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)

My Fedora 11 Adventures: Part I

Today I decided that I would deliberately put myself outside of my comfort zone. No, not by intentionally putting myself on a telephone for more than 5 minutes this month... I will need a lot more preparation before I can attempt that one. No no, today's experiment has to do with Linux. If you're new around here, I am a very big fan of Linux. It has been my primary operating system for over 8 years (but I still use Windows and Mac occasionally, when I need to test my programs and the cross-platform behavior).

A Little Background On Yours Truly

There was a time when I was what you would call a distro-hopper. I would download any and every Linux distribution I could get my hands on. Most of them would hang around on my computer for a few days at best, but a select few actually impressed me enough to have them stick around for longer. Among those few are Slackware and Sidux. Many other distros are nice and pretty, but when it comes to me being productive on them, there always seems to be something lacking.

I am addicted to speed and reliability--two things that originally urged me to tinker with Linux all those years ago. I am more than willing to sacrifice looks and features for being able to just get something done quickly and efficiently. As a matter of fact, I'm writing this article in VIM, one of the most "light-weight" editors around these days. It allows me to do exactly what I want to do without getting in my way. That's how I like things.

That's probably the main reason I love Slackware. It won't do anything I don't tell it to do. No crazy background processes updating some package repository, slowing down my system. No pestering me about security updates that I will install in my own due time. Slackware only does what I want it to, and I have learned a ton about Linux because of it. If I decide I want something automated in the background, I have to tell the computer to do it. If one of my programs has been updated on the Internet, I download and install the package manually instead of using a "package manager." If one of my programs doesn't work because of a missing dependency, I am the one who finds and downloads the dependency. It's a lot of work initially, but I'm of the persuasion that this work is well worth it for my situation.

In today's day and age, that sort of setup seems to scare a lot of people off. People like to have things "just work." People like to not have to worry about keeping up to speed with what security threats are out there. People like having things to keep them entertained instead of getting things done. People like to see their desktop turn into a cube and spin around. People like to see things glow and wiggle on their computer. It's aesthetically pleasing. There's nothing wrong with that. Unless you want to get things done instead of just stare at your computer.

The Challenge

With that background in mind, you should be equipped to better understand the information and articles that follow. My challenge to myself is this: install Fedora 11 and use it for at least a week. To add to the the challenge, I'm installing the 64-bit version. In my past experience with 64-bit operating systems, there has been no real motivation or necessity for 64-bit computing. It just means more compatibility problems, which reduces productivity. This will be the first 64-bit operating system I actually plan to keep around beyond the exploratory period.

There are a few things about this that will bring me waaaay out of my comfort zone. They are (in no particular order):

  • Fedora
  • RPMs
  • KDE 4

I have a strong disregard for each of these items. There was a time when I considered Fedora to be a respectable platform--back when it was Fedora Core 2 or 3. Ever since then, I feel that it has gone down the tubes. RPMs have always seemed grossly lacking in the speed department to me, and it only got worse after I found out about Debian and Slackware. Finally, KDE 4 seems like one of the absolute worst window managers I have yet to encounter. I love KDE 3.5.x. I wish I could use it everywhere I go. But KDE 4 has yet to appeal to my desire for efficient productivity--it gets in my way almost as much as GNOME does.

Starting today, I plan to look all of these opinions (as biased as they may be) straight in the eye and take 'em head-on. I am going to work on learning to enjoy using Fedora. I'm going to work on learning how to appreciate RPMs. I am going to learn to be productive in the window manager "of the future."

And I will keep you all apprised of my progress.

My Preferred Filesystem

I just thought I would share this little screenshot with you all:

GParted on a 1TB

Can anyone guess what my favorite filesystem is and why?

That's right, I'm a fan of reiserfs even if its daddy is a murderer. The filesystem is fast. Really fast. I have no definitive benchmarks, I just know what I've personally experienced over the last 8 years or so. I've dabbled with the major filesystems that Linux supports like xfs, ext2, ext3, and even a little with ext4. Out of the bunch, reiserfs has always come out on top for me.

I'm not trying to start any flame wars, and I don't really care to hear why my choice is wrong--it's my choice. A few people have asked me what format I prefer, and this is just a small demonstration of why I prefer what I do. Done.

Django Tip: Application-Specific Templates

Today I have another Django goodie to share with you. For the past few days, I've been struggling to come up with a way to only load certain Django template tag libraries when a particular Django application is installed. There may well be other, more elegant solutions for this particular problem, but it can't hurt to add my findings to the pile.

We have several templates which need to display certain information only when a particular application (Satchmo, in this case) is installed in the site. A lot of these templates are global for our 100+ Django-powered sites, such as customized admin templates and the like. It's much easier for us to maintain our code this way, as opposed to overriding templates on a per-site basis.

The Problem

We have created template tags which allow us to render "Content A" if application foo is installed or render "Content B" if foo is not installed. This works great all the way up until you need to use template tags that are specific to foo. The reason for this is that all of the template nodes appear to be parsed before they're actually rendered. That means that if foo is not installed and one of your templates included a template tag from foo's template tag library, Django will complain because it cannot find that tag (since foo is not in your settings.INSTALLED_APPS).

I investigated several possible solutions to this, including a custom loadifapp tag. The idea was to only load a template tag library if the specified application exists in settings.INSTALLED_APPS. This proved to be an interesting and very, very hacky endeavor. In the end it didn't work, and it was taking much too long to get anywhere useful.

The Solution

The solution I came up with for this situation is to create an additional include tag. I basically copied the include tag from Django itself and hacked it a bit. The result:

from django import template
from django.core.exceptions import ImproperlyConfigured
from django.db.models import get_app
from django.template.loader_tags import ConstantIncludeNode, IncludeNode

register = template.Library()

def do_include_ifapp(parser, token):
    """
    Loads a template and renders it with the current context if the specified
    application is in settings.INSTALLED_APPS.

    Example::

        {% includeifapp app_label "foo/some_include" %}
    """
    bits = token.split_contents()
    if len(bits) != 3:
        raise TemplateSyntaxError, "%r tag takes two argument: the application label and the name of the template to be included" % bits[0]

    app_name, path = bits[1:]
    app_name = app_name.strip('"\'')
    try:
        models = get_app(app_name)
    except ImproperlyConfigured:
        return template.Node()

    if path[0] in ('"', "'") and path[-1] == path[0]:
        return ConstantIncludeNode(path[1:-1])
    return IncludeNode(path)
register.tag('includeifapp', do_include_ifapp)

The magic here is the return template.Node() if Django cannot load a particular application. This makes it so the template you would be including will not be parsed, and the invalid template tag errors disappear!

To use this tag in your Django-powered site, simple plug it into one of your template tag libraries and do something like this:

{% extends 'base.html' %}
{% load our_global_tags %}

{% block content %}
<h2>Global Content Header</h2>
Bla bla

{% includeifapp foo 'foo_specific_junk.html' %}
{% endblock %}

And within foo_specific_junk.html you would load whatever template tag libraries you need that would break your templates without foo being installed. This tag should work for any application. I would be interested to hear what you use it for in the comments!

A Quick Django Tip: User Profiles

I thought I would share with all of you a little trick that I've been using for quite some time in my Django applications. Personally, I find it to be very convenient and simple.

Django allows you to specify an AUTH_PROFILE_MODULE setting if you wish to maintain information about a user beyond the basic username, password, email, etc. To access the profile for a given User instance, you must do something like:

from django.contrib.auth.models import User
user = User.objects.get(pk=1)
user.get_profile().additional_info_field

That seems all find and dandy, right? Just a simple call to get_profile() isn't that difficult. However, if there is not yet an instance of whatever you set AUTH_PROFILE_MODULE to for the user in question, you'll get an error about it when you call get_profile().

My simple-minded way around this is to do something like this:

from django.db import models
from django.contrib.auth.models import User

class UserProfile(models.Model):
    user = models.ForeignKey(User, unique=True)
    additional_info_field = models.CharField(max_length=50)

User.profile = property(lambda u: UserProfile.objects.get_or_create(user=u)[0])

The magic is in the property() and get_or_create. Using the property() feature in Python, means you can just do something like:

from django.contrib.auth.models import User
user = User.objects.get(pk=1)
user.profile.additional_info_field

(with no parentheses after profile) The get_or_create method tells Django to look for any UserProfile objects whose user attribute is the user from which you are accessing the profile property. If no matches are found, an instance of UserProfile is created for you. The lambda function returns the UserProfile instance in both cases.

This trick is very simple. It's also very effective in my experience. I'm sure there are other ways of doing the same thing, but this works for me, and it's just one line of code--no need to even specify the AUTH_PROFILE_MODULE setting! You can apply the same trick to pretty much anything if you'd like. It doesn't have to be just for user profiles. Enjoy!