All posts by argy

Install Oracle JVM in Arch Linux

Unfortunately OpenJDK gives me headaches (eclipse crash in PDT and java applets not starting) in everyday work and I had to switch to OracleJDK (at least for now).

OpenJDK is a dependency on multiple Arch Linux packages so just installing Oracle’s JDK wasn’t enough.

First had to remove icedtea-web

sudo pacman -R icedtea-web

Then build Oracle JRE AUR package,

Before installing OracleJRE I had to remove openjdk6 manually and ignore dependencies:

[argy@Freak jre]$ sudo pacman -Rdd openjdk6

Install OracleJRE

sudo pacman -U jre-7u2-1-i686.pkg.tar.xz

Build and Install JDK AUR package:

sudo pacman -U jdk-7u2-1-i686.pkg.tar.xz

Logout and Login so the PATH gets updated and we are ready to go.

UPDATE: Actually Eclipse crashing had nothing to do with OpenJDK or PDT, but an issue with the installed xulrunner. Workaround available here: 6.1 Autocompletion and javadoc render crash

Resources:

Switch keyboard layout holding windows key

I find really useful to switch keyboard layout while holding a key. That way I can easily type an English while writing in Greek. Left Windows key is good option for me as I don’t really need it on my Arch Linux powered laptop.

Can be easily setup in /etc/X11/xorg.conf.d/01-keyboard-layout.conf:

Section "InputClass"
        Identifier "keyboard-layout"
        Driver "evdev"
        MatchIsKeyboard "yes"
        Option "XkbLayout"  "us,gr"
        Option "XkbOptions" "grp:alt_caps_toggle,grp:lwin_switch"
EndSection

A full list is available in /usr/share/X11/xkb/rules/xorg.lst

Take Screenshots on LXDE

Edit the following in ~/.config/openbox/lxde-rc.xml:

   

<keybind key="Print">
      <action name="Execute">
        <command>screenshot-desktop.sh</command>
      </action>
    </keybind>
    <keybind key="A-Print">
      <action name="Execute">
        <command>screenshot-window.sh</command>
      </action>
    </keybind>

To take a full desktop screenshot:

#!/bin/bash
DATE=`date +%Y-%m-%d\ %H\:%M\:%S`
xwd -root | convert - "$HOME/Desktop/Screenshot-$DATE.png"
notify-send "Desktop screenshot saved!" "A descktop screenshot was saved on your Desktop as:\n Screenshot-$DATE.png" -i /usr/share/icons/Tango/scalable/devices/camera.svg

screenshot-desktop.sh

To take the current window screenshot:

#!/bin/bash
 activeWinLine=$(xprop -root | grep "_NET_ACTIVE_WINDOW(WINDOW)")
 activeWinId="${activeWinLine:40}"
 activeWinTitle=$(xwininfo -id $activeWinId | grep 'Window id:' | cut -d"\"" -f2)


COUNTER=0
FILENAME="$HOME/Desktop/$activeWinTitle-Screenshot.png"

while [ -f "$FILENAME" ]; do
  let COUNTER=COUNTER+1
  FILENAME="$HOME/Desktop/$activeWinTitle-Screenshot-$COUNTER.png"
done


 import -window $activeWinId "$FILENAME"

notify-send "Window screenshot saved!" "Windows screenshot was saved on your Desktop as:\n $FILENAME" -i /usr/share/icons/Tango/scalable/devices/camera.svg

screenshot-window.sh

Setup an Apache Pivot project in Eclipse

Apache Pivot logoApache Pivot is an open-source platform for building rich web applications in Java. I was looking for a modern UI toolkit and Pivot is exactly that. I’m willing to give a try so I tried to setup some Pivot projects in Eclipse. It actually comes with an Eclipse plugin that simplifies development of Pivot applications.

So here is a quick guide to setup Eclipse for the development of Pivot applications
Continue reading Setup an Apache Pivot project in Eclipse

Internet on SE mobile from Ubuntu

After using my Sony Ericsson Yari mobile phone for a while I got disappointed from the slow response times. Using it for a while made the phone respond even slower in manner that wasn’t only annoying but also hard to use some times. I tried using lightweight themes and clearing the recent calls list but still the phone’s response time was really slow. I decided to try updating the phone’s firmware and see if there was any improvements on the performance.

My mobile contract didn’t include any Internet access plan, so I thought I could share my laptop’s internet access using my phone’s USB cable. After I connected my SE on my Ubuntu laptop a usb0 network interface appeared on my NetworkManager. After some trial and error I managed to share my internet connection with my mobile phone.

Here are the steps I followed:

  1. Right click on NetworkManager and select “Edit Connections”
  2. On the “Wired” tab select “Auto Ethernet” and hit “Edit”
  3. In “IPv4 Settings” select Method: “Shared to other Computers” and hit “Apply”
  4. On your Sony Ericsson mobile select: Settings -> Connectivity ->USB -> Advanced -> Internet access -> Via Computer
  5. You should be able to access the internet from your mobile phone using Ubuntu’s Internet connection.

After that I updated my phone’s firmware. Although I didn’t think it will help, my phone’s performance was significantly improved. I also noticed that the video recording shagginess issue was resolved too.

Cross Compiling in Ubuntu

I just got a fresh install on my laptop of Ubuntu 10.10 and I had to set some things up after restoring my backup files (long story). So I thought it’s a good chance to make some notes of the process.

I wanted to setup again my development enviroment for cross-compiling for w32 some C++ projects I like to develop. First of all I install MinGW on my Ubuntu installation.

sudo apt-get install mingw32

Happy to notice that there is a mingw-w64 package on the repositories, but I’ll have to try this another time.

It’s being a long time I’m trying to figure out a file structure on my home directory to keep the source code and cross-compiled libs in a seperate place for each platform. I decided to mimic the POSIX style. So I create a usr directory on top of my home directory and use local subdirectory for my current platform builds and w32 for the w32 platform. I was never sure what /usr/local meant on POSIX systems but this seems to work for me now 🙂

~/usr/local/src
~/usr/local/include
~/usr/local/lib
~/usr/local/bin
~/usr/w32/src
~/usr/w32/include
~/usr/w32/lib
~/usr/w32/bin

And now the first cross compilation must take place. I need to compile fltk2 with mingw32 for w32 platform. There is a nice README.mingw32_cross to help you with the process but it fails on some point. So I had to use an ugly work around to go on.

First of all following the README.mingw32_cross I ran a ./configure with the following arguments:

$ ./configure --build=i586-mingw32msvc --host=i586-mingw32msvc --target=i586-mingw32msvc --prefix=$HOME/usr/w32

And now for the ugly work around. I had to edit makeinclude with the following:

CFLAGS		= $(OPTIM)  -I/usr/i586-mingw32msvc/include
CXXFLAGS	= $(OPTIM) -I/usr/include/freetype2  -I/usr/i586-mingw32msvc/include -Wno-non-virtual-dtor

and fltk2-config accordingly:

# flags for C++ compiler:
CFLAGS=" -I/usr/i586-mingw32msvc/include"
CXXFLAGS="-I/usr/include/freetype2  -I/usr/i586-mingw32msvc/include -Wno-non-virtual-dtor"
LDFLAGS=" -L/usr/lib "
LDLIBS=" -L/usr/lib  -lXi -lXinerama  -lXext  -lsupc++

I’m almost sure there is a better way to do this, but I’m not really familiar with autoconf and configure tools. If someone has a neater solution please leave a comment.

And now run make.

The build fails but on fluid2 but it’s ok for me as long as the library gets compiled. Running make install will put my w32 cross compile fltk2 library in $HOME/usr/w32/lib

Wait a minute! I need some w32 cross-compiled SQLite for my Driver Study project. As I remember that will be easy.

Download the Amalgamation sqlite3 tarball extract it in $HOME/usr/w32/src, do some configuring, build and install:

$./configure --build="i586-mingw32msvc" --host="i586-mingw32msvc"  --target="i586-mingw32msvc" --prefix="$HOME/usr/w32"
$make
$make install

And just worked.

Compile FLTK2 on Ubuntu

I’m using fltk2 for the development of DriverStudy. I had some difficulties compiling fltk2 on my Ubuntu, because of missing required libraries. So here are the packages you’ ll have to install to successfully compile fltk2.

sudo apt-get install xorg-dev libjpeg62-dev libpng12-dev

Instead of libjpeg62-dev you can install version 8 of the JPEG Library (libjpeg8-dev) if available on your system.

Also if you need OpenGL support on your fltk2 you’ll have to install GLUT libraries too.

sudo apt-get install libglut3-dev

The rest of the story goes like that:

./configure
make

After build completes take a look at test/demo for some demos.