News for hackers. Stuff that matters.

sischoel

Re:Google De-Indexed My Bear Blog and I Don't Know Why on Friday December 12, 2025 @05:25AM (#46242720)
The issues with auto-translated Reddit pages unfortunately also happens with Kagi. I am not sure if this is just because Kagi uses Google's search index or if Reddit publishes the translated title as metadata.

I think at least for Google there are some browser extensions that can remove these results.

Re:Dict Unpacking in Python on Monday July 14, 2025 @11:38AM (#44561433)
Dotted notation would not work because the keys in a dict can also contain dots. I am not terrible familiar with them but there is something called `lenses` that comes from functional programming that should allow you to access nested structures. And I am pretty sure there must be at least one python library that implements that.
Re:Dict Unpacking in Python on Saturday July 12, 2025 @01:23AM (#44539536)
Or use itemgetter:

  >>> from operator import itemgetter
  >>> dct = {'greeting': 'hello', 'thing': 'world', 'farewell': 'bye'}
  >>> thing, greeting = itemgetter("thing", "greeting")(dct)
  >>> thing
  'world'
  >>> greeting
  'hello'
I was looking a bit at the code for the shared memory implementation in https://github.com/3tilley/rust-experiments/tree/master/ipc and the dependency <https://github.com/elast0ny/raw_sync-rs.

My last systems programming class was already a few years ago and I am a bit rusty, so I got some questions:

1. Looking at the code in https://github.com/elast0ny/raw_sync-rs/blob/master/src/even...) it looks like we are using a userspace spinlock. Aren't these really bad because the mess with the process scheduler and might unnecessarily trigger the scaling governor to increase the cpu frequency? I think at least on linux one could use a semaphore to inform the consumer that new data has been produced.

2. What kind of memory guarantees do we have on modern computer architectures such as x86-64 and ARM? If the producers does two writes (I imagine first the data and then the release of the lock) - is it guaranteed that when the consumer reads the second value that also the first value has been synchronized?

Re:Bresenham's Circle Drawing Algorithm (2021) on Saturday August 31, 2024 @12:04PM (#41409785)
The CUDA documenation tells me that there are more performant but less precise trigonometric functions: https://docs.nvidia.com/cuda/cuda-c-programming-guide/index....

Do you know if that hardware pipeline works only for these intrinsic variants?

Re:Cosma Shalizi on Attention and Transformers on Sunday December 24, 2023 @07:23PM (#38758394)
I am not sure if this was the very first paper talking about attention, but https://arxiv.org/abs/1409.0473 from 2014 is a famous one.

What is still missing there, is the idea of self-attention.

Do you have any sources on that? The only thing I could find was that some parties want to ban digital billboard in the city of Zurich (not the whole canton).
Re:Source code for Glider Pro (1994) on Tuesday May 23, 2023 @06:49AM (#36042409)
A few years ago I was trying if I could port that code to Linux. I made some decent progress, but in the end I got stuck trying to convert the resources (images and audio files) to a more modern format. For example, the PICT format (https://en.wikipedia.org/wiki/PICT) is not just some pixel encoding but also contains QuickDraw commands. There are some open source converters, but they seem to support only a subset. And then I had to concentrate on finishing my degree so I abandoned that project.

Other things I remember: - Data is mapped directly from files to C structs - this provided some challenges as I had to convert big endian to little endian. - Classic MacOS handled memory allocations quite a bit different, if one wanted to access a dynamically allocated buffer, they first had to acquire a lock on that part of memory as otherwise the operating system was allowed to move the data to some other address.

My memory on these details is quite a bit fuzzy though, so I can't guarantee that what I wrote here is 100% correct.

Re:Incredible fast free AI image generation by Open AI on Thursday March 16, 2023 @04:19AM (#35179476)
There are some very explicit images for the default prompt when one scrolls a bit around there, can't imagine that OpenAI would not filter these out.
When one talks about the average income, does that average only consider people that work? Otherwise, in countries with a high rate of unemployment, I would imagine that a single salary might have to feed the whole extended family, so that one needs to have a salary that is much higher than then average income to be sustainable.
It is indeed O(N). There is also a more efficient algorithm (in case the range is small) that uses binary search to find the first index. Such an algorithm would have time complexity O(log(N) + H) where H is the number of elements in the output.
From skimming the paper (https://arxiv.org/abs/2211.09055), the proof seems to be amazingly short and relies only on a few theorems that one encounters in introductory class on information theory. Definitely recommendable to read if one is interested in that kind of combinatorics.
Re:That XOR Trick on Wednesday June 15, 2022 @04:38PM (#31759159)
Why is that though? Wouldn't something like `mov eax 0` also work?
Isn't that the case for most programming languages? The only exceptions I can think of are C++ and Rust.
Do you know any sources on on how set equivalence theory is related to integer programming? Because I don't see the immediate connection and I could not find anything on the internet, but maybe I used the wrong terms.
Re:The House of Graphs on Wednesday February 16, 2022 @01:56PM (#30364111)
Such graph collections are super helpful when trying to figure out if some theorem holds for a certain graph class, although only up to a certain size.

I think a lot of these graphs where generated with the genc.c program included in nauty (official website: https://pallini.di.uniroma1.it/ -- unofficial Github repository: https://github.com/lonnen/nauty). With the computing power that we have nowadays it might be easier to just to just run that program.

Re:What Fortran does better than C-like languages on Saturday February 12, 2022 @04:07PM (#30316474)
C and C++ do not have labeled breaks - Java indeed has.

But of course you are right, that one could just use goto for C/C++.

Re:Procrastinate: PostgreSQL-Based Task Queue for Python on Saturday January 29, 2022 @04:51PM (#30130910)
Genuine question, not a comment on OPs implementation: What is the reason that people so often use some external service for creating task queues (often backed by some kind of db), instead of just implementing it themselves in whatever language they are using for the rest of their application?

Is it: - They want persistence in case the system goes down, or the task queue service is restarted.

- They want to replicate their task queue service and want to be sure that the data is properly synchronized.

- The amount of tasks/time if simply too much for some standard library queues

- They think is is easier to add another dependency than implement it themselves

- something else

?

The page is from 2008 - unfortunately a lot of links to the original pictures do not work anymore.
Re:Julia Macros for Beginners on Wednesday January 26, 2022 @04:57AM (#30083618)
One could argue that Julia is just Lisp with a syntax that appeals more to popular taste.

There is also a secret option to get into a lisp repl in Julia "julia --lisp".

Re:The Tortoise, the Hare, and the Cyclical Linked List on Thursday December 16, 2021 @03:44AM (#29576311)
Indeed, there are quite a few application in cryptography, where one has to search trough a huge space. Wikipedia actually listens a few: https://en.wikipedia.org/wiki/Cycle_detection#Applications
Re:Shitoberfest – First Hacktoberfest spam of the season on Friday October 01, 2021 @05:30PM (#28723595)
It looks as if this year only repos with the topic "hacktoberfest" or PR's with the the tag "hacktoberfest-accepted" participate, so this should limit the amount of spam. Source: https://hacktoberfest.digitalocean.com/faq
Re:Building a data team at a mid-stage startup on Thursday July 08, 2021 @06:54PM (#27778615)
What about "data engineer"? There seem to be a lot of jobs for that title nowadays.
Re:Compiling Rust is NP-hard on Thursday July 08, 2021 @06:23AM (#27770182)
Yes, I hadn't thought about that before, but of course the difference here is that the Rust compiler cannot just produce a "good enough" result for pattern matching.
Re:Compiling Rust is NP-hard on Thursday July 08, 2021 @06:12AM (#27770121)
While this is an interesting result, isn't basically every compiler NP-hard, because of register allocation?
Re:Branch predictor: How many “if”s are too many? on Thursday May 06, 2021 @05:46PM (#27069425)
Although it is possible to create branchless binary search. Here is one article: https://schani.wordpress.com/2010/04/30/linear-vs-binary-sea..., there are probably other ways to do that.

Another interesting question where one could sink a lot of time is how do to binary search on GPU's using multiple threads. There branching in multiple threads at the same time is also bad, but for slightly different reasons.

Re:Kolmogorov Complexity: Extensions and Applications on Wednesday May 05, 2021 @05:32AM (#27047900)
Thanks, I had not seen that dissertation yet, it has much more information than that arxiv link - here is a a pdf of that dissertation that google gave me: https://www.illc.uva.nl/Research/Publications/Dissertations/...

Although strictly speaking the idea with the evolutionary trees is a bit older, as far as I know it is from https://arxiv.org/pdf/cs/0111054.pdf

Re:Kolmogorov Complexity: Extensions and Applications on Wednesday May 05, 2021 @05:26AM (#27047866)
I think there is a mistake in that article: One has to fix a specific language before and then determine the Kolmogorov Complexity of an input - one is not allowed to take a separate Language for each input, unless one also encodes how that Language is calculated from an input, which will take up some space. This is a bit like saying that SAT is in O(1): One can create a separate program for each instance that answers that instance in constant time.

And the useful applications that I know of (apart from using it as a tool in proving theoretical things) come from replacing the Kolmogorov complexity with a a real compressor that just approximates the Kolmogorov complexity - this produces some empirical results.

Re:Kolmogorov Complexity: Extensions and Applications on Tuesday May 04, 2021 @07:42PM (#27044274)
This article is surprisingly short on actual applications.

For some interesting applications one might look at the the Wikipedia article for the normalized compression distance: https://en.wikipedia.org/wiki/Normalized_compression_distanc...

This paper here shows some interesting applications - it is not the first one, but the first non-paywalled one that I found: https://arxiv.org/pdf/cs/0312044.pdf

There is also a book by Paul Vitanyi - it has been a while since I looked at it, but if I remember correctly it also discusses some of these applications: https://www.amazon.com/Introduction-Kolmogorov-Complexity-Ap...

Re:Ask HN: Is my starter interview question too simple? on Friday April 30, 2021 @07:40PM (#27001070)
It might be possible that candidates are afraid that their solution is not clever enough for you, i.e they assume that you want something like a one line formula that only contains numbers and basic arithmetic operators.

The way I would solve something like that is by mentioning that it is a good approach to do time calculations with some library functions so that I won't have to deal with all the weird edge cases, then start with a loop over the months and later refine that to get rid of the loop, but it is very much possible that an interviewer might view this loop negatively.

There might also be some cultural aspects. While the Gregorian calendar is probably somehow used everywhere in the world, I think there might also be some other calendar formats being used in parallel.

If it is the first interview of the day, maybe the candidates are also just nervous? I remember when I had my on site interview at Google, the first warm up question had something to do with probability and could be easily solved with linearity of expectation. In the months before that interview I had dealt quite a lot with probability for my master thesis - but at that day I was quite nervous and I had not slept well, so I spend quite a lot of time on that question. I think I answered later questions better, although it was not enough in the end.

Do you usually see some correlation between the warm-up question and later performance?

I am not sure if that is necessary, but what might help is by starting to calculate the number of days from the start of the month and then adapt the question.

Older »