Google Style Guide

November 10th, 2009 1 comment

So, I’m reading through Peter Seibel‘s “Coders at Work“, which both Joel Spolsky and Jeff Atwood blogged about. At some point I want to write more about the actual interviews; which are fantastic. But today, I’m just sharing a link of something that I came across in the book. In Seibel’s interview with Brad Fitzpatrick, Brad mentions something about style guides that Google published. Well I found the link to them and passed them around my office and it started some pretty interesting conversations. Anyways, thought it was worth highlighting this link since it’s definitely worth a read through.

The reason I even thought about looking up the link is because there was a discrepancy in the way people were naming Python modules in the project I’m working on, which was making me a bit uncomfortable. I was wondering what the Google folks had to say about it. With Guido, of course, their opinion has some clout in the Python world…

I’m only on the fourth interview and I’ve already been exposed to lots of great material. One thing that I finally did — after years of wanting to take the plunge — is I ordered The Art of Computer Programming books (“volumes”) by Knuth. I *almost* buy these books every single year since 1999, but it just seemed time…if you read the “Coders at Work” book, you’ll see why… One great thing is that they put out a new version of the books in paperback, and they’re MUCH cheaper than previous versions. So that made the decision to finally buy them very easy.

Categories: Programming, Python Tags:

iPhone iPod controls

November 10th, 2009 No comments

I always wanted to know what the icons on the iPod player stood for. Finally remembered to look it up and found a page on Apple’s site explaining it. I wish there was a way on the phone itself to know what the hell these icons meant.

There are times when Apple makes too many decisions and this is one of them. And it’s really just in the fact that whoever designed this interface thought we’d magically figure out that the same icon with different coloring would be clear to the user. I really don’t know how this interface got as far as it did.

Categories: iPhone Tags:

Thoughts on Gould

October 5th, 2009 1 comment

I’ve been mesmerized by Glenn Gould’s performances of Bach for years now. There are certain things in life that seem so pure and right that I don’t feel right analyzing them. His performances are one of those special things to me. They are alive and have this spirit that most other performances are sorely lacking.

I was just listening to Andras Schiff’s rendition of Bach’s Prelude in Fugue in c-minor, and although the playing is flawless, there’s something missing. There is a soul, but there seems to be a lack of purity to it. It’s as if other performers just play notes and Gould brings pieces to life. While listening to Schiff’s recording this all become a bit clearer to me…Gould seems to take a piece, read the notes, process them, and then reinterpret them. He is not really recomposing a piece, as he is putting extra life into it. He’ll do certain things you don’t agree with, but that is exactly what is so great about his readings of Bach. You can feel the anguish Gould has in his analysis of these compositions.

There are certain moments within Gould’s interpretations that one can’t help but just stop and feel the clarity in the music. It feels more as though he has solved something that the rest of us could not solve, than just bringing the music on the page to life. There are many that play, few that inject life.

Categories: Music Tags:

Makefile woes: PATH variable

September 9th, 2009 No comments

Was just writing a Makefile and ran into kind of a silly snag. The Makefile wasn’t finding any of the standard Unix commands (rm, rsync, …). What happened was I set the variable “PATH” to a value that I wanted to use on my script, totally forgetting the special significance of it.

Categories: Linux Tags:

GPush App for iPhone

September 9th, 2009 No comments

I just downloaded the GPush App for the iPhone. Main problem I had with it, is that nobody really specified what it does. What it does, is useful, but not what I expected.

So first, let me explain what I expected. I thought it would be an app that would get messages from a server and let you know when you have new e-mails. I also expected the GPush icon to update itself to reflect how many unread mails I have and when clicked, take me to my *updated* inbox.

What this app actually does is give you a popup notification when you get new mail. It also reflects the number of unread e-mails in your inbox on the GPush icon. What it does not do is update your mailbox in anyway. So your inbox is essentially split up into two icons. And now you need access to both icons. One where your actual mail resides and another just for the number of mails you actually have. And don’t click on that GPush icon, because each time you click it, the app verifies your e-mail. And after you’ve set it up, clicking through to the app is useless.

Setting up your e-mail happens through the app’s own interface, but all the other settings are set within the iPhones settings app. A huge improvement would be to move all the settings to the Settings page, and have the GPush icon lead you to the iPhone’s e-mail app. I’m sure the iPhone restricts the app from doing that, but that would be a huge improvement. There’s also the app google itself put out for GMail. I wonder if they can just link to that. Perfection would be to also have the e-mail downloaded when an update happens…
Some pages I found that are useful if you want to get updates about this app:
Company feedback page
Company Twitter page

Categories: iPhone Tags:

Emacs email shortcut

September 3rd, 2009 1 comment

This a pretty crazy little shortcut for shooting out an e-mail when you’re in the middle of something important. C-x m –> write message –> C-c C-c … That’s it. So the idea is that from emacs you can send an e-mail. I came across it by accident when chording. I knew emacs could send e-mails, but never really saw the point. It’s SO easy that I highly recommend testing it out.

1) C-x m
2) Write out your message
3) C-c C-c

While you’re at it, you can send me some Python/Django/emacs fanciness to: irani.michael at gmail

Categories: Emacs Tags:

Fix indentation on entire file

August 11th, 2009 1 comment

Sometimes, a file is just not indented right (usually happens with HTML files), and is totally unmaintable. Then I find myself opening the file in emacs and manually going through each line and tabbing them to the appropriate indentation. This is really just dumb, and I should’ve looked this up a long time ago, but there’s a built in command in emacs to handle this. All you do is select the text you want to indent — ctrl-x h for the entire buffer — and then do M-x “indent-region”. That’s all. Nifty little trick. I’m going to have to mess around with the other indent commands and see what they do. You can also use the shortcut C-M-\ instead of M-x “indent-region”.

Categories: Emacs Tags:

Firefox Keywords

August 10th, 2009 No comments

I remember reading about the new features of Firefox 3 before it came out many moons ago and how the new bookmarking features would blow our minds. Well, blow my mind, it did. The upgrade actually did such a great job, I forgot about one of the features they really stressed before the release: keywords. The claim was that you could map your bookmarks to your own preset strings and then call up the bookmarks by entering the string. I thought this was an interesting idea, but seemed a bit much. Anyways, when Firefox 3 actually did come out, they included this great feature where the link bar would do a full text search against your link history. This feature made bookmarking things almost useless, since it was probably quicker — and more natural — to type in some text as you remembered it into the link bar, and what you wanted would usually just come up. Pretty amazing stuff.

So now, why did I bring up the keywords if everything’s so great in FF3-land? because they actually add even more utility to this setup. I setup keywords for the things I least want to have to go through a menu for (and for which I probably shouldn’t have to use my mouse): a link to my repository, the company wiki, and our bug reporting tool. I added little keywords for those three things, and really like how simple and easy they are to reach now. This is one of those things that I’m sure you knew about, but it’s so simple to setup, and is actually a great little thing to have in place for those web tools you keep going to over and over. Especially with the advent of web tools taking the place of where real GUIs used to live.

For the sake of clarity, here’s one example of how I use the keywords. I have my bug tracking software bookmark set to the keyword ‘bugs’. All I do is press ‘ctrl-l’ type in ‘bugs’ and it shoots to my bug tracker.

Categories: Firefox Tags:

crontab shell

August 10th, 2009 1 comment

I wrote a Python script that I want to run every five minutes through a crontab. The script ran fine and linked with my local libraries until I ran it through the crontab and it couldn’t find my local libraries. After a bit of thought, I realized that the crontab was not running through the same shell environment as I expected it to. Apparently the shell is set in /etc/crontab file and there it was set to bash. That in turn was calling the wrong version of Python, and that was why my local Python scripts weren’t being found.

There are four different ways around this:
1) Modify /etc/crontab to hit the right shell; in my case (first line modified):


# run-parts
01 * * * * root run-parts /etc/cron.hourly
02 4 * * * root run-parts /etc/cron.daily
22 4 * * 0 root run-parts /etc/cron.weekly
42 4 1 * * root run-parts /etc/cron.monthly

crontab -e

*/5 * * * * python /my/

2) Add the shell value to the top of the custom crontab (crontab -e); in my case:


*/5 * * * * python /my/

3) Run the actual command through the tcsh as so:

*/5 * * * * tcsh -c "python /my/"

4) Directly request the right version of Python:

*/5 * * * * /tools/bin/python /my/
Categories: Linux, Python Tags:

Emacs in shell

August 7th, 2009 2 comments

Most people don’t know this, but you can also run emacs from within your shell (like vi). There are some moments where it just doesn’t make sense to load the emacs GUI, and it’s just nice to know that we don’t have to use vi in those circumstances. All you need to do is add the “-nw” tag when running emacs to load it up in the shell. I also add the “-Q” so that there’s no fancy color schemes introduced.

emacs -nw -Q

The most common usecase for doing this is when you’re committing something from the shell and want to add a comment. Usually the default is vi in these circumstances, but it doesn’t really have to be…

Categories: Emacs Tags: