Use PC Speaker from Java

Getting the PC speaker to emit a annoying beep might seem to be a quite easy task. And it is provided that you are in a graphical environment such as X.org och MS Windows™. Then using this easy bit of code will do:

package beeptest;

import java.awt.Toolkit;

public class BeepTest {
        public static void main(String[] args) {
                try {
                        Toolkit.getDefaultToolkit().beep();
                } catch (Exception e) {
                        e.printStackTrace();
                }
        }
}

SVN by Example

The example setup


The following test repository was created and used in the following examples.

$ cd /tmp
$ svnadmin create `pwd`/testrepo
$ svn mkdir -m "Added trunk" file:///tmp/testrepo/trunk/
$ svn co file:///tmp/testrepo/trunk/ testwc

$ echo "Added file in revision 2" > testfile.txt
$ svn add testfile.txt
$ svn ci -m "Rev 2"
Sending        testfile.txt
Transmitting file data .
Committed revision 2.
$ echo "Added a new line in rev 3" >> testfile.txt
$ svn ci -m "Rev 3"
Sending        testfile.txt

Project Ideas

Below are some ideas on projects I would like to get started on (when time comes).

Open Nautilus 2.6 in browse mode

Stuck on a machine with Gnome 2.6 and want Nautilus to open in browser mode by default ?
Well just set the hidden always_browse property to true. In later versions of Gnome this property can be set using the Nautilus preferences.

gconftool-2 --type bool -s /apps/nautilus/preferences/always_use_browser true |

My Oracle Notes

Here are some quick memos about Oracle. They are mostly here to be a place where I can refresh my memory.

Start a Oracle databse instance

* Setup paths and SID
export ORACLE_HOME=/usr/oracle/Ora901
export PATH=$PATH:$ORACLE_HOME/bin
export ORACLE_SID=mysid

* Start TNS Listner
lsnrctl start

* Startup the instance

$ sqlplus "/ as sysdba"

SQL*Plus: Release 9.2.0.8.0 - Production on Mon Dec 3 11:51:25 2007

Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.

Connected to an idle instance.

SQL> startup

MS Windows Commandline Tips

As a *nix user I'm used to the "powers of command line". Despite the rumors of being a GUI only OS MS Windows(C) you can do useful things from the command line.

Systeminfo


The equivalent to *nix command such as uptime, vmstat, uname is one command systeminfo

C:\>systeminfo
systeminfo

Host Name:                 MACHINE1
OS Name:                   Microsoft Windows XP Professional
OS Version:                5.1.2600 Service Pack 2 Build 2600
OS Manufacturer:           Microsoft Corporation
OS Configuration:          Standalone Workstation

JUCpio

Project summary


!SVN

What is JUCpio ?

JUCpio stands for Java Util CPIO and is a set of classes (a API) for reading and writing cpio files.

It is designed to be similar to java.util.zip.

The primary reason I started this project was to learn more about the CPIO file format. The API is currently in a very early stage of development.

Features


Implemented


* Gives a interface to extract data from cpio files.

Installing Windows XP

While I was installing Windows XP as a VirtualBox guest operating system I got the following error message from the Windows XP installer "No valid system partitions were found. Setup is unable to continue."

The solution was to start the installer with the '/syspart:c:' argument.

Select Disk 0
Clean
Create Partition primary
Active
Assign Letter=C
Detail Disk
exit
format c: /fs:ntfs /x /q
winnt32.exe /syspart:c:

Install Photo Organizer

Here is a small script to automate installation of Photo Organizer.
{{Note|It is not complete yet ....}}

{{File|filename=install_po.sh|content=

#!/bin/sh
#
# Install Photo Organizer
#

# First install all dependecies.
#
apt-get install apache2 postgresql-8.1 php5 imagemagick graphicsmagick php-pear libwmf-bin dcraw exif gs-common

mkdir -p /srv/www/po/html
mkdir -p /srv/www/po/logs
mkdir -p /srv/www/po/photos
chown www-data:www-data /srv/www/po/photos

# Get and unpack po

Find base directory for a application

The problem


When executing a application it is not uncommon that you need to be in that applications base directory so it can find its resource files. This is especially true when it comes to Java based applications and games on the Linux platform.

Syndicate content