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
I was doing my daily blog rundown, and this video caught my eye. Go watch it. It’s pretty cool. Of course, a recorded demo doesn’t say that much about the actual technology accomplishments, so I went ahead to check out the lab’s web site. Their technology is named SOINN–Self-Organizing Incremental Neural Network, and their page is here. It seems that SOINN is essentially an online variation of the Self-Organizing Map (SOM), using pretty standard Hebbian learning, and also something called Growing Neural Gas (GNG), which I haven’t heard of before. The SOINN algorithm itself is really interesting, but doesn’t seem as revolutionary as HuffPo and Engadget are making it out to be. It’s another online unsupervised learning algorithm. I’m more interested [more . . .]
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: http://morepypy.blogspot.com/2011/08/pypy-is-faster-than-c-again-string.html 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 . . .]
What a great day today in terms of Unix shell discoveries. Early in the morning, I bought iSSH for iPad and was blown away by how functional it was. The iPad is actually useful now besides being an overpriced e-reader. In the afternoon, someone pointed out ack to me instead of using grep. Faster search, here I come. Finally, just a few minutes ago, I discovered “cd -“, “pushd” and “popd”. No more need to set temporary aliases when I bounce back and forth between directories.
It was about two months ago that a mysterious package addressed to me showed up on the front patio. As I wasn’t expecting any packages, imagine my surprise when I discovered it was a thin, sleek laptop with absolutely no identifying markings. If I were completely rational, I would have looked through the rest of the box, where there was a thick piece of paper clearly identifying that it was the cr-48. Or I would have noticed that that box it came in matched what I saw online, here. But instead, my first instinct upon receiving a mysterious laptop with no markings was to turn it on. Kaboom. The Chromium logo appeared, and everything made sense and nothing made sense [more . . .]
The last four days has been a frentic coding frenzy–coding for 12 or more hours a day on an assignment for Stanford’s CS448B: Data Visualization course. The final product is the Iraq War Incidents Browser. Screenshot is below (click to enlarge). Application and (pretty messy) source code, and a much more detailed description on my CS448B page. Taking the entire data set of the recent Wikileaks leak of Iraq War Incident logs, the application can filter by date and region, and display histograms satisfying each filter. I am willing to call this version 0.5, since the bulk of the interesting data is in the text itself. For the eventual version 1.0, I will be adding the ability to view individual [more . . .]
Or, excuse me. They’ve rebranded as “Aol.” Casing matters. This is confusing. I know that Aol is trying to reposition itself as a content provider for the new social web, but this seems like a major integration problem with the culture clash between TechCrunch which exudes Silicon Valley, and Aol, which is, well, Aol. However, if the purchase price really is only $25 million, that’s a bargain for the brand. Maybe this is why Aol leased out the new building by my house. Taking bets on how long Arrington stays on.
The % operator is colloquially called the mod or remainder operator, and most people assume that its behavior is the same in all languages. I mean, 8%5==3 in pretty much any language with a C-style syntax, including Java. But what if you have -8%3? Or, -8%-3? Or let’s get really funky and what -8.03%-1.88 will be. So here are the rules.Both Java and C/C++ follow the ISO/IEC 1539:1991 standard, which maintains that (a/b)*b + a%b==a. Hence, the % functions much more like a remainder operator than a modulus operator in mathematics. In addition, the ISO/IEC 1539:1991 standard states that quotients always round toward 0 when there are negative numbers invovled, which is why we sometimes end up with negative remainders. [more . . .]
This is one of Lawrence Lessig’s classic speeches. I’m sure most people who read this already hold the viewpoint that copyright law needs a major overhaul, so this video will just be a friendly and clear reminder of why that is true. For those of you who believe that copyright law needs no change, hopefully this video will explain why so many people believe firmly that the current system is broken. The highly ironic part of this is that Warner Music has issued a DMCA take-down notice on the presentation. Really?