Fix PDFs hack

I recently bought a new ebook reader (Wolder miBuk ALFA 7.0 Color) because my previous one was very bad at reading comics. It looked really great in the shop, but as soon as I copied my entired e-book collection to a memory card and inserted it on the reader, I found its 1st problem: it doesn’t have the option to display the books collection by file name, but it gets the PDF metadata and uses that. So, since lots of my books didn’t have correct metadata, it was very hard to find books in the library view.

But thanks to the help of Carlos García Campos (famous Evince/poppler hacker), I cooked up a patch for Poppler to add API to be able to set the metadata, and, right after that, wrote a very simple GTK program to allow me to “fix” my ebook collection.

The Poppler patch is still not ready to be pushed upstream (my fault, lack of time in the last couple of weeks, but will fix it soon), but posting this now just in case it is useful for someone.

Unofficial GNOME3 on Ubuntu PPA

A friend of mine was having problems with the GNOME3 packages in Ubuntu, and after some questioning, he told me he was using a PPA from this Launchpad team:

https://launchpad.net/ubuntugnome

The GNOME3 PPA for that team seems to be just a copy of the official GNOME3 PPA, but just in case, this is a public announcement to let people know that they shouldn’t use that PPA (unless they really want to, of course), but use the official one instead, which is at:

https://launchpad.net/~gnome3-team/+archive/gnome3

That is, the official team is the gnome3-team, so please make sure to check your sources.list if you really want to use the official one.

GNOME3 on Ubuntu

I already blogged about this some time ago but since some people keep asking, I’d thought about giving it more publicity.

So, in case you don’t know, next Ubuntu version won’t ship GNOME 3, but we have been working in the last few months on providing GNOME 3 packages for anyone interested in running GNOME 3 on Ubuntu. The packages are in the GNOME 3 PPA, and although it still doesn’t include everything GNOME 3ish, it includes the stuff that has changed the most, like the new control center, gnome-shell and other core desktop things and some applications. Thanks to Allan Day, here are some instructions on how to use a PPA.

It still misses lots of apps and some core desktop things, like gnome-session, but should be ready for daily usage (using it myself on my systems).

You can report any problem you find on the PPA via the GNOME 3 team mailing list or directly to me, as you like.

“GNOME 3” on Ubuntu

With the great work from Robert Ancell and Sebastien Bacher, who worked on packaging the new GLib/GTK3 stack, and with the recent packaging of a few GNOME 3 applications (eog, Nautilus, the new control center, …), you can start testing what will be GNOME 3 on Ubuntu (Natty) by using this PPA.

Please note that this is a work very much in progress, which means that, apart from the usual problems of running unstable software, it’s got the unstability of new packages added, so please USE WITH CARE. I would suggest to use a virtual machine for testing this, but please test it and report any problems you might find. It seems to be running ok for me (on a virtual machine), but please don’t risk your every day desktop 😀

Ubuntu One SyncDaemon API

Ubuntu One‘s SyncDaemon (the process that takes care of synchronizing your files between the cloud and the desktop) has a DBus interface for applications to control and get notifications from it about what it is doing. This interface was being used in the Nautilus plugin and other desktop tools contained in ubuntuone-client itself. Even though powerful and straightforward, we haven’t seen many applications using it, since usually 3rd party applications don’t want to be dealing with the low level DBus API themselves.

But this is now history, since I introduce you to libsyncdaemon, a GObject wrapper on top of the DBus API which makes it very easy to communicate with SyncDaemon, as well as improving a lot the performance compared to accessing the DBus API directly (thanks to its use of caches, to avoid DBus calls repeating when no needed) and containing high level functions that would allow applications to, for instance, publish a file on Ubuntu One with just one call:

SyncdaemonDaemon *daemon = syncdaemon_daemon_new ();
syncdaemon_daemon_publish_file (daemon, "/home/user/myphoto.jpg");

But before you run to another place after seeing this C code, note that it includes bindings for many languages (Python, JavaScript, etc) for free, thanks to gobject-introspection. So, the same code in Python, for instance, would be:

daemon = Syncdaemon.Daemon ()
daemon.publish_file ("/home/user/myphoto.jpg")

So now, the next step is to start adding support for sharing/publishing files in Ubuntu One to many desktop applications, like, for instance (ideas stolen from Stuart Langridge):

  • Publish screenshots directly from gnome-screenshot tool
  • Sharing photos from f-spot/shotwell/etc
  • etc…

This, along with the already existing desktop APIs (desktopcouch, couchdb-glib, libubuntuone), makes integration of 3rd party applications into Ubuntu One a very easy thing.

Facebook account disabled

Last night, I was writing a message to a friend’s wall on Facebook, about telescopes, and when submitting the message, I got a message saying that the content of my message had been reported to be abusive by some Facebook users ?? After that, I couldn’t log in back again, it just said my account was disabled.

So, if you rely on Facebook for contacting me, please don’t, send me mail, which is still enabled, and even allows all sorts of abusive content (you can write me about telescopes if you want, no ultra-paranoid filters there 😀 ).

I already wrote to the Facebook staff about the issue, but I’m not sure what they will decide.

Social network[ing] services clients

All the social services (Facebook, Twitter, etc) client apps I’ve seen (Gwibber on the desktop, Mauku on Maemo) fail in the same way, which is:

  • They just show the latest “feed” of messages from the service, not allowing users to either keep some message for a while, or remove messages they are not interested in.
  • They don’t integrate well with all the services (having a ‘@friend ….’ message in your Facebook profile doesn’t look well at all, which is what is done when you ‘reply’ to a message in Twitter) or just don’t integrate at all.
  • Some of them, like the Facebook widget on Maemo, just display your home page in Facebook when you click on one item, instead of sending you to the entry for that message you’re clicking on!

The only “thing” that does it correctly, from what I’ve seen so far, is yoono, a Firefox extension, which shows all the messages from all the services you configure it with, allowing you to remove messages you’re not interested in or have already read, or keeping messages for future reference. Also, it gets you to the right page at Facebook when you click on one item, and also allows you to comment directly to the messages right from yoono itself.

It’s true though that it would be great to have it not tied to Firefox, as an independent application, so /me dreams about gwibber/mauku implementing something like yoono.

PHP Help

Dear lazy web:

How do I make PHP not run out of memory when doing thumbnails of large images? I’ve got this code:

                        $href = $path . "/" . $file;
			$tn_file = "thumbnail-" . $file;
			$orig_file = $full_path . "/" . $file;

			/* generate thumbnail if it does not exist */
			if (file_exists ($tn_file) == false) {
				$im = @imagecreatefromjpeg ($orig_file);
				if (!$im) {
				        $im = @imagecreatefrompng ($orig_file);
					if (!$im)
						continue;
					$is_png = 1;
				} else
					$is_png = 0;

				if (imagesx ($im) < imagesy ($im)) {
					$new_width = round (imagesx ($im) / (imagesy ($im) / 240));
					$new_height = 240;
				} else {
					$new_width = 240;
					$new_height = round (imagesy ($im) / (imagesx ($im) / 240));
				}
				
				$copy_im = imagecreatetruecolor ($new_width, $new_height);
				imagecopyresampled ($copy_im, $im, 0, 0, 0, 0,
					$new_width, $new_height, imagesx ($im), imagesy ($im));
				if (is_png == 1)
				        imagepng ($copy_im, $tn_file);
				else
				        imagejpeg ($copy_im, $tn_file);

				imagedestroy ($copy_im);
				imagedestroy ($im);
			}

			//$get_url = "/images/thumbnail-" . $file;
			$get_url = $tn_file;

It works great for most of my images (as you can see here), but it doesn't for big images (2592x1944 pixels, like this one).

I've been trying all the solutions mentioned in this page, but none seems to work for me 🙁 I am assuming it's an out-of-memory problem, but could it be something else?

The dream comes true

Two years ago I started dreaming about driving a Yamaha XT660Z Teneré. At that time, the motorbike had just been announced, getting to shops a few months later. Then, when available, I started trying to sell my previous motorbike (Aprilia Pegaso 650 Trail), which was hard because of the crisis, but some weeks ago, a nice guy from Coruña came here and got it (quite cheaper than what I could have got if there was no crisis though), so right after that, I went to the Yamaha shop and, finally, ordered one. After 3 weeks waiting (I wanted the 2008 model, which has that khakhi color as an option, not available in the 2009 model, so it took a bit to get it from another Yamaha shop), a few weeks ago I could finally get it.

After 1200 kms with it, I can only say it’s the best motorbike I could have bought, since it’s perfect for daily usage as well as for off-road, specially after having changed its tyres yesterday:


Now all the mud, snow and tracks around here are nothing I can’t deal with 🙂