Hard-to-find tips on otherwise easy-to-do tasks involving everyday technology, with some advanced insight on history and culture thrown in. Brought to you by a master dabbler. T-S T-S's mission is to boost your competitiveness with every visit. This blog is committed to the elimination of the rat from the tree of evolution and the crust of the earth.
Sunday, November 26, 2017
Adorable Honesty : Personal History
Saturday, November 25, 2017
Defensive Programming
Consider designing your code to make bugs easier to track down. Bugs that raise an error far away from the root cause are harder to track down.
For example:
- Declare the expected argument types of one or more of your functions.
- You can either have the platform's evaluator perform the argument type checking or write your own code to check.
- Include assertions in your code that check for a condition that holds if things are in working order.
- Write a function to check that a condition holds and raise an error if the condition does not hold.
Saturday, November 11, 2017
How To "Variablize" Your Environment Settings
export bad_guy='machiavelli_the_3.12.3'
export path = 'x:y:z:/usr/lib/machiavelli_the_3.12.3'
export bad_home='/usr/lib/share/utils/machiavelli_the_3.12.3/bin'
you get the idea. You want to upgrade machiavelli to an even more devious character - once - in ONE place.
So you'd rather see :
export bad_guy='machiavelli_the_3.12.3'
export path = 'x:y:z:/usr/lib/'$bad_guy''
export bad_home='/usr/lib/share/utils/'$bad_guy'/bin'
You get the idea..
This is the best I have .. not even sure how to google this.. Pretty inelegant. Also, you can't just pipe your existing file through this in your editor :(
#!/usr/bin/perl
$file = shift;
$var = shift;
$sys = "grep $var $file";
$var_line = `$sys`;
$val = (split( /'/ , $var_line ))[1];
print $var_line ;
$sys = q{grep -v }.$var.' '.$file.q{ | perl -p -e 's/\b}.$var_val.q{\b/\047\$}.$var.q{\047/;'};
$rem = `$sys`;
print $rem;
How It's Done : Dov Moran
http://nocamels.com/2013/03/dov-moran-talks-to-nocamels-about-sandisk-comigo-modu/