Archive for Programming

01.23.07

GP2X portable game console

Posted in Linux at 12:59 am by are

My new toy, the GP2X! A handheld game console running Linux.

This beauty runs every emulator you can think of, C64, Amiga, Dosbox, Mame, Snes, Sega, etc etc. This means tons of games… and fun fun fun.

It looks like this:

Runs on two AA batterys and has a SD-card slot. I’m using a 4GB card now, lots of space.

Some games I have tried, and is working great:
Doom, Quake, Wolfenstein 3D, Keen 1-2-3, Monkey Island (+other scummvm games), BubbleBubble, Duke Nukem 3D, Sonic the Hedgehog, Mario Bros, Outrun 2, Arkanoid 2, Street Fighter … well, you get the picture.

It can also play movies and mp3… and really anything as long as you can compile the linux program for ARM920 cpu.

http://wiki.gp2x.org/wiki/Main_Page

powered by performancing firefox


01.16.07

Getting Filmtrailers from FilmWeb into FreeVo

Posted in Freevo at 12:18 am by are

FilmWeb is a Norwegian movie site. They have a lot of movie trailers there, along with the premiere date here in Norway.
I have created a php-script that crawls the FilmWeb site and creates FXD-files with url’s, summary and picture. In FreeVo you can then browse all the new trailers and watch then streamed from Web.

Set this script up in your crontab to download every night. (fxd files will be created in the current directory)

trailers2fxd.php.gz

12.04.06

Xgl and the AltGr key

Posted in KDE, Linux at 10:10 pm by are

After installing Ubuntu Edgy and tried Xgl I suddenly noticed that the AltGr button did not work. So writing $ and any of the {[]} was impossible. (Norwegian keyboard setup).

The solution is simple:

Create the file ~/.Xmodmap

keycode 22 = BackSpace
keycode 113 = Mode_switch

Make sure it loads when loading Xgl

07.08.06

Quick-Kill Project Management

Posted in Programming at 1:46 am by are

Interesting article about project management of impossible projects:

Dr. Dobb’s | Quick-Kill Project Management | June 30, 2006
How to do smart software development even when facing impossible schedules.


05.27.06

Don’t blindly trust SSH

Posted in Uncategorized, Linux at 6:49 pm by are

I saw an article at Slashdot quoting this article about how SSH is not that secure you might think.

Quote:

“In UNIX, all things are files. To send network traffic, UNIX writes the traffic to the network device file. In this case, the connection to Box A (and that private key used for authentication) is a socket file. This file will shuttle the authentication traffic between Box A and Box P. So what’s the risk? Maybe the hacker can’t get a copy of the private key through the socket file, but something better (from his/her view) can be done. If the hacker has root on Box D, he or she can point a private copy of the agent forwarding software to that socket file and thereby point the authentication process to the administrator’s credentials–the ones kept on the ’safe’ intranet. What are the chances that the administrator has configured access to all the DMZ servers he controls?”


04.23.06

Backup: A nice way to backup your files

Posted in Linux at 5:30 pm by are

After realising that I have a lot of files in my home directory, scripts and config files, that I have used a lot of time creating and tweaking…I needed a backup solution. It had to be easy, fast, incremental and take as little space as possible.
Incremental is important here, because sometimes you destroy config files, or want to go back to a known working version.

Using rsync

First I used a script found at http://rsync.samba.org/examples.html. It works great (with a small modification so ssh does not ask for a password). It creates incremental backups, 7 days. But it takes much space, because when a file is modified, a whole new file is stored in the incremental dirs. Also, restoring is easy with a simple cp or scp, but restoring a whole directory from 3 days ago is not that easy.
Also I don’t know if it went well or not, and you can’t run more than one backup a day (without modification to the script)

Ssh trick:
The ssh trick is to have the backupscript know the sshauth socket so it can use your already running ssh-agent socket (the backup script will be running in a crontab, and therefore does not have the SSH_AUTH_SOCK environment var set).
Do this (each time you start your ssh-agent):

echo "export SSH_AUTH_SOCK=$SSH_AUTH_SOCK" > /home/username/.sshauthsock

Then in the backup script do:

. /home/username/.sshauthsock

Using rdiff-backup

Then I came over rdiff-backup. It’s very similar to the rsync method, but for the incremental backup it creates diffs of the files, both text and binaries work. So it’s very space friendly. Also, restoring is easy. The last “complete” backup can be restored with a simple cp or scp, but the incrementals you must use rdiff-backup to get. (there is a manual way).

Statistics:
To get statistics, you can use rdiffWeb. It creates a nice interface where you can browse your backup and restore whole directories, single files and previous versions of those. Also it has a rss feed with status of the backups run. Very handy.

Setup:
Many distributions have rdiff-backup in their packages. Or install from source, it is a python script, and needs librsync library. (see webpage)
You probably don’t want it to backup tmp directory etc. I am using this exclude-file:

- ./vmware
- ./tmp
- ./.thumbnails
- **Cache/*
- **fake_windows/Games
- ./.local/share/Trash
- **hidden_*

I don’t want it to backup the big vmware image files, and not the tmp directory. And all files named “hidden_*” will also be skipped.
Now just run: rdiff-backup –exclude-globbing-filelist backup_excludes_rdiff /home/username hostname::/path/to/backupdir

PS: remember that rdiff-backup is not secure, all files are stored plain on the backup server. If you need security, use duplicity
Also you need rdiff-backup on both client and server side.

04.17.06

Debugging mythtv

Posted in Programming, Linux, HTPC, Projects at 2:51 am by are

I upgraded MythTV from 0.17_cvs to 0.19 yesterday. It went smoothly, just a simple “emerge mythtv” and a long wait.
Well…it seemed smooth, until my pc hung and I had to reboot.
After it got up again, everything seemed fine, but when a recording started MythTV segfaulted. Now the hunt begins.

In the syslog I saw:
go7007: unsupported ioctl -1069263306
wis-sony-tuner: tuning to frequency 175.2500 (VHF_H)

Aha, something wrong with the new mythtv tuning…maybe. I tried the Plextor TV402 gorecord program (comes with the driver). It worked like a charm. So nothing wrong with the hardware or tvcard drivers. I’ll have to find out what the ioctl number means.
So I dive into the MythTV sourcecode. Looking at different files. Browsing the linux headers, and finally i find out that the macro _IOC_NR(nr) will decode the number. I then patch the go7007 (tvcard driver) code so the syslog output now is:

go7007: unsupported ioctl -1069263306, type: 86, nr: 54
wis-sony-tuner: tuning to frequency 175.2500 (VHF_H)

So, type 86 nr 54…is not supported. Maybe that’s why it segfaults.
I grep the mythtv sourcecode, but find nothing. I also start mythbackend with –verbose all. It seems it crashes directly after a sql query. hmm.

I then compile mythtv again, now in debugging mode.
I then start “gdb mythbackend”

After it crashes I type “trace” and get a backtrace of the calls. And voila…I see where it crashes.
MythTV has four recording profiles. In the frontend you can change their names…but if you do, mythtv does not work anymore, because the profilenames is hardcoded in the source. So changeing it back to the default profilenames, everything works again.

The mythtv bugreport is here: http://svn.mythtv.org/trac/ticket/1691

(And this was the short story. Finding out how to use gdb, and browse the linux source etc etc takes time…lots of it…and compiling mythtv is not a fast task…god bless distcc)

04.07.06

Cvs merge Zend Studio integration

Posted in Programming, KDE at 5:49 pm by are

Animated gif of cvs commit with mergeZend Studio has a good cvs integration, and you can just right-click to commit and add etc files. But if your commit or update results in a conflict, or you want to merge your file into other revisions. Well, then you must use other tools… until now.
Using some scripts and KDE tools like kdialog and cervisia, we can change this.

Where I work we have at least three versions that all our patches has to go into. That is alot of merging, and it is boring. With the Zend Merge scripts I have created, I replace the cvs command used by ZDE with a custom shellscript. (Tools->Preferences->Source Control in ZDE)
The shellscript does the usual thing (commits, updates etc), but then checks if there were any conflicts. If it were, it asks if you want to resolve them using cervisia.
After that it asks about merging. One of the scripts fetches all the versions you can choose from (this must be customized). It then merges your file into all the selected revisions.

I have also added a context sensitive menu for KDE in the tarball, so you can merge multiple files at once.
(Take a look at the animation on the right for a demo of ZDE integration)

Download shellscripts here | Screenshot

04.06.06

My new HTPC

Posted in Linux, Freevo, HTPC at 1:17 pm by are

My caseThe hot thing these days is HTPC. A pc in your livingroom that looks like a stereo hifi component, and you use it for playing music and movies etc.
The advanced users also use it to record tv-programmes.

My HTPC is not the kind that looks like a stereo component. This is because they are usually very small, and usually very noicy.

I sold the old MSI Mega 865 because it was noicy and it was so small I could not extend it (and the remote and FM radio did not work in linux). Now I got the “Arctic cooling Silentium 2″. I cannot hear it, and my livingroom is once again quiet.

Inside my HTPC i got:
*Intel(R) Celeron(R) CPU 2.40GHz (it’s cheap)
*400Gb Hdd
*450Gb external Hdd (usb)
*Plextor ConvertX TV402 external USB tv-tuner (works in linux)
*Zalman CNPS7700-Cu cpu fan (the biggest fan I have ever seen)

I use mythtv to capture tv-shows with the convertX, and Freevo for playing music and movies etc. Mythtv is only running the mythtvbackend that does the recording, while I use mythweb to schedule recordings.

My old HTPC

Posted in Linux, Freevo, HTPC at 1:02 pm by are

My old HTPC was a MSI Mega 865 but the support for Linux was crap. I eventually got the linux kernel to control the fans.

For those of you who has the MSI Mega 865 and uses Linux, here is how I got the fans to work:
The 865 uses the Super I/O smbusSMSC47M15x chipset. This is not supported by Linux. (at least not when I had it on 2.6.9 kernel)
Replace the /usr/src/linux/drivers/i2c/chips/smsc47m1.c with this file.

Then do:
echo 8 > /sys/bus/i2c/devices/1-0800/fan1_div
echo 8 > /sys/bus/i2c/devices/1-0800/fan2_div
echo 180 > /sys/bus/i2c/devices/1-0800/fan2_pwm
echo 210 > /sys/bus/i2c/devices/1-0800/fan1_pwm

and the fans will go really slow.

Do “cat /proc/acpi/thermal_zone/THRM/temperature” to see the core temperature rise… ;-)

· « Previous entries