Archive for October, 2010

Installing the Java plugin for Firefox

October 28, 2010 Leave a comment


You have a Linux box (e.g. Ubuntu) and you want to run an applet in Firefox. It starts, but then it hangs, and you have no idea what the hack is going on.

My Case

I had Firefox 3.6.3 and I wanted to use OpenCms 7.5.1’s upload feature. The uploading is done via an applet that started but when I chose the file to upload and clicked OK, nothing happened. The CPU was on 100% and using the top command I noticed that a Java process is stuck. A bit later I figured out that it must be the Java plugin…


In Firefox, verify what Java plugin you have. Go to ToolsAdd-onsPlugins. Here I had the icedtea Java plugin. This is a crap, use the official Sun plugin instead.

Open Synaptic and remove this plugin. I also removed all openjdk packages.

Then install these:

sudo apt-get install sun-java6-jdk sun-java6-jre sun-java6-plugin sun-java6-fonts

Now let’s see the list of alternatives:

sudo update-java-alternatives -l

Here I got this output:

java-6-sun 63 /usr/lib/jvm/java-6-sun

Set the official one:

sudo update-java-alternatives -s java-6-sun

Now restart Firefox and check the Java plugin again. You should see Java(TM) Plug-in 1.6.0_22 (or something more up-to-date).


If you cannot install sun-java6-jre because it’s not in the repository, add Canonical Partners to your software sources.


Find more info here.

Categories: firefox Tags: , , , ,

Firesheep danger, protect yourself

October 28, 2010 2 comments

I just read about a funny Firefox add-on called Firesheep that can capture login information on free wifis. (Video in Hungarian here, text in English here.)

At, two Firefox plugins are recommended. They force your Firefox to use the https protocol wherever possible.

  1. HTTPS Everywhere
  2. Force-TLS

I installed both. HTTPS Everywhere contains a list of predefined sites but it’s difficult to add a new site. Force-TLS is the opposite. So the two nicely complement one another :)

Update (20101109): you can find some more info here.

Categories: firefox Tags: , , ,

Split a large file

October 27, 2010 Leave a comment


You have a large file and you want to split it up in several pieces of the same size.


Let’s say we want pieces of 50,000,000 bytes (50 MB approximately).

split --bytes=50000000 film.avi

By default, the output files are named as ‘xaa‘, ‘xab‘, ‘xac‘, etc., where ‘x‘ is the prefix and ‘aa‘, ‘ab‘, ‘ac‘, etc. are the suffixes.

Use the command cat to put them together:

cat xaa xab xac >out.avi

Or simply:

cat x* >out.avi


split --bytes=50000000 -d film.avi pre-

Now the pieces will be named as pre-01, pre-02, etc. The switch -d means to use numeric suffixes.

One more:

split --bytes=50m -d film.avi pre-

Now the size of the output pieces is really 50 MB, i.e. 52,428,800 bytes.

Categories: bash Tags: ,

Modify dependencies of a .deb file

October 27, 2010 4 comments


You have a .deb file that doesn’t install because of some dependency problem. You want to tweak the list of dependencies yourself.

Example: under Ubuntu 10.10 I wanted to install Boxee TV. I downloaded the .deb file but it didn’t install. It said "Dependency is not satisfiable: libdirectfb-1.0-0|libdirectfb-1.2-0", though I had libdirectfb-1.2-9 on the system. So the natural solution is to modify the dependency from libdirectfb-1.2-0 to libdirectfb-1.2-9. This problem and its solution was provided here.


Here I found a nice script that allows you to modify a .deb file. It extracts the .deb file, you modify the dependencies, then it repacks the file. Easy. The script is the following:


# , from http:// ubuntuforums .org/showthread.php?t=636724

if [[ -z "$1" ]]; then
  echo "Syntax: $0 debfile"
  exit 1

TMPDIR=`mktemp -d /tmp/deb.XXXXXXXXXX` || exit 1
OUTPUT=`basename "$DEBFILE" .deb`.modfied.deb

if [[ -e "$OUTPUT" ]]; then
  echo "$OUTPUT exists."
  rm -r "$TMPDIR"
  exit 1

dpkg-deb -x "$DEBFILE" "$TMPDIR"
dpkg-deb --control "$DEBFILE" "$TMPDIR"/DEBIAN

if [[ ! -e "$TMPDIR"/DEBIAN/control ]]; then
  echo DEBIAN/control not found.

  rm -r "$TMPDIR"
  exit 1


MOD=`stat -c "%y" "$CONTROL"`

if [[ "$MOD" == `stat -c "%y" "$CONTROL"` ]]; then
  echo Not modfied.
  echo Building new deb...
  dpkg -b "$TMPDIR" "$OUTPUT"

rm -r "$TMPDIR"


Categories: bash Tags: ,

Get favicon from a website

October 27, 2010 Leave a comment


There is a nice favicon associated to a website that you want to extract. How to do that?


Well, the easiest way is to visit Just type in the web address and let it do the job for you. At the end you save the image.


If you want to do this with a script, this post can give you some ideas.

Categories: firefox Tags: ,

Remove the newline character from a text file

October 19, 2010 Leave a comment


I had a text file that contained only one line. For some reason I wanted to remove the trailing newline character (‘\n‘). However, it’s not that easy :) Most text editors automatically add a newline after every line. This is a normal behaviour actually, every line should end with a newline character. But if you want to get rid of it, how to do that?


You can remove the trailing newline with a hex editor. In the Ubuntu repositories I found hex (from package ‘hex‘) and ghex2 (from package ‘ghex‘). The first one, hex, is very simple, it just prints out the contents of a file, similarly to cat. It is good to identify the newline character. To edit the file, you can use the latter, ghex2.

Update (20140601): another hex editor is called “hexedit“. To use it, install it from the package with the same name.


To test your favourite text editor, create a simple file that contains the word “test”, without quotes (i.e. 4 characters). Do not press ENTER at the end. Save it and check its size. If it’s larger than 4 bytes, then the newline character was added automatically. With the command hex you can verify it.

If you need a hex editor for Windows, try HxD. It’s a freeware hex editor and disk editor.

Categories: bash, windows Tags: , , , , , ,

Copy a project folder without the .svn subdirectories

October 18, 2010 Leave a comment
rsync  -r  --exclude=.svn  $SRC_DIR  $DEST_DIR

This tip is from here.

Categories: bash Tags: ,