Wednesday, July 18, 2007

Reviews: Django, CSS, jQuery and DreamWeaver oh joy

One saying from my youth that has stuck with me was from my drumming instructor: "It's good for your beat to be ballsy, but the balls have to have hair on them." I took the meaning to be that a great idea isn't enough, it must be executed with finesse.



I am near completion of the secret project that I undertook a few months ago. With luck it will be unveiled in the next few weeks. Right now I am rewriting earthbrowser.com, which hasn't had a major update since 2003. I've had to update my skill set in the web design arena, since I have to do everything in this little business and I've learned some little nuggets that may be of use to someone. On to the tool review...


Let me just say right now that I don't understand why Dreamweaver exists. It has a very complex interface and set of features, so it looks like it is for professional web designers right? After trying to use it and spending all my time in the incredibly weak text editor to edit the HTML code, I just started using TextMate. I conclude that any expert web designer will just be editing the raw html source. Beginners will be overwhelmed by the options and difficulty of changing settings through the dialog box interface to the raw code. Again, who is the target market for Dreamweaver?


On to the server logic. I've looked at several CMS (Content Management System) packages such as Drupal, Joomla, ExpressionEngine, TurboGears and Django. I've decided that I'm pretty much done with PHP because it is so lame. Does anyone use Perl anymore? That leaves me with my preferred scripting language of Python and Django won the initial test phase hands down.


Django is actually very simple, it basically consists of models, views, url parsing and a templating system which are all nicely intertwined. You server parses the incoming url request and sends all the request info to a view function that you define. From there you can choose what models (if any) are involved in the request along with any other data, perform operations on that data like sorting and filtering, then pass it to the templating system where it can fill in subsections of your pre-defined HTML template. It took about 5 minutes to make a webpage that listed all of the recent earthquakes over magnitude 4, sorted by most recent and provide a link with a relevant title for each. Of course that doesn't include getting that quake information updating into the database, that is a whole other story. There are also nice little modules to do RSS or Atom feeds, blog posts and many other neat features. I'm now rewriting my purchasing system in Python instead of PHP and I couldn't be happier about it. If you are in search of a CMS for your site and don't have your heart set on PHP, you must try Django.


I've decided that giving my site that Web 2.0 feel isn't enough, I'm going with web 2.1. Learning CSS is now mandatory, it isn't that complex, just the ability to set up some inherited styling options for HTML elements. You just have to know what tags you are using and what styling options look best for what you want your site to look like. jQuery is fast becoming my friend and I haven't even done much with it yet. It is a set of Javascript functions that lets you alter the structure of your site when certain events happen, like the page loads or a button or link is clicked. It abstracts away the XMLHttpRequest, handles JSON data, animates elements and a lot more. If you design websites, use it!


In conclusion, if someone were to ask me what they would use to create a fairly complex website I would say set up a dedicated server with Apache, MySQL running the Django framework for the server side logic, edit your HTML and CSS with a nice text editor like TextMate and use jQuery for the client side logic. Don't bother with Dreamweaver.

Wednesday, July 11, 2007

Chewing Tobacco with Bill Gates

I've seen some famous people in my time, but have talked to very few. Perhaps meeting Linus Pauling, who was a personal hero, when I made a complete fool of myself has made me a bit shy. Mr Pauling gave a talk to my first year chemistry class at Reed College in 1985. After the lecture, I approached him and he gave me his full attention with everyone watching the exchange. I could tell that everyone was expecting a thought provoking question with an insightful and wise response from him. I kind of froze and asked a confused, misinformed clarification about his position on vitamin C. He corrected me politely and moved on leaving me groaning inside at my lack of having a prepared question.

In 1989 during summer break, I worked for Microsoft and was quite the wiseass. The marketing folks asked for quotes from the CalTech summer hires to put in the school newspaper the next year and I thought up some ultra-geeky quote that had a hidden, and very rude, message in it and everyone had a chuckle over the fact that the marketing people thought it was real. Toward the end of the summer, all of the interns were invited to Bill Gates house for an afternoon barbeque. At that time in my life I thought I was being a rebel by smoking nasty convenience store cigars and chewing tobacco. So I'm there at Mr. Gates house and I had perhaps my second "wad of chew" ever in my mouth, it was my last. I went to the bathroom to spit it out as it was making me feel sick but there was a line about 6 people deep. I look behind me and Bill himself is behind me in line and he strikes up a conversation with me about what I'm doing this summer outside of work. I tell him that I'm taking windsurfing lessons and ask him about the garage for boats he has near the lake edge. I realize that I'd flubbed another chance to ask someone famous a probing and insightful question. Feeling sicker and sicker as the nicotine leeched into my bloodstream through my raw gums, it was finally my turn and I made sure there was no residue for Mr. Gates to find as I spit it in the sink. The fact that one of the richest men in the world was waiting in line to use his own bathroom so he could talk to his young employees is amazing. For that, I will always have a great deal of respect for him.

I not even going to go into what happened when I met Vatos, the drummer from Oingo Boingo.