Posts

Showing posts from February, 2013

Android - Detect whether there is an Internet connection available?

Following method return true if there is any internet connection available and can connect to internet, and it will return if app cannot connect to internet. You must import following classes. import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.content.Context; And here is the method, public boolean checkInternet() { ConnectivityManager cm = (ConnectivityManager)getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo ni = cm.getActiveNetworkInfo(); if (ni == null) { // There are no active networks. return false; } else{ return true; } }

How to find your server's IP address

You can run the following command to reveal your server’s IP address. ifconfig eth0 | grep inet | awk '{ print $2 }'

CakePHP url rewrite not working or css cake.generic.css not working.

If CakePHP is not finding your image and css files and you tried everything else like activating mod rewrite, .htacess, try editing app/Config/Core.php file. Find following line and uncomment it. Configure::write(‘App.baseUrl’, env(‘SCRIPT_NAME’));