Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
mg
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
25 ms
·
331.
▲
by
mg
2y ago
Why wouldn't one be able to tell syntax highlighters and code checkers that the string that goes into the html.something() functions is html?
332.
▲
by
mg
2y ago
What is the benefit of mixing js and html? el = <button>Click me</button> as HTMLButtonElement; What would be the downside of el = html.button('<button>Click me</button>'); ? Tha
333.
▲
by
mg
2y ago
Probably. It is part of Pyodide, not something this PyScript project adds: https://pyodide.org/en/stable/usage/quickstart.html#accessin...
334.
▲
by
mg
2y ago
The homepage left me confused, and also after reading the documentation, I'm not sure what this is. I tinkered a bit to try it myself. Turns out you can throw this into your website and it will display "Hello World": &l
335.
▲
by
mg
2y ago
When I start a new project, the data structure usually is a "list of items with attributes". For example right now, I am writing a fitness app. The data consists of a list of exercises and each exercise has a title, a description,
336.
▲
by
mg
2y ago
That's what I meant. It tries to access a global variable 'y' and fails because there is none. See also: https://x.com/marekgibney/status/1817495719520940236 and https://x.com/marekg
337.
▲
by
mg
2y ago
Interesting. As I understand it, it will not affect my example: def f(): exec('y = 7') # will still create a local variable print(locals()['y']) # will still print this local variable print(
338.
▲
by
mg
2y ago
Yes, I stumbled across this quite recently: https://x.com/marekgibney/status/1817495719520940236 I was surprised that you cannot access dynamically created local variables even though they exist. Looks like the lo
339.
▲
by
mg
2y ago
I think you still need to do the templating in PHP, because you usually want to escape html chars. And because you want to seperate code and layout. Having "Hello <?=$name?>" in the template is usually not what you want. It
340.
▲
by
mg
2y ago
Interesting! Same here. Also with pypy3, putting it in a function about doubles the speed: time pypy3 min_in_function.py 4999874750 real 0m0.045s
341.
▲
by
mg
2y ago
I wouldn't say you are a stickler. But the most productive addition to the discussion would be to do the benchmark as you see fit and then show us the results.
342.
▲
by
mg
2y ago
Yes, it is CPython. Added data on the PyPy performance to this comment now: https://news.ycombinator.com/item?id=41199431
343.
▲
by
mg
2y ago
You might be right about the min() call being the major penalty. When I avoid the min() call like this ... min2.py: i = 10_000_000 r = 0 while i>0: i = i-1 if i<500: r += i else : r += 500
344.
▲
by
mg
2y ago
Reading this, I was interested to see how big the speed difference between Python and PHP is these days, so I tried it like this: min.py: i = 10_000_000 r = 0 while i>0: i = i-1 r += min(i,500) print(r
345.
▲
by
mg
2y ago
Which Raspberry Pi would one need to run Vim and Firefox? And is it possible to have it use a tablet as a monitor and draw power from it? That would be everything I need to develop web applications. I wonder if I could use a 3-piece setup t
346.
▲
by
mg
2y ago
A friend of mine has an expensive 15-inch Dell laptop. He does not know much about tech specs, but since much of his work life revolves around his laptop, he simply bought the maxed out version. In the hope it makes his life easier. In the
347.
▲
by
mg
2y ago
That is why people these days tend to use a single JSON blob instead of multiple columns. And because it is so popular, SQLITE and other DBs are building better and better JSON support into the DB. I wonder if better support of EAV tables w
348.
▲
by
mg
2y ago
Markdown:  RST: .. image:: example.jpg :alt: alttext The author prefers RST because: ... you can extend Sphinx with new text objects! Say you that instead of an <image>, you wan
349.
▲
by
mg
2y ago
The analogy I would make is that living in the command line is like using a CAD program while living in IDEs is like using CorelDraw to design houses. CorelDraw feels more efficient because one quickly has what looks like a beautiful, color
350.
▲
by
mg
2y ago
The command line is still king. Whenever I see new coders struggle, it usually is because they: - Don't know the context of what they are executing - Don't know about the concept of input and output On the command li
351.
▲
by
mg
2y ago
I also have the feeling that there is a good chance Tesla cars built in 2024 won't become robotaxis. But that is a different question. My guess is about the first car using Tesla software to offer commercial rides. No matter when it wa
352.
▲
by
mg
2y ago
It seems the focus of Tesla has mostly shifted to operating robotaxis. What is everybody's guess when they will have the first robotaxi on the road somewhere, offering rides without a safety driver? Could be interesting to look back in
353.
▲
by
mg
2y ago
Every time I change a ULR (or a set of URLs), I put a test for the redirect into my end-2-end tests, which run once per day. So I know all my URLs will work forever. I have not thought about it for years now. Just checked for my first ever
354.
▲
by
mg
2y ago
Awesome! That's pretty much how I make websites up to this day. Later, if it grows, I usually add a stylesheet file to separate content and layout. Then I sometimes add some JavaScript. Then I sometimes add some backend storage and pro
355.
▲
by
mg
2y ago
What exactly does it mean that we "have the language to know"? And how do you prove it? How does the cog's reply in my last comment not match your definition and proof? In my experience, when you try to define and prove it in
356.
▲
by
mg
2y ago
Is there a difference between panpsychism and the idea that consciousness is just a post hoc justification? To me they seem the same. When you say "3 stones make a trio of stones" you don't mean that a "trio" existe
357.
▲
by
mg
2y ago
Yes, I would say every system has self-awareness. You say "reasoning" is needed. Ok, but how is that defined? Say you "ask" the cog why it turned by rattling it. Then it will rattle the other cog and, therefore, point yo
358.
▲
by
mg
2y ago
Hey, I run two somewhat popular music recommendation websites, the Music-Map and Gnoosic. I currently experiment with the ability to feature the music of artists, so I have put your music up on Gnoosic: https://www.gnoosic.com&#x
359.
▲
by
mg
2y ago
I have the feeling that self-awareness is inherent in every system. When a flower gets more sunlight from one side than from the other, it starts to turn to that side. Is that different from a person who walks somewhere because they like to
360.
▲
by
mg
2y ago
#linux has 2198 users right now. That might be the largest. What is everybody's favorite channel? I find #python pretty good (1501 users!). Also #debian, #php, #javascript, #math and #statistics. #startups was great in the past but is
More ›