Convert GMT to Local timezone in PHP

Following code snippet converts a date time in GMT to Local timezone.

 

mysql table is marked as crashed and last (automatic?) repair failed

If you are getting this error

mysql table is marked as crashed and last (automatic?) repair failed

Go to your data folder and try running

You should stop MySQL process first. If that doesn’t work, you can try with

I had to navigate to /var/lib/mysql/<database> and run myisamchk -r -v -f ./<table name>.

PS – This was answered at following thread, this post is for just personal reference in future.

Reference – http://stackoverflow.com/questions/8843776/mysql-table-is-marked-as-crashed-and-last-automatic-repair-failed

Requires Doctrine DBAL Laravel migration

If you are running a migration to change the data type of a column in a table. You might come across this error message in terminal.

This error message is telling you to install doctrine/dbal to make this work. You can learn more about this package here https://github.com/doctrine/dbal

To install this package through composer, run following command in terminal.

Now you can run your migration by running

This should work now.

npm install – Please try running this command again as root/Administrator

If you are getting this error while running npm install, then you are not having write permission on .npm directory.

To get the ownership of this directory run following command

Also we need to give write permission to node_modules directory

ref – http://stackoverflow.com/questions/16151018/npm-throws-error-without-sudo

Install Mcrypt PHP extension on Ubuntu (PHP-FPM + Nginx)

To install Mcrypt PHP extension on Ubuntu / Debian run following command ( this step is same for Nginx and apache )

This will create a mcrypt module in /etc/php5/mods-available directory. If it doesnt we need to create symlink for this.

Now enable mcrypt by running

After this restart php5-fpm service by

 

Upgrade Google Cloud Compute Engine VM Instance

There two ways you can upgrade or downgrade your VM instances.

a. Stop – configure – start

b. Minimum downtime ( by swapping the disk )

a. This is a very easy method to do this. The main disadvantage of this is, it requires downtime. If you are okay with a 5 – 10 minute of downtime then you can go with this method.

b. If you this to happen almost real time then follow these steps

If you have a Google cloud compute engine VM Instance and wants to upgrade or downgrade  Continue reading

How to access remote mysql server using local phpmyadmin

phpMyAdmin is a free and open source tool written in PHP intended to handle the administration of MySQL or MariaDBwith the use of a web browser. It can perform various tasks such as creating, modifying or deleting databases, tables,fields or rows; executing SQL statements; or managing users and permissions. source: wikipedia

To access remote mysql database from your local phpmyadmin, open config.inc.php file by

Add following line

You can refer this article to install phpmyadmin on Ubuntu: http://devendraverma.com/install-phpmyadmin-on-ubuntu/

Android Splash Screen

To add Splash Screen to you android application


Splashscreen.java

AndroidManifest.xml

 

activity_splash.xml

Output

laterbox_splash_screen