HNHacker News
TopNewBestAskShowJobs

philo23

862 karma · joined February 15, 2011

submissionscomments
philo23··on Exploring Coroutines in PHP
Genuine question, what kind of problems would using fibers help with?

To be clear, my point wasn’t that I think fibers are useless or that people shouldn’t use them. I think it was a great addition.

Just that they wouldn’t be directly useful to the average PHP dev, until they’re being used by frameworks/libraries/extensions, say for example: a HTTP library that can fire off multiple requests asynchronously.

philo23··on Exploring Coroutines in PHP
Personally I've never come across any problem in PHP that I feel like Fibers would help me solve.

Having Fibers in PHP is a nice addition but it definitely feels more like plumbing for other PHP extensions/frameworks to use, rather than something the average dev would use themselves directly day to day.

philo23··on Making Beautiful API Keys
A bit off topic, but on the copying issue with dashes, you can wrap the whole key in a span styled with “user-select: all” to improve the copying experience. Well, on the web at least!
philo23··on Adobe's new image rotation tool is one of the most impressive AI tools seen
I don't think quite the same kind of tech, but this kinda reminds me of the "3D" pixel art sprite editor thing in Smack Studio

https://youtu.be/sM3ss-lY1zU?t=10

philo23··on More annoying macOS 15 Sequoia prompts: Bluetooth
I'm fairly certain this isn't new in macOS 15, I could have sworn I've seen this on 13 + 14
philo23··on Sanding UI
Well with the CSS in the post they would end up as wide as their parent. If you made it an inline flex box then yes, that wouldn’t be an issue.

> You can scroll on mobile by swiping over the text of a label itself without activating the input; this isn't generally a concern.

Generally speaking yes, but there’s still a chance of triggering it by touching the whitespace by mistake. Whereas if it wasn’t the full width it just wouldn’t be possible to begin with.

philo23··on Sanding UI
> However, wouldn't putting the input inside of the label (before the label text) be a better solution

The one potential downside to doing it the way you describe is (assuming the same CSS flexbox layout) now all the white space on the right side of the label acts the same as clicking the radio/checkbox. Which is almost like the opposite problem to the original issue.

This might actually be a good thing for some designs/contexts, but not always. For example, on mobile it might lead to miss-clicks while trying to scroll past the <label>s

philo23··on Styling Tables the Modern CSS Way
border-block (and border-inline) are new ones for me!

Also it might be worth mentioning position sticky on table rows/sections don't work yet in Firefox unfortunately :( but hopefully soon...

philo23··on My daughter (7 years old) used HTML to make a website
Wait until you find out how we used to change the colour of links!
philo23··on Show HN: Use Go's HTML/template to write React-like code
Yep, the HTML5 spec has an agreed on way to parse and interpret invalid HTML, so all modern browsers should handle it pretty consistently.

I was more interested in finding out where this style had come from really, because I've seen a lot of devs doing something similar and semantically it's just always struck me as a bit odd looking!

philo23··on Show HN: Use Go's HTML/template to write React-like code
> I used this approach mainly to have the button component behave as a link button and a form submit button.

Personally I think the "proper" way to do this would be use just <a> for links, and <button> for submitting forms, and then have the same CSS styles applied to both so that both <button>'s and <a>'s look the same visually if that's what you're going for.

I'm not particularly familiar with Go, but I'd either make the wrapping tag name itself a template variable (maybe an enum between "Anchor" and "Button"? again not familiar with Go) or have two components one for forms and one for links. If I've understood the syntax, something like this?

    <{{.Tag}} class="button-container"></{{.Tag}}>
But given both <button>'s and <a>'s have lots of different attributes to manage its behaviour and state (name/value/type/disabled vs href/rel/target etc) I'd personally split them into two separate components, even if it ends up doubling up some of the logic and styles.

> What are the drawbacks of this approach? I'm pretty sure I've used this before, can't recall any downsides.

As others have mentioned, while it's technically invalid browsers will still happily accept it so there's no real issue with it, personally I just find it a bit quirky to read. There's no harm in leaving it just as it is :)

philo23··on Show HN: Use Go's HTML/template to write React-like code
A bit off-topic, and maybe it was just an example made without too much thought put into it, but I've noticed there seems to be a lot of people now who write button/links like this:

    <button><a href="/blah.html">My Button</a></button>
As far as I know that's technically invalid HTML. You can't have an <a> as a child of a <button> (or even the other way around.) I'm also ignoring the invalid type="submit" against the <a> tag in the example button component in the post.

I think it stems from people who want their links to take on the default button styling, but I'm not 100% sure. Has anyone else noticed this trend at all?

philo23··on NoTunes is a macOS application that will prevent Apple Music from launching
I vaguely remember reading about this issue in the past, it’s actually down to the way the software running in the cars radio is using a backwards compatible “iPod” integration. It effectively (against Apple’s recommendations) sends a “play music” signal as soon as you connect your device.

Well behaved radios don’t send that signal immediately, and instead wait for you to hit play on your device, or on your cars radio/stalk.

philo23··on Meta Horizon OS
I think the mention of Steam will be to do with the Steam Link app they released for Meta quest devices fairly recently that lets you stream your VR games from your desktop computer to the quest wirelessly https://help.steampowered.com/en/faqs/view/0E2C-406B-9135-38...
philo23··on Tell HN: How an elderly couple I know had their computer 'stop working'
I’m pretty sure macOS does warn you that turning Bluetooth off will disconnect your keyboard/mouse/trackpad, if thats the only input device you’ve got connected.

Not sure when it was introduced but it’s definitely there on the latest version because I bumped into it the other day.

philo23··on Show HN: Tailspin – A Log File Highlighter
Brilliant, this looks like exactly what I want. I already use ripgrep a lot, so I should have guessed it had this feature already but wouldn't have known what to search for to find it! Thank you
philo23··on Show HN: Tailspin – A Log File Highlighter
A little bit off topic, but I’ve always wanted a “simple” CLI tool that works exactly like grep (same flags and regex support), but rather than filtering the result, it just highlights the matches in the output.

I’ve not found anything like that yet though, closest I’ve come is using grep with the before/after/context flag with a high number of lines or using search in less, but I want to do something like...

    tail -f access.log | highlight ".jpg"
Maybe I’ve just not found the right flag for grep yet...

Edit: Thank you everyone for your suggestions, you've all been very helpful! And apologies again for hijacking the topic, tailspin looks very neat.

philo23··on Fighting API bots with Cloudflare's invisible turnstile
Interesting that both the client side API and server side API for Cloudflare's turnstile seem to match Google's reCAPTCHA nearly exactly, which works in pretty much the same way with the exception that you can't configure it to _never_ show a visual captcha (in rare cases the v2 Invisible reCAPTCHA will still show the "select all the X from the images below" dialog)

Even down to the API endpoint and JS API names.

  https://www.google.com/recaptcha/api/siteverify
  https://challenges.cloudflare.com/turnstile/v0/siteverify

  grecaptcha.render({ callback: function (token) { ... } });
  turnstile.render({ callback: function (token) { ... } });
As soon as I saw the examples I recognised the names, I guess it's designed to be a drop in replacement?

https://developers.google.com/recaptcha/docs/verify https://developers.google.com/recaptcha/docs/invisible

philo23··on TS to JSDoc Conversion
Originally Symfony did use comments (docblock style ones like: /* @Route ... */) for this kind of thing, but since PHP 8 they've moved towards using attributes [1]. The syntax of the attributes #[Route(...)] might look like a comment, but they are actually just valid bits of code you can pragmatically inspect through reflection [2] and then choose to run if you want.

Docblock comments can also be inspected with reflection [3] but have a much looser syntax, so it was up to you to parse them. Where as you can create a new instance of an attribute directly from the reflection object [4]

In your example Symfony uses it to build up the list of HTTP routes by looking through all your controllers for #[Route] attributes. Generally that's done once and then cached, at least in production.

Personally I try to avoid using them, but they're definitely not comments. More like metadata you can attach to classes/methods/properties/parameters then use however you want.

[1]: https://www.php.net/manual/en/language.attributes.syntax.php

[2]: https://www.php.net/manual/en/reflectionclass.getattributes....

[3]: https://www.php.net/manual/en/reflectionclass.getdoccomment....

[4]: https://www.php.net/manual/en/reflectionattribute.newinstanc...

philo23··on One line of code that did cost $8k
I'm glad I'm not the only one that thinks checking every 5 mins is a little bit excessive!

Seeing as it's macOS only is there even any reason to roll your own update mechanism when you can use the Sparkle framework [1]?

EDIT: after a bit of digging, it actually looks like it uses Squirrel instead [2]

[1]: https://sparkle-project.org/ [2]: https://github.com/Squirrel/Squirrel.Mac

philo23··on Why do ships use “port” and “starboard” instead of “left” and “right?”
I guess some could argue that we do have some special vocabulary for cars too.

E.g. you don't call it the front/back door, you call it the bonnet/boot (or maybe hood/trunk depending where you're from) though that probably is stretching the definition of a door a little bit... but then you also have nearside and offside for passengers/drivers side, though that's probably a bit more of a technical term.

philo23··on We need better support for SSH host certificates
This is a bit off topic, but does anyone know how the mechanism that triggers the web page prompt from an ssh connection actually works? Is it some kind of alternate ssh authentication method (like password/publickey) or something entirely out-of-band coming directly from the VPN app intercepting the connection?

Ever since I saw it in action with Tailscale I've always wondered how it actually works, and I guess if anyone would know they'd be on HN

philo23··on Primitive Technology: Iron Bacteria Cement [video]
Also if you turn on subtitles you'll get a bit more information on what he's actually doing and why.
philo23··on SwiftUI Is Convenient, but Slow
Some parts of the panes are also webviews too, which definitely doesn't help. From memory you can go in and inspect them from the Safari web inspector.
philo23··on Factorio runs on Apple Silicon
Judging from the graphs[1] it looks like they were running the x86 binary through Rosetta on the same M1 machines as the native M1 binary.

[1]: https://cdn.factorio.com/assets/img/blog/fff-371-ups-graph.p...

philo23··on Which emoji scissors close (2020)
I'm left handed but I've always used right handed scissors in my right hand. I can actually cut with either, but cutting right handed has always been more natural for me. Using the left handed scissors in my left hand requires more concentration.

The only real benefit I've ever noticed of left handed scissors is that when you hold them in your left hand, you can see the point on the paper where the blades are going to cut. Holding a pair of right handed scissors in your left hand (or vice-versa) obscures that point behind the top blade, making it a lot harder to make accurate cuts.

If you try holding a pair of regular right handed scissor in your left hand you should be able to see the issue of the top blade covering the part of the paper you want to cut. Which let me tell you, makes following dotted lines a lot harder in school if you're using them on the wrong hand...

That's the only difference I've ever come across anyway, not sure what other commenters are talking about with the paper turning sideways!

philo23··on Why rails buckle in Britain
Definitely the same kind of buckling. Here's an example from a couple of years ago in the news https://www.bbc.co.uk/news/uk-england-cumbria-44658254

Check Google images for some more extreme examples.

philo23··on Running the Steam Deck’s OS in a virtual machine using QEMU
I wish I could take credit, but back while I was waiting for my preorder I really wanted to try out the new UI and found the instructions originally here on reddit: https://www.reddit.com/r/SteamDeck/comments/t57l4t/how_to_ge... but if I had to guess how it was found, someone probably just checked that file on a steam deck or from it's recovery image image.

That file normally contains the name of the client beta you're currently opted into in Steam's settings (normally only "publicbeta" is the only public option) so it's probably the first place someone checked.

philo23··on Running the Steam Deck’s OS in a virtual machine using QEMU
A little bit off topic, but in case anyone wants to try out the new Steam Deck UI on their desktop you can do it without installing Steam OS, just follow these steps:

1) Quit Steam

2) Find the "package" directory inside of the main Steam install directory (typically C:\Program Files (x86)\Steam on Windows, ~/.steam/steam on Linux)

3) Inside there create a file called "beta" (no extension), with the following content: steampal_stable_9a24a2bf68596b860cb6710d9ea307a76c29a04d

4) Reopen Steam with the -gamepadui argument

Fair warning: it's a little bit janky when it's not running on Steam Deck hardware. At least it was when I tried it out, but it'll give you a pretty decent idea what it's like. Also to undo it just delete that file and relaunch Steam without the extra argument.

philo23··on Browser in the Browser (BITB) Attack
This is a super common phishing attack on Steam, people send you links that eventually lead to a "Sign in with Steam" button, which opens up one of these fake popups with a perfectly styled login page. Almost got me the first time...
← PreviousPage 2 of 6Next →