News for hackers. Stuff that matters.

twanvl

This tile forces a pattern that does not repeat. If you use the simpler shape you can tile a wall such that it never repeats, but you can also make a repeating pattern.
Money is fungible, personal data is not.
Re:Why do arrays start at 0? on Wednesday August 24, 2022 @01:15PM (#32582588)
Other advantages of zero based indexing, beyond being 'closer to the machine':

It works better with the modulo operator: `array[i%length]` vs `array[(i+length-1)%length+1]`. Or you would have to define a modulo-like operator that maps ℕ to [1..n].

It works better if you have a multi-dimensional index, for example the pixels in an image. With 0 based indexing, pixel `(x,y)` is at `array[x+widthy]`. With 1 based indexing it is at `array[x+width(y-1)]`. You might argue that programming languages should support multi-dimensional arrays, but you still need operations like resizing, views, etc.

Re:When to use generics on Tuesday April 12, 2022 @09:11PM (#31010130)
The ergonomics of this are really bad without some kind of implicit parameters and trait resolution. Without trait methods, ad-hoc overloading becomes impossible. You would have to explicitly specify what + operator and what == operator you use everywhere. After all, there could be multiple different additions or comparisons defined for a type, so which one do you mean by `+`?

Another problem is that a data structure's invariant can depend on the trait implementation. For example a tree is balanced with a comparison. This means that the comparison has to be stored in the struct, with the corresponding runtime overhead. With traits you know that there is only a single implementation for any particular type, so if the trait v-table is an argument to every method call there is no risk of different implementations being used at different times.

It matters if people figure out how to make your model output inappropriate things and start sharing screenshots on twitter. What if you use a GPT model as part of a chat bot? Then you definitely don't want to risk any sexual or discriminatory output for example. If that was a person talking, they would be fired.
Re:Solving NP-hard puzzles with the oldest trick in the book on Thursday October 14, 2021 @09:18AM (#28863858)
Depending on the type of puzzle, it might be possible to work backwards. For example here, if you can compute reverse-transitions you could run one or two steps of that, and put all states from which the goal can be reached in two moves into a HashMap. Then you run the forward search and stop as soon as you hit anything in that HashMap. In theory, you can reduce the runtime to find an n-move solution from O(bf^n) to O(bf^{n/2}), at the cost of more memory use. This can also be combined with A*.

Low-level optimization can be worth it:

* You can try to pack the game state into integers and use bitwise operations. An 8×8 board can be stored as a 64 bit vector, so a `u64`. If you know the edges of the board are never occupied, then moving around can be as simple as a bit shift (probably not for this game).

* A smaller state representation also means that HashMap lookups will be faster.

* Instead of using a pair of integers to represent a position, use a single integer and save a multiplication for every lookup into a grid.

* Add a ring of impassible cells around the board, instead of checking for the edges of the board each time.

Re:What DeepMind’s AlphaFold 2 really achieved (2020) on Monday July 12, 2021 @08:33AM (#27809585)
An important input to this (and similar) algorithms is multiple sequence alignment, which tells the algorithm which parts of proteins are preserved between species and variants, and which amino-acids mutate together. So already it is relying on natural selection to do some of the work. And the algorithm will probably not work very well if you input a random sequence not found in nature and ask it to find the folding.
Re:General Fusion to build demonstration plant in UK on Thursday June 17, 2021 @05:18PM (#27544603)
I don't expect building a fusion power plant to become cheaper than a gas power plant. Both need steam turbines, cooling pipes, a big building, etc.. So that would be a lower bound on the construction cost.

If solar+batteries can outcompete fossil fuel plants (while ignoring fuel costs), then fusion likely wouldn't be viable commercially. And if you look at [the data](https://en.wikipedia.org/wiki/Cost_of_electricity_by_source#...), we are already close to this point.

Re:Cookie Consent Speed Running Game on Friday March 19, 2021 @08:53AM (#26512696)
A legitimate interest is a use of personal information that is needed to fulfill a service. This would be something like a session cookie for storing the contents of a shopping cart, a site's preferences, or login information. Using a cookie is the only way to provide that, and the user is basically implicitly asking for something to be stored. It would be silly to have a consent checkboxes like "before you can shop with us we need your permission to register what you want to buy" or "you give us permission to share your address details with the delivery company so they can actually deliver stuff to you".
Re:Mutation Driven Testing: When TDD Just Isn’t Good Enough on Saturday February 06, 2021 @06:40AM (#26045902)
> I'd be interested to see what a sufficiently strong QuickCheck specification of this problem would look like.

I would write something like this in haskell:

    spec :: [Integer] -> Property
    spec xs =
       length xs <= 2  ==>  fun (intercalate "," (map show xs)) == sum xs
This captures the three requirements, but not the implicit fourth requirement that the function throws an exception for other inputs.
But laws about minimum wage and employee rights are not optional. A company can't decide to offer a job below minimum wage and argue that the arrangement is clear upfront, and therefore ok.
Re:Score matching with Langevin Sampling: a new contender to GANs on Thursday September 03, 2020 @08:42PM (#24370585)
This is not just replacing the discriminator. In this DSM-ALS method you learn a score function instead of a generator, and to generate a sample you need to evaluate the score function multiple times (it essentially gives you a direction to move in).
Re:Italian Ruby on Monday August 31, 2020 @07:24AM (#24330290)
Excel does this for function names. If you open a file in your localized copy all the names are translated.
Re:Oatly: The New Coke? on Saturday August 08, 2020 @07:50AM (#24090891)
> The evidence for the harms of canola oil is still in its early days, but continues to grow. Research has linked it to: Memory impairment [1], Alzheimer’s risk [1], Cardiovascular disease [2], [5], [6], [8], Diabetes [2], Increased all-cause mortality [2], [6], [7], Metabolic syndrome [3], Decreased brain function [4], and Oxidative stress [5], [7].

Most of these references talk about how there is no clear benefit of vegetable oils over animal oils or how "chronic canola oil consumption" results in obesity in transgenic mice. That is not really the same thing as "growing evidence for the harms of canola oil".

> Fun fact: it requires more delta-V to hit the Sun than it does to leave the Solar System.

Isn't that the delta-v needed to reach a stable orbit? That is, to slow down and counteract all the kinetic energy you gained from the sun's gravity. To just hit the sun (with high velocity) you wouldn't need to do that.

Re:Picture Hanging Knot (2017) on Friday May 22, 2020 @03:49PM (#23276131)
> Steel wire rope is substantially stronger for its weight and for it size but generally harder to work with than plastic things of similar capacity.

That is not true. The tensile strength of kevlar and dynema is higher than that of steel, while they have a density that is several times lower.

They are certainly better than Type I and Type II, but it is still a potentially ambiguous (at least as a non-native speaker). What makes a "false positive" false? Is it called a false positive because it is actually a negative, or is it called a false positive because it is a positive for which you made the error of calling it negative?
Imagine mathematicians calling commutative groups abelian? How do you remember if xy=yx there?
Re:The growth of command-line options, 1979-Present on Tuesday March 03, 2020 @10:44AM (#22475389)
I assume `mkdir $@ && cd $@`
Re:Show HN: Base24 binary-to-text encoding for humans on Thursday February 27, 2020 @06:43AM (#22432429)
> Not sure why they removed z. Perhaps because of 2?

My guess would be because of C, since Z can be pronounced as "zee"

There was a whole series on the office 2007 ribbon UI. (see https://blogs.msdn.microsoft.com/jensenh/2008/03/13/table-of...)
Re:Personal information and ads on Twitter on Tuesday October 08, 2019 @06:14PM (#21197867)
This is not entirely correct, GDPR does not necessarily require consent, see https://en.wikipedia.org/wiki/General_Data_Protection_Regula...

However, you are right in saying that this violates the GDPR, because the data was collected for a different purpose, and using it for another reason like advertising is not allowed.

Re:Saving lives for seven cents each (2013) on Tuesday October 08, 2019 @09:25AM (#21192003)
> You should be more concerned with what a given charity's administrative overhead is.

If charity1 has a 20% overhead and then spends the rest on saving the life of a child for every 1000$, while charity2 has a 40% overhead but saves a child for every remaining 500$ spent, which one is better? Overhead is just one factor of a charity's efficiency.

Of course in this case the cost of the powder is just a small factor, and you also need to consider the cost of distribution and other overheads. And the fact that the effectiveness probably drops off at some point. Obviously just spending 1B$ is not going to save 20 billion children, there aren't that many children that need these ORS packets.

Re:EU brings in 'right to repair' rules for appliances on Tuesday October 01, 2019 @05:48AM (#21123656)
These ratings would change over time, so an A+ rating in 2017 would not be the same as an A+ rating in 2019. I think that is very confusing. Is a second hand A rated model better than a new D rated one? Who knows.
Re:Silicon Valley is terrified of California’s privacy law on Thursday September 19, 2019 @05:11PM (#21020807)
> except if the difference is reasonably related to value provided by the consumer’s data

I think it means that if you opt out of data collection, then things like personalized recommendations will no longer work, which makes the services worse. That is a part of the service directly related to the data.

Re:Rediscovering rules for ancient board games on Saturday August 24, 2019 @07:59AM (#20786636)
> For example, the fact that resolution order follows a "stack" is specified nowhere on cards.

There are actually several things that reference the stack. For example the reminder text for Split second ("As long as this spell is on the stack, players can't cast spells or activate abilities that aren't mana abilities.") and end the turn ("Exile all spells and abilities from the stack, including this card..."). From this we learn that normally people can cast spells and abilities, and that these go onto "the stack". And if you know what a stack is, then the resolution order follows from that.

From the article and video I got the impression that the goal was to give animators control over the robot's motion, while maintaining stability. The animators will not have a good model of the physical robot in their head, and that is what this model is correcting.
Raising wages are not the only way to make the poor relatively richer. There is also all kinds of taxation and welfare programs.
> The problem is that they fail differently than humans do

That is a great argument for giving such a model as an aid to a human doctor. Together they will be better then either one alone.

Re:Smoltcp: A small TCP/IP stack in Rust on Thursday June 20, 2019 @09:16AM (#20232573)
In something like a TCP/IP stack correctness is strongly related to safety. For example, it could be perfectly memory safe, but deliver packets to the wrong address, allow other programs to read all traffic, or allow easy denial-of-service attacks.

Older »