Nightly icon cache update for Gnome

Sometimes it happened on my Ubuntu system, that a newly added application didn't had its icon.
This can happen due to an not updated icon cache of GTK.
This can be fixed with the command
gtk-update-icon-cache
, which rebuilds the GTK+ icon cache.

So why don't do this automatically in the background on a daily basis (during the night)?

Install instructions

Just execute the following commands, which will put a script into /etc/cron.daily so that the cache is fixed and the missing icon appears overnight.
sudo -i
echo '#!/bin/sh
#
# 

for theme in $(find /usr/share/icons -mindepth 1 -maxdepth 1 -type d)
do 
    if [ -f "$theme/index.theme" ]
    then gtk-update-icon-cache -f -q "$theme"
    fi
done

exit 0' > /etc/cron.daily/update-icon-cache
chmod a+x /etc/cron.daily/update-icon-cache

Open URL in Firefox with middle mouse button

Often I copy an URL somewhere and want to open it in a new tab in Firefox.
Normal steps:
  • Open a new tab with Ctrl-T
  • Click into the URL address bar
  • Paste the URI and press Enter
Wouldn't it be nice to make all these steps in one, f.ex. by clicking with the middle mouse button on the current tab.

Firefox has this possibility, but you can't enable it from the normal preference dialog.
Instead you have to alter the configuration parameters directly.

Install instructions

  • Navigate to about:config
  • Put middlemouse.contentLoadURL in the filter bar
  • Press the right mouse button over the option and select toggle, so it's value is true.
Now lets test it:
  • select and copy this text: www.ubuntu.com 
  • press the middle mouse button in the window where you're reading this post
  • A new browser tab should appear with the Ubuntu site.

Flash Video in Linux and Webcam

You also experienced problems when trying to use a webcam from a flash application in your Firefox browser?
It claimed about not being able to detect the cam, whereas VLC finds and uses it perfectly.

Well, there's a known compatibility limitation between the underlying video-for-linux (v4l) layer.
Modern Linux systems use version 2, whereas the Flash applets seem to be comfortable only with version 1.

There's a possibility to force Firefox to use the version 1 of v4l, by launching it this way:
LD_PRELOAD=/usr/lib/libv4l/v4l2convert.so firefox &

Now the Flash applet should be able to detect and use your webcam.

More details can be found in this article I found.

Disk Defragmentation

Defragmenting your disks file-systems can be important for several reasons:
  • Lots of fragments are slowing down your systems performance (especially true for any Windows systems).
  • You may want to shrink a partition and therefore need to move all files to get all available space at the end of the partition.
I needed to shrink my NTFS partition, because I want to give more space to my Ubuntu one, but even if it claimed to have 26 GB free, I could only shrink about 300 MB.
Why?
Because NTFS uses a MFT table for allocating, which could be anywhere and unfortunately, it will be in most cases at the end of the partition.
And almost any defragmentation program is able to move it.

Since I found Perfect Disk. It is not free-ware, but its one month evaluation was enough to finally claim all free space to the end of the partition and get it shrunk with GParted.

Until then, I tested several programs (because Windows XP internal tool isn't the optimum), and I'll list them here.

Perfect Disk


Perfect Disk is simply perfect. It makes it job as one thinks it should. Can defrag your MFT, pagefile, hyberfile in offline mode, its defragmentation algorithms seem to be very clever, can choose each algorithm automatically adapted to the file-systems state, scheduled tasks, during screensaver, and the interface is clean and nice.

O&O Defrag


O&O Defrag is similar to Perfect Disk, but finally wasn't able to move the MFT, but has more algorithms than Perfect Disk. It seems to be more slower during defragmentation than the other one. Isn't free-ware too.

MyDefrag


MyDefrag is freeware, and has a very different concept to other tools. Internally, it uses scripts that define the algorithm, and even if there are several ones included already, you could write your own ones. Its interface is ugly, but includes screensaver mode. Can handle floppies, USB disks, memory sticks, and anything else that looks like a disk to Windows.

Auslogic Disk Defrag


Auslogic tools is a simple disk defrag tool, with a nice interface. Does its job better than Windows included one and is free-ware too. Can defrag a single file or folder and includes a scheduler.

Defraggler


Use Defraggler to defrag your entire hard drive, or individual files - unique in the industry. This compact and portable Windows application supports NTFS and FAT32 file systems. Lets you specify one or more files, folders, or the whole drive to defragment. Very simple and supports quick defrag.

WinContig


WinContig is an easy-to-use stand-alone defragmentation tool that doesn't create any installation directories or Registry entries on your computer. Its purpose is to quick defrag files without the need to defrag the whole disk. In addition, WinContig allows you to group files into profiles, and also it accepts a number of optional command-line switches that you can use to control how the program operates.

SysInternal Tools


SysInternals also has some tools for defragmentation working directly on single files which can help out in some cases.

Contig


Contig is a single-file defragmenter that attempts to make files contiguous on disk. Its perfect for quickly optimizing files that are continuously becoming fragmented, or that you want to ensure are in as few fragments as possible.

PageDefrag


PageDefrag uses advanced techniques to provide you what commercial defragmenters cannot: the ability for you to see how fragmented your paging files and Registry hives are, and to defragment them. In addition, it defragments event log files and Windows 2000/XP hibernation files (where system memory is saved when you hibernate a laptop).