Dpkg and apt-get reading database is really slow [fixed]

August 21, 2009 by · Leave a Comment
Filed under: Linux, Ubuntu 

I’ve had problems many times with the “reading database” step in deb package based systems getting really slow. Today it took over 1,5 minute on a quad core machine with 4 gig ram, which is simply over the top for me.

Within 5 minutes of searching I found this:

http://antti-juhani.kaijanaho.fi/newblog/archives/521

So a total of 7 minutes later, it takes me less than 2 seconds to install small packages again. I should’ve found this earlier :-).

Migrating windows to virtualbox

August 16, 2009 by · Leave a Comment
Filed under: Linux, Ubuntu, Windows 

I finally got rid of the last windows computer in our home. My laptop had a backup installation of Windows XP just in case I realized I had either forgotten something on that partition, or I realized I had some need I had forgotten. This partition has now been moved to virtualbox on my workstation via the http://www.virtualbox.org/wiki/Migrate_Windows how-to.

Also, my wifes laptop running Windows Vista stopped working (again), and she had finally had enough of the problems that Windows installation has caused so she asked me to remove Windows Vista and install Ubuntu 9.04. The harddrive was also copied over to the workstation and I tried the same how-to as above, but it didn’t work properly unfortunately, so I winded up just moving the harddrive inside my old Windows XP installation.

Once this is done, I’m planning to reduce the size of the harddrives. This is 220gig data at the moment, so it could be a good thing. I will try http://forums.virtualbox.org/viewtopic.php?p=572#p572 and see how it goes. Once that is done, I’m almost 100% free of all the problems we’ve had with Windows. The only windows I have left is the backups for emergencies.

Mednafen configuration for Logitech Precision

October 29, 2008 by · Leave a Comment
Filed under: Linux, Ubuntu 

As I’ve already stated partially, I got an HTPC at home running MythTV on ubuntu. One of the things I’ve wanted to do for a long time was to get some games running on it. Supertuxkart was simple and was installed in less than 3-4 minutes once I understood the basics of the MythGames plugin (typing with a on-screen keyboard and a remote control is slow).

Anyways, I did have some problems getting a NES emulator, or any emulator at all as a matter of fact, running on it, and I also had some problems getting input from the right devices to them properly. I finally decided on mednafen as it seemed the easiest to understand.

Let’s understand the structure. NES and other games are usually downloaded in some image file. Mednafen is installed as a binary. MythGames needs to know about the binary used to launch a NES image, and where the NES images are located. I downloaded mednafen using apt-get install mednafen. Secondly, MythGames needs to know where you will put the images, personally I put them in /var/games/nes/. This is entered into the mythtv configuration using the Setup -> Game Settings -> Game Players. Choose New Game Player and enter

Player name: mednafen (for example)
Type: Other
command: mednafen -nes.stretch 1 -fs 1 -vdriver 0 %s
Rom Path: /var/games/nes

Having a keyboard around when doing this is prefered, using the on-screen keyboard takes ages.

Once this is done, go to Setup -> Game Settings -> Scan for games. This will scan the /var/games/nes directory for all images and add them to the list. To start a game, go to Games. Then get into the “All Games” -> “mednafen” and you should find all the games from /var/games/nes there.

Click one, and the game should hopefully start. The first time mednafen is run, it creates a directory ~/.mednafen/ containing a basic configuration. The following is an example to get my Logitech Precision gamepad running with it:

nes.input.port1.gamepad.a joystick 42190af389429475 00000002
nes.input.port1.gamepad.rapid_a joystick 42190af389429475 00000003
nes.input.port1.gamepad.b joystick 42190af389429475 00000000
nes.input.port1.gamepad.rapid_b joystick 42190af389429475 00000001
nes.input.port1.gamepad.select joystick 42190af389429475 00000008
nes.input.port1.gamepad.start joystick 42190af389429475 00000009
nes.input.port1.gamepad.up joystick 42190af389429475 0000c001
nes.input.port1.gamepad.down joystick 42190af389429475 00008001
nes.input.port1.gamepad.left joystick 42190af389429475 0000c000
nes.input.port1.gamepad.right joystick 42190af389429475 00008000

nes.input.port2.gamepad.a joystick 42190af389429476 00000002
nes.input.port2.gamepad.rapid_a joystick 42190af389429476 00000003
nes.input.port2.gamepad.b joystick 42190af389429476 00000000
nes.input.port2.gamepad.rapid_b joystick 42190af389429476 00000001
nes.input.port2.gamepad.select joystick 42190af389429476 00000008
nes.input.port2.gamepad.start joystick 42190af389429476 00000009
nes.input.port2.gamepad.up joystick 42190af389429476 0000c001
nes.input.port2.gamepad.down joystick 42190af389429476 00008001
nes.input.port2.gamepad.left joystick 42190af389429476 0000c000
nes.input.port2.gamepad.right joystick 42190af389429476 00008000

command.exit joystick 42190af389429475 00000006&joystick 42190af389429475 00000007
command.exit joystick 42190af389429476 00000006&joystick 42190af389429476 00000007

Unfortunately, the above changes around a bit from device to device and atm i’m not even sure the i’d will survive from disconnect/connect of the gamepads.

The proper way of doing this is to:

1. Start a game.
2. Press Alt+Shift+1
3. Push the correct buttons asked for on screen to do specified command. (First time you push a button adds it to the command, second time you push the same button marks it “final” for the command sequence. Peculiar, I know. So, to make the game use button 2 and 3 in conjunction to be button A, you’d first press button 2 once, then button 3 twice.
4. hit esc on the keyboard to leave mednafen. The config should now be saved.

I haven’t found a way to create the “command.exit” commands yet. I’ll have to work some more on that.

Ubuntu 8.04 lirc_imon VFD’s

September 10, 2008 by · Leave a Comment
Filed under: Hardware, Linux, Ubuntu 

I got a silverstone LC20 chassi with a built in iMON vacuum fluorescent display (VFD) and IR remote control. I recently upgraded to Ubuntu 8.04 from 7.10 — yes I know, I am a bit late, but generally you don’t have to deal with kinks like this one when that happens.

Ubuntu 7.10 -> 8.04 changed the behaviour of the lirc_imon module pretty little, yet radically. The old default was to treat all iMON driven screens as VFD’s, but it now defaults to treat all iMON modules as LCD modules instead.

This results in tons of errors being pumped out (10’s-100’s per second), like this one:

Sep 9 21:35:00 fs1 kernel: [ 71.481262] /var/lib/dkms/lirc/0.8.3~pre1/build/drivers/lirc_imon/lirc_imon.c: lcd_write: invalid payload size: 32 (expecting 8)

Also, the VFD will not work. To make a long story short, to fix it, you need to tell the kernel module that the VFD is in fact a VFD and not a LCD, by giving the kernel module the option islcd=0. For example, in /etc/modprobe.d/options:

options lirc_imon islcd=0

I hope this helps anyone out there. I will soon try to have something together on getting the iMON PAD working properly. The basics was simple to get working, but the “mousepad” has been a general pain to get up and running properly.

Qt presentation tomorrow

September 8, 2008 by · Leave a Comment
Filed under: Development, Ubuntu 

So, I’m holding a brief Qt presentation on a demo i made a few weeks back. It’s pretty, and got a ton of stylesheets on it. Going down tomorrow at work. Hopefully people will be a little bit interested at least. It’s not that often I dare get my ass up there behind a podium, or speak up at all for that matter.

To be honest, I don’t know why really, I just hate being in front of people talking and possibly saying anything that might be wrong. Of course, there’s a reason why I’m doing the presentation, and not someone else. I’m the only one with any substantial experience at all of this subject, so why not basically.

Also, I’m feeling horribly stressed as of late. I started on a project last week, and it’s getting to me. Need to take a minute, sit down, and calm down.

Continuous integration and buildserver

So, I finally got around to trying out continuous integration and got a buildserver at home. Ok, not much use on any 1-man projects, but should be good enough for some testing at least. I’m currently using cruisecontrol for it, and so far so good. I’ve got a few points I sincerely react against, but I’ll get back to that a bit later.

For those not knowing what continuous integration is, I suggest reading the above link. Basically, when you run a project, you always run into some “final” integration problems. People have coded each on their own side, and you wind up having to “integrating” the code so that it all works as supposed. In the one extreme, you have everyone coding on their own tree from start to end, and then you finally have an integration session. In this shitty situation, you have no clue how long it will take. On the other extreme, you have “perfect” continuous integration, where every single line of code is tested and checked that it doesnt screw things up.

A buildserver such as cruisecontrol is an excellent tool for doing “good” continuous integration. What it does is as follows, it connects to your central code repository, checks for any changes. If there was changes, it downloads them, and then rebuilds the project(s). If you have done it properly, you also have a ton of tests that you can run on the project. This is then reported or output in several different ways. Did it fail, did it succeed, and so forth.

I might be able to convince my new project manager to use a cruisecontrol server for the project I am working on at the moment, and he sounds like he likes the idea. We just need to consider everything for this project, and I need to figure out just how it works and how to configure it etc etc etc =) . Either way, I think it will be interesting to find out more about this type of development, and to see if it actually changes the development in any large way.

Oh, yes, I currently got two things I need to figure out with cruisecontrol. If I got it right, it doesn’t support GNU Make. Not supporting make seems… well, to be honest, totally stupid. It’s been one of the biggest make systems for 20 years or more, so there’s bound to be like 500000+ projects out there already running Make. I know it’s an old system, but it works, and it’s there already.

The second thing, I’m not totally certain of this, but subversion support seems to be abysmal. I need to look more at it however to find out the lay of the land or something.

« Previous Page