HNHacker News
TopNewBestAskShowJobs

gens

503 karma · joined April 2, 2016

submissionscomments
gens··on Writing parsers like it is 2017
How about using a parser generator ? Yacc, ragel, bison, etc[0] ?

Nooooo, we have to use rust, because we are not "2017" if we don't.

[0] https://en.wikipedia.org/wiki/Comparison_of_parser_generator...

PS I use C. I say this to align my post with the "Rust is the best and i use rust" mentality of the article.

EDIT: Also, this article says absolutely nothing about actually writing a parser.

gens··on Exploring strategies to decarbonize electricity
> Congrats on your "stuff" degree.

"Technician for electro-machinery", but it doesn't matter since we all learn mostly the same "stuff" (i guess i get a bonus on generators, +5 to inductor calculating and winding).

14 hours and maybe a couple good arguments in the whole thread. I responded to the other person as to why this is just a nice graph for the masses to enjoy.

gens··on Exploring strategies to decarbonize electricity
That the model is useless for anyone actually wanting to do something about carbon emissions (or about anything really).

If you told a senior engineer of a power company that you want to reduce carbon emissions by/to some value, they would take out a notebook and pull out real data from power plants and distribution things (power lines, transformers) and tell you how much money and time they need to do it. They would not do hypotheticals or some graphs based on some generalized models of a power grid, but real equations based on real data.

Solar does not work the same in Saudi Arabia as it does in Norway as Norway gets less sun. It is similar for wind and all the water powered plants. Some solutions are much more viable for some places (my city is bad for wind and so-so bad for solar (there are maps for bout), but just some 50km away those become somewhat viable options (wind more then solar).

There is also the power loss on distribution. For example the loss on power distribution in my country was 15% when i went to school, where it should be 5%. The engineers working at the power company knew exactly why and where the problems are. Funny enough hotter countries have inherently more losses there.

Engineers know what must be done to accomplish something, and it is not done by making generalized "models" (water power plants are usually the best solution, after/next to nuklear).

(I'l skip over the huge problems with wind and solar power that were probably not solved properly here, as i don't have time now)

In the end the real proper solution is to better isolate houses use more efficient electronics. That has been going strong as most "developed" countries subsidize the construction of your house if you use better materials and practices, and there are stricter.. restrictions on what kind of electric devices you can sell (for example you can't sell a vacuum cleaner with power usage over 1.5kW, as many were making high power but inefficient vacuums).

TLDR: It doesn't work that way, and engineers already know what to do but don't have the money to do it. It is not a technical problem, but a political one (as almost all bigger problems are).

PS Ironically, these interactive web graphs are very power inefficient.

EDIT: Just to be clear; if the difference between the amount of power you get from 1m^2 of solar panels in Uganda and the same in Sweden was 5%, and the difference in cost of building a dam on soft soil versus building it on hard soil was 5%, i wouldn't say anything. But the differences are massive, making one way of generating power much more cost effective then another in one specific region (and solar and wind have a big problem of storing power, that is also a bit region specific; IIRC Hawaii has that problem now).

gens··on GNUstep LiveCD 2017
No, it's tied to systemd. That was one of the big reasons behind systemd adoption in the first place.
gens··on Unreal Engine 4.17 Released
To try and give a slightly better answer then others, without complicating too much.

My thought it is because they use the default shaders (and/or the artists do glossy too much). That said..

Most, if not all, modern big engines use "deferred shading" and support normal/bump maps, gloss/reflection maps in addition to "normal" textures (lately every rendering engine that focuses on being realistic is switching to "Physically based rendering", that is very similar to "normal" rendering except that it obeys the "amount of (light) energy out can not be greater then the amount of energy in"(this also means linear light space, instead of logarithmic like we humans perceive)).

All the big rendering engines can, with the same equations in shaders, produce exactly the same result. The same results in regards to the direct "shading".

The other part of how a thing looks is lighting (aka "global illumination"), where the actual engine code is a lot more involved. Since you can't make, like raytracing does, light bounce off of things, you have to cheat (it uses too much processing power). Rendering engines cheat by, for example, plunking "light probes" around (unity had a good post about them, i can't find it now). The slight differences in lighting may not seem like much in a side by side comparison, but our brains use those little lighting clues meaning they(we) are sensitive to them.

There is also how many lights a rendering engine supports (and the distance they can cast light), how it does particles and can they emit light, how it does volumetric.. things (like smoke, maybe water and such), how good it is at reflections (are they precise, do they include dynamic things; note that they probably don't bounce twice), subsurface scattering (notable on skin), and probably more that i forgot.

Note that i simplified plenty. For example lighting and shading are closely related.

PS Reality is not like basic theory. Physically based rendering does give real world results but in reality everything has dust on it, or an oxide layer (aluminium especially), or a sulfide layer (copper likes sulphor). The other imperfection is the minor imperfections in smoothness, what the collective "they" do take into equation (see https://www.cs.cornell.edu/~srm/publications/EGSR07-btdf.pdf).

PPS "Physically based rendering".. as if Phong shading is based on something else. (PBR is still no where near reality, for reasons above)

gens··on Risks of Artificial Intelligence
Whoever is using it to make said decisions.
gens··on “We currently have no plans to support Xwayland”
I have something against dbus. Bout the protocol and the implementation are very much over-engineered. The protocol at least has an excuse.

In the desktop things, that wayland aims to do, dbus is useless. (actually i don't know what it's useful for at all, other then quickly hacking some object oriented (gui)client-server desktop program)

I do recommend reading the dbus protocol (the protocol, not the API).

Sorry to sound negative but "modern linux" now means "desktop crap", and it is all crap. Freedesktop.org (the linux "desktop" "standards" authority) has gone from "ehh, passable" to "complete crap" in the last... idk 5-10 years (the "desktop" quoting is because it has gone pass the actual desktop problems).

gens··on 24-core CPU and I can’t move my mouse
Not on my computer. Something like a WM will freeze while it waits in queue to read those 0.2kB it needs of the disk (poor software design, if you ask me). But the mouse will freeze when IO buffers get filled. Just writing a huge file to a (slow-ish) usb stick will make my whole computer freeze, including the mouse, because the kernel usb code doesn't limit the buffer to some sane size (there was a kernel patch, and there is an option, and even with it turned on the problem is still there) (note that the probable reasoning for that is the fact that usb sucks).

A mouse cursor, AFAIK, is a gpu thing, not that it matters (wayland, i remember something that, will use normal gpu rendering to render the mouse). In the UNIX haters handbook there is a section about X where it is written that displays used to have 2-3 planes (IIRC, 2 planes + a cursor plane. I do recommend reading the good book, as it is funny).

I remember some talk about better kernel buffers management just for things like this. Memory management in the kernel is one of those actually hard things.

gens··on Minimal PDF
Here you go, a good talk about pdf.

https://media.ccc.de/v/27c3-4221-en-omg_wtf_pdf

gens··on Effectively Using Matplotlib
How about gnuplot ?
gens··on Efficient music players remain elusive
I have been playing with making a player to learn a few audio decoding libraries. Using dr_flac, LAME, and nuklear for the gui I made a simple player. It turned out to be extremely efficient (cpu-wise, memory is the next step).

Nuklear, the gui part, I know to be extremely inefficient. Due to it not being called that much (refresh every 10ms, IIRC) it uses an insignificant amount of cpu time.

dr_flac and LAME are efficient enough, especially considering the work they do.

Note that LAME can do fixed-point, while dr_flac uses floats. This is very important when talking about power efficiency, as floats use much more power.

Sending the PCM data to the sound card (using ALSA) takes an insignificant amount of cpu time (memcpy to fill the buffer, that is ~172kB per second (44100 * 2 * 2 / 1024 ; 2 channels of 2byte samples at 44.1kHz)). Though ALSA (speex) resampling 44100Hz to 48000Hz does take a significant amount of cpu time (IMO best to resample while decoding).

On "modern" linux there is also Pulse Audio, that takes that resampling overhead from the program onto itself. Note that PA (idk if still) uses floats to resample, making it very inefficient.

Floats on modern x86/amd64 cpus are fast, as fast as integers (although float operations have a delay so it turns out slower). More important is that floats use much more power to compute. Another thing with power efficiency is that modern cpu cores go to sleep to save power, so one should not wake them up every milisecond to check on something.

As for the article;

>After downloading hundreds upon hundreds of kilobytes of zip file, fire up a shell, run mpg123, and wowzers. It plays MP3s smoothly and efficiently. A remarkable feat of engineering, especially considering it’s all written in plain old C without leveraging the synergies of dozens of frameworks. One wonders how they managed.

I want to say "no shit".. so... No shit. For multiple reasons.

>Time for an old standby? What’s Winamp up to these days? Oh, great, looks like more internet radio nonsense. And the website has the modern flat square design I’ve recognized as a harbinger of impending disaster. Sigh.

Winamp doesn't even get the chance because the website looks signals an "impending disaster" ?

gens··on System programming in Rust: beyond safety
>You may find calls to functions from the standard library to be converted in surprising ways, while touching undefined behavior can eliminate evaluations, branches, function calls and more.

Yes, things like memcpy and printf are (in most cases) built-in in compilers. Not surprising really.

Undefined behavioral is bad programming, if your ask me. Almost all examples of it, that i ran across, are in really ugly code that only a "smart" programmer would write.

Clangs static analyzer points out undefined behavior, and gcc is close to getting a "-Wundefined" flag that points that out at compile time.

A optimizing C compiler can change the resulting code even more then just doing dead code elimination. But the point still stands, that C maps well to assembly and that languages that do things like their own memory allocation are not even comparable to what the cpu provides (only automatic memory allocation that a cpu somewhat provides is the stack, and C exposes even that).

gens··on System programming in Rust: beyond safety
https://docs.rs/bitflags/0.9.1/bitflags/ vs https://www.tutorialspoint.com/cprogramming/c_bit_fields.htm

But i give up, as this isn't a technical discussion.

gens··on System programming in Rust: beyond safety
>What does "native" mean, built into the language? Why does it matter?

I don't know how that macro works, but in kernel C bitfields are used in structs that map to device registers (that are mapped to memory).

>I suspect it's the same with type punning (though also, to some degree because we're still working out the details of what exactly the semantics of unsafe are.) In the end, you can always cast stuff to bytes and then cast those bytes to something else.

So if i want to store a series of things with random (length) types in a single array, i can ? Sounds like i can, even though you explained the simpler case.

>I don't take (too much) objection to that, and little with "not much more", but that doesn't mean that C has some secret stuff that only C can do, which it feels like you're implying.

And for the third (edit:second) time, that is not my point. Thing is that C does not have "secret stuff" and rust does. In C you get what you wrote, and not much more. There is no need for telling the compiler to not do some checking or to not make a copy of something. (edit2: granted, bitfields are not native to cpus as type punning is)

Rust, IMO, is more for the C++ crowd then C. And those two are very different.

gens··on System programming in Rust: beyond safety
>https://crates.io/crates/bitflags

Not native, see C.

>Rust's raw pointers have equivalent power to C's pointers.

Again, AFAIK you can't do type punning.

That wasn't even my point, that was that C gives you almost everything a cpu does and not much more.

gens··on System programming in Rust: beyond safety
C is not only better for performance, but also because you simply can not do some things in most other languages. Rust lacks bitfields, for one. But the bigger thing are pointers. AFAIK you can not do type punning in rust, and i don't know if you can do other pointer plays. (note that pointers are barely even mentioned in this blog post)

IMO rust is a replacement for C++, not for C. C is much closer to assembly then most all other languages, especially those that deal with memory allocation natively.

gens··on Why Threads are a Bad Idea (for most purposes) (1995) [pdf]
Obligatory CSP[0] reference.

There are only a handful of examples, that i can think of, where threading(multiprocessing, concurrency, and other names for it) is useful.

[0] http://www.usingcsp.com/

gens··on Hackers Are Hijacking Phone Numbers and Breaking into Email, Bank Accounts
> Why would they care?

Because it is their job.

gens··on An Introduction to the CAN Bus: How to Programmatically Control a Car
Sure.

https://www.youtube.com/watch?v=MEYCU62yeYk and the mentioned paper i assume is https://ioactive.com/pdfs/IOActive_Remote_Car_Hacking.pdf

gens··on Stop trying to ‘be original’ and be prolific instead (2016)
It was a long time ago and i did do more of the heavier construction then stuff like painting.

Biggest thing i learned from doing things quickly is where precision matters and where not. For example if i'm painting the ceiling it doesn't matter if i touch a wall as i will paint that wall later (unless i splat a bunch of it, ofc), but it does matter if i touch the ceiling when i'm paining the wall. Of course painting things quickly brings the risk of spraying paint around, especially when using a roller. Painting things too slowly can also be bad if the paint is highly viscous, like with the paint for outside metal surfaces (railings) as it ends up being obvious where you stopped to detail something else. Or wall paint if you cba to do it in two layers so you mix thicker paint and do it in one.

With windows specifically (and doors and such) you would put the.. paper tape (idk how to translate it) (edit: masking tape) some 2 or more cm wide on the edges so you would have a nice margin of error. With paining fast there is a bigger risk of going over it, and that can be bad (oil based window paint on a wall is really bad, wall paint on a window easily goes away with a wet rag).

In most construction it doesn't matter if you are little off, it was just me being anal.

TL;DR I learned where it matters to go a bit slower and where i can go fast without consequences.

edit: Forgot to answer the question. Yes, i did get better. Mostly because i learned where i can go fast and where i need to pay more attention. Learning to not wave brushes full of paint around like a figure skater also had a bit to do with it. I did also learn that some things come out better by default if you do them fast.

gens··on Stop trying to ‘be original’ and be prolific instead (2016)
My 2 moneys.

I worked in construction a while ago. I was always slow, pedantic, and the work i did usually reflected that (usually, some things benefit from being done fast). Everybody kept telling me that i was slow so one day i said "f it" and started working faster. The quality of work went down, for obvious reasons, and never got to the quality that was before (for most of it, some work like cutting things to size stayed precise). But if you, for example, paint a hundred windows really fast, you will probably not find many windows painted nicely. (mind you that nobody notices the little imperfections in construction, like, for example, a drop of white wall paint on the white radiator pipe)

Of course doing more means learning more, but so does thinking and experimenting.

Pottery, i never tried, but i assume it is more about the "feel" then anything else. While programming benefits a lot more from learning random stuff. It's easier to write a huge mess of code that works fine then it is to make a huge pot that doesn't fall apart.

All in all, why not bout ? Hack some 100 programs quickly, and write a couple programs with lots of preparation and research.

gens··on ElectronConf postponed until a “more diverse slate of speakers” can be delivered
>(https://twitter.com/nmsanchez/status/870811022306574336)

I usually hate doing this, but hey.

From that twitter:

>OG tech diversifier. GitHubber. Lecturer, UC Berkeley Haas School of Business.

And her github is: https://github.com/nmsanchez?tab=repositories

Two repositories have only a README, with, more or less, one line in it. One has a document about, not surprisingly, "diversity in tech" (and a code of conduct, ofc). And one is a fork. Her contributions to other projects sing the same song.

There is also a link there to her profile on https://medium.com/@nmsanchez

>Lecturer at UC Berkeley Haas School of Business. VP of Social Impact @ GitHub. Founder of Vaya Consulting. Purveyor of fine race/class analysis.

All this kind of behavior rubs me the wrong way so i won't even comment on it all.

To be honest i never had a high opinion of electron as a piece of software, so i don't know why i am even here. Sorry, i guess.

gens··on GNU Shepherd
There are many amazing GNU projects. Just yesterday I found out about GNU radio. I also remember reading the initial commit for Gneural and thinking "wow, this code is really nice".

I think GNU deserves much more support then it's getting.

gens··on GNU Shepherd
I don't know what they use. I do know that you can use the proc events over "connector" to get all the forks and execs. That is how I would do it.
gens··on Ohio Sues 5 Major Drug Companies For 'Fueling Opioid Epidemic'
In my experience.

In Croatia you have to be very much in pain to be prescribed opioids. The strongest pain killer i got is Voltaren, for toothache. A friend got opium, or some derivative of, when he got chopped up because of cancer (same goes for other major surgeries).

We have good, state employed, doctors.

I have seen some heavier drugs prescribed by shrinks, but i don't know how (physically) addictive they are.

If you ask me, the whole USA medical thing is broken by design.

gens··on The Race to 10/7nm
It is hard (read expensive) to go under 14nm.

Sophie Wilson talks about it much better then i could. https://www.youtube.com/watch?v=_9mzmvhwMqw

gens··on Electric Cars Soon Will Cost Less Than Gas Cars, Research Suggests
Tangents:

Vacuum tubes can work a very long time without breaking, if they are never turned off.

Wankel engines have less moving parts then piston engines and can last longer because of it. Problem with Wankel engines is that they need heat and a good seal to be efficient.

Stirling engines could, in theory, be superior to bout piston and Wankel engines, in efficiency and lifespan. [0]

Fuel cells used to power electrical engines is yet another alternative that combines the high energy density of liquid fuel with robustness of very few moving parts.

[0] https://www.youtube.com/watch?v=H_Vnxapd5fs

gens··on A brief history of IPv4 address space exhaustion
IANA sold the blocks. There are still a lot of unused IPv4 addresses. IANA sold the blocks.

PS IPv6 sucks.

gens··on America’s Cars Are Getting Faster and More Efficient
Electric cars have constant torque. And it's a smaller car then all those listed. That's probably why it feels faster.
gens··on My Kid Will Never Hack Linux
That's why i said that the hype behind rust is unreasonable. Just look at your post. Is it an objective look at programming ? Or just a lot of words that make rust look like the greatest thing ever ? If you think it is objective, what you wrote that is, then why did you not spend 10min looking at Ada ? Why did you even mention GC, the tired argument as to why "rust is better then Go (note: go has a thing that is more awsome then anything in rust, not that you would care; also go can be used without gc) ? Not that it matters anyway. There is more to programming languages then "features". There is no "perfect" programming language. Rust is most definitely not a replacement for C. And it sucks at "systems programming", whatever that is (for kernel programming, C is definitely a lot better). Just the mere fact that i will not talk about the shortcomings of rust is a clear indication that there is too much hype behind it (you can blame it on the "loud minority", but there is none).

Feel free to write yet another page of text about how rust is the most greatest thing that is great and i am wrong.

← PreviousPage 4 of 10Next →