Posts

Showing posts from May, 2014

How to set a cron?

Set a cronjob file Please check the details Below  which represent that how can you set a cron job on time basis    .---------------- minute (0 - 59) | .------------- hour (0 - 23) | | .---------- day of month (1 - 31) | | | .------- month (1 - 12) OR jan,feb,mar,apr ... | | | | .---- day of week (0 - 6) (Sunday=0 or 7) | | | | | * * * * * command to be executed     Example 1: Set cron job run per minute * * * * * /usr/bin/php /var/www/vhosts/site/cron/mycron.php Example 2: Set cron job to run on a specific time every day 5:50am 50 5 * * * /usr/bin/php /var/www/vhosts/site/cron/mycron.php Example 3: Set cron job to run on a specific time every day 10:50pm 50 22 * * * /usr/bin/php /var/www/vhosts/site/cron/mycron.php Example 4: Set cron job to run on every sunday 1am 00 1 * * 0 /usr/bin/php /var/www/vhosts/site/cron/mycron.php   Example 5: Set cron job to run on every sunday 1am   00 1 * * Sun /usr/bin/php /var/www/vhosts/site/cron

How to print date in linux?

How to print date in linux Simply copy and paste this command in your linux console to print the date -  date '+%A %W %Y %X' Press enter output: Thursday 20 2014 12:29:38 PM You can check more command by write this command on your console date --help

How To install MongoDB in ubuntu?

How To install MongoDB in ubuntu   step1: Open the terminal login with root and copy the given code past in terminal apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10 echo "deb http://downloads-distro. mongodb.org/repo/ubuntu- upstart dist 10gen" | tee -a /etc/apt/sources.list.d/10gen. list apt-get -y update apt-get -y install mongodb-10gen step2: $ sudo service mongodb start ******************** setup with php *************** step 1: sudo apt-get install php5-dev php5-cli php-pear step2 : sudo pecl install mongo step3: open php.ini "/etc/php5/apache2/php.ini" and set "extension=mongo.so" step4: service apache2 restart Now php with mongodb is ready for work.

How to pass parameter in routes using controller in laravel?

You can just pass the parameter like this in your routes.php file Route::get('company/{name}', array('as' => 'companydetails', 'uses' => 'PublicareaController@companydetails')); And you need to add your controller this code like this: public function companydetails($name)     {         echo $name;         die; }

How to add new field to all documents in mongoDB?

As you know that mongoDB have a update function which have four parameter to pass. You can use this like below: db.coll.update({}, $set:{name:"value"}, false, true);   You can set condition too: db.coll.update({_id:12}, $set:{name:"value"}, false, true);

How to create an Auto-Incrementing field in MongoDB?

Create an Auto-Incrementing  I checked so many article related to this but all are confusing for me because i was new in MongoDB and i want to create a field which should be auto increment like MySql. So i got an article on docs.mongodb.org and find that this article is great Here are some steps that how you can create an auto-increament id in your MongoDB Open your MongoDB screen where you write command line query Run this command and check database Step 1. show dbs - This command will show all database from your MongoDB Step 2. use databasename -  choose your database where you want to create a collection and auto increment field Now create new collection Step 3. db.createCollection("user"); Step 4. db.counters.insert(    {       _id: "userid",       seq: 0    } ) Now you need to create a function for auto increment the _id in mongoDB so create a function in your mongodb You need to write this function on your mongoDB scree

Responsive Charts with D3 with json parsing

Image
I was using chart of D3 but the chart were not responsive and also with csv. I found a article on eyeseast.github.io and i modified the article according to my need to make D3 chart responsive and work with JSON value. I passed JSON value into the Code and made some easy change. I really want to thanks eyeseast.github.io to great article of Responsive Charts with D3 but the article was not fulfilling my requirement for JSON parsing. That article use a csv file for data and some 4 column data to represent the Graph which was so difficult to understand and edit. I decided to make it more easy for  D3 chart with json parsing. Here is an example: Just copy and paste this code into a html file and run.  <style type="text/css">  /* Start css for D3 Graph for twitter Index */ div#chart{   max-width: 800px;   width: auto; } .bar rect {     stroke: #fff;     shape-rendering: crispEdges; } .bar rect.background {     fill: #E7E7E7; } .bar rect.percent {    

How to use GLYPHICONS Icon - bootstrap icon font hex value?

Here i shown hex value of the each icon, i don't see any page about it so i make this article here from bootstrap website and GLYPHICONS website,so here i will show you that how to embed that into project and use it. We can find these by looking at Bootstrap's stylesheet, Bootstrap.css. Each \{number} represents a hexadecimal value, so \2a is equal to 0x2a or &#x2a;.   You can check which icon you want to use from here: http://getbootstrap.com/components/#glyphicons and you can make css like this to use the icon:  <style> .tableheaderth{     content: "\e155";     font-family:"Glyphicons Halflings";      line-height:1;       margin:5px;       float: left; } </style> . glyphicon-asterisk : before { content : "\2a" ; } . glyphicon-plus : before { content : "\2b" ; } . glyphicon-euro : before { content : "\20ac" ; } . glyphicon-minus : before { content : "\2212" ; }