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

-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms100M
-Xmx512M

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:

-vmargs
...
-Duser.name=...
-XX:PermSize=256m
-XX:MaxPermSize=256m
-Xmn128m
-Xms256m

-Xmx768m



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:
nvidia-settings
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
CLASSPATH=
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:
/sbin/reboot

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

Perform ldconfig:
ldconfig

Create xorg.conf for NVidia graphics card:
nvidia-xconfig
or
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

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

Alternatively, you can install NVidia binary drivers by Vendor-provided install script: NVIDIA-Linux-x86-96.43.16-pkg1.run 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:
about:config

Find item:
browser.fullscreen.animateUp

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

Friday, June 18, 2010

Linux xrandr add new mode

Run cvt and give resolution as params:
$ cvt 1280 1024

Cvt prints out mode line for xorg.conf. Paste this line as an argument for xrandr:
$ xrandr --newmode "1280x1024_60.00" 109.00 1280 1368 1496 1712 1024 1027 1034 1063 -hsync +vsync

Add new mode to list of available modes:
$ xrandr --verbose --addmode VGA1 "1280x1024_60.00"

Set new mode for appropriate output:
$ xrandr --output VGA1 --mode 1280x1024_60.00

Resources:
UbuntuForums
AutoStart of dual monitor mode: ThinkWiki

Friday, April 23, 2010

Linux nohup running process

How to nohup already running process?

Put it to background:
Ctrl+Z
bg

Run disown:
disown

source: stackoverflow

Friday, February 26, 2010

Ubuntu latest original Flash plugin

How to install latest version of original Flash plugin in Ubuntu.

Do under root:

Remove Ubuntu Flash package:
# apt-get remove flashplugin-nonfree

Install required libraries:
# apt-get install libnspr4-dev libnss3-dev

Download latest Flash plugin from:
http://get.adobe.com/flashplayer/

Install downloaded plugin:
# dpkg -i install_flash_player_10_linux.deb

Debian Ubuntu dual monitor KDE

KDE dual monitor setup short guide:

Start ControlPanel from KDE menu or by Alt+F2 or from console:
$ ControlPanel

Choose:
System settings / Display / Multiple monitors / Show unmanaged windows on

Choose your default monitor for new windows.

You can set positions, resolutions and rotation for each output by xrandr:

In console:
xrandr --output LVDS --auto --rotate normal --pos 0x0 --output VGA-0 --auto --rotate normal --right-of LVDS

xrandr --output VGA-0 --auto --rotate normal --pos 0x0 --output LVDS --auto --rotate normal --right-of LVDS

Set equal contents for both outputs:
xrandr --output LVDS --same-as VGA-0

If the following error occurs:
xrandr: screen cannot be larger than 1280x1280 (desired size 2560x1024)

you have to change virtual desktop resolutions:

Open file /etc/X11/xorg.conf
Add to section "Screen" - SubSection "Display" item Virtual x y
where x and y is new resolution required by xrandr.

For example, if xrandr outputs:
xrandr: screen cannot be larger than 1280x1280 (desired size 2560x1024)

Add following line:

Section "Screen"
Identifier "Screen0"
Device "Card0"
Monitor "Monitor0"
SubSection "Display"
Viewport 0 0
Depth 24
Virtual 2560 1024
EndSubSection
EndSection

If you don't have any xorg.conf, you can (re)generate xorg.conf

Stop X Window:
Do as root from console:
# /etc/init.d/kdm stop
# /etc/init.d/gdm stop
# /etc/init.d/xdm stop
# killall X
# killall Xorg

Reconfigure:
# dpkg-reconfigure xserver-xorg

or:
# Xorg -configure

Done.

You can restart your X Window and reconfigure resolutions, positions and rotations for your monitors.

Ubuntu Linux WebCam

WebCam Acer TravelMate 5720.

Install under root:

# apt-get install luvcview guvcview
# depmod -ae

Done.

Test under regular user:

$ guvcview