HNHacker News
TopNewBestAskShowJobs

gens

503 karma · joined April 2, 2016

submissionscomments
gens··on An efficient power converter design reduces resting power consumption by 50%
Short story they measure the output voltage every once in a while, depending on the load, instead of always measuring it.

> If no device is drawing current from the converter, or if the current is going only to a simple, local circuit, the controllers might release between 1 and a couple hundred packets per second.

> .. To accommodate that range of outputs, a typical converter — even a low-power one — will simply perform 1 million voltage measurements a second; on that basis, it will release anywhere from 1 to 1 million packets.

^ Normal switched-mode converter, though a million is not realistic and they don't always work like that

Considering that today's computers power supplies work at 70kHz, a megahertz is probably too much. (granted PSUs do PWM so i may be wrong, but it depends on the size of the capacitor at the output; then again chemical capacitors are bad for efficiency and block capacitors are huge compared to their capacity so block capacitors would have to be filled more often meaning more pulses meaning more losses on the FETs but then again transistors now have much lower capacitance and resistance then ever before but .. ramble ramble ramble etc)

> Paidimarri and Chandrakasan’s converter thus features a variable clock, which can run the switch controllers at a wide range of rates.

Theirs just varies the rate of (in programmers terms) pool()ing. Like clocking down a cpu when there is no load.

(note: "packets" means pulses, see switched-mode power supply on wikipedia)

gens··on How to securely recycle or dispose of your SSD
Apparently the NSA would. (somewhere around the shredding part; don't have time to find exact)

https://www.youtube.com/watch?v=-bpX8YvNg6Y&feature=youtu.be

gens··on Future of Java 8 Language Feature Support on Android
How about support for C ?
gens··on EFF Applauds Amazon for Pushing Back on Request for Echo Data
I don't know anything about you, but I do know that I know a somewhat fair amount about electronics and mechanics. I'l just respond to the first one.

> no it doesn't. rfid, weight, a camera, can easily do this.

Dirt, egg-white, temperature variations. Rfid on eggs ? I get my eggs from the market. A nice lady has chickens that lay those eggs. I get 50 of them at once, that is much more then it fits in the egg drawer. (bdw lasers are better then cameras) The best solution i can think of are actually weight sensors (your idea). But even that has immense problems in that all eggs are not equal. Meaning that the whole.. what you call the little cup they sit in.. would have to be weighted. Meaning either separate cups or rubber cups, bout of which are a reliability problem.

>And it's no problem living without a cell phone, or central heating, or indoor plumbing, but we don't see many people running to that lifestyle very often.

Hyperbole. But anyway, have you tried living in a forest ? Just because you think it's bad doesn't mean it is. (see that, i can hyperbole too)

>Just because you don't want something, has no bearing on whether other people want it or not.

I didn't say i don't want it. I explained that it is too much trouble for almost no benefit. Some such things are great. I can think of a dozen things that can be done with electronics that are nice, kind-of useful and, most importantly, actually liable (fairly cheap, reliable and fairly easy to do). An egg-counting refrigerator is not one of them.

Mind you that i love electronics. (my desk is littered with it) Would even be doing it instead of programming if it wasn't so expensive.

gens··on Notes on Programming in C – Rob Pike (1989)
>Redis is often thrown around as an example of an excellent, clean C source code base. Look at server.h. It has 34 include statements. Would you rather that every C file that includes server.h have to include these 34 files before including server.h? Seems insane to me.

Good point. This is exactly why I would want that, yes.

gens··on EFF Applauds Amazon for Pushing Back on Request for Echo Data
> see how many eggs I have left

Requires machine vision (or you telling it every time you take out an egg), doesn't have much to do with IoT (unless you want to see that from your TV or phone, that i guess you do).

> what temperature a corner of the fridge is

So many things to say, with the most prominent being that your fridge would have to have a ton of sensors. Again, not much to do with IoT (can even be analog, unless you want to check it on your office computer, ofc).

> have a way to tell when my milk is going bad

This is a lot harder then one might think. Did you buy fresh milk ? Pasteurized milk ? When did you open it ? What kind of bacteria live in your mouth/kitchen ? How long was it open ?

One could put a sensor for a specific gas in the milk package but even that has problems as the thin layer of milk on the side of the package will go sour faster but the milk itself will be fine.

Ofc, the fridge could guess. But you won't know anything for sure until you open the fridge and check. And the extra complexity means not just higher cost but also lower reliability.

> IoT is bringing in some potentially cool stuff, ..

Yes. I intend to, someday, plug a RPI to the TV and lights and put speech recognition on it. Star Trek FTW. But it is no problem living without it all. For a better living i recommend moving to a wooden house (or just putting wood on the inside of rooms), as it is a much better feeling then titanium white painted minerals.

gens··on Notes on Programming in C – Rob Pike (1989)
Because then people know what they are using. And that is more valuable then fixing simple compiler errors.

I'v seen programs that have an "uberinclude", usually named "common.h" or something like that, that includes not only standard libs but also other headers. It is horrible. There is no way to understand what code written with that mind-set is doing, other then slaving over a notebook trying to make sense of it. Granted all encompassing/nested headers don't mean unreadable code. But from my experience with my own code, clear and separate headers (including standard ones) make me write clear and separate .c files.

gens··on Notes on Programming in C – Rob Pike (1989)
>Rule 5. Data dominates. If you've chosen the right data structures and organized things well, the algorithms will almost always be self­evident. Data structures, not algorithms, are central to programming. (See Brooks p. 102.)

I came to the same conclusion, after a while. In the end code is there to process data. (there is meta programming and things like state machines but most programs do hold data in some kind of structures to be processed)

>Simple rule: include files should never include include files.

Yes, please!

gens··on EFF Applauds Amazon for Pushing Back on Request for Echo Data
Those are bad examples.
gens··on A Study of MAC Address Randomization in Mobile Devices and When It Fails
>Side question: the last time I watched broadcasts coming out of my unassociated iPhone, it was specifically asking for certain SSIDs. The set seemed somewhat random (I've joined all of them, but not recently), and I don't think any of them had ever been hidden networks.

IOS, like the linux's NetworkManager (and probably whatever android, didn't check), just assume that the AP could be hidden and try to connect to it anyway. Those people, that did something as stupid as that(for "user convenience"), later implemented MAC randomization in their network managers. Windows has a checkbox for hidden networks.

>Are these broadcasts viable for tracking (it seems like they would be)? Is there anything I can do as a user to mitigate the effects (other than turning off WiFi)?

Yes. No. MAC address randomization helps somewhat, as per glancing at pdf.

All in all just fire up airodump-ng and see for yourself.

gens··on The Truth About the WikiLeaks C.I.A. Cache
As an outsider whose only contact with New York Times is from submissions here, it seems that they don't know what they are talking about most of the time.
gens··on CPython internals: A ten-hour codewalk through the Python interpreter (2015)
Also check out libpng's source.

https://github.com/glennrp/libpng

gens··on Hydrogen – An advanced drum machine for Linux
I find bout of your claims hard to believe as OSX has a sound architecture similar to PulseAudio.

Are the 3ms measured or is it just what OSX tells you ?

A buffer of 3ms at 48kHz holds 144 samples. That means shoveling 144 fresh samples (per channel, ofc) ~333 times a second and sending them to the sound card immediately. That may be possible if your sound card supports resampling (and minor magic) and only without a sound server (OSX uses one). Either that or you have an impressive cpu. Feel free to correct me at any point.

edit: PS This is only the program->sound_card part. Programs themselves add a ton of latency and sound cards add to it as well. In reality even 10ms is beyond perfect conditions.

gens··on Nissan driverless car guilty of “close pass” overtake of UK cyclist
>Self-driving cars should try to avoid collisions regardless of fault and should not adjust that behavior based on who the local liability laws will hold responsible.

I would love to watch a show called "Driverless cars in India".

gens··on Sexism at Uber from Female Management
Seems to me that your manager is more an asshole and/or idiot then sexist.
gens··on The Collapse of the Unix Philosophy
As a contrast, I use sublime. It has (almost) everything I desire. And it saves everything i write, even in the case of a power outage.

Another example would be Acme[0].

>The point is that user preferences are more fragmented and expectations are higher for features, and willingness to learn details and gotchas of a program are lower, which has created the bloated program for the simple things like text editors.

I agree. People are people and people will always be subjective. But there should be a distinction between feature bloat and node.js bloat. Still, ofc, to each his own. (I measure how good it is for me by how much hair i pull out by using it, be it by lack of features, bugs, performance, or anything)

[0]https://www.youtube.com/watch?v=dP1xVpMPn8M and https://www.usenix.org/legacy/publications/library/proceedin...

gens··on The Collapse of the Unix Philosophy
ftp://ftp.slackware.org.uk/slackware/slackware64-14.2/ChangeLog.txt

Just ctrl+f for "xml". (edit: nvm, only 3 reports are bugs. although the libxml2 report has 3 somewhat serious bugs)

"XML is a well established standard" is usually the reason people choose XML for anything. I guess i would add "Nobody got fired for choosing XML" to the list of such sayings, if i had such a list.

gens··on The Collapse of the Unix Philosophy
>True enough, but as a younger programmer, I find it pretty reasonable to look back at computer systems of the 70s and wonder if we can do better today. I feel a little bit gross every time I have to write a bash shell script (or edit config files that aren't JSON/XML/YAML, for that matter), and I don't think that's a bad impulse. That something so inelegant and unsafe is still in widespread use in 2017 really ought to be a scandal.

As a relatively young programmer i look at the computer systems of the 70's and think to myself "what the fuck are programmers thinking when writing today's programs". I mean we got amazing tools and a plethora of amazing languages, an insane amount of memory and an idiotic amount of processing power, chips specialized for sound and even ones for visuals. And yet everything lags.

As for shell scripts, they are fine. Not that you have to use them, as you can use python, scheme, anything (even C with tcc).

As for XML... oh god.. it is the worst, the absolute worst, way to do config files. Jesus help, is it awful. Bad for the user, bad for the processor. Simple key–value pairs (as in "power_level: 9000") are good enough for almost all configuration. Hell even the INI format is faaaaaaaaaaaaaaaaaaaaaar better then XML (and YAML, JSON (although these are themselves better then XML)).

I look at the 70's and think "haven't we learned any fucking thing ?".

PS On topic, the Unix philosophy is still valid. For a plethora of reasons. I typed too much already but if anyone's interested in my "opinion" i'l write it later today. PPS The author of this piece doesn't even know what "the Unix philosophy" exactly is.

gens··on New Rust hash table leads Benchmarks Game
>.. and the cpu load looks about even.

318% is 20% bigger then 265%.

gens··on A self-driving Uber ran a red light last December, contrary to company claims
A talk about this topic: https://www.youtube.com/watch?v=k5E28fp4oc0
gens··on Demangling C++ Symbols in Rust
>You already did a possible security exploit on your example, as you need to guarantee 100% of the time that bla and blaa sizes are always less or equal than buffer_size.

bla and blaa buffer sizes, yes. I mostly string file names/paths, that have NAME_MAX and PATH_MAX. So my excuse here is that all my buffers have the same size (not the best excuse, i know). PS I always sanitize on input if the input can be anything (network/ipc sockets, for example).

>True, but Valgrind doesn't exist in every OS that one might need to work with, specially embedded ones, and according to Herb's talk at CppCon 2015, only 1% of the audience was using any form of static analyisis tooling.

Quick google shows some tools for windows. I don't know how good they are. Clangs static analyzer seems to work on windows, for static analysis. But if it compiles on linux/bsd/osx then people should check before shipping the code.

This just reminded me of the latest Linus rant[0].

Then there is fuzzing and formal verification, that are too much for "normal" programs (these are not C specific).

>The world of C and C++ programming, in typical 9-5 enterprise jobs is quite different from HN ideals about code quality.

As is in the world of hobby C and C++ programming. And python, and ruby, and haskell, and... It just shows more in C. But C is still the king when it comes to portable and efficient programs, and that won't change soon (although there is less need for such programs, as "embedded" today equals "has only 512MB RAM").

[0] http://lkml.iu.edu/hypermail/linux/kernel/1702.2/05171.html

gens··on Using Neutrino to jump-start modern JavaScript development
I see. I meant it as "things implemented in the browser", without any of the million and a half libraries.
gens··on Using Neutrino to jump-start modern JavaScript development
Does anybody just write plain JS ?
gens··on Demangling C++ Symbols in Rust
>That said, as a general rule raw C-style string parsing, which that C++ code is an example of, is asking for trouble. It's painful to write, painful to maintain, painful to debug, and, when it fails, fails in the worst possible way. In my opinion there's little benefit to using C++ for these workloads.

AFAIK Valgrind can catch many memory access related errors. And static analyzers can point out where such errors could happen.

From a different perspective: Why don't people do pascal stile strings with C or C++ (and such) ? I think even i could make a library that does all the string.h things but with length-prefixed strings. People have been complaining for years now about C stile strings (that have been widely used for decades now). But nobody ever did anything about it ?

PS I, myself, don't find it "painful" to use C stile strings. A few basic precautions (like using strncmp(bla,blaa,buffer_size)) and your fine. Off-by-one is more of a problem, at least for me at night (valgrind and llvm static analyzer point even those out).

gens··on Anagram Scoring
You could also use their Levenshtein distances.
gens··on How copying an int made my code 11 times faster
Ok. Like what ?
gens··on JPS+: Over 100x Faster than A* (2015) [video]
And i just implemented A* yesterday...

JPS is great. I remembered it from a former talk a while ago.

From the little experience i have with pathfinding, it seems to be an interesting topic with many little details to be explored. Like smoothing a path, smoothing/tuning a path in regards to loss of "speed" when turning, avoiding dynamic obstacles like other "agents", "flocking" of groups, various different ways of representing a "map", and probably many more.

gens··on How copying an int made my code 11 times faster
C has a pointer aliasing keyword, "restrict".

Also: "Originally implemented for C and C++, the language-agnostic design of LLVM has since spawned a wide variety of front ends: languages with compilers that use LLVM include ActionScript, Ada, C#,[4][5][6] Common Lisp, Crystal, D, Delphi, Fortran, OpenGL Shading Language, Halide, Haskell, Java bytecode, Julia, Lua, Objective-C, Pony,[7] Python, R, Ruby, Rust, CUDA, Scala,[8] and Swift."

Most of these are nothing like C when it comes to pointers and memory layout.

gens··on Drawing Lines is Hard (2015)
Sorry, i meant that it is buggy. Specifically the line\* drawing functions. I filled a 22x22 window with segmented lines and it blanked the window. A line across the leftmost pixels on the window (x=0) behaves differently then anywhere else. And such.

At least i think, as there is no hard spec on X11.

gens··on AMD Ryzen 7 1800X Benchmarked – Giving Intel’s $1000 Chips A Run For It
If your goal is quiet and quiet alone, i would suggest a good cooler. A cooler master hyper 212 is really quiet.

I thought data centers are going for ARM cpu's now, as shoveling data is not all that cpu intensive ?

← PreviousPage 6 of 10Next →