Monthly Archives: August 2007

shell split

Dannyman sez:

# octects
oct1=`echo $subnet | awk -F . ‘{print $1}’`
oct2=`echo $subnet | awk -F . ‘{print $2}’`
oct3=`echo $subnet | awk -F . ‘{print $3}’`
oct4=`echo $subnet | awk -F . ‘{print $4}’`
Later, when reviewing my script, Anonymous Coward offered this little gem:
$ set `echo 10.20.30.40 | tr ‘.’ ‘ ‘`
Ok, that’s a reduction from 12 forks [...]

A Day, In Pictures

Gabby was great. Rebecca was great. Theo was great. I got a phone call at work from Rebecca, that she was at the ER and Theo was at the downstairs neighbor’s. Other than a slight possibility of a lack of fingernail, there should be no long term damage.
Still, stressful on everybody, [...]

Erlang wish list

WSGI. I don’t want an apache replacement, or at least have to bootstrap one just to write a webapp. I’d much rather have something very simple and callback based to handle requests and output dynamic data (and push static data through something else. No offense to erlang on that score but …)

for loops in erlang

For loops in Erlang:

for(Max, Max, F) -gt; [F(Max)];
for(I, Max, F) -gt; [F(I)|for(I+1, Max, F)].

My I suggest instead either:

lists:each(lists:seq(Min, Max), F).

or:

for(I, Max, F) when I <= Max ->
  for_impl(I, Max, F, []).
for_impl(Max, Max, F, Acc) ->
  lists:reverse(Acc);
for_impl(I, Max, F, Acc) ->
  for_impl(I+1, Max, F, [F(I)|Acc].

The original version of this code will blow out the stack with non-trivial length [...]

Looking for a career?

If you’re college age, technically and mathematically inclined, and detail oriented… I suggest Civil Engineering.