• About

    Swaroop C H is 29 years of age. He is a coder and startupper. He has previously worked at Yahoo!, Adobe, his own startup and Infibeam.


    Read more about him


    Email: swaroop (at) swaroopch.com

  • Subscription

    If you want to know when new stories and articles appear on this website, you can receive them via:

  • I'm a Wannabe Hacker

    The Glider: A Universal Hacker Emblem

Archive for the ‘Design’ Category

Insightful books about Computing

Friday, July 29th, 2005

Banker asked me whether “you know of any good IT bios, or books related to gaming or animation or coding that are interesting enough to a layperson”.

So, I came up with:

Any other recommendations?

Note to self: I should read all the essays in these books as well.

Tiger Dictionary

Wednesday, July 20th, 2005

Just discovered a new shortcut for the Dictionary in Mac OS X Tiger – Press Cmd-Ctrl-D and voila, it shows the meanings of the selected word in my browser!

Shortcut to see dictionary meanings

P.S. In case you are wondering, I’m reading the RSS feed for Sepia Mutiny.

Update: The shortcut works everywhere, not just the browser.

Update: Premshree has written a Greasemonkey script that does the same for you on Firefox, although I don’t know if it’s okay by OneLook’s TOS since it does site-scraping.

SQL and XML are not that different

Monday, May 9th, 2005

About a year ago, I had presented my 8th semester presentation on Xen, now called C Omega. It is a language that combines SQL, XML and OOP into one tight language. The paper that proposed this language was named Programming with Circles, Triangles and Rectangles. The circle represents the encapsulation behavior of objects and OOP, the triangle represents the tree structure of the XML and the rectangle represents the tabular structure of databases.

Video of Anders Hejlsberg talking about C# 3.0

I recently came across Anders Hejlsberg’s interview on Channel 9 regarding programming data in C# 3.0 and it looks like C-Omega is going to be ‘merged’ into 3.0. Its amazing that MS has taken this concept (which seemed totally radical to me when I first read about it) to production quality and is actually going to make this a core part of their platform.

Let us consider an example of using C-Omega. Suppose you want to handle books in a program used to manage libraries. Then you could write a book class using C-Omega as

[code] public class book { sequence {

string title;
choice {
  sequence{ editor editor; }+;
  sequence{ author author; }+;
}
string publisher;
int price;

} attribute int year; } [/code]

The cool part is that the above same class can be used to store the data either as XML or in a relational database. You can also instantiate an object using XML syntax:

[code] book b =

<first>Swaroop</first><last>C H</last>

www.byteofpython.info 250 ; [/code]

Note that this syntax is still static typing. Needless to say, the C-Omega compiler must be one heck of a monster.

The Python connection is that the C-Omega-ish method of access will probably be included into IronPython at some stage. Even if that doesn’t happen, we already have Pythonic ways of doing XML as pointed out long ago by wspace.

If you have ever written a program that uses databases, I highly recommend reading the Circles, Triangles and Rectangles paper. It just might change the way you think about databases and SQL, or even XML for that matter.

You can also download that old presentation of mine on Xen.

G4Swaroop

Wednesday, April 27th, 2005

A close friend of mine had been to the US for work in his company’s headquarters. I had asked him to get me a laptop and I’ve been playing with it since the night before yesterday.

What kind of laptop? It is a 12-inch Apple Powerbook with Mac OS X 10.3.9. It has a 1.5 GHz RISC processor (apparently, equivalent to a 3GHz CISC processor such as Intel/AMD ones) with 512 MB DDR RAM, 60 GB hard disk, Combo drive which can read DVDs and write CDs, a GeForce video card with 64 MB dedicated video RAM, Airport Extreme for wireless networking, Bluetooth built-in, very clear speakers, keyboard with big keys (really like that keyboard), and much more. I haven’t been able to grok all the features, let alone explore all of them…

![11150079][Small][]

I have never used Mac OS before in my life, so, it’s difficult exploring the computer. My previous experience with computers is not helping and the keyboard shortcuts are a bit different and they depend on the special Apple key (which they call ‘Command’ key).

The first thing I tried was to get online. After 20 min of exploring, I finally figured out how to change the IP address, netmask, etc. I think I am getting the hang of using the menus.

![11150080][Small][photo] ![11150081][Small][photo]

The graphics in Mac OS, needless to say, are very appealing. The rollover effects for the tray (or whatever they call it in Mac), the genie effect when minimizing a button, etc. are nice. Pressing F9 causes all the windows to be rearranged such that you can see all of them, click on the window you want to see and it comes up in front. Very nifty; after all, there is no taskbar.

The software installed is amazing as well. I hope to get used to Garage Band soon so I can make starting songs again (I had made one song using FruityLoops a long time ago). The DVD player immediately popped up when I inserted the Yahoo! 10th Birthday Videos DVD (I was so inspired when seeing those videos but that’s another story). All the interpreted languages like Python, Perl, Ruby, PHP were already present. That reminds me that Mac OS X is built on top of Darwin, an open source core based on BSD. iTunes provides a one-click import interface for my Audio CDs. It was a breeze to transfer the songs to my iPod.

![11152077][Small][photo] ![11152076][Small][photo]

If you are still wondering about the “g4swaroop”, my friend joked that I should change my handle from g2swaroop to g4swaroop (because of the G4 processor of the PowerBook) – I thought that was an appropriate title for this post since this is the first post using the PowerBook :)

I still have a lot to explore. I hope to get the hang of it before my copy of Mac OS X 10.4 Tiger arrives. I also have to figure how to “install” software – I have to figure out what the .sit, .dmg and .mpkg extensions mean… that means time to explore the Help (Command-?).

W.r.t. Powerbook and Mac OS X, I would appreciate any words of advice from the Mac veterans :)

Mark down my email

Thursday, April 7th, 2005

Here’s my weird-but-yet-interesting idea of the day…

In most mailing lists (including non-geeky ones), HTML mail is usually discouraged but the newbies still want to make use of bold and italics and the rest.

So, here’s my simple solution:

Allow the user to use a rich text box to get all their HTML-coolness but instead of sending raw HTML, send across the text formatted in Markdown syntax.

The advantage is that the recipient actually has a choice of seeing a plain text view or a HTML fancy view. This also encourages “clean mails”. Power-users will like this feature as well.

P.S. Of course, Markdown is not the only choice of semantic text styles, there are many choices such as reST, Textile and the plethora of wiki syntaxes. I just find Markdown to be the simplest and most readable of the ones I’ve used.

I write all my posts using Markdown and it has never gotten in my way of writing and yet works well. That says a lot about its good design.

The Apple bites back

Wednesday, March 30th, 2005

The webosphere is all about design and aesthetics these days, which is of course, just what the doctor ordered and mainly thanks to Google and Apple (yes, I know you were waiting for me to say that).

And when Paul Graham says we are now witnessing the return of the Mac, people sit up and take notice (my iPod agrees with me too).

I especially liked this part:

So what, the business world may say. Who cares if hackers like Apple again? How big is the hacker market, after all?

Quite small, but important out of proportion to its size. When it comes to computers, what hackers are doing now, everyone will be doing in ten years. Almost all technology, from Unix to bitmapped displays to the Web, became popular first within CS departments and research labs, and gradually spread to the rest of the world.

That reminds me of the Shufflephones hack that my friend Jim has made. Now, that is something really designer-ish but very usable at the same time:

Shufflephones

He even has a whole blog dedicated to shuffle hacks.

I try to always keep in mind that ‘Usability and Simplicity’ are the two most important factors for anything to succeed. It almost feels like Apple invented that concept.

This also means that I’m getting a Powerbook soon. I can’t wait.

iPod!

Monday, March 21st, 2005

My manager went to our Sunnyvale office recently and came back today. I had asked him to get an iPod Mini for me… when he gave it to me in the morning, I was grinning away to glory. I am not much of a gadget guy, but I was craving for an iPod being such a music buff. I forced myself not to open up the package in the morning (otherwise I wouldn’t get any work done). So, when I came back home in the evening, I tore open the package and went total gaga over it.

Packaging of My iPod! Packaging of My iPod!

First of all, it is so compact, I wonder how Apple managed to squeeze so much into something so small… this is the 4 GB version, so I can store approximately 1000 songs on this baby! Oh, and I can use it as a huge floppy drive as well ;)

Coming to life!

The first song I copied to it and listened was the instrumental version of the title track of Roja. For me, there is simply no other song that is as good as that one…

Listening to Roja See how really cute it is!

Just compare the sizes of the iPod Mini and my watch in the last snap above… :)

Now, I just have to find enough good songs to fill it….

P.S. The reason I had to get it ‘imported’ was that it costs $200 == 9 grand rupees that way whereas it costs 18 grand rupees in the Apple store in Forum, Koramangala, Bangalore.

GCC and the ABI

Friday, March 18th, 2005

From the Autopackage Developer Quickstart:

Important note to C++ developers

If your software uses Qt/kdelibs, or just rely on many (large) C++ libraries, then you must be careful. This is because of C++ ABI (Application Binary Interface) issues: GCC 3.4 broke C++ ABI (again), so software compiled with GCC 3.4 can mysteriously crash on GCC 3.2/3.3 systems, and vice versa. Because of this, we cannot guarantee that your software will run on all (or even most) systems. At the time of writing, most distributions still use GCC 3.2, but GCC 3.4 distributions are coming and GCC 3.2 distributions are not going to disappear any time soon.

Can we have ever have a write-once compile-once run-anywhere system on Linux/BSD?

I guess that’s a stupid question.

Sidebar:

  • Autopackage 1.0 final to be (hopefully) released within a month. Yay!

  • Autopackage basically makes software installation on Linux easier. For more details, read the FAQ.

  • The Autopackage website is very well designed. I’m impressed.

Bazaar-NG

Monday, March 14th, 2005

Canonical, the guys behind Ubuntu Linux, seem to be creating a “next-generation distributed version control system” called Bazaar-NG. It’s written in Python and is primarily tested on Ubuntu. I haven’t played with it but it seems it is already self-hosting, that demonstrates a bit of its capabilities. They have excellent documentation already. Although, I am wondering how they are going to handle the ‘distributed’ part.

(via creosote)

Update : The lead guy on Bazaar-NG is also the person who wrote DistCC. So, I guess he knows what he’s doing ;)

Walk the tree

Saturday, March 12th, 2005

In the second round of Google India Code Jam 2005, there were 3 problems to be solved in 1 hour. The first question was easy. The second question was also kind of easy, but I mucked up due to bad handling of corner cases, however I finally managed to get all the 5 examples working. I didn’t have enough time to solve the third problem.

My second solution failed in the system testing. I was kind of irritated about that but was too lazy to find out where it went wrong. One of my colleagues did a post-mortem for me and told me that in one of the loops, I had i < 10 instead of i <= 10 … Arrrggggh….

Anyway, the third problem was kind of baffling for me: “Given a sequence, figure out the minimum number of moves required to convert it into an arithmetic progression” (this is a simplification of the longer original problem).

I first thought of using differences between consecutive numbers and so on, but quickly realized that wasn’t the solution. Then, I thought this problem must have something to do with dynamic programming or some sort of tree-walking to compute the proper sequences. However, I was too lazy to try it myself and got caught up in work anyway. So, I sent the problem to few of my colleagues and got them to scratch their heads.

When I bumped into Avinash in the evening, I told him about this problem, he immediately said that this has got to do with game theory and all you have to do is tree walking. I didn’t understand his solution at first. So, he said “I’ll write it in Python and send it to you in half an hour”, and he did! Next thing I know, Gopal and Avinash are optimizing it – the time taken came down from 1 min 15 seconds to about 7.8 seconds! Avinash explains it in more detail in his writeup about it. As expected, after seeing his solution, I have that ‘Duh’ kind of feeling…