Falling Down the Rabbit Hole

For quite some time now, I have been following all the hype of application frameworks. The analogy is that if a programming language were clay, an application framework would be the tools needed to mold that clay into something beautiful. Of course you could make something beautiful with your bare hands alone, but the tools aim to help speed the process.

From what I have been gathering, Ruby on Rails is the framework of frameworks. For a proper introduction, visit the official site. Ruby is a scripting language that was largely influenced by Perl. I have read that the name Ruby comes from the birth stone of July as Perl (Pearl) is the birth stone of June. No one seems to claim they know for sure, but it is a popular theory. Ruby has been around for some ten years, but it wasn’t until about three years ago with the release of Ruby on Rails that the movement behind Ruby really gained momentum.

When I first saw Ruby, I was a bit confused to be honest. In retrospect, when I saw my first programming language, I was a bit confused. Ruby appears to be a very elegant language. It is purely object oriented, which I won’t discuss now, and can almost be read like a sentence.

The Rails aspect, is even more intriguing. The framework has loads of features built right into it, making development as easy as typing in a few commands and filling in the blanks. But what I think is the most fascinating thing about Rails is it’s dominance. I don’t think the Ruby programming language was even in the top ten programming languages until Ruby on Rails came along. Additionally, it is THE framework for Ruby and has inspired a handful of frameworks in other languages.

Speaking frameworks in other languages, I have investigated a few PHP frameworks. I was hoping to get similar functionality of Ruby on Rails, but still be able to code in PHP (which I feel more comfortable in). A couple that share similarities to Ruby on Rails and are fairly easy to get up and running are CakePHP and Code Igniter. But still, they have a long ways to go to catch Ruby on Rails.

This leaves me with an interesting scenario. Do I dig deeper into Ruby so I can learn more Rails or do I try to navigate through all the documentation for a PHP framework and lose some of the cool features of Rails? I’ve scoured internet forums for answers and there are people on both sides of the fence. Not an easy decision if you ask me.

Scrub it with AJAX

AJAX = Asynchronous Javascript and XML

Not sure if that means anything to you. Have you ever been to a web site, clicked something, and lo and behold the something magically changed right before your eyes? That magic is AJAX (or Flash depending on the site).

I won’t get into the technicalities in this post, but rather point you in the direction of some resources I found useful.

Scriptaculous
This is probably the most popular AJAX/Javascript library right now. I’m making this assumption based on the number of people that have bookmarked the site on Del.icio.us. At this moment, there are 26,125 other people who have this site bookmarked. The closest AJAX library (in my bookmarks) is jQuery with 12,476.

Scriptaculous is built on another popular library, Prototype and has a strong following, I believe, because it is native in Ruby on Rails.

It’s fairly straight forward to implement. The Scriptaculous site has a bunch of docs and demos on their site, but I’m a really big fan of video tutorials. If you’re looking for an easy introduction to AJAX, check out this link.

After watching the video, I found it pretty straight forward to integrate AJAX into my blog

Thanks again!

Count your chips and cache them in!

I was pleasantly surprised to find out that caching wasn’t super difficult to implement. I found this article on caching and knew that sooner or later I would have to implement it into my blog page.

What is caching?

To put it simply, caching makes websites perform faster and there are two ways (that I know of) that caching works.

Method 1. This is the caching that most people think of when they think of caching. Our internet browsers will save little snippets of web pages to be used if we return to a page. Because retrieving information from the internet is a lot slower than retrieving information from our hard drive or RAM, saving information locally will speed up sites we often visit.

Method 2. This is the method that I used for speeding up my site. The blog page of my site retrieves information from my Blogger account and then dynamically creates the HTML to be displayed. In plain English, my site was a greedy pig. If two people were to visit the same page, the server could not remember that a page had already been visited, thus it would recreate the page from scratch.

The solution. Caching, obviously. Now the second person that visits the page has the convenience of visiting a page that has already been generated and is less of a wait.

The savings. I was surprised how much time maybe 20 lines of code or so saved. It was taking some pages *gasp* almost 10 seconds to render. After the page has been cached, it’s fractions of hundreths of seconds.

Now on to the fun stuff. Look out AJAX!!!

If your page is greedy and you’re using PHP, I’d suggest taking a gander at the article.

XHTML

XHTML = XML + HTML

Today I made my site XHTML compliant using this great validator tool from the World Wide Web Consortium. They’re the reason why you can view and use the same site in Windows, Apple, Linux, etc. They call this interoperability, or the ability of a site or program to be cross compatible. This is why web applications have such a bright future.

Because of these standards, developers can focus more of their time on application features as opposed to compatibility with multiple systems. For example, GMail works on pretty much anything. Outlook, doesn’t. And I imagine plenty of resources go into the development of Outlook, but since a lot of Microsoft’s technology is proprietary as opposed to open source I imagine it’s very difficult to create platforms that support their software. (If that’s at all what Microsoft wants.)

Of course this really alters the business model, but that can be a topic of a totally different post.

So what does my site being XHTML complaint have to do with anything?

Nothing really. Someone could probably mine the data from my site, and I do get put a cool badge at the bottom of my page!

** Some of my blog pages are not XHTML compliant. This is because I am getting my content from a different site that isn’t XHTML complaint. I’ll probably get around to writing a script to fix that, but that opens a whole can of worms. I’ll probably need to start thinking about caching my pages at some point as the page is slow enough already with all of the data transfer from Blogger to my site.

IE Rant

So I was designing my site in Firefox and on Ubuntu thinking the beautiful things I was creating were universal. Then after hours of design, I went to have dinner with my parents and I was excited to show off my progress…and it looked like crap.

My mom runs Windows XP in 800×600 resolution and at 8-bits of color. It was almost like going back in time to Windows 98, but it really made me realize that I need to consider all configurations when designing my site. Especially since the majority of people surfing the net still use IE.

Things that were supposed to be transparent weren’t. Menus were lost. Divs didn’t line up. It was a disaster.

So I went home and booted up my old Windows machine (guess it’s still good for something). I quickly looked up some fixes, applied them, and used my Windows machine to verify.

I guess the moral of the story is: hang on to your Windows machine…at least until everyone else wises up. 🙂

I love paisley!

I decided a while back that my site design sucked. I finally had some time where I could really get into the nuts and bolts of my site design. So I had a go.

I really wanted the site to look like a piece of paper on a backdrop, desk, wallpaper, etc. And I also wanted it to have a sort of drop shadow effect to give it an element of depth.

Played around with a few backdrops, but ultimately I decided upon paisley. I love paisley.

Check it out at www.seanchon.com!

Up All Night

Honestly, working on this website is like opening Pandora’s Box.

I think I finally have the blog to a point where it’s not terribly plain. I opted against using an RSS reader to populate the posts as it’s very linear, and instead decided to write my own navigational functions using the Zend/Google PHP API to give it the feel of blogging software that is currently available. I’m embarrassed to say how much time I spent on that page as it is not obvious what lies beneath the page, but I am proud of the work in progress.

Also, I have been learning about cookies and thought it would be fun to give my website an alternate theme. So it has been implemented. There might be a bug or two here or there, so if the site behaves funny for you, please let me know. If you go to my site (www.seanchon.com), you’ll notice an option on the top left of your screen. There are two themes right now. I might try to incorporate some more, but it’s kind of a pain in the ass honestly, as you need to compare multiple stylesheets to avoid conflicts.

Anyway, it’s late. I should be sleeping, but I got carried away.

Oh, and please give me feedback about how the page looks too. I am using Firefox on Ubuntu…so I don’t represent the average web surfer.

Thanks!