"Lit the Candle"

PHP and Ajax for Beginners

AJAX is not a new programming language,it is a type of programming made popular by Google (with Google Suggest) to use existing standards based on JavaScript and HTTP requests.

With AJAX, your JavaScript can communicate directly with the server, using the JavaScript XMLHttpRequest object. With this object, your JavaScript can trade data with a web server, without reloading the page.

AJAX uses asynchronous data transfer (HTTP requests) between the browser and the web server, allowing web pages to request small bits of information from the server instead of whole pages.

The AJAX technique makes Internet applications smaller, faster and more user-friendly.

AJAX is a browser technology independent of web server software.

AJAX is based on the following web standards:

  • JavaScript
  • XML
  • HTML
  • CSS

There is nothing new to learn.AJAX is based on existing standards. These standards have been used by most developers for several years.The keystone of AJAX is the XMLHttpRequest object.

Different browsers use different methods to create the XMLHttpRequest object.

Internet Explorer uses an ActiveXObject, while other browsers uses the built-in JavaScript object called XMLHttpRequest.How the browsers work with ajax its depends these objects.

There are  three important properties of the XMLHttpRequest object.

a) The onreadystatechange Property

b) The readystate Property

c) The responseText Property

After a request to the server, we need a function that can receive the data that is returned by the server.

The onreadystatechange property stores your function that will process the response from a server. This is not a method, the function is stored in the property to be called automatically.

To send off a request to the server, we use the open() method and the send() method.

The open() method takes three arguments. The first argument defines which method to use when sending the request (GET or POST). The second argument specifies the URL of the server-side script. The third argument specifies that the request should be handled asynchronously. The send() method sends the request off to the server. If we assume that the HTML and PHP file are in the same directory, the code would be:

xmlHttp.open("GET","sample.php",true);
xmlHttp.send(null);

For a  example of php and ajax you should have a look at this link.

While responseText returns the HTTP response as a string, responseXML returns the response as XML.

The ResponseXML property returns an XML document object, which can be examined and parsed using W3C DOM node tree methods and properties.

As an example of Ajax ResponseXML you can try the this one.

By this time i hope that you got the very basic of ajax functionality. Now its your time to play more with Ajax.

March 23, 2009 Posted by milansaha | Ajax, Uncategorized | | No Comments Yet

Internet Explorer 8

Internet Explorer 8

Internet Explorer 8 was released on March 19th 2009.

Microsoft claims that their new browser is faster, safer, and has better support for W3C standards.

New features in Internet Explorer 8:

  • Accelerators – quick access to web services. On a restaurant web site, for example, you can click within the page to get maps, news, information about the restaurant, blog about it, or share it on Facebook
  • Web Slice – keep up with changes to the sites you care about most
  • Compatibility View – for web pages designed for older browsers
  • Search Suggestions – get suggested content as you type
  • New Tab features – allow you to open accidentally closed tabs, and group related tabs together using color codes
  • Tab isolation – prevents a faulty web site from crashing the whole browser. Only the tab with the faulty page will close
  • InPrivate – browsing the web without saving any data (like passwords, cookies, browsing history, etc.)
  • SmartScreen – protects you against installation of malware, or malicious software which can compromise your data, privacy, and identity, and also damaging your computer and valuable data

Microsoft has announced that Internet Explorer 8 will interpret web pages according to strict W3C standards by default.

Previously, Microsoft announced that IE 8 would use the “IE7 standard” as default, and that interpreting web pages according to strict W3C standards would be a secondary option. This created strong reactions in the web developer community, as the “IE 7 standard” does not completely conform to W3C standards. However, Microsoft have now reversed this decision, and it looks like Internet Explorer 8 will be truly standards-compliant.

IE 8 has full support for CSS 2.1. In addition, it has fixed many cross-browser inconsistencies such as get/set/removeAttribute, default attributes, Attribute object and the <q> tag.

pic_ie2 Download Internet Explorer


March 23, 2009 Posted by milansaha | Others | | No Comments Yet

Health Issues due to Computer

Eye problems are probably the major problems experienced by computer users. These include fatigue, blurred vision and dry eyes. These symptoms are also aggravated by external factors, such as poor lighting, improperly designed work-stations and viewing the screen up too close. Other problems are stress, depression and electromagnetic radiation hazards. Do not forget that it is better to stay away from the back of monitors, where the electromagnetic field is stronger and against which walls did not give any protection. The monitor screen surface should be approximately 18-24 inches away from upper body. It is good to have a suitable monitor screen without any wave.

Bad posture is enemy number two. Check your posture now! You should be able to reach the keyboard and mouse whilst bending your elbows at 90 degrees, with your shoulders relaxed. If you are stretching, this could cause problems. Your back should be straight and the top of the monitor should be just below eye level. If your monitor is to the left or right of your keyboard you are putting strain on your neck.

Long periods of time at the computer while blogging, working or reading often leads to pain in the lumbar region of the back. Neck and shoulder problems also result from poor seating and the poor organization of equipment on the desk (stretching for the telephone or files etc).

Your hand and wrist ache after working at the computer all day, and they sometimes start feeling numb. Research in recent years has found that things like typing and sewing rarely cause carpal tunnel. Wear splints while you work to keep your wrists from bending too high or low, and use a keyboard tray or adjust your chair so the keyboard and mouse are below your elbows and your wrists are level.

It is really important to give your fingers, wrists and hands a break from resting on the keyboard all day. A tennis ball is a great way to do this. Every time you need to think you should grab the ball and give it a few quick squeezes. This will do wonders for your joints and muscles.

Organise your computer-work properly. Look away from the screen periodically. Sit up straight and if possible chairs should be on wheels, have backrest tilt adjustment, and have arms. And of course, do not forget to blink, your eyes need the moisture.

High levels of stress can kill you, don’t make mistakes! Highly stressful workers have a higher risk of developing heart diseases and even cancer. So make sure that you can manage your stress. Start making something to reduce it, don’t wait till computer stress will be the main problem in your life. Taking frequent breaks is an important step in preventing repetitive computer stress injuries.

I consider that persons should have active lifestyle and an ergonomic computer work station, thereby even hardly computer working can’t affect their health.

March 22, 2009 Posted by milansaha | Health | | No Comments Yet