Friday, December 7, 2012

python debugs


3 categories of bugs:
1. actual bugs - logic and more: I did not visually see the schema change - so ran into run time issues
2. code bugs : forgot to test all code paths.
3. Typo: possibly as I worked remotely on this. Existing code stopped working as I accedently removed a "," in between 2 strings

Monday, June 18, 2012

pain of line endings - remove the dos line endings

The pain of \r\n. If your scripts in *nix are giving strange errors, dos line endings might be the issue. The issues of mixing Windows and Linux.


# remove dos char endings from a file
for i in $* 
do
  sed 's/\r//' $i > $i.out && mv $i.out $i
done


Save as script.sh, and run on your troublesome files.
script.sh <files>
e.g. 
script.sh *.sql