Updating Android SDK

Recently I am facing a problem when I create an Android application with Cordova platform. It happend when I execute $ cordova platform add android. The error line showing like this;

at /home/admin/.cordova/lib/android/cordova/3.3.0/bin/lib/check_reqs.js:87:29

This error message clear to me because when I opened check_reqs.js file, I found an information what I must do. Yeah, updating Android SDK or configuring Android SDK Path. But on this post, I will show you how to update The Android SDK;

$ cd android-sdk-linux/tools
$ ./android update sdk --no-ui

For further discussion, take a look at this

Laravel 4.x setting in production and development

Surely, in production use you don’t want to show any error to the user. In simple way, you can set debug to false:

return array (

'debug' => false,



For complete setting for development and production, you can try;

$env = $app->detectEnvironment(array(
	'local' => array('localURL.com'),
	'production' => array('productionURL.com')

Define your file/folder configuration for every situation (development/production):


Easiest way to write library in Laravel

Sometimes you have change a lot in your Laravel configuration and folder. This will avoiding running composer again.

First, just open your /app/start/global.php. Add a folder libraries (whatever you want):


And now you can add any file in your libraries folder.



/* File: Bantu.php */

class Bantu {

    public static function write( $message ) {

        echo $message;



Non Alpha Numeric Regex with Javascript

Using javascript regular expressions to stop users from entering non-aphanumeric characters or white spaces

Say you want to stop users from entering non-aphanumeric characters or white spaces.

Using regular expressions would be the easiest method:

Here is my javascript code:

<script language="Javascript">
function alphaNumericCheck(){
    var regex=/^[0-9A-Za-z]+$/; //^[a-zA-z]+$/
        return true;
    else {
        alert("Please fix: password")
        return false;

For numbers only use /^[0-9]+$/

For mixed text and numbers, with spaces /^[0-9a-zA-Zs]+$/

Here are more useful regular expressions:

[a-zA-Z] any letter
d any number; same as [0-9]
D any NOT number; same as [^0-9]
w any alphanumeric character; same as [a-zA-Z-0-9_]
W any NON-alphanumeric character; same as [^a-zA-Z0-9_]
s any whitespace (tab, space, newline, etc...)
S any NON-whitespace
n newline
t tab

To view a full html sample of the above code click the links below using regular expressions in JavaScript

Restarting Mysql and Apache Using Cron Job

Have you notice that your RAM usage on your server is very close to your memory installed? It’s possible because of memory leaking and resource hogging web application. You can free your RAM by restarting Apache and MySQL.

I will give you step by step adding cron jobs into your system:

  1. Login to your server with SSH
  2. Type crontab -l to display list of cron jobs,
  3. Type crontab -e to edit your crontab,
  4. Add * 4 * * * /etc/init.d/mysqld restart to restart Mysql everyday at 4 AM,
  5. Add * 5 * * * /etc/init.d/httpd restart to restart Apache everyday at 5 AM,
  6. Save your file,
  7. Recheck with crontab -l

Step by Step Installing Composer

Since Composer works with the current working directory it is possible to install it in a system wide way.

  1. Change into a directory in your path like cd /usr/local/bin
  2. Get Composer curl -sS https://getcomposer.org/installer | php
  3. Make the phar executable chmod a+x composer.phar
  4. Change into a project directory cd /path/to/my/project
  5. Use Composer as you normally would composer.phar install

Original Source: http://stackoverflow.com/questions/11333230/how-to-run-composer-from-anywhere