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
Some lessons were impressed on me by reverse example. When I was young, I perceived grown-ups behaving quite oddly at times. I remember being shocked or dismayed by things I observed and making silent vows not to behave as they did when I grew up. For instance, my mother, when confronted with a line waiting at the movies, would go up to the box oflice and say, “I am Mrs. Eugene Meyer of The Washington Post,” and demand to be taken in and seated. At that time, she did indeed get in. l cringed with embarrassment and hoped the ground would swallow me up. It had such a lasting effect on me that I have never been able to deal with headwaiters in restaurants who put you “in Siberia” rather than the better part of the restaurant. I just go meekly to Siberia.
Saturday, November 25, 2017
Defensive Programming
Programming Defensively :
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:
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
You have
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;
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
Congratulations. Enough said..
http://nocamels.com/2013/03/dov-moran-talks-to-nocamels-about-sandisk-comigo-modu/
http://nocamels.com/2013/03/dov-moran-talks-to-nocamels-about-sandisk-comigo-modu/
Subscribe to:
Posts (Atom)