Pages

Tuesday, April 2, 2013

php format date


$originalDate = "2010-03-21";
$newDate = date("d-m-Y", strtotime($originalDate));


<? echo date(" \n l jS F Y", strtotime($data['availability'])) ?>

http://php.net/manual/en/datetime.format.php

Monday, April 1, 2013

ec2 machine


curl -XPUT 'http://ec2-184-73-28-56.compute-1.amazonaws.com:9200/blog/post/1' -d '
{
    "user": "dilbert",
    "postDate": "2011-12-15",
    "body": "Search is hard. Search should be easy." ,
    "title": "On search"
}'

scp -i PrashantKey.pem FinaleCrawler-full.jar ubuntu@ec2-184-73-28-56.compute-1.amazonaws.com:/data

http://ec2-184-73-28-56.compute-1.amazonaws.com:9200/document/post/_search

EC2 Ubuntu Instance - UNPROTECTED PRIVATE KEY FILE


UNPROTECTED PRIVATE KEY FILE!  
permissions 0644 for 'xxxxx.pem' are too open.
It is recommended that your private key files are NOT accessible by others.
This private key will be ignored.
bad permissions: ignore key: xxxxx.pem
Permission denied (publickey).

Private keys must be readable only by the owner ..
Do chmod 400 xxxxx.pem on the machine from which you're connecting

scp (secure copy) to ec2 instance without password


scp -i myAmazonKey.pem phpMyAdmin-3.4.5-all-languages.tar.gz ec2-user@mec2-50-17-16-67.compute-1.amazonaws.com:~/.

Saturday, March 16, 2013

You should always issue a redirect for successful POST requests


The reason: if a user hits “Refresh” on a page that was loaded via POST, that request will be repeated. This can often lead to undesired behavior, such as a duplicate record being added to the database – or, in our example, the e-mail being sent twice. If the user is redirected to another page after the POST, then there’s no chance of repeating the request.
You should always issue a redirect for successful POST requests. It’s a Web development best practice.