second step api google


Step 2: Setting Up Your HTML

For the sake of simplicity, we’ll create a bare bones layout. Add the following within the body element of your document.

  1. <div id=”myMap” style=”width: 600px; height: 400px;”></div>

Step 3: Javascript

Next, add the following to your Javascript file. Review it a bit and then continue on.

  1. $(function() { // when the document is ready to be manipulated.
  2.   if (GBrowserIsCompatible()) { // if the browser is compatible with Google Map’s
  3.     var map = document.getElementById(“myMap”); // Get div element
  4.     var m = new GMap2(map); // new instance of the GMap2 class and pass in our div location.
  5.     m.setCenter(new GLatLng(36.158887, -86.782056), 13); // pass in latitude, longitude, and zoom level.
  6.   }
  7. else {alert(“Your browser is not worthy.”);}
  8. });

To take this code line by line:

  • When the document is ready to be manipulated, run the code within.This is a jQuery syntax, but jQuery isn’t required in the least. You could also simply add an “onLoad()” attribute to your body element – though this is messy.
  • If the browser that the user is accessing the map from isn’t compatible with the API, then show an alert (see bottom). Otherwise, run the code within.
  • Create a variable called “map” and tell it to find the div that will contain the map.
  • Next, create a variable called “m” and make it equal to a new instance of the “GMap2″ class. Within the parenthesis, pass in the “map” variable that you just created previously
  • Finally, set a center point so that the map knows what to show. To do this, we create a new instance of the “GLatLng” class and pass in the latitude and longitude values. You can go here to grab the appropriate values. In my case, I’ve set the coordinates to my home town. After that, you can optionally input a zoom level – which I’ve set to the standard ’13′.

This code alone will give you a basic map that might be completely appropriate for your needs. However, if you’d like to also implement “zoom” and “map mode” features, read on.

Posted in php | Comments Off

google api

Step 1: Obtain a Unique API Key

If you were to download the source code that is provided with this article, you would find that it doesn’t work on your website. The reason is because Google requires all users to obtain a unique “API key” for each site that implements Google maps.

Never fear. It’s 100% free and takes about thirty seconds to sign up. First, visit Google’s sign up page and enter the url of your website. Don’t worry about adding a specific path. The root url will cover every page that is part of that domain. Agree to the terms and conditions and click “Generate API”.

That’s it! The page that you’ve been redirected to contains your unique key as well as a sample page – to serve as a crash course. Your key will look something like:

ABQIAAAAAq93o5nn5Q3TYaaSmVsHhR1DJfR2IAi0TSZmrrsgSOYoGgsxBSG2a3MNFcUDaRPk6tAEpdWI5Odv

You’ll also find a script path that will look like:

<script src=”http://maps.google.com/maps?file=api&v=2ampkey=ABQIAAAAAq93o5nn5Q3TYaaSmVsHhR1DJfR2IAi0TSZmrrsgSOYoGgsxBSG2a3MNFcUDaRPk6tAEpdI5Odvw” type=”text/javascript”></script>
Yours will be different from mine because it will contain your own specific key value. Copy this and paste it into the head portion of your document.

Posted in php | Comments Off

how to use google map api

Google Maps

<link rel="stylesheet" href="style.css" type="text/css" media="all" title="" /

Loading Map

Now create a JavaScript file called map.js:
Copy code

function load () {
var map = document.getElementById(“map”);
if (GBrowserIsCompatible()) {
var gmap = new GMap2(map);
gmap.addControl( new GSmallMapControl() );
gmap.addControl( new GMapTypeControl()) ;
gmap.addControl( new GOverviewMapControl(new GSize(100,100)) );
gmap.setCenter( new GLatLng(54.7,-4), 5 );
} else {
alert(“Sorry, your browser cannot handle the true power of Google Maps”);
}
}
window.onload = load;
window.onunload = GUnload;

Posted in php | Comments Off

how to insert row in runtime in javascript

function AddRow(){
var table = document.getElementById(“myTable”);
if (!table) throw “Table not found”;
var row = table.insertRow(-1); //append at the end
var cell1 = row.insertCell(-1);
var cell2 = row.insertCell(-1);
cell1.innerHTML = ’2′;
cell2.innerHTML = ‘test’;
}

1 sam
Posted in php | Comments Off

how to use rollback in mysql

RollBack – As mentioned above Truncate is DDL command, so the changes made by it are committed automatically hence there is nothing called rollback when you use truncate, while Delete commands can be rolled back

Table Structure – When you use Truncate command, all the rows in the table are delete and the structure of the table is recreated and so does the indexes. On the contrary if you use Delete command only the desired rows or all the rows are deleted and the structure remains unchanged.

create a plagin code

Enough talking it is time to write some code, let’s start with function, which will be responsible for creating additional table in our database and populating it with two records. In this table we will keep information about different bots and their visits number.

function bot_install()
{
global $wpdb;
$table = $wpdb->prefix.”bot_counter”;
$structure = “CREATE TABLE $table (
id INT(9) NOT NULL AUTO_INCREMENT,
bot_name VARCHAR(80) NOT NULL,
bot_mark VARCHAR(20) NOT NULL,
bot_visits INT(9) DEFAULT 0,
UNIQUE KEY id (id)
);”;
$wpdb->query($structure);

// Populate table
$wpdb->query(“INSERT INTO $table(bot_name, bot_mark)
VALUES(‘Google Bot’, ‘googlebot’)”);
$wpdb->query(“INSERT INTO $table(bot_name, bot_mark)
VALUES(‘Yahoo Slurp’, ‘yahoo’)”);
}

so our best shot will be “activate” Plugin Hook, but be careful these one is a bit tricky.

All of WordPress actions are predefined, all except these one. Look at the code:

add_action(‘activate_bot/bots.php’, ‘bot_install’);

Remove cache in cake php use it The Motivation

The Motivation

1. When you work with large projects you can end up with a ton of cache files (models, db cache, etc.) as well as view caching files. When you try removing them with:

cd /app/tmp/cache/models && rm -f cake_*

and

cd /app/tmp/cache/views && rm -f *

.. you can end up with with the “argument list too long” error easily.

2. Also, executing two commands sucks – we are lazy after all. Now you could pull out some fancy bash fun to pipe file names. Have a look at this:

find . -type f | awk ‘!/empty/ {print “rm”, $0}’ | bash

The problem is, when you run this in /app/tmp it will not only remove cache files, but also files in /tmp/sessions, /tmp/logs and so on. If you ask me, the command is complex enough, so no need to add more funny stuff there to take this into account.

(For you peeps who want to see this, I bugged Felix to tell me: find . -type f | awk ‘!/empty$|^.\/logs|^.\/sessions/ {print “rm”, $0}’ | bash)

3. Once you are on windows, you do not have a powerful bash to your side.

I thought a simple call to a CakePHP shell can do the trick as well and doesn’t force you to waste half a minute to remember and type in the proper bash command.

Add The Categories Selector Widget To The PAGE Editor With Predefined Categories Listed?

The following code will add the categories selector widget to the WordPress Page editor interface…

add_action(‘admin_menu’, ‘my_post_categories_meta_box’);
function my_post_categories_meta_box() {
add_meta_box(‘categorydiv’, __(‘Categories’), ‘post_categories_meta_box’, ‘page’, ‘side’, ‘core’);
}

What I would like to do is to figure out how to modify the resulting category listing so that it only contains a predefined list of hard coded categories that I define. Since I’m adding this via my custom theme, it will only appear on the page editor when my theme is active on the site. And I have some specific “handler” categories that my theme installs into the site and later uses to determine layout elements. I only want these specific categories to be listed in this particular instance of the categories widget.

Using AJAX and CakePHP to dynamically populate select form fields

Today, I struggled a bit to get a select field to be dynamically populated with values. The values are depending on what choice has been made earlier in the form in combination with CakePHP.

Before we get into things I must give credit where credit is due, this article helped me a lot, although since it was based on CakePHP 1.2 things were a bit outdated, so I had to adjust it here and there.

Time to get to the point. I’m assuming that you’re already familiar with AJAX and are just trying to integrate it nicely into your Cake app. I won’t be getting into AJAX itself, so if you’re not familiar with that, I suggest reading up on it first.

Let’s say you have a form with 2 drop down menus. For example, we would like to populate a dropdown with a list of chapters whenever a book is selected from the first dropdown. We want the chapters dropdown to get re-populated with options if the book were to change. In order to achieve this, we can use CakePHP’s built-in Ajax helper, which saves us loads of time. You can easily call the Ajax helper by putting this line in the top section of your controller:

var $helpers = array(‘Ajax’);

That will make the Ajax helper available to all the views belonging to this controller’s actions. Now, on top of that, we would like our views to be “expecting” AJAX calls and stand by for them. To do that, you can use CakePHP’s RequestHandler component, which can be included in your controller like this:

var $components = array(‘RequestHandler’);

Now, let’s say we would like to give users the ability to add a synopsis for a chapter of a book. Depending on what book they pick, a list of chapters for that book should be presented. Let’s assume the models are associated with the relation: Book hasMany Chapter. Now let’s take a look at what the view for such a page might look like.

Add synopsis

Form->create(‘Book’);
echo $this->Form->input(‘Book.id’, array(‘label’ => ‘Book’, ‘empty’ => ‘– Pick a book –’));
echo $this->Form->input(‘Book.chapter_id’, array(‘label’ => ‘Chapter’, ‘empty’ => ‘– Pick a chapter –’));
echo $this->Form->input(‘Chapter.synopsis’);
echo $this->Form->end(‘Submit synopsis’);
?>

small cost create web sites

i m web developer i can create web sites low cost pls contact me

ho

<b>dfdsfsd </b>

USING’ command in LEFT JOIN

mysql> SELECT ArticleTitle, Copyright, AuthID
-> FROM Articles LEFT JOIN AuthorArticle
-> USING (ArticleID)
-> ORDER BY ArticleTitle;
+——————-+———–+——–+
| ArticleTitle | Copyright | AuthID |
+——————-+———–+——–+
| AI | 1993 | 1012 |
| Buy a paper | 1932 | 1008 |
| Buy a paper | 1932 | 1011 |
| Conferences | 1996 | 1014 |
| How write a paper | 1934 | 1009 |
| Information | 1992 | 1012 |
| Journal | 1980 | 1010 |
| Publish a paper | 1919 | NULL |
| Sell a paper | 1966 | 1006 |
+——————-+———–+——–+
9 rows in set (0.00 sec)

Drop table Articles;
Drop table Authors;
Drop table AuthorArticle;

CREATE TABLE Articles (
ArticleID SMALLINT NOT NULL PRIMARY KEY,
ArticleTitle VARCHAR(60) NOT NULL,
Copyright YEAR NOT NULL
)
ENGINE=INNODB;

INSERT INTO Articles VALUES (12786, ‘How write a paper’, 1934),
(13331, ‘Publish a paper’, 1919),
(14356, ‘Sell a paper’, 1966),
(15729, ‘Buy a paper’, 1932),
(16284, ‘Conferences’, 1996),
(17695, ‘Journal’, 1980),
(19264, ‘Information’, 1992),
(19354, ‘AI’, 1993);

CREATE TABLE Authors (
AuthID SMALLINT NOT NULL PRIMARY KEY,
AuthorFirstName VARCHAR(20),
AuthorMiddleName VARCHAR(20),
AuthorLastName VARCHAR(20)
)
ENGINE=INNODB;

INSERT INTO Authors VALUES (1006, ‘Henry’, ‘S.’, ‘Thompson’),
(1007, ‘Jason’, ‘Carol’, ‘Oak’),
(1008, ‘James’, NULL, ‘Elk’),
(1009, ‘Tom’, ‘M’, ‘Ride’),
(1010, ‘Jack’, ‘K’, ‘Ken’),
(1011, ‘Mary’, ‘G.’, ‘Lee’),
(1012, ‘Annie’, NULL, ‘Peng’),
(1013, ‘Alan’, NULL, ‘Wang’),
(1014, ‘Nelson’, NULL, ‘Yin’);

CREATE TABLE AuthorArticle (
AuthID SMALLINT NOT NULL,
ArticleID SMALLINT NOT NULL,
PRIMARY KEY (AuthID, ArticleID),
FOREIGN KEY (AuthID) REFERENCES Authors (AuthID),
FOREIGN KEY (ArticleID) REFERENCES Articles (ArticleID)
)
ENGINE=INNODB;

INSERT INTO AuthorArticle VALUES (1006, 14356),
(1008, 15729),
(1009, 12786),
(1010, 17695),
(1011, 15729),
(1012, 19264),
(1012, 19354),
(1014, 16284);

SELECT ArticleTitle, Copyright, AuthID
FROM Articles LEFT JOIN AuthorArticle
USING (ArticleID)
ORDER BY ArticleTitle;

Posted in php | Comments Off

PHP mysql_start() Function

Definition and Usage

The mysql_stat() function returns the current system status of the MySQL server.

This function returns status on success, or NULL on failure.
Syntax
mysql_stat(connection)

Parameter Description
connection Optional. Specifies the MySQL connection. If not specified, the last connection opened by mysql_connect() or mysql_pconnect() is used.

Example

Posted in php | Comments Off

php answer

46) What is the difference between the functions unlink and unset?
unlink is a function for file system handling. It will simply delete the file in context. unset will set UNSET the
specified variable.
unlink is used to delete a file. unset is used to destroy an earlier declared variable.
47) What are the different types of errors in PHP?
1. Notices: These are trivial, non-critical errors that PHP encounters while executing a script – for example,
accessing a variable that has not yet been defined. By default, such errors are not displayed to the user at all
- although you can change this default behavior.
2. Warnings: These are more serious errors – for example, attempting to include() a file which does not exist.
By default, these errors are displayed to the user, but they do not result in script termination.
3. Fatal errors: These are critical errors – for example, instantiating an object of a non-existent class, or calling
a non-existent function. These errors cause the immediate termination of the script, and PHP’s default
behavior is to display them to the user when they take place.
48) How can we create a session variable & terminate it?
$_SESSION[’name’] = “Chinmay”;
To destroy a session: unset($_SESSION[’name’]);
49) How to Create a Cookie & destroy it in PHP?
setcookie(”variable”,”value”,”time”);
variable – name of the cookie variable
variable – value of the cookie variable
time – expiry time
Example: setcookie(”test”,$i,time()+3600);
Test – cookie variable name
$i – value of the variable ‘Test’
time()+3600 – denotes that the cookie will expire after an one hour.
Destroy a cookie by specifying expiry time
Example: setcookie(”test”,$i,time()-3600); // already expired time
Reset a cookie by specifying its name only
setcookie(”test”);
50) What is the difference between sizeof($array) and count($array)?
sizeof($array) – This function is an alias of count()
count($array) – If you just pass a simple variable instead of an array it will return 1.

php question

12) What’s the difference between COPY OF A FILE & MOVE_UPLOAD_FILE in file uploading?
Move: This function checks to ensure that the file designated by filename is a valid upload file (meaning that it
was uploaded via PHP’s HTTP POST upload mechanism). If the file is valid, it will be moved to the filename
given by destination.
If filename is not a valid upload file, then no action will occur, and move_uploaded_file() will return FALSE.
Copy: Makes a copy of a file. Returns TRUE if the copy succeeded, FALSE otherwise.
13) How do you insert single & double quotes in MySQL db without using PHP?
& / &quote;
Alternately, escape single quote using forward slash \’ . In double quote you don’t need to escape quotes.
Insert double quotes as “”.
14) What do you need to do to improve the performance (speedy execution) for the script you have written?
If your script is to retrieve data from Database, you should use “Limit” syntax. Break down the non dynamic
sections of website which need not be repeated over a period of time as include files.
15) How do you capture audio/video in PHP?
You need a module installed – FFMPEG. FFmpeg is a complete solution to record, convert and stream audio
and video. It includes libavcodec, the leading audio/video codec library. FFmpeg is developed under Linux,
but it can be compiled under most operating systems, including Windows.
Page 3/8
PDF generated by PHPKB Knowledge Base Script
16) How do you know (status) whether the recipient of your mail had opened the mail i.e. read the mail?
Embed an URL in a say 0-byte image tag may be the better way to go. In other word, you embed an invisible
image on you html email and when the src URL is being rendered by the server, you can track whether your
recipients have view the emails or not.
17) What is random number?
A random number is a number generated by a process, whose outcome is unpredictable, and which cannot
be sub sequentially reliably reproduced.
18) What is difference between srand & shuffle?
The srand function seeds the random number generator with seed and shuffle is used for shuffling the array
values.
shuffle – This function shuffles (randomizes the order of the elements in) an array. This function assigns new
keys for the elements in array. It will remove any existing keys you may have assigned, rather than just
reordering the keys.
srand – Seed the random number generator
19) How can we remove duplicate values from an array?
array_unique() funciton can be used for the purpose.
20) How do I find out weather a number is odd or even?
if (number%2==0 ) then even else odd.
21) How can we get the ID generated from the previous insert operation?
SELECT MAX(ID) from tablename;
22) How to limit the number of rows to 5 that I get out of my database?
Select * from tablename LIMIT 0, 5;
23) How to store binary data in MySQL?
Use BLOB data type for the database field.
24) How can we submit a form without a submit button?
We can submit a form using the JavaScript. Example: document.formname.submit();
25) How can I maintain the count of how many persons have hit my site?
26) What is difference between mysql_fetch_array(), mysql_fetch_row() and mysql_fetch_object()?
mysql_fetch_array – Fetch the all matching records of results.
mysql_fetch_object – Fetch the first single matching record of results.
Page 4/8
PDF generated by PHPKB Knowledge Base Script
mysql_fetch_row – fetches a result row as array.
27) How to make a download page in own site, where I can know that how many file has been loaded by
particular user or particular IP address?
We can log the IP addresses in one database table while downloading the file. This way we can count and
check the no. of rows inserted for a particular download.
28) What is difference between mysql_connect and mysql_pconnect?
mysql_connect opens up a database connection every time a page is loaded. mysql_pconnect opens up a
connection, and keeps it open across multiple requests.
mysql_pconnect uses less resources, because it does not need to establish a database connection every
time a page is loaded.
29) What is the difference between “Insert”, “Update” and “Modify” events?
INSERT – Add a new record into the database table.
MODIFY – If record is available it modifies otherwise it wont modify.
UPDATE – If record is available it updates the record otherwise it creates a new record.
30) How I can get IP address?
getenv(“REMOTE_ADDR”);
31) How to make a login page where once the user has logged in will go back to the page it came from to
login page?
32) How do we know properties of the browser?
You can gather a lot of information about a person’s computer by using $_SERVER['HTTP_USER_AGENT'].
This can tell us more about the user’s operating system, as well as their browser. For example I am revealed
to be Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/418 (KHTML, like Gecko) Safari/417.9.3
when visiting a PHP page.
This can be useful to programmers if they are using special features that may not work for everyone, or if
they want to get an idea of their target audience. This also is important when using the get_browser() function
for finding out more information about the browser’s capabilities. By having this information the user can be
directed to a version of your site best suited to their browser.
get_browser() attempts to determine the capabilities of the user’s browser. This is done by looking up the
browser’s information in the browscap.ini file.
echo $_SERVER['HTTP_USER_AGENT'] . “


\n”;
$browser = get_browser();
foreach ($browser as $name => $value)
{
echo “$name $value
\n”;
Page 5/8
PDF generated by PHPKB Knowledge Base Script
}
33) What is difference between require_once(), require(), include(). Because all these function are used to
call a file in another file.
Difference between require() and require_once(): require() includes and evaluates a specific file, while
require_once() does that only if it has not been included before (on the same page).
So, require_once() is recommended to use when you want to include a file where you have a lot of functions
for example. This way you make sure you don’t include the file more times and you will not get the “function
re-declared” error.
Difference between require() and include() is that require() produces a FATAL ERROR if the file you want to
include is not found, while include() only produces a WARNING.
There is also include_once() which is the same as include(), but the difference between them is the same as
the difference between require() and require_once().
34) If you have to work with dates in the following format: “Tuesday, February 14, 2006 @ 10:39 am”, how
can you convert them to another format that is easier to use?
The strtotime function can convert a string to a timestamp.
A timestamp can be converted to date format. So it is best to store the dates as timestamp in the database,
and just output them in the format you like.
So let’s say we have $date = “Tuesday, February 14, 2006 @ 10:39 am”;
In order to convert that to a timestamp, we need to get rid of the “@” sign, and we can use the remaining
string as a parameter for the strtotime function.
So we have
$date = str_replace(“@ “,”",$date);
$date = strtotime($date);
Now $date is a timestamp and we can say:
echo date(“d M Y”,$date);
35) What is CAPTCHA?
CAPTCHA stands for Completely Automated Public Turing Test to tell Computers and Humans Apart. To
prevent spammers from using bots to automatically fill out forms, CAPTCHA programmers will generate an
image containing distorted images of a string of numbers and letters. Computers cannot determine what the
numbers and letters are from the image but humans have great pattern recognition abilities and will be able
to fairly accurately determine the string of numbers and letters. By entering the numbers and letters from the
image in the validation field, the application can be fairly assured that there is a human client using it.
36) What is the difference between sessions and cookies?
37) What is the difference between $x and $$x ?
Page 6/8
PDF generated by PHPKB Knowledge Base Script
$x is simple variable. $$x is reference variable or infact a variable of variable. A variable variable allows us to
change the name of a variable dynamically.

interview php

PHP Interview Questions – PHP Interview Questions and Answers
Author: Administrator
Saved From: http://www.knowledgebase-script.com/demo/article-694.html
PHP Interview Questions – Here are some of the best PHP Interview Questions with Answers. This is a
platform where you can get everything about PHP Interview Questions & Answers.
1) What is the difference between strstr & stristr?
For strstr, the syntax is: string strstr(string $string,string $str ); The function strstr will search $str in $string. If
it finds the string means it will return string from where it finds the $str upto end of $string.
For Example:
$string = “http://yahoomail.com”;
$str=”yahoomail”;
The output is “yahoomail.com”. The main difference between strstr and stristr is of case sensitivity. The
former consider the case difference and later ignore the case difference.
2) What is the difference between explode and split?
Split function splits string into array by regular expression. Explode splits a string into array by string.
For Example:
explode(” and”, “India and Pakistan and Srilanka”);
split(” :”, “India : Pakistan : Srilanka”);
Both of these functions will return an array that contains India, Pakistan, and Srilanka.
3) How can you avoid execution time out error while fetching record from MySQL?
set_time_limit — Limits the maximum execution time
For Example:
set_time_limit(0);
If you set to 0 you say that there is not limit.
4) Write a SQL query that displays the difference between the highest and lowest salaries of a database table
“employees”. Label the column as DIFFERENCE.
Select max(sal)-min(sal) as Difference from employees;
5) What is the difference between require() and include()?

List of Some Multimedia Based Full Forms

VCD – Video Compact Disk

DVD – Digital Video Disk

AVI – Audio Video Interleave.

3GP – 3rd Version of generation protocol

JPEG – Joint Photographic Experts Group

GIF – – Graphic Interchange Format

PNG – Portable Networks Graphic

MPEG – Moving Picture Experts Group

Ogg – Ogg files with Thedora video codec and Vorbis audio codec

MPEG4 – MPEG 4 files with H.264 video codec and AAC audio codec
full form of google, yahoo, ICICI, HDFC, oracle, gprs, smtp, mpeg, jpeg, gps, hsdpa, computer, apj abdul kalam, virus

List of Some Technology Based Full Forms

GPRS – General Packet Radio Service ( GPRS Core Network )

3G – Third Generation

GPS – Global Positioning System

UMTS – Universal Mobile Telecommunications System (UMTS)

HSDPA – High- Speed Downlink Protocol Access

GSM – Global System for Mobile Communications ( GSM )

EDGE – Enhanced Data rates for GSM Evolution (edge org )

IMEI – International Mobile Equipment Identity (dial *#06# to know your mobile IMEI number) ( Track IMEI )

IVRS – Interactive Voice Response System

CDVA – Code Division Multiple Access

RAM – Random Access Memory

ROM – Read Only Memory

MIME – Multipurpose Internet Mail Extensions

SMTP – Simple Mail Transfer Protocol ( SMTP Website )

IMAP – Internet Message Access Protocol ( IMAP Website )

HTTP – Hypertext Transfer Protocol

WWWC / W3C – World Wide Web Consortium ( W3school website )

DNS – Domain Name System

List of Some Programming Based Full Forms

AJAX – Asynchronous JavaScript and XML

Oracle – Oak Ridge Automatic Computer and Logical Engine

RDBMS – Relational DataBase Management System

SQL – Structured Query Language

XML – Extensible Markup Language

PERL – Practical Extraction and Report Language

PHP – Hypertext Preprocessor (before it was Personal Home Page )

ASP – Active Server Pages

ASPX / ASP.NET – Active Server Page Extended

API – Application Programming Interfaces

HTML – HyperText Markup Language (DHTML/HTML both are same)

XHTML – Extensible HyperText Markup Language

CSS – Cascading Style Sheets
Others

ASCII – American Standard Code for Information Interchange

Some Interesting Collection of Full Forms

Google Doodles Google – Global Organization of Oriented Group Language of Earth
(Google is written in AJAX – Asynchronous JavaScript and XML)

Yahoo – Yet Another Hierarchy of Officious OracleYahoo Logo

ADIDAS – All Day I Dream About Sports

NASA – National Aeronautics Space Administration

ISRO – Indian Space Research Organisation

KML – Keyhole Markup Language is a language schema based on the Extensible Markup Language. It’s released recently by google to view google maps.

Computer – Commonly Operating Machine Particularly Used for Technology Entertainment and Research

APJ Abdul Kalam LogoAPJ Abdul Kalam – Avul Pakir Jainulabdeen Abdul Kalam Inspirational words of Dr.A.P.J.Abdul Kalam (knwme.wordpress.com)

ICICI – Industrial Credit and Investment Corporation of India

HDFC – Housing Development Finance Corporation

Virus – Vital Information Resources Under Seize.

PSD – Photoshop Document (Photoshop Standard Document)PSD Logo

PDF – Portable Document Format (Adobe PDF)PDF Logo


Display today’s date on your WordPress blog

Many blogs displays the current date on their blog header. It looks profesional, and it is also useful, especially if your blog posts are dated. Here is a very easy way to add today’s date on your WordPress blog.

Open your header.php file (or any other file) and paste the following code:


<?php echo date('l jS F Y'); ?>

Manually reset your WordPress password

What to do if you lost your WordPress password? The easier is to use PhpMyAdmin and execute a simple SQL query to update it. Here’s how to proceed.

To achieve this recipe, login to your PhpMyAdmin, select your WordPress database and click on the “SQL” button to open the SQL query window.

Then, paste the following code in the window textarea. Don’t forget to modify the password and username before executing it. Also, make sure you have a backup of your database before executing any SQL queries to your database.


UPDATE 'wp_users' SET 'user_pass' = MD5('PASSWORD') WHERE 'user_login' ='admin' LIMIT 1;

Display the total number of your Twitter followers on your WordPress blog

The first thing to do is to paste the following php functions on the functions.php file from your WordPress blog theme:


function string_getInsertedString($long_string,$short_string,$is_html=false){
if($short_string>=strlen($long_string))return false;
$insertion_length=strlen($long_string)-strlen($short_string);
for($i=0;$i<strlen($short_string);++$i){
if($long_string[$i]!=$short_string[$i])break;
}
$inserted_string=substr($long_string,$i,$insertion_length);
if($is_html && $inserted_string[$insertion_length-1]=='<'){
$inserted_string='<'.substr($inserted_string,0,$insertion_length-1);
}
return $inserted_string;
}
function DOMElement_getOuterHTML($document,$element){
$html=$document->saveHTML();
$element->parentNode->removeChild($element);
$html2=$document->saveHTML();
return string_getInsertedString($html,$html2,true);
}function getFollowers($username){
$x = file_get_contents(“http://twitter.com/”.$username);
$doc = new DomDocument;
@$doc->loadHTML($x);
$ele = $doc->getElementById(‘follower_count’);
$innerHTML=preg_replace(‘/^<[^>]*>(.*)<[^>]*>$/’,”\\1″,DOMElement_getOuterHTML($doc,$ele));
return $innerHTML;
}

Then, simply paste the following anywhere on your theme files. Just replace our username with yours.


<?php echo getFollowers("artatm")." followers"; ?>

 

Display Archives in a drop down Menu


<select name=\"archive-dropdown\" onChange='document.location.href=this.options[this.selectedIndex].value;'>
<option value=\"\"><?php echo attribute_escape(__('Select Month')); ?></option>
<?php wp_get_archives('type=monthly&format=option&show_post_count=1'); ?> </select>

Display Tags In A Dropdown Menu

The first thing to do is to create the function. Paste the following code to your functions.php file:


<?php
function dropdown_tag_cloud( $args = '' ) {
$defaults = array(
'smallest' => 8, 'largest' => 22, 'unit' => 'pt', 'number' => 45,
'format' => 'flat', 'orderby' => 'name', 'order' => 'ASC',
'exclude' => '', 'include' => ''
);
$args = wp_parse_args( $args, $defaults );
$tags = get_tags( array_merge($args, array(‘orderby’ => ‘count’, ‘order’ => ‘DESC’)) ); // Always query top tags

if ( empty($tags) )
return;

$return = dropdown_generate_tag_cloud( $tags, $args ); // Here’s where those top tags get sorted according to $args
if ( is_wp_error( $return ) )
return false;
else
echo apply_filters( ‘dropdown_tag_cloud’, $return, $args );
}

function dropdown_generate_tag_cloud( $tags, $args = ” ) {
global $wp_rewrite;
$defaults = array(
‘smallest’ => 8, ‘largest’ => 22, ‘unit’ => ‘pt’, ‘number’ => 45,
‘format’ => ‘flat’, ‘orderby’ => ‘name’, ‘order’ => ‘ASC’
);
$args = wp_parse_args( $args, $defaults );
extract($args);

if ( !$tags )
return;
$counts = $tag_links = array();
foreach ( (array) $tags as $tag ) {
$counts[$tag->name] = $tag->count;
$tag_links[$tag->name] = get_tag_link( $tag->term_id );
if ( is_wp_error( $tag_links[$tag->name] ) )
return $tag_links[$tag->name];
$tag_ids[$tag->name] = $tag->term_id;
}

$min_count = min($counts);
$spread = max($counts) – $min_count;
if ( $spread <= 0 )
$spread = 1;
$font_spread = $largest – $smallest;
if ( $font_spread <= 0 )
$font_spread = 1;
$font_step = $font_spread / $spread;

// SQL cannot save you; this is a second (potentially different) sort on a subset of data.
if ( ‘name’ == $orderby )
uksort($counts, ‘strnatcasecmp’);
else
asort($counts);

if ( ‘DESC’ == $order )
$counts = array_reverse( $counts, true );

$a = array();

$rel = ( is_object($wp_rewrite) && $wp_rewrite->using_permalinks() ) ? ‘ rel=”tag”‘ : ”;

foreach ( $counts as $tag => $count ) {
$tag_id = $tag_ids[$tag];
$tag_link = clean_url($tag_links[$tag]);
$tag = str_replace(‘ ‘, ‘ ’, wp_specialchars( $tag ));
$a[] = “\t<option value=’$tag_link’>$tag ($count)</option>”;
}

switch ( $format ) :
case ‘array’ :
$return =& $a;
break;
case ‘list’ :
$return = “<ul class=’wp-tag-cloud’>\n\t<li>”;
$return .= join(“</li>\n\t<li>”, $a);
$return .= “</li>\n</ul>\n”;
break;
default :
$return = join(“\n”, $a);
break;
endswitch;

return apply_filters( ‘dropdown_generate_tag_cloud’, $return, $tags, $args );
}
?>

Once done, you can use the function to get your dropdown menu of tags. Just open the file where you want the list to be displayed (Most of the time it is sidebar.php) and paste the following code:


<select name="tag-dropdown" onchange="document.location.href=this.options[this.selectedIndex].value;">
<option value="#">Liste d'auteurs</option>
<?php dropdown_tag_cloud('number=0&order=asc'); ?>
</select>

Displaying Recent Comments


<?php
function recent_comments($src_count=10, $src_length=60, $pre_HTML='<ul>', $post_HTML='') {
global $wpdb;
$sql = "SELECT DISTINCT ID, post_title, post_password, comment_ID, comment_post_ID, comment_author, comment_date_gmt, comment_approved, comment_type,
SUBSTRING(comment_content,1,$src_length) AS com_excerpt FROM $wpdb->comments LEFT OUTER JOIN $wpdb->posts ON ($wpdb->comments.comment_post_ID = $wpdb->posts.ID) WHERE comment_approved = '1' AND comment_type = '' AND post_password = '' ORDER BY comment_date_gmt DESC
LIMIT $src_count";
$comments = $wpdb->get_results($sql);
$output = $pre_HTML;
foreach ($comments as $comment) {
$output .= "<li><a href=\"" . get_permalink($comment->ID) . "#comment-" . $comment->comment_ID . "\" title=\"on " . $comment->post_title . "\">" . strip_tags($comment->com_excerpt) ."...</a></li>";
}
$output .= $post_HTML;
echo $output;
}
?>

call that function

<?php recent_comments(); ?>

Number your comments

Open comments.php and find the following line:


<?php foreach ($comments as $comment) : ?>

Just above this line, initialize a counter variable:


<?php $i = 0; ?>

Just after this line, increment the counter:


<?php $i++; ?>

Now, you just have to echo the $i variable to get the number of the current comment. Paste this code anywhere on your comments loop:


<?php echo $i; ?>

Display Sticky Posts in One Area

<?php
$sticky = get_option('sticky_posts');
rsort( $sticky );
$sticky = array_slice( $sticky, 0, 5);
query_posts( array( 'post__in' => $sticky, 'caller_get_posts' => 1 ) );

if (have_posts()) :
while (have_posts()) : the_post();
the_title();
the_excerpt();
endwhile;
endif;

?>

Source

Get posts published between two particular dates


WordPress loop is very powerful, as well as the query_posts() function, which allow you to specify some parameters for the loop to retrieve posts. Though, there’s no built-in function or parameter to get posts between two dates. Let’s solve that.

Open your index.php file and find the loop. Just before the loop starts, paste the following code. Of course, don’t forget to change the dates on line 3 according to your needs.

<?php
function filter_where($where = '') {
$where .= " AND post_date >= '2009-05-01' AND post_date <=
'2009-05-15'";
return $where;
  }
add_filter('posts_where', 'filter_where');
query_posts($query_string);
?>

WordPress function to display your posts words count

function wcount(){
    ob_start();
    the_content();
    $content = ob_get_clean();
    return sizeof(explode(" ", $content));
}

Once done, you can call the function within the loop to get the number of words of the current post:

<?php echo wcount(); ?>
Posted in php | Comments Off

Display Related Posts without using Plugins

<?php
//for use in the loop, list 5 post titles related to first tag on
//current post
$tags = wp_get_post_tags($post->ID);
if ($tags) {
  echo 'Related Posts';
  $first_tag = $tags[0]->term_id;
  $args=array(
    'tag__in' => array($first_tag),
    'post__not_in' => array($post->ID),
    'showposts'=>5,
    'caller_get_posts'=>1
   );
  $my_query = new WP_Query($args);
  if( $my_query->have_posts() ) {
    while ($my_query->have_posts()) : $my_query->the_post(); ?>
      <p><a href="<?php the_permalink() ?>" rel="bookmark" title="
      Permanent Link to <?php the_title_attribute(); ?>">
      <?php the_title(); ?></a></p>
      <?php
    endwhile;
  }
}
?>
Posted in php | Comments Off

Get the first Image from the Post and display it

function catch_that_image() {
  global $post, $posts;
  $first_img = '';
  ob_start();
  ob_end_clean();
  $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i',
$post->post_content, $matches);
  $first_img = $matches [1] [0];

  if(empty($first_img)){ //Defines a default image
    $first_img = "/images/default.jpg";
  }
  return $first_img;
}

Create Your Own Popular Posts

<h2>Popular Posts</h2>
<ul>
<?php $result = $wpdb->get_results("SELECT comment_count,ID,post_title
FROM $wpdb->posts ORDER BY comment_count DESC LIMIT 0 , 5");
foreach ($result as $post) {
setup_postdata($post);
$postid = $post->ID;
$title = $post->post_title;
$commentcount = $post->comment_count;
if ($commentcount != 0) { ?>
<li><a href="<?php echo get_permalink($postid); ?>" title="<?php echo
$title ?>">
<?php echo $title ?></a> {<?php echo $commentcount ?>}</li>
<?php } } ?>
</ul>

Glow an open source javascript library by BBC

 

 

 

 

 

 

Open Source a big bang which is spreading like a fire in the forest. Everything today has an open-source alternative, let it be Microsoft Windows, Photoshop, Microsoft Office, Outlook Express or whatever. The best thing about Open Source is that people actually love it and the community contributes

number of post show

that code is used
<?php $posts = query_posts( $query_string . ‘&orderby=title&order=asc’ ); ?>
<?php if( $posts ) : ?>
<?php foreach( $posts as $post ) : setup_postdata( $post ); ?>
<li><a href=”<?php the_permalink() ?>”><?php the_title(); ?></a></li>
<?php endforeach; ?>
<?php endif; ?></ul>

Change Facebook theme using Camouflage

 

Facebook is one of the most leading social networking websites ruling the hearts of billions. The white background with blue detailing reminds us of Facebook but it has been a long time since we have been watching the same combination for ages. It has been quoted

MacBook Pro for a windows users

WordPress is a powerful CMS for a website and it provides features which makes it easy to use CMS. Navigation or Menu is one of the key point of the website. People tend to change Menu names, links, reorder them ever now & then. In a normal website it is a tedious job to change menu every time

Add default content for a new post in WordPress

o what if we can automate that type of text such that it shows up automatically whenever you start writing a new post ? Yes, that will be something awesome, hence in this blog post I am going to show you how you can do that in your blog. I am sure there must be some plugins out already for this trick, but my aim here is to make you understand how simple it is to do your own thing icon smile Add default content for a new post in WordPress

Since you know WordPress comes with lot of hooks and filters to make the development process easier. Hence we are going to use a filter which will allow us to populate some pre-defined text while creating a new post. Now let us see how to go about it.

Open functions.php which is present in the themes folder of your blog and copy the following code at the end of the file.

 
/**
 * Add a filter called default_content
 */
add_filter('default_content', 'add_pre_populated_content');

/**
 * function will get called by the filter defined above
 */
function add_pre_populated_content( $content ) {
        // you can change the content as per your requirement
	$content = "<p>Stay Digified!!<br/>Sachin Khosla</p>";
	return $content;
}

As you can see the we have added a filter called “default_content” in WordPress which is used when you hit “Add New Post” in your WordPress Admin dashboard. You can put as much content as you want to add as per your requirement. I told you already that it’s simple, right ? So go ahead and add this code snippet in your blog and enjoy.

Enable Apache,PHP in Mac OS X

Mac OS X comes with Apache,PHP pre-installed but is not enabled by default. Just when you get on to your new Mac OS X you definitely want to enable these. The following steps should help you enable PHP over Apache and you can start rolling. Enable PHP module in httpd.conf   * We first need to enable PHP module in Apache’s configuration file i.e. httpd.conf. This configuration file,httpd.conf, is stored in /etc/apache2 folder which is hidden by default. * You can directly jump into this folder by clicking on Go > Go To Folder and type /etc/apache2 . * From this folder open httpd.conf  in your favorite text editor. I am using Text Wrangler for this example. * Since this file requires root permission to edit, you can unlock this before editing. text wrangler file unlock Enable Apache,PHP in Mac OS XAlternatively, if you are not using TextWrangler, then you can open this file in OS X’s default editor called Text Edit, using this  command, sudo open -t /etc/apache2/httpd.conf * In the config file, search for the line which says “#LoadModule php5_module libexec/apache2/libphp5.so” . Notice, that it has a hash sign (#)  at the start, this means that it is commented. Just uncomment this line, by removing the hash sign (#) from the start and save the file. For my httpd.conf  the line no. is 111, you can search for string “php5” to quickly search this line. * With this step we have enabled the PHP5 module on Apache server. Creating the default php.ini Next we need to create a default php.ini file for PHP to run successfully. A default php.ini exists in the /etc  folder with the name php.ini.default . You first need to duplicate this file and simply save it with the name php.ini . If you are an advanced user or need to make any changes to the default php configuration, you can do it now or later in this very file.

Multiple Logins on Gmail Mobile now possible

We all love Gmail.. It has now become synonymous with E-mail!. It’s clean interface, simple navigation, multiple & updated features that enhance user experience & awesome SPAM filters have hooked people since the day it was launched as Beta (It carried a BETA moniker for a LONG time.. that’s a different story).

Google Wallet Friends with MasterCard & Visa! Goes Live!


There are not one but two pieces of News from Googleplex, that are bound to have a long-lasting impact on the average consumer.

By average, I mean the people who own a mid-ranged (at-least) Android Device (lower end Android devices like Micromax a70 / Kyocera & others do not have NFC hardware) and have a VISA / MasterCard Credit Card.

For a List of NFC enabled Handsets go HERE. Please note, this post is only about Google’s Android Handsets having NFC Chip within them. The list does include many handsets that have NFC capabilities but Google has not announced any plans to license the technology to other Mobile Operating Systems / Platforms with NFC hardware (Symbian, Windows, BlackBerry etc.)

First News:

Google has announced partnership no…. it has “Licensed” (I am tempted to use the word “acquired”, but I will not) VISA’s Near-Field Communications (NFC) based payment technology called PayWave. Many might not be aware but PayWave has been in the market for quite some time (since Sep 2007), but could not make any sizable dent in the credit card + contactless payment market as it was marred with anarchic laws.

This partnership clearly means that customers who own a VISA credit card will now be able to save their credit card information (securely, I might add) on their NFC enabled Android devices & make purchases at any outlet that accepts VISA credit card (who doesn’t!) AND (this is a big “and” for the time being) have NFC reader hardware present in their shops (the list is growing steadily)

clip image006 thumb Google Wallet Friends with MasterCard & Visa! Goes Live!Second News: Partnerships, acquisitions, licensing is one thing, but what good is a technology if it does not go live & can be actually used (both commercially & profitably!)

Hence, Google has announced that Google Wave has gone LIVE! That is, after conducting field trials for few months in New York city & San Francisco, the system is being rolled out at Macy’s (Departmental Store), Walgreens (Pharmaceutical) & Subway (you know…. Subway)!

The further good news is that Google has partnered with MasterCard! Using PayPass!

Similar to PayWave, the Paypass system too, could not garner huge support, but unlike VISA hurdles, the only issue hampering wide adoption was absence of enhanced user-friendliness. But that is about to change as Google’s Android rests in a Phone, the ultimate portable & user-friendly device!

So, what does this mean for Indians?

Indians are increasingly using Credit Cards, hence there is an immediate need for such ultra-fast contact-less payment systems.

Moreover, VISA & MasterCard are the two dominating Credit-Card issuers in India.

However, there is a catch (isn’t there always?). The contact-less payment system has multiple partners who have to work in tandem.

Your Mobile Phone with NFC hardware: You can get that easily.

Your Credit Card issuing Bank has to be ready (& willing) to roll out Contact-less payment option. Though this is not a technical hurdle, however it is more of a policy decision by the Banks to allow consumers to “load” their credit-card information onto their NFC enabled phones (security, fraud etc. are the usual issues to deny such service). However, the recent & rampant rollout of “Mobile Banking” by multiple Banks is a sure sign of relief!

Google-wallet: The agency that will achieve a “marriage” between all the various companies / agencies involved.

AND FINALLY:

The actual Pont-Of-Sale i.e. the merchant / seller etc. should have an additional NFC reader hardware. By far this is the largest hurdle in India, owing to the shear magnitude of NFC equipment that need to be distributed. However, this can be overcome… remember the Credit Card reader hardware were rare once upon a time, but now they are VERY common.

php developer

php is simple language and i have ability to fast create websites.

i creates facebook api and wordpress plagin,joomla etc

pls contact me you can creates the websites in small cost

pls contact me baljitsaini786@yahoo.com