Author Archive
How to test HTTPS CURL in development server?
HTTPS is secure HTTP communication based on SSL protocol (HTTP over SSL). Generally all sensitive info (like passwords, financial details, etc.) are sent over this transport. Common example: your gmail login is done through HTTPS channel and different payment gateway.
So here in this deal -
$postfields = array('field1'=>'value1', 'field2'=>'value2'); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'https://foo.com'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $postFields); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); $result = curl_exec($ch); |
CURLOPT_SSL_VERIFYHOST is off. This allows you to test the CURL in your dev server without having HTTPS. PHP/Curl will handle the http request.
What is CSS Image Sprites?
An image sprite is a collection of images put into a single image.
What is advantage of using image sprite?
- Reduce multiple server requests.
- Sprites reduce the number of server requests and save bandwidth.
- Another advantage of sprites is that you can keep all your images in one location and in some cases it makes more sense (for menus and so on).
A real life Example
If you use sprites for a “mouse over” display, the user won’t experience image disappear for a second… and it looks really good when you have heavy graphics in your site.
If you change the image instead of just moving the sprite around it will load a new image and the loading time can be visible to the end user.
CSS Image Sprites Example Code
.NotGood{ background:url(sprites.jpg); } .NotGood:hover{ background:url(spritesHover.jpg); } .Good{ background:url(sprites.jpg) 0px 0px; } .Good:hover{ background-position:15px 0px; } |
You can use Adobe Photoshop or any other image editing software to determine which area needs to be display.
JavaScript Refrence
JavaScript Variable Manipulation Functions
As shown in the following table, you can use these JavaScript statements in your own code to create and modify variables in your JavaScript functions.
| Element | Description |
|---|---|
| var myVar = 0; | Creates a variable with given starting value. Type is determined dynamically. |
| stringVar = prompt(“message”) | Sends message to user in a dialog box, retrieves text input from user and stores it in stringVar. |
| stringVar.length | Returns the length (in characters) of stringVar. |
| stringVar.toUpperCase(), stringVar.toLowerCase() | Converts stringVar to upper- or lowercase. |
| stringVar.substring() | Returns a specified subset of stringVar. |
| stringVar.indexOf() | Returns location of a substring in stringVar (or -1). |
| parseInt() | Converts string to int. |
| parseFloat() | Converts string to float. |
| toString() | Converts any variable to string. |
| eval() | Evaluates string as JavaScript code. |
| Math.ceil() | Converts any number to integer by rounding up. |
| Math.floor() | Converts any number to integer by rounding down. |
| Math.round() | Converts any number to integer by standard rounding algorithm. |
| Math.random() | Returns random float between 0 and 1. |
Basic I/O Commands in JavaScript
JavaScript programmers commonly use the commands shown in the following table for controlling dialog-based input and output in programs to be used on the Web.
| Element | Description |
|---|---|
| alert(“message”); | Creates a popup dialog containing “message.” |
| stringVar = prompt(“message”) | Send message to user in a dialog box, retrieve text input from user and store it in stringVar. |
JavaScript Conditions and Branching Code Structures
Look to the following table for JavaScript control structures you can use in your program code to add branching and looping behavior to your JavaScript programs.
| Element | Description |
|---|---|
| if (condition){ // content } else { // more content } // end if |
Executes content only if condition is true.
Optional else clause occurs if condition |
| switch (expression)
case: value; //code break; default: //code |
Compares expression against one or more values. If expression is equal to value, runs corresponding code. Default clause catches any uncaught values. |
| for(i = 0; i < count; i++)
//code } // end for |
Repeats code i times. |
| While (condition){
//code } // end while |
Repeats code as long as condition is true. |
| Function fnName(paramaters) {
//code } // end function |
Defines a function named fnName and sends it parameters. All code inside the function will execute when the function is called. |
Add JavaScript Comparison Operators to Condition Statements
JavaScript uses comparison operators inside conditions to make numeric or alphabetical comparisons of variables to other variables or values. Using these operators, you can determine whether a variable is greater than, less than, or equal to another variable or value. You can also use combinations of these comparison operators.
| Name | Operator | Example | Notes |
|---|---|---|---|
| Equality | == | (x==3) | Works with all variable types, including strings. |
| Not equal | != | (x != 3) | True if values are not equal. |
| Less than | < | (x < 3) | Numeric or alphabetical comparison. |
| Greater than | > | (x > 3) | Numeric or alphabetical comparison. |
| Less than or equal to | <= | (x <= 3) | Numeric or alphabetical comparison. |
| Greater than or equal to | >= | (x >= 3) | Numeric or alphabetical comparison. |
Create JavaScript Structures and Objects
JavaScript allows you to put together code lines to create functions and variables to create arrays. You can put functions and variables together to create objects.
| Element | Description |
| function fnName(parameters) { //code } // end function |
Defines a function named fnName and sends it parameters. All code inside function will execute when the function is called. |
| var myArray = new Array(“a”, “b”, “c”); |
Creates an array. Elements can be any type (even mixed types). |
| Var myJSON = {
“name”: “title”: } |
Creates a JSON object. Each element has a name/value pair, and can contain anything, including an array (with square braces) another JSON object, or a function. |
| Var person = new Object();
Person.name = |
Creates an object. You can add ordinary variables (which become properties) or functions (which become methods). |
Change Your Web Page with JavaScript Document Object Model Methods
The Document Object Model methods shown in the following table offer you a great way to access and modify your Web pages through your JavaScript code.
| Element | Description |
| myElement = document.getElementById(“name”); |
Gets an element from the page with the specified ID and copies a reference to that element to the variable myElement. |
| myElement.innerHTML = “value” |
Changes the value of the element to “value”. |
| document.onkeydown = keyListener | When a key is pressed, a function called keyListener is automatically activated. |
| document.onmousemove = mouseListener |
When the mouse is moved, a function called mouseListener is automatically activated. |
| setInterval(function, ms); | Runs function each ms milliseconds. |
| myArray = document.getElementByName(“name”) |
Returns an array of objects with the current name (frequently used with radio buttons). |
What is ajax synchronous and asynchronous?
Synchronous – Script stops and waits for the server to send back a reply before continuing. There are some situations where Synchronous Ajax is mandatory.
In standard Web applications, the interaction between the customer and the server is synchronous. This means that one has to happen after the other. If a customer clicks a link, the request is sent to the server, which then sends the results back.
Because of the danger of a request getting lost and hanging the browser, synchronous javascript isn’t recommended for anything outside of (onbefore)unload event handlers, but if you need to hear back from the server before you can allow the user to navigate away from the page, synchronous Javascript isn’t just your best option.
Synchronous AJAX function Example using GET.
function getFile(url) { if (window.XMLHttpRequest) { AJAX=new XMLHttpRequest(); } else { AJAX=new ActiveXObject("Microsoft.XMLHTTP"); } if (AJAX) { AJAX.open("GET", url, false); AJAX.send(null); return AJAX.responseText; } else { return false; } } var fileFromServer = getFile('http://www.phpmind.com/om.txt'); |
Synchronous AJAX function Example using POST.
function getFile(url, passData) { if (window.XMLHttpRequest) { AJAX=new XMLHttpRequest(); } else { AJAX=new ActiveXObject("Microsoft.XMLHTTP"); } if (AJAX) { AJAX.open("POST", url, false); AJAX.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); AJAX.send(passData); return AJAX.responseText; } else { return false; } } var fileFromServer = getFile('http://www.phpmind.com/data.php', sendThisDataAsAPost); |
Asynchronous – Where the script allows the page to continue to be processed and will handle the reply if and when it arrives. If anything goes wrong in the request and/or transfer of the file, your program still has the ability to recognize the problem and recover from it.
Processing asynchronously avoids the delay while the retrieval from the server is taking place because your visitor can continue to interact with the web page and the requested information will be processed with the response updating the page as and when it arrives.
What is Ajax?
Ajax (sometimes called Asynchronous JavaScript and XML) is a way of programming for the Web that gets rid of the hourglass. Data, content, and design are merged together into a seamless whole. When your customer clicks on something on an Ajax driven application, there is very little lag time. The page simply displays what they’re asking for.
Ajax is a way of developing Web applications that combines:
- XHTML and CSS standards based presentation
- Interaction with the page through the DOM
- Data interchange with XML and XSLT
- Asynchronous data retrieval with XMLHttpRequest
- JavaScript to tie it all together
JSON: The 5 minute lesson
What is Json ?
JSON stand for JavaScript Object Notation.
It is a lightweight text-based open standard designed for human-readable data interchange.
It is derived from the JavaScript programming language for representing simple data structures and associative arrays, called objects.
Despite its relationship to JavaScript, it is language-independent, with parsers available for virtually every programming language. The JSON filename extension is .json.
It is easy for humans to read and write. It is easy for machines to parse and generate.
Exmaple:
{"skillz": {
"web":[
{"name": "html",
"years": "5"
},
{"name": "css",
"years": "3"
}],
"database":[
{"name": "sql",
"years": "7"
}]
}} |
Squiggles, Squares, Colons and Commas
1. Squiggly brackets act as ‘containers’ { }
2. Square brackets holds arrays [ ]
3. Names and values are separated by a colon. :
4. Array elements are separated by commas. ,
Linux Beginner Practice using command line tool.

PhpMind Linux Practice Command line.
LAMP is growing very fast from small business to Enterprise level.
Every one is looking for LAMP developers. Most of them are very good in PHP and MYSQL but in Interview Interviewer stat asking about Apache and Linux questions they keep mum!!
This is for php beginners those who want to learn Linux and don’t have command line facility to practice. Its easy like 1 2 3 !!
1. Open this link – Linux Practice for beginners.
2. Open terminal -
3. Start working.
Amazon.com Customer Service Phone Number
Thousands of people buy amazon products every second including ebooks, books and gadgets etc. Very few people know customer care number.
Call them and ask anything you want to know!
Amazon.com customer service phone number – 1-866-216-1072
International customers can reach us at – 1-206-266-2992.
Amazon’s rebate center: 1-866-348-2492
Amazon Corporate Accounts: 1-866-486-2360
Snail mail to customer service
Amazon.com, Inc.
Customer Service
PO Box 81226
Seattle, WA 98108-1226
Service for Amazon Sellers
877-251-0696
They also have special e-mail accounts for spoofing and abuse:
stop-spoofing@amazon.com
reports@amazon.com
Canadian Customer Service
Phone 9 a.m. to 10 p.m. Eastern time, 6 a.m. to 7 p.m. Pacific: (877)-586-3230
Corporate Offices, Seattle
(206) 622-2335
The fax number has changed. 206-266-1832 is no longer a fax number.
New! Fax for Amazon’s legal Department: 206-266-7010
UK Customer Service
Phone: +44.208.636.9200
More UK numbers, from a reader:
Freephone (only from within the UK): 0800 279 6620
Phone (outside the UK): +44 20 8636 9451
Fax (free from within the UK): 0800 279 6630
Fax (outside the UK): +44 20 8636 9401
An Aussie who contacted me verified the number above but for Aussies you need to dial it this way: 0011 1 206 266-2992.
UK Snail Mail:
Amazon.co.uk Ltd
Patriot Court
1-9 The Grove
Slough
SL1 1QP
Amazon.com Headquarters
Address: 1200 12th Ave., Ste. 1200
Seattle, WA 98144
Phone: (206) 266-1000
Fax: (206) 622-2405
Info e-mail: in@amazon.com is no longer a working e-mail address.
(Amazon’s CEO is Jeff Bezos, if you want a name to put on an e-mail or fax to this office.)
Amazon customer service is good.
You asked for it! e-Bay and PayPal Phone Numbers and More!
e-Bay, Inc. - 408-376-7400
Toll Free: 800-322-9266
And another one: 888-749-3229
PayPal
1-888-221-1161
or 402-935-2050
For PayPal in the UK: 0870 7307 191 (replace the first 0 by +44 if dialling from outside the UK)
PayPal (Europe) Ltd
Hotham House
1 Heron Square
Richmond Upon Thames
TW9 1EJ
Yahoo! – 1-408-349-1572
Netflix – 1-800-585-8131
How to check your apple product warranty?
Recently I start using MacbookPro for PHP and Mysql development.
I was checking phpmind.com in my Ipod Touch and idea came to my mind that how can I check warranty of my Ipod touch online without calling Apple customer care. After spending 15 min I got very useful link.
Using this link below you can check apple product warranty.
This is useful for all those who are using apple family products.
https://selfsolve.apple.com/GetWarranty.do
Yahoo instant messenger is now on Kindle?
Kindle is very useful device, now it is possible to log into Yahoo Mail using the Kindle, turns out that you now access Yahoo Messenger with the Kindle using the Yahoo mobile service. How cool is that?
I always wanted to check my email and yahoo messenger because of my boss!
Now while I am sitting on a park I can read new PHP-MYSQL 5 EBooks and can talk with my boss without paying any thing.

Staying logged into your Yahoo messenger for long is not a good idea because it will drain your battery. Since the mobile Yahoo messenger site does not use flash or java, you will be required to manually refresh the page to see any new messages you have received.
If you want to try this out yourself, you can follow the link to the Yahoo mobile messenger site:
http://us.m.yahoo.com/p/messenger/





