Pages

Friday, October 30, 2009

How to set NetBeans locale to English

My Windows OS has Japanese language as its default locale. However, I am still having troubles understanding Japanese anyway lol. When I try to install JDK+NetBeans, by defaults it will start with the default locale of my system --that is Japanese. After googling here and there, finally found the way to run the NetBeans in English:

Execute the NetBeans with startup parameter --locale:
netbeans --locale en

or

Edit the configuration files (usually in \etc\netbeans.conf), find the entry started with netbeans_default_options="..." and insert the locale parameter to it:
netbeans_default_options="--locale en ..."

Reference:
http://wiki.netbeans.org/FaqMessagesInEnglish

That's all :)

Saturday, July 25, 2009

How to merge file dll to exe C#

Today, at work I have to create a demo application using C# to automatically launch IE and open certain URL and modify its form input. Since this task requires SHDocVW and MSHTML components, I have to let dll files accompany the exe file. But there is a requirement that the application shall consist of one single executable. Hence, I have to find a way to merge the dll to executable. Gladly, after searching in the internet, I found that it is very simple.

The step is as follows:

  1. Download ILMerge from microsoft site here.

  2. Install and copy the ilmerge.exe to windows directory or simply make the PATH to installation directory (to let us execute ilmerge.exe from anywhere)

  3. Go to the project properties, Build Events. Assuming the dll files are in the same directory of the Target, enter the following code to the post built even command line:
    ilmerge /wildcards /out:$(TargetDir)my-final-app.exe $(TargetPath) $(TargetDir)*.dll

To have a better understanding on how to execute ilmerge, I suggest to read the ilmerge.doc which is located in the installation folder.

That's all :)

Thursday, April 16, 2009

how to change gimp language setting

After changing some regional and language settings in my vista to Japanese, if I run gimp, it displays unreadable character instead of English. I found this url is very helpful to change the language of gimp (in XP, Linux, and MacOSX):
http://docs.gimp.org/en/gimp-fire-up.html#gimp-concepts-running-language

For vista, it is very similar with XP, example is to use English (en):
  1. go to control panel, system, advanced system settings
  2. click Environment variables..
  3. add new environment variable (click New...):
    variable name: LANG
    variable value: en
  4. Ok. Finish.

That's all :)

Thursday, April 02, 2009

Cannot display Hidden Folders and Files

If you have just infected by some worm or mallware, probably your windows cannot display hidden folders and files although you already set the hidden files options from explorer.
Copy paste the following text to notepad, and save it (for example: repair.reg), then double click to make changes to windows registry.
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Folder\Hidden]
"Text"="@shell32.dll,-30499"
"Type"="group"
"Bitmap"=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,\
00,25,00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,53,00,\
48,00,45,00,4c,00,4c,00,33,00,32,00,2e,00,64,00,6c,00,6c,00,2c,00,34,00,00,\
00
"HelpID"="shell.hlp#51131"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Folder\Hidden\NOHIDDEN]
"RegPath"="Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced"
"Text"="@shell32.dll,-30501"
"Type"="radio"
"CheckedValue"=dword:00000002
"ValueName"="Hidden"
"DefaultValue"=dword:00000002
"HKeyRoot"=dword:80000001
"HelpID"="shell.hlp#51104"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Folder\Hidden\SHOWALL]
"RegPath"="Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced"
"Text"="@shell32.dll,-30500"
"Type"="radio"
"ValueName"="Hidden"
"DefaultValue"=dword:00000002
"HKeyRoot"=dword:80000001
"HelpID"="shell.hlp#51105"
"CheckedValue"=dword:00000001

That's all :)

Tuesday, March 31, 2009

How to change ubuntu resolution in Virtual Box

Today, I'm installing Ubuntu 8.04 in Virtual Box, with Vista as the host OS. I'm planning to use it as Qtopia development environment. After the installation is completed, I found that the maximum resolution I could set was only 800x600. After some googling, found the solution as follows:

  1. install linux guest additions in virtual box
    1. Select from menu: Devices, Install Guest Additions... Ubuntu will detect a new CD inserted and mount it automatically.
    2. go to the terminal, run the VBoxLinuxAdditions.run as root
      $ sudo /media/cdrom/VBoxLinuxAdditions-x86.run

  2. edit /etc/X11/xorg.conf using any text editor you're familiar with.
    1. Find section "Device" as follows:
      Section "Device"
              Identifier      "Configured Video Device"
              ...
      EndSection
      Insert additional setting so that the section "Device" will look as follows:
      Section "Device"
              Identifier "Configured Video Device"
              ...
              Driver "vboxvideo"
      EndSection
    2. Find section "Screen" as follows:
      Section "Screen"
              Identifier "Default Screen"
              Device "VirtualBox graphics card"
              Monitor "Generic Monitor" 
              ...
      EndSection
      Modify value of Device and Monitor, and insert some additional setting before EndSection so that the section will look similar with the following (I set resolution 1024x768 here):
      Section "Screen"
              Identifier "Default Screen"
              Device "VirtualBox graphics card"
              Monitor "Generic Monitor"
              DefaultDepth 24
              ....
              SubSection "Display"
                  Depth 24
                  Modes "1024x768"
            EndSubSection
      EndSection

  3. Finish, reboot.

That's all :)

Friday, March 20, 2009

pppd segmentation fault

At work, I have to develop an embedded system sh3 with busybox and 2.6.12.6 kernel inside it. It is connected to gsm modem through ttySC1. After shutting down several times and rebooting, the pppd occasionally got segmentation fault. The suggestion from debian bug report solves my problem. It is pretty straightforward: Simply delete /var/run/pppd.tdb file (in my system, it is /var/run/pppd2.tdb).

That's all :)

Saturday, February 14, 2009

jwgkvsq.vmx worm/virus RECYCLER folder

To clean up system which automatically creates autorun.inf and RECYCLER folder with jwgkvsq.vmx, download and run this program. After reboot, the system probably will complain about missing dll file. To fix it manually, you can use regedit or msconfig:

Regedit:
  1. run regedit.exe (start menu, run: regedit.exe),
  2. search the dll file name (CTRL+F)
  3. delete the entry which contains the missing dll file. Usually, the entry should be found on registry location: HKCU\Software\Microsoft\Windows\CurrentVersion\Run\

Or MsConfig:
  1. run msconfig.exe (start menu, run: msconfig.exe),
  2. go to startup tab
  3. Uncheck the Startup Item which contains missing dll file on the command.

To clean up the infected flash disk or external disk with FAT file system, simply delete the autorun.inf and RECYCLER folder. But if it has NTFS file system, windows will complain about having unauthorized access to the file and folder. You can use Linux and mount the NTFS volume (probably it must be mounted forcefully with options -o force), then delete them. Live CD such as Ubuntu will do.

That's all :)

Updated:
If the above cleaning process didn't work (somehow, the above process works perfectly on my PC but has no effect on my friend's), scan the system using this tool. After scanning, there are probably some unaccessible files (check the log file). then:
  1. find suspicious hidden dll file on \windows\system32\,
  2. boot to save mode
  3. change the ownership of the file (right click, properties, security, click advanced.. the rest I expect you know how.. ;) ), then
  4. change the access permissions for everyone,
  5. delete the dll file manually.

Perhaps, step (3) to (5) can be applied to remove the autorun.inf and RECYCLER folder too..

That's all :)

Updated #2:
For those who have trouble downloading from antivirus website, I add mirrors for the antivirus:
(2012/10/4: Sorry, the mirrors are no longer available).

PS. Turn off System Restore and unplug your network before executing the removal tool. Otherwise, the virus might not be cleaned up. And refer to microsoft bulletin here to update the vulnerable patch.

If none of the above methods works for you, perhaps you should try to follow the cleaning process from microsoft knowledge base here.

That's all :)

Updated #3:
If you still got problem, The FAQ about conficker from kaspersky might be helpful.

That's all :)

Saturday, February 07, 2009

Zend framework mail: broken kanji

I'm using Zend framework for most of my web projects at work. One of the must-have features is must be able to send email either scheduled routinely using cron or executed manually from the web. Somehow, I found that on certain web based email clients the contents of the email with Japanese kanji is unreadable.

I'm quite surprised that after doing many trial and errors converting the encoding type, the solution is very straightforward. Simply add a line to the header of the email contains MIME-Version information as follows:
$class->addHeader('MIME-Version','1.0');

But I still don't know why it should be added manually.. :S

That's all :)

Saturday, October 18, 2008

disable SELINUX? for smbd.log: Error was Permission denied

I've just tried to setup another samba for my new linux vmware (I'm using CentOS running on VMWare player). As I already has several linux vmware with samba, I simply copied the samba configuration from other linux which already running.

But.. to my surprised, from the new linux vmware+samba, I cannot mount the samba directory from windows. Checking /var/log/smbd.log, found the following error message:
[2008/10/18 00:26:32, 0] smbd/service.c:make_connection_snum(911)
'/home/user1' does not exist or permission denied when connecting to [remote] Error was Permission denied

I already checked that the directory /home/user1 did exist, the user for connecting was also already had permission to access. After searching for the solution, it seems the problem is related with security enhanced linux policy (called SELINUX ?). Executing man smb_selinux will explain everything what should be done. Well, since this system is only for development, I'm not concerning much for security. The easiest way IMO is by disabling SELINUX at /etc/selinux/config. lol..

SELINUX=disabled

That's all :)

Thursday, September 11, 2008

How to change vista shutdown/power button behaviour

By default, power button in start menu of vista will change the system into sleep mode.

Here is the way to change it, so it will simply shut down our computer:

  1. go to control panel

  2. if your control panel is in classic view, click 'Power Options', otherwise, click 'Hardware and Sound', then click 'Power Options'.

  3. Click 'Change plan settings'

  4. Click 'Change advanced power settings'

  5. A new dialog window will appear, find in the list 'Power buttons and lid', expand the 'Start menu power button'.

  6. By default, the value should be: Sleep. Click it to display some options to choose: Sleep, Hibernate, Shutdown. Choose whichever you prefer. For example, Selecting shutdown will turn off computer whenever the power button in start menu is clicked.


That's all :)

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 :)