PHP Interview With Manuel Lemos Founder Of PHPClasses.org


Manuel Lemos Founder Of PHPClasses.org gave a wonderful insight on PHP, following are some key points that stand out.

To begin with here is an opening statement:

Focus On The Problems Rather Than The Means To Solve Them

  1. This is the #31st set of PHP Interview to help aspiring PHP developers and PHP fans alike to get inspired by listening from those PHP guys who are already highly involved into the PHP Ocean
  2. Its is an opportunity for new PHPers to get to know their PHP Elders
  3. PHP is the pragmatic spirit of the people that developed the language features
  4. Developers that have came out of college recently are a bit obsessed to use all the design patterns they learned in school.
  5. Your software should be self-explanatory even without comments. It should be easy to read and understand what it does.
  6. Unnecessary complexity will cost more to develop
  7. IMP: Practice a lot
  8. If your day job is to work for somebody else, try creating your own sites for an useful purpose
  9. The best PHP book: The PHP online manual
  10. To debug your PHP code : error_log() and print_r() is what I often use in my development environment to inspect values and output them in a way that does not interfere with the execution of the code
  11. PHP is so powerful that it already provides the basic building blocks to do it with minimal amount of code.
  12. For database abstraction I use Metabase which is package that I started in 1999

For more information on PHP Interview With Manuel Lemos Founder Of PHPClasses.org visit :
http://7php.com/php-interview-manuel-lemos/#Purpose_Of_This_Interview

Based on the interview I can easily say that we should apply the KISS principle (“Keep it simple, stupid”), as it becomes very easy to manage and run code and keeping in mind the end result i.e. Users Satisfaction

FarmVille – New Enjoyment In Online Flash Gaming


FarmVille

facebook has done it again, being the leader in social networking it’s out done itself by launching on its own king of online flash gaming in the www (world wide web).

First when I heard about it from my friends and family, i thought its just another online game giving out trial games and then ask for money for playing the full game. But when i checked out the game i really liked it. And now  i am addicted to it.

In FarmVille you can plow, plant and harvest crops to earn money to further expand and improve your farmstead. You can also harvest trees and collect from animals.

It’s just a crazy world , farming your own land and it’s more fun when you see your own people interacting with by sending gifts, harvesting your crops or fertilizing your crops etc.

farmville

farmville

I AM TOTALLY ADDICTED TO IT NOW!!!!

and i know you are too, so what are yoiu waiting for…….. START FARMING NOW

More Info on Farville…..

Summary:

FarmVille is a real-time farm simulation game developed by Zynga, available as an application on the social networking website Facebook. The game allows members of Facebook to manage a virtual farm by planting, growing and harvesting virtual crops, trees, and livestock. Since its launch in June 2009, FarmVille has become the most popular game application on Facebook with 63.7 million active users on November 9th, 2009. FarmVille started as a duplicate of the popular Farm Town on Facebook.

More Info,,,,,,,,

Requirements:

Its requires the latest version of Adobe Falsh- flashplayer

Best browsers are: Firefox 3+ , IE7+ and Google Chrome 2+

All the best…. Don’t forget to help me in my farm!!!

Vote Now:

Compress Javascript and CSS Files Using PHP


Enhance your Javascript and CSS resources:

I have been doing some web applications lately, and wanted to compress my Javascript and CSS files so that page loads are quicker and also the files are cached at all times.

So i thought to myself, that we could truncate the JS and CSS files by removing the unwanted spaces and characters.

So i began writing a script that does the following:

  1. Reads JS or CSS files(s) from a particular folder called either js or css.
  2. Removes all the unwanted characters and blank spaces.
  3. Creates a new file in a new directory called js_cache or css_cache.
  4. Wallla!! we have done it, you have successfully reduced the file file size.

The script will allow you to manage easily your Javascript and CSS resources and to reduce the amount of data transferred between the server and the client.

Performances:

We can say that the performance is better but not the best, but it works.

You would see a slight reduce in time between the server and the client.

Restrictions:

In CSS files there are no problems, but in case of Javascript there may some problems where single line comments are used like ‘// comment ‘.

Therefore always use multi line comments like /* comment */ if you want to use this script

Requirements:

  1. Create a folder for you project
  2. Dump all the js files in js folder and css files in css folder
  3. Then create two more folders js_cache and css_cache
  4. Copy and paste this script in the project directory
  5. Edit the script by changing the constant FILE_TYPE as js or css only
  6. Run the script
  7. New files will be created in js_cache and css_cache
  8. Wow, its done now use these file instead of the original one

ALL THE BEST…

HAPPY SCRIPTING…..

Do keep sharing!!!

Download file:

Compress Javascript and CSS Files Using PHP

Basic AJAX (Asynchronous JavaScript and XML)


Ajax, sometimes written as AJAX (shorthand for asynchronous JavaScript and XML), is a group of interrelated web development techniques used on the client-side to create interactive web applications or rich Internet applications.

With Ajax, web applications can retrieve data from the server asynchronously in the background without interfering with the display and behavior of the existing page.


/**
* Declare global variable....
* @param string elementName this is to identify the elemnt in which the response should be dispalyed. like as div id (required)
*/
var elementName = "";

/**
* Open a connection to the specified URL, which is
* intended to provide an XML message. The specified data
* is sent to the server as parameters. This is the same as
* calling xmlOpen(“POST”, url, toSend, responseHandler).
*
* @param string url The URL to connect to.
* @param string toSend The data to send to the server; must be URL encoded.
* @param function responseHandler The Javascript function handling server response.
* @param function elementIdentify The elemnt in which the response should be dispalyed.
*/
function xmlPost(url, toSend, responseHandler, elementIdentify)
{
elementName = elementIdentify;
xmlOpen(“POST”, url, toSend, responseHandler);
}

/**
* Open a connection to the specified URL, which is
* intended to provide an XML message. No other data is
* sent to the server. This is the same as calling
* xmlOpen(“GET”, url, null, responseHandler).
*
* @param string url The URL to connect to.
* @param function responseHandler The Javascript function handling server response.
* @param function elementIdentify The elemnt in which the response should be dispalyed.
*/
function xmlGet(url, responseHandler, elementIdentify)
{
elementName = elementIdentify;
xmlOpen(“GET”, url, null, responseHandler);
/**
* This code can be used if you need to call the required function after every interval i.e seconds..
* setTimeout(“xmlGet(‘products.php’, notesResponseHandler)”,3000);
* setTimeout(“alert(‘products.php’)”,3000);
*/
}

/**
* Open a connection to the specified URL, which is
* intended to respond with an XML message.
*
* @param string method The connection method; either “GET” or “POST”.
* @param string url The URL to connect to.
* @param string toSend The data to send to the server; must be URL encoded.
* @param function responseHandler The Javascript function handling server response.
*/
function xmlOpen(method, url, toSend, responseHandler)
{
// alert(url);
if (window.XMLHttpRequest)
{
// browser has native support for XMLHttpRequest object
req = new XMLHttpRequest();
}
else if (window.ActiveXObject)
{
// try XMLHTTP ActiveX (Internet Explorer) version
req = new ActiveXObject(“Microsoft.XMLHTTP”);
}

if(req)
{
req.onreadystatechange = responseHandler;
req.open(method, url, true);
req.setRequestHeader(“content-type”,”application/x-www-form-urlencoded”);
req.send(toSend);
}
else
{
alert(‘Your browser does not seem to support XMLHttpRequest.’);
}
}

/**
* Handler for server’s response to notes.xml request.
* Notes are pulled from notes.xml and replace the
* contents of the DIV with id ‘notesSection’.
*/
function notesResponseHandler()
{
// Make sure the request is loaded (readyState = 4)
if (req.readyState == 4)
{
// Make sure the status is “OK”
if (req.status == 200)
{
var swappableSection = document.getElementById(elementName);
var str = req.responseText;
swappableSection.innerHTML = str;
}
else
{
alert(“There was a problem retrieving the XML data:\n” +
req.statusText);
}
}
}

/**
* When a file gets included in the page….
* Call the function on load or on click….
*/
//xmlGet(‘products.php’, notesResponseHandler);
//alert(‘called’);

XML-RPC


XML-RPC and XML-RPC Server Classes

What is XML-RPC?

Quite simply it is a way for two computers to communicate over the internet using XML. One computer, which we will call the client, sends an XML-RPC request to another computer, which we will call the server. Once the server receives and processes the request it will send back a response to the client.

For example, using the MetaWeblog API, an XML-RPC Client (usually a desktop publishing tool) will send a request to an XML-RPC Server running on your site. This request might be a new weblog entry being sent for publication, or it could be a request for an existing entry for editing. When the XML-RPC Server receives this request it will examine it to determine which class/method should be called to process the request. Once processed, the server will then send back a response message.

For detailed specifications, you can visit the XML-RPC site: http://www.xmlrpc.com/

This can be easily implemented using CodeIgniter’s framework: http://codeigniter.com/

CodeIgniter’s XML-RPC classes permit you to send requests to another server, or set up your own XML-RPC server to receive requests. Overview XML-RPC is a Remote Procedure Calling protocol that works over the Internet.

http://www.codeignitor.com/user_guide/libraries/xmlrpc.html

An XML-RPC message is an HTTP-POST request. The body of the request is in XML. A procedure executes on the server and the value it returns is also formatted in XML. Procedure parameters can be scalars, numbers, strings, dates, etc.; and can also be complex record and list structures.

XML-RPC Specification : http://www.xmlrpc.com/spec