Better HN
topnewbestaskshowjobs
Log inSign up

GrumpySloth

4,901 karma · joined Sep 13, 2020 (6y ago) · 1,641 submissions

Submissions

comment 5y ago · link · parent

The second zip had 109 bytes.

comment 5y ago · link · parent

> How do you read a zip file?

> This is undefined by the spec.

> There are 2 obvious ways.

> 1. Scan from the front, when you see an id for a record do the appropriate thing.

> 2. Scan from the back, find the end-of-central-directory-record and then use it to read through the central directory, only looking at things the central directory references.

I was recently bitten by this at work. I got a zip from someone and couldn't find inside the files that were supposed to be there. I asked a colleague, and they sent me a screenshot showing that the files were there, and that they didn't see the set of files that I saw. I listed the content of the zip using the "unzip -l" command. They used the engrampa GUI. At that point I looked at the hexdump of the file. What caught my eye was that I saw the zip magic number near the end of the zip, which was odd. The magic number was also present at the beginning of the file. At this point I suspected that someone used cat(1) to concatenate two zips together. I checked it with dd(1), extracting the sequence of bytes before the second occurrence of the zip magic number and the remainder into two separate files. And sure enough at that point both "unzip -l" and "engrampa" showed the same set of files, and both could show both zips correctly. Turns out engrampa was reading the file forwards, whereas unzip was reading the file backwards.

comment 5y ago · link · parent

IME most external hard drives and USB sticks are marketed as compatible with both Windows and Mac, and ship formatted with FAT32. But maybe I'm the odd one here.

comment 5y ago · link · parent

> NTFS is the de facto filesystem for portable data storage

I thought it was FAT32. Do Macs support NTFS?

EDIT: It seems they don't out of the box: <https://www.howtogeek.com/236055/HOW-TO-WRITE-TO-NTFS-DRIVES...>

EDIT 2: Since many comments replied with the same thing, I'll reply here: I wouldn't consider read-only support as support for portable data storage, since that allows you only to send data in one direction. When you want to copy a file from a Mac to a Windows computer, NTFS is not a solution now (out of the box at least), therefore falls pretty short wrt "portable".

comment 5y ago · link · parent

Go's design was influenced by Oberon (without "+") because of one of the three original Go designers, Robert Griesemer, who did a doctorate under Niklaus Wirth (designer of Oberon).

comment 5y ago · link · parent

A study of the frequency of memory corruption in rust programs would be useful here. If the real-world frequency is let's say <0.1% of bugs uncovered, then I say this mindset is a blessing. Working with C++ the feeling of paranoia you have with 1/3[1] of bugs reported, that maybe again it's memory corruption, is sucking the energy out of developers.

[1]: That's the frequency of this paranoia creeping in that I observed, not of detected memory corruption, but that too I think would be counted in an integer number of percents IME.

comment 5y ago · link · parent

Do Mac apps stay functional for long without work put into maintenance by their developers, with all the breaking changes introduced by Apple?

comment 5y ago · link · parent

More accurate title: Why The British Don't Refrigerate Eggs but Americans Do.

As evidenced by a lot of comments here and my own experience in an Eastern European country.

comment 5y ago · link · parent

You don't need any geometry to define pi. At uni, I had it defined as the smallest positive zero of sin(x). And sin(x) was defined axiomatically (in terms of real analysis) in conjunction with cos(x) (and then shown to be equal to its Maclaurin expansion).

comment 5y ago · link · parent

> He believes Hollywood is to blame for giving dinosaurs their skeletal 'monster' image.

I don't think most dinosaurs are seen as monsters. When it comes to public relations "monsters", I think it's mostly T-Rex, and usually it isn't portrayed as skeletal. Depictions of most dinosaurs make them look cute.

comment 5y ago · link · parent

This is the entire point of this command. It will update the rev attribute. What else would it be for?

comment 5y ago · link · parent

That's the primary method of turning embedded devices on and off though. :) During development it's done around the clock and noone bats an eye. Rule of thumb: if a device doesn't have a power button, it's fine to turn off using the power strip.

comment 5y ago · link · parent

Made me think of The Trial, by Franz Kafka: <https://gutenberg.org/ebooks/7849>

Or bullshit jobs.

comment 5y ago · link · parent

When one side sends data at 1Gb/s and the other receives at 100Mb/s, it's worse than if the first side sent data at 100Mb/s. Here's a description from Julia Evans: <https://jvns.ca/blog/2018/07/12/netdev-day-2--moving-away-fr...>

Basically my ISP router would receive data at full speed, while internally I would have a lot of dropped packets.

Additionally, I usually use the web browser to view Jira or copy files over NFS during calls, and I'm sure there are some background apps contributing to the traffic as well.

The one thing that fixed all my problems was reconfiguring the network driver to set 1G bandwidth on my NIC instead of the 100M that it set automatically. Yeah, Linux Desktop problems...

comment 5y ago · link · parent

> But even if, why do you keep your power efficient router running 24/7? You could turn it off when you're not home to save even more energy.

You jest, but I turn off my router for the night and each time I leave home for more than a day. Not just router to be exact, everything that's connected to a power strip goes down, as I turn off all the power strips. (Not OP.)

comment 5y ago · link · parent

I work from home and regularly need to download large files from work servers. Several months ago I noticed that my internal network was 100Mb/s, which was dreadful. Downloads of 500MiB files would take tens of minutes, because Tomcat would drop connections on such a slow download. And even without dropped connections it generally took a long time to download anything, and Zoom call quality was regularly degraded (I sometimes heard my colleagues as androids and vice versa). I fixed the issue and now I get the full 700M/s that my ISP offers (and 1G/s internally over a Netgear switch for NFS transfers). I could get a 1G/s, but it would cost me more and 700M/s is fine for the most time. But sometimes to get a shorter feedback loop on what I'm doing I could imagine getting a 5G/s. I think it would be optimal. But 10G is clearly overkill.

comment 5y ago · link · parent

Changelogs for different components are linked, titled "release notes" instead. However, the ones for 12.0.1 seem not to have been updated for this release and are the same as for 12.0.0.

comment 5y ago · link · parent

"cargo update" will update the packages along with Cargo.lock content. As for not updating them without a manual trigger, I consider it a feature, but I guess it's a matter of opinion.

comment 5y ago · link · parent

> As for Cargo, [...] I also found it unusable because it provided no way to check for the hash or signature of the dependencies that it downloads.

Afaik Cargo does it out of the box, based on Cargo.lock.

UPDATE: This doc page seems to confirm that: <https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lo...>

comment 5y ago · link · parent

What do embedded projects in US use instead?

comment 5y ago · link · parent

Is that a reference to a book I don't know?

comment 5y ago · link · parent

Although Rust compile times are rather bad, IME such astronomical compile times are rather a result of terrible code quality, a lot of code doing essentially nothing, just gluing glue, to the point where it's normal to get a 50-60 frames deep stack trace with most functions being named such that it would suggest that all of them do basically the same. Then you look at their bodies and... yep... doing the same, aka nothing.

With Rust, procedural macros add a lot of overhead when compiling, so I try to avoid them.

At work, we have a C++ project which, without using distributed builds with distributed ccache, running on powerful cloud computers, takes 3h+. Code quality is adequate. Debugging anything is a nightmare in such a codebase.

comment 5y ago · link · parent

I am happy everyday. It's far from fleeting. I don't have, nor am I going to have children. Maybe we understand "happiness" differently?

comment 5y ago · link · parent

> The output of a machine simply does not qualify for copyright protection – it is in the public domain.

Does it mean that compiler output does not qualify for copyright protection and I may legally share copies of MS Word via torrent?

comment 5y ago · link · parent

This is one of very few things that I envy USA.

comment 5y ago · link · parent

You don't need an account to use a Mac or iPhone. You need an account to use App Store (duh), but you don't need to use the App Store, especially on Mac, where applications are mainly installed without using the App Store.

comment 5y ago · link · parent

> if something was so unequivocally better then wouldn't this perhaps resulted in a massive adoption rate

That's not what we see happen in life. Just look at how dearly we hold on to coal plants. My country's energy is 90+% coal-based and there is an insurmountable opposition to atom, and great suspicion against solar (government recently started financially deterring against mounting solar panels).

comment 5y ago · link · parent

Compiler optimizers also optimize only the generated code, but not the data structure layout, which is usually what matters most.

Also, compilers often can't optimize stuff which is obvious to humans. E.g. here is an example of GCC not being able to delete useless code: <https://godbolt.org/z/655KeM33Y> (it's fixed in later versions of GCC, but this version of GCC also isn't that old). Another example is Clang emitting useless code out of nowhere: <https://youtu.be/R5tBY9Zyw6o?t=1620>. So, it's not out of the ordinary for compilers to be really stupid about the assembly they generate.

1
454647
55