Archive

- for November, 2010

PHP is not Java

I went for an Interview and there interviewer asked me few questions. I disagreed on two questions and their answers. According to interviewer, it is must to use parenthesis while initializing class( new className()), but I said if it requires parameters then it is essential otherwise it is not. After… (Continue)

Magic of WordPress

WordPress is having magic hidden behind it. Few magics are related to <script> and <style> tags. Today I have tried both style and script tag. I was aware of problem in style or script but did not remember where it is.
When I have entered <style> tag with some styles… (Continue)

JavaScript: Strip HTML, and get UpperCase and LowerCase words

I was looking for getting all words in uppercase in HTML text using Regex. After solving through Googling and trial and error, I thought to extend the code to return all lowercase words too. <!–Actually I was helping someone on forum and there the question was only for capturing Upper… (Continue)

Play with YQL: HTML Scraping using YQL and PHP

Here is a quick post. It is a product created from a play with YQL (Yahoo Query Language). YQL is very powerful in scrapping HTML from any page on web. Yahoo YQL and Yahoo Pipes are very powerful tool. Yahoo pipes is very good for merging Feed.
This YQL play… (Continue)

PHP: Using Callback Function/method

Before going into the details syntax of using Callbacks in PHP, we need a use case where we can use callbacks. Many PHP build-in functions uses callback function and then we need to just pass our callbacks. WordPress also accepts callback at many places.
Here the example presented gives us… (Continue)

XML in PHP (version 5+)

PHP 5 has many XML extensions. Each one has its own advantages and disadvantages. Which one to select for our task. Suppose you know some XML techniques and can dive into the XML extension whichever is suitable then you first need to know all the available extensions.
I tried to… (Continue)

Stateful Ajax experimentation

Here is a JavaScript, PHP and HTML written during experiment with stateful Ajax. The code provide stateful Ajax. It maintains the stateful Ajax as you traveled the path. file1 and file2 is separate PHP file that Ajax loads. +ve Counter is provided by one PHP file and -ve Counter is… (Continue)

RESTful new Custom Search API by Google

Google has announced new API for Custom Search. It is currently in Labs. It is always confusing for me to what API is for what use. Google has lots of search API for different usage. Google already has this API for Custom Search.
[This code has been committed to GitHub.]… (Continue)

Observer Design Pattern – Usage and Example in PHP

This is another post regarding design patterns. This time it is observer design pattern which is helpful in developing system having plugin facility and subscription based services. I will present example in PHP for Observer design pattern which is taken from Aaron Saray’s Professional PHP Design Patterns book on design… (Continue)

Just a quick post about jQuery on Google CDN

I was using 1.3.2 version of jQuery on this blog using Google CDN URL: http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js?ver=1.3.2. First this is not very good URL in the sense that few proxy is not good in caching the URLs with parameter. One example is squid. I am not sure about the current version of… (Continue)