May 25
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

CHM IconAs most people know, CHM (Microsoft Compiled HTML Help) is a proprietary format, and not supported by default in Linux. Thankfully, there are several options available for viewing CHM files, and even converting them to another format - such as HTML and PDF.

Viewing CHM Files

The simplest method for dealing with CHM files is to download and install a CHM Viewer, for example gnochm or xchm, which under Ubuntu/Debian can be installed via a Terminal:

sudo apt-get install gnochm

or

sudo apt-get install xchm

or via the Synaptic Package Manager, by searching for “gnochm”, or “xchm”. Once installed, CHM files will automatically open within the CHM Viewer.

Converting CHM Files

My prefered method for dealing with CHM files, is to convert them to a more universal format, such as HTML, or even PDF, and there are a couple of ways, and several different tools for accomplishing this.

Conversion Method 1: CHM -> HTML (-> PDF)

HTML IconFirstly, it is possible to simply decompile the CHM file into component HTML files, which can be opened in any web browser. These HTML files may then optionally be transformed into a PDF document. In order to do this, two main packages (with dependencies) need to be installed - chmlib, and htmldoc:

sudo apt-get install libchm-bin htmldoc

The first part of the process calls upon chmlib to essentially decompile the CHM file, and save the new files to a specified directory, for example:

extract_chmLib my_chm_book.chm htmloutputdir

This will pull apart the CHM file, and store all the new HTML files within the “htmloutputdir” directory (within a sub-directory called “final”). If desired, htmldoc can be called upon to convert the HTML files into a single PDF document. Running

htmldoc &

from the Terminal, opens up the htmldoc GUI from which the HTML files can be selected for input, the output formatted, and PDF document generated. The htmldoc website has extensive documentation which covers this process, but for converting to PDF, I find the next method much easier!

Conversion Method 2: CHM -> PDF

PDF IconA tool written in Python, called chm2pdf, essentially cuts out (for the user) the intermediary processes above. It sits as a layer on top of chmlib and htmldoc, automating most of the conversion work, and as such also requires chmlib, htmldoc and additionally pychm (Python binding for chmlib) in order to execute. chm2pdf can be downloaded from the website and compiled/installed manually or, in Ubuntu, installed from the repositories. To install it, and the required additional applications, in a terminal run:

sudo apt-get install libchm-bin htmldoc python-chm chm2pdf

chm2pdf is a command line tool, and in most cases, the default options work for me (outputting an A4 PDF document, with ToC, images, links etc.), and is as simple as running:

chm2pdf --webpage my_chm_book.chm

from the directory where the CHM file is located. This converts the file (to HTML - these files are stored in the /tmp directory), and generates a PDF document with the same name, with the ToC, Index, links, images etc. all intact. Running either:

man chm2pdf

or

chm2pdf --help | less

will output the manual and help pages, both of which contain a wealth of information and command options to perfect and tweak the CHM to PDF conversion process.

  • Digg
  • del.icio.us
  • Facebook
  • Google
  • Reddit
  • StumbleUpon
  • Technorati
  • Slashdot
  • TwitThis
  • Yahoo! Buzz

written by Hodge \\ tags: , , ,

May 21
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

While aimlessly wandering the web yesterday, I happened upon a rather cool little plugin for Eclipse, called AnyEdit tools, which adds a bunch of useful tools to the context menu of the Eclipse editor, and also to the output consoles, main menu and editor toolbar. Most interestingly for me, is the addition to the context menu which allows opening an included file from the within Editor, which means I don’t have to search through directory structures in the Eclipse explorer to open a file included in the one I’m currently editing. With AnyEdit tools, I just right-click on the include/require statement, and select “Open file under cursor” (Ctrl+Alt+R does the same), and the file is opened in the editor. Cool.

AnyEdit tools is easy to install - in Eclipse, go to Help -> Software Updates -> Find and Install and select the “Search for ne features to install” option. Click on “New Remote Site”, and add “AnyEdit tools” as the Name, and http://andrei.gmxhome.de/eclipse/ as the URL and click OK. Tick the box next to the new site, and click Finish. Once the update site has been contacted, and the plugin list retrieved, expand the AnyEdit tools -> Eclipse 3.3 plugins, and select AnyEditTools 2.0.2. Click Next, accept the agreement, Next, Next, Finish. Once dowloaded, the Update Manager asks to verify the installation - click Install, and that’s it. Eclipse needs restarting to activate the plugin.

  • Digg
  • del.icio.us
  • Facebook
  • Google
  • Reddit
  • StumbleUpon
  • Technorati
  • Slashdot
  • TwitThis
  • Yahoo! Buzz

written by Hodge \\ tags: ,

May 14
1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 2 out of 5)
Loading ... Loading ...

I’ve just solved a funky little problem with Compiz and Emerald, whereby Emerald wasn’t used for window decorations, and changing the Theme via the Emerald Theme Manager accomplished nothing - this is after upgrading to Ubuntu Hardy Heron, by the way. If you don’t have Emerald installed, it can be done by running, in a Terminal:

sudo apt-get install emerald

or via the Synaptic Package Manager. The same goes for the CompizConfig Settings Manager:

apt-get install compizconfig-settings-manager

Anyway, the problem boiled down to Compiz not using Emerald for Window Decoration, and was thankfully veyr easy to solve, by pointing Compiz to the Emerald binary. Open up the compizConfig Settings Manager - System -> Preferences -> Advanced Desktop Effects Settings and select the “Effects” category from the left menu. Click on “Window Decoration” from the selectionin the right pane, and for Command, enter:

/usr/bin/emerald

Make sure it’s enabled, and close the CompizConfig Settings Manager. In order for the new settings to take effect, wither restart X by pressing Ctrl+Alt+Backspace, or run the following in a Terminal:

compiz --replace &
emerald --replace &

Now Compiz is using Emerald for my Window Decorations, and I can once again change the Emerald Theme dynamically via the Emerald Theme Manager.

  • Digg
  • del.icio.us
  • Facebook
  • Google
  • Reddit
  • StumbleUpon
  • Technorati
  • Slashdot
  • TwitThis
  • Yahoo! Buzz

written by Hodge \\ tags: ,

May 13
1 Star2 Stars3 Stars4 Stars5 Stars (2 votes, average: 4 out of 5)
Loading ... Loading ...

There are times - many in fact - when I need to find a file, or multiple files containing a particular string. For example, I’m developing a web application, and need to find out which pages call a particular class method, say, all the files which call the getTopTenCDs() method - I can do this by opening a Terminal, and running grep (Global Regular Expression Print), with a couple of options:

grep -r -n 'getTopTenCDs()' /var/www/cdcollection/*

This will return a list of files, and the lines within those files, and the line numbers containing the string ‘getTopTenCDs()’ in the directory /var/www/cdcollection/. The -n option tells grep to output the line numbers, the -r option tells grep to search recursively through the sub-directories too, and * tells it to look in all files - which can be changed to *.php etc: /var/www/cdcollection/*.php

So, the output would be something along the lines of:

/var/www/cdcollection/viewcd.php:192:   $topTen = $cd->getTopTenCDs();
/var/www/cdcollection/sidebar.php:215:   $topTen = $cd->getTopTenCDs();

If I just want a list of files without the lines containing the search string, I can use the -l option:

grep -r -l 'getTopTenCDs()' /var/www/cdcollection/*

which would simply return:

/var/www/cdcollection/viewcd.php
/var/www/cdcollection/sidebar.php

As the name implies, grep uses Regular Expressions, and therefore the search string can contain the usual RegEx operatiors: . ? * + {n} etc. RegEx is out of scope for this post I’m affraid - there are dozens of great tutorials available on RegEx, and applying RegEx to grep.

One final point about grep: if the search string begins with a hyphen (minus sign, or whatever you want to call “-”), the search string needs to be preceded with the -e option:

grep -r -e '-starts with a hyphen' /var/www/cdcollection/*

so that grep doesn’t mistake the search pattern for an option! Forget the -e option, and you’ll get:

grep: invalid option -- $
Usage: grep [OPTION]… PATTERN [FILE]…
Try `grep –help’ for more information.

Also, remember the ever useful pipe | and output to file > commands. If the list printed by grep is huge, you can simply pipe it to more:

grep -r 'getTopTenCDs()' /var/www/cdcollection/* | more

or, if you want to save it to a file to peruse later:

grep -r 'getTopTenCDs()' /var/www/cdcollection/* > ~/grep_output.txt

Always useful.

Finally, remember to take a look at the grep man page:

man grep

Which contains a world of useful information, including a wealth of options I haven’t covered.

  • Digg
  • del.icio.us
  • Facebook
  • Google
  • Reddit
  • StumbleUpon
  • Technorati
  • Slashdot
  • TwitThis
  • Yahoo! Buzz

written by Hodge \\ tags: , , ,

May 12
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Skype. Skype, skype, skype… Say it enough times, and it sounds like a nonsensical sound. Mind you, say any word repeatedly, enough times, and it ceases to sound like a real word and becomes gibberish, randomly rolling between toungue and palate like a peanut in a tin can. Try it. “Flannel” is a great word to experiment with, although after 30 seconds of repeating it, you’ll probably question your sanity…

But anyway, this post isn’t about language, it’s about how I got Skype installed, and customized the look and feel of the GUI. I’ll not bore you with the details on what Skype is, and what it does - most people know already, and most likely found this page by searching for “Installing Skype on 64 Bit Ubunutu”, or some such string. If not, you can check out the Skype website.

First things first - as of writing this post, there is no 64 Bit version of Skype available for Linux. Thankfully, it is possible to install 32 Bit applications in 64 Bit Ubuntu with the correct libraries:

sudo apt-get install ia32-libs

ia32-libs is available through the Universe repositories, which can be activated by going to System -> Administration -> Software Sources and checking the “Universe” option.

Having installed the correct libraries, I downloaded the deb package (generic download page here), and saved it to my Desktop. Since it is a 32 bit application, dpkg requires prodding with the –force-architecture and –force-depends options:

cd ~/Desktop
sudo dpkg --install --force-architecture --force-depends skype-debian_2.0.0.68-1_i386.deb

(The current version is 2.0.0.68-1 - if you have downloaded a later version, you’ll need to replace the version number in the file name with the current version. If, like me, you’re lazy, you can copy and paste everything up to and including “skype” then press the Tab key… the Terminal will fill in the rest of the file name).

That’s pretty much it. Skype can be found under Applications -> Internet -> Skype.

Since Skype is a Qt application, it is possible to customise the interface using an application called qtconfig. For Completeness I also installed the msttcorefonts package, which installs a few, well, core MS True Type fonts, such as Times, Courier, etc.

sudo apt-get install msttcorefonts
sudo fc-cache -fv

Running fc-cache will rebuild the Font cache to include the newly installed fonts. Restarting X by pressing Ctrl+Alt+Backspace will also do the trick. With this done, I installed the Qt Config application:

sudo apt-get install qt3-qtconfig

To give the Qt applications a “Gnomeish” look, there is a theme called Polymer available:

sudo apt-get install polymer

With these installed, it is possible to run the Qt Config tool from either System -> Preferences -> Qt3 Configuration, or by executing qtconfig in a terminal. The first tab - Appearance - allows us to select the Polymer theme, by changing “Select GUI Style” to Polymer:

The second tab, “Fonts” allows control over how Qt displays text. Skype can be made more readable and friendly, by increasing the font size to 10 Points, and changing the font family to Sans Serif:

Save the changes with either File -> Save or Ctrl+S, exit, and start Skype (or any Qt application) to see the changes.

That’s it!

References:

  • Digg
  • del.icio.us
  • Facebook
  • Google
  • Reddit
  • StumbleUpon
  • Technorati
  • Slashdot
  • TwitThis
  • Yahoo! Buzz

written by Hodge \\ tags: , ,

May 11
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

I noticed today that a bunch of applications, and even some web sites were displaying interesting fonts, making the application/web site unusable and unreadable - most notably QT applications. The text rendered like an interesting cross between Hindu and Arabic. This issue just so happened to crop up shortly after transferring a bunch of fonts over from my Windozzze partition to Linux:

cd /media/hda1/WINDOWS/Fonts
cp * ~/.fonts
sudo fc-cache -fv

Basically, there seemed to be a conflict between the fonts already installed in Linux, and the fonts I had just transferred over. So, I removed all the fonts, and copied over just the True Type Fonts and Open Type Fonts:

cd ~/.fonts
rm *.*
cd /media/hda1/WINDOWS/Fonts
cp *.ttf *.TTF *.otf *.OTF ~/.fonts
sudo fc-cache -fv

So far so good - the funky script has been replaced with readable text. I guess I’ll have to move the rest one-by-one to find the miscreant font…

  • Digg
  • del.icio.us
  • Facebook
  • Google
  • Reddit
  • StumbleUpon
  • Technorati
  • Slashdot
  • TwitThis
  • Yahoo! Buzz

written by Hodge \\ tags: ,

Apr 30
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Azureus LogoI love the fact that a huge amount of the applications I regularly use are available via the package manager, but sometimes, I like to install applications myself. Azureus is one such application - I wanted to install the latest x64 version, and utilise the x64 JRE I had installed for the x64 Eclipse IDE. Of course, it can easily be installed by running

sudo apt-get install azureus

(in Ubuntu) and everything is done automatically. But, this is how I installed it.

I had already installed x64 JRE (see 64 Bit Eclipse: Linux Installation, including PDT, WTP (WST), ATF, and MySQL (SQL Explorer Plugin)), but for the benefit of those who haven’t, don’t want to read that particular article, or just can’t be arsed scanning through it, here’s the procedure again (skip to —END x64 JRE INSTALL— if you don’t want to read this part!)

The 64 Bit JRE can be downloaded here (or use the direct link to the bin file). After the file downloaded to my desktop, I opened up a new Terminal Window (Applications -> Accessories -> Terminal), traversed to the directory I wanted to install it into, moved the file, made it executable, and ran it to install:

cd /usr/java
sudo mkdir 64
cd 64
sudo mv ~/Desktop/jdk-6u5-linux-x64.bin /usr/java/64/
sudo chmod a+x jdk-6u5-linux-x64.bin
sudo ./jdk-6u5-linux-x64.bin

If the “java” directory doesn’t exist by the way, it needs to be created first:

sudo mkdir /usr/java

Anyway, listing the directory

ls

should return

jre1.6.0_05

which is the directory containing the necessary Java binaries.

—END x64 JRE INSTALL—

The 64 Bit version of Azureus (currently v3.5.0.2) can be downloaded here. Once the archive had downloaded to my desktop, I unpacked it:

cd ~/Desktop
tar -xjvf Azureus_3.0.5.2_linux-x86_64.tar.bz2

As usual, I like to put applications (which don’t need compiling and installing) into /opt

sudo mv azureus /opt

Within the /opt/azureus folder, is a shell script for running the Azureus client called, funnily enough, azureus. However, to get it working with the 64 Bit JRE I had installed, I had to make a couple of minor adjustments to the script:

cd /opt/azureus
gksu gedit azureus

Line 5 contains a variable for the Java program directory:

JAVA_PROGRAM_DIR=""

so, I simply inserted the path to the JRE bin directory:

JAVA_PROGRAM_DIR="/usr/java/64/jre1.6.0_05/bin/"

saved the script, and closed the editor. I can now run the Azureus client by running this script:

/opt/azureus/azureus

Alternatively, it can be run from the Applications menu by creating an entry pointing to /opt/azureus/azureus - open System -> Preferences -> Main Menu, highlight “Internet”, and click “New Item”. Enter “Azureus” for the name, /opt/azureus/azureus for the Command, and change the icon to the Azureus logo by clicking on the Icon, and browsing to /opt/azureus/azureus, which will automatically list the images in the folder to choose from.

  • Digg
  • del.icio.us
  • Facebook
  • Google
  • Reddit
  • StumbleUpon
  • Technorati
  • Slashdot
  • TwitThis
  • Yahoo! Buzz

written by Hodge \\ tags: , , ,

Apr 30
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

I wanted to see if I could take advantage of my Dual Core CPU during boot time, by enabling concurrent init.d scripts, in the hope this could improve (an already pretty fast) boot time. The implementation is pretty simple - first, I backed up /etc/init.d/rc

cd /etc/init.d/
sudo cp rc rc.BAK

then set about editing /etc/init.d/rc

gksu gedit /etc/init.d/rc

Actually, there isn’t much to edit - I just needed to change:

CONCURRENCY=none

to:

CONCURRENCY=shell

on line 24, save the file, and reboot. However, when I rebooted, there was a gnarly error caused by HAL (Hardware Abstraction Layer) failing to initialise. After some digging, I found a bug report, and a solution. The cause of the problem, and the solution is actually quite simple. At run level 2, HAL and DBus are set to start at the same time - in the /etc/rc2.d/ directory, both symbolic links have the same S12 prefix (S12hal and S12dbus):

ls -l
...snip...
lrwxrwxrwx 1 root root 14 2008-04-26 00:52 S12dbus -> ../init.d/dbus
lrwxrwxrwx 1 root root 13 2008-04-25 18:58 S12hal -> ../init.d/hal
...snip...

which causes a problem with concurrent init.d scripts, since they are now executed at the same time. HAL initialises slightly faster than DBus, but requires DBus in order to initialise, hence the “failed to initialize” error. The solution is equally simple. As suggested in the bug report, I changed the execution order of HAL. I had to do this via the recovery console, but so long as you don’t reboot after saving the /etc/init.d/rc file, it can be done via the GUI terminal:

sudo mv /etc/rc2.d/S12hal /etc/rc2.d/S13hal
sudo reboot

This time, there was no problem, and no error, since it ensures that DBus (S12dbus) initialises before HAL (S13hal).

If I still get problems in the future, I can always restore the old version of /etc/init.d/rc:

cd /etc/init.d
sudo cp rc.BAK rc

Coupled with boot profiling, this does speed up my boot time by shaving an extra few seconds away.

  • Digg
  • del.icio.us
  • Facebook
  • Google
  • Reddit
  • StumbleUpon
  • Technorati
  • Slashdot
  • TwitThis
  • Yahoo! Buzz

written by Hodge \\ tags: , , ,

Apr 28
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Like most other Ubuntu users, I recently upgraded to 8.04 (Hardy Heron), but numerous power cuts, and a sketchy internet connection screwed up the upgrade process, resulting in a horribly drawn out process of reinstalling a fresh copy of 7.10, downloading and installing the updates, and finally the alternate CD for 8.04… but that’s another story for another time…

During this process, I found that the Ubuntu archive repository, http://archive.ubuntu.com/ubuntu/ was somewhat slower than usual. Thankfully, there are many mirrors available to download from - most are up to date with the latest packages. https://launchpad.net/ubuntu/+archivemirrors has an extensive list, so I looked for one with an “Up to Date” status, and edited my sources.list:

gksu gedit /etc/apt/sources.list

commented out the current archive site:

#deb http://archive.ubuntu.com/ubuntu/ hardy main universe multiverse restricted
#deb http://archive.ubuntu.com/ubuntu/ hardy-updates main universe multiverse restricted

and added the mirror:

deb http://ubuntu.positive-internet.com/ubuntu/ hardy main universe multiverse restricted
deb http://ubuntu.positive-internet.com/ubuntu/ hardy-updates main universe multiverse restricted

After saving the file, and starting the Update Manager, I simply had to click “Check” to retrieve the update information from the mirror. Alternatively, this can be done with the “Reload” button in the Synaptic Package Manager.

Simple, but effective, leading to much faster downloads, and you can always revert back to using archive.ubuntu.com by uncommenting the entries in sources.list, and commenting out/deleting the mirror entries.

  • Digg
  • del.icio.us
  • Facebook
  • Google
  • Reddit
  • StumbleUpon
  • Technorati
  • Slashdot
  • TwitThis
  • Yahoo! Buzz

written by Hodge \\ tags: ,

Apr 27
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Sorry if you were expecting a substantial research report, but there really is no need for an in depth technical evaluation and comparison. No need to waste your time with specifications and benchmark results. No funky table with the pros and cons of each operating system. All you need do, is watch the following video.

Even if it’s satire, it’s more than enough reason to switch to Linux…

You need to a flashplayer enabled browser to view this YouTube video

Cringe

  • Digg
  • del.icio.us
  • Facebook
  • Google
  • Reddit
  • StumbleUpon
  • Technorati
  • Slashdot
  • TwitThis
  • Yahoo! Buzz

written by Hodge \\ tags: , , ,