Web Server build in a minute on Ubuntu Machine

I guess, you want to make your Ubuntu server UP & running within few minutes with one click that will install all the essential packages for your web server. I created the following script that you can run right after installing your Ubuntu OS in your machine.

I tested this script over Ubuntu 14.04 LTS and nGinx as web server.

I created the following shell script for (a) Installing Common packages, (b) Configuring Virtual Host

You just need to run the installer. In your terminal just write down the following command and it will start installing all the essential thing and after that browse localhost or with server IP address and you are supposed to see the default nginx server page.

And browse ‘http://localhost’

You can explore the shell script from the following gist. First file is the shell script that you are installing in above command prompt. Second and third .conf file is for sample virtual host. I embeded those 3 files for you to look at. If you think that we can add any more things please write here in comment box so I will consider that for others.

Fast startup turn on or off in windows 10

Today is my first day in my machine to work in Windows 10. And my machine has Windows 10 installed alongside Ubuntu 14.04 LTS. But I faced my very first problem with Windows 10 today that was related to NTFS drive mounting from Linux. At last I figured out the problem.

If you use Windows 10 and Linux in same machine then when you will use Windows 10, by default Windows 10 has Fast startup turned on and that will prevent mounting your Hard disk again from Linux OS. So in that case you have to turn of the Fast startup option from your Windows 10 so you can again mount your hard disk from your Ubuntu Machine.

This is very pretty simple thing. See the following screencast and turn of Fast startup from your Windows 10 machine.
Screencast link on Youtube. Here is the link: https://www.youtube.com/watch?v=1uZU9OwjebI

Google Mobile-friendly test in PHP

Lots of folks out there about to make your website Mobile-friendly. It’s obvious that there will be significant impact on your website if your site is not mobile-friendly or what we regularly call ‘responsive’. Mobile friendly sites will get higher rank in search results in Google. And Google already started to rolling out this algorithms.

After searching on internet, I didn’t get any quick solution to check mobile-friendliness website in PHP. Although Google published it’s official Mobile-friendliness Test Tools.

When I tried to find some solutions then I figured out that Google has it’s public Pagespeed Test API v2. But in this version Google didn’t make it clear to see Pass or fail result for mobile-friendliness test. It only shows UX score. But in their v3beta1 API version they have a clear indicator about mobile-friendliness. And I figured it out and made a simple PHP functions to check the mobile-friendliness test of any website. Here is my scripts:

In the above script you just need to put your website URL to check and Google PageSpeed API Key what you will get from your Google API Console or see the Google PageSpeed Developer Getting Starter page.

Now, run your script and you will get the following array.


From the above array $result['ruleGroups']['USABILITY']['pass'] is the actual result of your website’s mobile-friendliness status. true means your website is mobile friendly and false means your failed to make your website mobile friendly. Simple.

Have fun! Write comments if you need any more assistance.

AngularJS Resource use for RESTful apps

This example will help you to learn how to interact between your backened RESTful apps and AngularJS. AngularJS has a service factory called ngResource which you can use to do CRUD operation with your RESTful backend application.

Here you just need to define the service factory which will get all notes by calling an ajax request to your http://yourRESTAPIBackendserver.url/notes. Also you can do rest of the CRUD services with that script. This script represents very basic usage of ngResource. So you learn it and try to DYI.

Don’t forget to add the main angularjs library and ng resource service library in your html head tag.


Twig and AngularJS curly braces conflict solution

Whoever loves to work with Twig template system for their PHP driven web application may want to implement AngularJS within Twig template. But the main problem will be Twig’s curly braces. AngularJS and Twig both use __ inside their template to output data. So simply, it can cause trouble to work with this two lovely systems together in your application.

But here is the solution. According to AngularJS $interpolateProvider docs I figured out the easy solution. You can change AngularJS __ symbol with any other symbol. Cool! So see how you will override that configuration.

Now you can use {[{ }]} symbol for your AngularJS. And Twig use **. So problem solved. From now on you can use AngularJS within your Twig template system.