Special web hosting offer - LIMITED TIME ONLY

Sep 02
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

I love tabs - Tabbed browsing has become an invaluable and integral part of my daily surfing. I also love the Terminal Emulator built into GNOME, but when it comes to opening multiple instances of Terminal Emulators, I prefer split screen over tabs. This is where Terminator wins for me, hands down. I’m just too lazy to flip between tabs when referencing commands, or standard output from multiple terminals. Terminator allows me to open multiple instances of Terminals in the same window - the screen can be split horizontally and vertically with either a mouse click, or the built in keybindings. The current version also supports tabs, by the way.

Terminator - split screen GNOME Terminal Emulation

The easiest way to install Terminator, is via either the Synaptic Package Manager, or by running the following command:

sudo apt-get install terminator

As the Terminator website points out, the version available in the Ubuntu Repositories is only 0.8.1. If you want the latest version, it must be compiled from source. Terminator’s creator doesn’t recommend installing from the source, and instead recommends using the package manager. However, it can be compiled and installed as follows. Be warned, though, that there is currently no uninstall option, and no GNOME menu/icon integration. The current version (0.10) can be downloaded here (although be sure to check the site for the latest version). Python vte bindings are also required, and can be installed by running:

sudo apt-get install python-vte

Now for Terminator:

wget http://launchpad.net/terminator/trunk/0.10/+download/terminator_0.10.tar.gz
tar -zxvf terminator_0.10.tar.gz
cd terminator-0.10
./setup.py install

that’s it. Either way, once installed, it can be run from Applications -> Accessories -> Terminator. Running

man terminator

outputs the Terminator Manual page, which has a stack of information on options and keybindings.

I like to have quick access to the Terminal, so I have a shortcut on my Panel, next to the menus, for Terminator. This launcher also executes the application with a couple fo handy options, saving me a few more mouse clicks. Right click on the Panel, and Add to Panel. Select Custom Application Launcher, and click Add. In the Name field, enter “Terminator”. In the Command field, enter “terminator -m” and click OK. The “-m” option opens Terminator maximised.

Once opened, Ctrl+Shift+O will split the terminals Horizontally, while Ctrl+Shift+E will split them vertically.


written by Hodge \\ tags: , ,

Aug 02
1 Star2 Stars3 Stars4 Stars5 Stars (2 votes, average: 4.5 out of 5)
Loading ... Loading ...

Java JRE LogoI wanted the latest version of Sun’s JRE installed on my system, and to have it set up as the default Java Runtime Environment whenever I ran a Java executable, or Jar file. It’s actually a pretty easy process, so this is a relatively short tutorial, but I’ll cover both the 32 bit and 64 bit installations, since aside from differences in file names, the set up is identical.

Installing JRE

First, decide on which architecture will be installed, and download the relevant file from the main Java website. At the time of writing, 1.6.0 u7 can be downloaded from the following: 32 bit, and 64 bit. I wanted to install the x64 version, and so downloaded jre-6u7-linux-x64.bin to my Desktop. I also wanted to install it in its own directory in /usr, and so created a directory for it to sit in:

cd /usr
sudo mkdir java

I was also experimenting with the 32 and 64 bit versions, so made two extra directories within java:

cd java
mkdir 32 64

and, since I’m the only user of the system, for my own convenience (I’m just too lazy to type “sudo” sometimes…) changed the ownership to my user, as opposed to root:

sudo chown myuser:mygroup 32 64

I then copied the relevant file(s) to the respective directories, and made them executable:

32 bit:

cp ~/Desktop/jre-6u7-linux-i586.bin /usr/java/32
chmod 755 /usr/java/32/jre-6u7-linux-i586.bin

64 bit:

cp ~/Desktop/jre-6u7-linux-x64.bin /usr/java/64
chmod 755 /usr/java/64/jre-6u7-linux-x64.bin

The final part of the installation simply involves executing the binary file:

32 bit:

cd /usr/java/32
./jre-6u7-linux-i586.bin

64 bit:

cd /usr/java/64
./jre-6u7-linux-x64.bin

Regardless of architecture, this should create a sub directory called jre1.6.0_07.

Setting JRE 1.6.0 u7 as Default

The process simply involves telling the system that there is an alternative Java binary available, and to use this binary to execute an “java” commands:

32 bit:

sudo update-alternatives --install "/usr/bin/java" "java" "/usr/java/32/jre1.6.0_07/bin/java" 1
sudo update-alternatives --set java /usr/java/32/jre1.6.0_07/bin/java

64 bit:

sudo update-alternatives --install "/usr/bin/java" "java" "/usr/java/64/jre1.6.0_07/bin/java" 1
sudo update-alternatives --set java /usr/java/64/jre1.6.0_07/bin/java

Follwing the second command, there should be output to the terminal something along the lines of:

Using '/usr/java/32/jre1.6.0_07/bin/java' to provide 'java'.

or,

Using '/usr/java/64/jre1.6.0_07/bin/java' to provide 'java'.

depending on the architecture installed. That’s it. Now every time “java” is run, either explicitly from the Terminal, or via a Java executable (such as the Eclipse IDE), Ubuntu will use the newly installed /usr/java/64/jre1.6.0_07/bin/java binary as opposed to the binary installed by default. Simple, eh?


written by Hodge \\ tags: ,

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

Update, 17/08/08: There is no longer any need to switch to the Experimental branch, if you are using the following Microdia cameras:

0c45:6027, 0c45:608f, 0c45:60ec, 0c45:60fe, 0c45:60c0, 0c45:613b, 0c45:613c, 0c45:624e, 0c45:624f, 0c45:6242, 0c45:6253, 0c45:6260, 0c45:6270, 0c45:627b, 0c45:8105

Keep up to date on the current supported webcams: http://groups.google.com/group/microdia/web/project-status?hl=en

The webcam (Acer Orbicam) on my Acer Aspire 5052 has been somewhat of a bane - with no drivers available, it has been one of the last stumbling blocks of getting all of my hardware working in Linux (the Ubuntu 8.04 Distro, Hardy Heron, in my case). That is until I ambled across, quite by accident, the Microdia Google Group. These guys are the epitome of Open Source development in action - a group of widely distributed people who are collaborating to solve a common problem: to get the Microdia webcams supported under Linux. And they’re doing a fantastic job so far.

Note: I should first mention that the drivers are still heavily under development, and although they are not (for some webcams) to the point where they can be used for Skype, for example, major progress has been made, and there is now finally communication with my webcam, to the point where I can successfully output video to mplayer. Therefore, this post is not quite yet a HowTo on getting a Microdia webcam fully function, but a step towards helping people installing and testing the drivers under development.

So, here’s how I’ve got to the stage of seeing myself in mplayer…

Information Gathering

Firstly, I had to determine i) whether or not my Webcam was in fact a Microdia camera, and ii) the model number, so in a Terminan, I ran:

lsusb

Which output, amongst other information about the rest of my USB devices:

Bus 003 Device 002: ID 0c45:6260 Microdia

confirming that my Acer Orbicam is a Microdia device. The two hex values 0c45:6260 represent the Vendor ID and Product ID respectively - 0c45 being Microdia, and 6260 the Product itself. In order to create my meagre contribution to the Microdia Group, I had to gather some more information about the device’s bridge and sensor. Firstly, I needed the USB Device Descriptors, which were obtained by running:

sudo lsusb -d 0c45:6260 -v > ~/Desktop/0c45_6260_device_descriptors.txt

I then needed to discover the Bridge and Sensor types, which thankfully could be found in the Windows driver file, snp2std.inf:

%USBPCamDesc% = SN.USBPCamVGA,USB\VID_0c45&PID_6260 ; SN9C201 + OV7670ISP

Which tells me:
Bridge: SN9C201
Sensor: OV7670

The full guide to gathering information for your webcam can be found at the Microdia group, here.

Driver Compiling and Installing

The driver code is controlled by git, which I installed by running:

sudo apt-get install git-core gitk git-gui git-doc curl

Also, before downloading and installing the drivers, I ran:

sudo apt-get install kernel-package linux-source build-essential

To grab the Linux source etc. Once finished, I created a directory to set up my local git repository and downloaded the driver code:

cd ~/Documents
mkdir webcam
cd webcam
git clone http://repo.or.cz/r/microdia.git

The final command executes git, and tells it to clone the remote repository. The files are downloaded to a sub directory called microdia, from which I ran the rest of the commands:

cd microdia

Note: If you have any of the following Microdia cameras, you’ll need to switch to the Experimental branch:

6242, 624e, 624f, 6270, 627b, 62bb, 145f:013d, 045e:00f4

Switch to the Experimental branch by running:

git checkout --track -b v4l2-experimental origin/v4l2-experimental

I then compiled the code:

make

and received this error, but it’s not important:

make: ctags: Command not found
make: *** [ctags] Error 127

Once compiled, the module can be inserted to the kernel for testing:

sudo insmod ./microdia.ko

I also received the following error:

insmod: error inserting ‘microdia.ko’: -1 Unknown symbol in module

so had to run the following first:

sudo modprobe videodev
sudo modprobe compat-ioctl32

and then I could insert the module:

sudo insmod ./microdia.ko

Finally, to test, I ran:

mplayer tv:// -tv noaudio:driver=v4l2:width=640:height=480:outfmt=yuy2:device=/dev/video0:fps=30

you may need to change /dev/video0 to /dev/video1 - also, if you don’t have mplayer, it needs installing:

sudo apt-get install mplayer

The only thing is… it’s currently a mirror image, hehehe:

References

  1. Microdia, Google Group
  2. Full list of currently supported (and unsupported) Microdia Webcams
  3. How to gather information on your webcam
  4. Using git with Microdia
  5. Testing the Microdia driver
  6. PATCH: v4l-experimental support for 6260 (3rd try) Thread

written by Hodge \\ tags: , , ,

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.


written by Hodge \\ tags: , , ,

May 14
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
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.


written by Hodge \\ tags: ,

May 13
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
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.


written by Hodge \\ tags: , , ,

Webloogle Blog Directory