HNHacker News
TopNewBestAskShowJobs

smcdow

61 karma · joined May 5, 2008

submissionscomments
smcdow··on Why Systems Programmers Still Use C (2006)
How do you handle DMA and other I/O in your system?
smcdow··on Reinventing tools for developers, let's start with unix terminal.
Um, no mention of shell functions? I recommend to the author that he spend a full day carefully studying the bash man page.
smcdow··on Combining coins to reach a target sum (C, Python)
So what? Even then, there will be no concurrency issues in a single threaded application.
smcdow··on Combining coins to reach a target sum (C, Python)
Please explain why this would be true for single-threaded applications.
smcdow··on Combining coins to reach a target sum (C, Python)
A (possibly) cleaner way would be to use Boost.asio. I haven't yet evaluated the POSIX Signal handing part of Boost.asio, but I'm hopeful that it will be useful for my purposes.
smcdow··on Combining coins to reach a target sum (C, Python)
I'd keep an int flag, initialized to zero. The sighandler sets the flag. The flag is checked (and reset) on entry to newCoin().

Not exactly pretty, but using signals to trigger to produce reports isn't exactly pretty either.

Unfortunately, signals are often abused in this manner. Not a big deal for such for this small piece of software, but in larger systems this kind of abuse can cause very hard to fix bugs.

smcdow··on Combining coins to reach a target sum (C, Python)
FWIW, printf() is not async-signal-safe. It's bad form to call such routines from within a signal handler.

Here's a list of async-signal-safe functions (scroll down): http://pubs.opengroup.org/onlinepubs/009695399/functions/xsh...

I know I'm missing the point of the post, but it is a particular nit that I pick. You'd be surprised at how often this happens in production code, and how often it causes mysterious, hard-to-reproduce bugs.

smcdow··on Android crushes iPhone, makes Google $5 billion
I think the only real metric that matters is: Which platform generates the most revenue for developers?
smcdow··on Show HN: An OS X music library I've been working on for the past year.
I'd love to get rid of iTunes, but AirPlay is a complete necessity for me.

iTunes + AirPortExpress == poor-man's-sonos.

Also, podcasts would be good.

smcdow··on New BMW i8 gets 94mpg - visually makes Iron Man's Audi look like a Honda
Sorry, but real BMWs have only two wheels. http://www.bmwmotorcycles.com/us/en/index.html
smcdow··on Why you should have a long commute - The opportunity of commuting
He claims his commute involves one hour per day walking and one hour per day riding on a train.

THIS IS NOT COMMUTING.

Commuting is getting in your car and sitting in traffic for two hours per day.

smcdow··on Founder begins eating a stick of butter a day
This is simple, standard Paleo diet behavior.

Here it is in a nutshell: No grains nor legumes; minimize fructose; minimize PUFAs; emphasize MUFAs and saturated fats, especially short- and medium- chain triglycerides; aim for 20% carbs, 65% fats, 15% protein (by caloric value); fiber is good (because your gut bacteria convert a lot of it to SCTs and MCTs).

The 20/65/15 ratio may need to change depending on how active your are and how damaged your metabolism is.

Butter contains a fair amount of butyric acid (a short-chain triglycerides), so it would make sense to add it to your diet. I prefer coconut oil because it is about 50% MCTs and typically doesn't require refrigeration. I eat a lot of it, and it tends to fire me up like a rocket.

And, yes, I've lost approximately a shit-ton of weight on a Paleo diet.

smcdow··on The Technical Origins of Trent Reznor (of Nine Inch Nails)
Props to Trent and all, but Kraftwerk was doing all this and more in the 1970s. They're the original Mensch-Maschine.
smcdow··on Pipeable Ruby - forget about grep / sed / awk / wc ...

  ps -ef | grep foo | grep -v grep
Will fail if foo="grep"
smcdow··on Pipeable Ruby - forget about grep / sed / awk / wc ...
Drop it in your .bashrc and just type "psg foo"
smcdow··on Pipeable Ruby - forget about grep / sed / awk / wc ...

  function psg () { [[ -z "$1" ]] && return ; local _first=${1:0:1} ; local _rest=${1:1} ; [[ -z "$_rest" ]] && _rest='[^]]' ; local _com="ps -ef | grep '[$_first]'$_rest" ; eval "$_com" }
smcdow··on Pipeable Ruby - forget about grep / sed / awk / wc ...
Out of curiosity, I tried this and it worked fine:

  seq $((2**32)) | perl -ne '/find me/ && print'
smcdow··on Pipeable Ruby - forget about grep / sed / awk / wc ...
Seriously? People still do this?

  ps -ef | grep foo | grep -v grep
This always works:

  ps -ef | grep '[f]oo'
And, if you're running a modern operating system:

  pgrep foo
smcdow··on Angry Birds maker apologizes for Android fragmentation issues
Does no one in HN understand the basic concepts of configuration management?
smcdow··on Texas, here we come: Migration to the lone star state
Look in Rosedale. You can still get a good house for under $500K.
smcdow··on Google Chrome for Linux goes stable
Where the stable version for RHEL-5?
smcdow··on MySQL Doesn’t Always Suck; This Time it’s AMD
Workaround? Are you suggesting that MySQL somehow hotpatch the kernel (which is what would be needed to fix the problem)? When was the last time you saw a userland process hotpatch a kernel? This issue belongs to the kernel hackers, not userland people. And a killswitch? Great. Then what? Go buy new hardware?
smcdow··on SquirrelShell - a cross-platform alternative to (e.g.) bash and cmd.exe
Until system scripts start being written in alternative shells (which will never happen), I wouldn't bother learning any other shell than /bin/sh (and, by extension, bash). For more complex applications, stick to Python.

Also, I never really understand why everyone wants to tout the "cross-platform" nature of their applications. You always run up against OS differences fairly quickly, negating any supposed "cross-platform" benefits. Especially if you want hooks into the OS (and who doesn't want OS hooks?)

Cross-platform apps that do provide hooks into the OS are excepted: those are indeed useful: Python, etc.

smcdow··on Fewer Calories (Carbs, Protein or Fat) Are Called Weight-Loss Key
Yes, calories==energy. But why is it necessarily "spill out all over"? If thermodynamics apply (and they do), then adding more fuel to a fire makes the fire burn hotter. Or, to keep the car analogy, pumping more gas to the engine makes the engine run faster, and thereby consume all the fuel being pumped into it.

So, by analogy (and since we're talking about simple thermodynamics), eating more calories should make your metabolism run faster. More fuel, more fire, higher rate of fuel consumption. This is definitely true for those people who can eat lots of food and never get fat. Ectomorphs.

So, why doesn't this rule apply to everyone? Why do some people store what they eat as fat and others just burn it all off regardless of how little they exercise. Why aren't we all ectomophs? Genetics may come into play, sure, but all humans have the same genome.

The difference must be related to differences in our bodies. Which means differences in hormonal reflexes, differences in responses to certain types of food, etc.

It is about calories, but it's not _just_ about calories. It's about our bodies, too, and how we've conditioned them to process different kinds of foods.

Highly recommend "Good Calories, Bad Calories" by Gary Taubes.

smcdow··on How to undelete any open file on Linux
whoops, sorry, on crack. You can't after it's been deleted.
smcdow··on How to undelete any open file on Linux
yes, you can. and this is better than copying.
smcdow··on Hello World Executable Sizes in 18 Languages
Oh, brother, formatting.<p> <pre> $ echo 'echo $0' > 'Hello, world!' $ chmod +x 'Hello, world!' $ 'Hello, world!' Hello, world! $ wc 'Hello, World!' 1 2 8 Hello, world! </pre>
smcdow··on Hello World Executable Sizes in 18 Languages
Not really:

$ echo 'echo $0' > 'Hello, world!' $ chmod +x 'Hello, world!' $ 'Hello, world!' Hello, world! $ wc 'Hello, World!' 1 2 8 Hello, world!

8 bytes. I think that's probably as small as you can get.

smcdow··on Hello World Executable Sizes in 18 Languages
It can be done in 8 bytes.
smcdow··on The Difference Between Electrical Engineers and Computer Scientists
Ugh. As someone with an EE degree, this is a nice allegory explaining why anyone with a CS degree coming in an job interview at my company has to demonstrate that they've overcome their deficiencies introduced by the CS program.

Usually a few questions involving pointers does the trick quite nicely.

In fact, I'm almost at the point where I'm rejecting applicants with CS degrees out of hand. I've had too many problems with architecture astronauts and the Java-solves-all-problems crowd.

← PreviousPage 2 of 3Next →