Monday, January 14, 2013

Using Emacs with ItsAllText on Fedora

ItsAllText (project website on GitHub) is a nifty Firefox add-on that allows you to edit the contents of a textbox with your favourite text editor, in my case Emacs. The configuration is quite simple. All you need to do is mention the path to the executable for your text-editor, and the add-on will use that to open the temporary file automatically. In the screen-shot below, I've used /usr/bin/emacs as the executable.


The trouble with using /usr/bin/emacs is that it opens a new Emacs window, which may become annoying after a while. To avoid this, you can use the emacsclient command, which opens the file in the Emacs instance that is running the Emacs server.

To enable the Emacs server, you need to add the following line to your .emacs file.

(server-start)

Or, if Emacs is already running, you can start the server using M-x server-start

Now, modify the ItsAllText configuration to use the emacsclient command instead of emacs, as shown in the screen-shot below.



On recent versions of Fedora, including FC 17 which I'm using, Firefox changes the default tmp directory to /var/tmp. Because of this, the emacsclient command cannot find the socket file used by the Emacs server, which is in /tmp. As a workaround, you can use the following script, that modifies the TMPDIR variable, to run emacsclient using /tmp.

#!/bin/sh
export TMPDIR=/tmp
/usr/bin/emacsclient "$@"

Now, set the path to this script as the editor in the ItsAllText preferences window. You can see the full description on the associated GitHub issue

Sunday, March 14, 2010

The quest for a Flickr uploader ends

After much searching, I've finally managed to set up a decent uploader for Flickr on my Linux laptop. Initially, like practically everyone, I guess, I started off using Flickr's web interface to upload photos. While that worked well for a small number of photos, you do get bandwidth conscious when using the web interface. Thus began my quest for a good Flickr uploader for Linux.

The first thing I did was check out the official Flickr Uploadr, which is available only for Windows and Mac OS X. Happily, the source code is available under the LGPL, so I downloaded it and tried compiling it. This turned out to be more complicated than I'd bargained for, and since I didn't have the time, I added it to my burgeoning list of future projects.

Next up, I tried using KFlickr, KDE's Flickr uploader. I liked this as I could set all Flickr options including licenses, and even resize the image before uploading it. Unfortunately, since Ubuntu Karmic has moved to KDE4, thumbnails weren't working, as KFlickr at the time still used KDE3 libraries, as described in this bug. Anyone who's tried to figure out which pic is which based on the usual digicam naming schemes, will know that it's practically impossible without thumbnails.

So, for a while I used Postr, the Flickr uploader for Gnome. While it is pretty good, it doesn't have all the features that KFlickr has.

Recently, I decided to have another crack at it, and tried out jUploadr, which is built using Java, so it runs everywhere. However, it's not been developed since 2007, and it shows. It has about the same feature set as Postr, and I couldn't get it to upload the only time I tried.

Rather despondent I checked out the aforementioned bug, and noticed that a new version of KFlickr with KDE support is out. It's not an official Ubuntu release yet, but you can get it from this PPA. Importantly, thumbnails work, and uploading so far has been a breeze.

Now, to finish uploading that massive backlog of photos...

Wednesday, December 30, 2009

How to include sub-floats in a list-of-floats in LaTeX

Been pottering around with LaTeX lately, after a long while, and came across this handy nugget I couldn't find adequately documented anywhere else.

I was trying to combine 2 images into a single float using the subfig package, but couldn't see them in the "List of Figures", despite adding individual captions. It turned out to be a simple fix. All you need to do is add the following line just before the \listoffigures command.

\setcounter{lofdepth}{2}

As you might have guessed looking at the command, it sets the depth for list-of-figures to 2, which meant that the captions of the sub-figures were displayed.

If you've combined 2 tables into a single float, you need to add the following line just before the \listoftables command.

\setcounter{lotdepth}{2}

You can find the full documentation for subfig as a PDF, here.

And, finally, I publish a post on this blog after ages!

Tuesday, June 03, 2008

Installing WordPress

Recently, I tried installing WordPress on my lab PC, Nogzone Mk II. The version I used was 2.5.1, the most recent release. It turned out to be a fairly easy install. I already had Apache, PHP, MySQL and the PHP-MySQL connector installed. After that, I just followed the instructions given here.

Installing plugins turned out to be a more painful process. The plugin I tried to install, WordPress.com stats, needed an API key. I followed the instructions given here to get the API key. They included creating an account at WordPress.com. Not a very painful task admittedly, but it seems to me to be rather pointless. It might be that I'm using some service of WordPress.com, but I can't reason what. It's my own database and webserver that I'm using.

Once I got the API key, I tried using it to activate the stats plugin. However, this required my WordPress install to access WordPress.com. This didn't work as my lab PC can't directly access the internet.

So, in the end, though WordPress is quite easy to install, getting plugins on it will only work if your server can contact WordPress.com.

Tuesday, December 18, 2007

Happy Birthday Perl!

Yes, on this day in 1987 Larry Wall released Perl 1.0 on the comp.sources.misc newsgroup. So, that means 20 years of easing the text-processing headaches of countless programmers around the world!

I've been using Perl for some time now and it never ceases to amaze me with its ability to handle text manipulation tasks that would take ages to code in Java even with all its libraries, forget about C! Though, then Java would take ages to run, unlike C.

Friday, September 14, 2007

Shifting lab PCs

Moving from the first to the second year of M.Tech. means you get a chance to upgrade PCs. My old PC, named nogzone, was a Compaq D380m, with a ViewSonic E70 monitor. This monitor is the biggest and heaviest amongst all 17" monitors in the department, the main reason I took it.

Nogzone Mk I, had the following specs:
Intel P4 1.6GHz
256MB RAM
NVIDIA Riva TNT 2 (NV5M64) with 64MB of RAM
Maxtor HDD 4D040H2 (40 GB capacity)
BTC (Some Chinese company) F563E CD-ROM

That's all that I could extract from /proc! It has been running Ubuntu Dapper Drake since I first got it.

Fortunately, it's run rather well as long as I've had it. The graphics card even made for passable gaming when I tried it. Now it's time to move on to Nogzone Mk II. More on this later.

It's been fun having Nogzone Mk I around, and if only it had more memory, I wouldn't have given it up. Installation and configuration does take ages! Now, I've realized that data transfer taken an equivalent amount of time, especially when you're as haphazard as I am.

Saturday, February 10, 2007

Nvidia drivers on Ubuntu

This goes out to all those unlucky people who still haven't managed to enable 3D acceleration on their Nvidia graphics cards. This is a link to the Ubuntu HOWTO on installing Nvidia drivers. It worked like a charm on the Riva TNT 2 on my KReSIT PC.