on beauty

Here I quote judofyr from a Hacker News thread. The following exemplifies why _why wasn’t just a coder, he was also a poet.

Interestingly, camping.rb on the other hand is not very pretty or correct: http://github.com/camping/camping/blob/master/lib/camping.rb, and that’s also what makes it so beautiful in my opinion.

Oh well, let me finish with a little quote from _why:

On Sun, May 25, 2008 at 02:47:39PM +0200, zimbatm wrote:  
> This is not that hard to do. Maybe I should add some shortening tricks  
> document. I propose platterizing to be done only before release.  
No, let's not have rules.  I don't feel comfortable with having  
coding standards or any protocol on Camping.  The point of Camping  
is to have very ugly, tricky code that goes against all the rules that  
people make for "beautiful" code these days.  To show that ugly code  
can do beautiful things, maybe.  
I don't want to demonize anyone here, I just want to express the  
ideas that make Camping different.  Camping's personality is 80x50.  
It is like the little gears of a watch that are all meshed together  
into a tight little mind-bending machine.  The challenge of Camping  
isn't to figure out how to automate obfuscation.  The challenge is  
to bring new tricks into the code that push Ruby's parser and make  
everyone look twice.  
Not all code needs to be a factory, some of it can just be origami.  

under new management

Things are changing. This blog is under new management. New content management, that is. No longer using WordPress.

After years and year and years of wanting to make my own blogging system (this is even before blogging was popular), I finally have something I’m going to use.

It has no features, no templating, no previewing posts, no media management, no plugins, no stats tracking, and no this that or the other. It’s simple as heck and I’m going to add features as I need/want them. Oh, right now, it has no commenting either. But I will soon implement that feature. Archives and search are also missing. They are also on the list.

Another change is that I’m also running this on Amazon’s EC2. This blog is officially on the cloud. Other technologies: Ruby on Rails for the framework and MongoDB for the database.

More information as it becomes available.

Here we go. =)

open formats

Open formats are cool. They’re cool for reasons I should not have to explain.

The new US Administration, in their stimulus implementation guidelines, has indicated that government agencies use feeds (Atom or RSS) to disclose how funds are being allocated.

It’s neat not only because the data is available, but also because people can do things with this data. People can chart and graph things, or create watch dog websites, or approval rating websites (on each allocation) etc. Open data allows people to do things. This is a good thing.

When throwing together demand a stance, I couldn’t find any open formats for contact information on members of parliament. The government does have this website, which returns MP information based on a postal code. Which is great, because it was exactly what I was looking for, except that the information is not in an open format (or an easily machine readable format).

So I wrote a scraper that extracted the information that was required. We threw the site up in PHP, I hacked together some pages, Fathima made it look pretty. We also threw in a whole bunch of javascripty goodness, for smooth flowing and what not.

But that doesn’t solve the open format issue. I decided to rebuild the site in Ruby on Rails. So as a starting step I’m extracting the information from the government website and presenting it in nicer HTML and also in JSON. So people can easily do what they want.

The test site is: http://das.nashahai.com/. Yeah, the page needs work. But it describes how to use the thing.

HTML: http://das.nashahai.com/mp/find/by_postal_code.html?postal_code=m1s5b2

You can view source on that and see the HTML layout. I think all the elements should be accessible via css, and can be manipulated using javascript.

JSON: http://das.nashahai.com/mp/find/by_postal_code.js?postal_code=m1s5b2

This returns a JSON object containing all the data.

You can find the code here: http://github.com/adnanali/das2/tree/master

I’m assuming that if I needed something like this then someone else will too. If you find any issues, let me know.


My, oh my, has it already been over a year? Unbelievable.

I did play with CouchDB a little back then, and it was very rough. It has come a long long way since then. The potential was there then, and it is being realized now with a lot more potential left in storage.

CouchDB is a database engine, it is a very exciting database engine. It is, if I may describe it in this manner, beautiful. It is beautiful in the very sense of the word. Not simply for what it is, but for what it allows you to do and for it’s pure potential, the possibilities.

Most databases are relational, they consist of tables and tables consist of rows of data. It can be likened to an Excel spreadsheet. You can have multiple sheets in an Excel file, each sheet can be viewed as a table. Each sheet also consists of rows of data, and the columns represent attributes. Say in a schooling system, you can have classes, students, and teachers. So you would have a sheet to represent each of these. The students sheet would contain a row per student, and the classes sheet would contain a row per class and so on. A classes sheet would have attributes like: name, # of credits, schedule, teacher, semester, etc. All the rows in the sheet have the same attributes, so if an attribute were not to apply to a particular row, it would be left empty.

CouchDB has no tables, there is no schema. It stores documents. The documents can be of a certain type, like teacher or student, but unlike a table, not all the documents of a certain type need to contain the same attributes. So if an attribute does not apply to a particular document it simply does not exist in that document. This allows documents to be of the same type and yet be unique (kinda like humans). It is this flexibility and freedom from constraints that makes CouchDB so beautiful.

Developers are very used to the rigid way of relational databases, it is ingrained into the way we are taught to think. The freedom of CouchDB is awesome. But not all is hunky dory, there are still ways to go and there are things that can be easily done in relational databases that take more effort with CouchDB. However, in my mind, it’s worth it. The freedom and flexibility allow your mind to run in so many directions and consider so many possibilities (if you let it). You don’t have to have everything planned out before you start, you can just go with the flow and not worry about being locked in. Did I mention how beautiful this thing is?

CouchDB uses javascript to query information instead of the traditional SQL. The sweetness of this goes beyond the syntactic sugar. Once again, it changes the way in which you think about information.

This is quite the database engine. Sexy, if you will. =D

on thinking and doing

teetering on the edge I am,
teeter teeter

I have a headache. I need to wrap my head around it, but it seems to have me wrapped. I suspect that it is a symptom of thought, or of desire, or some combination thereof. But it is there. I can feel it.

I remember simpler times, when I just did things. It wasn’t as if I wasn’t thinking, I was, but that thinking happened in the process of doing. A shift occurred somewhere along the lines. The process of thinking overtook the process of doing. Maybe I was just done with doing, seeing as how I had already done it. Maybe not.

On the commute to and from work I started to read tech books (back in 04/05) even when I didn’t have any immediate use to draw from them. Some of them were on the deep tech aspects and others on the design aspects. It was basically a knowledge store, I wasn’t using this information for anything, I was just collecting it. At lot of it came in handy, when something was crashing or breaking, or when someone asked me a question a window would open up in the brain and I’d either know the answer, or know where to find it. Better yet, being able to combine two separate ideas to devise a possible new use. All this is good, but at some point all this thought collected and got to a point where I couldn’t implement the ideas I was holding (or maybe I felt I couldn’t). This was/is problematic.

It’s not like I didn’t try doing things. I’d load up the machine and get ready to string together ideas in code, and then I’d feel a thousand pulls from a thousand ideas, leaving me in a state of paralysis. Overload, crash and retreat. I would think things and not do things. So I’d leave things incomplete. This incompleteness is not particularly new, I can’t remember a personal project that I’ve “completed” to completion even when I was doing things. But now I would barely get started and get stuck. What is this state of “completeness” anyway? Maybe I started to believe there was such a thing as “complete”, and knowing I could not get there prevented me from doing anything?

I found myself going through this cycle with magic as well. First I learnt and did, then I read and read and read. When you read volumes of books with titles like “The Structural Conception of Magic” you tend to place more thought into magic. How can you not? And it’s great, I love that aspect of magic as well, it’s fascinatingly fantastic. But if you’re like me, to a large degree it prevents you from doing. Oh and there’ll be no false modesty here, I am very good at this magic thing.

I can see an effect and like it for what it is, but you can’t see an effect the same way after you’ve changed your frame of thinking on it. This has nothing to do with the secret of the effect or “how it is done”, far from it (anyone who really has a feel for magic should know that the secret is far from the Most Important Thing). So while I did magic the last couple of years, I wasn’t really there, I wasn’t in the magic, not as much. Hah, and I’ve only been doing this for 3 years now. All of this, of course, is going on in my mind alone, not like anyone else sees it or cares, nor should they.

But of late I’ve started to get that feel back, that feeling of raw excitement, an inexplicable trembling passion. I was watching a couple of my favourite magicians, stuff I’ve seen before, stuff I’ve done before, and l was very moved by the magic. It was exciting and fun. What I feel magic should be like, the flow and the feel. So awesome, so fluid. It occurred to me, how do they do it? These are people who have done magic for decades, thought and thunk, written books, performed thousands and thousands of times professionally and otherwise, they have forgotten more about magic than I will ever know in my lifetime. How do they do it? This applies to all the software monkeys too, they’ve designed and redesigned, built and torn, they have more knowledge in their left pinky nail than I will ever scratch. How do they balance this thought and action?

What should be my approach in comparison? Why am I in paralysis? Why am I not in a state of doing what I love?

It’s foolishness.

totter totter

captain obvious

I’ve said this before, if you state the obvious, chances are you have presented yourself as the most clever person in the group. If everyone is thinking it (and it’s a good idea) but everyone thinks it’s obvious and no one says it, then well… you’ve lost a good idea. So it’s okay, go ahead and say the obvious, go ahead be unoriginal. Say the obvious, and everyone will agree with you and you’ll be credited with the idea (if that’s what you want) because you simply spoke up.

Now I’d like to get into specifics at work. However, there’s a slight difference from what I presented above. There are times when I think the idea is obvious (because in my mind it is obvious) but other folk don’t see it that way. This has happened at the new workplace quite a bit. Because in my natural flow of saying what is obvious, I sometimes happen to say things that are obvious to me but not to everyone else. This makes me seem more intelligent than I actually am. It’s outright deception.

I look at something, and I will say, “Hmmm… this seems not right (polite way of saying it’s wrong). How about we do it this other way.” Initially there will be resistance, this is expected. But after some thought and deliberation people will realize why it’s better. In fact they’ll issue this smile that indicates they’ve been introduced to a whole new way of thinking. It’s not a half-hearted, “yeah that sounds like a good idea”. It’s a, “OMFG, that’s bluddy brilliant!”. Yes, I deduce this all from a smile.

Sometimes there won’t even be any resistance.
I say, “I think we should do it this way.”
Cue smiles.
“That’s actually a great idea!”.

But in my mind it’s just the way I’d do it. Why else would I do it any other way? It just seems so natural. It might be experience in dealing with these type of things, and that experience quickly collects in my mind and tells me the “natural” way. Of course, the readings I do also help. But I haven’t tried most of what I’ve read. I just “feel” that it will work.

When I see something that isn’t done quite “right”, I can’t help not say anything. I must speak out. It doesn’t matter whether it’s the Main Architect (notice the upper case) person or the junior developer. If I see something that doesn’t “feel” right to me, they’ll hear it. It really is nothing personal. I don’t dislike you, unless you’re incompetent. I can’t stand incompetence. Don’t be a pretender, go do something else instead. At least be honest, admit your incompetence. Okay, back to what I was saying. It’s not personal, please don’t take it personally. But some people do take it personally, this bothers me. They’ll defend their work even if it’s wrong. Grow up and get over yourself. Admit your mistake and move on. No harm, no foul. Thank you.

Of course this applies to me too. I’ve deleted/restarted/ditched plenty of my own ideas because I’ve realized that I was plain wrong. This is probably why I know that you’re wrong, because I’ve been wrong myself.

In any case, I was pulled into a meeting where a 3rd party software vendor was describing how we could integrate their software into our websites. I took a look at the integration code that was in their powerpoint presentation.

I resisted the urge, I really did.

But then I raised my hand and said, “Wouldn’t be a lot simpler if you used hashes? And that would automatically allow you to provide X, Y and Z functionality without much extra work!!”.

The technical person on their end thought about it for a second or two. “Yes, that’s a good idea. Actually it’s a great idea”. I could see the smile forming on his face. As if he was introduced to a whole new way of seeing the problem (and he was). The pains he’s had to go through to implement his own solution were showing. He sits down, a few more seconds pass. It’s still on his mind, “That would make things a lot easier”.

“Yeah, come on guys, why wouldn’t you think of this in the first place? Now you’ve released your API to so many of your customers. It’d be hard to change it and get them to implment it.”

“Yes, but we could still try it. Why don’t you send us an email, maybe we could implement it for you?”, the tech lead says.

“Also, please attach your resume to that email. We’re always looking for clever people.”, says one of their tech/business people.

I think I laughed inside a little. Did they just offer me an interview in a meeting where we were purchasing their software? Hah!

At least my experiences here (current workplace) have been better in that regard, here people will eventually admit to good/obvious idea, even if we can’t implement it due to whatever constraints. Where I worked before, I just got mad stares and weird looks, I felt I was insane.

Point is, tell people when they’ve done something wrong or complicated. Even if it seems like the obvious thing to say. They don’t know any better.

i am here, again

so firstly, i’m not in pakistan. i’m here.

secondly, i’m here again. what does that mean?

that means i am, once again, thinking of writing a blogging program.

“why would you engage in such madness adnan?”, you ask.

“because madness engages me”, i respond. and i assure you that i’m just as confused by the response as you are.

but in part seriousness… the nature of blogging used to be simpler. if you had a one liner, you’d blog. if you had a link to share, you’d blog. if you had a long piece to write, you’d blog. if you had to rant, you’d blog.

now, we have different tools to do each. i don’t fancy this. twitter for one liners and updates, tumblr for links, blog for long posts… meh. no. it’s too complex, too many logins, too much work. i need simple and minimal.

the blog needs to do all that. while i can just blog the links and updates and what not, the presentation of that information isn’t exactly friendly to the way it is absorbed and consumed. i know what i mean in my mind, so i won’t even explain it.

oddly enough, and as many will attest, it doesn’t get simpler/minimaler than nothing. but i keep coming back. for one reason or another.

if i knew i could stay away, i would. but i can’t. no really, i can’t. i haven’t blogged like this since… since forever.

so, as it were, i am… here… again. hello.

it’s a mac yo!

The iPod Touch (hereinafter referred to as itouch) arrived last Friday, and the macbook (hereinafter referred to as macbook) arrived Monday. Which was great because I got to spend Canada Day with the macbook.

About the itouch, I had been researching eReaders for a while. The Kindle was not a possibility because it’s only available in the States, plus it’s extremely expensive and doesn’t natively read PDFs. The iLiad? Also very expensive. The Cybook? Decently priced, but still pricey. At some point I was seriously considering the Sony Reader. But with all the research I couldn’t still justify spending hundreds on another device to carry around. So I looked into the itouch, to see whether it would could be used as an ebook reader. I was skeptical since it only has a 3.5 inch screen (compared to 6 to 8 inch screens on the ereaders). I knew the pain of trying to read PDFs on a small screen when I tried it out on a Sony Erricson PDA. You have to scroll horizontally forward and backward for each line. Not fun. And I still couldn’t justify purchasing another MP3 player.

But as fate would have it (it always does), my laptop screen broke and I had to make a decision. I had also been researching tablet pcs for a while and was really high on getting one. I eventually went with the macbook.

“Why macbook?”, you ask. And I’m glad you did.

Well, for many reasons. While the tablet would have been a great play toy, and great for taking notes during work or school, the macbook’s benefits outweighed the tablet’s.

First of all, going from PC to Mac is like changing religions. It’s not a small step. It’s not easy at the start and has its bumps.

You may be distracted by the fancy exterior and the shiny graphics of the Mac, but I’m more interested in what’s inside. Mac hardware is known to be rock solid when it comes to personal PCs. They recently switched to an intel based processor (more on this later). The operating system, Mac OS X, is a Unix based OS and written/modified specifically to work with Mac’s hardware.

I extremely dislike Windows’ navigation system and much prefer to use the command-line on a Linux machine, specially when it comes to software development. So to keep my sanity I was having to keep source code files on a Ubuntu Linux VMWare install, and I would SSH into it to access and manipulate the files and using IntelliJ or Zend Studio on the Windows end. With the macbook, I get the best of both worlds, I can use my IDEs and access the command-line whenever I want. Unlike the other Unix environments, Mac can actually run programs like Photoshop and the like. Win-win.

Now, if there is ever a moment where I need to run software that will only run on Windows and not a Mac, I can use VMWare or Parallels (haven’t decided which yet) to install a Windows virtual machine. I’m using VMWare’s trail version and it’s much better for the Mac than it was for windows. I still want to give Parallels a shot. This is where the Intel chipset comes in real handy, the Windows virtual machine runs really well on the Mac. Really really well.

I want to delve into Rails development, and most of the Rails world uses Mac and they recently started using git as their SCM tool. And git really works well with Unix based systems. Most of the Rails books use a Mac as a default platform. Macbook, win-win.

I really like the desktop navigation features, the F8 to F11 keys help me easily get to any window I want without having to plow through Alt-Tab selections. It’s really good.

But the macbook is not without its quirks. The keyboard is fine, but I still need to get used to the trackpad mouse. Particularly dealing with the speed at which the mouse pointer moves, and the size of the trackpad: it’s huge! I also don’t like how when I’m filling out forms the tab key takes me to the address bar instead of the next form element. I don’t want to have to flame my carpal-tunnel having to reach for the trackpad every time I fill out a form. The Firefox theme on the macbook is just… no. It’s not right. I still haven’t found a theme I like yet.

But getting the Unix features with a great GUI trumps all of that. This is not a toy, it’s a real heavy-duty machine. I could use it for pretty much anything I would use a PC for, except gaming. I don’t play games much anymore.

Oh yes… the itouch. This is an exciting device. What makes it different from all the previous iPod versions is that it has Mac OS X installed on it. Which really makes it a mini-tablet computer! After hacking (or jail-breaking as it’s called in the itouch world) into it, I can load up a shell prompt and play with the command-line. The wifi allows me to SSH into it from another computer, and it can even run a web server. Madness and awesomeness, for a device so small. So deceptive, yet powerful and strong. I can check mail on it and download Google Reader feeds onto it and browse through them on the subway.

Reading full-sized PDFs on it is still a pain, but reading properly formatted PDFs is fine. Just getting properly formatted PDFs is hard. I need to find a way to convert normal PDFs to iPod PDFs. But HTML/text based ebooks are fine. In fact, they’re great. The itouch is a great e-book reader! I downloaded a bunch of books from ManyBooks.net and will make my way through them.

I was originally excited about the itouch because it’s 3.5 inch screen is great for watching video. I have yet to transfer a single video to it.

I may post tweaks and tips that I’ve come across for the macbook to make it more comfortable.

search is where it’s at

The new Firefox 3 browser is out! You should go download it.

It has a slightly new look and feel, it also uses a lot less memory. I really like how when you’re on a page where you enter a password, it doesn’t popup a window anymore asking you if you want to remember your password. Instead it will continue to the next page, and ask you in a bar if you want to remember the password. This makes things flow smoother and faster. I’ll find out the other changes/features as I use the browser more and more.

The most noticeable change is the address bar, it now uses search to show you the most relevant URL. This means you can type in any portion of a URL and the address bar will show you the matching URLs. In fact, you can even type on the title of a page (that’s not part of the URL) and it will still show you the proper URL matches. This is great for moments where you don’t remember the exact domain name or URL but remember only portions of it. The ability to search is awesome.

This takes us to Google Desktop. This program indexes all the files on your computer and even the web pages you’ve visited. So now, if you forget the domain name and URL, but you remember some of the content on the page, Google Desktop will search amongst the pages that you’ve visited. If you download a file and forget where you saved it, or you forget the exact name, no problem. Just press the CTRL button twice, the search prompt makes itself available, type in your search query and you’re good to go.

You know how when you’ve installed hundreds of programs on your computer and Window’s Start Menu becomes huge! Well now, instead of looking through the menu to launch your program, you can just search for it. This makes life a lot easier.

Google Desktop also indexes your email (Gmail email). Which means that you can search for your email even when you’re not connected to the intertubes. It doesn’t index Gtalk though.
End Addendum

Some of you may be concerned about Google indexing everything that’s on your computer and then transferring that data to their grand central database. This is a valid concern, though they say that they don’t do this. But Google already knows everything. Google knows what you want (because you use Google to search for it), Google knows who you talk to (because you use Gmail and Gtalk), Google also knows what you say to the people you talk to, Google knows where you live (because you use Google Maps), Google knows what data you pull in (because you use Google Reader), Google knows what you’re doing on the certain day (because you use Google Calendar), Google knows what videos you watch (because you use Google’s YouTube), Google even knows what blog posts you have in draft mode (because you use Google’s Blogger (though WordPress has but a huge dent here, but Google still has all of those indexed in their search anyway)). Google just knows. Google knows. Google.

Try out Google Desktop (which interestingly and surprisingly comes in Linux and Mac versions as well), it will make things faster to look for. Just give in… to Google. You already have.