Friday, June 29, 2007

VM Player

Download kernel-headers and kernel-sources packages first.

Then get VM Player from the interweb, using the rpm installer.

Run the vmware-config.pl script and tell it where the relevant bits and pieces are.

I struggled to find the kernel-source files. Its important to have a good look around for these and trying to update the kernel headers and sources match - i.e. have the same version number.

In SuSE I eventually found them here:

/usr/src/linux-2.6.18.8-0.1-obj/x86_64/default/include

or here:
/usr/src/linux-2.6.18.8-0.3-obj/x86_64/default/include

run: uname -r first to see what version of the kernel you are running.

Next you have to download the vmx file. This contains the OS and the configuration for VM Player to use it. Look around on the VMWare website or here:
http://www.tuxdistro.com
EG Kubuntu
http://www.tuxdistro.com/torrents-details.php?id=283

Be aware - most seem to be torrents - so perhaps a work policy may be a problem.

After downloading the file unrar it and then start the VM Player. Give it the files it needs - that were extracted from the torrent. And then viola - your new VM Player is working with ubuntu.

Monday, June 18, 2007

Place for Tomcat Notes

Some general notes on getting tomcat working. After installing the relevant packages from yast - a few commands needed to be run - and then I had to find out how to test the installation. Its all pretty well documented - I just thought I'd save a few notes here.

Check status of your server:
/etc/init.d/apache2 status


Check if tomcat is running - and the output:
ps -def | grep tomcat
tomcat 31388 1 0 11:53 pts/0 00:00:05 /usr/lib64/jvm/java/bin/java -Djava.endorsed.dirs= -classpath /usr/lib64/jvm/java/lib/tools.jar:/usr/share/tomcat5/bin/bootstrap.jar:/usr/share/tomcat5/bin/commons-logging-api.jar:/usr/share/java/mx4j/mx4j-actions-1.1.1.jar:/usr/share/java/mx4j/mx4j-jmx-1.1.1.jar:/usr/share/java/mx4j/mx4j-tools-1.1.1.jar:/usr/share/java/mx4j/mx4j-jmx.jar -Dcatalina.base=/srv/www/tomcat5/base/ -Dcatalina.home=/usr/share/tomcat5 -Djava.io.tmpdir=/srv/www/tomcat5/base//temp org.apache.catalina.startup.Bootstrap start
root 31806 29163 0 12:13 pts/0 00:00:00 grep tomcat



Add tomcat module to the apache (or something):
a2enmod jk 


More to follow here.

Thursday, June 14, 2007

eps2latex

quick and dirty bash script to create a latex document from a bunch of eps files.

#!/bin/bash

echo "\documentclass{article}"
echo "\usepackage{graphicx}"
echo "\begin{document}"

for file in $1/*.eps
do
echo "\begin{center}"
echo "\begin{minipage}{\textwidth}"
echo "\includegraphics{$file}"
echo "\end{minipage}"
echo "\end{center}"
echo "{\footnotesize $file}"
done

echo "\end{document}"

Wednesday, June 13, 2007

Run preview easily from bash on Mac OS X

add the following to your .profile:

preview(){
open -a /Applications/Preview.app/ "$1"
}

useful vim commands

Timetravel



Vim 7 lets you move forward and backward a duration in time. For example:

:earlier 1h
:later 5m
:earlier 10s


What's also neat is that vim stores undo branches. So say you undo something, make some edits, then decide that you didn't really want to undo you can still go back to the previous state. Simply type:

:undolist


to view the various buffers and:

:undo <number>


to go to the buffer

Spell checking



To enable spell checking type:


:set spell


All your spelling errors will be highlighted. From command mode use:

]s - next spelling error
[s - previous spelling error
z= - correct spelling from close matches


Record a macro



press q followed by one of 0 to 9 or a to z in command mode. do stuff... press q in command mode. Then press @ followed by 0-9 a-z (as you entered before) to play the macro. Press @@ to repeat the last macro.

Simple search and replace with a number in it



Search for all argv[NUMBER] and replace with plotprefix. Where NUMBER is um a number:

%s/argv\[\d\]/plotprefix/g


Replace something with somethingelse over the next 4 lines from the current cursor position:

.,+4s/something/somethingelse/g


Replace whatever.cpp with ../whatever.cpp where whatever is any character string:

%s/\<\a*.cpp\>/..\/&/g


Delete every other line, no idea how it works, in command mode:

%norm jdd



See: http://www.geocities.com/volontir for a load of useful vim regular expression stuff.

Tuesday, June 12, 2007

Remote browsing

Say your trying to access regionalised content or may be a journal a different university has access to and you happen to have a box on that remote network, how do you access websites as if you were coming from there network?

There are a few solutions:

1. Just run firefox over an X session. ssh will setup your environment variables making this straight forward. Simply do: ssh my.computer.com -X -l username (unfortunately this is usually very slow)

2. Run lynx! Because text based browsing rocks! (no, no it actually sucks ass)

3. Run a proxy on the remote workstation on a local port (such as squid). Then use ssh port forwarding to redirect the proxy to a local port for example: ssh -L 3128:localhost:3128 my.computer.com -lusername. Then reconfigure your webrowser to use a proxy at localhost port 3128. All done!

4. Use ssh remote port port forwarding to forward port 80 on a specific host to a port on your local computer. Unfortunately this means you can only browse that host (basically this sucks)

Right now those are all the solutions I know of. It would be great if you could forward all outgoing connections from a given application using ssh port forwarding, but as far as I can see... you can't. Another nice solution would be to use a simple user mode proxy server, if anyone konws of one leave a comment.

Monday, June 11, 2007

Wii 50Hz reset

My TV Card only supports 50Hz and I set my Wii to 60Hz. To reset the Wii to 50Hz press reset on the Wii while pressing down on the directional pad on the wiimote.