Saturday, July 31, 2010

Eclipse CPU usage 100 open XML

My Eclipse CPU usage grows to 100% after I try to open XML file.

Eclipse probably ended up with little available memory. Following setup solved my problem.
Open eclipse.ini from Eclipse installation dir. Change all memory variables to sufficient values, check especially following items:
--launcher.XXMaxPermSize 256M


Start eclipse with additional parameter:
eclipse.exe ... -vmargs -Xmx256M
You can also start Eclipse in its own VM:
eclipse.exe -vm "C:\Program Files\Java\jdk1.5.0_22\bin\javaw.exe"

Later, dmatej sw suggested more complete arg list:



Tuesday, July 27, 2010

xrandr: Configure crtc 0 failed

If you get problem:
xrandr: Configure crtc 0 failed
Create xorg.conf for NVidia graphics card:
nvidia-xconfig --add-argb-glx-visuals -d 24
Change your xorg.conf by running:
You can also add to xorg.conf manually following line to
Section "Screen"
Option AddARGBGLXVisuals" "True"
And then add to
SubSection "Display"
your preffered resolution, e.g. 1920x1080:
Modes "1920x1080" "1600x1200" "1280x1024" "1024x768" "800x600" "640x480"
There you can select your native monitor mode.

Resource: LinuxMint

Thursday, July 22, 2010

Setup Java environment variables

To run Java applications we need JRE, Java runtime environment. If we want to build new Java applications it is neccessary to install JDK, Java development kit.

After installation we should set following environment variables to let application servers and development environment start properly. Paths depend on Java version and installation directories:

PATH=%PATH%;C:\Program Files\Java\jdk1.6.0_21\bin;
JAVA_HOME=C:\Program Files\Java\jdk1.6.0_21
C:\Program Files\Java\jdk1.6.0_21\jre\lib;
C:\Soft\Apache Tomcat\apache-tomcat-6.0.28\lib\jsp-api.jar;
C:\Soft\Apache Tomcat\apache-tomcat-6.0.28\lib\servlet-api.jar;.

Easiest way is to set the variables system-wide. In WinXP it is done by: Control Panel / System / Details / System variables. In Linux it is done by adding variables to user init script, e.g. .bashrc.

Note that CLASSPATH is one-line string variable. I just divided it to multiple lines for better readability.

Tuesday, July 20, 2010

Install Autotools in Debian

How to install build environment in Ubuntu (Debian) Linux in one step:
apt-get install build-essential g++ automake autoconf gnu-standards autoconf-doc libtool gettext autoconf-archive

Linux NVidia Legacy GeForce2

How to install latest or legacy NVidia binary drivers on Ubuntu Linux 10.04? How to choose Legacy drivers for GeForce2 (MX400)?

Perform following commands in sequence under root privileges (e.g. sudo su).

Stop X Window System and switch to the console:
/etc/init.d/kdm stop
/etc/init.d/gdm stop
/etc/init.d/xdm stop
killall X

Remove nouveau drivers:
apt-get --purge remove xserver-xorg-video-nouveau remove xserver-xorg-video-all

Remove all nvidia-* drivers, in my case:
apt-get remove nvidia-current nvidia-current-modaliases nvidia-common

Blacklist any unwanted graphics drivers:
vim /etc/modprobe.d/blacklist.conf
Add lines:
blacklist vga16fb
blacklist nouveau
blacklist rivafb
blacklist nvidiafb
blacklist rivatv

Install development and conf environment:
apt-get install build-essential
apt-get install pkg-config
apt-get install nvidia-settings
apt-get install nvidia-173-modaliases

If you have latest card, install latest NVidia binary drivers:
apt-get install nvidia-current

If you have legacy card, find out NVidia legacy driver serie appropriate for your card and install legacy NVidia drivers:
apt-get install nvidia-96 nvidia-96-modaliases

Reboot system:

Choose driver from list (0 in my case):
update-alternatives --config gl_conf

Perform ldconfig:

Create xorg.conf for NVidia graphics card:
nvidia-xconfig --add-argb-glx-visuals -d 24
If you get problem using xrandr:
xrandr: Configure crtc 0 failed
you can change xorg.conf by running nvidia-settings

You will most probably have to reboot before using the driver.

Alternatively, you can install NVidia binary drivers by Vendor-provided install script: from Nvidia website

resources: Ubuntu Forums

Friday, July 16, 2010

Mount NTFS in Linux

How to mount NTFS in Linux with appropriate code page?

Mount command
  # mount -t ntfs /dev/hda1 /mnt/hda1 -o user,ntfs,codepage=850,exec,umask=0,iocharset=iso8859-2

Record in /etc/fstab
  /dev/hda1 /mnt/hda1 ntfs user,ntfs,codepage=850,exec,kudzu,umask=0,iocharset=iso8859-2 0 0

Sunday, July 11, 2010

Firefox full screen animation

How to disable toolbar animation when switching to full screen mode?

Write to Location bar:

Find item:

Set to value 0

Friday, July 02, 2010

Grep multiple lines

Grep multiple lines:

$ apt-get install pcregrep
$ pcregrep -M 'first_line\nsecond_line' file.txt

Additionally you can print some lines before and after matched string. To print one line Before and two lines After matched string, use switches:
$ grep -B 1 -A 2 'regex' file.txt