My new foray into web development has been bolstered substantially by using jQuery for any client-side scripting needs. However, I’ve also been using a new server-side tool in my belt. I call it Webstraction… it’s a web development not-framework I’ve recently built.
I like the idea of web development abstractions. That’s what CakePHP, symfony, and Rails all are, at a very high level. They are systems which take care of lower-level grunt work for you, and free up your time to focus on site/application design, rather than the nitty gritty technical details of the actual programming itself. All basically serve to answer the same cry: I don’t want to write the same code more than once. For example, header logic that checks to see if the user is logged in, footer markup that displays links at the bottom of the page, left hand navigation, etc. You place the code for these in certain places, and then you include them where you need them.
Taking it a step further, many of these tools can actually automatically handle including the code for you - provided you put it in the right places, name it the right name, use it in the right fashion, and only need it in certain circumstances. Many of these frameworks will actually write code for you, if you take the time to learn their system.
Now, don’t get me wrong, there is absolutely nothing wrong with learning one of these systems, and then leveraging it to quickly churn out product. However, I take issue with them for a single reason. Say I commit hours, weeks, whatever, to learning Rails. To really learning Rails, and being beyond proficient with it. And then I spend the time to use it for several sites. What happens to the first site where I want to step outside of the Rails paradigm? Do something that it doesn’t support? Do something that goes against it’s main function?
It breaks, or you break. Either you have to go then into the Rails core code, and start hacking it up (making upgrading to newer versions highly time-consuming, if not impossible in some cases), or you have to break down, and give up your dream (or find a compromise to make it happen). All of these solutions are, to me, a bit unsavory.
What would really be nice, is a system that let you do what you do, but didn’t tell you how to go about it. Offered you a set of tools that made you more productive, but didn’t get in your way when you wanted to go and do something non-standard. That’s where Webstraction comes into play. Webstraction provides standard methodologies for building web pages and accessing common code. It is an abstraction in that, many times, the logical flow of page creation depends merely upon the existence or absence of a given file or directory. It provides a really smooth interface for having the system automatically grab all necessary php, css, and javascript files for you. Webstraction also has special handlers for Ajax requests. And, most currently, I’m in the process of redeveloping it to support plug-ins (which seem, on today’s web, to be an expectation (Just look at the communities around Firefox, jQuery, and Wordpress, for instance).
I’ve submitted the project to SourceForge with a GNU/GPL license, and a recent version is available for download there, however I’ve not yet completed the documentation site, nor have I migrated the Subversion repository. More updates to follow.
October 29 2008 | Development and Web | No Comments »
I’ve had a bit of a writers block lately. I thought it was due to the fact that I’d been too busy developing to think up things to write. And then I made a realization - the entire concept of a blog on computer science is to share my experiences; If I’m busy solving problems and writing code, then, necessarily, I have blog fodder. One of those moments where you rediscover something you already knew, in an entirely new light.
I’ve been getting pretty heavily into web development lately. Wrote my own web development abstraction system (I cringe to call it a “framework” because frameworks, by definition, are restrictive, and my goal here was to do as much heavy lifting for the web developer as I could, without stepping on their toes at any point), and more recently, wrote a jQuery plugin for myself called Superedit. I’ve really been loving jQuery. Really loving it. I would recommend it very highly if you’re looking to add any javascript to your site; jQuery makes web development a real pleasure.
As all of my project start, I got sidetracked. While writing a site for the Honors Program here at my school, I decided that I’d like to make all “edit” functionality on the site happen via an edit-in-place system.
Take a user account page for example. Say you want to change your contact email address. The form might look like so:

And when you click on the span, I use JavaScript to turn it into an input like so:

You edit the content:

And then, on JavaScript’s blur() or change() events, the content is saved via callback, and the input is turned back into a span:

Now, personally, I think this is one of the greatest toys Ajax has given us so far. The ability to edit (and validate) form input without having to reload entire pages for a single element to change. Of course, the first [working] iteration of this system spanned two disjoint JavaScript files, a php header, a php function file, and then more configuration in the markup itself. Now I’ve got it down into two plain jQuery methods. To initialize the element for display:
$( 'selector' ).superbox( 'initial value', callback, { options } );
And to initialize the element for editing:
$( 'selector' ).superinput( 'initial value', callback, { options } );
And the plugin handles the rest. The only tricky part has been getting the callback to behave itself, so I’m working on getting that stable. jQuery plugin generation is actually a pretty pleasant process. A good primer can be found directly from jQuery’s documentation, and once you’ve gone through that, an excellent practical demonstration can be found here.
I’ll probably be posting again soon on Superedit when I get it stable and formally add it to the jQuery Plugin list. If you want to add hover event handlers, use collapsible containers, Ajax, browser-dependent scripting, or, like me, you want to extend the already sprawling library and bend your XHTML to your will, javascript has never been easier.
… I think I should get paid for advertising.
October 28 2008 | Development and Libraries and Web | No Comments »
If you’re looking to start a flame war, go ahead and mention that your operating system is better than another. Do it at work. Do it in school. Do it on a public forum. At lunch. Anywhere, really.
You’ve heard all about the big three: Windows, Mac, Linux. I know the topic has been beaten to death and back again, but I feel compelled to inject a bit of objective commentary to the fray. First, a history lesson, I should think. In order of popularity - that is to say, market share at the time of posting.

In 1980, an employee of Seattle Computer Products wrote a disk operating system called 86-DOS (also known as QDOS) for IBM Personal Computers using the Intel 8086. Microsoft Corp. licensed the software, fiddled with it, and sold it as MS-DOS (”Microsoft Disk Operating System”) in 1981. MS-DOS quickly gained popularity and market share. In 1985, Microsoft released Windows version 1.0. Windows continued over three major revisions until 1995. None of which were true graphical operating systems in their own right; rather they were simply graphic shells placed over top of MS-DOS. Windows 95, released in 1995 (surprised?) was the first true GUI OS from Microsoft. It included a command line reminiscent (read: taken directly from) MS-DOS, however this was merely the shadow of DOS, and not a window into the heart of the operating system. Even through to Windows Vista, traces of DOS can still be found.

Apple Incorporated released the Macintosh 128k in early 1984. This system was largely a success for Apple. The Macintosh 128k featured a mouse and keyboard to support a complete graphical user interface, which had not been done successfully before (an attempt called the Apple Lisa failed fairly quickly due to high costs and limited software availability). A few attempts later, Apple released the Macintosh Plus in 1986 which was, arguably, one of it’s more popular systems. System 7 was the first Mac to natively (and fully) support 32-bit addressing. Via many significant patches and retrofitting, Mac OS made it’s way up to version 9.2.2, however the system quickly became dated, and in early 2001, Apple released Mac OS X - entirely rewritten using the Unix variant (a hybrid of Nextstep and FreeBSD) called Darwin.

In the 1960’s, MIT, Bell Labs, and GE jointly worked on an experimental operating system called Multics. The project wasn’t particularly a hit, and eventually was dropped. However, one of it’s developers, Ken Thompson, led a team in writing a novel operating system for the PDP-7 in assembly language called Unics (yes, a play on the name Multics), which was to be a secure, efficient, time-sharing (read: multiuser) system. Unics was later renamed Unix. Between 1969 and 1973, the C programming language had been written by Dennis Richie et. al., and in 1973, Unix was rewritten in C. In 1984, Richard Stallman announced the GNU free software project with the goal of organizing a unix-compatible operating system entirely comprised of free software. Many things went well for the GNU Project. Their microkernel, called Hurd, was not one of them. However, in 1991, Linus Torvalds generated the monolithic Linux kernel, which was compatible with GNU software. This springboard gave enormous popularity to both projects and arose to what is now called the “Linux” operating system, although it is more properly titled “GNU/Linux.” Many, many, many GNU/Linux derivations exist today.
Now that we’re (roughly) on the same page, which one is best? The answer is simple: they all suck. If you’re a graphic designer, Linux will put you through torture and a half. Once you get done with all those pesky configurations files, manage to get your devices working properly, and swallow the fact that there’s no 1-800 number in case your machine crashes, you’ll realize that Adobe Photoshop CS3 is not available for you. If you’re a gamer, you scoff at Mac. It’s useless. I can’t play Team Fortress 2? The mouse only has one button! Where’s the registry? And certainly, if you’re a hard-core dev, you can’t stand all of Windows’ quirks. Memory leak galore, reboots after every five minutes, security measures consume the first hour of your morning routine…. And Mac? You can’t even tool around in certain system directories!
My favorite argument is the classic Windows guy vs. Mac guy. Let me explain what I mean.
Windows guy: Mac is too simple - there’s not even a right click!
Mac guy: Windows is too confusing! And what the heck is a right click?
Windows guy: There’s no control key!
Mac guy: Use the apple key, dummy!
Windows guy: I just want to defrag my computer now and then, alright?
Mac guy: I just want my computer to work!
[The Linux guy walks in, and the other two roll their eyes.]
Mac guy: Oh jeez….
Windows guy: Not HIM again…
Linux guy: Pffft…. Noobs.
You’ve heard it - you know you have. You’ve said it yourself, even. What is it, I wonder, about people and their obsession over their preferred operating system?
I haven’t figured it out quite yet. But let me be perfectly clear. If an operating system does what you need it to do, how you need to do it, and within reasonable limits of timeliness, then it’s the best system for you. And if your buddy has different needs, a different system might just be the best for him. Even if (heaven forbid) it’s from a competing vendor. One of my personal pet peeves are those computer users who religiously claim that their choice of operating system is simply the only viable solution, and anyone who claims any differently is a heretic.
I just like to keep in mind a simple analogy, whenever the topic arises. A Caravan would not be the optimal vehicle for a 17 year old student to drive back and forth to high school every day, while a Neon is certainly not the most sensical choice in transportation for a mother of 4. (Note, however, that both are produced by Dodge because, of course, Mopar is always the best manufacturer…)

October 27 2008 | History and Operating Systems | No Comments »
If you’re reading this post, and you’re familiar with version control software, and you’re not using it for one of your current projects, shame on you.
That having been said, for those unfamiliar with it, let me explain. Version control software is a client-server application which tracks changes in files over time. That’s it. Pretty dull, huh? It has it’s uses. When you want to start a new project, you create what’s known as a “repository” for it under the version control system. The repository keeps track of all the files you’re dealing with. If you delete a file from your project, you tell the repository that you deleted it. If you add a file to your project, you tell it that you added a file. And when you change files, you tell it which ones you changed. And that’s really all there is to it.
If this seems unnecessary, that’s understandable. It did to me at first. But there are numerous advantages to be gleaned from using version control software, such as CVS, or Subversion which is what I use. Ever have one of those dismal “oops” moments? The kind when you’re crawling around on the command line (am I the only one who still uses the CLI?) and you accidentally delete a file? Or you accidentally overwrite the wrong file? Well, them’s the breaks, I’m afraid. Unix isn’t shy. You delete a file, it’s gone. Unless you’re sitting on a nice desktop like Gnome or KDE, which has built in recycle-bin functionality, then that file is history.
Or is it?
If you’ve been using version control religiously - which I submit as the only way to use it - then all you have to do is open up your version control client application (I recommend TortoiseSVN if you’re on Windows, and RapidSVN if you’re running Linux) and revert the dirty deed from the repository. It’s that simple. There’s always the wonderful case when you find a bit of code, and you don’t know when or why it was added, and you remove it, only to find out days later it broke another section of the application. Version control will let you bring up ANY previous version of a file that you’ve committed to the repo (that’s short for repository), at the push of a button. And with a nice file comparison tool, you can easily see what you changed, and where.
A good version control client will also allow you to merge files together. Say you’re working on lines 1-40 of a file, and I’m working on lines 41-100. Well modern version control systems were built with teams in mind. You commit your changes, and I’ll commit my changes. If our code changes don’t affect one another, then the two will be accepted by the repo without complaint. If they do conflict, however, you’ll be able to see what’s different where, and easily rectify the disagreement.
If you aren’t using version control for every project, then you’re doing yourself a disservice.
As a note, I like Subversion because of it’s ease of use. Also, Tigris (who maintains Subversion) puts out both the Windows and Linux clients I mentioned, TortoiseSVN and RapidSVN, respectively. So it’s all packaged by the same great folks. And those file comparison tools I was blathering about? TortoiseSVN has one built right in. For Linux I can recommend Meld. There’s a small learning curve, just in getting used to how these systems work, and learning to discipline yourself into using them properly, but once you get it - I hate to use cliches - it really is one thing you’ll wonder just how you got by without.
For those who don’t have a server of their own, or don’t feel like tooling around with daemon services, there are free online services such as the wonderful Assembla which provide a Subversion server to you, wherever you are. All you need is a network connection.
August 08 2008 | Applications | No Comments »
« Prev - Next »