Jan 222008
 
No Gravatar

Although [tag]KDE4[/tag] came out last week, I have not yet been able to try it out as I was out of town. Today (Sunday 20 January) however, I decided the time had come, I had some time to spare, and I was a few days behind everybody else. So I started googling…. and what a nightmare. The kde4 overlay that [tag]gentoo[/tag] had, has become obsoleted but the websites haven’t been updated. A thousand sites told me that kde4.0 will not be in the official portage tree – then I finally found out it IS in there (though it took a few days) and it is hard masked.

So confusing was things that at least one blogger gave up and posted a howto that relied on grabbing the source packages yourself and compiling them in a tree, rather than as packages.

Advantage of that method: It keeps it seperate from your existing stuff. Perhaps a lower risk.

Disadvantage: it’s not really the gentoo way is it ? Not to mention it’s a LOT of work.

So having spent ages googling, I felt I would summarize the right way ™ to install KDE4 on gentoo so others can skip digging through litterally hundreds of pages on the forums (not least because the kde4 release sparked the single largest flamewar I have ever seen on the usually amiable gentoo forums).

Finally, please note that I did my tests on gentoo for X64 – YMMV. Now on with the [tag]howto[/tag].

First things first, we’ll need an up-to-date gentoo system:

emerge –sync && emerge portage && emerge –update –deep –newuse world

Short version: Get the latest package list, upgrade portage to the latest version then do a deep world update with your current USE flags. If youhaven’t done a deep world update recently, you can expect some minor issues like blocks to deal with. This is a good time to go make coffee, mow the lawn, make love to somebody and a few other timekillers (it is not fast). If you are brave, you could skip this and run it instead of the emerge kde-meta later on (it will include it by then) – but while this is likely to be faster, it is also likely to break more often.

At this stage you need to get (if you don’t have it) the autounmask tool:

emerge autounmask

Autounmask if you don’t know it, is by far the easiest way to unmask bigger sets of software. With KDE4 hardmasked, you would need to find and unmask dozens of packages, which autounmask will do for you instantly. It’s a very usefull little app to keep for future reference anyway.

Next modify your USE flags a little and ensure that both opengl and xcomposite are in there (by editing /etc/make.conf) – this is required if you want to be able to enable the composition features in kwin later.

You can now test autounmask like so:

autounmask -p kde-base/kde-meta-4.0.0

Check the output, unless you see something very concerning, you can run it for real:

 autounmask kde-base/kde-meta-4.0.0

To get a more minimalistic version, you could use kdebase-meta as well. However, kde-meta will get all the kde4 packages for you. Including the newly redesigned kdegames. There are a lot of packages on that list though, so be prepared to wait a while (again).

You will have to update startkde-3.5.8 first (KDE4 blocks any earlier revisions – the last one is patched to allow it to exist next to KDE4):

   emerge –update /usr/portage/kde-base/kdebase-startkde/kdebase-startkde-3.5.8-r1.ebuild

You also need to force some special use flags for qt4.
Edit /etc/portage/package.use

Add the line:

x11-libs/qt:4 accessibility qt3support dbus gif jpg png ssl zlib

 

 Finally, it’s time to emerge kde4: 

 

emerge kde-meta

This will really take a long time. If you skipped the update world above, use this here and now. It is a good idea to do a -pv first, and check if you want to add some temporary USE flags as well. In my case I added:

 USE="pdf svg wmf ppds htmlhandbook debug "

But the list will depend on your current USE setup and needs so decide for yourself.

 

Once it is finished, you will need to restart kdm to get to a kde4 session:

First edit /etc/conf.d/xdm and change it to read:

DISPLAYMANAGER=kdm-4.0

Then run:

/etc/init.d/xdm restart

Voila, you can now log into a KDE4 session. You KDE3 session is also still available should you desire it. I’ll post a review of my findings with it in about 24 hours.

 

Final note: After I started, but before I finished this task  (which took me all of three entire days)- gentoo themselves published an up-to-date howto, I suggest reading it as well for comparison.

Jan 142008
 
No Gravatar

My aunt made us pancakes on Thursday night. Her recipe yields 60 of them which, since we are not such a huge group, is really a lot of pancakes. You could even say it was a crepe-load of pancakes !

Jan 102008
 
No Gravatar

I had a very interesting morning about 2 days ago, I didn’t post about it then because I wanted to do the post about code as well, but nonetheless it deserves a mention. As I woke up to the sound of my alarm, so I could go to work, the silentwife informed me “The neighbour was coming a while ago”. Not exactly your usual wake-up call. I looked at her quizzically for a minute, I was hardly expecting visitors so early, but it became clearly soon that what she meant was the common slang term for an orgasm.
Oh well, I go to my shower. As I return I am informed “she came again while you were in the shower, if we wait a while, it may happen again”. So we did, within five minutes the sounds of a woman experiencing a very intense [tag]orgasm[/tag] came wafting through the window like Jozi smogg (though much prettier). It returned no less than three more times, which brings my count to at least five for a lucky neighbourlady that morning.
Afterward we heard her and her boy joking and talking and apparently drinking coffee (though we couldn’t make out what they said).

Now this is not generally newsworthy (actually it is but you know what I mean) – what was funny though, is that we regularly do hear what they say to one another – because they mostly shout it and it is largely confined to terrible insults and accusations.
I could probably go into a large philosophical discussion about people whose [tag]passions[/tag] are somewhat off-scale and how this can come through both in negative ways (horrible fights) and positive ways (amazing sex) but that would just ruin a lighthearted post with some way too serious stuff.

Jan 082008
 
No Gravatar

Yes, there is a problem with writing [tag]well designed code[/tag]. It’s not a technical problem, it’s a human problem. Perhaps it’s more of a [tag]geek[/tag] problem than anything else, but it’s real enough.
What are (some of) the attributes of well designed [tag]code[/tag]  ?

  • It is highly reusable
  • It employs a common, standard design across the project.
  • It follows known algorithmic best-practices.

And why do we do that ?

  • It makes code less prone to bugs
  • Bugs that do appear are much more easily fixed
  • It makes it much easier to extend the functionality of the code later

This is just a short list of the things that make for well designed code, and the major reasons why it is important to follow the rules of good design. Things like avoid global variables, use object oriented code, abstract away from implementation details in a library to the very greatest possible extent (in theory, a simple library change should allow you to do such a thing as switch to another kind of database server with zero impact on your other code).

So what is the problem ? Well it is like this. When you first start a project, and you follow these rules it is a highly creative and enjoyable experience. You are designing every step of the way, figuring out just how to apply the rules to your specific needs. What tables does your database need ? What should be the class structures you use to abstract it ?
But now skip ahead a year. Your project is stable, it’s working well – there are hardly any known critical bugs and your core features are all there. Your customer calls you to ask a new feature. Adding it is so simple, just add a table to hold the requisite new data, create a class to manage it, and then code the feature into your frontend. Much less work than when you did a feature of similiar complexity back in the start of the project. Exactly the purpose for which you took the time to design the code well…. only problem is… well it’s not hard enough. You spend about an hour being creative to work out how the modifications to the interface should look, the process-flow for the new functionality (from a user point of view) and all that is pretty creative. But it’s over in an hour, then you spend a much longer time implementing it. Sure it’s much less than it was at the beginning since all the hard work is already done – but it’s still long, and it’s extremely boring.
There, I said it, it’s boring to extend well written code. It just doesn’t have any real creative impact.
In the project I am using as an example for the post, my library contains about 30 classes for tables as well as all the code needed to handle the database-basics (connecting and issuing queries and such) once-off. So the classes basically consist of get and set methods (which is good practice) – thousands of them. And they are all, literally, almost identical. The typical set method has one line, and between any two, the only difference will be three words – and they will change identically per method (e.g. the name of the identifier being set).
The get methods are no different, except that the occasionally contain a typecast to get from the database-string to the real datatype.

It’s all very good for the project, but rather bad for the job-satisfaction.
All in all, I am not saying don’t write good code because you’ll get bored. Firstly because in a bigger organization you can usually pass most of the drudge on to the juniors (who need the practice) while focusing on the design part (which remains new and creative at all times), and secondly because if you take as long to add a feature to a mature project as you did when the project was new – you’ll end up with absolute time-management havoc and unhappy customers (just ask Microsoft), and worst of all, you’ll spend nearly all your time trying to fix bugs.
In the end, programming remains one of the most satisfying, fun and creative jobs you can have. Unfortunately it is, by it’s very nature, particularly attractive to people who love a challenge – especially as it remains challenging no matter how good you are at it – but sadly, this becomes less true for a certain project, the more mature that project becomes.

This is, ultimately, an unsolvable side-effect. Extreme programming, [tag]agile[/tag], or any other methodology intended to create better software, ipso facto reduces the challenge when working on established code (that is, in a very real sense, their purpose). It is just not something people usually say (probably for fear that newbie programmers will decide that writing good code is for chums).

Despite our frequent jokes, bad code is still ultimately a bad thing. We may say ‘it was hard to write, it should be hard to read’ – but in fact, we all know deep down, that if you do your job well, the real problem is that it actually isn’t that hard to write (for a programmer anyway).

So, with this not-entirely-serious rant complete, I declare the first silentcoder blog post of 2008 officially completed.