HNHacker News
TopNewBestAskShowJobs

phaker

373 karma · joined May 30, 2011

submissionscomments
phaker··on Zsh and Fish’s simple but clever trick for highlighting missing linefeeds
Woo! I have the same trick in my .bashrc, love to see it spread.

If you can, please add a note that if you want to add it to bash you _have_ to use an echo/printf from PROMPT_CMD, if you add it to PS1 bash's (or readline's?) own logic will get confused as to how long the prompt is and what column the cursor is at.

(If anyone wants to try it, personally the only caveat i noticed is that when you copy a command from the terminal window any spaces not overwritten by something else will appear in the output.)

phaker··on Unicode 13.0
Down for me as is everything else.

Found a unicode consortium tweet (!) with a picture of the whole block:

https://twitter.com/unicode/status/1085613123183071232?lang=...

phaker··on Draft of the Fast.ai Book
After reading that section of the book i think the language property you're after is 'highly synthetic':

https://en.wikipedia.org/wiki/Synthetic_language

There's a spectrum between synthetic and analytic languages ( https://en.wikipedia.org/wiki/Synthetic_language#Synthetic_a... ) and those closer to the synthetic end are the ones giving you trouble.

Polish will be subtype of synthetic called fusional/inflected which means things need to be adjusted to fit together, agglutinative languages are those that use mainly agglutination where morphemes are stuck together as is:

https://en.wikipedia.org/wiki/Agglutinative_language

Since it's a spectrum / categorization based on features, all languages will show these features to various degrees. E.g. the famous "anti|dis|establish|ment|ari|an|ism" in english and "anty|samo|u|bez|przedmiot|owia|nie" as a similar example in polish (both from https://pl.wikipedia.org/wiki/Aglutynacyjno%C5%9B%C4%87 ), or more humble "houseboat" or "bitwise".

There are also polysynthetic languages, which is the name for the extreme of this spectrum, but there are no familiar examples of these (Mayan languages, Ainu, Inuit, Aleut are only i recognize from those mentioned on wikipedia).

phaker··on Hanging the Linux core dump pipe helper
In re the 'and nothing improves' sentiment at the end: there _is_ a safety limit and it's even documented in dump(5):

/proc/sys/kernel/core_pipe_limit

When collecting core dumps via a pipe to a user-space program, it can be useful for the collecting program to gather data about the crashing process from that process's /proc/[pid] directory. In order to do this safely, the kernel must wait for the program collecting the core dump to exit, so as not to remove the crashing process's /proc/[pid] files prematurely. This in turn creates the possibility that a misbehaving collecting program can block the reaping of a crashed process by simply never exiting.

Since Linux 2.6.32, the /proc/sys/kernel/core_pipe_limit can be used to defend against this possibility. The value in this file defines how many concurrent crashing processes may be piped to user-space programs in parallel. If this value is exceeded, then those crashing processes above this value are noted in the kernel log and their core dumps are skipped.

A value of 0 in this file is special. It indicates that unlimited processes may be captured in parallel, but that no waiting will take place (i.e., the collecting program is not guaranteed access to /proc/<crashing-PID>). The default value for this file is 0.

(edit: in case if that came off as curt i didn't intend it to, i do agree that far too many things suck because "it's documented in a defunct mailing list somewhere and if you don't know it's your own fault")

phaker··on Android Wear, it’s time for a new name
Adding insult to the injury the thumbnails in the footer are 2800px-wide. The web developer used srcset but every resolution links to the largest image. And they're PNGs not JPEGs, despite the url implying otherwise. Together they weigh 19.5MB, >99% of total page size.
phaker··on Guetzli: A New Open-Source JPEG Encoder
Do you have / plan a paper describing butteraugli itself?

It seems like that's where most of the magic lies. Also peculiarities of human vision are one of my oddball interests, after compression of course. :)

phaker··on Do not let your CDN betray you: Use Subresource Integrity
Maybe use ETag or a similar mechanism? This way we'll need to contact the server, but we save bandwidth that would be spent resending the resource, which is still faster than what we have.

Given something like this:

    <script src="https://code.jquery.com/....." integrity="sha384-R4/....." shared>
(where 'shared' invokes the caching mechanism)

The browser sends a request for it with If-None-Match: "sha384-R4/....." header set.

I think this solves 99% of the problem:

If the integrity tag doesn't match the ETag of the resource, the server interprets it as out-of-date cache and responds with content of that resource. If the integrity tag matches the ETag of the resource, it will respond with '304 Not Modified'.

And that's the remaining 1% of the attack surface: basically the attacker wins iff the site can be tricked into serving a resource with the same ETag as the hash of his payload. We don't need to worry about collisions: even if someone uses ETags that match the form of subresource integrity tags without intending to, the attacker would still need to generate a collision, which is just as hard as finding a collision with any other hash. But if there are servers out there that will serve files with externally-set ETags then they'd be exploitable.

phaker··on A9ChipSource: small open-source iOS utility to identify A9 foundry
Now this is interesting, had to dig it out:

Free On-Device Development

Now everyone can run and test their own app on a device—for free. You can run and debug your own creations on a Mac, iPhone, iPad, iPod touch, or Apple Watch without any fees, and no programs to join. All you need to do is enter your free Apple ID into Xcode. You can even use the same Apple ID you already use for the App Store or iTunes. Once you’ve perfected your app the Apple Developer Program can help you get it on the App Store.

See Launching Your App on Devices for detailed information about installing and running on devices.

( From the feature list for xcode 7 — https://developer.apple.com/library/prerelease/ios/documenta... )

My theory was that the whole developer key thing was a very effective piracy countermeasure — registering and paying $100/year (iirc) is expensive and inconvenient enough that it's easier to just buy things. What has changed?

phaker··on My Love-Hate Relationship with Stack Overflow
I'm afraid that many of the people you'll find in meta are the "soup nazis" the article complains about.

Any community is a sieve. It takes effort to join and the more you get involved the more time and effort it consumes and at every step someone gives up and drops out. The meta subsite is not easy to stumble into, very few people will have any questions to ask there and very few will have a good answer to contribute so it takes a lot of effort to get there. That means that the crowd that hangs out in meta will be very different from the bulk of SO/SE.

Several meta discussions were linked by ircmaxell above and another was posted in the r/programming discussion - http://meta.stackoverflow.com/questions/286299/closing-quest... - so let's take a look: those of questions that are expressing disagreement with how things are run (that cv-pls is a bad idea and that often questions are closed when they shouldn't) are currently at -20, -14, -24 and -13 points. But let's ignore the votes and look at the answers: the absolutely overwhelming consensus is that everything is right an nothing should be done. I'm not saying that "they" are wrong and "we" are wrong, just take note that there's zero overlap in opinions expressed here and there.

phaker··on Microsoft announces Project Spartan, its new web browser for Windows 10
Webkit was called called a fork of khtml, if that was a fork then so is this.
phaker··on Scroll Slow. Have Fun
It's because of these horizontal bars, you can get the same effect with similar graphics:

All video interfaces we use transmit data serially, line by line, pixel by pixel. The bars are 16px tall (black + white) so at 60Hz and 1920×1080px they'll produce a tone with fundamental frequency of 4.05kHz (60Hz × 1080 lines / 16 lines) and harmonics.

phaker··on Gallery of Processor Cache Effects
What processor is it? Or at least: how old is it?
phaker··on [dead]
This isn't someone sharing their experience publicly, but a copy-paste from Microsoft's internal mailing list, see the note at the top:

The following has been making the rounds on just about every internal email list I belong to in Microsoft. Here it is to share a little insight with the rest of the world. Microsoft is an amazingly transparent company. Google is not. Any peek is a good peek.

So those are Microsoft employees upset about public airing of only semi-public laundry. I wouldn't mind if i wrote something like this and someone put it online, but i can see that someone else might.

phaker··on Welcome, cryptanalyst
Look at the response body, the 403 i got had a nice html error message attached.
phaker··on Welcome, cryptanalyst
If anyone involved is reading this -- please make the timer a bit more obvious. I opened the link, went back here, then made a quick wikipedia safari and when i got back to it timed out with no indication that i can restart it. :(

edit: The console could use a little error checking, if the request dies (i had referrer disabled), it prints "requesting xxxx..." and then nothing. Tsk, tsk :)

phaker··on What happens if you write a TCP stack in Python?
Some guy actually did it on a 20MHz avr: http://www.cesko.host.sk/IgorPlugUDP/IgorPlug-UDP%20%28AVR%2... (hope the url doesn't get borked).

Sadly 10BASE-T ethernet uses manchester coding, so you need 20MHz :( you could pull it off with a slower processor if you had a fifo that can reach 20Mbaud on the serial end, but the usart in avr micros runs at a fraction of the system clock.

phaker··on Judge rejects $324.5M settlement over Apple, Google hiring
The thing that irks me the most is not the practice itself. My problem is with everything else in that post.

Note that he has not described it as a morally ambiguous but sometimes unavoidable choice (like you did) but as the most righteous and noble option. That he's openly admitting he knows that it's illegal. Pay attention the sugar-sweet language of his parable and how its tone gets more colorful whenever the story takes a darker turn (from pov of the employee).

I mean, this entire thing is something out of a dilbert strip. I'm serious. This is something you'd expect Dilbert's CEO to write. The self deceit, the contrast between the language of "hurt feelings" vs the unstated reality of a person getting fired as a consequence and the stupidity of it all are mocked in hundred different Dilbert strips. Remember when this wage fixing story surfaced and the surprised comments that they were stupid enough to put it in email? If Mr Horowitz ever gets in similar trouble the paragraph i quoted above will make these troubles a lot worse.

phaker··on Judge rejects $324.5M settlement over Apple, Google hiring
Seems taken out of context.

In a [post] on his blog Horowitz describes a scenario in which a person currently employed at a company that is "important" to you comes in for an interview. The recommended course of action is to 1: block the hire, 2: inform said company about it. There are two things i just can't agree with at all:

* The part about informing the current employer: about 50% of the time it will end with ruining the next few weeks or months of his/her life. I.e. getting them fired, with ruined prospects of getting the job they took the risk for. Note that at e.g. apple the standard procedure when they find out that an employee is looking for a job is to escort them out of the building right then and there.

* Note it's not about "poaching", he explains thoroughly that it applies to people who ask for an interview on their own accord too.

If you don't want to read the whole thing, at least read this gem:

It is important to note that just about all of these kinds of policies violate the Right to Work laws in California. Specifically, if you block a hire based on this kind of policy and the employee loses their job and cannot find work, your company is liable for his wages. As a result, the business relationship with the other company must be extremely important for you to employ any kind of “hands off” policy.

said blog [post]: http://www.bhorowitz.com/is_it_ok_to_hire_people_from_your_f...

phaker··on Disable Visited Links for Firefox
Most of that 40kB is eaten up by three icons. The actual code is 13 lines long:

https://github.com/ChrisAntaki/visited-links-firefox/blob/ma...

(plus a 14 line manifest file, 12 lines of test boilerplate and a 10 line readme)

phaker··on Ada, C, C++, and Java vs. The Steelman (1997)
> It should be noted that the free version of said compiler may only be used to produce software released under a GPL compatible license.

No. No. No.

GCC GNAT is under GPL 3 with GCC runtime library exception, the same license as the rest of GCC.

Before GPL 3 it was licensed under GMGPL -- GNAT Modified GPL, which was very similar to the the current license as the "runtime library exception" is intended to unify similar exceptions from several GCC compilers, for example if you're using C++11 on GCC you are bound by the exact same license.

I'm sorry if i'm not as nice as I could be. Every time Ada is mentioned someone chimes in with mythical license woes. You're doing harm by spreading misinformation. This myth needs to die.

phaker··on Learn Git in the Browser
Do you mean you get '+[m' instead of '+' in front of an added line? If so, this looks suspiciously like ecma formatting escapes (\e[XXXm).

Try if calling git diff --no-color, if this helps then something is broken on your setup. Another way i could see that happening is if you have color set to 'always' and then use some app that wraps git's command line output.

phaker··on DEC64: Decimal Floating Point
Said reference implementation is written in x86 assembly. 1261 lines, 650 lines sans comments and blanks.

To be fair it is extensively commented, but the comments describe what it does, not why. And for fuck's sake, hundreds of lines of assembly is not a spec, even if it is most readable code in the world

phaker··on Keyboard Ghosting Explained
It's not just that. USB nkro keyboards can fail in several interesting ways, so they earned a bad reputation. Paradoxically the hacks that work around the standard (e.g. a keyboard reports as several devices behind a usb hub) are more reliable, so many keyboards use that instead.

There are several cases of driver bugs you have to work around and ignoring driver bugs, it's just generally much harder than it should be (which means more device bugs):

* USB HID specifies two interfaces: the full report interface and a simplified "boot interface" that lets you avoid parsing interface descriptors. The boot interface supports only 6 keys, low speed and it's supposed to be used by bioses etc. Some host devices (like TVs) use the boot interface, those can't support more than 6kro.

* A USB device can specify several interfaces, the host selects which one it'll use to talk to it. For HID devices the boot interface (if supported) has to come first. The problem is that sometimes the first one is selected as it's the "default" one. It's not really supposed to happen but when it does, you can't have more than 6kro.

* The number of simultaneous keys a keyboard (one of its interfaces) can report is specified in its interface descriptor. The USB HID spec contains few sentences that can be easily misunderstood to mean that if a keyboard can report more than simultaneous 6 keys, it doesn't support the boot interface. Some bios writers read it that way, so if you have a fully compliant keyboard with nkro, it will fail on some (buggy) bioses.

* USB specifies low-speed (1.5Mbit/s) and full-speed (12Mbit/s) operation (2.0 adds high speed and 3.0 adds super speed). At low speed the payload length of the interrupt frames the HID devices use are limited to 8 bytes, which limits them to 6 keys (one byte is used for modifiers, one is reserved) for one frame messages. It's possible to chain multiple frames per message, but some OSes don't support that. This means that a nkro low-speed keyboard will (on buggy oses) have only 6kro.

* A way to work around the last problem is to make a keyboard that uses the full-speed interface. The problem is that one some systems this fails hard (the keyboard doesn't work at all).

(source: I wanted to make my own dream keyboard. The existing USB HID device implementations i could find had various limitations so I decided that i'd make my own one. I mean, hey, how hard could it be?)

phaker··on DigitalOcean Raises $37.2M From Andreessen Horowitz to Take on AWS
> update packages and the kernel

PSA: If you just update the kernel using system tools within the instance, it'll still boot the old one. (At least it did few months ago.)

The grub (or other bootloader) and kernels that are installed inside the instance's disk image are silently ignored and the vm uses a kernel stored outside of your instance's image. You can select which kernel image you want to boot in the control panel. The problem is that the kernels available in there are updated very, very rarely. For popular distributions like Ubuntu they can lag several months, for others it can get up to, say, _two years_ [1].

Since digitalocean "doesn't support custom kernels" it appears that the only way to use something up to date (and stay secure) is to write a script that loads a custom kernel using kexec. :S

edit: The fact that they use kvm (and that kexec works) which means real visualization but can't boot user's kernels is just very, very weird. The only technical reason i can think of is that they can't manage to make it work with their control panel. If that's the reason, then it's very worrying. (The "right" way is easier to code and it's the solution that you'd think of first and it makes custom kernels a non-problem, but they picked one that both has obvious problems and is harder to setup, i can't think of a reason why.)

[1]: https://www.digitalocean.com/community/questions/how-can-i-b...

phaker··on CSS usage metrics
Offtopic: Scrolling is broken/disabled, someone put overflow: hidden; on the main content element (section#panels). Either way killing that rule fixes it with no ill effects.
phaker··on Introducing our smart contact lens project (for diabetics)
She posted here first, before she responded to your post (and likely before she read it).
phaker··on Docker: The good parts
This looks like the font file you're using lacks some rendering hints (all points that touch the median line should be annotated as such, it looks like they aren't).

Another version of the same font or the same font from another source may work. Webfont sites often try to tweak the hinting tables, they're trying to make the fonts look better but it breaks stuff all the time.

phaker··on Awful app review trend among Turkish users
This post is a little like programming pop science: an entertaining read, but greatly overstates some small result. The only Turkish-specific problem he mentions is case folding of ı/i. This is a problem unique to Turkish, there are other problems in case folding, like eszett (ß/ss) in German but these are much less likely to trip you up.

The US date format (m/d/y) is used virtually only in US, most other places use d/m/y or y/m/d. -- http://en.wikipedia.org/wiki/Date_format_by_country#Map

Re dots for thousands separators -- the world is split about roughly evenly on this, with all of europe (except for Great Britain and Ireland) using commas for decimals dots for thousands separators. -- http://en.wikipedia.org/wiki/Decimal_mark#Hindu.E2.80.93Arab...

phaker··on Very funny, gdb. Ve-ery funny
This is called application or process checkpointing. There are/were lots of attempts to get it working under linux, some are more some less complete. It was a hot topic several years ago, but the interest sort of fizzled out since then because virtual machines sovle the same problem. A vm has more overhead but freezing a vm is also much more reliable.

This wikipedia article mentions few approaches: http://en.wikipedia.org/wiki/Application_checkpointing

This page has many more projects, though most are probably dead by now: http://checkpointing.org/

Both are incomplete, googling "linux checkpointing" returns things not mentioned in either, like https://ckpt.wiki.kernel.org/index.php/Main_Page

phaker··on Yotaphone
There's a hint? I still can't find it.

No, I'm not trolling. No indication that scrolling does anything, there's even a footer at the bottom of the page. Then _when_ i scroll nothing happens for a while until i scroll far enough.

← PreviousPage 2 of 4Next →