Feb
15
2010
I had a problem last week. I had refactored TasksApp to be wholly object-oriented, and had just finished the second round of refactoring code – tidying up classes, moving code that could be reused into more sensible places, and generally tidying up ready to launch my project on the world.
I checked out a new working version to use with my live database and was appalled at how slow the app had become. Loading the home page with around 100 tasks was taking a couple of seconds on my local machine; much slower than it had been before I refactored. I did some quick testing and saw that the delay was increasing with the number of projects and actions displayed.
First port of call, make sure the database indexes were set up right. All looked ok, apart from a couple of indexes that were now useful with the query chanegs I had made. Fixed these, but no dice.
Secondly, set up XDebug to pump out some profiling information, and use KCacheGrind to have a look. Not much I didn’t know, but confirmation that the time was all being taken in instantiating and displaying project and action objects. A brief look didn’t show anything up so I decided to leave it and come back to debug the paths through the app in Komodo when I had a bit more time. Very annoyed that my lovely, modular, readable, extendable code was behaving badly like this.
This morning I noticed that a page on our intranet was really taking along time to load, and saw a message in the status bar about bit.ly. Hmm. A quick trip to the Firefox add-ons window, and one uninstalled plugin later – all is fine. The page snaps up in super-quick time, and all is well. Lesson learned – test web apps in Firefox with all plugins turned off, and have confidence that the code I produce is good-quality code.
Feb
11
2010
…not because I feel the obligation, but because the act of blogging about the thought made me realise that I spend far too much time installing other distros and then setting them up to work exactly like Ubuntu. I appreciate the freedom that Arch gives me, and I appreciate the flexibility that that system provides. It’s just that I don’t really need it. This came into sharp relief thanks to this sequence of events:
- Want to boot Ubuntu to a text prompt and then start X when I need it
- Can’t find an easy way to do it as they seem to have changed the boot process to avoid using inittab
- Throw all my toys out of the pram at The Injustice Of It All
- Wipe my machine and spend a whole weekend getting Arch to work, booting nicely to a text prompt
- Blog about my new found freedom
- Take an hour installing and setting up the software I need to get Arch to boot to a graphical log-in as I’m fed up of the text one
Granted, I know a lot more about Linux than I did before I started, but that’s another few hours lost that I could have spent improving my Python or PHP skills, or writing a chapter of my novel, or sorting out some of my photos, or any one of the other hundred things on my to-do list. And I could have done any of those on any of the distros I’ve tried in the last year.
Jan
25
2010
Well, I’ve been edging around it for a while – slowly trying to get a bit more independent of Ubuntu, trying not to settle for the default install and making Linux work for me. It has been largely unsatisfying though, mainly because there are a lot of things I don’t like about Ubuntu, but all tempered with the fact that it does a lot of stuff well; and it really does ‘just work’. However, I hanker after a distribution that lets me have the same DIY experience that made me love Linux in the first place. Getting Linux up and running really was a triumph when I first started messing around with Suse, Mandrake and Red Hat back in the day. I miss the challenge, but I still need a system that has the potential to do everything I need.
Enter Arch Linux.
I had tried a VM install of this a while ago but decided to go all the way and do a clean install of it at the weekend. As I am writing this on that system, all geared up to use for work, it obviously has worked. But is it what I had hoped for? Yes it is! The install was actually relatively painless, if time consuming. Ubuntu 9.10 took about an hour from finishing my backup to having a completely clean install running, with all the packages I wanted installed and configured. Arch took more like three or four hours, but I really feel like I’ve built the system I want and, more importantly, I feel like I know how it all fits together. For my money Ubuntu is getting increasingly large-OS-like in its approach — and I’m including Windows and Mac in that — hiding a lot of detail from the user and changing some configuration to be more user-friendly ( for ‘user-friendly’ read ‘hard to understand and different to the way everyone else does it’).
Arch values simplicity in its best form — not meaning ‘dumbed-down’ or ‘simplistic’ but meaning that everything works in a consistent way, and that your basic install is minimal but functional. You then add in the components you need to make the system you want to work with. It could be seen as a great distro for beginners, if that beginner is wanting to understand Linux and how to put a truly great and reliable system together, rather than beginning to use Linux because it is an OS that will let them ‘not use Windows’. No snobbery intended here — these are both equally legitimate paths into and through the Linux world. I think of it as being lord of the manor in both cases; with Arch you know where the wiring is, how the plumbing works, and more than a little about the structural stresses and strains of your manor. The Ubuntu manor is just as sturdy and impressive, its just you may need to call in an expert when you want to start making structural changes.
And with that almost supernatural straining of the art of simile, I’ll get back to my work…
Jan
14
2010
Getting the code and installing
Grab the code from here and follow the instructions (they’re in French but pretty easy to follow if you’ve compiled your own software before). Out of the box it recognises .mdtxt files as Markdown files, but I like all my .txt files to be recognised as Markdown too, so I did a bit extra behind my scenes to get this to work.
Setting the association
First thing to do is add the “txt” extension to be recognised as markdown format. Open the file to edit:
gedit ~/.local/share/mime/packages/x-markdown.xml
then add in the glob pattern for txt files under the current pattern for files so that the file has two lines like this:
<glob pattern="*.mdtxt"/>
<glob pattern="*.txt"/>
Next, remove the txt extension association with plain text. Open the main mime types file (you will probably need to do this as root):
gedit /usr/share/mime/packages/freedesktop.org.xml
and search for the line
<glob pattern="*.txt"/>
This should only appear once and will be in the section for ‘plain/text’. Delete this line.
Once you’ve done these steps, run the following two lines of code (the second may need you to be root):
update-mime-database ~/.local/share/mime/
update-mime-database /usr/share/mime
then restart Gedit and you’ll be all set!
Dec
18
2009
A comment on my previous post has inspired me to put fingers to keys and mention that I have recently discovered Openbox – a rather wonderful window manager that is working very well for me on Linux.
Openbox does one thing only – manages windows – without giving you all the frippery that, say, Gnome does. That means no panel, no desktop icons, no all-pervading Nautilus, nothing. Moving from Gnome to Openbox is a bit like the difference between going swimming by going to a ‘pool’ at Center Parcs and jumping out of a boat straight into the middle of the ocean. This requires a steep learning curve, but the rewards are great. There are plenty of applications you can use to provide the functionality you may miss, but they are all very nicely self-contained, light, with very few dependencies, and nicely customisable.
At the risk of incurring the wrath of the analogy police – Openbox is a bit like watching a film at home rather than at the cinema. You can set the screen, snacks and seating up how you like, start the fiolm when you want, stop it if you need a wee, and talk all over the best bits if you so please. You also need to shop ahead for the snacks, live with your own choices if you miss the best bits by talking over them, and realise you can’t complain if you don’t like the service you give yourself. In other words, you can get a much richer experience but you have to put in a bit more work to get it.