How to enable/disable Android logcat when using a custom kernel

A good source of information could be found in this page, but none of them worked for me.

The most useful article I found was on xda and here’s the solution:

  • enable
    echo 0 > /sys/module/logger/parameters/log_mode
    
  • enable at boot, but not when suspended
    echo 1 > /sys/module/logger/parameters/log_mode
    
  • completely disabled:
    echo 2 > /sys/module/logger/parameters/log_mode
    

(you need a rooted device)

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

Override DNS for KitKat – first release

Override DNS for KitKat has been released

Override DNS icon

Override DNS is the easiest way to force your rooted phone to use custom nameservers on mobile networks.

Many things dealing with name resolution have changed in Android 4.4 KitKat and so all the current Play Store apps stopped working.

The problem I found with this release of Android (4.4) is that, apparently for caching reasons, the system behaviour has been changed to redirect all DNS queries to a system daemon called netd (here’s a link to a presentation related to Android networking before 4.4 which, however, covers part of this topics).

The getprop/setprop method used by all the DNS changer apps does not work anymore. Those values, when changed, get simply ignored by the netd daemon.

It’s necessary to communicate directly to the daemon via the /dev/socket/netd socket.

The app automatically guesses the network device name and applies the right commands each time a mobile network gets activated.

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.

Run Chrome with out of date plug-ins

Plug-ins which run inside Google Chrome don’t automatically update and so they may get outdated over time. When an outdated plug-in is called inside a HTML page, Google Chrome detects that it’s out of date and a message will appear informing you that the plugin has been blocked.

An unsafe solution to the problem is to run Google Chrome with a special argument:

chrome --allow-outdated-plugins

References