Wednesday, July 29, 2009

Texlipse Plugin

If you are an Eclipse fan and in love with LaTeX, you should try the eclipse plugin Texlipse. It seems to be still in its infancy, but works fine for general needs.
  • Has command completion with Ctrl+space.
  • Can invoke latex command internally to compile the project.
  • Can spawn xdvi for viewing compiled dvi files.
  • Can handle complicated projects with \input and \include commands.
  • Can keep all the temporary files in a separate directory.
Confusing, irritating, and missing features:
  • It does not have a separate perspective. (Still, it doesn't matter, once installed, it enable additional menus when you open a .tex file.)
  • You better compile with the "build automatically" ON. Otherwise, you will be force to do a lot of "clean, build."
  • There is no way to select a text and apply a latex command to it (for example, change the font style to italics or bold.)
  • Auto-format does not work.
  • Working with spell-check is not that intuitive.

Globally Installing LaTeX Style Files

If you want install a LaTeX style file in Ubuntu/Kubuntu globally so that all the users in the system can access it, put it inside a directory (say misc) in /usr/share/texmf-texlive/tex/latex and run the mktexlsr command from a command line. You have to have root privileges for both the above steps.

Sunday, April 26, 2009

Upgrading to Kubuntu 9.04

I have two desktops, one at home and another at office, installed exclusively with Kubuntu. I had them Kubuntu 8.10 (Intrepid) installed and, when Kubuntu 9.04 was released last Thursday (23rd April, 2009), I decided to upgrade my machines (simultaneously) with the new version. And, that's how I ended up wasting nearly two days...!

Upgrading Nightmares

OK, let's clear about one thing: the fault is half mine. But I am still peeved about how the other half made me go into this half. ;-) When I upgrade my machines from 8.04 to 8.10, which was a major upgrade because KDE moved from 3.x to 4.x, I didn't have this much trouble. Now, when I upgrade from 8.10 to 9.04, where KDE just moved from 4.1 to 4.2, things got messed up. I would say the blame is on the switching of package management tool -- from adept-manager to KPackageKit; I don't have an actual proof to support my this claim though.

My machines' software manager informed me on Thursday that there is a version upgrade available, so I asked it to do the upgrade. Both my machines' upgrade manager broke down in the middle of the upgrade saying the repository failed to respond. Everything went wrong from that point.

My Lab Machine
After the upgrade broke down, I restarted the version upgrade. Instead of downloading the remaining packages needed to upgrade the system properly, it immediately went into installing the already downloaded packages. It went fine and asked me to restart the machine after 'completely upgrading' the system. When I did, my machine booted with Kubuntu 8.04 (which was left aside when I installed 8.10)! Again, the update manager informed me of new updates available, so I updated again. The packages that are updated/installed belonged to 9.04! I still hoped that after this everything will be fine. But after considerable amount of time spent on downloading the packages, the system informed me of a dependency problem and the installation crashed again. Confused about what to do now, I chose to do what came first into my mind -- I rebooted the system. Now things got worse and I was left with only a CLI. I tried all my best to recover the system, but I couldn't resolve the dependency issue. After wasting about 8 hours, I used a live CD to reinstall the OS from scratch. I got no problem there.

My Home Machine
Again, after the upgrade broke down, I restarted it and here things were better. The tool started from downloading missing packages and installed all of them; no dependency issues; no booting into old version. But when I rebooted the system, the system refused to load NVIDIA drivers to utilize my video card. Acccording to the OS's guidance, I switched to use a non-NVIDIA (vesa) driver and my xserver booted with 800x600 resolution. I can do nothing to increase the resolution: I couldn't increase the resolution with the vesa driver and I couldn't use any of the supplied NVIDIA drivers (when I activate them, I couldn't start xserver.) As the next step, I downloaded the latest NVIDIA driver from NVIDIA website. When I tried to install it, it asked me to recompile the kernel. But I couldn't get the source code for the loaded kernel! Frustrated, I decided to go with the approach that worked in the lab -- reinstall the OS from scratch. But, at home, even that failed, when the installation terminated with the "grub-install failed on hd0" message! After multiple install attempts have failed, I have almost decided that my hard disk has gone bad. As usual, I "consulted" Google to resolve this problem. By deciphering number of posts in different forums, I decided to try installing grub manually and that finally worked (ha!) After I have created the proper device-map file, I reinstall the system and it smoothly went pass the point where it got struck earlier. A reboot brought my system live without any problem in video. I enabled the NVIDIA driver later (the recommended one) to enjoy all the sweetness of the KDE 4.2 (even though the default driver brings up the video card with proper resolution and color, some desktop effects can be enabled only when a NVIDIA driver is activated.)

I think that I got the "grub-install failed" message, because grub-install conflicted with the grub files with my 8.10 (or is it 8.04?) installation (I didn't format the drive.) Manually launching grub-install corrected the files, after which the installation went smooth. May be I should have done this at the time when the version upgrade complained about loaded kernel not supporting the provided NVIDIA driver. I should have used the upgrade-grub command to rewrite my grub menu.lst file and I might have saved about 6 hours I spent on reinstalling the system from scratch! But who expected an upgrade not to have updated the grub files!

I also suspect that the things got screwed up, because my machines actually had both 8.10 and 8.04 installed earlier. When I upgraded from 8.10 to 9.04, the upgrade removed the 8.10 installation, but, I think, kept the 8.04 (with KDE 3.x) which made things messed up.

So, after all these struggle, everything is fine. Of course I had to reinstall additional software I needed, such as Firefox, LaTex, Java, Eclipse, Acrobat Reader, etc. As far as I am concerned, the verdict is still out on the new package manager. But the trusty apt-get is always there.

Reinstalling Kubuntu Over an Existing Installation

One thing the *Ubuntu distributions lack is a recovery mode in the installation/live CD. Was there one like that, I am pretty certain that I could've saved a lot of time. Now, the only way to "recover" a system seems to install a new system over an existing one, with the risk of loosing all the data except in /home/.

Reinstalling is pretty easy:
  1. Boot with a live CD and start the installation process.
  2. When the partitioning process begins, choose the manual mode
  3. Don't change the partition setup of the disk. Just enter the partitions' mount point as it were earlier. If you don't know, use a shell from the live CD, mount different partitions to see what is inside, and choose the mount point accordingly.
  4. Make sure "format" checkboxes are unchecked at least for the /home partition (or the partition that contain the /home directory
  5. Proceed with the installation and finish it
In this way, you can be sure that the data in your home partition is saved. If you use the same username for the new installation, you can safely login to your old account without any problem with the new OS version. Anyway, just backup your data with live CD just to be extra-confident.

Love the New KDE 4.2

After all these struggle, things are pretty good. I really like the new KDE. Of course, it borrows a lot from both Vista and Mac, but why not? The taking the best of both of these, KDE looks better. I feel that KDE 4.2 is much more stable than KDE 4.1. The plasma looks better and works better (still not 100% though.) Another think I really appreciate is the performance of GTK applications in KDE. Earlier whenever I do 'heavy' browsing (lot of javascripts, images, etc.), firefox used to crash; I had to restart firefox about 10 times a day. Now no crashes; When I used Eclipse, the plasma panel sometimes used to vanish or behave oddly. Now it is not the case. The only issue I still see is that the image libraries are still have to improve a lot. It takes a noticeable amount of time to load big image files (big in terms of either by resolution or file size). It degrades the experience with graphics/photo softwares. I hope the future updates will further improve the quality of KDE. In any case, now I am not thinking about KDE 3.x as a lost lover any more. :-)

Monday, September 15, 2008

The 'tee' Command

Sometimes you don't see an old, good thing, until you really need them.

tee is Linux shell command using which you can redirect a program's output to the screen as the same time dumping it on a file.

Usage:
$ < program> | tee < output_file>

If it is your own program, make sure that it flushes the output time to time if you want to readily see the output on the screen.

Wednesday, August 20, 2008

Boolean AND and OR

Yesterday, at the lab, we went into an argument on the boolean operator precedence. We always talk about precedence in arithmetic operators, but the precedence in boolean operator is hardly a topic of discussion. One of my colleague claimed that logical AND has higher priority than the logical OR; I sided with another saying that they have equal priority. So we ended up writing sample programs (in python) to verify our claims:

if a or b and c:
print "true1"
if a and b or c:
print "true2"

It's embarrassing that we had this doubt at this stage of the academic life (6th year Ph.D.). But the funny thing is that we couldn't test our claims because of how the compiler works. The programing languages don't go into processing the second operant of a OR statement, if the first is "true"; same with a AND statement, if the first operant is "false". I don't want to write the whole story of why this feature makes the tests invalid, but think about it and you will see it.

Ultimately, we ended up looking at the language documentation (which we should've done in the first place!) and found out my other colleague is right - the AND operator do have higher priority than the OR operator.

Nothing new in this story, but I was just surprised to see how couldn't test the priority programmatically.

Sunday, July 6, 2008

Google Search Tricks

Here is a nice article from Lifehacker.com on top 10 Google search tricks.
http://lifehacker.com/339474/top-10-obscure-google-search-tricks

Wednesday, June 18, 2008

Firefox 3 Add-Ons and Other Stuffs

As a person who uses Firefox on three different computers regularly, synchronizing bookmarks is very essential to me. Earlier I was using Google FF Sync, but it is discontinued with FF3. Fortunately I found Foxmarks. It works great for my need.

Another problem I had was that I can not access some of the private web pages of my research group at UofT from home - the access is denied for external (to UofT) IP addresses. The proper solution is to setup a VPN connection. But, once the VPN is activated, everything goes through the VPN resulting in unnecessary traffic going through UofT. FoxyProxy is a great FF extension to solve this problem. It can filter my http queries so that only a selected queries go through UofT. The only problem is to create an ssh connection to my lab computer and keep it alive all the time. Still, you can safely put the ssh connection in the background using -fN options. The additional benefit of using FoxyProxy is that now I can access premium websites like IEEEExplore and Oxford Online Dictionary from home (UofT has a enterprise subscription to these websites.)

Another excellent extension I am using is FireGestures: it let you perform many menu actions by drawing figures using mouse (like the graffiti handwriting recognition.) If you are a "mouse-man", it is an essential FF extension; but even for a "shortcut-key-man" like me, it helps a lot.

Do you know now you can now make the FF to call gmail compose box whenever you click a "mailto:" link? It is a new feature introduced with FF3. This link has detailed instructions.