Friday, February 19, 2010

Cron job settings in server

Cron jobs are used to run a script automatically with some time interval Example if you want to send emails daily morining to all newsletter subscribers when new jobs were added to your jobs portal these cron jobs are used. Below are the steps to setup cron jobs

For php:
Login to hosting server and goto the cron job settings page and select the time interval you want to run the script then give the command to run the php file as below

php /path-to-your-phpfile.php
(OR)
/usr/local/bin/php /path-to-your-phpfile.php

For Ruby:
/usr/local/bin/ruby /home/user/domainname/script/runner /home/user/domainname/app/cron_job.rb

Understanding of Restful Architecture

RESTful interface means clean URLs, less code, CRUD interface.

CRUD means Create-READ-UPDATE-DESTROY.

You might heard about HTTP verbs, GET, POST. In REST, they add 2 new verbs, i.e, PUT, DELETE.

There are 7 default actions, those are – index, show, new, create, edit, update, destroy

GET is used when you retrieve data from database. POST is used when you create new record in database. PUT is used when you are updating any existing record in database, and DELETE is used when you are destroying any record in database. Following table may clear the concept.

Action VERB

index GET

show GET

new GET

create POST

edit GET

update PUT

destroy DELETE