Thursday, December 04, 2008

To-Haves When Using Eclipse (Java development)

  • CloudGarden Jigloo: SWT/Swing GUI builder
  • Tigris Subversion: SVN repositories management (Subclipse is one client for Eclipse)

Tuesday, December 02, 2008

Converting MPEG-4 to MP3

Instructions for Fedora Linux.
Install lame:
> yum install lame

Install FAAD.
You need to compile it. Instructions are in the README.linux file in the source package.

Then you can use this command:
> faad -o - "file.m4a" | lame - "file.mp3"

References
  1. Lame, http://lame.sourceforge.net/
  2. FAAD, http://sourceforge.net/projects/faac/

Monday, September 22, 2008

Ant unable to locate javadoc.exe

The situation: you're launching an Ant build file from within Eclipse on Windoz and the file has a Javadoc task. But Eclipse can't find the executable.

What you need to do is add the JDK bin directory to the PATH environment variable.
There is nothing to configure in Eclipse.

Tuesday, September 09, 2008

Configuring the Class Path When Testing in Eclipse

If you're testing from within Eclipse and are using Apache Commons Logging + log4j and you get the message:
log4j:WARN No appenders could be found for logger

you can let log4j know about the location of the log4j configuration file adding the directory where that file can be found this way:

Right click on the test class and choose Properties --> Run/Debug Settings
Select the file.
Click on Edit and select the Classpath tab.
Select the first item in User Entries, then Advanced, then Add Folders and you're done.

Monday, August 25, 2008

Merging PDFs on Windows

First you need Ghostscript.
Then, you can just issue the command:
> gswin32 -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=merged_file.pdf -dBATCH file_1.pdf file_2.pdf file_3.pdf

What I noticed is that the text in the merged file is a little bigger than the original one at the same magnification although nothing is missing.
Maybe you/we need to tweak a bit with the parameters...

Sunday, August 24, 2008

Dual-boot With Grub After Installing Windows XP on a Linux Machine

Your situation: Windoz will boot but Linux is now invisible.
What you want is to have Grub installed on the Master Boot Record (MBR) of the first disk to pilot the boot sequence.
You need a Linux distribution CD/DVD with the rescue mode as an option. Any distribution is fine even if different from the one you have installed.
  1. Boot in rescue mode
  2. Once you have a shell type:
  3. > fdisk -l
  4. > grub
  5. grub> root (hd0, n)
  6. grub> setup (hd0)
  7. grub> quit
Notes
3. With fdisk -l you can check which partition holds the linux root partition (in case you forgot).
5. If your partition is, for example, /dev/sda2, then your value for n is 1 (Grub starts from 0)

Now you can exit the rescue shell and reboot. If you had a Grub configuration file configured to boot Linux and Windoz, you are done. You will be in the same exact position as before Winsoz zeroed Grub on the MBR.

If you didn't have Windoz before, you need to add to the Grub configuration file the Windoz entry:

title Windoz
root (hd0,m)
makeactive
chainloader +1

where m is the Windoz partition (Grub's way of course, see note above).

Sunday, July 27, 2008

Screen Capture With Mac Keyboard and Windows Desktop

The problem starts on the Mac keyboard: you don't have the prnscr key! But still what you have is a Windoz machine. What is working for me (there are external applications but I couldn't find a good free one) is to open the on-screen keyboard under Programs --> Accessories --> Accessibility. There you have it!
If you have the always-on-top option enabled, you loose control of the physical keyboard and sometimes I had to kill the virtual thing anyway to get back the other one. But I can live with that.

Thursday, July 17, 2008

gpk-application Not Working

I recently had this problem with the gpk-application on a Fedora 9. This Gnome application allows you to check what you have installed and install/remove packages.
The thing was I could not see the groups of packages and update the list from a remote machine. It happened I found out the cache was corrupted and this command:

> yum makecache

restored it to its full functionality.
Almost. I still cannot remotely refresh the list (which I could on the local display) but I think this is another story... permissions maybe.

Tuesday, July 15, 2008

Linux Graphical FTP Client

I recently switched to gFTP, the FTP client from Gnome, after I apparently encountered problems connecting to a couple sites with Kasablanca (from KDE). One was that the client could not display the content of a remote directory no matter what I did.
I must say that gFTP is more solid and it did not have those glitches. I personally recommend it at this time.

Wednesday, May 28, 2008

Linux Toolbox: pdftk

(from the man page) If PDF is electronic paper, then pdftk is an electronic staple-remover, hole-punch, binder, secret-decoder-ring, and X-Ray-glasses. Pdftk is a simple tool for doing everyday things with PDF documents. Use it to:
  • Merge PDF Documents
  • Split PDF Pages into a New Document
  • Rotate PDF Documents or Pages
  • Decrypt Input as Necessary (Password Required)
  • Encrypt Output as Desired
  • Fill PDF Forms with X/FDF Data and/or Flatten Forms
  • Generate FDF Data Stencil from PDF Forms
  • Apply a Background Watermark or a Foreground Stamp
  • Report PDF Metrics such as Metadata and Bookmarks
  • Update PDF Metadata
  • Attach Files to PDF Pages or the PDF Document
  • Unpack PDF Attachments
  • Burst a PDF Document into Single Pages
  • Uncompress and Re-Compress Page Streams
  • Repair Corrupted PDF (Where Possible)
Get it on Fedora:
> yum install pdftk

Note Unfortunately pdftk was removed from the Fedora repository due to a license issue that prevented it from being used in nuclear facilities. Yeah, right. Okay. Whatever!
You have to recompile it from the sources or... grab the final product from someone who already did it: Professor Kriehn's Fedora Repository!

Tuesday, May 27, 2008

Exporting the Graphical Display

If you need to open a graphical application on a Linux box A and see it on another one B (i.e. exporting the DISPLAY) there is one easy way if you log in from B to A with SSH:

> ssh -X -Y user@host.domain

Then you can start a graphical application on A from the remote session on B and see the output on B.

Monday, May 12, 2008

Installing Linux on the Sony Vaio PCG FX-220

I bought this notebook in August 2001. I will never buy a Sony again despite the pros for the following reasons:
  • Bad user support. If you have a problem, you have to pay to be able to speak with a Sony representative.
  • A memory slot had a problem which prevented it to be used. This is a common issue ([1]) with this series and Sony did nothing to fix that.
  • The CD/DVD reader broke in 2007 (I have a Fujitsu notebook from 1996 which is still perfectly working).
Anyways, for the last reason and the fact that I needed to reinstall from scratch recently, I needed to go with boot diskettes and a network installation. Debian 4.0 was the easiest choice from a first overview (I had already installed Debian a few years ago on this notebook).

Installation
  1. You need the boot, root and network-drivers-1 diskettes.
  2. Start at the boot with: expert hw-detect/start_pcmcia=false
  3. After that, installation starts. It might hang (it did with me) but it's a network timeout problem. Retry with a different mirror.
  4. At the end of the installation, LILO and Grub won't install. Skip that step.
  5. To reboot, use the boot diskette with the following parameters: rescue root=/dev/hda1 (replace with your settings). Load the drivers, networks-drivers-1 and 2 diskettes this time (might not be necessary but it might save your time).
  6. Log in as root. Install Grub: apt-get install grub.
  7. Configure Grub automatically creating its configuration file.
  8. Reboot.
  9. Start in single user mode because the default X.org configuration file won't work.
  10. Edit the X.org configuration file manually removing all references to screen resolutions above 1024x768 and above 16bpp (TODO to be verified, 24bpp might work)
  11. Reboot.
  12. Check that the network parameters are correctly set.
Components

USB: working out of the box.

Useful Links

Tuesday, May 06, 2008

Logitech Quickcam Pro 4000 on Linux

This post is about using a Logitech Quickcam Pro 4000 on Linux (Fedora 8) to store snapshots and producing a movie.

# Install xawtv (xawtv-3.95-7.fc8)
> yum install xawtv

# Install mencoder (mencoder-1.0-0.90.rc2.lvn8 from the livna repository)
> yum install mencoder

The xawtv package contains tools which allow you to connect to the webcam, grab pictures and videos on the fly and also produce movies from the snaps.

# Check that the webcam is recognized and broadcasting:
> xawtv -c /dev/video0 &

/dev/video0 : the device (use xawtv -hwscan to see which one it is for you)

# You can grab pictures in two ways with xawtv: using webcam or using streamer.

# grab snapshots using streamer
> streamer -c /dev/video0 -j 85 -t 1200 -r 0.03 -o office-0000.jpeg

/dev/video0 : the device
85 : JPEG quality
1200 : number of snapshots to grab
0.03 : frames per second (here it's about 1 snap every 30 seconds)
office-0000.jpeg : output file with counter to accomodate 4 digits here

# grap snapshots using webcam
> webcam webcam.conf

All configuration is read from file. My webcam.conf is:

[grab]
device = /dev/video0
text = Atlanta GA - %Y-%m-%d %H:%M:%S
#infofile = infofile.txt
fg_red = 255
fg_green = 255
fg_blue = 255
width = 320
height = 240
delay = 30
wait = 0
#input = camera
brightness = 100
#norm = pal
rotate = 0
top = 0
left = 5
bottom = -1
right = -1
quality = 85
trigger = 0
once = 0
archive = office-%Y%m%d-%H%M%S.jpg

TODO Explanation to follow...

# make movie using mencoder (you can also use streamer but I didn't try it yet)
> mencoder "mf://${CURR_DATE}/*.jpg" -msglevel all=-1 -mf fps=12:type=jpg -ovc lavc -lavcopts vcodec=mpeg4:trell:mbd=2:dc=10 -oac copy -o "movie_${CURR_DATE}.avi"

... to be continued

Wednesday, April 30, 2008

Fedora Extras @ livna

rpm.livna.org provides many useful packages that can not be distributed in Fedora (previously known as Fedora Core and Extras) for one reason or another, including multimedia applications.

rpm.livna.org is not a standalone repository, but an extension of Fedora, Fedora Core and Extras repositories.

To add livna Fedora 8 packages to your list of repositories:
> rpm -ihv http://rpm.livna.org/livna-release-8.rpm

Tuesday, April 29, 2008

Installing Xine on Fedora 8

This procedure details the installation using the available prepackaged RPMs. The trick is that they're not all in the same place!

Install the main xine libraries (available from the main Fedora repositories):
> yum install xine-lib

Grab the main package and dependencies from RPM Find [1] and RPM pbone.net [2]:
  1. xine (xine-0.99.5-1.fc7.i386.rpm) [1]
  2. xine-lib-moles (xine-lib-moles-1.1.11.1-1.fc8.i386.rpm) [1]
  3. vcdimager (vcdimager-0.7.23-7.fc8.i386.rpm [2]
  4. libdvdcss (libdvdcss-1.2.9-2.fc7.i386.rpm) [1]
  5. libfame (libfame-0.9.1-12.fc7.i386.rpm) [1]
  6. libmad (libmad-0.15.1b-4.fc7.i386.rpm) [1]
Note that on Fedora 8 you need the above version of xine-lib-moles for compatibility with xine-lib.

Install them directly with rpm to avoid the need of disabling yum's signature check:

> rpm -ihv libdvdcss-1.2.9-2.fc7.i386.rpm libfame-0.9.1-12.fc7.i386.rpm libmad-0.15.1b-4.fc7.i386.rpm vcdimager-0.7.23-7.fc8.i386.rpm xine-0.99.5-1.fc7.i386.rpm xine-lib-moles-1.1.11.1-1.fc8.i386.rpm

Another way is to add livna to your list of repositories and do a:
> yum install xine

Didn't try this though...

Thursday, April 17, 2008

Java and Firefox 3 Beta 5 on Linux

This post is about configuring Java with Firefox 3 beta 5 on Linux i386. It might work for similar versions of Java and Firefox though.
The JRE coming with JSE v1.6.0_03 is currently not working. BUT the one coming with JSE v1.5.0_08 does work!
You just need to follow the usual instructions (which can be found here) and create a symbolic link the the Java plugin library:

> cd ${FIREFOX_HOME}/plugins
> ln -s ${JAVA_HOME}jre/plugin/i386/ns7/libjavaplugin_oji.so libjavaplugin_oji.so

Restart Firefox and check at this URL: about:plugins if it's loaded and here if it works.

Note: Actually "works" is perhaps a little bit of an overstatement. I found out an applet which is supposed to update itself with streaming data and is not doing it. So maybe it's a matter of waiting on Firefox's final version...
On the other side Firefox 3 is much much faster and less memory consuming than Firefox 2.

Tuesday, March 18, 2008

Verifying Which Ports Are Listening

The most reliable way is to use a port scanner like nmap.
You can install nmap in a blink of an eye on a Red Hat system (Fedora included) with yum install nmap or rpm -ihv if you have the package or in many other ways lasting a little bit longer than the blink of an eye.

Then issue:

> nmap -sT -O localhost

Reference: Red Hat Linux Manual v9