12/31/07

gusty firefox + google toolbar = hang

I love google toolbar and it's my number one online bookmark for a long time. After upgrade to gusty I feel that my firefox is not stable as it use to be. My firefox is freeze on some site that try to open second window. I'm not sure what's wrong firefox or toolbar but I know that after uninstall toolbar the problem gone. [to uninstall go to "Settings" > "Help" > "Uninstall" option on toolbar]
Now I need something to replace google toobar jobs. Not too hard to find this.
"Firefox Google Bookmark" for bookmarks. After install this extensions your firefox will has new menu "GBookmarks". below is screenshot

Another thing i need is gmail notifyer, there are many firefox extension and linux apps can do this job. For me i choose checkgmail.

pnix@pnix-a7n:~$ sudo aptitude install checkgmail
Reading package lists... Done
Building dependency tree
...
Building tag database... Done
pnix@pnix-a7n:~$

note: for now look like checkgmail from repos has problem about authorization. If you have a problem, go to get latest version from svn should fix it.
wget http://checkgmail.svn.sourceforge.net/viewvc/*checkout*/checkgmail/checkgmail
sudo mv checkgmail /usr/bin/
sudo chmod +x /usr/bin/checkgmail

Thanks to hotweiss from ubuntuforums for the trick.


Last, Happy new year 2008. :D

12/27/07

using cron to execute sqlscript in oracle

Using cron to run sql script is a good idea to apply with a periodic database job. When running any scripts, cron doesn't know any environment variable. So, in the script, we always
-use full path with execute command.
-define all environment variable.

ex. to see data in customer table in oracle database and log in customer_rpt.log, I create sql script[testsc1.sql] like this

[oracle@oracle1 ~]$ cat testsc1.sql
spool /home/oracle/customer_rpt.log
select * from customer;
quit;
[oracle@oracle1 ~]$


next create shell script file to run sql script file.
[oracle@oracle1 ~]$ cat mydbshell.cron
#!/bin/bash
ORACLE_HOME=/u01/app/oracle/product/10.1.0/db_1; export ORACLE_HOME;
ORACLE_SID=my_sid; export ORACLE_SID;
/u01/app/oracle/product/10.1.0/db_1/bin/sqlplus user/password @/home/oracle/testsc1.sql
[oracle@oracle1 ~]$
note that oracle_home, oracle_sid variable must be defined and sqlplus command called with full path.

Now, we define new cron job by 'crontab -e' in console and make it look like this[this is only example you need to modify it as you wish. to learn more about crontab type 'more crontab' ]
[oracle@oracle1 ~]$ crontab -l
0 4 * * * /home/oracle/mydbshell.cron
[oracle@oracle1 ~]$

12/22/07

sopcast on gutsy


To celebrate liverpool winning today[not yet but I'm so sure :D],this post will show you how to watch tv on gutsy. First goto sopcast download page and get these two rpm files, qsopcast-0.3.5-2mgc.i686.rpm and sp-sc-1.0.2-1mgc.i686.rpm.
Then to convert rpm packages to deb we need alien

pnix@pnix-a7n:sopcast$ sudo aptitude install alien
[sudo] password for pnix:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
Building tag database... Done
The following NEW packages will be automatically installed:
libbeecrypt6 libneon25 librpm4 rpm
The following NEW packages will be installed:
alien libbeecrypt6 libneon25 librpm4 rpm
0 packages upgraded, 5 newly installed, 0 to remove and 0 not upgraded.
Need to get 1911kB of archives. After unpacking 6488kB will be used.
Do you want to continue? [Y/n/?] y
...
Building tag database... Done
pnix@pnix-a7n:sopcast$

now convert them to deb packages and install
pnix@pnix-a7n:sopcast$ ls
qsopcast-0.3.5-2mgc.i686.rpm sp-sc-1.0.2-1mgc.i686.rpm
pnix@pnix-a7n:sopcast$ sudo alien -k *
qsopcast_0.3.5-2mgc_i386.deb generated
sp-sc_1.0.2-1mgc_i386.deb generated
pnix@pnix-a7n:sopcast$ sudo dpkg -i *deb
Selecting previously deselected package qsopcast.
(Reading database ... 119336 files and directories currently installed.)
Unpacking qsopcast (from qsopcast_0.3.5-2mgc_i386.deb) ...
Selecting previously deselected package sp-sc.
Unpacking sp-sc (from sp-sc_1.0.2-1mgc_i386.deb) ...
Setting up qsopcast (0.3.5-2mgc) ...
Setting up sp-sc (1.0.2-1mgc) ...
pnix@pnix-a7n:sopcast$

That's it. Now goto "Applications/Intenet/qsopcast" and have fun

12/19/07

color your nano

nano editor is no syntax highlight for any language by default. It is only black and white as in the picture below.

To enable syntax highlight, you can uncomment the line [# include "/usr/share/nano/ruby.nanorc"]in /etc/nanorc[for global effect]. Or if you just want this effect to your user only. create ~/.nanorc and include default[sample] language specific config file from /usr/share/nano. Here is my java syntax highlight .nanorc file

include "/usr/share/nano/java.nanorc"

11/30/07

export db in hibernate3 ant

I try the example in "Hibernate Quickly" ebook and found that using SchemaExportTask to export database in build.xml file is not work in hibernate3. In hibernate3, export database done by use annotations like this

<target name="schema-export" >
<taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" classpathref="schema.classpath" />
<hibernatetool destdir="${sql.dir}">
<annotationconfiguration configurationfile="${src.java.dir}/hibernate.cfg.xml" />
<hbm2ddldir}/hibernate.cfg.xml"
drop="true"
create="true"
export="true"
outputfilename="helloworld-ddl.sql"
delimiter=";"
format="true"/>
</hibernatetool>
</target>

thanks, Jon Rose for howto.

note1: transaction support in mysql need "TYPE=InnoDB" when create the table.
note2: InnoDB support begin with mysql4.0. In old version like 3.23 need to add this code in my.cnf [/etc/mysql/my.cnf or /etc/my.cnf in FC3].

[mysqld]
innodb_data_file_path=ibdata1:500M


Now to add "type=InnoDB" in generated script, Dialect property in hibernate.cfg.xml must be
<property name="dialect">
org.hibernate.dialect.MySQLInnoDBDialect
</property>

11/14/07

Install win32 codecs for mplayer in Ubuntu Gutsy

If you have trouble in playing media file, stream [like me] may be this will help. Today I try open video stream with mplayer and get no sound. So I go to run mplayer from terminal and get errors about codecs below

pnix@pnix-a7n:progdl$ mplayer mms://61.47.35.66/NTTV
MPlayer 2:1.0~rc1-0ubuntu13 (C) 2000-2006 MPlayer Team
CPU: AMD Athlon(tm) (Family: 6, Model: 8, Stepping: 1)
CPUflags: MMX: 1 MMX2: 1 3DNow: 1 3DNow2: 1 SSE: 1 SSE2: 0
...
Opening video decoder: [dmo] DMO video codecs
Win32 LoadLibrary failed to load: wmv9dmod.dll, /usr/lib/win32/wmv9dmod.dll, /usr/local/lib/win32/wmv9dmod.dll
IMediaObject ERROR: 0x8773d96 could not open DMO DLL (0x0 : 0)
Failed to create DMO filter
ERROR: Could not open required DirectShow codec wmv9dmod.dll.
You need to upgrade/install the binary codecs package.
Go to http://www.mplayerhq.hu/dload.html
VDecoder init failed :(
Opening video decoder: [dmo] DMO video codecs
Win32 LoadLibrary failed to load: wmvdmod.dll, /usr/lib/win32/wmvdmod.dll, /usr/local/lib/win32/wmvdmod.dll
IMediaObject ERROR: 0x8773d96 could not open DMO DLL (0x0 : 0)
Failed to create DMO filter
ERROR: Could not open required DirectShow codec wmvdmod.dll.
You need to upgrade/install the binary codecs package.
Go to http://www.mplayerhq.hu/dload.html
VDecoder init failed :(
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Selected video codec: [ffwmv3] vfm: ffmpeg (FFmpeg M$ WMV3/WMV9)
==========================================================================
==========================================================================
Forced audio codec: mad
Opening audio decoder: [dmo] Win32/DMO decoders
Win32 LoadLibrary failed to load: wmspdmod.dll, /usr/lib/win32/wmspdmod.dll, /usr/local/lib/win32/wmspdmod.dll
IMediaObject ERROR: 0x8773d96 could not open DMO DLL (0x0 : 0)
ERROR: Could not open required DirectShow codec wmspdmod.dll.
ADecoder preinit failed :(
ADecoder init failed :(
Opening audio decoder: [dshow] Win32/DirectShow decoders
Win32 LoadLibrary failed to load: wmavds32.ax, /usr/lib/win32/wmavds32.ax, /usr/local/lib/win32/wmavds32.ax
Warning: DS_Filter() could not open DirectShow DLL. (DLL=wmavds32.ax, r=0x8ae1eb0)
ERROR: Could not open required DirectShow codec wmavds32.ax.
ADecoder preinit failed :(
ADecoder init failed :(
Cannot find codec for audio format 0xA.
Read DOCS/HTML/en/codecs.html!
Audio: no sound
Starting playback...
VDec: vo config request - 320 x 240 (preferred colorspace: Planar YV12)
VDec: using Planar YV12 as output csp (no 0)
Movie-Aspect is undefined - no prescaling applied.
VO: [xv] 320x240 => 320x240 Planar YV12
V:40148.2 803/803 4% 0% 0.0% 0 0 25%

So we need codecs files, go to mplayer download page and get correct package for the system[x86, AMD64 or whatever, the file will name as essential-xxx.tar.bz2]. Then unpack it and move all file to /usr/lib/win32 folder. Now try it again.
pnix@pnix-a7n:progdl$ mplayer mms://61.47.35.66/NTTV
MPlayer 2:1.0~rc1-0ubuntu13 (C) 2000-2006 MPlayer Team
CPU: AMD Athlon(tm) (Family: 6, Model: 8, Stepping: 1)
...
Opening video decoder: [dmo] DMO video codecs
Creating new registry
DMO dll supports VO Optimizations 0 1
DMO dll might use previous sample when requested
GetOutput r=0x0 size:230400 align:1
StreamCount r=0x0 1 1
Decoder supports the following formats: YV12 YUY2 UYVY YVYU RGB8 RGB555 RGB565 RGB24 RGB32
Decoder is capable of YUV output (flags 0x1b)
VDec: vo config request - 320 x 240 (preferred colorspace: Packed YUY2)
VDec: using Planar YV12 as output csp (no 0)
Movie-Aspect is undefined - no prescaling applied.
VO: [xv] 320x240 => 320x240 Planar YV12
Selected video codec: [wmv9dmo] vfm: dmo (Windows Media Video 9 DMO)
==========================================================================
==========================================================================
Forced audio codec: mad
Opening audio decoder: [dmo] Win32/DMO decoders
GetOutput r=0x0 size:8192 align:1
StreamCount r=0x0 1 1
AUDIO: 8000 Hz, 1 ch, s16le, 8.0 kbit/6.25% (ratio: 1000->16000)
Selected audio codec: [wma9spdmo] afm: dmo (Windows Media Audio 9 Speech DMO)
==========================================================================
AO: [alsa] 48000Hz 1ch s16le (2 bytes per sample)
Starting playback...
gnome_screensaver_control().462 ct: -1.063 2329/2329 3% 0% 4.0% 8 0 3%

10/23/07

pnix report on gutsy

I start upgrading to Gutsy on last Friday night with slow speed. Estimate time to finish package download is vary from 3 hours to 2 days depend on speed it get at that time so I just go to bed and come back again on Saturday 11AM. Downloading is finished it waiting for my response to config some package to install. After that it reboot and try to startx first time and fail!!
It ask me to config my display.Monitor are detected correctly[dell 1905FP] but resolution only give me 800x600. I go to Graphic Card tab, the driver said vesa. At this point if I go to choose nvidia or nv x will fell to failsafe xserver and reconfig my xorg.conf to use vesa driver.
Checking on Xorg.0.log I saw my old friend. "The NVIDIA kernel module does not appear to be receiving interrupts". Nvidia driver is installed but on Gutsy my "acpi=off irqpoll" kernel option doesn't seem to work anymore. I stumble many kernel option for three days and last night I found that for my gutsy it need to be "nolapic irqpoll" :)
Now I've got my 3D back, compiz-fusion is already installed[sure from official repos.] and work fine. I found that wine is on universe repos too that great.
So, for me gutsy does it's job. The graphic card irq problem is seem to be my specific motherboard bios problem and will be come back everytime i upgrade or install ubuntu.

Note : On Gutsy, compizfusion-config-manager is not installed by default. To get it

pnix@pnix-a7n:~$ sudo aptitude install compizconfig-settings-manager
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
Building tag database... Done
The following NEW packages will be automatically installed:
python-compizconfig
The following NEW packages will be installed:
compizconfig-settings-manager python-compizconfig
0 packages upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 540kB of archives. After unpacking 3486kB will be used.
...
Writing extended state information... Done
Building tag database... Done
pnix@pnix-a7n:~$

10/18/07

I change my mind...


Look like everyone try to upgrade now, maybe I should be patient and wait for one or two days. Update-manager has a hard time to connect to server. I have 1M adsl but download upgrade tool give me 7KB/S.

Prepare the box before get Gutsy

Gutsy is already released now. It should be better to have original updated Feisty before upgrading. I mean no software from 3rd party repos. What I have are wine, fm2007[under wine] and compiz-fusion. First uninstall FM2007 leave me some menu entry that i need to manually delete it. I will post about this later. Afterthat i remove wine then compiz-fusion. Compiz-fusion set has a few packages installed and I can't remember the names what i do is ..

pnix@pnix-a7n:~$ echo "sudo aptitude remove "`sudo dpkg -l |egrep compiz| awk '{print $2}'`|sudo bash
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
Building tag database... Done
The following packages will be REMOVED:
compiz compiz-core compiz-fusion-plugins-extra compiz-fusion-plugins-main compiz-fusion-plugins-unofficial
compiz-fusion-plugins-unsupported compiz-gnome compiz-plugins compizconfig-settings-manager
libcompizconfig-backend-gconf libcompizconfig0 python-compizconfig
0 packages upgraded, 0 newly installed, 12 to remove and 0 not upgraded.
Need to get 0B of archives. After unpacking 24.2MB will be freed.
Writing extended state information... Done
(Reading database ... 113410 files and directories currently installed.)
Removing compiz ...
Removing compiz-fusion-plugins-unsupported ...
Removing compiz-fusion-plugins-unofficial ...
Removing compiz-fusion-plugins-extra ...
Removing compiz-fusion-plugins-main ...
Removing compizconfig-settings-manager ...
Removing compiz-plugins ...
Removing compiz-core ...
Removing compiz-gnome ...
Removing libcompizconfig-backend-gconf ...
Removing python-compizconfig ...
Removing libcompizconfig0 ...
pnix@pnix-a7n:~$

Now update packages again 'sudo aptitude update' and 'sudo aptitude upgrade'. Last reinstall ubuntu-desktop that removed when compiz-fusion installed.
pnix@pnix-a7n:~$ sudo aptitude install ubuntu-desktop
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
Building tag database... Done
The following NEW packages will be automatically installed:
compiz compiz-core compiz-gnome compiz-gtk compiz-plugins freeglut3 libglut3
The following NEW packages will be installed:
compiz compiz-core compiz-gnome compiz-gtk compiz-plugins desktop-effects freeglut3 libglut3 ubuntu-desktop
0 packages upgraded, 9 newly installed, 0 to remove and 0 not upgraded.
Need to get 692kB of archives. After unpacking 4145kB will be used.
Do you want to continue? [Y/n/?] y
Writing extended state information... Done
Get:1 http://th.archive.ubuntu.com feisty/main compiz-core 1:0.3.6-1ubuntu13 [143kB]
Get:2 http://th.archive.ubuntu.com feisty/main compiz-plugins 1:0.3.6-1ubuntu13 [269kB]
Get:3 http://th.archive.ubuntu.com feisty/main compiz-gtk 1:0.3.6-1ubuntu13 [61.8kB]
Get:4 http://th.archive.ubuntu.com feisty/main compiz-gnome 1:0.3.6-1ubuntu13 [35.0kB]
Get:5 http://th.archive.ubuntu.com feisty/main compiz 1:0.3.6-1ubuntu13 [26.9kB]
Get:6 http://th.archive.ubuntu.com feisty/main desktop-effects 0.7.1-0ubuntu4 [33.1kB]
Get:7 http://th.archive.ubuntu.com feisty/main freeglut3 2.4.0-5 [84.0kB]
Get:8 http://th.archive.ubuntu.com feisty/main libglut3 3.7-25 [21.5kB]
Get:9 http://th.archive.ubuntu.com feisty/main ubuntu-desktop 1.43 [18.1kB]
. ...

Setting up libglut3 (3.7-25) ...
Setting up ubuntu-desktop (1.43) ...
pnix@pnix-a7n:~$

Now I'm ready to go for Gutsy. manual here

10/15/07

VM crash on Feisty

During use netbeans5.5 to create webapps. I insert table and suddenly netbeans crash. It generate error log[hs_err_pidxxxx.log] in my home dir and here is it said.

#
# An unexpected error has been detected by Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0xb51b8d5a, pid=5417, tid=3025587088
#
# Java VM: Java HotSpot(TM) Client VM (1.6.0-b105 mixed mode, sharing)
# Problematic frame:
# C [libmawt.so+0x81d5a]
#
# If you would like to submit a bug report, please visit:
# http://java.sun.com/webapps/bugreport/crash.jsp
#

Few months ago, I add "AWT_TOOLKIT=MToolkit" to fix blank window problem in swing application when enable "Desktop Effect" and now look like java hotspot has problem with MToolkit too:(
"AWT_TOOLKIT=XToolkit" fix the problem but i will get blank window under compiz-fusion. So for now my solution is no eye-candy when use java apps.

10/11/07

Gutsy Gibbon

It's about a week from today that Gutsy[ubuntu 7.10] will come out. I read through new feature in beta version and feel enthusiastic to see the change.

- new gnome2.2, it's new feature here.
- compiz fusion will be in official repos. that good, on feisty i use third party repos. and sometime got error when updating for last few weeks.
- ntfs writing enable. i rarely need to write file on ntfs partition, anyway it may be useful.
- automatic printer installation, this will be great for other[I have no printer at my house]

I really hope that my hardware[athlonXP1700+,512DDR,fx6200 and A7N8X-E] can run gutsy with 3D effect smoothly.:)

10/6/07

Avidemux on ubuntu feisty

Video editing on ubuntu will be not too hard, thanks for Nathan's comment in last post that remind me about avidemux.
On feisty you can find avidemux from multiverse repos.

pnix@pnix-a7n:~$ sudo aptitude install avidemux
Password:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
Building tag database... Done
The following NEW packages will be automatically installed:
lame libfaad2-0 libmjpegtools0c2a libmozjs0d libnspr4-0d libquicktime0 mjpegtools toolame
The following NEW packages will be installed:
avidemux lame libfaad2-0 libmjpegtools0c2a libmozjs0d libnspr4-0d libquicktime0 mjpegtools toolame
0 packages upgraded, 9 newly installed, 0 to remove and 0 not upgraded.
Need to get 5403kB of archives. After unpacking 13.8MB will be used.
Do you want to continue? [Y/n/?] y
...

Setting up toolame (02l-3) ...
localepurge: Disk space freed in /usr/share/locale: 224K
pnix@pnix-a7n:~$

with avidemux, all you need to do is just open video file, select 'auto' menu and choose which format you want, click save that's it. I choose VCD then it's auto apply two filters for me [scaling,add black border]. Ofcourse you can add more filter if you want.


Update:
Note: encoding ~50 mins 688x384 avi file to mpg with athlon xp 1700+, avidemux take 44 mins but mencoder take only 17 mins!!!.

10/3/07

Encoding avi to mpg with mencoder

I just finish downloading japanese series from bittorrent, Nodame Cantabile. 12 avi files are now on my disk. I need to covert it to mpg before burn to vcd. After searching, look like mencoder is a good choice do this job. let try.

pnix@pnix-a7n:~$ sudo aptitude install mencoder
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
Building tag database... Done
The following NEW packages will be installed:
mencoder
0 packages upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 3557kB of archives. After unpacking 8946kB will be used.
Writing extended state information... Done
Get:1 http://security.ubuntu.com feisty-security/multiverse mencoder 2:1.0~rc1-0ubuntu9.1 [3557kB]
Fetched 3557kB in 4m54s (12.1kB/s)
Selecting previously deselected package mencoder.
(Reading database ... 113732 files and directories currently installed.)
Unpacking mencoder (from .../mencoder_2%3a1.0~rc1-0ubuntu9.1_i386.deb) ...
Setting up mencoder (1.0~rc1-0ubuntu9.1) ...
pnix@pnix-a7n:~$

I'm not an expert in video editing, anyway thanks for document from mplayerhq that give me a very very long command.
mencoder -oac lavc -ovc lavc -of mpeg -mpegopts format=xvcd -vf scale=352:196,expand=352:240,harddup -srate 44100 -af lavcresample=44100 -lavcopts     vcodec=mpeg1video:keyint=18:vrc_buf_size=327:vrc_minrate=1152:vbitrate=1152:vrc_maxrate=1152:acodec=mp2:abitrate=224 -ofps 30000/1001 -o n01.mpg N*01.avi

scaling:
meaning of many option are mostly standard for 'NTSC VCD' format except scaling option that depend on original file resolution. 352x240 is resolution of NTSC VCD but my original avi res. is 688x384 so it need to scale and add black border to meet requirement. In my 'scale=352:196' 196 is came from 352x384/688.

first trying i got many error like this
mpg123: Can't rewind stream by 17 bits!:   0min   0mb  A-V:0.030 [0:0]
mpg123: Can't rewind stream by 36 bits!: 0min 0mb A-V:0.039 [0:0]
mpg123: Can't rewind stream by 18 bits!: 0min 0mb A-V:0.046 [0:0]
mpg123: Can't rewind stream by 22 bits!: 0min 0mb A-V:0.049 [0:0]
mpg123: Can't rewind stream by 12 bits!: 0min 0mb A-V:0.052 [0:0]

the trick is i need to add '-ac mad' to specify decoder in that command and here is the result.

9/26/07

Enable Nvidia AGP Fast Writes and Side Band Addressing on ubuntu Feisty

Today I found tutorial about turn on AGP Fast Writes and Side Band Addressing on nvidia graphic card that not enable by default[ my SBA is already enable, don't know why? ]. Even I'm not sure what it for? I guess it's something that increase 3D performance. Anyway I still want to enable it if my card can support. Since last time I play with my graphic card, my status is

pnix@pnix-a7n:~$ cat /proc/driver/nvidia/agp/status
Status: Enabled
Driver: NVIDIA
AGP Rate: 8x
Fast Writes: Disabled
SBA: Enabled

First check that your card and motherboard are support by
pnix@pnix-a7n:~$ cat /proc/driver/nvidia/agp/card
Fast Writes: Supported
SBA: Supported
AGP Rates: 8x 4x
Registers: 0xff000e1b:0x1f004302
pnix@pnix-a7n:~$ cat /proc/driver/nvidia/agp/host-bridge
Host Bridge: PCI device 10de:01e0
Fast Writes: Supported
SBA: Supported
AGP Rates: 8x 4x
Registers: 0x1f00421b:0x00000302
pnix@pnix-a7n:~$

or there is the newer way
pnix@pnix-a7n:~$ cat /proc/driver/nvidia/registry
VideoMemoryTypeOverride: 1
EnableVia4x: 0
EnableALiAGP: 0
NvAGP: 3
ReqAGPRate: 15
EnableAGPSBA: 0
EnableAGPFW: 0

SoftEDIDs: 1
Mobile: 4294967295
ResmanDebugLevel: 4294967295
FlatPanelMode: 0
DevicesConnected: 0
RmLogonRC: 1
VbiosFromROM: 0
ModifyDeviceFiles: 1
DeviceFileUID: 0
DeviceFileGID: 0
DeviceFileMode: 438
RemapLimit: 0
UseCPA: 4294967295
DetectPrimaryVga: 1
SaveVBios: 0
EnableBrightnessControl: 0
PanelPWMFrequency: 1018
PanelBrightnessLimits: 65280
RMEdgeIntrCheck: 1
pnix@pnix-a7n:~$

now my current frame rate is about
pnix@pnix-a7n:~$ glxgears -info
GL_RENDERER = GeForce 6200/AGP/SSE/3DNOW!
GL_VERSION = 2.1.0 NVIDIA 96.31
GL_VENDOR = NVIDIA Corporation
GL_EXTENSIONS = GL_ARB_color_buffer_float GL_ARB_depth_texture GL_ARB_draw_buffers
.
.
GL_SGIS_generate_mipmap GL_SGIS_texture_lod GL_SGIX_depth_texture GL_SGIX_shadow GL_SUN_slice_accum
8405 frames in 5.0 seconds = 1680.943 FPS
8117 frames in 5.0 seconds = 1623.218 FPS
7256 frames in 5.0 seconds = 1451.083 FPS
8248 frames in 5.0 seconds = 1649.593 FPS
7872 frames in 5.0 seconds = 1574.323 FPS
7993 frames in 5.0 seconds = 1598.514 FPS
8243 frames in 5.0 seconds = 1648.591 FPS
8300 frames in 5.0 seconds = 1659.995 FPS
6721 frames in 5.0 seconds = 1344.161 FPS
8324 frames in 5.0 seconds = 1664.768 FPS
8337 frames in 5.0 seconds = 1667.350 FPS
8479 frames in 5.0 seconds = 1695.651 FPS

To turn on those two option you need to edit '/etc/modprobe.d/nvidia-kernel-nkc' file. Open it with your favorite text editor and make it look like this.
alias char-major-195* nvidia
options nvidia NVreg_EnableAGPFW=1 NVreg_EnableAGPSBA=1

then reboot.
After it come back on, I can't see noticable change. except
pnix@pnix-a7n:~$ cat /proc/driver/nvidia/agp/status
Status: Enabled
Driver: NVIDIA
AGP Rate: 8x
Fast Writes: Enabled
SBA: Enabled

ref: original howto on gentoo-wiki

9/22/07

Resurrect my old ide disk

I've got the problem with my old ide harddrive fews day ago. At last i found that it's ide cable is bad and that destroy the partition table. Anyway today after recover and backup the files, I create new partition table with fdisk and here is the new table.

Disk /dev/hda: 60.0 GB, 60022480896 bytes
16 heads, 63 sectors/track, 116301 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes

Device Boot Start End Blocks Id System
/dev/hda1 1 58130 29297488+ 7 HPFS/NTFS
/dev/hda2 58131 116301 29318184 83 Linux
50/50 ntfs and ext3 should be fair :). After repartition, Ubuntu know only hda1 as 10GB partition[my old config]. what i forget? May be need to fotmat it first. I'm not sure how to format ntfs partition in ubuntu so i reboot to winxp, format it then turn back to ubuntu again. Now I format hda2 like this.
pnix@pnix-a7n:~$ sudo mke2fs -j /dev/hda2
mke2fs 1.40-WIP (14-Nov-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
3670016 inodes, 7329546 blocks
366477 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=0
224 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000

Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 33 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
pnix@pnix-a7n:~$
Last thing add 2 new partition to fstab to let it automount.First create mount point with 'sudo mkdir /media/hda2'[hda1 already exist] then find the uuid and edit /etc/fstab like this.
# /dev/hda1
UUID=9EF07DDDF07DBBD9 /media/hda1 ntfs defaults,nls=utf8,umask=007,gid=46 0 1
# /dev/hda2
UUID=30bf1301-3dbd-47f0-b80e-b68047358a53 /media/hda2 ext3 defaults 0 1
After reboot hda2 is mounted but no write permission for me, still has other thing to fix. I follow this guide and run command below
pnix@pnix-a7n:~$ sudo chgrp plugdev /media/hda2
pnix@pnix-a7n:~$ sudo chmod g+w /media/hda2
pnix@pnix-a7n:~$ sudo chmod +t /media/hda2
to change group, add write permission and sticky bit. And that it my old ide disk is come back and ready for command.

note: "chmod +t" adds the sticky bit, so that people can only delete their own files and sub-directories in a directory

9/19/07

ssl+apache2 feisty

This will be part2 of my setting up apache2 on feisty[part1 here]. As I remember to enable ssl on apache first we need to run 'apache2-ssl-certificate' to create certificate file. But apache2-ssl-certificate is not come with apache2 package in feisty so the procedure need little change.
First, create 'ssl' dir in '/etc/apache2' and create cert. file with 'make-ssl-cert'.

pnix@pnix-a7n:~$ sudo mkdir /etc/apache2/ssl
Password:
pnix@pnix-a7n:~$ sudo make-ssl-cert /usr/share/ssl-cert/ssleay.cnf /etc/apache2/ssl/apache2.pem
pnix@pnix-a7n:~$

Enable ssl module.
pnix@pnix-a7n:~$ sudo a2enmod ssl
Module ssl installed; run /etc/init.d/apache2 force-reload to enable.
pnix@pnix-a7n:~$

Add "Listen 443" to /etc/apache2/ports.conf.
pnix@pnix-a7n:~$ echo "Listen 443" | sudo tee -a /etc/apache2/ports.conf
Listen 443
pnix@pnix-a7n:~$

Create ssl site
pnix@pnix-a7n:~$ sudo cp /etc/apache2/sites-available/default /etc/apache2/sites-available/ssl
pnix@pnix-a7n:~$

edit /etc/apache2/sites-available/ssl by adding bold character like this
NameVirtualHost *:443
<VirtualHost *:443>
ServerAdmin webmaster@localhost
SSLEngine on
SSLCertificateFile /etc/apache2/ssl/apache2.pem

.
</VirtualHost>

and for /etc/apache2/sites-available/default
NameVirtualHost *:80
<VirtualHost *:80>
.
</VirtualHost>

Now enable ssl site by
pnix@pnix-a7n:~$ sudo a2ensite ssl
Site ssl installed; run /etc/init.d/apache2 reload to enable.
pnix@pnix-a7n:~$

Last thing is restart apache2 and ssl should work.

9/16/07

Better way to manage services in Ubuntu with rcconf

I want to prevent apache2 from autostart but update-rc.d is not let me do that. Look like update-rc.d is only for install and remove scripts[ not for update ].

pnix@pnix-a7n:~$ ls /etc/rc2.d
README S20hotkey-setup S89cron
S05vbesave S20makedev S90binfmt-support
S10powernowd.early S20nvidia-kernel S91apache2
S10sysklogd S20privoxy S98usplash
S10xserver-xorg-input-wacom S20rsync S99acpi-support
S11klogd S20tor S99rc.local
S12dbus S50acpid S99rmnologin
S13gdm S89anacron S99stop-readahead
S20apport S89atd
pnix@pnix-a7n:~$ sudo update-rc.d apache2 stop 91 0 1 2 6 .
System startup links for /etc/init.d/apache2 already exist.
pnix@pnix-a7n:~$
rcconf, the debian runlevel configuration tool, is more suit for this job. Let's install and run it from teminal.
pnix@pnix-a7n:~$ sudo aptitude install rcconf
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
Building tag database... Done
The following NEW packages will be installed:
rcconf
0 packages upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 18.2kB of archives. After unpacking 115kB will be used.
Writing extended state information... Done
Get:1 http://th.archive.ubuntu.com feisty/universe rcconf 1.19 [18.2kB]
Fetched 18.2kB in 0s (20.3kB/s)
Selecting previously deselected package rcconf.
(Reading database ... 113711 files and directories currently installed.)
Unpacking rcconf (from .../archives/rcconf_1.19_all.deb) ...
Setting up rcconf (1.19) ...
pnix@pnix-a7n:~$ sudo rcconf
rcconf give easy interface to select which service should start in current run level.

9/15/07

Apache2 web server on Feisty

Apache2 installation on feisty is just one line 'sudo aptitude install apache2'.

pnix@pnix-a7n:~$ sudo aptitude install apache2
Password:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
Building tag database... Done
The following NEW packages will be automatically installed:
apache2-mpm-worker apache2-utils apache2.2-common libapr1 libaprutil1
The following NEW packages will be installed:
apache2 apache2-mpm-worker apache2-utils apache2.2-common libapr1 libaprutil1
0 packages upgraded, 6 newly installed, 0 to remove and 0 not upgraded.
.
.
Setting up apache2-mpm-worker (2.2.3-3.2ubuntu0.1) ...

* Starting web server (apache2)...
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName [ OK ]

Setting up apache2 (2.2.3-3.2ubuntu0.1) ...
pnix@pnix-a7n:~$
I fix the “Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
” warning message by add “ServerName <myservername>” to '/etc/apache2/apache2.conf'.
Another thing is apache use 127.0.1.1 instead of 127.0.0.1. In '/etc/hosts' file it has a line state that
127.0.1.1 <myservername>
I just change 127.0.1.1 to 127.0.0.1.
Now try to restart apache2 again. The warning message will be gone.
pnix@pnix-a7n:~$ sudo apache2 -k restart
Password:
pnix@pnix-a7n:~$


Note: I just know that the address 127.0.0.1 to 127.255.255.254 are all loopback address.

Now for php
pnix@pnix-a7n:www$ sudo aptitude install php5
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
Building tag database... Done
The following NEW packages will be automatically installed:
apache2-mpm-prefork libapache2-mod-php5 php5-common
The following packages will be automatically REMOVED:
apache2-mpm-worker
The following NEW packages will be installed:
apache2-mpm-prefork libapache2-mod-php5 php5 php5-common
The following packages will be REMOVED:
apache2-mpm-worker
0 packages upgraded, 4 newly installed, 1 to remove and 0 not upgraded.
Need to get 3184kB of archives. After unpacking 6324kB will be used.
Do you want to continue? [Y/n/?] y
.
.
Creating config file /etc/php5/apache2/php.ini with new version

* Forcing reload of web server (apache2)... [ OK ]



Setting up php5 (5.2.1-0ubuntu1.4) ...

pnix@pnix-a7n:www$

Time to test
Now I will create the most popular php testing script in the world, yes, phpinfo(). Use any text editor create a file called phptest.php that have one line '' then move it to web root directory[/var/www by default]. Open web browser and goto 'http://myservername/phptest.php'. If everything is ok you should see something like this.

Ubuntu kill your hard drive???

I've got a problem with my desktop box again and look like it's happen periodically [every 5 months I think]. In the box, I have two hard drives. The new one, sata, is installed as dual boot disk, feisty and xp and another is 5 years old ide. I use it to store some unimportance files. Yesterday I start up ubuntu and can't mount the old one. It made some noise at boot time but this is nothing weird, It's sound terrible like this every day. The difference is this time it can't mount.

Until now I still not sure my old ide is bad. Almost parts in the box are almost 5 years old, it can die at anytime. Maybe it's power supply, I don't know, it run at least 5 hours a day everyday for almost five years. Anyway my main SATA still healthy.

I found this thread on ubuntuforums, he said ubuntu kill his laptop drive.

This is because upon power off, the kernel sends the FLUSH CACHE message to the disk to flush the disk write cache, which cause it to spin up. Then it suddenly shuts down making no call to the STANDBY signal to make the disk stop. The result is that the hdd keeps spinning as the power is off. Modern hdd's (yours, if it works after rebooting), can prevent such damage by taking the head off the disk surface just after power down so it does not hurt the disk in such situation. This is called an emergency unload. Technical specifications say doing this instead of the regular standby can reduce the drive's life time by about a rate of thrity (30) times. The symptoms of this is a weird noise upon shutdown (power off). It is like a "pop"!


It's sound like it's laptop only bug and thanks for Martin Koßler for his shutdown disk scripts.
Simply write a file at "/etc/rc0.d/S00hdd-shutdown-workaround" which includes this two lines:

#!/bin/sh
echo 1 > /sys/class/scsi_disk/0\:0\:0\:0/stop_on_shutdown

If you have more than one directory at "/sys/class/scsi_disk/" try to find out which of it is your internal harddisk (e.g. "cat /sys/class/scsi_disk/a:b:c:d/device/model") If you have more than one harddisk add another line for each of them.

Then make it executable ("chmod +x filename")
At the next shutdown it should park the hd heads.

9/10/07

Bad version number in .class file

I need a new free java server because myjavaserver.com, free host that i use for along time has a problem. My friend tell me to check out eatj.com, another free java host. I think it's great for doing a test. I just register for a free account and upload my testing web app to it. Testing my first apps give me "Bad version number" as you see below.

javax.servlet.ServletException: Bad version number in .class file
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:273)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

I guess these caused by eatj.com tomcat is running with j2se 1.5 but I compile my servlet with j2se 1.6.
Anyway, the problem is easily solve by recompile with option -target 1.5.

9/6/07

3D Windows, Cube Atlantis and more effects for Compiz Fusion on Ubuntu Feisty


When I looked at others screenshot posted on the web I noticed that some have window float off the cube when rotating. I love it and looking for what effect to do like that. Someone on ubuntuforums said "just enable 3D windows effect" but my "compizconfig setting manager" didn't has that effect to enable :(. or others said "it's for beryl only" that hard to believe. I try to search for plugin package and found that I miss two of four plugins packages, unofficial and unsupported[on tuxfamily.org]. Pick the leftover packages.

pnix@pnix-a7n:~$ sudo aptitude install compiz-fusion-plugins-unofficial compiz-fusion-plugins-unsupported
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
Building tag database... Done
The following NEW packages will be installed:
compiz-fusion-plugins-unofficial compiz-fusion-plugins-unsupported
0 packages upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 139kB of archives. After unpacking 532kB will be used.
Writing extended state information... Done
Get:1 http://download.tuxfamily.org feisty/eyecandy compiz-fusion-plugins-unofficial 0.0.2~git20070902+3v1ubuntu0 [92.1kB]
Get:2 http://download.tuxfamily.org feisty/eyecandy compiz-fusion-plugins-unsupported 0.5.2~git20070831+3v1ubuntu1 [47.1kB]
Fetched 139kB in 5s (24.4kB/s)
Selecting previously deselected package compiz-fusion-plugins-unofficial.
(Reading database ... 113055 files and directories currently installed.)
Unpacking compiz-fusion-plugins-unofficial (from .../compiz-fusion-plugins-unofficial_0.0.2~git20070902+3v1ubuntu0_i386.deb) ...
Selecting previously deselected package compiz-fusion-plugins-unsupported.
Unpacking compiz-fusion-plugins-unsupported (from .../compiz-fusion-plugins-unsupported_0.5.2~git20070831+3v1ubuntu1_i386.deb) ...
Setting up compiz-fusion-plugins-unofficial (0.0.2~git20070902+3v1ubuntu0) ...
Setting up compiz-fusion-plugins-unsupported (0.5.2~git20070831+3v1ubuntu1) ...
pnix@pnix-a7n:~$
As you see pic on the right, now in my "CompizConfig Setting Manager" two more effects are added, 3D Windows and Cube Atlantis. Actually it has more added to other section but I can not remember which one are new.

8/26/07

Momo scores the 7000th league goal for Reds

Momo Sissoko scores his first goal for liverpool after playing 75 games. It's also the 7000th league goal for the club since Malcolm McVean got the first goal a century ago.
Yesterday [actually it's few hours ago] at the stadium of light, Liverpool got 2-0 won over Sunderland from Sissoko in 37th minute then confirmed by Andriy Voronin at almost the end of game. Very very good start for this season.

8/20/07

More secure your ssh server with public/private keys

To add more secure on ssh server it's good idea to make our server allow only user who has a key to login. Today I found this trick from ubuntuforums.

Gen the keys: First, on client box, we generate keys pair and copy the public key file to server box.

[poj@client ~]$ ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (/home/poj/.ssh/id_dsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/poj/.ssh/id_dsa.
Your public key has been saved in /home/poj/.ssh/id_dsa.pub.
The key fingerprint is:
38:58:74:7b:4c:5a:11:d7:70:de:c0:41:c2:93:c4:b9 poj@client
[poj@client ~]$ ls .ssh
id_dsa id_dsa.pub known_hosts
[poj@client ~]$ scp .ssh/id_dsa.pub poj@192.168.1.122:./id_dsa.pub
poj@192.168.1.122's password:
id_dsa.pub 100% 598 0.6KB/s 00:00
[poj@client ~]$
During key gen., we will be asked for place to save the key. Just enter for default, then for passpharse, we enter a strong password. This will generate keys pair file [id_dsa and id_dsa.pub] in $HOME/.ssh .

Install the key: In your $HOME, on server box, cat our publickey file to $HOME/.ssh/authorized_keys
[poj@client ~]$ ssh -l poj 192.168.1.122
poj@192.168.1.122's password:
Last login: Mon Aug 20 16:49:38 2007 from 192.168.1.73
[poj@server ~]$ cat id_dsa.pub >> .ssh/authorized_keys
[poj@server ~]$


Config the server: Next on server box go to edit /etc/ssh/sshd_config by change or add this two lines then restart ssh service.
PasswordAuthentication no
UsePAM no


Now, try to ssh again
[poj@client ~]$ ssh -l poj 192.168.1.122
Enter passphrase for key '/home/poj/.ssh/id_dsa':
Last login: Mon Aug 20 17:54:11 2007 from 192.168.1.69
[poj@server ~]$
Notice that this time it ask for passphrase not password
for other client box, ssh request will be denied.
[poj@client2 ~]$ ssh -l poj 192.168.1.122
Permission denied (publickey,gssapi-with-mic).
[poj@client2 ~]$

8/13/07

Customize icons on ubuntu desktop

One thing I want to do for a long time is remove mounted partition icons that default show on my ubuntu desktop. Nothing wrong with those icons, it's just too many icons and some I never go to browse into it. Now what to do. Open gconf-editor by hit [Alt+F2] and type gconf-editor. Go to apps->nautilus->desktop then check out "volume_visible".

You can also customize others as you want like adding computer and trash icon to your desktop.

8/12/07

Add truetype fonts on X client side

The pdf file [as I understand] encapsulate text, images and fonts so it should give me same result on any os. Many of pdf files I have are generated on windows and use windows fonts. When I open these files with evince [default document viewer] some can't render fonts correctly because windows fonts aren't embedded and not exist on ubuntu too.
What I need to do is make application has correct fonts to use. There are two places that we can add fonts, the first is on server[Xserver] side and the second is on client side. Here I choose second choice by copy fonts required by the document from windows to $HOME/.fonts then caching new fonts by run command 'fc-cache -fv .fonts'. Below is result after adding fonts.

pnix@pnix-a7n:~$ ls .fonts
ANGSAB.TTF ANGSA.TTF ANGSAUI.TTF ANGSAUZ.TTF timesbd.ttf timesi.ttf
ANGSAI.TTF ANGSAUB.TTF ANGSAU.TTF ANGSAZ.TTF timesbi.ttf times.ttf
pnix@pnix-a7n:~$ fc-cache -fv .fonts
/home/pnix/.fonts: caching, 12 fonts, 0 dirs
/var/cache/fontconfig: not cleaning unwritable cache directory
/home/pnix/.fontconfig: cleaning cache directory
fc-cache: succeeded
pnix@pnix-a7n:~$

8/8/07

package utility command in linux

Have you ever want to know Where is the files go when you install any package? or What package this file belong to? This post is about some package utility command that I've use many time but never remember.

To list all files in the package.

dpkg -L package-name

rpm -ql package-name


To find out which package[ we installed ] contains this file.
dpkg -S file

rpm -qf file


To list installed package.
dpkg -l

rpm -qa


To find out which package[ we not installed ] contains this file.
apt-file search file

yum whatprovides file

Many situations in linux that you're complained about missing some library file to do something. Use this command to find the required package.

8/6/07

No window border, window title in compiz-fusion

Update I just found that this problem is about xorg.conf. After add code below it gone

Section "Extensions"
Option "Composite" "Enable"
EndSection


-------------------
Sometime when enable compiz-fusion with
compiz --replace

Window border will disappear and it's not comeback after restart X or even restart system[in my case]. To bring window border back, Alt-F2 then type
metacity --replace

Don't know why but it's work beleive me. After run this command your desktop will have no 3D effect, now you can try enable compiz again.

8/4/07

Bygfoot the Football Manager game on linux

Long long time ago when I'm university student, one popular game on computer I've played is Championship Manager. At that time it's no 3D graphic only color bar to show stat of attack, defend percentage and comentary text. Today during surf the net I found bygfoot that remind me of the old football manager game.
To install
On ubuntu, I search repos and found that it's there. so nothing to do just type 'sudo aptitude install bygfoot'.

pnix@pnix-a7n:~$ apt-cache search bygfoot
bygfoot - soccer (football) manager game featuring the most important European leagues
pnix@pnix-a7n:~$ sudo aptitude install bygfoot
Password:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
Building tag database... Done
The following NEW packages will be installed:
bygfoot
0 packages upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 1519kB of archives. After unpacking 5923kB will be used.
Writing extended state information... Done
Get:1 http://th.archive.ubuntu.com feisty/universe bygfoot 2.0.1-1ubuntu2 [1519kB]
Fetched 1519kB in 1m30s (16.7kB/s)
Selecting previously deselected package bygfoot.
(Reading database ... 112069 files and directories currently installed.)
Unpacking bygfoot (from .../bygfoot_2.0.1-1ubuntu2_i386.deb) ...
Setting up bygfoot (2.0.1-1ubuntu2) ...

localepurge: Disk space freed in /usr/share/locale: 560K
pnix@pnix-a7n:~$

First match
In the game, you can selling and buying players, improving the stadium, sharing revenue to improve youth, setting rate for scout and physio.

Due to copyright, trademark or something current version don't use real player names, to get it need to run update script. It will ask for your definitions dir, give '$HOME/.bygfoot/definitions'.
pnix@pnix-a7n:~$ bygfoot-update

bygfoot-update: A bash script keeping your Bygfoot Football Manager up-to-date.
Version 2.0.1.
See the file UPDATE for some more information.
Call bygfoot-update -h|--help for usage information.


** b-u: checking for sed... ok
** b-u: checking for tar... ok
** b-u: checking for bzip2... ok
** b-u: checking for wget... ok
** b-u: checking for patch... ok
** b-u: checking for cvs... failed

** WARNING: Didn't find working cvs, maybe it's not in your PATH.
** WARNING: You might not be able to use all bygfoot-update features.

** b-u: checking for zenity... 2.18.1 found.
** b-u: User input: 2

** b-u: User input: /home/pnix/.bygfoot/definitions


** b-u: Country dir set to
** b-u: /home/pnix/.bygfoot/definitions

** b-u: Fetching official team names and
** b-u: team definitions files.
+ Adding official names to italy...
+ Adding official names to germany...
+ Adding official names to england...
+ Adding official names to wales...
+ Adding official names to ireland...
.
.


After update ,as liverpool manager, I've got real name players like Gerrard, Carragher . But data is not up to date I still have Baros, Morientes, Hamann, Biscan and others. Not all team are updated, For england, data update available only teams in this list.
pnix@pnix-a7n:teams$ ls team_england_*.xml
team_england_barnsley.xml team_england_leicester.xml
team_england_blackpool.xml team_england_liverpool.xml
team_england_bournemouth.xml team_england_luton.xml
team_england_bradford.xml team_england_millwall.xml
team_england_brentford.xml team_england_norwich.xml
team_england_brighton.xml team_england_plymouth.xml
team_england_bristolc.xml team_england_preston.xml
team_england_burnley.xml team_england_qpr.xml
team_england_cardiff.xml team_england_reading.xml
team_england_coventry.xml team_england_sheffieldu.xml
team_england_crewe.xml team_england_sheffieldw.xml
team_england_crystal.xml team_england_southampton.xml
team_england_derby.xml team_england_stoke.xml
team_england_hull.xml team_england_watford.xml
team_england_ipswich.xml team_england_wolves.xml
team_england_leeds.xml
pnix@pnix-a7n:teams$

Anyway you can edit or add any data for your favorite team by yourself[ all files will locate at $HOME/.bygfoot/definitions/teams]. Game running is very fast , You don't need to wait for a long time to play next match. I think this is another choice if you don't want to play FM on ubuntu with wine.

7/31/07

My choice for music player on ubuntu.

Today I'm looking for mp3 player for my ubuntu. Feisty come with rhythmbox but after few months using I think it's time to try something better. Rhythmbox does not let me edit idv3 tags and [for me]it's hard to manage library so it's not acceptable. All I wants are

a) idv3 tags must editable. This is important for me because some of my mp3 collection don't have info in tags or some have a wrong info.

b) full support thai language.

c) gtk+ application will be good.
I found this blog [http://onlyubuntu.blogspot.com/2007/03/media-players-available-for-ubuntu.html] list some media players in ubuntu. I choose some to try[all are easy to install in Feisty just 'sudo aptitude install <packagename>']

Beep Media Player is like xmms. If I'm not wrong I think the project is stop now.

Amarok come with great interface, full of features but it's KDE app so it's need some other kde package to install and run.

Exaile, like KDE's Amarok but it's GTK+ and written in Python. It almost be my choice but it has a problem with my language e.g. the library manager can not add mp3 file to collection when artist and album tag are thai langauge.


At last Listen is my choice, interface just like other gtk apps, does everything amarok and exaile can do, idv3 tags editing, ipod management, information from wikipedia, lyrics search, webradio, lastfm, download album cover. Even I feel Amarok still better in editing multitrack tags, burning CD and browsing collection but listen does it's job and I try to avoid to use kde in gnome.

7/28/07

convert mp3 id3 tags to unicode.

The problem about playlist on media player are unreadable when it use thai character. This is caused by different encoding used in id3 tags and in media player. Id3 tags use cp874[don't know why] but in current linux distribution, player use unicode. This will not be a problem if tags are english characters that cp874 and unicode has the same value e.g. 'A' is '0x41' for cp874 and '0x0041' for unicode, but not for thai character.

To correct thai character in playlist. There is a script to convert 1-byte charsets to unicode[download] by Kopats Andrei.
Now what to do:
1. download the script. You'll get 'tag2utf.py'.
2. install requirement software

sudo apt-get install python-eyed3

3. in the script, looking for charsets = {'cp1251':'c','koi8-r':'k' } and replace with your language encoding[ for thai change it to charsets = {'tis-620':'t' } ]
Now we ready to convert mp3 tags. run script by 'tag2utf.py <mp3 dir>' it will convert id3 tags of all files in specify directory include sub directory. Below is the result.


resource [in thai]
http://wiki.ubuntuclub.com/wiki/Tag2utf
http://linuxtip.blogspot.com/2007/02/id3-tag-part-ii.html

7/25/07

uhh.. I got hacked

Yesterday, In the morning my boss tell me to looking at the router. It blinks like it'll going to blow up. Something in our network use almost 60% of my bandwidth. I look around and see that network light on the acient small box on the floor blinks too. It's a secondhand computer from japan and I almost forget it.

On that box,I install dapper server,postfix,courier,mysql and use it as a mail server with no firewall. poor me. :(

This is first time I got hacked(as I know hah ha). I've no idea what to do first. I go to check /var/log/auth.log and found many ssh attack. 'who' give me two users online, me and test1[the hacker]. 'top' show that user test1 run tons of ssh-scan process. I can't remember that did I create that test1 user myself or the hacker do a dictionary attack, found my password then create test1 user. What I do at that time is restart computer, delete test1 user then create a firewall.

Then I go to ubuntuforums and found this thread. It look like my case and from his .bash_history look like the hacker going to /var/tmp, download a file.tgz that contain hiden directory 1.user 2.user ssh-scan... So I go back to check my box and here is what i found on my email server.

pnix@xxx:~$ ls -a /var/tmp
. .. fast .PA PA.tgz
pnix@xxx:~$ ls -a /var/tmp/.PA
. 191.20.pscan.22 191.83.pscan.22 217.20.pscan.22 gen-pass.sh pass_file pscan2 ssh-scan vuln.txt
.. 191.21.pscan.22 217.10.pscan.22 common go.sh pico ss start
pnix@xxx:~$ ls -a /var/tmp/fast
. 1.user 3.user checkmech fast go LinkEvents m.help m.lev m.ses .m.set.swp src
.. 2.user Andy.seen configure genuser httpd Makefile mkindex m.pid m.set r Vipuletz.seen
pnix@xxx:~$

It's look almost the same files. On that thread many one said go to reinstall this box can't trust anymore. Yes, I agree but not now I will prepare the new one first with full secure as I can.

Since yesterday lunch until now there five or six attempts to attack my mail server. From many places include the test1 user[I know his ip address] but no success[my firewall's job not too bad]. :)

7/24/07

Manage services on ubuntu

To add/remove service in ubuntu. Manually you can put init script in /etc/init.d then create symbolic link from /etc/rc?.d/S[NN]name or K[NN]name to /etc/init.d/scriptname.[S for start and K for stop]
In ubuntu has a tool to manage init scripts call update-rc.d. For example if you want to start serviceA in runlevel 2 3 4 5 with sequence number 18 and stop in runlevel 0 1 6 with sequence number 99 use the command.[the scriptA must already create in /etc/init.d]

pnix@pnix-a7n:~$ sudo update-rc.d serviceA start 18 2 3 4 5 . stop 99 0 1 6


In redhat base linux, i use chkconfig do the same thing. For more detail try 'man chkconfig'.

7/22/07

Clean up your ubuntu box

After running the system for a long time. Today I found few things I should do to clean the box.

First clean the old package files in cache, When you do "sudo aptitude update|upgraed|install", the packages will be downloaded to your local disk[ locate at /var/cache/apt/archives/ ] then installed. If you try ls that directory you will see how many packages you've download. To prevent these cache from growing we should remove some outdated package by

pnix@pnix-a7n:~$ sudo apt-get autoclean
Password:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Del compizconfig-settings-manager 0.1.0+git20070717~3v1ubuntu0 [461kB]
Del libcompizconfig-backend-gconf 0.1+git20070709~3v1ubuntu0 [29.5kB]
.
.
Del libdecoration0 1:0.5.1+git20070706~3v1ubuntu1 [2401B]
pnix@pnix-a7n:~$


next install localepurge. [These package will remove all locale in your system except what you choose to keep]
pnix@pnix-a7n:~$ sudo aptitude install localepurge

it will open package configuration for select language you want to use on your system. I select all en,de,pt and th.

another thing is orphaned libraries[ the packages that no longer use]. To find orphaned packages we need a tool.
pnix@pnix-a7n:~$ sudo aptitude install deborphan

Now to use it, just type "deborphan" in terminal then orphaned packages will be listed and you can remove it with "aptitude purge <package>".
pnix@pnix-a7n:~$ deborphan
libglut3
pnix@pnix-a7n:~$ sudo aptitude purge libglut3
Password:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
Building tag database... Done
The following packages will be REMOVED:
libglut3{p}
0 packages upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
Need to get 0B of archives. After unpacking 49.2kB will be freed.
Do you want to continue? [Y/n/?] y
Writing extended state information... Done
(Reading database ... 109118 files and directories currently installed.)
Removing libglut3 ...
localepurge: Disk space freed in /usr/share/locale: 21704K
localepurge: Disk space freed in /usr/share/man: 3168K

Total disk space freed by localepurge: 24872K

pnix@pnix-a7n:~$

or if you want one line command try this.
sudo deborphan | xargs sudo apt-get -y remove --purge

7/18/07

Directive tag in more details

From last post about tag in jsp. This post is about directive tag in more details. Directive tag can devide into three types e.g. page, include and taglib

<%@ directive attribute="value" %>

page directive: page directive will provide the information about the page for jsp engine to compile that page.
Below are some importance attributes of page directive :
language tells the engine about language that the page is using.
usage: <%@ page language="java" %>

extends tell jsp engine that this page will extend from specify class.
usage: <%@ page extends="test.myclass" %>

import used to import any class to use in our jsp page. We can use comma(,) to import more than one packages.
usage: <%@ page import="java.sql.*,mypackage.myclass" %>

session="true|false", default is true so jsp pages are session enable.
usage: <%@ page session="true" %>

buffer, control buffer usage for that jsp page.
usage: <%@ page buffer="none" %>

autoFlush="true|false", if true will automatic clear when buffer is full.
usage: <%@ page autoFlush="true" %>

isThreadSafe="true|false", if true, jsp engine will create new thread for every concurrent request.
usage: <%@ page isThreadSafe="true" %>

errorPage tell the server that which page to go when got un-handled exceptions in the page.
usage: <%@ page errorPage="error.jsp" %>

more than one directives can be used by separate by space.
usage: <%@ page language="java" session="true" contentType="text/html;charset=ISO-8859-1" %>

include directive: include is used to include content in another file into the jsp page. You can use it for header or footer of the page.
<% include file="file to include" %>

usage: <%@ include file="/header.jsp" %>

taglib directive:
next in jsp tag series

7/14/07

wine0.9.40 and utorrent1.7 on win2000 mode get black screen

Today I upgrade utorrent[sure on feisty] from 1.6 to 1.7 then restart utorrent. This upgrading cause unused parts of uTorrent's window are black. That's annoying me.


After some searching, look like it wine bug, I run with wine 0.9.40, the newest one. The black window area will happen when use in mode < winxp. So if you have the same problem, setting "windows version"[by run winecfg] to winxp will fix it.

7/11/07

JSP TAGS

JSP is the html page that add java code[called JSP tags] into it.
JSP tags can be devided into 6 different types. These are:
Comment tag use to add comment.

<% --comment here-- %> or <! --comment here-- >

Declarations tag use to define the variables,methods or classes to use in the JSP page.
<%!
Declaration1;
Declaration2;
%>

Scriplets tag use to insert java statements.
<%
Statement 1;
Statement 2;
Statement n;
%>

Expressions tag use to print out any data on the page. These data are automatically converted to string.
<%=[Value] or [Expression]%>

Directives tag is used for many purposes depend on directive and attribute in tag. there are three directives page, include and taglib.
<%@ directive attribute="value" %>

Action tag is use to transfer control to other server objects[ex. pages] or perform operations on other objects.
<jsp:action attributes />

action tag has three types e.g. include,forward and usebean.

7/8/07

Compiz Fusion on Fiesty

Two weeks ago, I read on ubuntuforums and found this thread about how to get compiz fusion work on ubuntu fiesty. It show you clearly step by step how to. Today I'm just decide to try and it's real amazing. 3D Cube and many effect feel smoother than the old compiz from repos.
It's work on my asus n6200td 128M card, my memory is 512M, athlon xp 1700+ and A7N8X-E mobo. Compiz fusion still development version but for me it's very very very stable. So I urge you to try it now.

Compiz Fusion is merging of compiz and beryl project. It's not on feisty repos yet but may be on Gutsy Gibbon.

Using HttpURLConnection

Usually when I want to make a request over network in java I familiar to use Socket class like this.

Socket theSock = new Socket(server,port);
PrintStream ps = new PrintStream(theSock.getOutputStream());

then uses ps.println() to send a request and uses theSock.getInputStream() to reciece response to see everything that sent over output stream. But this maybe not suitable for all situation.

Talking with web server will be done through HTTP message[request,response] that consists of header and body. So to make a post,get http request [with Socket class]
//Post
ps.println("POST uri HTTP/1.1");
ps.println("Content-Length: "+body.length());
ps.println("Content-Type: "+contenttype);
ps.println();
ps.println(body);

//or Get
ps.println("GET uri HTTP/1.1");
ps.println("Connection: Close");
ps.println();

and web server will responds with HTTP response like. Here's the example.
HTTP/1.1 200 OK
Date: Wed, 04 Jul 2007 10:14:54 GMT
.
Content-Length: 7
Connection: close
Content-Type: text/html

body

With this format it's hard to manage if we get the reponse via getInputStream() of Socket instance. How about Cookie or Session? or actual data in body. If the response is in xml format and we try to parse it like this
SAXBuilder builder = new SAXBuilder();
Document doc = builder.build(theSock.getInputStream());

It will throw "SAXException: Parsing Error : The root element is required in a well-formed document".
Instead of using using Socket class that saw only bits transfer over the network. HttpURLConnection class will alows us to read parameters in header and data in body. see the code.
//to make HTTP Post request with HttpURLConnection
URL url = new URL("http://server/uri");
HttpURLConnection conn = (HttpURLConnection)url.openConnection();

then set some properties and make a request
conn.setRequestMethod("POST");
conn.setAllowUserInteraction(false); // no user interact [like pop up]
conn.setDoOutput(true); // want to send
conn.setRequestProperty( "Content-type", "text/xml" );
conn.setRequestProperty( "Content-length", Integer.toString(contentx.length()));
OutputStream ost = conn.getOutputStream();
PrintWriter pw = new PrintWriter(ost);
pw.print(body); // here we "send" our body!
pw.flush();
pw.close();

for Get Exam just change setRequestMethod to conn.setRequestMethod("GET").

To get body,cookie or other header parameter of HTTP response
int i=1;// this will print all header parameter
String hKey;
while ((hKey=conn.getHeaderFieldKey(i))!=null){
String hVal = conn.getHeaderField(i);
System.out.println(hKey+"="+hVal);
i++;
}
//and InputStream from here will be body
conn.getInputStream()


note: some time http get need to pass some parameter value, url to create in new URL("url") will end with something like field1=value1&field2=value2... This url must be encode with static method URLEncoder.encode(String) first.

7/2/07

3DES/Base64 encryption in java

Last week I need to post data in xml format to one server. For security reason one node[xml] require 3DES encryption and encode to Base64 before send. It's a good idea to encrypt sensitive data before store in database or transfer over internet but I'm not even know what 3DES is. After some search, I found that it's not too hard.

This post is about how i encrypt data in java. 3DES algorithm use symetric key[secret key] to encrypt or decrypt data. So..

First define a key [ length must be 24 bytes ]. I do this by getBytes() from random string.

byte [] seed_key = (new String("er48nsjhwlG593mjhgdb20ih")).getBytes()

create Cipher object
SecretKeySpec keySpec = new SecretKeySpec(seed_key,"TripleDES");
Cipher nCipher=Cipher.getInstance("TripleDES");
nCipher.init( Cipher.ENCRYPT_MODE, keySpec );

Cipher class provides the functionality of a cryptographic cipher for encryption and decryption. To create cipher object, pass transformation to getInstance method.
Transformation can be in form like "algorithm/mode/padding" or only "algorithm".
for 3DES, algorithm can be "DESede" or "TripleDES". In experiment both give me the same result so I specify only algorithm as "TripleDES".

Now encrypt plaintext and get our cipher bytes by
String plaintxt="My SECRET WORD";
byte[] cipherbyte = cipher.doFinal(plaintxt.getBytes());

From cipher bytes. Our text is encrypted. To be easy to manage[send over internet or store in db] I will transform it with Base64[package from commons codec]
String encodeTxt = new String(Base64.encodeBase64(rawbyte));

Now decryption is just reverse the things we do for encryption, getBytes() from encodeTxt, decode with Base64 class, and doFinal() will give you decrypt text.
Note that for decryption, cipher object will init in DECRYPT_MODE.
nCipher.init( Cipher.DECRYPT_MODE, keySpec );
byte [] encData = Base64.decodeBase64(encodeTxt.getBytes());
decryptedtxt = nCipher.doFinal(encData);

6/28/07

vsftpd restrict access

If you run vsftp as your ftp server, may be you want to config
in /etc/vsftpd/vsftpd.conf

To disable anonymous ftp logins, change anonymous_enable to NO [Default: YES]

anonymous_enable=NO

To jail some user in their home dir uncomment two following line [Default: NO]
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd/chroot_list
and put a list of user [to be jailed] in /etc/vsftpd/chroot_list.
Note that if chroot_local_user set to YES, meaning of list will be a list that not to be jailed.

To jail all user in their home dir, add chroot_local_user=YES [Default: NO]
chroot_local_user=YES

6/22/07

True transparent Tilda Terminal on Ubuntu Feisty

On Feisty Fawn, Compiz [a compositing window manager that uses 3D graphics acceleration via OpenGL] will be installed by default. This provides effects and features on desktop environment like Desktop Effect. This post is about how to install tilda terminal and make it real transparent on ubuntu Feisty.


You must be already installed nvidia driver and enabled the "Desktop Effect" function.
First download tilda source package and install other packages to satisfy the build dependencies of tilda source

pnix@pnix-a7n:~/build$ apt-get source tilda
Reading package lists... Done
Building dependency tree
Reading state information... Done
Need to get 133kB of source archives.
Get:1 http://th.archive.ubuntu.com feisty/universe tilda 0.09.4-0ubuntu2 (dsc) [662B]
Get:2 http://th.archive.ubuntu.com feisty/universe tilda 0.09.4-0ubuntu2 (tar) [126kB]
Get:3 http://th.archive.ubuntu.com feisty/universe tilda 0.09.4-0ubuntu2 (diff) [6782B]
Fetched 133kB in 1s (95.7kB/s)
gpg: Signature made Wed 24 Jan 2007 08:08:51 AM ICT using DSA key ID C88ABDA3
gpg: Can't check signature: public key not found
dpkg-source: extracting tilda in tilda-0.09.4
dpkg-source: unpacking tilda_0.09.4.orig.tar.gz
dpkg-source: applying ./tilda_0.09.4-0ubuntu2.diff.gz
pnix@pnix-a7n:~/build$ sudo apt-get build-dep tilda
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
build-essential cdbs debhelper docbook-xsl g++ g++-4.1 gettext html2text intltool-debian libatk1.0-dev libc6-dev
libcairo2-dev libconfuse-dev libconfuse0 libexpat1-dev libfontconfig1-dev libfreetype6-dev libglib2.0-dev
.
.
Setting up build-essential (11.3) ...
pnix@pnix-a7n:~/build$
Now you should have directory name tilda-0.09.4 in your current directory.
Next create dir name patches under tilda-0.09.4/debian, download a tilda transparency patch for 0.09.4 from here and move it to patches dir, change it's extension to .patch.
pnix@pnix-a7n:~/build$ mv tiltilda-0.09.4-real-transparency.patch_.txt tilda-0.09.4/debian/patches/tilda-0.09.4-real-transparency.patch

Under tilda-0.09.4 dir build deb package by type 'dpkg-buildpackage -rfakeroot'. maybe you have this error[like me].
/usr/bin/dpkg-buildpackage: 212: fakeroot: not found

it's mean you need fakeroot package too. Install it.
pnix@pnix-a7n:~/build/tilda-0.09.4$ sudo aptitude install fakeroot
Password:
Reading package lists... Done
.
The following NEW packages will be installed:
fakeroot
0 packages upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 99.4kB of archives. After unpacking 397kB will be used.
Writing extended state information... Done
Get:1 http://th.archive.ubuntu.com feisty/main fakeroot 1.5.10ubuntu2 [99.4kB]
Fetched 99.4kB in 8s (11.7kB/s)
Selecting previously deselected package fakeroot.
(Reading database ... 107534 files and directories currently installed.)
Unpacking fakeroot (from .../fakeroot_1.5.10ubuntu2_i386.deb) ...
Setting up fakeroot (1.5.10ubuntu2) ...

pnix@pnix-a7n:~/build/tilda-0.09.4$

Now we're ready to build. Do it again.
pnix@pnix-a7n:~/build/tilda-0.09.4$ dpkg-buildpackage -rfakeroot
dpkg-buildpackage: source package is tilda
dpkg-buildpackage: source version is 0.09.4-0ubuntu2
dpkg-buildpackage: source changed by Áron Sisak
dpkg-buildpackage: host architecture i386
dpkg-buildpackage: source version without epoch 0.09.4-0ubuntu2
fakeroot debian/rules clean
test -x debian/rules
test "`id -u`" = 0
.
.

It's a good idea to change version before 'dpkg-buildpackage' to prevent autoupdate try to update with a version in repos. To do that add .1 to end of current version# in debian/changelog file.
After fiished tilda_0.09.4-0ubuntu2_i386.deb should be built. So install it by type 'sudo dpkg -i yourdebpkg.deb'.
pnix@pnix-a7n:~/build/tilda-0.09.4$ cd ..
pnix@pnix-a7n:~/build$ ls
tilda-0.09.4 tilda_0.09.4-0ubuntu2_i386.changes
tilda_0.09.4-0ubuntu2.diff.gz tilda_0.09.4-0ubuntu2_i386.deb
tilda_0.09.4-0ubuntu2.dsc tilda_0.09.4.orig.tar.gz
pnix@pnix-a7n:~/build$ sudo dpkg -i tilda_0.09.4-0ubuntu2_i386.deb
Selecting previously deselected package tilda.
(Reading database ... 107569 files and directories currently installed.)
Unpacking tilda (from tilda_0.09.4-0ubuntu2_i386.deb) ...
Setting up tilda (0.09.4-0ubuntu2) ...

pnix@pnix-a7n:~/build$

ref: http://forum.beryl-project.org/viewtopic.php?f=51&p=31430

6/20/07

Desktop effects on Feisty, Cube and JAVA Swing problems

Even the "desktop effects" is just technology preview on Feisty. It still has some bugs but I like it. To enable go to System > Preferences > Destop Effects, then click "Enable Desktop Effects" button.
It has two effects for now[as I known], "Windows wobble when move" and "Workspaces on a Cube".
After enable it, windows wobble is work fine but not the cube effect. Notice that number of workspace will change to 1. If set it back to 2, when I change workspace[e.g. Ctrl+Alt+->] sometime it loose both panels[top and bottom] or sometime it give me blank screen[no panel,no icon]

To make cube effect work open terminal and

pnix@pnix-a7n:~$ gconftool-2 --type int --set /apps/compiz/general/screen0/options/hsize 4
pnix@pnix-a7n:~$ gconftool-2 --type int --set /apps/compiz/general/screen0/options/number_of_desktops 1
or use gui tool by type "gconf-editor" in terminal
And navigate to: apps > compiz > general > screen0 > options
and change value of “hsize” to 4 and “number_of_desktops” to 1.

Another thing is enabling "Desktop Effects" will causes java swing component show as blank window. In my box it happen when start I netbeans. I read somewhere that this is java bug. Hope that sun will fix this in next jdk version.

To fix this, you need to set the variable AWT_TOOLKIT to "MToolKit". Add the code below in your $HOME/.bashrc [For me I put it in /etc/profile coz i need to run netbeans from menu]
export AWT_TOOLKIT=MToolkit


update: If you have stability problem with AWT_TOOLKIT=MToolkit[like me], may be you need to make a choice.

6/17/07

Mount ISO, CUE/BIN, NRG, IMG, MDF files in ubuntu

I known that to mount iso file

pnix@pnix-a7n:~$ sudo mount -o loop file.iso mountpoint
or
pnix@pnix-a7n:~$ sudo mount -o loop -t iso9660 file.iso mountpoint

and for cue/bin file ,I convert it to iso first use bchunk
pnix@pnix-a7n:~$ bchunk file.bin file.cue file.iso

but how about the others. After some search, I collect tips to handle many types of image file in linux.
For nrg[ nero image ], img [ clone cd] and mdf [ alcohol 120% ] files, We need nrg2iso, ccd2iso and mdf2iso to convert those image files to iso image. Luckily, All are in Feisty repos.
pnix@pnix-a7n:~$ sudo aptitude install nrg2iso ccd2iso mdf2iso
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
Building tag database... Done
The following NEW packages will be installed:
ccd2iso mdf2iso nrg2iso
0 packages upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 19.1kB of archives. After unpacking 193kB will be used.
Writing extended state information... Done
Get:1 http://th.archive.ubuntu.com feisty/universe ccd2iso 0.3-1 [7004B]
Get:2 http://th.archive.ubuntu.com feisty/universe mdf2iso 0.3.0-0ubuntu2 [7066B]
Get:3 http://th.archive.ubuntu.com feisty/universe nrg2iso 0.4-1.1 [4996B]
Fetched 19.1kB in 1s (17.8kB/s)
Selecting previously deselected package ccd2iso.
(Reading database ... 107513 files and directories currently installed.)
Unpacking ccd2iso (from .../ccd2iso_0.3-1_i386.deb) ...
Selecting previously deselected package mdf2iso.
Unpacking mdf2iso (from .../mdf2iso_0.3.0-0ubuntu2_i386.deb) ...
Selecting previously deselected package nrg2iso.
Unpacking nrg2iso (from .../nrg2iso_0.4-1.1_i386.deb) ...
Setting up ccd2iso (0.3-1) ...
Setting up mdf2iso (0.3.0-0ubuntu2) ...
Setting up nrg2iso (0.4-1.1) ...
pnix@pnix-a7n:~$

then to covert to iso use command
pnix@pnix-a7n:~$ mdf2iso file.mdf file.iso
pnix@pnix-a7n:~$ ccd2iso file.img file.iso
pnix@pnix-a7n:~$ nrg2iso file.nrg file.iso


for nrg file, we can mount it directly by
pnix@pnix-a7n:~$ sudo mount -o loop,offset=307200 file.nrg mountpoint


Other choices
cdemu[a kernel module for mounting Cue/Bin files directly] with nautilus script.more
AcetoneISO gui app to mount all image file.