Archive for the 'Computer' Category

Published by Niels on 12 Mar 2006

Networking and sound on an old system

So we have this old system running at home. That is, this message is brought to you by a Dell Dimension XPS R450 that originally had 64MB RAM, a 450MHz Pentium II processor and a whopping 9GB hard-drive. Last year I have upgraded the system to a 1.3GHz processor using a Powerleap PL-iP3/T processor board, added some extra RAM (256MB), a second hard-drive of 40GB using a Promise Ultra ATA-100 TX2 so that the system could fully use its 100MHz bus potential, and last but not least a CD-RW drive instead of the 8x CD-ROM that came with it.

This system ran Gentoo Linux for a while, but I found that the continuous compile sessions became somewhat of a burden (this is a mild remark, the truth is a lot worse). So Ubuntu was installed and everything was fine. Except for the sound card that refused to work. The lspci command showed me that the sound card was of the cs46xx type. But when I did modprobe snd-cs46xx the module got nicely loaded, but the sound card did nothing. After some tinkering with several modules I found that the system worked using the snd-cs4236 module. All was fine and I put this module in the /etc/modules file. After a reboot (just to check) the network did not come up. Some research later revealed that one of the IRQ’s the sound card occupied was IRQ 10. Did I mention that my network card is a 3Com 3c509 hard-wired to use IRQ 10?

Everything works fine now that the following line is included in the file /etc/modprobe.d/alsa-base:

options snd-cs4236 port=0x530 mpu_port=0x330 irq=5 mpu_irq=3 dma1=1 dma2=0

This nicely forces the card to use IRQ’s 3 and 5. My daughter can now even play Putt-Putt games using Wine and her own mouse :).

If you want more information on upgrading your Dell Dimension XPS there is a lot of information to be found here.

Published by Niels on 09 Mar 2006

Check this out…

If you want to learn something.

Out of curiosity I started writing an application using PHP and MySQL. The syntax of PHP wasn’t a problem, it feels like a very dumbed down version of Perl, with which I am very familiar. And neither was MySQL. It is ‘just’ another RDBMS and a simple one at that. Nor was the design of the database tables a problem as I remembered my lessons and experiences on database normalization.

When I wanted to code the entire application I found out that I lacked experience in setting up a website using the n-tier model and the MVC (Model-View-Controller) pattern. After some searching Tony Marston provided me with a lot of good insights. He is very pragmatic, but don’t let that scare you off. The proof is in the pudding and a wonderful pudding he made and explains how he made it.

Published by Niels on 03 Mar 2006

Alas, poor sl, I knew him well

To update a site created by NanoBlogger you either have to:

  • Painfully copy the newly created entries by hand and move or remove all other files.
  • Use a protocol like rsync. But some of us are not fortunate enough to have a hosting company that offers this protocol (as a side note: that is about the only shortcoming I can think of regarding BHosted).
  • Brew your own update script that works quite well, but is still a little rough around the edges. In order the smooth things out you would have to spend considerable time which you don’t have.

Or you can read the NanoBlogger newsgroup where a question on site-synchronization was answered by me and then by someone else who had a better answer.

So suffice to say that I will be no longer using my home-brew sl, instead I will be using sitecopy. It works on the same principle as my own solution, only more mature and maintained by somebody else :). The observant reader will notice that sl no longer is in my category list. The entries and the program will stay however. So if needed they can still be found.

Sitecopy is very simple. All it needs are two things:

  1. An entry in a file called .sitecopyrc in your $HOME, where an entry has to be created per website. The permissions of the file have to be set to 600. Mine looks like this:
    site heirbaut.nl
        server server9.bhosted.nl
        protocol sftp
        rsh "ssh"
        rcp "sftp"
        username ***
        password ***
        local /home/niels/Projects/www/www.heirbaut.nl/
        remote /srv/nielsh/www/www.heirbaut.nl/
        state checksum
        checkmoved renames
    
  2. A working directory called .sitecopy in $HOME with the permissions set to 700.

Published by Niels on 03 Mar 2006

Just documenting

One of the reasons I keeps this weblog is to have a central storage of my cumulative knowledge. That is, instead of writing all kinds of little tidbits in a notebook, I put them here. This has the benefit that wherever there is have web-access the information can be found and perhaps someone else that is looking for the information is happy to find it here.

OpenOffice Writer was given me a minor problem: it set the page size for all new documents to the Letter format. It is not difficult to change, but quite annoying. After some investigation I found that the best (only?) method was to:

  1. Open OpenOffice Writer.
  2. Open the Stylist by pressing F11.
  3. Go to the list with page styles.
  4. Right-click ‘Default‘ and select ‘Modify‘.
  5. In the Page-tab choose the format you want (A4 in my case) and click ‘OK‘.
  6. Go to ‘File -> Templates -> Save‘ to save the current template. Choose a new name.
  7. Go to ‘File -> Templates -> Organize‘ and right-click the save template (probably under ‘My Templates‘) and select ‘Set As Default Template‘.
  8. Restart OO Writer and check if the page size is indeed the correct one.

Published by Niels on 25 Jan 2006

ViM, ViM…

Editing entries in NanoBlogger appeared a bit cumbersome to me. But as with any open source solution this is primarily my own fault. Anything can be customized…

I added a ‘modeline’ to my templates/entry.metadata to override my .vimrc settings and also changed the editor setting in my blog.conf.

templates/entry.metadata:

TITLE: $NB_EntryTitle
AUTHOR: $NB_EntryAuthor
DATE: $NB_EntryDate
DESC: $NB_EntryDescription
FORMAT: $NB_EntryFormat
$METADATA_MARKER
BODY:
$NB_EntryBody
$METADATA_CLOSETAG
vim:set sw=4 ts=4 fo=cqt noet:

blog.conf:

EDITOR="gvim -f"

Now editing is a lot more bearable. The only problem now is that :!aspell -c % from gViM is not working properly anymore. Everything stays in in the bottom command line. Ah well, just another item for my TODO list.

Update: Wed Jan 25 21:41:50 CET 2006
Forget about the ‘modeline’. It screws the title of the entries up by adding $NB_EntryDate (literally) to the entry’s timestamp. This will take more time debugging than I have tonight. <schwarzenegger_voice>I’ll be back</schwarzenegger_voice> (on this one).

Published by Niels on 15 Jan 2006

USB Data key problem

Diona just came to me with the message that she couldn’t write to, or remove files from, her SanDisk USB memory stick on the laptop. So I plugged the stick into the PC I am sitting at right now and behold: the same problem. For a moment I was afraid that the memory stick went to memory stick heaven. But after some searching on the internet I found that re-formatting the bugger sometimes helps.

Since the data from the stick could still be read a backup was made, the stick was unmounted and the following command was given to reformat:

sudo mkfs.vfat /dev/sda1

This wiped the entire contents of the stick, but some short tests proved that it was working again.

Published by Niels on 14 Jan 2006

Why not…

Use Bourne Shell/BASH/Korn Shell/etc. as your CGI language? To me it would be the perfect fit with NanoBlogger to do my server side scripting. A short (but crude) example:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/bash
 
echo "Content-type: text/html"
echo ""
 
cat << EOF
<html>
<head><title>Your environment variables</title></head>
<body>
EOF
 
env
 
cat << EOF
 
</body>
</html>
EOF
exit 0

Put this in in a file called test.cgi and put that file somewhere in a directory where your web page is hosted. Make sure that the following is set on test.sh:


chmod 755 yourdir
chmod 755 yourdir/test.cgi

Now point your browser to http://www.yourdomain.com/<yourdir>/test.cgi and behold, a nice overview of the environment variables your provider provides for you!

I think this is the perfect way to make a NanoBlogger powered site more interactive. Here are some nice examples of the things that can be done using Shell CGI scripting.

Although a comments addition for NanoBlogger can be found here I think I could give it a shot to implement the same functionality using Shell scripting. Not that I am opposed to using PHP and MySQL, but using Shell scripts seems a bit more pure to me in combination with NanoBlogger.

If there are any disadvantages and reasons why Shell scripting should not be used for this I would be glad to hear about it.

Update:
I renamed test.sh to test.cgi as my browser suggested to download the script rather then being executed on the server. And quotes have been put around “Content-type: text/html”. It is probably not necessary, but I like consistency.

Published by Niels on 01 Jan 2006

IE6 on Ubuntu Linux

First of all: A Happy New year!

Diona uses the Linux setup we have here at home. Previously all machines were running Gentoo but a couple of months ago the switch was made to Ubuntu as the constant compiling and tweaking took too much of our time. And we have a more purposeful use for our computers than constant downloading and compiling.

Back to installing Internet Explorer 6 on Ubuntu:

First make sure that the following packages are installed:

  • wine
  • xdialog
  • alien

If not, install them using the following command on the command line:

sudo apt-get install wine alien xdialog

Next, download winetools. Grab the .rpm. On the command line go to the directory where the winetools were downloaded and issue the following command:

sudo alien -i winetools-0.9-3jo.i386.rpm

Replace the name of the RPM if necessary of course :).

Winetools needs Xdialog, but on Ubuntu that is not installed in the place where it is expected. So go to the Winetools directory and make a symbolic link to Xdialog:

cd /usr/local/winetools

sudo ln -s /usr/bin/Xdialog

Go back to your home directory (not really necessary, I just like to be there when possibly goofing things up) and start the Winetools using the following command: wt. Everything after that should be straightforward. You get the possibility to install IE6 from here. Do not forget to install all the MS fonts.

Winetools is so nice to create Wine launcher scripts in ~/bin, so IE can be started using the following command:

~/bin/ie6

But you might find it more convenient to make an entry in the main menu of your desktop environment.

Published by Niels on 10 Dec 2005

Making a usable Picture Gallery

Generating picture galleries proved to have a steeper learning curve than anticipated. The originals were kept and somehow the thumbnails that the gallery plugin created were 60+ KB. After some searching I found out that ImageMagick, which is used to create the thumbnails, retains the EXIF put in the photo by the camera. Since this can easily be 60 KB it means that the size of the thumbnails is always larger than 60 KB.

To fix things the originals were reduced to 60% of their original size and the EXIF data was stripped from the pictures. I used the following command:

mogrify -thumbnail 60% *.JPG

This already greatly reduced the size of the ‘originals’ without losing too much quality when viewed on a website. Since this has also stripped the EXIF data the thumbnails are now a mere 8 KB in size. This keeps the bandwidth low and makes the download of the gallery page faster.

This site has very nice examples and explanations on using the ImageMagick tools to create thumbnails.

Published by Niels on 03 Dec 2005

Learning all the time

As mentioned in an earlier post I was looking for a mechanism to get remote information and take actions based on that information without having to give my password multiple times. Recently I found at that apparently I am a SSH newbie, because it is very easy to setup SSH in such a way that you never have to provide a password ever again when working from a machine that is known to the remote system.

On your local system do the following:

mkdir -p $HOME/.ssh

chmod 0700 $HOME/.ssh

ssh-keygen -t dsa -f $HOME/.ssh/id_dsa -P ''

Now copy the resulting file $HOME/.ssh/id_dsa.pub to the remote server you want password-less access to and log in to the remote system (using SSH of course). On the remote system take the following actions:

mkdir -p $HOME/.ssh

chmod 0700 $HOME/.ssh

cat id_dsa.pub >> $HOME/.ssh/authorized_keys2

chmod 0600 $HOME/.ssh/authorized_keys2

rm -f id_dsa.pub

If you want access from multiple machines to the remote system just repeat the ssh-keygen, cat and rm commands from the system you want use to connect to the remote server.

« Prev