Pages

Tuesday, May 27, 2008

Internet Explorer cannot open the Internet site http://mail.google.com/mail/

I'm not internet explorer (IE) fanboy, but sometimes I'm still using IE together with firefox. When using IE, if gmail already accessed before, after sign in I often get error message as follows:

Internet Explorer cannot open the Internet site http://mail.google.com/mail/
Operation aborted

The only workaround I found is : by clearing the IE temporary internet files (in IE7: menu Tools, delete browsing history, delete files..), and reload the gmail.

That's all. :)

Tuesday, May 13, 2008

postgresql ilike for non latin character

I was having problem with insensitive query of non latin character in postgresql. My postgresql version is 8.2.5, with EUC_JP encoding. However, for temporary solution, I'm using workaround as follows.

Suppose you are having table ABCD with field name: FIELD1 which might contain non latin characters, with database encoding EUC_JP. For example, to search word 'keyword' with ilike in FIELD1, use the following sql:

select * from ABCD where convert(FIELD1 ,'euc_jp','unicode') ilike '%keyword%';

that's all :)

Tuesday, April 15, 2008

Disable All Auto Play in Vista

Below is a way to globally disable auto play in vista:

  1. Open Control Panel, if it is in classic mode, click Control Panel Home to switch to vista default style for control panel. And then click on "Play CDs or other media automatically" (below the title Hardware and Sound).

  2. Select take no Actions for every media.

  3. Save

Or, if you are using Vista Business or Vista Ultimate, edit group policies:

  1. start, run, type: gpedit.msc

  2. press CTRL+SHIFT+Enter to execute group policy in administrator mode

  3. Expand: Computer Configuration, Administrative Template, Windows Components, AutoPlay Policies. Double click at Turn off Autoplay. Set enabled. You can choose Turn Off autoplay on certain drive or All drives.

  4. Expand: User Configuration, Administrative Template, Windows Components, AutoPlay Policies. Double click at Turn off Autoplay. Set enabled. You can choose Turn Off autoplay on certain drive or All drives.


That's all :)

Wednesday, April 09, 2008

Gimp on Vista: svg.exe has stopped working

I've just installed Gimp 2.4.5 on Vista. Every time I run Gimp, there're always error message like this:

svg.exe has stopped working

helpbrowser.exe has stopped working

Checking the detail information, seems there's problem with libxml2.dll ( Fault Module Name: libxml2.dll ). Searching from internet, finally found out the workaround:

As administrator, copy libxml2.dll from the bin directory of installed gimp (default will be c:\program files\gimp\bin ) into c:\windows. And don't forget to backup the original libxml2.dll just in case it is required, by simply rename it into any file name, eg: libxml2.dll.original.


That's all.

Monday, March 03, 2008

Cancelling clicked href link in html

If we want to create a link which is not linked to anywhere but only want to trigger something example as follows:
<a href="#" onclick="alert('test');">...</a>

The page will scroll to the top since the link is nowhere found in that page. To disable the scroll, simply add return false like this:
<a href="#" onclick="alert('test'); return false;">...</a>

or
<a href="" onclick="alert('test'); return false;">...</a>

That's all. :)

Friday, February 01, 2008

Display flash (swf) as background in html

If we have flash embedded in a html page. Usually, it will be placed on top of other div or other components. There is a way to display other thing on top of flash, that is by adding the parameter: wmode with value opaque. Example:
<param name="wmode" value="opaque">

Or, there's a good library for embedding flash object to html by using SWFObject. It is located in here.

that's all :)

Preventing form tag create new line

To prevent form tag in html creating new line, create the css for the form with attribute display: inline;
For example, to apply it for all forms, create css as follow:
form {display: inline; }
or directly in the form:
<form style="display: inline">

That's all :)

Sunday, January 06, 2008

How to disable root access from ssh

By default, usually ssh allow us to login as root. If we are concerned a lot about security, we'll want to disable root access from ssh. Belows are steps to disable direct root access from ssh:

  1. login to your server, and gain root access (by sudo or su - )

  2. Edit ssh configuration file. Usually the file is located at /etc/ssh/sshd_config

  3. Find the line: PermitRootLogin yes, then replace the line into: PermitRootLogin no

  4. If you'd like to only enable protocol version 2, find the line: Protocol 2,1 then replace it into: Protocol 2

  5. Save the files

  6. restart ssh:
    /etc/rc.d/init.d/sshd restart

That's all :)

Saturday, January 05, 2008

How to ssh/scp w/o password prompt

Sometimes, we'd like to automate a file transfer process between main server and backup server. We can use scp to transfer files but usually scp requires input for password prompt. Belows are quick steps to remove the password prompt for scp/ssh.Basically, there are two steps needed:
  1. create public and private key in the ssh client
  2. copy or append the public key content to the ssh server

If you are using SSH version 2, follow the following steps:
  1. at the client machine, login as the user who will execute the ssh or scp, then create pair of public and private key using dsa to ~/.ssh/id_dsa with the following command:
    $ ssh-keygen -t dsa -f .ssh/id_dsa
    (If there's a prompt asking for password, leave it blank. There will be two files created on ~/.ssh/ : id_dsa (private key) and id_dsa.pub (public key))
  2. Copy or append the content of id_dsa.pub (public key) above to the ssh server at the home directory of the ssh user: ~/.ssh/authorized_keys2

If you are using SSH version 1, follow the following steps (very similar):
  1. At the client machine, login as the user who will execute the ssh or scp, then create pair of public and private key using rsa to ~/.ssh/id_rsa with the following command:
    $ ssh-keygen -t rsa -f .ssh/id_rsa
    (If there's a prompt asking for password, leave it blank, there will be two files created.)
  2. Copy or append the content of id_rsa.pub (public key) above to the ssh server at the home directory of the ssh user: ~/.ssh/authorized_keys

That's all :)

Update:
Don't forget to set the file permission for the public key file in ssh server:
chmod 600 ~/.ssh/authorized_keys or chmod 600 ~/.ssh/authorized_keys2

That's all :)

Friday, January 04, 2008

How to use vi style in Bash

If you are vi fans, probably you want to have vi command style in bash shell.

Simply add the following command in your ~/.profile_bash file:
set -o vi

That's all :)

Thursday, January 03, 2008

How to get yesterday time

Sometimes, we need to create a simple script in linux which involves retrieving system time several days/hours/minutes ago.

Belows are example use of date command:

To get yesterday time:
$ date --date="1 days ago"
or
$ date --date="-1 days"


To get one month ago:
$ date --date="1 months ago"
or
$ date --date="-1 months"


To get one hour ago:
$ date --date="1 hours ago"
or
$ date --date="-1 hours"


To get one minutes in the future:
$ date --date="+1 minutes"


To get one seconds in the future:
$ date --date="+1 seconds"


We can also combine it, example to get one month and two hours ago:
$ date --date="1 month 2 hours ago"
or
$ date --date="-1 month -2 hours"

There are many other ways to express the particular time.

That's all :)

Wednesday, January 02, 2008

Bash keyboard shortcut

Below is list of keyboard shortcut for bash shell.

Why we need keyboard shortcut? The short answer is: to save time!
Especially, when we are accessing bash remotely (eg: by ssh) and the network access pretty slow, we will need a keyboard shortcut such as deleting the entire command line, moving to the beginning of the command, etc to save a lot of time.

Below are some of keyboard shortcuts for bash. Maybe in certain conditions it does not work properly.

  • ALT + b : move the cursor backward one word.

  • ALT + f : move the cursor forward one word.

  • ALT + d : cut one word after the cursor.

  • ALT + u : uppercase one word after the cursor.

  • CTRL + a : go to the first character of the line.

  • CTRL + b : move back one character.

  • CTRL + c : Sending signal SIGINT the current process you run (usually the process will be killed).

  • CTRL + d : Sending EOF, Exit/logout the current shell.

  • CTRL + e : go to the last character of the line.

  • CTRL + f : move forward one character.

  • CTRL + h : clear one character before the cursor. (similar with backspace)

  • CTRL + k : cut all characters after the cursor.

  • CTRL + l : clear screen.

  • CTRL + r : search for previously used commands.

  • CTRL + t : swap the last two characters before the cursor.

  • CTRL + u : cut all characters before the cursor.

  • CTRL + w : delete one word before the cursor.

  • CTRL + y : recall the last cut character by CTRL+u or CTRL+k or ALT+d (just like paste)

  • CTRL + z : put the current process you run into background process. To restore it, use command fg.

  • ESC + t : swap the last two words before the cursor.

  • TAB : autocomplete command/files or folders name.


That's all :)

Wednesday, July 05, 2006

Ubuntu Dapper Drake + XGL + Compiz + Acer Aspire 5502 Part 2

All right folks, now I'd like to share what I've done to enable XGL and compiz to my aspire 5502. FYI, acer aspire 5502 is using ATI X-700 as it's VGA card with screen resolution 1280x800.

At the beginning of running Dapper Drake CD installer, all I got was only blank screen on Graphics mode. I had to switch to console, using sudo, and edited /etc/xorg.conf to enable viewing the graphics on the LCD screen.
At the Section "Device" I added:
Option "MonitorLayout" "LVDS,CRT"

And voila.. I could see the GUI but the resolution only worked at 640x480. I've tried dpkg-reconfigure -phigh xserver-xorg but still the same. Well, nevermind, from http://ubuntuforums.org/showthread.php?t=204910, I got a clear step to install fglrx 8.26.18 (the latest ATI proprietary driver for now). Here's the step I've done:

0. make sure having the latest ubuntu packages
sudo apt-get update
sudo apt-get dist-upgrade
(I also update my kernel into the latest one)

1. download the ATI driver file from
https://www2.ati.com/drivers/linux/ati-driver-installer-8.26.18-x86.run

2. Edit /etc/apt/sources.list
to enable universe and multiverse repository (actually I enable all repository, lol)

3. install some necessary tools:

sudo apt-get update
sudo apt-get install module-assistant build-essential
sudo apt-get install fakeroot dh-make debconf libstdc++5 gcc-3.3-base
and from synaptic package manager, I also install linux-header and linux-headers-386 (I think it's needed by ATI proprietary driver, because without installing it, the installation of ATI proprietary driver was failed)

4. continue the walkthrough from http://ubuntuforums.org/showthread.php?t=204910, that is to create deb package:
chmod +x ati-driver-installer-8.26.18-x86.run
./ati-driver-installer-8.26.18-x86.run --buildpkg Ubuntu/dapper

5. install the package:
sudo dpkg -i xorg-driver-fglrx_8.26.18-1_i386.deb
sudo dpkg -i fglrx-kernel-source_8.26.18-1_i386.deb
sudo dpkg -i fglrx-control_8.26.18-1_i386.deb

6. compile the kernel module:
sudo module-assistant prepare,update
sudo module-assistant build,install fglrx
sudo depmod


7.finish. Just need to update the xorg.conf file:
sudo aticonfig --initial

then I edit manually the xorg.conf :)

To make sure everything is on the correct way, running fglrxinfo, I got message looks like this:
display: :0.0 screen: 0
OpenGL vendor string: ATI Technologies Inc.
OpenGL renderer string: MOBILITY RADEON X700 Generic
OpenGL version string: 2.0.5879 (8.26.18)

Now onto the installation of compiz.. Based on the walkthrough I found at http://www.compiz.net/viewtopic.php?id=389 and http://www.tectonic.co.za/view.php?id=916, I follow the combination steps from both url before it works for my laptop:

0.Edit /etc/apt/sources.list, adding repositories for compiz:

deb http://www.beerorkid.com/compiz/ dapper main
deb http://xgl.compiz.info/ dapper main
deb-src http://xgl.compiz.info/ dapper main


1. download and import the gpg key for quinnstorms repository
wget http://www.beerorkid.com/compiz/quinn.key.asc -O - sudo apt-key add -


2. update apt packages again:
sudo apt-get update


3. install the compiz related packages:
sudo apt-get install compiz xserver-xgl libgl1-mesa xserver-xorg libglitz-glx1 compiz-gnome


4. create file .Xsession and save it into /home/{$user}
The contains is like this (I copy paste directly from http://www.tectonic.co.za/view.php?id=916)

#!/bin/sh
# Start up Xgl, compiz, and GNOME
# Run Xgl server on :1, on top of normal X
Xgl :1 -fullscreen -ac -accel xv -accel glx:pbuffer &
# Tell subsequent X programs to access the Xgl server at :1
DISPLAY=:1
# Start Compiz window manager
gnome-window-decorator &
compiz gconf decoration wobbly fade minimize cube rotate zoom scale move resize place menu switcher &
# Start GNOME
exec gnome-session


5. Finish.

That's all... When I tried to create new user account for my ubuntu, I should create .Xsession to run Xgl server on :2 (not :1), so the .Xsession for the 2nd user should be like this (I ommit the comment line):
#!/bin/sh
Xgl :2 -fullscreen -ac -accel xv -accel glx:pbuffer &
DISPLAY=:2
gnome-window-decorator &
compiz gconf decoration wobbly fade minimize cube rotate zoom scale move resize place menu switcher &
exec gnome-session


Now I'm quite happy with my "pretty funny" ubuntu. ;)

Want to see my xorg.conf ? here is:

Section "ServerLayout"
Identifier "Default Layout"
Screen 0 "aticonfig-Screen[0]" 0 0
InputDevice "Generic Keyboard"
InputDevice "Configured Mouse"
InputDevice "Synaptics Touchpad"
EndSection

Section "Files"

# path to defoma fonts
FontPath "/usr/share/X11/fonts/misc"
FontPath "/usr/share/X11/fonts/cyrillic"
FontPath "/usr/share/X11/fonts/100dpi/:unscaled"
FontPath "/usr/share/X11/fonts/75dpi/:unscaled"
FontPath "/usr/share/X11/fonts/Type1"
FontPath "/usr/share/X11/fonts/100dpi"
FontPath "/usr/share/X11/fonts/75dpi"
FontPath "/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType"
EndSection

Section "Module"
Load "bitmap"
Load "dbe"
Load "ddc"
Load "dri"
# Load "extmod"
Load "freetype"
Load "glx"
Load "int10"
Load "type1"
Load "vbe"
EndSection

Section "InputDevice"
Identifier "Generic Keyboard"
Driver "kbd"
Option "CoreKeyboard"
Option "XkbRules" "xorg"
Option "XkbModel" "pc104"
Option "XkbLayout" "us"
EndSection

Section "InputDevice"
Identifier "Configured Mouse"
Driver "mouse"
Option "CorePointer"
Option "Device" "/dev/input/mice"
Option "Protocol" "ExplorerPS/2"
Option "ZAxisMapping" "4 5"
Option "Emulate3Buttons" "true"
EndSection

Section "InputDevice"
Identifier "Synaptics Touchpad"
Driver "synaptics"
Option "SendCoreEvents" "true"
Option "Device" "/dev/psaux"
Option "Protocol" "auto-dev"
Option "HorizScrollDelta" "0"
EndSection

Section "Monitor"
Identifier "aticonfig-Monitor[0]"
Option "VendorName" "ATI Proprietary Driver"
Option "ModelName" "Generic Autodetecting Monitor"
EndSection

Section "Device"
Identifier "aticonfig-Device[0]"
Driver "fglrx"
Option "ForceMonitors" "lvds"
Option "no_accel" "no"
Option "no_dri" "no"
Option "DynamicClocks" "on"
Option "mtrr" "on"
Option "DesktopSetup" "Single"
Option "ScreenOverlap" "0"
Option "Capabilities" "0x00000000"
Option "CapabilitiesEx" "0x00000000"
Option "VideoOverlay" "on"
Option "OpenGLOverlay" "off"
Option "CenterMode" "off"
Option "PseudoColorVisuals" "off"
Option "Stereo" "off"
Option "StereoSyncEnable" "1"
Option "FSAAEnable" "no"
Option "FSAAScale" "1"
Option "FSAADisableGamma" "no"
Option "FSAACustomizeMSPos" "no"
Option "FSAAMSPosX0" "0.000000"
Option "FSAAMSPosY0" "0.000000"
Option "FSAAMSPosX1" "0.000000"
Option "FSAAMSPosY1" "0.000000"
Option "FSAAMSPosX2" "0.000000"
Option "FSAAMSPosY2" "0.000000"
Option "FSAAMSPosX3" "0.000000"
Option "FSAAMSPosY3" "0.000000"
Option "FSAAMSPosX4" "0.000000"
Option "FSAAMSPosY4" "0.000000"
Option "FSAAMSPosX5" "0.000000"
Option "FSAAMSPosY5" "0.000000"
Option "UseFastTLS" "0"
Option "BlockSignalsOnLock" "on"
Option "UseInternalAGPGART" "no"
Option "ForceGenericCPU" "no"
Option "KernelModuleParm" "agplock=0"
Option "PowerState" "1"
EndSection

Section "Screen"
Identifier "aticonfig-Screen[0]"
Device "aticonfig-Device[0]"
Monitor "aticonfig-Monitor[0]"
DefaultDepth 24
SubSection "Display"

#Viewport 0 0
#Depth 24
Depth 24
Modes "1280x800" "1024x768" "800x600" "640x480"
EndSubSection
EndSection

Section "DRI"
Mode 0666
EndSection

Monday, July 03, 2006

Ubuntu Dapper Drake + XGL + Compiz + Acer Aspire 5502

Last weekend, I was very anxious to see how good is XGL, so I search any howto for installing xgl and compiz to linux ubuntu.

I got many helps from compiz forum and ubuntu forum.

Here is the step to enable XGL+compiz on my Acer Aspire 5502 and Ubuntu dapper drake.

1. Make sure 3d graphics already enabled

just make it easy.. I got the howto in here:
http://www.ubuntuforums.org/showthread.php?t=204910

2. Installing compiz+xgl
I got the walkthrough in here:
http://www.compiz.net/viewtopic.php?id=389 (the 2nd howto) and
http://www.tectonic.co.za/view.php?id=916

Later on, if I'm not lazy, I'll post the summary, so you can see the detail what I've done.