Friday, September 10, 2010

WTF happened to Bob?

I guess he's dole'n it up bro. Come back in a month.

http://nodejs.org

There Ain't No Such Thing As Plain Text

This article definitely shines some like on character encodings. Especially UTF-8 and Unicode.

"It does not make sense to have a string without knowing what encoding it uses."

http://www.joelonsoftware.com/articles/Unicode.html

You have no choice but to read it or it will come back to haunt you if you don't. I'm not kidding. If you say you already know, then I say read it anyway. Wait, let me say it in not a rude way. Can you please, pretty please read this page so you don't screw yourself later on in your code.

I can think of a few instances where my code came back to haunt me when I didn't use a charset/encoding or used the wrong one. Learn from your mistakes, or better yet. Learn from others'.

Wednesday, September 8, 2010

Cohesion for source control by CVSDude

http://codesion.com/



I'm in love.

How to whet your Python and HTML5

Dive into Python by Mark Pilgrim, you can read the full thing online or buy the book.

Join the mailing list, but before you do so I would highly recommend you read dive into python first.

I personally like Python more than any other language I've worked with. It is more of a wrapper language thou. Meaning It's a good multi-platform language that you can develop code that can use other languages as well. You can write you heavy lifting in C/C++ or Java or C# and then use those libraries in python. It's so awesome in fact, that I was left speechless for a while during learning this language in the beginning.

Mark Pilgrim also wrote Dive into HTML5. BTW, If your doing any HTML5 dev work then you need to checkout HTML5Boilerplate which is done by Paul Irish.

Happy coding to you all.

exporting bash aliases and functions into a variable

I'm getting a little git gist happy. :) So here's something just for kicks. I'm gonna start posting other things than bash. Perhaps more python and php code. ATM I'm reading "JavaScript: The Good Parts" I highly recommend this book, it's a good read. Been meaning to read it for a while to brush up on my js coding skills, because I plan on doing a lot of nodejs development here in the near future for a import/export system.

running aliases and functions with sudo, and Blogger bashing

I don't remember where I got this like 3 years ago. Just thought I'd share it because it's very useful. Maybe it will be as useful for you as it is for me.

Blogger seems to always mess up my indentations. So it's not really good for python code. However, this is a bash function to wrap aliases and functions in sudo. I wish blogger wouldn't do that. But wait folks that's not all. It assists me in losing changes too. Gotta love that. If you see me switch over to posterous or not blog on here anymore, then you will know why. Not much incentive to use a system that screws with your text or text formating. hahaha, even Gov. Arnold has a posterous.

Better yet I will place code in a gist and keep ranting :) (I'll leave the below function declaration so you can see how ugly it looks)



sudo ()
{
local c o t parse

# Parse sudo args
OPTIND=1
while getopts xVhlLvkKsHPSb:p:c:a:u: t; do
if [ "$t" = x ]; then
parse=true
else
o="$o -$t"
[ "$OPTARG" ] && o="$o $OPTARG"
fi
done
shift $(( $OPTIND - 1 ))

# If no arguments are left, it's a simple call to sudo
if [ $# -ge 1 ]; then
c="$1";
shift;
case $(type -t "$c") in
"")
echo No such command "$c"
return 127
;;
alias)
c=$(type "$c"|sed "s/^.* to \`//;s/.$//")
;;
function)
c=$(type "$c"|sed 1d)";\"$c\""
;;
*)
c="\"$c\""
;;
esac
if [ -n "$parse" ]; then
# Quote the rest once, so it gets processed by bash.
# Done this way so variables can get expanded.
while [ -n "$1" ]; do
c="$c \"$1\""
shift
done
else
# Otherwise, quote the arguments. The echo gets an extra
# space to prevent echo from parsing arguments like -n
# Note the lovely interactions between " and ' ;-)
while [ -n "$1" ]; do
c="$c '$(echo " $1"|sed -e "s/^ //" -e "s/'/'\"'\"'/")'"
shift
done
fi
# Run the command with verbose options
echo Executing sudo $o -- bash -x -v -c "$c" >&2
command sudo $o bash -xvc "$c"
else
echo sudo $o >&2
command sudo $o
fi
}