Wednesday, May 27, 2009

jQuery


jQuery is a lightweight JavaScript library that emphasizes interaction between JavaScript and HTML. 
It was released in January 2006 at BarCamp NYC by John Resig.

Dual-licensed under the MIT License and the GNU General Public License, jQuery is free, open source software.

Both Microsoft and Nokia have announced plans to bundle jQuery on their platforms, Microsoft adopting it initially within Visual Studio for use within Microsoft's ASP.NET AJAX framework and ASP.NET MVC Framework whilst Nokia will integrate it into their Web Run-Time platform.

Features

DOM element selections using the cross-browser open source selector engine Sizzle, a spin-off out of jQuery project
DOM traversal and modification (including support for CSS 1-3 and basic XPath)
Events
CSS manipulation
Effects and animations
Ajax
Extensibility
Utilities - such as browser version and the each function.
JavaScript Plugins

The Basic

This is a basic tutorial, designed to help you get started using jQuery. If you don't have a test page setup yet, start by creating a new HTML page with the following contents:


Edit the src attribute in the script tag to point to your copy of jquery.js. For example, if jquery.js is in the same directory as your HTML file, you can use:


Wednesday, May 6, 2009

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/direct/public_html/admin/index.php:1) in /home/direct /public_html/admin/header.php on line 1

how to solve above php error  and what is session handling in php.

A session refers to all the connections that a single client might make to a server in the course of viewing any pages associated with a given application. Sessions are specific to both the individual user and the application. As a result, every user of an application has a separate session and has access to a separate set of session variables.

This logical view of a session begins with the first connection to an application by a client and ends after that client's last connection. However, because of the stateless nature of the web, it is not always possible to define a precise point at which a session ends. A session should end when the user finishes using an application. In most cases, however, a web application has no way of knowing if a user has finished or is just lingering over a page.

Therefore, sessions always terminate after a time-out period of inactivity. If the user does not access a page of the application within this time-out period, ColdFusion interprets this as the end of the session and clears any variables associated with that session.

bool session_start ( void )

session_start() creates a session or resumes the current one based on the current session id that's being passed via a request, such as GET, POST, or a cookie.

If you want to use a named session, you must call session_name() before calling session_start().

session_start() will register internal output handler for URL rewriting when trans-sid is enabled. If a user uses ob_gzhandler or like with ob_start(), the order of output handler is important for proper output. For example, user must register ob_gzhandler before session start.

If you are using cookie-based sessions, you must call session_start() before anything is outputted to the browser.

Only when I had uploaded my pages from my home development server to my hosted website.  the same page worked fine in development, so there must be a difference in the php setup, but since this is a site that hosts many different clients web sites, I can't get them to change thier config.

After a little bit of research and trial and error, I found the cure was to move the line: