Django 1.1 Has Arrived!

Just a quick note to spread the news as far as possible: Django 1.1 has been released!

This looks to be an excellent release, as usual. Some new features:

Hooray! Excellent work everyone! For more info, see the Release Notes.

Bulk Update With Mercurial

Some of you may well know that I was previously an subversion user, more out of comfort than necessity. SVN was the first version control system that I became well acquainted with, so it just seemed like a natural choice for me when I thought I needed version control.

Several months ago I read a blog article by a buddy, in which he briefly discussed Mercurial. I had been meaning to give some distributed version control systems a shot after some disasters related to the centralized nature of SVN. This blog article prompted me to take a stab at Mercurial and some others.

Within a few days I was sold on Mercurial. I won't go into details simply because I'm not one for religious wars that way. Let's just say that Mercurial seemed to be perfect for my wants and needs.

There were, however, a few things about using Mercurial that I miss from the SVN world. One such thing is that you can update several "working copies" of something in SVN with a single command. For example, I keep a lot of my 3rd party Django applications in one directory. Many of these applications use SVN. Sometimes I'll just run a command like this:

svn up /path/to/third/party/apps/*

Each project that uses SVN will automatically be updated without much fuss with such a command. However, with Mercurial, it appears that you need to be in an actual Mercurial repository in order to update it. There are extensions to get around this problem, but I was looking for something a little different.

Since I use Linux almost exclusively, I didn't feel bad about just using the power within to do the work. The following command does everything I need it to:

find -name ".hg" -type d | xargs -t -i bash -c "(cd {}; hg pull; hg up)"

This command finds any directories called .hg anywhere under your current location on the filesystem. Any matches will be used in the command at the end: cd {}; hg pull; hg up

So far I haven't had any problems with this command, but your mileage may vary. To make things even easier, I made an alias for this rather long command:

alias hgupall='find -name ".hg" -type d | xargs -t -i bash -c "(cd {}; hg pull; hg up)"'

I put that line in my ~/.bashrc script, which is executed each time I log into my computer. With that in place, all I need to do is something like this:

cd /path/to/third/party/apps
hgupall

And the aliased command handles the rest. Pretty slick stuff. Hooray for Mercurial and Linux!

Mercurial 1.3 Released

Today marks the official release of Mercurial 1.3, an awesome distributed version control system. This release comes with several nifty features, including the following, straight from the What's New wiki page:

Major Changes

  • experimental support for sub-repositories
  • Python 2.3 is no longer supported; now requires Python 2.4-2.6

Commands

  • merge: add -P/--preview option
  • update: don't unlink added files when -C/--clean is specified
  • update: added -c/--check option to abort on local changes
  • update: allow merges going backwards
  • push: improved handling of named branches
  • branches/heads: add a -c/--closed option to show closed branches
  • help: new extensions topic

General

  • add patch.eol config setting to work with cross-platform patches
  • fixed support for SSL through proxies
  • add ability to load hooks from arbitrary Python modules
  • hide passwords for HTTP repositories in error and log output
  • fix Python 2.6 support in the Windows installer
  • add mechanism for specifying HTTP authentication details in hgrc
  • prompts and choices are now shown even in non-interactive mode
  • performance improvements, especially on Windows
  • much improved zsh completion
  • improved Danish, Japanese, Italian and simplified Chinese translations
  • new German, French, Greek, Brazilian Portuguese and traditional Chinese translations

Web interface

  • read configuration data from webdir configs
  • add branches page to hgweb
  • pluggable templater engine support
  • refresh hgwebdir configuration periodically
  • let web.encoding override ui.encoding setting
  • deal with dicts/lists like webdir config paths

I'm quite stoked about this release :) For additional information, please check the project's wiki.

My VIM Adventures

Along with my recent adventures with Fedora 11, I decided to force myself to become more proficient with VIM. For those of you who do not know, VIM is based on perhaps one of the oldest surviving text editors around today. There are often religious-grade battles between those who believe in VIM and those who believe in Emacs, another long-surviving text editor. I'm not trying to get into any debates about which is better, and I'm not interested in why I should not be using VIM. If you still feel like I need to be set straight, please use the contact me form instead of the comments section.

Anyway, most people who use these editors fall into 1 of 3 categories (there are probably more categories actually):

  1. They're familiar with it enough to get the job done, but they're not exactly proficient. Therefore, they don't care about evangelizing the editor.
  2. They're proficient with the editor, but they're afraid of the politics involved in religious wars relating to text editors, so they don't evangelize.
  3. They're proficient with the editor and feel that the whole world would be better off if everyone used their preferred text editor. As such, they cannot shut up about the dang thing and drive all of their friends, coworkers, and acquaintances mad.

A few of you will probably agree with what I'm about to say. I fear I have transitioned from stage 1 to stage 3 fairly rapidly. I can't stop talking about VIM all of the sudden! You'd think it's the next best thing after sliced bread the way I've been blabbering about it. And here I am, writing an article about it. Hah.

Ever since I first started using Linux, I have been using vi to handle most of my text editing when I was in a terminal. I knew enough to get around. Basic things like navigation and inserting text were pretty much all I knew how to do. I dabbled with a tutorial here and there, but it wasn't long before the things I learned were lost, since I usually preferred a graphical text editor over VIM.

My recent experimentation with VIM has proved to be very fruitful, if I do say so myself. I am no longer tied down to some editor that is slow and bulky, I don't have much to worry about when I switch computers (chances are that VIM is on any computer I use regularly), and I don't even need to be sitting at the computer I'm using VIM on! In fact, today I was doing most of my work over an SSH session to my netbook. I felt more productive today than I have in a very long time.

It's been a long time since I've enjoyed using a mouse to perform basic tasks on my computer. Using VIM allows me to rid myself of the mouse entirely for my text editing tasks, and I don't feel at all limited in my capabilities. Things that used to be quite sketchy operations using my favorite graphical editors end up being very simple with VIM.

I also love the obscurity favor of it all.

Examples

I wish I could just keep adding stuff to this list! There are so many neat things I want to share with everyone about VIM! I'm sure there are more efficient ways to do some of the things I have been learning with VIM, but this works very well for me.

Laziness

I do a lot of reStructuredText for various things. In fact, I'm writing this article using VIM right now. ReST is fantastic, but it's horrible to do using an editor that is not set up with a mono spaced font. I like to see things nicely lined up (I'm a Python developer, after all). I also like to have my section headings have an underline that is as long as the heading itself. For example, the heading just above this looks like this:

Examples
========

In this particular instance, it's not a big deal to hold down the equals key long enough to underline the word "Examples". However, sometimes I get some pretty lengthy section titles. The lazy side of me doesn't want my finger to hang around on the same key for very long (or tap it dozens of times, for that matter). Also, trying to figure out how many characters are in a section title without a mono spaced font is very annoying.

The/a solution? Say I have a section heading that is 50 characters long. To underline it, all I have to do is type 50i= and hit the escape key.

Cutting Text Mid-Line

Another neat thing is being able to cut text from the cursor to a particular character somewhere later on (or earlier on!) in the same line. Say I have a hyperlink whose address I wish to change:

<a href="http://www.somelong.com/that/I/want/to/change/">Link Text</a>

Instead of using the mouse to highlight the href attribute's value (or highlight it using shift on the keyboard), I just position my cursor on the h in http and type dt". VIM will lop that address right out of there (and you can paste it elsewhere if you'd like). I used this particular shortcut countless times today as I replaced things like {% url some-named-url with,some,parameters %} with {{ some_object.get_absolute_url }} in some Django templates.

Search & Replace

And I cannot neglect the classic search and replace functionality in VIM. You can use fancy regular expressions in VIM to replace some text with something else. I was trying to do a little refactoring today, and I came up with a command like this:

:s/something/lambda (a,b,c): \0(a,b,c)/g

That sort of command works great to replace all occurrences of "something" on the current line with "lambda (a,b,c): something(a,b,c)". Fantastic. What about a global search and replace, instead of just the current line? Stash a % at the front of the command (:%s/something/lambda (a,b,c): \0(a,b,c)/g) and you're in business.

Now what if you only wanted to perform that search and replace over a certain group of lines instead of a single line or the whole file? This is one I'm particularly thrilled about:

:.,.+9 s/something/lambda (a,b,c): \0(a,b,c)/g

That little beauty will perform the search and replace on the current line and the following 9 lines. How awesome is that?

Moving & Deleting Words

Sometimes as I am writing something, I decide I would like to reword a sentence as I near the end. Sometimes this involves simply deleting a word or two. Sometimes it means chopping a few words out of the beginning part of a sentence to put them back at the end somewhere. Whatever the case, VIM seems to handle my needs perfectly well.

Say I have this sentence (from the Vimperator Web site): "Writing efficient user interfaces is the main maxim, here at Vimperator labs." If I want to move the "here at Vimperator labs" to the beginning of the sentence, assuming I just finished typing it, I would place my cursor over the period at the end, type dT,, hit ( to go to the beginning of the sentence, hit P to insert what I just copied, and then handle the rest of the clean up (capitalization, fixing the comma, etc). I could have also done something like, 4db instead of dT,.

If I want to cut/delete an entire word, or to the end of whatever word my cursor is currently on, I could use dw. For more than one word, just put a number before the command. It's great stuff!

Taking It Too Far

I've gotten so carried away with all of this VIM business. I really have. I installed vimperator in Firefox. This extension gives Firefox a VIM-like interface. Now I can do pretty much all of my regular surfing without using the mouse. Some may argue that this is absolutely impractical because it would take much longer to get to the right link on a page using the keyboard than it would with the mouse. That may be true. I dunno, but I still think it's awesome that I really don't need my mouse to browse the Internet now.

As I was playing with vimperator tonight, one of my buddies pointed out another useful extension called It's All Text. This extension allows you to use your preferred text editing program in regular old text boxes in Firefox. It is this extension which has just made writing my blog articles 200x more efficient. Now I can quickly and easily write my articles right here in VIM without having to copy and paste all over the place. Pretty dang incredible.

Oh yes, I'd like to thank Chad Hansen and Jonathan Geddes for helping me out as I explore the depths of VIM. You guys rock!

My Fedora 11 Adventures: Part VI

Folks, I cannot take this any longer. I've had Fedora 11 installed on my computer for 5 days now. That is close enough to a week for me. There simply is not enough about Fedora right now to keep me using it. Perhaps the next release will be better for me. I honestly hope so.

To be perfectly honest, I enjoyed most of the Fedora experience these past few days. I was thoroughly impressed with the speed and memory usage in Fedora compared to Jaunty. When I mentioned that on Twitter the other day, one fellow asked if the two systems were running the exact same software. His train of thought seemed to be that you can't really compare two different distros for speed or memory usage unless they run the exact same software at the time of the sample.

My response to that is that it doesn't matter to me in this particular case. I was comparing the general performance of both distros using their "stock" configuration. You can customize a distro however you'd like, and, in the end, that's where you'll probably find the most performance gains in any system.

But performance out of the box is important to me. I'll just leave it at that.

As I write this, I'm creating an ISO of slackware-current (as of midnight MST) so I can see what KDE 4 is like on a real distribution. Heh. This oughta be fun. Anyway, I truly hope that the next release of Fedora will hold my attention for a bit longer.

My Fedora 11 Adventures: Part V

Fedora 11 has been treating me pretty well now that I don't have Firefox installed. I am considering the head of manually installing Firefox 3.0.11 in my home directory to see if that fares any better. Another goal I have for today is to change some of the settings for the login screen. So far I haven't been able to figure out how to access that one.

The Login Manager

Surfing a few sites this morning has suggested that I'm not the only one struggling to rid myself of the stock Fedora login manager preferences. One person did suggest a trick for changing the background image, though. I tried it out, but I'm not so sure it worked as planned--I got a ton of SELinux notifications, and I'm not prepared to log out and back in at this time.

Well that's cool. I was just playing around in the terminal looking for any commands that might help me change the settings for the login screen. One command, gdmflexiserver, seemed to lock my screen and show the login screen again. Sure enough, the background I had chosen before was there instead of the nasty default image. Logging in as myself at this screen unlocked my session, and I had everything just as I left it.

Installing Firefox

I tried to download the .tar.bz2 archive of Firefox straight from their website, but that is only i686. My computer didn't know how to execute the program. Time to look into alternatives.

After a while I decided to try to compile my own Firefox. That didn't go very well--nearly an hour into the compile, it farted out complaining about floats or something. I don't have the time to dedicate to making Firefox work.

Google Code + Mercurial = Many Happies

Last night I noticed that Google Code is actually offering the Mercurial project hosting that they promised back in April. I guess it's been around for most of May, but I never saw any news to suggest that it was actually public. As soon as I noticed it, I converted one of my less-known, less-used SVN projects to Mercurial. I'm really liking it.

I need to do a bit more work on this particular project before I announce it to the world, but it's out there, and it's Mercurial powered now babay. I think I will be leaving most of my other projects in SVN so I don't upset all of the other people who actually use them.

Oh, I also noticed that the project quotas were bumped up quite a bit. Now each project seems to get a whopping 1GB of space for free!!! What do you have to say about that, BitBucket/GitHub/Assembla/[insert dirty, rotten free open source project hosting host name here]?!

Hooray for Google Code!

My Fedora 11 Adventures: Part IV

Well, here I am in 64-bit Fedora 11. Only this time I'm using GNOME. I followed pretty much the same steps as before to make my computer conform to my preferences (background image, font sizes, etc). Things seem to be rolling much more smoothly with GNOME than they did with KDE 4. To top it all off, I haven't had to do a hard reset of my machine since I noticed that Firefox was the culprit that always seemed to be loading when my GUI became unresponsive.

Wireless Networking

I found a pretty good, straight-forward tutorial for getting my wireless adapter running in Fedora 11. You can find it here. I used b43-fwcutter to get hooked up. Very easy, but not quite as easy as recent versions of Ubuntu and several other distros (which detected and used my wireless adapter automatically).

Installing Software

I have learned that the Software Management tool I was trying to use before simply is not the way to install software in Fedora. It doesn't work worth beans for me. Instead, I've been dropping to a root terminal whenever I need to install something. The yum utility has been treating me pretty well. It's found every package I look for.

That is, until I tried to install vlc. When I went to the VLC website to grab a Fedora package, I learned about something that I've never heard of before: RPM Fusion.

I guess it is just another software repository with all of the goods that aren't in the stock Fedora repositories. VLC was easily installed after following this guide.

I really need to get some work done, so I will have to wait a little while longer before I post any further information about my adventures.

My Fedora 11 Adventures: Part III

Alrighty folks. Good night's rest? Check. Need to get work done? Check. Today's adventure will be about getting my computer set up for the regular development tasks that I need to do every day for my work and hobbies.

Getting Work Done

The first thing I noticed this morning when I turned on my computer was that it took exactly 1 minute from the time I hit the power button to the time I hit the enter key to log into my computer. Logging in took an additional 15-20 seconds. That was quite nice.

The next thing I noticed was that I was not connected to my network as I should be. Clicking the system tray menu item as I did last night did the trick, but I'm going to have to investigate how to make it connect automatically at boot.

Automatic Network Connectivity

It looks like I can have my Ethernet be activated automatically by right clicking on the network manager icon in my system tray, selecting "Edit Connections," selecting "System eth0," clicking the "Edit" button, and finally checking the "Connect automatically" option in the subsequent window. We'll see if this truly activates my connection next time I boot.

In an effort to get my wireless working, I poked around a little more in the "Edit Connections" screen, but I didn't see anything that seemed useful. I did find something that seemed a bit more interesting by selecting Applications > Administration > Network Configuration from the KDE menu. This utility suggested that my wireless adapter was actually wlan1 instead of the wlan0 that the tray icon seemed to think it was.

I tweaked a few settings about my wireless adapter, such as marking the "Activate device when computer starts" and "Allow all users to enable and disable the device." In the Hardware Device tab, I selected my actual Broadcom wireless adapter instead of the non-existant wlan0. I also hit the probe button next to the "Bind to MAC address" box.

My network manager tray icon still shows no wireless networks (of which there is no shortage around here), and running iwlist scan as root says "Network is down" next to wlan1. I think I will just mess with it later. Maybe it will "just work" when I reboot next time.

Installing/Configuring The Tools

As I previously mentioned, I prefer to use things that work well without getting in my way. When talking about text editors, VIM is just fine for me, and VIM 7.2.148 is already installed on my Fedora 11. One less thing to install.

Next up comes the installation of all of the goods for Firefox. It turns out that Fedora comes with Firefox 3.5 Beta 4--a bold move. I hope my extensions all work! The extensions I will be installing right now include:

  • AdBlock Plus: get rid of pesky ads that slow down my computer
  • Firebug: an amazing tool when debugging Web pages
  • Web Developer: has some niceties that Firebug doesn't come with
  • Screengrab: fantastic for taking screenshots of full Web pages
  • 2Zeus: my own little extension that allows me to quickly get short URLs a la tinyurl.com and is.gd

When I plugged in my external 1TB Seagate hard drive, I got a delicious Fatal Error message:

/images/fedora/p3/fatal_error.png

All appears to be in order, however, as I have access to all of the partitions on the external drive.

Next I want to install Opera. It appears that the place to look is Applications > System > Software Management in the KDE menu. Let's see what we have. Searching for Opera in the only obvious search box sent my computer into a crazy "let me do something without telling you" cycle. I have no idea what's really going on, but my processor has been maxed out for the past 3 minutes and my network has been working a little here and there. Can it really be that difficult to find a simple package? Oh! It finished! It took 6 minutes and 54 seconds to find nothing. Excellent. Let me look somewhere else.

Awesome. My computer is non-responsive. The hard drive is still working, but my GUI is doing nothing. I love it. Attempts to drop back to a trusty console using Control, Alt, and F1-F6 rendered no results. I wonder if I can SSH in from here... I sure can! Fantastic. Let's see what's happening.

It appears that X is taking up 90% of my processing power, but my computer is still not responding to any of my input. Dang it! Now my SSH session isn't working. Looks like the only option I have now is to do a hard reset. Joy of joys. Thank you for this opportunity, Fedora. Last time I did a hard reset, I was in Windows and it trashed my 1TB external.

So far rebooting seems to be going well. I wonder if my network will be setup properly still... Fantastic! It works! Wireless is still not available though. I can live without that for the time being.

Back in the Software Management utility, searching for Opera again proved to work much more quickly, but I didn't get any results. I suppose I'll just go download it from their site. The download for Opera 10 beta 1 is a mere 7.2MB, and it looks like it will open in the same Software Management utility that I've been dinking around in.

When I downloaded the Opera package, I asked it to open directly in the default program, KPackageKit. That doesn't seem to be working in the least, so I am going to try to just save it to my home directory and install it some other way. Sorry guys and gals, I ended up just dropping back to a terminal to run rpm -Uvh opera-10.00-b1.gcc4-shared-qt3.x86_64.rpm and that seemed to work fine. Opera appeared in my KDE menu, and it runs well now.

Next up is Pidgin. Pidgin 2.5.5 is installed by default, and getting it up and running was as trivial as ever.

Now to test Flash... YouTube, here I come!! Beh, Flash is not installed by default, and it's also not in the Software Management tool. What use is that thing?! Maybe if I apply all of the updates in the "Software Updates" section it will feel more useful... Here it goes.

Cool. System is unresponsive again. Let's see if I can reboot from here. Nope! Thank you, Fedora, for making me hard reset my system more in 2 hours than I have had to in YEARS. Yeah, thanks buddy.

10:50 AM So the software updates continue to not work. It appears that a ypbind package is the culprit which is causing everything to hang... I disabled it and tried to install the software updates again.

10:53 AM GUI is non-responsive again. Yay.

10:56 AM Third hard reset in 3 hours. Maybe I will have to modify my original parameters and try GNOME to see if that makes the computer usable for more than an hour at a time.

11:00 AM That's it! I'm getting rid of KDE 4... sorry folks, GNOME is my only hope of getting work done. Second clean shutdown out of 5 since the installation completed last night.

My Fedora 11 Adventures: Part II

The Uneventful Installation

The installation for Fedora 11 went pretty smoothly. I began the installation around 11:10PM on June 10th, 2009. I did a fair amount of customization with my partitions and package selection, so the exact timing for installation is probably not a very fair figure to place here. But I'll share some numbers anyway, for my own benefit more than yours.

  • The "Starting installation. This may take several minutes..." took about 4 minutes
  • Installing 1,443 packages took 33 minutes

The timing seemed pretty typical of an RPM-based distribution to me.

First Boot

After the installation succeeded, it asked me to reboot. I noticed that the installer didn't eject the DVD when it was ready to actually reboot, so I just left it in there for kicks. When the DVD's boot menu came up, it showed a list of a few boot options, one of which was to boot from a local drive.

I selected the local drive option, but it failed--it apparently decided to look for a non-existant PXE server. Ejecting the DVD and rebooting again rendered the actual Fedora bootloader that was installed to my hard drive. It automatically launched Fedora after 5 seconds or so.

The boot screen is nice and pretty... none of the classical progress bar business, but rather the circular shape that makes up the Fedora logo. As the boot process proceeded, this shape was filled in a diagonal, bottom-left to top-right fashion. I like that.

Next, it presented me with a "Welcome" screen that said something about there being a few more steps before my system would be ready to use. These steps included a license information page, creating a regular, unpriviledged user, setting up the date and time, and an optional "send hardware profile" page. I opted to send my hardware profile just because I know what it's like to not have information like this when you're trying to figure out problems your users are having. You should be aware that opting in on the hardware profile submission enables a monthly submission, not just a one-time submission during setup.

First Login

After all that was done, I was presented with a login screen and a fairly ugly background. I will probably be changing that one. After logging in, the loading screen seems pretty slick... It has a fancy little progress dealy unlike no other I've seen before. Almost as impressive as the boot up screen, if not more so.

The sound levels after logging in were pretty obnoxious. If I were in a crowded workplace, I'm sure I would have been attacked with rotten lettuce and tomatoes because of that sound. That will also have to change...

The default Fedora 11 KDE 4 desktop

My default background was the same that was used on the login screen. It was the first thing I decided to try to change.

Changing The Background

System settings

Clicking the Fedora button in the bottom-left corner of the screen pulls up the new KDE menu (which is going to take some getting used to for me). The initial menu showed a "System Settings" option, which is what I used to change the background image. On the screen that loaded immediately after selecting "System Settings," I was presented with several icons that seemed like they would do the trick.

Appearance settings

Well, after a little poking around, I decided it might be easier to just right click the desktop to see if the context menu had any suspicious items for changing the background. Lo and behold, I found an "Appearance Settings" item. That was the ticket.

The desktop context menu

Disappointment. Utter disappointment. When I went to select a new background image, I discovered that there was only one to choose from--the nasty default one! I tried clicking the "Get New Wallpapers..." button, but all that did was tell me I had network problems.

Connecting To The Network

There was a nice little icon in my system tray that suggested it was a network manager, so I clicked on it. I suppose Fedora detected my Ethernet adapter just fine, as it was an option in the menu that popped up when I clicked the icon. My Broadcom wireless adapter apparently was not detected. Still, I find it curious that Fedora didn't connect to my Ethernet automatically (the cable was plugged in the entire time). Clicking the eth0 item in the menu was painless, though. It connected me directly to my network with no additional fuss.

The network manager menu

Back To Backgrounds

The "Get New Wallpapers..." button that I mentioned previously seemed to work a bit better after having connected to the network. When I clicked it, though, I was presented with a screen that apparently wanted me to do something before it would do anything for me. After waiting for a few seconds (because I was typing this), things started happening. New backgrounds started to appear, but there was no indication of any activity. I found that rather strange.

Getting new backgrounds

Selecting a few background images that looked appealing from their thumbnails was pretty straight-forward. The actual download, however, was less than impressive... either the server is overloaded with activity, or the images are very large, because my connection is quite idle right now.

It seems that all of the backgrounds that appeared are all of the classics from kde-look.org that were available in my trusty KDE 3.5. This is good.

Font Sizes

The next change I felt I must make before proceeding was reducing the size of the fonts. They are much too large for my preferences. Back to the System Settings I went. This time, the "Appearance" icon was the one that proved to be pertinent. Fedora's default font size was 10-point. I changed them all to 8-point. Things felt a lot better after doing that.

Things after changing the background and the fonts

Playing Sudoku

The new sudoku game

Now that it's close to bed time, I feel I must close this section with the requisite game of Sudoku :) The new KDE menu setup is really, really going to take some getting used to. I found Sudoku under Applications > Games > Logic Games > Sudoku Game.

I beat sudoku!

Tomorrow will be an interesting day, because I'm going to get my system setup for work! (By the way, Fedora 11 shuts down insanely fast!! It also blares another nasty sound when you begin the shutdown sequence... ugh)