You missed the opportunity to make the strokes of the A be the flags.
- 3 Posts
- 353 Comments
anton@lemmy.blahaj.zoneto
Programming@programming.dev•What are some cool and obscure data structure you know of?
1·11 days agoI came up with a kind of clever data type for storing short strings in a fixed size struct so they can be stored on the stack or inline without any allocations.
C++ already does that for short strings while seamlessly switching to allocation for long strings.
It’s always null-terminated so it can be passed directly as a C-style string, but it also stores the string length without using any additional data (Getting the length would normally have to iterate to find the end).
Also the case in the standard library
The trick is to store the number of unused bytes in the last character of the buffer. When the string is full, there are 0 unused bytes and the size byte overlaps the null terminator.
Iirc, that trick was used in one implementation but discontinued because it was against the standard.
(Only works for strings < 256 chars excluding null byte)
If you need a niche for allocated string you can get to 254 but the typical choice seem to be around 16.
I don’t believe you could save the emissions from animal agriculture.
The easiest is to stop converting more land to animals use.
Most animal ag is on land that isn’t suitable for growing crops,
But 6% of global emissions are from feeding crops to animals.
if it was ended, the land would become useless
Aside from reducing our emissions by 16%, meaning it would be about as useful as removing all emissions from the transport sector.
and left to go wild where it would support just as many just as polluting animals,
Laughable, but if if it where true it could easily be solved with reintroducing predators and rewilding the artificial grass lands.
but with no possibility of treating the pollution problem as no one would be managing the wild animals
What is more polluting? Animals shiting in the forrest every day at a different place or month worth of stored manure deposited on one field in a day, with barely any plant at the moment? Which of those will naturally break down and which will be washed into the ground water?
Where are the huge amounts of biomass fermenting into methane? Some swamps and every farm.
anton@lemmy.blahaj.zoneto
Programming@programming.dev•Retro Messenger (Is there anything else a messenger could need?)
29·24 days agoWhere is the source code?
You can’t make any claims about privacy without it.
anton@lemmy.blahaj.zoneto
Programmer Humor@programming.dev•Unsafe Rust: living up to its name
4·27 days agoRust doesn’t have a scheduler.
The issue is the false assumption, that theremoveoperation can safely be done without taking a lock. This can be done in some specific data structures using atomic operations, but here the solution was to just take the lock. The same thing could have happened in a C code base but without the unsafe block indicating where to look for the bug.
I had the same question a few hours ago, but I found some science.
Tldr: 30% of energy use is in diesel, and about half of that is for tilling fields.Rant:
Note that this is energy use, so only CO2 emissions are counted, while methan is ignored. If we stopped farming animals, the effective emissions of the sector would be cut in half. Even if we are unwilling to change out diet, maybe we should look at reducing the amount of fertilizer instead.
The main problem is that, not ploughing increases the need for pesticides, currently around 8% of energy used and reduces yield. While not ploughing increasing requiring 3x the pesticides might not be the case, a 20% reduction in yield seems plausible.
The main energy consumption in farming is fertilizer at around 50%, but more importantly half the emissions are related to animal agriculture. Cutting back on that would actually make a difference.
The commenter must believe forks are magic.
and like half the [rust] devs left for Crab.
Crablang is a joke fork to make fun of a trademark screw up by the rust foundation.
The code seems to be C-style language with curly braces and types in front for variable declarations, probably java. This means the variable must be declared of screen before the loop or it would not compile. It could have a previous value or be uninitialized, but that does not affect the end result.
Because the only brainfuck instructions in your comment where a
-which decrements and 20+, each of which increments.
Mine echos the first two characters from stdin, because of the commas and dots.
anton@lemmy.blahaj.zoneto
Programming@programming.dev•what's the coolest thing you have ever programmed?
5·1 month agoIt’s either printf and stack unwinding in assembly or something to test all possible execution path for very simple multi threaded programms.
anton@lemmy.blahaj.zoneto
Linux@programming.dev•Linux traffic has grown 22.4% in PH this year
17·1 month agoSerenityOS is “a love letter to '90s user interfaces with a custom Unix-like core”.
It’s good enough to be proud of, while alienating normal people, not incidentally, like linux used to, but on purpose, like this sentence does, making it a great for elitists.
Spotify suck at programming. When using the app offline, I can view and play songs and podcasts directly or from the queue, but the menu to add stuff to the queue doesn’t load.
We should name diseases after members of uncontactable tribes. We just need to ask them for their names and … shit.
Headaches cause discard, which helps with the overthinking because you have less options now.
Have you even watched Spice8Rack’s multi-hour masterpiece of a video essay on mill vs discard?
anton@lemmy.blahaj.zoneto
Science Memes@mander.xyz•'Chimpfluencers' Are Sticking Grass in Their Ears And Butts in Latest Viral TrendEnglish
13·1 month agoIt was interesting, but why are we reheating news from 2023 every few month?
But they grow of air and water without significantly consuming the earth they grow in.
anton@lemmy.blahaj.zoneto
Technology@beehaw.org•South Korea police say 120,000 home cameras hacked for 'sexploitation' footage
191·1 month agoThey may not have noticed the cameras or not have a choice to go elsewhere in a reasonable time.




It’s just reference counting with some common sense optimisations. From the website I can’t quite make out wether they disallow cyclic data structures or just leek them, but I’m guessing it’s the latter.
Also the only thing worse than one-indexed arrays (the default) is allowing user defined array start.
Don’t be, there are so many out there, no need to be embarrassed for not knowing a language that prides itself on lot having fortran style line length limit.
After slogging through vhdl, I personally will not voluntarily use a language that forces me to write out stuff like
end if; end for; end func;when three
}would work just as well.Similar deal with
const proc: main is func local # local variables go here begin # finally, the actual code can beginwhere
procmeansfunc voidso essentiallyconst func void main is func begin. Just default to const, remove the redundantfuncs and allow locals to go where they are used, not all up front, even when they are only used in one branch.