Jump to Navigation

025 - PuTTY for Amazon EC2

PuTTY is a free SSH client for Windows. Other tools that form part of the PuTTY suite are PuTTYgen, a key generation program, and pscp, a secure copy command line tool. This topic outlines the additional steps required to use PuTTY with Amazon EC2. PuTTY does not natively support the private key format generated by Amazon EC2. Fortunately, PuTTY has a tool called PuTTYgen, which can convert keys to its internal format.

1. To configure PuTTY


024 - To generate a key pair using gsg-keypair

You can run an instance of a public AMI. Since it has no password, you need a public/private key pair to login to the instance. One half of this key pair is embedded in your instance, allowing you to login securely without a password using the other half of the key pair.

PROMPT> ec2-add-keypair gsg-keypair

Amazon EC2 returns a key pair.



023 - Searching Array

The preg_grep() function searches all element of an array, returning an array consisting of all
elements matching a certain pattern.


$foods = array("pasta", "steak", "fish", "potatoes");
$food = preg_grep("/^p/", $foods);

022 - Regular Expression

Reqular Expression can:

  • Replace text
  • Test for a pattern within a string
  • Extract a substring from within a string

PHP contains two ways to perform regular expressions, known as POSIX-extented and Perl-Compatible
Regular expressions(PCRE). The PCRE functions are more powerful than the POSIX ones, and faster too,
You should use the PCRE function.

POSIX: ereg()

021 - MySQL Backup Script Sample1

This is a sample backup script to keep the mysql dump for 3 days.



# Set parameters for MySQL

# Set parameters for the backup path
ROOT_PATH=/var/www/vhosts/your domain/data
BKUP_PATH=/var/www/vhosts/your domain/backups


020 - How to Set Up MySQL Replication

1. Creating a User for Replication
Each slave must connect to the master using a standard MySQL username and password,
so there must be a user account on the master that the slave can use to connect.

019 - Javascript Hello World Sample

This will show you how to write a simple HTML page that displays "Hello World!"


<script language=javascript>
document.write("Hello World!");



018 - To get RSS(XML) data

You can use curl PHP library to get RSS XML data for your aplication. It is a set of routines for making Internet file transfer easier to program.



017 - Ajax text return sample code

JavaScript generate an instance of a XMLHTTPRequest object and it can make a server request for text.


http = new XMLHttpRequest();

function getServerText() {
var myurl = 'textserver.php';
http.open("GET", url, true);
http.onreadystatechange = useHttpResponse;


016 - JSON Format

One common alternative to using XML as the format for data exchange is to use the JSON format. JSON(JavaScript Over the Network) is a compact, easy-to-parse format that uses a syntax identical to JavaScript's array and object literal syntax. The JSON specification, along with numerous links to implementations and tutorials, can be found at http://json.org/.




Subscribe to LAMP, Database and Cloud Technical Information RSS

Main menu 2

by Dr. Radut