Sep 212012

It’s pretty annoying supporting both Windows and Linux systems. One of the things that comes up over and over is line endings. You’re about to run a script, and immediate get an error about the bash command not found or something bizarre like that. Fortunately, there are easy ways to fix this. (note, in the following, to type the ^M character, you’ll actually be typing ^V^M) Solution 1: use sed sed s/^M// Solution 2: use the same replacement string in vim :%s/^M//g Solution 3 (the really easy way): Use the dos2unix command that comes with most *nix distros: dos2unix

Aug 022011

I hear debates about the speed of languages all the time. Most people who argue for low-level compiled languages cite that anything can be faster with optimized C. True, but if we put in around the same effort in coding, higher level languages can offer better optimization. Java doesn’t have direct pointer access, and so can offer better compiler and runtime optimization than compiled C/++ in some cases, since the JVM has more control over your memory usage. This, though, takes the cake:   In general Python, as a dynamically typed language, and PyPy is one of the fastest JIT compilers for Python out there. Even so, Python is generally much slower than an equivalent program in C. However, this [more . . .]

Jun 182011

I recently began seriously trying to learn Javascript and JQuery. Up til now, I knew just enough to tweak a script or make some WordPress behavior changes when needed, but if I were to do a complete project in Javascript from start to finish, it would probably look like a mess of PHP. (ooh, zing!) In case anyone out there is in a similar position, with a reasonably solid coding background, but looking to beef up Javascript, I found the following resources really helpful: Javascript: The Good Parts by Douglas Crockford — Most JS developers have probably heard of this book, and for good reason. This book really helped clarify how the language should be used properly to avoid many [more . . .]