Archive for the ‘General’ Category

How many recent files does an application really need?

Tuesday, April 1st, 2008

A few days ago, Claudio wrote about the time Eog spent saving the filename of a recenlty used image into ~/.recently-used.xbel. The reason: ~/.recently-used.xbel was too big. If I remember correctly, the FileChooser used to have a similar issue in the past.

Going down from 5.8 MiB to 1.8 MiB, through deleting all those items whose files does not exists, seems to be a good improvement. I wanted to go a bit further and I wondered ¿How many recent files does an application really need? (sorry, not that further :-) I do not think more than 10 per application, but let me know if I am wrong.

I wrote my own version of Claudio’s program with that matter in mind. And my ~/.recently-used.xbel file went down from 1.2 MiB to 54 KiB. Before to go to the script, let me show you the numbers I got in a computer with less than two month of non intensive use:

gpoo@pendragon:~$ python clean-recently-used.py -v
Summary:
     1 Reproductor de películas Totem
     1 Glade
     4 GNU Image Manipulation Program
     4 Navegador web
     9 Visor de documentos Evince
     9 File Roller
    14 Web Browser
    15 Gnumeric Spreadsheet
    26 gedit
    34 Administrador de archivos
    36 Evince Document Viewer
    52 Totem Movie Player
   292 File Manager
  1151 Eye of GNOME Image Viewer

Whenever I run Eog, it always shows me only the last 5 files I opened before. Why does it need 1146 extra items stored?

Nevermind. The script I wrote is simple. It deletes those files that does not exists (the same strategy used by Claudio’s program), but it also deletes those files that are not so recently used, and I got the following numbers:

gpoo@pendragon:~$ python clean-recently-used.py -v
Summary:
     1 Glade
     3 GNU Image Manipulation Program
     4 Navegador web
     8 File Roller
     9 Visor de documentos Evince
    10 Totem Movie Player
    10 Eye of GNOME Image Viewer
    10 Web Browser
    10 Gnumeric Spreadsheet
    12 Evince Document Viewer
    13 Administrador de archivos
    14 gedit
    41 File Manager

Now you can put the script to be executed when you start your session or you can program it as a cron task.

If you are only interested in getting a summary, you can run the script just using the option -v.

How much space are eating your thumbnails?

Wednesday, August 30th, 2006

Thumbnails are created by applications and thanks to a proposed draft are shared among desktops. But, it doesnot mean that every thumbnail stored in your home directory is useful for the purpose they were created. Some of them points to a file that doesnot exists anymore, some of them are broken images, and some of them were created by applications that doesnot respect the proposed draft.

Basically there are two size of thumbnails: normal (128×128 pixels) and large (256×256 pixels). Each thumbnail must contains at least two pairs of key/value, one of them is the URI of the original file and the another one is the last time the file was modified.

To get the file name of a thumbnail a MD5 sum must be applied to its URI. If you move the file to a new location, then the name of the thumbnail must be updated (also its metadata).

When you delete a file through Nautilus, this file is moved to the Trash folder. Furthermore, its thumbnail must be updated. Nautilus does it right, which is good. But, when you expunge the Trash, only the original file is deleted, not the thumbnail; which is bad, but easy to fix.

On the other hand, when you rename a folder, the next time the folder will be visited (in this case under a new name), the thumbnails will be regenerated, because for each URI there is no a thumbnails associated. Now, you have two thumbnails stored for the same file, but only one is valid. If you repeat this step often, your .thumbnails filder will get polluted of useless thumbnails.

Instead of renaming the folder, you can create a new folder, then move the group of files there, and finally, delete the old one. In this case Nautilus will not regenerate the thumbnails, it will update the thumbnails correctly. At least in the first hiearchy (I have not test it deeply).

The worst case happens when the files are moved or deleted by a non free desktop compliant (or kind of compliant) application, let’s say the shell. The thumbnails associated to those files will not be updated or deleted. (inotify to rescue?).

The average for a normal thumbnail is 25Kb of space while for a large one is 75Kb. If you maintain a lot of pictures in a long period of time (with all the file management involved), probably you have enough space wasted by useless thumbnails.

At least, I had. And I have the feeling that some other people, too. A time to live for thumbnails was requested, as is filed in bugzilla #150483.

Instead of delete my old thumbnails, I prefer to delete only the useless ones (in the sense of my first paragraph). So, I wrote a little script in Python (shorter than my comment) that estimate how much space I am wasting because of useless thumbnails.

Rupert in the scene

Saturday, December 17th, 2005

Rupert in Code Monkey at Work

After the success of “Code Monkey at Work”, where Rupert was the young hero of the movie, Rupert was invited to participate in a cameo of “Aardvark’d: 12 weeks with geeks”, a documentary film (idea of Joel Spolsky) of the whole process to build copilot (the simplest way to use VNC trhought a reflector; full of features with a simple user interface, and a better name).

Rupert in Aardvark'd
Rupert in the documentary
(Rupert also appears in the trailer)

I just received my copy on Saturday 10 and I watched it the same afternoon. Interesting, even if you agree or not of what Joel usually writes about software development.

Anyway, I thought Fog Creek was bigger than I realized it is; and I was not expecting their concerns about risks in their first days (probably the same happened for Ximian, Fluendo and other related companies).

A keynote of Joel Spolsky could be very interesting indeed. Or have a short documentary of our community (we have the chance at GUADEC, Boston Summit, and so on).

New place for GNOME’s writings

Sunday, June 19th, 2005

As far as I have my own space to store my writings I decided to use this space to write some of my GNOME’s related notes.

Also, my main blog it is written in Spanish and I will follow writing there in my native language, because I know it is read by many people who only speaks in Spanish.