HNHacker News
TopNewBestAskShowJobs

SyrupThinker

241 karma · joined January 24, 2017

submissionscomments
SyrupThinker··on On File Formats
From my own experience SQLite works just fine as the container for an archive format.

It ends up having some overhead compared to established ones, but the ability to query over the attributes of 10000s of files is pretty nice, and definitely faster than the worst case of tar.

My archiver could even keep up with 7z in some cases (for size and access speed).

Implementing it is also not particularly tricky, and SQLite even allows streaming the blobs.

Making readers for such a format seems more accessible to me.

SyrupThinker··on Flattening Rust’s learning curve
I think this is good insight, and I would extend this further to “coming from a less strict language to a very strict one”.

As someone who self-learned Rust around 1.0, after half a year of high school level Java 6, I’ve never had the problems people (even now) report with concepts like the ownership system. And that despite Rust 1.0 being far more restrictive than modern Rust, and learning with a supposedly harder to understand version of “The Book”.

I think it’s because I, and other early Rust learners I’ve talked to about this, had little preconceived notions of how a programming language should work. Thus the restrictions imposed by Rust were just as “arbitrary” as any other PL, and there was no perceived “better” way of accomplishing something.

Generally the more popular languages like JS or Python allow you to mold the patterns you want to use sufficiently, so that they fit into it. At least to me with languages like Rust or Haskell, if you try to do this with too different concepts, the code gets pretty ugly. This can give the impression the PL “does not do what you need” and “imposes restrictions”.

I also think that this goes the other way, and might just be a sort of developed taste.

SyrupThinker··on Rost – Rust Programming in German
Possibly “(ver)änderbar” (changeable) to have a distinct keyword. “Mutierbar” would also work fine in German, but it was probably changed with the same reasoning that fn was to fk.
SyrupThinker··on Writing a DSL in Lua (2015)
While I can't speak for MicroLua, this can indeed be accomplished with vanilla Lua.

There are two things in play here:

First, the _ENV variable here is special.

It is implicitly used to lookup any identifier that has no visible binding, locally or in the surrounding scopes.

Thus a script just containing print("Hello world") is really _ENV.print("Hello world").

Usually _ENV is just implicitly defined to be the global environment (available as _G), but it can be overridden within a lexical scope to a custom value.

Second, the jump labels just make use of the alternate function call syntax of object:method(args), which is equivalent to object.method(object, args).

The whitespace is non-significant, which allows it to be written like that.

In combination with metatables you can use _ENV to track variable reads, calls etc. within a function, which you can (abuse) to create DSLs.

You can get an idea of whats possible by just tracking what we can intercept with _ENV. Adding the following code after the pio_timer function, and running the script with Lua 5.4, already gives us quite a bit for just the first three lines of the function.

local loggerMetatable = {} function loggerMetatable:__bnot() print("Called bnot on " .. rawget(self, "name")) end function loggerMetatable:__call(...) local name = rawget(self, "name") print("Invoked " .. name .. " with " .. #table.pack(...) .. " args") -- Return another logger table to visualize variable interactions return setmetatable({ name = name .. "(...)" }, loggerMetatable) end function loggerMetatable:__index(key) local name = rawget(self, "name") print("Accessed key " .. key .. " on " .. name) -- Return another logger table to visualize variable interactions return setmetatable({ name = name .. "." .. key }, loggerMetatable) end

local pio_env = setmetatable({ name = "_ENV" }, loggerMetatable) pio_timer(pio_env)

-- Output:

Accessed key public on _ENV

Accessed key start on _ENV

Invoked _ENV.public with 1 args

Accessed key set on _ENV.public(...)

Accessed key y on _ENV

Invoked _ENV.public(...).set with 3 args

Accessed key mov on _ENV

Accessed key y on _ENV

Accessed key y on _ENV

Called bnot on _ENV.y

Invoked _ENV.mov with 1 args

[...snip...]

SyrupThinker··on "Hetzner decided to cancel our account and terminate all servers"
Close to zero from the DSA given thats how several European cloud providers have acted for the last decade.

Theres certainly other (German) legislation in place that might be relevant, but whats the point of speculating if we can’t blame the EU for it.

SyrupThinker··on Crokinole
Very fun. Unfortunately there is a way to, in my opinion, cheese it. I made it to 2485 on my second attempt.

Reversed to avoid spoiling the game: .gard ot reyalp eht gnicrof yb devlos eb dluoc siht ebyaM .kcab ot kcab tsrub eht reggirt ylbailer ot mhtyhr a ni taht od ot eunitnoc tsuj nac uoy ,kcilc ot ecalp thgir eht dnif uoy fI

SyrupThinker··on TOTP tokens on my wrist with the smartest dumb watch
You are missing that the TOTP secret will only be presented once during setup.

It is now a second factor because you need to prove possession of the secret by entering the current TOTP code during login. It will not be presented again, so an attacker needs to have been able to intercept the initial secret exchange. (well or phish for it etc.)

You are usually prompted to enter the code during setup to ensure the secret has actually been put into some authenticator and is not immediately going to be lost.

SyrupThinker··on Pack: A new container format for compressed files
Interesting, I've recently spent an unhealthy amount of time researching archival formats to build the same setup of using SQLite with ZStd.

My use case is extremely redundant data (specific website dumps + logs) that I want decently quick random access into, and I was unhappy with either the access speed, quality/usability or even existence of libraries for several formats.

Glancing over the code this seems to use the following setup:

- Aggregate files

- Chunk into blocks

- Compress blocks of fixed size

- Store file to chunk and chunk to block associations

What I did not see is a deduplication step for the chunks, or an attempt to group files (and by extend, blocks) by similarity in an attempt improve compression.

But I might have just missed that due to lack of familiarity with Pascal.

For anyone interested in this strategy, take a look at ZPAQ [1] by Matt Mahoney, you might know him from the Hutter Prize competition [2] / Large Text Compression Benchmark. It takes 14th place with tuned parameters.

There's also a maintained fork called zpaqfranz, but I ran into some issues like incorrect disk size estimates with it. For me the code was also sometimes hard to read due to being a mix of English and Italian. So your mileage may vary.

[1]: http://mattmahoney.net/dc/zpaq.html [2]: http://prize.hutter1.net [3]: https://github.com/fcorbelli/zpaqfranz

SyrupThinker··on Emergency-hired teachers without degrees as effective as licensed educators
Seems about right for "Science and Technology", a variant of this question also shows up in German IHK (chamber of commerce) exams for software developer certifications, with a similar expected answer.

Although you do sometimes get weights… the important part is explaining that you evaluate some weighted sum and take the best result.

How much impact would this question have on the final result for the licensure exam?

IIRC during my own IHK examination this was worth around 5pp, which is almost enough to drop you an entire grade.

SyrupThinker··on What every software developer must know about Unicode in 2023
I imagine the author would disagree with that because it does not have the “right” behavior by default.

For example indexing and length of the string are done by codeunit. [1]

On the other hand Rakus Str type does behave similarly to Swifts: indexing, length and iteration by grapheme; view methods for specific encodings. [2]

[1]: https://docs.julialang.org/en/v1/base/strings/ [2]: https://docs.raku.org/type/Str#routine_chars

SyrupThinker··on Raku: A language for gremlins
Well… that was supposedly considered at some point:

https://youtube.com/watch?v=BJIfPFpaMRI&t=1891 (~1m)

SyrupThinker··on Evading JavaScript anti-debugging techniques
Using a `debugger;` statement allows you to trigger a breakpoint with code.

This only gets activated when the devtools window is opened, so placing this statement in a frequently executed piece code will continuously interrupt whatever you are doing in the devtools when you use them.

I assume in the past the tooling might not have had the necessary configuration options to suppress that, but nowadays you can just disable debugger statement breakpoints to avoid it.

SyrupThinker··on US smartphone shipments fall sharply, but Android more than iPhone
Am I misunderstanding something, I think that gesture exists on iOS?

Swiping from the left screen edge to the right navigates back in any properly designed app.

Alternatively sheets are usually dismissed by swiping down.

Do you have particular apps or contexts in mind where this did not work?

SyrupThinker··on The $5 Plan
I must be misunderstanding the pricing (talk about confusing) or the value proposition.

The way I understand it those $5 give you all the management features and $5 worth of compute.

But compute costs $10 GB/month for RAM and $20 per vCPU/month.

So in comparison to a VPS this costs $30 for a full-time 1vCPU/1GB machine, ignoring network egress.

At least as a VPS replacement this really doesn’t seem worth it. For that money I can get a 12 vCPU / 24 GB machine with my current provider, which includes 80TB traffic.

SyrupThinker··on Buying an iPad Pro for coding was a mistake
Not making any statement regarding the mentioned workflow issues (I mostly agree with them), I really like iSH [1] for this sort thing.

It’s a “good enough” solution for the “I just quickly need to do something in a terminal” problems.

And because it’s an x86 Alpine Linux it can even run simple binaries if needed.

But for me it still couldn’t replace a dedicated laptop for proper tasks.

[1]: https://github.com/ish-app/ish

SyrupThinker··on Ask HN: Does anybody not use an adblocker?
Sure you can, you can run something like Wipr [1] and SponsorBlock [2] in Safari on an iPad for an ad-free YouTube experience, in the browser.

Of course there is a compromise on the video quality (1080p max) and convenience of the official app.

[1]: https://kaylees.site/wipr.html [2]: https://sponsor.ajay.app

SyrupThinker··on Meta now officially outsources support to the legal system
You said before that you are acting as a business here, so I don’t think these apply, but just to mention it.

(1) A trader who maintains a website or uses terms and conditions shall, […]

1. […] inform consumers of the extent to which it is willing or obliged to take part in dispute resolution procedures before a consumer conciliation body […]

I imagine there is equivalent legislation for B2B, this one applies to consumer matters.

Or maybe the notice is a catch-all for exactly this law.

DE: https://www.gesetze-im-internet.de/vsbg/BJNR025410016.html#B... EN: https://www.gesetze-im-internet.de/englisch_vsbg/englisch_vs...

SyrupThinker··on Thoughts on Swift and Objective-C (2022)
Many parts of the Swift toolchain are already open source [1], there is a Windows and even a WASM port [2].

The caveats are:

- Xcode indeed isn’t, but you can use sourcekit-lsp for Swift development with some compromises. The experience has really improved the last few months thanks to the Swift Server Work Group [3].

- Apple platforms have their own Foundation implementation and the open-source one is incomplete.

[1]: https://www.swift.org/source-code/

[2]: https://swiftwasm.org/

[3]: https://www.swift.org/blog/vscode-extension/

SyrupThinker··on Nearly 40% of software engineers will only work remotely
To be fair the grandparent post did not elaborate, but not everyone is locked into doing nothing during their commute.

People using public transport might be able to do all sorts of things like reading or creative work.

That’s of course hard if you need to drive yourself.

But if you are able to make good use of that time one could consider it not lost.

Maybe commute should be clocked in for jobs that don’t rely on physical presence?

SyrupThinker··on JEP 430: String Templates (Preview) Proposed to Target Java 21
But if you do follow that advice consider if it is worth just using a different escape character for all interpolations. That way could still make use of this very sensible syntax of reusing the escape for interpolation whilst avoiding the backslash issues.
SyrupThinker··on Deno 1.31: Package.json Support
> I knew they would eventually cave and implement it […]

Let’s see how long it takes until Deno is just NodeJS Mark 2, with little value of adopting it.

Hopefully the answer is never, but considering the type checking changes last year and deprecation of bundle now I have little faith that the features that, at least to me, made Deno a worthwhile improvement over NodeJS will stay.

SyrupThinker··on Deno 1.31: Package.json Support
Almost a year ago with Deno 1.22 type checking for TypeScript was default disabled. (i.E. you must manually request checking on the CLI, editors still do typechecking as before)

At least in my microcosm of Deno-use the package quality degraded since then with more and more packages having subtle type bugs that could have been caught easily by anyone with checks enabled.

Compared to what was before that is to me a drawback, but of course it depends on whether your bigger priority is to reduce friction.

Apparently `deno bundle` has now been deprecated too, because it couldn’t be used for web bundling and because NodeJS support is hard.

So early adopters that possibly wanted to get away from the web and NPM get punished by these ecosystems now.

Hope my 2 cents answer your question.

SyrupThinker··on Deno 1.31: Package.json Support
Does every project need to strive for maximum adoption? I guess because Deno is a company the answer is yes.

But I think one of Deno’s initial appeals was “A JS/TS runtime for people that don’t want to deal with JavaScript status quo”. Its accomplishment would have been to be bold and try something different, similar to for example Zig.

SyrupThinker··on The Janet Language
Thanks for clarifying, I did not find anything decisive searching persistent in combination with Clojure, weird.

> Because "tuple" for an immutable sequence is rather specific to Python.

As someone with a background in Swift, Rust and C#, all of which have the concept of a tuple, I did not make that connection, but thanks again.

SyrupThinker··on The Janet Language
> Closure is not a language so hopefully not?

Very true, the typo is strong in this one.

> rather than the persistent data structures you'd expect from a strong clj inspiration

What do you mean by persistent here? I assume some kind of shared memory instead of copying? Or something with more practical implications like deep immutability?

> looks a lot more like a description of Python datatypes

I am surprised where this sentiment comes from. Because of the initial comment? Basically any language nowadays has maps, sequences and byte strings. If I had to draw a similarity to Python it would be something along the lines of first-class generators.

SyrupThinker··on The Janet Language
I'm pretty sure GP meant Closure, considering the language has matching immutable data structures for mutable ones [^1] and even its own (limited) version of EDN called JDN. It’s definitely also inspired by it.

[^1]: https://janet-lang.org/docs/data_structures/index.html

SyrupThinker··on Want anonymity? Make a persona not a mystery
> We're talking about fingerprinting here.

I think the whole subthread is more mixed in terms of fingerprinting and social interactions. But if you only consider the the former then yes, one would probably only care about what I called "resourceful actors" to which you would end up standing out.

I was more referring to the social aspect, were if you give someone a name they will (usually) not immediately assume it is false. Thus giving a false name does not make you "stand out" unless there is already other information in play. But I'm just clarifying what I meant, considering your point was meant for a different context.

SyrupThinker··on Want anonymity? Make a persona not a mystery
Maybe to some actor that has sufficient data to correlate identities.

But if I introduce myself to someone with an alias or claim false traits, they will not immediately just know it’s fake unless they have additional contradicting information.

Most people do not casually wear ski masks, but they tend to not lie when asked for a name.

SyrupThinker··on Noise2Music: Generating Music from Text Using Diffusion Models
I don’t know about the general claims of Noise2Music (I can’t play the samples),

but Riffusion[1] uses the spectrogram approach and kind of works.

[1]: https://www.riffusion.com/about

SyrupThinker··on Ask HN: Why no HN live chat?
I'm going to slightly lean against this notion. For me personally the actual value of HN is the number of people that have some neat insights on niche topics, rather than it being a "good" place for discussion in comparison to chat.

> Also chat platforms can't bring valuable discussion like hn . Most chat devloves to dramas and fight.

This to me seems more like a function of the aforementioned people involved. I've personally had plenty of valuable discussions in random chatrooms. Even in more active ones.

Meanwhile on HN, a decent portion of the comments also is drama of some kind. (rude remarks, off-hand comments, FUD spreading)

Mind you, either medium has it's high's and low's, but I just think they don't differentiate themselves much in that regard. It probably depends significantly on the specific communities one engages with.

> Because there's no topic to follow, nobody read back original posts and it became personal.

To me this same issues exists on HN, possibly even more prevalent by virtue of being a news aggregator. People frequently do not even appear to read the article before arguing about things (mostly the title).

This sometimes makes comments feel like they are done in bad faith, or out of hostility towards the topic/author. Which I don't think makes a good climate for discussion.

On some topics even going slightly against status quo can result in gray or dead comments, even when the comment is well argued. Meanwhile, some hostile comments are not pushed against enough.

I think the value of the discussions within a community depends far more on how much the community polices it's standards by discouraging unwanted behavior rather than the medium in which it happens.

But ignoring that, the lack of notifications on replies, which is something I don't really mind, also seems antithetical to the concept of discussion.

Some threads don't end by merit of their arguments but because one of the parties involved did not reply, possibly because of a lack of visibility.

← PreviousPage 2 of 3Next →