470 karma · joined Nov 3, 2020 (6y ago) · 46 submissions
comment 2y ago · link · parent
Being better at debugging doesn't necessarily makes you better at writing less complex, more approachable code. Though debugging should teach you which patterns cause bugs or impede debugging.
And what do you do once you are so skilled your software doesn't have bugs? :P
Regarding self improvement, Aaron Swartz put it better here: https://web.archive.org/web/20240928215405/http://www.aarons... (tldr: do things you don't like)
comment 2y ago · link · parent
Comparing that to the US, where if you get caught dealing marijuana, you get a 5 years minimum sentence. That seems disproportionate to me. Maybe police in the US is more compassionate than some militants make it seem, and that's why they don't like catching people for that kind of crime?
Looking at Wikipedia[1] it appears the number of policemen per people is two times higher in the US than Switzerland, and about the same as France. If it is true that "the police are plentiful and they come down fast" in Switzerland (which I would not agree with), it is twice as true in the US.
[1]: https://en.wikipedia.org/wiki/List_of_countries_and_dependen...
comment 2y ago · link · parent
I would recommend it not just for the philosophical aspect (it has a very interesting way of placating transhumanism) but also for the entertainment aspect (aforementioned shrimps, did I mention the Iranian space program?)
Stross is a very approachable author, Accelerando is not his most accessible book, but if you can go through half of Diaspora, you can easily go through the entirety of Accelerando.
4.
Xan, the CSV Magician(github.com ↗)
1 points · by nicopappl · 2y ago · discuss
5.
Strandbeest(strandbeest.com ↗)
421 points · by nicopappl · 2y ago · 107 comments
comment 2y ago · link · parent
I suspect the author might be reading this post back and cringe a bit. That last code listing with handle_session_completed triggers my inner clippy. Why clone session.customer_id to then pass it as a reference? Why are those CheckoutSession fields Options?
The other advice I would give is to identify what the author calls "Service" as what is called "view type" or "newtypes" in rust. A newtype wraps another type, to give it a different set of methods. For example, a counter could wrap an i32 and only allow incrementing and reading the value. Or put together a set of references to fields/slices of a struct.
It can be useful, but the way it's used by the author here is not very rusty, and the final suggestion of using a function is a descent alternative. Although I think defining handle_session_completed as a method on CheckoutSession or UserRepo might be better.
comment 2y ago · link · parent
> “Chain voting” ensures that people vote the right way. Voter 1 goes into the polling station,
> appears to vote by depositing an empty envelope into the ballot box, but comes out with a
> blank ballot. Voter 2 is then sent in with that ballot—now marked by a [party] operative—and
> told to put it in the ballot box and exit with another blank ballot in hand. Carried on down
> the line, the [...] party boss in the town can ensure that all have voted the proper way
> while the election workers find that they are short only one unaccounted-for vote
comment 2y ago · link · parent
The old codebase was an hairy ball of scala using a very outdated version of a (now) infamous actor framework. Before they figured out that untyped messages kinda left out one of the major selling point of Scala.
The code was readable, but the authors had this strange idea that every little piece of logic should be part of its own "Actor". An actor is pretty much equivalent to a class, and each one of them had their own little file. With this many classes, with very specialized purposes, you ended up with 90 character identifier names.
To understand what would be a single function in a normal code base, you would have to dive through half a dozen files through several repositories to piece together the logic. Generally, at the end, you find that most of the code is about passing around a value, and there is this one file where there is actual logic applied to the value.
It wasn't that awful. The thing was that it was impossible to change anything: no documentation, no test, no bug tracking, not even any PR process, laconic commit messages, no Wiki pages. And the actor framework made it very difficult to add tests. But later developers did manage it pretty well, they drew fences around the old services, with an HTTP API to communicate with it. And all later additions were part of different services that were very cleanly and consistently designed.
comment 2y ago · link · parent
When your text editor is not enough for a task, and it hopefully is extensible, consider writing little plugins to reduce repetitive tasks.
Here is an example. I was working with a legacy code base using an infamous Scala actor framework. Basically, all function calls were replaced by message passing. All messages were sent as 'Any' objects, then downcast to the expected type, so an IDE wasn't of much use. I wrote a little bash script to populate a jump buffer in vim with the result of a grep, and suddenly, I had jump functionality! Originally, I had to jump to type definition, hope that the associated "received message" type was in the same file, then look for downcasting into that received type. I don't remember precisely the details, but what I do remember is that the little script helped go from a few seconds to just pressing two keys to navigate the code. It's especially useful for legacy code, where the main activity associated with it is reading and understanding.
Our capacity to focus as humans is limited in time and energy. Writing tools to do in half a second what otherwise would take a few seconds can help, not only to make you faster (for that, refer to xkcd 1205) but also to effectively increase your capacity to focus.
Though being able to develop your own tooling is less important today. Languages and frameworks nowadays prioritize tooling as an important feature. And I'm grateful for that, programming used to be much more annoying.
10.
From Dimes to Fahrenheit 451(web.archive.org ↗)
1 points · by nicopappl · 2y ago · discuss
12.
2010 Flash Crash(en.wikipedia.org ↗)
2 points · by nicopappl · 2y ago · discuss
13.
Perspective-Correct Interpolation(andrewkchan.dev ↗)
54 points · by nicopappl · 2y ago · 12 comments
comment 3y ago · link · parent
* https://blog.plover.com/Unix/whitespace.html (mentioned at the beginning of the linked post)
* https://drewdevault.com/2023/07/31/The-rc-shell-and-whitespa... (mentioned at the end of the linked post)
16.
“Killer” Trees? Not (2013)(earthobservatory.nasa.gov ↗)
1 points · by nicopappl · 3y ago · discuss
comment 3y ago · link · parent
I use regularly Inkscape, and it has been a constant source of frustration. The UI is the exact opposite of how I expect things to work.
It's improving at breakneck speed though. 1.2 already solved some of my frustrations (the new interface for linecaps & line dots, amazing!)
Almost all the features in this release seem to solve a major frustration I had with Inkscape.
* The node deletion behavior, it was so annoying, how you delete a node on a straight line and suddenly you get some soup.
* The awful color palette. You had to manually edit text files to get your own palettes, couldn't edit them in Inkscape. I, in fact, never managed to create a custom palette. Pinned colors seem to solve this.
* Lasso selection. It was soo fiddly to select a group of nodes. One missclick and you had to start from scratch, clicking on the tinny controls.
* Multithreaded rendering. The single-threaded software renderer is a misery for complex projects, or just zooming in. Now Inkscape is going to be 12 times faster on my machine
* Font selection was utter garbage, the new UI seems promising
* Patterns was also a constant source of frustration, looks like this release improves it.
This is exciting. I'm looking forward to use this new release.
Now please give me a dialog for key rebinding, similar to Krita. And better key binding discoverability.
comment 3y ago · link · parent
Personally I find the way rows are added in this post a bit confusing. It's done for the sake of illustrating a source of data where rows elements of the jagged array are not accessed sequentially. That's reasonable for the purpose of the post, but for someone not familiar with jagged arrays, it can be a bit confusing. A more traditional way of building a jagged array is as follow:
struct JaggedArray<T> {
offsets: Vec<u32>,
data: Vec<T>,
}
// impl JaggedArray<T>
fn add_row(&mut self, row: Vec<T>) {
self.data.extend(row);
self.offsets.push(self.len());
}
fn get_row(&self, row: usize) -> &[T] {
let start = self.offsets[row] as usize;
let end = self.offsets[row + 1] as usize;
&self.data[start..end]
}
Now this could be improved to reduce allocations, but it's fine as an illustration.I personally prefer to store the end element in the 'offsets' array, since you know the first offset will always be zero. With this, the 'offsets' array has as many elements as the jagged array has rows, which I find elegant:
fn get_row(&self, row: usize) -> &[T] {
let start = if row == 0 { 0 } else { self.offsets[row - 1] as usize };
let end = self.offsets[row] as usize;
&self.data[start..end]
}
Jagged arrays are super useful as lists of list, some better perf characteristics than the naive Illife Vector. I've used them extensively lately. It's also extra fun when you combine them with a bitset.With a vector as backing storage, jagged arrays are also not limited to a fixed size! You can trivially add new rows or extend the last row. This comes in handy in a parsing context.
comment 3y ago · link · parent
It's still a pain in other ways. AMD does not support ROCm on consumer-grade GPUs, it only "happens to work". I had to explicitly install the 3.10 python interpreter and use an older torch version, because seemingly, the newer ROCm releases do not support the RX5700 XT. Also ROCm only works on Linux.
comment 3y ago · link · parent
Just excellent if you want to understand what is going on under the hood. Which is necessary if you are writing anything more than a toy graphic program, or understand the output of GPU debugging/profiling tools from Nvidia and AMD.
comment 3y ago · link · parent
comment 3y ago · link · parent
The real problem is entry-level opportunities. As a developer, I experienced first hand how great ChatGPT is. I can just submit an undecipherable bash one-liner I wrote 6 months ago and it will explain in details what it does.
I tell it "write a command line utility using libraries X and Y to convert MessagePack to JSON" and it writes it. It's pretty bad, so I type "refactor duplicate code into a single function" or "put that string into a constant" and it does it. Amazingly.
It's not perfect, sometimes it is completely wrong and persists in it, like Trurl's first machine in the Cyberiad, but my experience tells me what is credible and what isn't. What elements of the answer are total bullshit.
But to build that experience, I first had to write that code. How will a junior programmer find a job when all the menial labor can be done so easily in two seconds by an AI? This is not limited to programming, other domains where writing dominate are also a concern.
We need somehow a safe space for people to experiment and become experts. If we blindly use ChatGPT I fear we are going to cut out the opportunity to become an expert to a whole generation.
comment 3y ago · link · parent
Beside, with ChatGPT in its current state, it's still absolutely impossible to get it to produce any useful code without knowing how code works. There is an advantage to the precise specification of a formal language. At least for the next decade, I think there will be human proof-reading AI output before generated code is ran, with catastrophic consequences when that doesn't happen.
What I've difficulties getting over right now is every time I write something (text or code) I ask myself "Could ChatGPT have written it better?"
comment 3y ago · link · parent
There is also another story, "The Electronic Bard" another computer made by Trurl, capable to write such good poetry that poets start to give up on life. ChatGPT is surprisingly good at writing romantic poems in the language of pure mathematics! Though still needs some work on rhyming.
Of all the Sci-fi AIs, we ended up with the ones from the Cyberiad. Amazing.
comment 4y ago · link · parent
I like the article, because it exposes very quickly a very powerful idea, but I disagree with the conclusion.
Information networks are built by humans, they are designed, they are not necessarily bound by the rules of evolution. Which means we may yet be able to find a system that is not afflicted by the curse of perpetual destruction and reconstruction.
comment 4y ago · link · parent
It's in fact a seriously amazing essay, thank you for sharing it here. The 2006 Jaron Lanier essay, in addition with the 13 responses (including from Cory Doctorow and Jimmy Wales) is a golden nugget of internet history, and a snapshot of what people believed would be the future of the internet (oh boy, with 15 years of insight, there is quite a lot to say)
comment 4y ago · link · parent
Per the description:
> Fraidycat is a desktop app or browser extension for Firefox or Chrome. I use it to follow people (hundreds) on whatever platform they choose - Twitter, a blog, YouTube, even on a public TiddlyWiki.
This doesn't solve the problem of discoverability, but it solves half of what you described.
comment 4y ago · link · parent
I've absolutely 0 info on cash distribution across the richest people, but this figure shows average asset across all people (in France). It still can be helpful as a way to "visualize" asset type property distribution across the spectrum.