Tag Archives: development

How to compile rsync for Android in Ubuntu

My situation

My machine

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 14.04 LTS
Release:    14.04
Codename:   trusty

The latest rsync version to compile (for me it was rsync-3.1.0.tar.gz)

$ curl -s http://rsync.samba.org/ftp/rsync/ \
    | sed -r 's/^.*href="([^"]*)".*$/\1/' | grep 'rsync-[0-9].*\.tar\.gz$'

Procedure

  1. save the tarball name in a variable
    $ RSYNCTGZ="rsync-3.1.0.tar.gz"
    
  2. install needed software
    $ sudo aptitude install gcc-arm-linux-gnueabi
    
  3. download sources
    $ wget http://rsync.samba.org/ftp/rsync/$RSYNCTGZ
    $ tar xzf $RSYNCTGZ
    $ cd rsync-[0-9]*
    
  4. compile
    $ ./configure --host=arm-linux-gnueabi CFLAGS=-static
    $ make
    
  5. install on the device
    $ adb push rsync /data/local/tmp && adb shell chmod 775 /data/local/tmp/rsync
    
  6. test execution
    $ adb shell /data/local/tmp/rsync
    

References

How to display PHP errors only in public_html directories

How to display PHP errors

I always use servers where PHP errors are not shown by default and I always forget how to enable error messages in development environments.

My situation

On a server I usually prefer Debian OS, but when I develop on the go I use laptops with Ubuntu.
In this case I’m running Ubuntu 14.04 LTS with Apache2 (v2.4.7) and libapache2-mod-php5 (v5.5.9).

I want PHP errorors displayed for projects in my public_html folder.

Solution 1 (only Apache conf files)

Create the file /etc/apache2/sites-enabled/800-public-html.conf with this content:

<Directory /home/*/public_html>
  AllowOverride Options
  php_admin_flag display_errors On
</Directory>

Solution 2 (using .htaccess)

Create the file /etc/apache2/sites-enabled/800-public-html.conf with this content:

<Directory /home/*/public_html>
  AllowOverride Options
</Directory>

Create the file /home/max/public_html/project1/.htaccess with this content:

php_admin_flag display_errors On

Conclusions

It’s easy and easily forgettable. Don’t forget to add

error_reporting(E_ALL | E_NOTICE);

in your .php files.

Postphone v1.1.0

There’s a new version of Postphone. Huge list of things, here’s the full changelog:

    Improvements:
      New feat Google Android Backup Service (settings and database)
      Issue-001 now app keeps alarms upon reboot
      Hotfix-002 now when you receive a call with unknown Caller ID, 
           no popup is shown
    
    Application workflow:
      You must check or dismiss notification to remove alarm
    
    Code:
      Min SDK change from 7 to 8 (drop support for Eclair)
      DatabaseHelper class replaces DBAdapter
      Allow to upgrade from db v0 to db v1 and allow future upgrades
      Remove old code doTheVibration() and playSound()
      File rename popupcallback => popupcallback.xml
      Fix some typos
      Lower the number of events logged
    
    Developer side:
      New utility emulate-reboot
      New utility insert-fake-passed-calls with support for TZ
      New utilities for backup
      Change tmp path in sqlite-postphone-db utility
      Publish notes
      Backup notes
    
    Debug menu:
      Is disabled by default
      Can now be enabled via multiple taps on version name
      New menu entry "clear alarms table"
      New menu entry "test PopUpAfterCall"
    
    Design and blog:
      Blog featured banner
      Official logo.png

Android on Ubuntu: IOException on aapt

As I told in a previous post, I’m setting up a new Ubuntu installation and I want to compile something for Android on it.

After installing Android SDK I got this error on my first iteration of “ant debug”

BUILD FAILED
/home/max/AndroidSDK/android-sdk-linux/tools/ant/build.xml:621: The following error occurred while executing this line:
/home/max/AndroidSDK/android-sdk-linux/tools/ant/build.xml:657: Execute failed: java.io.IOException: Cannot run program "/home/max/AndroidSDK/android-sdk-linux/platform-tools/aapt": error=2, No such file or directory

The error is in some way misleading because the binary is there, but the problem is that it’s a 32-bit executable

max@praxi:~$ ls -l /home/max/AndroidSDK/android-sdk-linux/platform-tools/aapt
-rwxr-xr-x 1 max max 929400 Jul 27 14:33 /home/max/AndroidSDK/android-sdk-linux/platform-tools/aapt

max@praxi:~$ file /home/max/AndroidSDK/android-sdk-linux/platform-tools/aapt
/home/max/AndroidSDK/android-sdk-linux/platform-tools/aapt: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.8, stripped

The solution is near: we need 32-bit libraries

root@praxi:~# aptitude install ia32-libs

As always it’s a good idea to RTFM:

The Android Ant-based build system requires Ant 1.8.0

I’m setting up a new Ubuntu installation (Quantal Quetzal) and I’m going to play with some Android code on it.

The first test I did after installing the Android SDK gave me this result:

BUILD FAILED
/home/max/AndroidSDK/android-sdk-linux/tools/ant/build.xml:377: The Android Ant-based build system requires Ant 1.8.0 or later. Current version is 1.7.1

This is not what I needed, but fortunately the solution is easy enough.
Doing something like this solved my issue:

root@praxi:~# aptitude install ant=1.8.2-4build2

Done