Compiling AndEngine with IntelliJ Idea

I couldn’t get AndEngine to compile with Intellij Idea¬† 11.1.3.

These were the errors that occurred during compilation:

cannot find symbol class BuildConfig

cannot find symbol variable BuildConfig

Finally, I found that this was mentioned in the readme : ).

It appears that AndEngine relies on the ADT tools being able to generate a BuildConfig file. IntelliJ does not fully support this, so you will have to add the class (BuildConfig.java) yourself to the root of the AndEngine project.

package org.andengine;
public final class BuildConfig {
    public final static boolean DEBUG = true;
}
Posted in Uncategorized | Leave a comment

Fix Anyconnect Client on Linux

1. disable icedtea plugin from the Firefox

2. go to your vpn page and wait for 60 seconds for the timeout

3. download the vpnsetup.sh from your VPN website,

    chmod +x vpnsetup.sh && sudo vpnsetup.sh

4. it installs the client and it to your menu as ‘Cisco Anyconnect Secure Mobility Client’

Posted in Uncategorized | Leave a comment

Intellij Idea: shared sources between projects

Often enough you will need to share the source code between two or more Java projects. In Eclipse, this is very intuitive. Under the build path settings you just link the appropriate paths.
Due to several problems with Eclipse, I prefer to use Intellij Idea. Unfortunately, this was not as intuitive in Intellij Idea and took me some time to figure out.

Let’s assume you have two projects: Project A and Project B. Project A is independent of project B and compiles from its own sources, whereas project B shares some of its source code with project A.
IntelliJ employs the concept of modules, a project can compose of several modules (of several projects in Eclipse-speak). To make the aforementioned scenario work, you must create a project that includes the two modules (create a module from existing sources for both project A and project B). In project A, you mark the source folders that you require as source folders (blue folder icon).
In module B, you create a module dependency for project A. And that’s it!

Posted in Uncategorized | Tagged , , | Leave a comment

Adb shell autocomplete

wget http://dl.dropbox.com/u/13321962/bash
adb remount
adb push bash /system/bin/</pre>

then

adb shell
cd /system/bin
chmod 777 bash
mv sh sh.bak
ln -s bash sh
Posted in Uncategorized | Leave a comment

Installing python .deb packages by discarding dependencies

Today I ran into some trouble installing PyAudio. PyAudio only comes in a .deb package, and is not available for installation via pip. The deb package unfortunately¬† required a Python installation version < 2.7. Virtualenv didn’t help me either, because it was dpkg that was causing the issues, as after. I learnt that that a *.deb¬† file is nothing but two ar compressed files which are in turn {g,b}zipped.

So, for a quick hack it was enough to unar it and modify it the hardcoded dependency so that it would read < 2.8, or some similar nonsense, so that it would pass, and then ar it back together. This can be quite a nuisance to do by hand, so I found a tutorial which included a small bash script on the Ubuntu forums.

I copy-pasted it here, so I can test the blog’s script highlighting capabilities, if any:

#!/bin/bash

if [[ -z "$1" ]]; then
  echo "Syntax: $0 debfile"
  exit 1
fi

DEBFILE="$1"
TMPDIR=`mktemp -d /tmp/deb.XXXXXXXXXX` || exit 1
OUTPUT=`basename "$DEBFILE" .deb`.modfied.deb

if [[ -e "$OUTPUT" ]]; then
  echo "$OUTPUT exists."
  rm -r "$TMPDIR"
  exit 1
fi

dpkg-deb -x "$DEBFILE" "$TMPDIR"
dpkg-deb --control "$DEBFILE" "$TMPDIR"/DEBIAN

if [[ ! -e "$TMPDIR"/DEBIAN/control ]]; then
  echo DEBIAN/control not found.

  rm -r "$TMPDIR"
  exit 1
fi

CONTROL="$TMPDIR"/DEBIAN/control

MOD=`stat -c "%y" "$CONTROL"`
vi "$CONTROL"

if [[ "$MOD" == `stat -c "%y" "$CONTROL"` ]]; then
  echo Not modfied.
else
  echo Building new deb...
  dpkg -b "$TMPDIR" "$OUTPUT"
fi

rm -r "$TMPDIR"

Save this in a script file, give it execution permissions (chmod +x filename.sh).

./filename.sh debfile should open it up with vi.

Now, pyAudio works fine with python v 2.6 installed alongside 2.7.

Posted in Uncategorized | Leave a comment