Browse > Home /

Friday, March 12, 2010 | Subscribe via RSS

Subversion for Beginners

June 30th, 2009 | 1 Comment | Posted in Computer Matters

I mentioned previously that I wanted to post how Subversion works (on the surface, for beginners) and how I use it for my development needs.

To create my WordPress plugins, Simpler iPaper and Simpler CSS, using SVN has been a must; after all, the only way to release new versions of the plugins is through SVN. I also keep this site’s WordPress installation up-to-date on the development version using Subversion. Additionally, in my current efforts to develop a working solution for HDTV’s in business and organizational settings, Display UI is being developed using Subversion for version control.

You get the idea. I use it on a daily basis, and for practical purposes. I don’t claim to understand the fine details, but hopefully this post gives you an idea of how I use it and how you can, too.

Source Code SnapshotSo what is version control? Simply put, it’s a way of keeping track of the changes made to files. It’s often impractical to make manual backups of a file before every set of changes to it, so version control systems like CVS and SVN emerged to help people — especially developers and programmers — keep track of their files, share changes with team members, and prevent stupid mistakes.

Accidentally deleted your code? Revert your changes. Came up with an ingenious way (that works) to do something? Commit your changes. Need to get the latest revision of all the files? Update the working copy.

Perhaps the most practical application of systems like Subversion is in team development. When three or more people are working on the same set of files, it’s useful to be able to merge the changes seamlessly, see the changes others have made, or even work separately on branches (kind of like forks) and tags (usually released versions that are being maintained).

I did write that I don’t claim to understand the fine details. If you really want to understand Subversion, I highly recommend this book by members of the development team: Version Control with Subversion, or the book online.

Let’s talk about how to use it. Hard-core programmers often choose to use the command line tools, where they type commands like svn up to update the files. Beginners will be glad to know that there are implementations with GUI’s, like RapidSVN and TortoiseSVN. Eclipse users may use Subversive or Subclipse, “team providers” that let coders easily perform version control tasks inside the IDE.

Subversion tasks can be done in Windows Explorer

Subversion tasks can be done in Windows Explorer

Assuming that you’re using the command line binaries — which you can get from the Subversion site, and I recommend official CollabNet builds where possible — most of the basic tasks are rather easy.

Instead of right-clicking and picking options from a menu, tasks are done by typing commands.

First of all, a ‘repository’ is a hosted location containing all of the code, revisions and metadata. Often, one can access a repository via HTTP, as in the case of WordPress, which is found at http://core.svn.wordpress.org/ .

To ‘checkout’ a repository means to make a local copy (known as a ‘working copy’) of the contents. That’s what we have to do first when working with an established project: get the code from the repository.

To do so, type the following at an open shell (on Linux/Mac OS X) or command prompt: (don’t type the ‘$’ — that’s just what you should see at the start of every command line in Bash)

$ svn checkout http://core.svn.wordpress.org/trunk/ wordpress/

Windows users would do the same, but at a command prompt — again, without the dollar sign.

That command invokes the svn executable and tells it to checkout the WordPress trunk directory to the local folder wordpress.

More »

Yay for WordPress 2.8 Release Candidate

June 7th, 2009 | 1 Comment | Posted in Uncategorized

Awesome! WordPress has just released the release candidate of WordPress 2.8, which seems to contain an awesome amount of improvements over WordPress 2.7 (most of them subtle and unexposed to the end user). I’ve been running the trunk version of WordPress for months now, and I have to say that WordPress 2.8 is stable and usable.

If you want to stay up-to-date with WordPress, you can try running it from SVN. I’ll post a little guide on how I do it soon.

Customizing 404 error pages (on WordPress blogs)

September 28th, 2008 | 1 Comment | Posted in Web Matters

If you’ve ever seen a 404 error (“not found”), you’ll relate to the frustration that users experience when all they get is a “Sorry, can’t help you” type of message.

That’s why I’ve customized the 404 errors on Frederick’s Timelog to be a bit more user-friendly.

If you go to any random non-existent page (for instance, http://www.frederickding.com/posts/234u0af) you will come up against a 404 page with an evident error. The red background immediately indicates a problem, while the blue section indicates possible remedies.

404 error page

On a random URL, the possible remedies are limited to a site search. However, if you go to a misspelling (for instance, http://www.frederickding.com/podcasts as opposed to http://www.frederickding.com/podcast), there’s a neat feature that says “Go to [the correct URL]“.

Better 404 error page

How was this accomplished? (Code samples follow after the jump.)

More »