[Linux] How to speed up Android Emulator

  • 0
If you are using the android AVD emulator under linux, you may have noticed that its performance is very poor. However, to speed up the android emulator you can use Intels Hardware-assisted Virtualization (hypervisor). This How-To describes the necessary steps to enable Hardware-assisted virtualization on (X)ubuntu 13.10.

First you need to install KVM:
Check if your processor actually supports hardware virtualization:
 $ egrep -c '(vmx|svm)' /proc/cpuinfo  
A return value "0" means that your processor does NOT support hardware virtualization.
Now install cpu-checker:
 $ sudo apt-get install cpu-checker  
and check if your cpu supports KVM:
 $kvm-ok  
Now you need to enable Virtualization in the BIOS setup of your machine.
Now you have all the requirements fulfilled to install KVM:
 $ sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils  
After the installation you need to add your user to the "kvm" and "libvirtd" group:
 $ sudo adduser your_user_name kvm  
 $ sudo adduser your_user_name libvirtd  
Now it's time to reboot your machine, or simple logout and login again.
Start Eclipse and create a new Virtual device. Under CPU/ABI you should now be able to select "Intel Atom (x84)". If not you may want to install the "Intel x86 Atom System Image" for your desired Android API with the Android SDK Manager in eclipse.

To start the emulator use the command:
 $ <SDK directory>/tools/emulator-x86 -avd Your_AVD_Name -qemu -m 2047 -enable-kvm  
I recommend that you create a little bash script which uses the command above to start your AVD.


Note: if you want to start the AVD from eclipse do the following:
1) In Eclipse, click your Android project folder and then select Run > Run Configurations...
2) Select your Android project run configuration or create a new configuration.
3) Click the Target tab.
4) Select your AVD device.
5) In the Additional Emulator Command Line Options field, enter:
 -qemu -m 2047 -enable-kvm  

-- Sources: Ubuntu Documentation Intel Blog Post

Making Eclipse look more beautiful on Linux

  • 0
You may have noticed that Eclipse, other than on the windows OS, looks kind of clumpsy on Linux. This is because the fonts are too heavy and big, at least for my taste.

Changing the font size via Window --> Preferences only affects the Editor font sizes. But that's not enough. So here's a workaround to change the font size of all the menus, dialogs, etc. in Eclipse on Linux.

In your home directory create a file named: ~/.gtkrc-eclipse with the following content:

 style "eclipse" {  
     font_name = "Sans Condensed 8"  
 }  
 class "GtkWidget" style "eclipse"  

Now you can start Eclipse with a this command:

 GTK2_RC_FILES=/usr/share/themes/Clearlooks/gtk-2.0/gtkrc:/home/user/.gtkrc-eclipse '<path to your eclipse bin>'  

Or if you want to create an Launcher icon use this command:

 env GTK2_RC_FILES=/usr/share/themes/Clearlooks/gtk-2.0/gtkrc:/home/user/.gtkrc-eclipse '<path to your eclipse bin>'  

Now you should see way smaller fonts in the menus and dialogs of Eclipse.
But what's with the Tabs? They have still too large fonts. In order to change the font size of tabs, we have to tweak a little more:

In your eclipse installation directory go to:
 /plugins/org.eclipse.platform_*/css  

and open e4_default_gtk.css with your text editor.
Here you can see a section similar to this:

 .MPartStack {  
      font-size: 9;  
      swt-simple: false;  
      swt-mru-visible: false;  
 }  

Simply change the font size or erase this line.
Restart eclipse and obtain the results.

--
This workaround was tested on Xubuntu 13.10 and LMDE Cinnamon with Eclipse Kepler.

Making IntelliJ Idea look more beautiful on Linux

  • 0
IntelliJ Idea became my first choice for developing Java Applications. Unfortunately, since Ideas User Interface is programmed using Swing the rendering of fonts and other user interface components can cause problems on linux resulting in a totally ugly user interface.

After some time for searching for a solution i found a workaround which worked form me (Linux Crunchbang, IntelliJ Idea 12)

Adding the following two lines to your idea64.vmoptions file should do the trick:

-Dawt.useSystemAAFontSettings=lcd
-Dswing.aatext=true

Greets

Super easy way to download Youtube Videos for CLI junkies [linux]

  • 0
This article deals with downloading youtube videos to your computer so you can watch it offline. There are several ways, e.g. browser extensions or several programs to download youtube vids to your computer. If you're a linux user, let's do it with the command line. There exists a super nice script provided by Ricardo Garcia Gonzalwhich does the job quite nicely :) You can download the Python Script from here. It's called youtube-dl.
All you have to do is:

  • first make that script executable using: chmod 755 youtube-dl
  • then copy the script into either ~/bin or /usr/bin
thats it.

From now on you can download your youtube videos using the command line with the following command:

triggetry@sym:~$ youtube-dl <path to the youtube video>

[Linux] Add AVR Assembly (*.s) Syntax Highlighting to Geany

  • 0
One of my favorite Linux Text Editor is Geany. However, if you want to write avr assembler programs with Geany, you may notice that it does not support syntax highlighting for *.s assembly-files. This will show you how you can easily create your custom filetype configuration for your assembly source files in order to get full syntax highlighting support for avr assembly programs.

First copy the standard file for filetype configuration filetype_extensions.conf to your local geany config directory:
 cp /usr/share/geany/filetype_extensions.conf ~/.config/geany
To recognize the new filetype extension, add the following line to your local filetype_extensions.conf.
Avr=*.s;
Now,Arthur Artamonov contributed an improved filetypes.asm which conaints the AVR instuctions. The file is listed below:


Source: http://wiki.geany.org/config/avr_asm

Notice: You have to change the file extension format:
Just change the line:
extenstion=asm
to
extenstion=s
Right after this line you have to specify a lexer for your file format. You can use the one from ASM. so right after the above line add the following:
lexer_filetype=ASM
Save this file with filename: filetypes.Avr.conf  in ~/.config/geany/filedefs

And you are done!


(Re)Start Geany and try opening a *.s assembly source file. The content of the file should be nicely displayed with syntax highlighting.

Notice: You can do a lot moar with custom filetypes. For this, take a look at the Geany Manual.

:)

Installing Oracle JDK on Debian based Linux distributions

  • 0
This guide is for those who would like to use the official JDK from Oracle on a debian based linux distribution (like Crunchbang). While the installation procedure for OpenJDK is very simple, installing the Oracle JDK requires some work, since it cannot be installed via the software repositories.

I'll describe two ways to install the JDK.

 Manually download and install the jdk from oracle

1) Download the jdk<version>.tar.gz from Oracle.
2) Navigate to the downloaded file and extract it: tar -xf jdk-7u4-linux-i586.tar.gz
3) Decide where to install the new JDK. I prefer to install the new JDK in /usr/lib/jvm
4) Now move the extracted JDK folder to that location.
5) We have to refer to the newly installed JDK and the Firefox Java Plugin (in order the use java applets):

 
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk<version>/bin/java" 1
sudo update-alternatives --config java
sudo update-alternatives --install "/usr/lib/mozilla/plugins/libjavaplugin.so" "mozilla-javaplugin.so" "/usr/lib/jvm/jdk<version>/jre/lib/i386/libnpjp2.so" 1
sudo update-alternatives --config mozilla-javaplugin.so


6) Test your java installation by typing into a terminal:
java -version

7) Finally you have to set the JAVA_HOME variable by adding the following two lines to the file .bashrc
 
JAVA_HOME=/usr/lib/jvm/jdk1.7.0_04/
export JAVA_HOME

Done!

This approach, however, has a little problem. Whenever you decide to update your current JDK you have to reconfigure the system to use the updated version of your JDK.

Solution: Just make a symlink /usr/lib/jvm/jdk which points to /usr/lib/jvm/jdk<version>.
update-alternatives schould refer to this symlink. After you've updated your JDK all you have to do is to update the symlink to the new installed JDK location/name. 


 Manually add the ppa repositories to te software sources

This is the second approach to install the Oracle JDK. With this approach you can stay up to date to the latest Oracle Java Version. Just run the following commands as root:
 
su -
echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu precise main" | tee -a     /etc/apt/sources.list
echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu precise main" | tee -a /etc/apt/sources.list
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EEA14886
apt-get update
apt-get install oracle-java7-installer
exit

Source: http://www.webupd8.org/2012/06/how-to-install-oracle-java-7-in-debian.html


Greets!

installing javaHL 1.7.x in order to use subclipse 1.8.x on Ubuntu

  • 0
If you tried to install the current subclipse 1.8.x plugin and installed the javaHL library like in recommended on the subclipse wiki page you may come up with the error that javaHL 1.7.x is required there is a solution.

First remove you already installed javaHL library:

sudo apt-get purge libsvn-java

Because the current version of the javaHL libraries are not in the ubuntu repositories add the following ppa using the commands:

 sudo apt-add-repository ppa:dominik-stadler/subversion-1.7  
 sudo apt-get update  
Finally install the library:
 sudo apt-get install libsvn-java  
The Error should be gone on next eclipse startup. :)

Source: http://www.sidewaysforward.com/2012/02/upgrading-to-svnjavahl-1-7-x-in-ubuntu/