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.
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 Tools → Add-ons → Plugins. 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
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.
At http://techcrunch.com/2010/10/25/firesheep/, two Firefox plugins are recommended. They force your Firefox to use the https protocol wherever possible.
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.
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 ‘
xac‘, etc., where ‘
x‘ is the prefix and ‘
ac‘, etc. are the suffixes.
Use the command
cat to put them together:
cat xaa xab xac >out.avi
cat x* >out.avi
split --bytes=50000000 -d film.avi pre-
Now the pieces will be named as
pre-02, etc. The switch
-d means to use numeric suffixes.
split --bytes=50m -d film.avi pre-
Now the size of the output pieces is really 50 MB, i.e.
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-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:
#!/bin/bash # videbcontrol.sh , from http:// ubuntuforums .org/showthread.php?t=636724 if [[ -z "$1" ]]; then echo "Syntax: $0 debfile" exit 1 fi DEBFILE="$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 fi 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 fi CONTROL="$TMPDIR"/DEBIAN/control MOD=`stat -c "%y" "$CONTROL"` vi "$CONTROL" if [[ "$MOD" == `stat -c "%y" "$CONTROL"` ]]; then echo Not modfied. else echo Building new deb... dpkg -b "$TMPDIR" "$OUTPUT" fi rm -r "$TMPDIR"
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 http://www.getfavicon.org/. 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.
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,
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.