Archive for the ‘Open Source’ Category
Git on that train
Warning: As the title suggests, I’m on a train.
In the last week and a half or so I’ve been using Git for a project amongst coworkers and most recently for my own code and text files. I was a bit skeptical. But after going through their excellent documentation, seeing the videos, and most importantly, a lot of tinkering, I’m realizing that it’s making life better for me.
There are a lot of resources that compare SCMs, so I don’t want to worry here about which is better and why. But I’d like to share two things that I’ve really liked about using Git.
- First off, using something like Git doesn’t necessarily have to be for a big collaborative project. This may be a sort of different take than the usual, but I like to see it as a tool that helps me see different “views” of my files depending on the job. Anyone who’s written a lot of text or code realizes that it’s actually quite hard to make things as modular as one would like and that sometimes we’re relegated to grabbing snippets of text here and there rather than making black boxes. While this is not encouraged as an engineering practice, it’s sometimes very useful for play. With Git, I’m less concerned about making all my source code fit in a super-consistent modular framework and more concerned with focusing on doing a task cleanly. This is possible because I can branch and merge with relative ease (which I understand is a pain in the ass with other SCMs). In a branch I can move some files around and do whatever I want without affecting the source. I can then cherry-pick commits I like from that into another branch. These branches can look wholly different, but the code can still be updated. This flexibility makes me worry less about organization and directory structure and more about just choosing the right, minimalistic view for the job. I now see things in terms of diffs and commits and Git provides the machinery to do real work with them.
- Git is minimalistic, local, and fast. Which is great. It’s a small source code base that compiles quickly and gives me handy command line utilities. Proper use of them = power (though even with good documentation there’s a learning curve involved). Unlike a lot of SCMs, Git is designed to be local. While it can do a lot of stuff over the network, it’s modus operandi is in a local repository (which is just one .git/ directory in your root directory). I, in fact, don’t even use the SSH/SSL features layered on top. Git helps me realize what I’ve changed and worked on and I build patches from there. You can email them to whoever, and applying them is easy.
And if I’m frustrated with some apparent inadequacy, it’s likely I can find some post with Linus himself justifying it with a little intellegence (e.g.).
PSTricks and LaTeXdraw
Those who are familiar with LaTeX know the power of PSTricks. I’d like to give my two-cents that LaTeXdraw is one of the cleanest and most-straightforward exporters (in this case from SVG) to PSTricks I’ve come across. If anyone knows of alternatives (other than Inkscape) that export particularly to PSTricks, I’d love to know.
R project map-reduce-filter tidbit
The R-project is a great tool set for statistical computing (this is its speciality) and even just to have around for quick calculations, plots [1], and data manipulations. The community is large and the source is open. It provides a nifty Unix-like environment to work in and is available on three major operating systems. </advertisement>
Because of the large community size and the highly-interpreted nature of the language, there is definitely an “impure” feeling about using it since some packages have procedures that will call their own C or Fortran code while others use the language directly. I personally like to see it as a good platform for exploratory data analysis/prototyping ideas, and like to leave the more heavy-lifting to something..different.
That said, since its internals are kind of Scheme-like, the expressiveness of the language for data manipulation in particular can be quite handy [2]. The introduction describes a function “tapply” which is useful for applying functions to groups of items with the same category. In that neighborhood there is also “lapply/sapply/mapply” [3] which are like the traditional “map” function. “subset” is very much like the traditional “filter” function.
Not-so-advertised are the “Map“, “Reduce“, and “Filter” functions (tricky-little capital letters). The differences between the traditional FP functions above and the two R analogs listed in the last paragraph are mostly conveniences for the way R treats its data.
If you use R or are interested in experimenting with it, keep these functions in mind because they can make just a few lines of code do some pretty awesome things.
——
[1] Gnuplot and matplotlib are also pretty good open source alternatives to plotting, and there are of course any non-open source options. In my opinion, experimentation with R is definitely worth the time if you’re playing with plots, and willing to side-step a bit from the Python bandwagon, since Python does have some well-developed statistical and scientific computing tools.
[2] See their “Manuals” section for some good introductory documentation and language definition. Many scripting languages these days support higher order functions.
[3] “mapply” is a neat sort-of multimodal map.
Texify
Link advertisement: I came across Texify a while back. It is great for inserting TeX in HTML notes/documentation/blog entries without bothering with the more in-depth Latexing better suited for article creation.
Jot down that melody
Have you ever conjured up a simple tune in your head but felt like big hammers were a bit inappropriate to jot the melodic thought down? There exists a wonderful thing called LilyPond which takes a TeX-like syntax for music composition and not only renders a neat little PDF or postscript of the score, but can also create a MIDI file of the tune that you can play very easily with a program like Timidity (this program allows you to avoid the sometimes tedious configuring of hardware and software to do MIDI synthesis that comes second nature to more seasoned PC audio folks). Here’s a simple example of how easy it is:
Write a super-sophisticated melody to some file called test.ly:
score {
{ c’ e’ g’ e’ }
}
Now, just run:
$ lilypond test.ly
and it will produce a test.pdf (and postscript) file that looks something like:
Now to create a MIDI file simply add a directive to your file:
score {
{ c’ e’ g’ e’ }
midi {}
}
and rerun the command above. It will produce a MIDI file. If you’d like to hear it with software-synthesized goodness:
$ timidity test.midi
Timidity can, of course, output to WAV or OGG and whatnot for you.
Get more from your computers
If you’re like me at all, you probably find that even with older/alternative laptops and desktops you may have lying around, one of them is essentially the “main” one. Most of these machines (even ones that are many years old) still have it in them to do good for you–whether it be for the little monitor space they provide or offloading some basic media or computations to them. While this is ideal, it’s not all that practical and it may be tempting to sell or scrap your old and stick with the new. Inappropriate.
Taking advantage of a few simple, tried-and-true tools that have been shown to work well across platforms can go a long way. I find these have helped me use all my PCs in a surprisingly integrated and headache-free way so I can focus on stuff I’d rather do:
- A quick way to backup and update files to any machine that allows you to SSH into it (and if you’re so inclined, an easy way to access your files remotely in the same spirit).
- If you’re an occasional or heavy terminal user and run computationally-intensive tasks on machines better-suited for the job than your current one, it might be nice to log out of your system and log back in at a future time to see things exactly as you left them (but with more work done of course).
- Finally, the most important tool allows one to share a mouse and keyboard across computers and across platforms over a local network, making it seem like each monitor is all part of one big desktop in which you can arrange your computers and share clipboard data with one another seamlessly–and a refreshing use of a sleezy-sounding corporate buzz word.

The picture above shows three quite different machines that have been with me for years. They now share the same keyboard and mouse and act as a big desktop when around each other, but still function just as well as independent units.
Laptop wishlist
The time has come where a biennial urge for a new laptop device has shadowed my good senses, intermittently diverting me from all the things that make a young spring so enjoyable. In keeping with previous patterns, I have decided to go with a Linux approach after a wonderful MacBook experience. I don’t like to spend much on laptops. The most I’ve ever spent is on a Powerbook Titanium: a lovely machine, but still a bit steep for a laptop.
I do however tend to use them as my primary machine since I like having my setup go with me places. Fortunately, the file management and backup system I’ve chosen is quite portable whether I’m on a Mac or Linux system so long as it supports decent permissions and a UNIX-like semantic (e.g. ext3, HFS, …). Moreover most of the software I use is either a web application or open source and available on all 3 major OSs.
I’m not one to join flame wars on laptop brands or concern myself with how to get everything working just right on a Linux laptop, but at the same token, experience with a variety of them has built a sort of rough “wishlist” over the years–not so much what a laptop can or should be able to do (you can get laptops to do anything these days), just more on some general themes that would seem to improve my experience, but also things I don’t necessarily have the time to work on myself. My views are biased to Linux and OS X since I stopped using Windows (for no principled reason whatsoever) years back.
Apple is officially the epitome of great laptop and software design that “works out the box” for me. They make great machines, and the MacBook series has super hardware for the price. Since everything is sold as a package, they’ve intertwined their hardware and software in very intelligent ways that leaves me typically very pleased and impressed. There are noticeable things like the snappiest sleep-wake process that I’ve seen: this makes it super-easy to jot notes down and tote the top away in seconds. And perhaps less appreciated things such as how all the audio/multitrack mixing/soundfont midi synthesis/etc works seamlessly (much more than I can say for Linux). Over the last few years they have made strides in making open source Linux-like scientific computing programming more possible and transparent (given that you have XCode installed with a little Fink or DarwinPorts).
Yet with all this, there are times I feel a little trapped in the Apple world. Though software like Gimp and Inkscape is available for OS X, it’s usually a clunky X11 version that isn’t in keeping with good OS X software design. That being said, there are many great OS X specific programs like TeX-Shop or OmniGraffle that do the job just as well if not better than a well-known open source alternative (sometimes at a price). If I can avoid proprietary standards and commitments to a single company/possibly ephemeral software life, I’d like to. This tends to lean me towards using well established open source software that writes files out to simple formats or standards.
The first wish is not directed to Apple so much as the open source community making OS X ports. For the programs written in GTK, moving towards something like GTK on OS X, like Windows did years ago would go a long way in making some heavier-duty open source programs look good and feel snappier on OS X. Speaking of which, the second wish is harder to describe. Things are typically not that snappy feeling and configurable on OS X in general. I can’t pinpoint exactly why, though I’ve brainstormed several possible reasons. I used to attribute this flaw to an intentional design constraint imposed by Apple. While this may be the case for some things, I’m becoming more and more convinced that a bit more gracefully placed configuration settings and some window manager snappiness could go a long way for the next generation of OS X power users. A third wish is that the MacBook Pros would very much benefit from higher screen resolutions for the prices they’re sold at.
Linux has come a long way in making their distributions work out of the box on laptops since my first experimentations with them. The community has done a great job at letting each other know how to resolve issues with Linux in general or with particular distributions (shamelessly). The fourth wish is for the sleep-wake functionality in Linux and laptops to work better (this is a long shot). I’ve had some luck in the past but, for the most part, the kernel always needs to modprobe something again, reload some service, etc., leaving me to a “just boot the computer every time you transport” heuristic. A fifth wish is for companies to continue the growing efforts to support general web apps and software resources (hardware drivers, Flash, legal DVD playback, etc.). The sixth and possibly most practical wish is to have a distro’s community help contribute to a metapackage and post-install scripts that tailor configure settings such that the hardware and software are the most compatible with the machine.
Do it yourself for laptops, unlike desktops, has pretty much been a joke (other than an alright attempt at barebones laptops). The parts are surprisingly standard these days, except it appears you must buy the parts in bulk and invest in manufacturing chassis en masse before an earnest attempt at a barebones laptop company can be made. I sincerely think that a business along these lines could go a long way if marketed minimalistically, carefully, and in large enough quantity to wholesale the parts. Coat some decent utilitarian chassis designs with an elegant web-based ordering system (or reselling through something like newegg or mwave) and I would have a seventh wish satisfied: I would be able to piece together a high-resolution LCD laptop of my own with swappable motherboard, hard drive, and CD rom, all in a solid, hand-picked framework. Finally wish eight, Dell, though your designs and laptop quality has improved over the last few years, the machinery that is your customer service needs to strive for sending their customers along a directed acyclic path.
As far as the current purchase, I’ve gone for a very inexpensive deal on a pretty decked-out high resolution Inspiron 1720, since I feel comfortable developing on a Linux laptop and testing scientific computation programs on some decent portable processing and RAM.