<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" gd:etag="W/&quot;DUQCQX4_eCp7ImA9WhRUF04.&quot;"><id>tag:blogger.com,1999:blog-2074903243668094130</id><updated>2012-01-28T07:56:00.040Z</updated><category term="zend engine" /><category term="TypoScript" /><category term="identity operator" /><category term="cross-site scripting" /><category term="XSLT" /><category term="javascript" /><category term="SQL" /><category term="IE6" /><category term="Typo3" /><category term="===" /><category term="PDF" /><category term="missing sequence values" /><category term="VirtualBox" /><category term="TSconfig" /><category term="PRAGMA" /><category term="PHP 5 Certification" /><category term="events" /><category term="Session" /><category term="SQLite" /><category term="Skype" /><category term="the Web" /><category term="Cydia" /><category term="PHP" /><category term="jquery" /><category term="accessibility" /><category term="Google Analytics" /><category term="xcode" /><category term="iPhone" /><category term="pwnage" /><category term="highlighter" /><category term="10.6" /><category term="Linux" /><category term="thoughts" /><category term="mac" /><category term="3.0" /><category term="xss" /><category term="Ubuntu" /><category term="jailbroken" /><category term="PHP5" /><category term="svn" /><title>Float Middle</title><subtitle type="html">&lt;strong&gt;Web Developer's daily adventures in the technologies jungle.&lt;/strong&gt;&lt;br&gt;XHTML, CSS, XML, XSL, XPATH, PHP, SQL, JS and Typo3</subtitle><link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://float-middle.blogspot.com/feeds/posts/default" /><link rel="alternate" type="text/html" href="http://float-middle.blogspot.com/" /><link rel="next" type="application/atom+xml" href="http://www.blogger.com/feeds/2074903243668094130/posts/default?start-index=26&amp;max-results=25&amp;redirect=false&amp;v=2" /><author><name>Jacek Ciolek</name><uri>https://profiles.google.com/103748721182438044687</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-tzHE9XYxfZE/AAAAAAAAAAI/AAAAAAAAAAA/XK7j2YkcrrY/s512-c/photo.jpg" /></author><generator version="7.00" uri="http://www.blogger.com">Blogger</generator><openSearch:totalResults>33</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/FloatMiddle" /><feedburner:info uri="floatmiddle" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><entry gd:etag="W/&quot;CE4NSHw5fyp7ImA9WhRVEkk.&quot;"><id>tag:blogger.com,1999:blog-2074903243668094130.post-8638660798879716614</id><published>2012-01-11T00:49:00.000Z</published><updated>2012-01-11T00:49:59.227Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-01-11T00:49:59.227Z</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="thoughts" /><category scheme="http://www.blogger.com/atom/ns#" term="the Web" /><category scheme="http://www.blogger.com/atom/ns#" term="IE6" /><title>How IE6 caused the Dark Decade of the Web</title><content type="html">&lt;p class="lead"&gt;
If each developer in the world gave me a penny for every time they were swearing at IE6 then I could possibly be the richest man on the planet.&amp;nbsp;The money spent in web development worldwide just for fighting IE6 bugs could probably buy the Cure For Cancer. Dealing with IE6 was not fun by the slightest. And now, finally, this global generator of frustration is dying&amp;nbsp;a death celebrated by the whole Web Community as well as&amp;nbsp;&lt;a href="http://windowsteamblog.com/ie/b/ie/archive/2012/01/03/the-us-says-goodbye-to-ie6.aspx" target="_blank"&gt;its own creators&lt;/a&gt;. It is really the time to crack a bottle of champagne.&lt;/p&gt;
&lt;br /&gt;
No doubt, we could have been saved from the Dark Decade of the Web. Netscape Navigator was once the best browser on the Web,&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/File:Netscape-navigator-usage-data.svg" target="_blank"&gt;holding nearly 80% of the market in 1996&lt;/a&gt;. It was a strong competitor for IE and competition drives innovation. Unfortunately Netscape&amp;nbsp;couldn't keep up the pace and finally lost the Browser Wars. When the dust settled eventually, we found ourselves left with far from perfection IE6 and on the brink of the decade of frustration.&lt;br /&gt;
&lt;br /&gt;
For nearly 10 years we couldn't do much other then learn how to compensate for IE6 bugs and its devilish quirks.&amp;nbsp;We did care about IE6 not because we liked it. I don't know about you but I still hate it with passion. It gives me nightmares. We cared about IE6 because we cared about our users. What choice did they have after all? With no sensible alternatives at the time it became the most popular browser. The reference experience. The blocker of the Web innovation.&lt;br /&gt;
&lt;br /&gt;
How many times, with pondering heart, were you launching IE6&amp;nbsp;to view your newest, inventive piece of work and asking yourself: "Will it work in IE?" How many times were you dreading this question so often thrown casually into a conversation by your customer: "That looks cool. Can we have a quick look at it in IE?"And it had to look good in IE. It had to look the same in every browser.&lt;br /&gt;
&lt;br /&gt;
It was going on for so long as to became our second nature. Even after Firefox and then Chrome started gaining popularity and could deliver better experience at a lower price it had always to be the same. We were consciously downgrading the experience in more capable browsers in order to keep it "consistent". Now&amp;nbsp;IE6 is good as dead but will we still carry on? Will we pick another "reference browser", the worst on the market (let me guess... IE7?) to bring our work down to its level?&lt;br /&gt;
&lt;br /&gt;
I sincerely hope we know better than that now.&amp;nbsp;If you had a CRT TV you probably wouldn't expect to watch HD programs on it.&amp;nbsp;With browsers it is not that much different. IE7 is nothing like new Chrome. There is no reason to try and make our websites look and behave identical in both. The experience can downgrade and that is OK. As long as we define and deliver acceptable minimum the rest becomes pure fun. We don't have to worry about how it would look in IE7. We know it will be different. And that is OK.&lt;br /&gt;
&lt;br /&gt;
Even though I am concerned I believe the black scenario is not very likely to happen. The Web becomes less and less desktop-centric. Many more other devices are being used for browsing the Web today and the numbers are growing. Mobile phones, tables, game consoles - they all have different resolutions and provide different experience. The game is&amp;nbsp;no longer about minimum screen resolution. Responsive design becomes a necessity.&amp;nbsp;We are slowly growing used to the fact that the same website can look differently when we switch to another device. From here it takes just a small step to accept that it can also differ depending on the browser we use.&lt;br /&gt;
&lt;br /&gt;
I am sure that the challenges that are yet to be taken are going to be interesting. I imagine designers would be required to provide scalable designs, probably in several variations mitigating scaling stress points. Implementation of those designs would be relying more on scalable CSS3 effects rather than their graphics heavy counterparts. The focus of testing would shift to different resolutions and graceful downgrade of experience in less capable browsers.&amp;nbsp;It's the whole new world.&lt;br /&gt;
&lt;br /&gt;
Seems that the Web has just evolved, we have a&amp;nbsp;lot to learn and even more fun ahead and&amp;nbsp;IE6 is nearly dead. Isn't that exciting?&lt;br /&gt;
&lt;br /&gt;
Jacek&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
PS.&lt;br /&gt;
I would like to thank two remarkable people who inspired me and opened my eyes. &lt;a href="http://paulirish.com/" target="_blank"&gt;Paul Irish&lt;/a&gt;, the Lead Developer of Modernizr who gave a presentation on &lt;a href="http://vimeo.com/33678526" target="_blank"&gt;Developing HTML5 in cross-browser world&lt;/a&gt;&amp;nbsp;and &lt;a href="http://unstoppablerobotninja.com/" target="_blank"&gt;Ethan Marcotte&lt;/a&gt; who contributed to "An Event Apart" (Jan 2012) giving great presentation entitled "&lt;a href="http://aneventapart.com/news/2012/01/06/ethan-marcotte-a-dao-of-flexibility-video/" target="_blank"&gt;A Dao of flexibility&lt;/a&gt;".&lt;br /&gt;
&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2074903243668094130-8638660798879716614?l=float-middle.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/rx0Ix9wpDhWKpSNK92nUSVTzdfg/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/rx0Ix9wpDhWKpSNK92nUSVTzdfg/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/rx0Ix9wpDhWKpSNK92nUSVTzdfg/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/rx0Ix9wpDhWKpSNK92nUSVTzdfg/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/FloatMiddle/~4/Rv3NO79VQD8" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://float-middle.blogspot.com/feeds/8638660798879716614/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://float-middle.blogspot.com/2012/01/how-ie6-caused-dark-decade-of-web.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2074903243668094130/posts/default/8638660798879716614?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2074903243668094130/posts/default/8638660798879716614?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/FloatMiddle/~3/Rv3NO79VQD8/how-ie6-caused-dark-decade-of-web.html" title="How IE6 caused the Dark Decade of the Web" /><author><name>Jacek Ciolek</name><uri>https://profiles.google.com/103748721182438044687</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-tzHE9XYxfZE/AAAAAAAAAAI/AAAAAAAAAAA/XK7j2YkcrrY/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://float-middle.blogspot.com/2012/01/how-ie6-caused-dark-decade-of-web.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkMFRHc6cSp7ImA9WhdUF0Q.&quot;"><id>tag:blogger.com,1999:blog-2074903243668094130.post-3491532114600669922</id><published>2011-10-05T00:10:00.008+01:00</published><updated>2011-10-05T08:06:55.919+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-10-05T08:06:55.919+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="javascript" /><category scheme="http://www.blogger.com/atom/ns#" term="Google Analytics" /><title>Google Analytics code in external .js file</title><content type="html">&lt;p class="lead"&gt;
Google Analytics JavaScript code does not have to be inline. New, asynchronous GA tracker can be as well invoked from external JavaScript file with no - at least noticeable - impact on performance.&lt;/p&gt;
I have read on one of the forums that with putting GA code in an external file you lose the benefit of asynchronous architecture which is quite obviously bollocks. One of the main benefits mentioned on &lt;a href="http://www.google.com/support/analytics/bin/answer.py?answer=161379"&gt;Google Analytics help page&lt;/a&gt;&amp;nbsp;is that you can start tracking user events even before the tracking code loads and you still have that! The GA JavaScript still loads in the background and the page load time is as with inline Google Analytics code.&lt;br /&gt;
The best thing is that there is&amp;nbsp;nothing special you have to do. Just get the JavaScript code generated in your Google Analytics account and instead of pasting it directly onto the page paste it into .js file and refer to that file from your page. More or less as follows.&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-size: large;"&gt;On your page&lt;/span&gt;&lt;br /&gt;
&lt;blockquote class="code"&gt;&lt;pre class="xml"&gt;
&amp;lt;script src="file_containing_google_analytics.js" type="text/javascript"&amp;gt;&amp;lt;/script&amp;gt;&lt;/pre&gt;&lt;/blockquote&gt;
&lt;span class="Apple-style-span" style="font-size: large;"&gt;Inside the file_containig_google_analytics.js:&lt;/span&gt;&lt;br /&gt;
&lt;blockquote class="code"&gt;&lt;pre class="javascript"&gt;
&amp;nbsp; var _gaq = _gaq || [];
&amp;nbsp; _gaq.push(['_setAccount', 'UA-XXXXXXX-X']);
&amp;nbsp; _gaq.push(['_trackPageview']);

(function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();&lt;/pre&gt;&lt;/blockquote&gt;
Have fun!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2074903243668094130-3491532114600669922?l=float-middle.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/Ml-Z-s1HMrPUgeF0Jktt45SnlQo/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Ml-Z-s1HMrPUgeF0Jktt45SnlQo/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/Ml-Z-s1HMrPUgeF0Jktt45SnlQo/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Ml-Z-s1HMrPUgeF0Jktt45SnlQo/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/FloatMiddle/~4/PlFe2hI9QnI" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://float-middle.blogspot.com/feeds/3491532114600669922/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://float-middle.blogspot.com/2011/10/google-analytics-code-in-external-js.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2074903243668094130/posts/default/3491532114600669922?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2074903243668094130/posts/default/3491532114600669922?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/FloatMiddle/~3/PlFe2hI9QnI/google-analytics-code-in-external-js.html" title="Google Analytics code in external .js file" /><author><name>Jacek Ciolek</name><uri>https://profiles.google.com/103748721182438044687</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-tzHE9XYxfZE/AAAAAAAAAAI/AAAAAAAAAAA/XK7j2YkcrrY/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://float-middle.blogspot.com/2011/10/google-analytics-code-in-external-js.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkQMR3wyfSp7ImA9Wx9aGUg.&quot;"><id>tag:blogger.com,1999:blog-2074903243668094130.post-3905798516663905</id><published>2011-03-12T18:23:00.001Z</published><updated>2011-03-12T18:26:26.295Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-03-12T18:26:26.295Z</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="iPhone" /><category scheme="http://www.blogger.com/atom/ns#" term="Linux" /><category scheme="http://www.blogger.com/atom/ns#" term="Ubuntu" /><title>iPhone 4.2 and Ubuntu 10.10 - mount problem with dbus</title><content type="html">&lt;p class="lead"&gt;I can't believe it's been nearly half a year since my last post. Anyways. It so happened that I was stuck with a large video on my iPhone. I wanted to download it however my iTunes had different opinion and refused to deal with it. As I'm running Ubuntu 10.10 on my laptop I have decided to try my luck in there.&lt;/p&gt;
I have plugged my iPhone in and to my dismay my beloved Ubuntu threw ugly DBus error in my face saying iPhone could not be mounted. I should've taken a screenshot but hey, who wants to remember error messages? Nevertheless after some googling I have discovered that iOS 4.2 requires libimobiledevice1 package upgrade to version 1.0.4. Unfortunately official stable repos offer version 1.0.1 at the moment but it's nothing to worry about, though. Thanks to &lt;a href="https://launchpad.net/~pmcenery/+archive/ppa"&gt;Paul McEnery&lt;/a&gt; you can benefit from your iPhone 4.2 connected successfully to your Ubuntu machine. Just add the PPA in command line:
&lt;blockquote&gt;&lt;code&gt;sudo apt-add-repository ppa:pmcenery/ppa&lt;/code&gt;&lt;/blockquote&gt;
next do the update:
&lt;blockquote&gt;&lt;code&gt;sudo apt-get update&lt;/code&gt;&lt;/blockquote&gt;
and then install/upgrade the library and other tools if necessary.
Thanks for reading. I hope you found it helpful.
&lt;em&gt;Jacek&lt;/em&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2074903243668094130-3905798516663905?l=float-middle.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/pt2Gxime11axGHwEl_BaLVGYkJ0/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/pt2Gxime11axGHwEl_BaLVGYkJ0/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/pt2Gxime11axGHwEl_BaLVGYkJ0/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/pt2Gxime11axGHwEl_BaLVGYkJ0/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/FloatMiddle/~4/V7PboYFNZLo" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://float-middle.blogspot.com/feeds/3905798516663905/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://float-middle.blogspot.com/2011/03/iphone-42-and-ubuntu-1010-mount-problem.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2074903243668094130/posts/default/3905798516663905?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2074903243668094130/posts/default/3905798516663905?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/FloatMiddle/~3/V7PboYFNZLo/iphone-42-and-ubuntu-1010-mount-problem.html" title="iPhone 4.2 and Ubuntu 10.10 - mount problem with dbus" /><author><name>Jacek Ciolek</name><uri>https://profiles.google.com/103748721182438044687</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-tzHE9XYxfZE/AAAAAAAAAAI/AAAAAAAAAAA/XK7j2YkcrrY/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://float-middle.blogspot.com/2011/03/iphone-42-and-ubuntu-1010-mount-problem.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C04CSXc5fip7ImA9Wx5VEUg.&quot;"><id>tag:blogger.com,1999:blog-2074903243668094130.post-8546592177092927090</id><published>2010-10-04T01:24:00.001+01:00</published><updated>2010-10-04T01:26:08.926+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-10-04T01:26:08.926+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="javascript" /><category scheme="http://www.blogger.com/atom/ns#" term="jquery" /><category scheme="http://www.blogger.com/atom/ns#" term="events" /><title>jQuery Event Showcase</title><content type="html">&lt;p class="lead"&gt;Have you ever wondered in what order JavaScript events are fired? What are the event object properties? How events differ in different browsers? Good news - wonder no more, check it out yourself.&lt;/p&gt;
&lt;p&gt;The &lt;a href="http://webnicer.com/javascript/jquery-event-showcase.html"&gt;jQuery Event Showcase&lt;/a&gt; records the events you cause with your actions and allows you to browse through them. Clear visual indication shows you which element fired each event. You can also see all the event object properties, and if a property is an object or a function - you can also see all the details of it and so on. Better still, at your command remains events filter which helps you focus on the event types you want to investigate.&lt;/p&gt;
&lt;p&gt;A few screenshots:&lt;/p&gt;
&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: left; margin-right: 1em; text-align: left;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://webnicer.com/javascript/jquery-event-showcase.html"&gt;&lt;img border="0" height="237" src="http://2.bp.blogspot.com/_RbwT9UpEI_8/TKkXzcMX1YI/AAAAAAAAAi0/jWXgCeq4l1I/s320/event-log-list.png" style="margin-left: auto; margin-right: auto;" width="320" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;&lt;a href="http://webnicer.com/javascript/jquery-event-showcase.html"&gt;List of events in the Events Log&lt;/a&gt; &lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: left; margin-right: 1em; text-align: left;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://webnicer.com/javascript/jquery-event-showcase.html"&gt;&lt;img border="0" height="237" src="http://3.bp.blogspot.com/_RbwT9UpEI_8/TKkXwgBLn8I/AAAAAAAAAis/7aLYOLVJZ_g/s320/event-log-details.png" style="margin-left: auto; margin-right: auto;" width="320" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;&lt;a href="http://webnicer.com/javascript/jquery-event-showcase.html"&gt;Event details in the Events Log&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: left; margin-right: 1em; text-align: left;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://webnicer.com/javascript/jquery-event-showcase.html"&gt;&lt;img border="0" height="237" src="http://1.bp.blogspot.com/_RbwT9UpEI_8/TKkXyw9z4AI/AAAAAAAAAiw/ULTR1Io30sA/s320/event-log-filter.png" style="margin-left: auto; margin-right: auto;" width="320" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;&lt;a href="http://webnicer.com/javascript/jquery-event-showcase.html"&gt;Events Filter&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;p&gt;Any feedback welcome.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Jacek&lt;/em&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2074903243668094130-8546592177092927090?l=float-middle.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/UeiP1EWIeYWT6JhYaBD_IhSnzHg/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/UeiP1EWIeYWT6JhYaBD_IhSnzHg/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/UeiP1EWIeYWT6JhYaBD_IhSnzHg/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/UeiP1EWIeYWT6JhYaBD_IhSnzHg/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/FloatMiddle/~4/rnRaYPS1_hY" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://float-middle.blogspot.com/feeds/8546592177092927090/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://float-middle.blogspot.com/2010/10/jquery-event-showcase.html#comment-form" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2074903243668094130/posts/default/8546592177092927090?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2074903243668094130/posts/default/8546592177092927090?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/FloatMiddle/~3/rnRaYPS1_hY/jquery-event-showcase.html" title="jQuery Event Showcase" /><author><name>Jacek Ciolek</name><uri>https://profiles.google.com/103748721182438044687</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-tzHE9XYxfZE/AAAAAAAAAAI/AAAAAAAAAAA/XK7j2YkcrrY/s512-c/photo.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/_RbwT9UpEI_8/TKkXzcMX1YI/AAAAAAAAAi0/jWXgCeq4l1I/s72-c/event-log-list.png" height="72" width="72" /><thr:total>1</thr:total><feedburner:origLink>http://float-middle.blogspot.com/2010/10/jquery-event-showcase.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUQEQXszfCp7ImA9Wx5XEEo.&quot;"><id>tag:blogger.com,1999:blog-2074903243668094130.post-5636897678058600729</id><published>2010-09-10T00:01:00.000+01:00</published><updated>2010-09-10T00:01:40.584+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-09-10T00:01:40.584+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="javascript" /><category scheme="http://www.blogger.com/atom/ns#" term="highlighter" /><title>JavaScript: best code highlighter I have seen</title><content type="html">&lt;p class="lead"&gt;
I needed JavaScript code highlighter for my recent project and having a gut feeling that someone has done it already, I decided to do a search rather than develop it myself. Not so much as a surprise it turned out to be good feeling and soon enough I ended up testing a dozen of different highlighters. I had spent good couple of hours before I found the one. Sharing is caring so here we go.&lt;/p&gt;
That beauty is called &lt;a class="external" href="http://softwaremaniacs.org/soft/highlight/en/"&gt;hightlight.js&lt;/a&gt;. You won't be disappointed especially if you are using jQuery, although it's a standalone library. It was created by talented Russian programmer &lt;a class="external" href="http://softwaremaniacs.org/about/en/"&gt;Ivan Sagalaev&lt;/a&gt; who claims to be Software Maniac. He put together very simple &lt;a href="http://softwaremaniacs.org/soft/highlight/en/description/" class="external"&gt;documentation page&lt;/a&gt; which contains everything you need to know. It took me literally 5 minutes to download it, unpack it and get it working.

Why do I think highlight.js is the best JavaScript highlighter?
&lt;ul&gt;
&lt;li&gt;supports 32 different types of syntax, including exotic ones like Lua, Lisp or Nginx&lt;/li&gt;
&lt;li&gt;is a standalone library but is very easy to use with mootools, jQuery, prototype or any other JS library&lt;/li&gt;
&lt;li&gt;can be used to highlight code injected to the DOM with JS (for some reason that didn't work for me with quite a few other libraries)&lt;/li&gt;
&lt;li&gt;allows user to choose which nodes should be processed and does not force parsing the whole document&lt;/li&gt;
&lt;li&gt;does not require being called upon document load event&lt;/li&gt;
&lt;li&gt;is quite simplistic and is not trying to do 1000 things except from the one that you need; instead it does one thing and does it well: highlights code&lt;/li&gt;
&lt;/ul&gt;

Damn it, now I'm tempted to use it on my own old blog pages with code examples.

Respect, Ivan!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2074903243668094130-5636897678058600729?l=float-middle.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/l9lWFrM7RdZGuOw5XhINB7SFbxE/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/l9lWFrM7RdZGuOw5XhINB7SFbxE/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/l9lWFrM7RdZGuOw5XhINB7SFbxE/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/l9lWFrM7RdZGuOw5XhINB7SFbxE/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/FloatMiddle/~4/66wMTLdkzwc" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://float-middle.blogspot.com/feeds/5636897678058600729/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://float-middle.blogspot.com/2010/09/javascript-best-code-highlighter-i-have.html#comment-form" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2074903243668094130/posts/default/5636897678058600729?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2074903243668094130/posts/default/5636897678058600729?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/FloatMiddle/~3/66wMTLdkzwc/javascript-best-code-highlighter-i-have.html" title="JavaScript: best code highlighter I have seen" /><author><name>Jacek Ciolek</name><uri>https://profiles.google.com/103748721182438044687</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-tzHE9XYxfZE/AAAAAAAAAAI/AAAAAAAAAAA/XK7j2YkcrrY/s512-c/photo.jpg" /></author><thr:total>2</thr:total><feedburner:origLink>http://float-middle.blogspot.com/2010/09/javascript-best-code-highlighter-i-have.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkAMQHkzeip7ImA9WxFbEE8.&quot;"><id>tag:blogger.com,1999:blog-2074903243668094130.post-1899498551958170849</id><published>2010-07-01T22:44:00.001+01:00</published><updated>2010-07-01T22:46:21.782+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-07-01T22:46:21.782+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="10.6" /><category scheme="http://www.blogger.com/atom/ns#" term="mac" /><category scheme="http://www.blogger.com/atom/ns#" term="svn" /><title>How to get SubVersioN on Mac OS X 10.6?</title><content type="html">&lt;p class="lead"&gt;
Even if you work on a project on your own it's worth having version control system in place. It helps to keep things tidy and gives you time machine possibilities for working with your code (I am not talking about the trademarked machine). I like SVN which is mature and seems to have it all. Let's have a look how to install that beast on our lovely Macs.&lt;/p&gt;
&lt;h4&gt;
Download SVN for free&lt;/h4&gt;
&lt;p&gt;First good news - SVN comes with a nice Mac-like installer and is completely free and published  under &lt;a href="http://svn.apache.org/repos/asf/subversion/trunk/LICENSE"&gt;Apache Licence&lt;/a&gt;. You can &lt;a href="http://www.open.collab.net/products/subversion/getit_community.html"&gt;download it from CollabNet website&lt;/a&gt;. It requires free registration which at first seems a bit dodgy but CollabNet is the company responsible for creating SVN and it's a good source.&lt;/p&gt;

&lt;h4&gt;
Install SVN on Mac OS X 10.6&lt;/h4&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://4.bp.blogspot.com/_RbwT9UpEI_8/TCpzfkrtQzI/AAAAAAAAAhs/AxlYZRG_vGA/s1600/subversion+installer.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_RbwT9UpEI_8/TCpzfkrtQzI/AAAAAAAAAhs/AxlYZRG_vGA/s320/subversion+installer.png" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;p&gt;Once you have downloaded the package it's time to install it. The installer looks all pretty and takes no longer than just a few moments. It installs the whole svn bunch (server and client) in /opt/subversion directory. The only downside is that you don't get any fancy application like you do for MAMP to control it. After you've finished the installation it all happens in the command line... but cheer up, it's not that scary. You will get it up and running in no time.&lt;/p&gt;

&lt;h4&gt;Set up evironment&lt;/h4&gt;
&lt;p&gt;SVN gives you complete freedom of the location of your repositories. It goes like this. You create a directory wherever you wish and tell your svn server to feel at home in there. That directory is then your svn server root directory. Your SVN server will create your repositories in there.&lt;/p&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/_RbwT9UpEI_8/TC0JZqwlBQI/AAAAAAAAAiM/l-V2SrGjkow/s1600/profile.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_RbwT9UpEI_8/TC0JZqwlBQI/AAAAAAAAAiM/l-V2SrGjkow/s320/profile.png" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;p&gt;Let's get started then. Since all the svn related programs are located in &lt;code&gt;/opt/subversion/bin&lt;/code&gt; you have to specify the path every time you need to run them. It's not handy at all, we would prefer not to worry about where they are. That's not a biggy. Fire up your Terminal (it's that monitor icon in &lt;code&gt;/Applications/Utilities&lt;/code&gt;) and edit the file &lt;code&gt;.profile&lt;/code&gt; in your home directory. I, for one, like vim but it might be slightly depressing experience at first if you are not familiar with it. In that case use pico, it's really straighforward
&lt;blockquote&gt;&lt;code&gt;$ pico .profile&lt;/code&gt;&lt;/blockquote&gt;
and add the following line at the end of the file:
&lt;blockquote&gt;&lt;code&gt;export PATH=/opt/subversion/bin:$PATH&lt;/code&gt;&lt;/blockquote&gt;
The &lt;code&gt;.profile&lt;/code&gt; file is read every time you create new shell, so next time you open your Terminal the change will be applied. Because we don't want to close the Terminal just yet only to reopen it let's cheat a tiny bit:&lt;blockquote&gt;&lt;code&gt;$ . .profile&lt;/code&gt;&lt;/blockquote&gt;&lt;/p&gt;
&lt;p&gt;Well done! Let's check if it works &lt;blockquote&gt;&lt;code&gt;$ svn&lt;br /&gt;Type 'svn help' for usage.&lt;/code&gt;&lt;/blockquote&gt; If you got similar output you are ready to proceed.&lt;/p&gt;

&lt;h4&gt;Set up SVN repository&lt;/h4&gt;
&lt;p&gt;Now it's time to create root directory for the SVN server. You can name it whatever you like and create it even in your home directory if you wish. SVN is not fussy at all. Let's do that then and let's give it meaningful name "svnrepos".
&lt;blockquote&gt;&lt;code&gt;$ mkdir svnrepos&lt;/code&gt;&lt;/blockquote&gt; And finally it's time to launch your SVN server. By the way it's not a typo, there is no 'r' at the end:
&lt;blockquote&gt;&lt;code&gt;$ svnserve -d -r svnrepos&lt;/code&gt;&lt;/blockquote&gt;
There are no repositories. All we have is just SVN server ready for action. Let's give him something to look after. If you want to create a test repository to play with it for a while, just do this: &lt;blockquote&gt;&lt;code&gt;$ svnadmin create svnrepos/test&lt;/code&gt;&lt;/blockquote&gt;&lt;/p&gt;

&lt;h4&gt;Set up privileges&lt;/h4&gt;
&lt;p&gt;Congratulations! You have just created your repository. Good thing is you don't need to worry about having to do some magic tricks later on to get rid of the test repository whenever you feel like it. Simply delete the directory svnrepost/test and it's gone forever. For now though, it's accesible through the URL &lt;code&gt;svn://localhost/test&lt;/code&gt; but you cannot do much with it unless you grant yourself the privileges.&lt;/p&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/_RbwT9UpEI_8/TC0Dd6rM7aI/AAAAAAAAAh0/j5htQmPu_mM/s1600/svnserve+passwd.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_RbwT9UpEI_8/TC0Dd6rM7aI/AAAAAAAAAh0/j5htQmPu_mM/s320/svnserve+passwd.png" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;p&gt;SVN server keeps access control lists per repository, so you need to dive into config directory of your newly created repository and conquer! Sounds like a big job but it isn't. All it takes is adding one line in one file and removing one comment in another one. Go to svnserve/test/conf and edit the file passwd first. Here you will add your preferred username and password. It's easier when you choose your Mac username. For example, my Mac username is "jacek" and my password for the test repository is "test", so I added a line &lt;code&gt;jacek = test&lt;/code&gt;.&lt;/p&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/_RbwT9UpEI_8/TC0DqRr2NvI/AAAAAAAAAh8/82yaFcc0br4/s1600/svnserve+config.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_RbwT9UpEI_8/TC0DqRr2NvI/AAAAAAAAAh8/82yaFcc0br4/s320/svnserve+config.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;p&gt;Next edit the file svnserve.conf and remove comment from the line saying &lt;code&gt;password-db = passwd&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Believe it or not, that's it! Now you can access your repository through your favourite SVN client and do whater SVN clients do. One thing you need to remember is to run &lt;blockquote&gt;&lt;code&gt;svnserve -d -r svnrepos&lt;/code&gt;&lt;/blockquote&gt;
every time you start your Mac. Of course it's quite easy to make it happen automagically but that's for another story.&lt;/p&gt;
&lt;p&gt;Thanks for reading. I hope you found this guide useful, it worked for you and made you a bit happier. Please don't think twice before you leave your comment.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Jacek&lt;/em&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2074903243668094130-1899498551958170849?l=float-middle.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/Kj8fpCnuGSCAsn1cGR738BBq6_0/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Kj8fpCnuGSCAsn1cGR738BBq6_0/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/Kj8fpCnuGSCAsn1cGR738BBq6_0/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Kj8fpCnuGSCAsn1cGR738BBq6_0/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/FloatMiddle/~4/l7oO0oIdXz8" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://float-middle.blogspot.com/feeds/1899498551958170849/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://float-middle.blogspot.com/2010/07/how-to-get-subversion-on-mac-os-x-106.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2074903243668094130/posts/default/1899498551958170849?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2074903243668094130/posts/default/1899498551958170849?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/FloatMiddle/~3/l7oO0oIdXz8/how-to-get-subversion-on-mac-os-x-106.html" title="How to get SubVersioN on Mac OS X 10.6?" /><author><name>Jacek Ciolek</name><uri>https://profiles.google.com/103748721182438044687</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-tzHE9XYxfZE/AAAAAAAAAAI/AAAAAAAAAAA/XK7j2YkcrrY/s512-c/photo.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/_RbwT9UpEI_8/TCpzfkrtQzI/AAAAAAAAAhs/AxlYZRG_vGA/s72-c/subversion+installer.png" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://float-middle.blogspot.com/2010/07/how-to-get-subversion-on-mac-os-x-106.html</feedburner:origLink></entry><entry gd:etag="W/&quot;Ak4FRnsyeSp7ImA9WxFXFEo.&quot;"><id>tag:blogger.com,1999:blog-2074903243668094130.post-3618150790108112832</id><published>2010-05-11T23:35:00.007+01:00</published><updated>2010-05-21T22:55:17.591+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-05-21T22:55:17.591+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="javascript" /><category scheme="http://www.blogger.com/atom/ns#" term="XSLT" /><title>How to put CDATA into script tag in XSLT</title><content type="html">&lt;p class="lead"&gt;You have an XSL template for the website you are working on and you would like to embed some JavaScript in the markup. You care so you would like to keep the XHTML output valid. Easy enough - all it takes is wrapping the actual JavaScript code with CDATA. To make it safe you would also add JS comments around CDATA and move on. But is it really that easy with XSL? Let's have a look.&lt;/p&gt;

&lt;h4&gt;XSL template for JavaScript&lt;/h4&gt;
&lt;p&gt;Here is the working solution which allows for safe embedding JavaScript on XHTML pages created with XSL templates.&lt;/p&gt;

&lt;h5&gt;Example 0&lt;/h5&gt;
&lt;blockquote class="code"&gt;&lt;pre class="xml" style="font-family:monospace;"&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;
&amp;lt;xsl:transform version=&amp;quot;1.0&amp;quot;
    xmlns:xsl=&amp;quot;http://www.w3.org/1999/XSL/Transform&amp;quot;&amp;gt;
    &amp;lt;xsl:output
        method=&amp;quot;xml&amp;quot;
        encoding=&amp;quot;utf-8&amp;quot;
        doctype-public=&amp;quot;-//W3C//DTD XHTML 1.0 Strict//EN&amp;quot;
        doctype-system=&amp;quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&amp;quot;
        indent=&amp;quot;yes&amp;quot;
        cdata-section-elements=&amp;quot;&amp;quot;
        omit-xml-declaration=&amp;quot;yes&amp;quot; /&amp;gt;
 
    &amp;lt;xsl:template name=&amp;quot;javascript&amp;quot;&amp;gt;
        &amp;lt;xsl:param name=&amp;quot;code&amp;quot;/&amp;gt;
            &amp;lt;xsl:text disable-output-escaping=&amp;quot;yes&amp;quot;&amp;gt;
            &amp;amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;amp;gt;
            /* &amp;amp;lt;![CDATA[ */ &amp;lt;/xsl:text&amp;gt;
            &amp;lt;xsl:value-of select=&amp;quot;$code&amp;quot; disable-output-escaping=&amp;quot;yes&amp;quot;/&amp;gt;
            &amp;lt;xsl:text disable-output-escaping=&amp;quot;yes&amp;quot;&amp;gt;
            /* ]]&amp;amp;gt; */
            &amp;amp;lt;/script&amp;amp;gt;
            &amp;lt;/xsl:text&amp;gt;
    &amp;lt;/xsl:template&amp;gt;
        
    &amp;lt;xsl:template match=&amp;quot;/&amp;quot;&amp;gt;
        &amp;lt;html&amp;gt;
            &amp;lt;body&amp;gt;
                &amp;lt;xsl:call-template name=&amp;quot;javascript&amp;quot;&amp;gt;
                    &amp;lt;xsl:with-param name=&amp;quot;code&amp;quot;&amp;gt;
                        &amp;lt;![CDATA[
                        if (1 &amp;gt; 2) {}
                        ]]&amp;gt;
                    &amp;lt;/xsl:with-param&amp;gt;
                &amp;lt;/xsl:call-template&amp;gt;
            &amp;lt;/body&amp;gt;
        &amp;lt;/html&amp;gt;
    &amp;lt;/xsl:template&amp;gt;
&amp;lt;/xsl:transform&amp;gt;
&lt;/pre&gt;&lt;/blockquote&gt;

&lt;h5&gt;The above example will output:&lt;/h5&gt;
&lt;blockquote class="code"&gt;&lt;pre class="xml" style="font-family:monospace;"&gt;&lt;ol&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;&lt;span style="color: #00bbdd;"&gt;&amp;lt;!DOCTYPE html PUBLIC &amp;quot;-//W3C//DTD XHTML 1.0 Strict//EN&amp;quot; &amp;quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&amp;quot;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;&lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;html&lt;/span&gt; &lt;span style="color: #000066;"&gt;xmlns&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;http://www.w3.org/1999/xhtml&amp;quot;&lt;/span&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;  &lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;body&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;            &lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;script&lt;/span&gt; &lt;span style="color: #000066;"&gt;type&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;text/javascript&amp;quot;&lt;/span&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;            /* &lt;span style="color: #339933;"&gt;&amp;lt;![CDATA[ */ &lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;&lt;span style="color: #339933;"&gt;                        if (1 &amp;gt; 2) {}&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;&lt;span style="color: #339933;"&gt;            /* ]]&amp;gt;&lt;/span&gt; */&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;            &lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/script&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;            &lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/body&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;&lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/html&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/pre&gt;&lt;/blockquote&gt;

&lt;h4&gt;Can it be simpler?&lt;/h4&gt;
&lt;p&gt;Let's start off with the most intuitive approach - add CDATA inside script tag as you would in XHTML.&lt;/p&gt;
&lt;h5&gt;Example 1&lt;/h5&gt; 
&lt;blockquote class="code"&gt;&lt;pre class="xml" style="font-family:monospace;"&gt;&lt;ol&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;&lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;?xml&lt;/span&gt; &lt;span style="color: #000066;"&gt;version&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;1.0&amp;quot;&lt;/span&gt; &lt;span style="color: #000066;"&gt;encoding&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;UTF-8&amp;quot;&lt;/span&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;&lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;xsl:transform&lt;/span&gt; &lt;span style="color: #000066;"&gt;version&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;1.0&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;&lt;span style="color: #009900;"&gt; &lt;span style="color: #000066;"&gt;xmlns:xsl&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;http://www.w3.org/1999/XSL/Transform&amp;quot;&lt;/span&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt; &lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;xsl:output&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;&lt;span style="color: #009900;"&gt;  &lt;span style="color: #000066;"&gt;method&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;xml&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;&lt;span style="color: #009900;"&gt;  &lt;span style="color: #000066;"&gt;encoding&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;utf-8&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;&lt;span style="color: #009900;"&gt;  &lt;span style="color: #000066;"&gt;doctype-public&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;-//W3C//DTD XHTML 1.0 Strict//EN&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;&lt;span style="color: #009900;"&gt;  &lt;span style="color: #000066;"&gt;doctype-system&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;&lt;span style="color: #009900;"&gt;  &lt;span style="color: #000066;"&gt;indent&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;yes&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;&lt;span style="color: #009900;"&gt;  &lt;span style="color: #000066;"&gt;cdata-section-elements&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;&lt;span style="color: #009900;"&gt;  &lt;span style="color: #000066;"&gt;omit-xml-declaration&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;yes&amp;quot;&lt;/span&gt; &lt;span style="color: #000000; font-weight: bold;"&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt; &lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;xsl:template&lt;/span&gt; &lt;span style="color: #000066;"&gt;match&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;/&amp;quot;&lt;/span&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;  &lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;html&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;   &lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;body&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;    &lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;script&lt;/span&gt; &lt;span style="color: #000066;"&gt;type&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;text/javascript&amp;quot;&lt;/span&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;    /* &lt;span style="color: #339933;"&gt;&amp;lt;![CDATA[ */&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;&lt;span style="color: #339933;"&gt;    if (1 &amp;lt; 2) {}&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;&lt;span style="color: #339933;"&gt;    /* ]]&amp;gt;&lt;/span&gt; */&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;    &lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/script&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;   &lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/body&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;  &lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/html&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt; &lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/xsl:template&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;&lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/xsl:transform&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/pre&gt;&lt;/blockquote&gt;

&lt;h5&gt;The above example will output:&lt;/h5&gt;
&lt;blockquote class="code"&gt;&lt;pre class="xml" style="font-family:monospace;"&gt;&lt;ol&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;&lt;span style="color: #00bbdd;"&gt;&amp;lt;!DOCTYPE html PUBLIC &amp;quot;-//W3C//DTD XHTML 1.0 Strict//EN&amp;quot; &amp;quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&amp;quot;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;&lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;html&lt;/span&gt; &lt;span style="color: #000066;"&gt;xmlns&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;http://www.w3.org/1999/xhtml&amp;quot;&lt;/span&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;  &lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;body&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;    &lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;script&lt;/span&gt; &lt;span style="color: #000066;"&gt;type&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;text/javascript&amp;quot;&lt;/span&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;    /*  */&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;    if (1 &lt;span style="color: #ddbb00;"&gt;&amp;amp;lt;&lt;/span&gt; 2) {}&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;    /*  */&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;    &lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/script&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;  &lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/body&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;&lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/html&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/pre&gt;&lt;/blockquote&gt;

&lt;p&gt;CDATA got stripped off and the &amp;lt; sign got replaced with &amp;amp;lt;. Of course! CDATA as an XML specific construct is interpreted in XSL as well. And that helps - try to remove CDATA from the following example and you will see an error. Good old &amp;lt; is the source of trouble here - without CDATA around, it makes XML invalid.&lt;/p&gt;

&lt;p&gt;The interpreted CDATA should stay then but another CDATA is required in the output. xls:output has an option which allows to wrap content of certain tags with CDATA. However if you set it up to wrap up content of script tags with CDATA (the rest of the code like in example 1) you will not get what you need. Let's have a look.

&lt;h5&gt;Example 2&lt;/h5&gt; 
&lt;blockquote class="code"&gt;&lt;pre class="xml" style="font-family:monospace;"&gt;&lt;ol&gt;&lt;li style="font-weight: normal; vertical-align:top;" start="10"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;&lt;span style="color: #009900;"&gt;  &lt;span style="color: #000066;"&gt;cdata-section-elements&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;script&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/pre&gt;&lt;/blockquote&gt; 

&lt;h5&gt;The above example will output:&lt;/h5&gt;
&lt;blockquote class="code"&gt;&lt;pre class="xml" style="font-family:monospace;"&gt;&lt;ol&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;&lt;span style="color: #00bbdd;"&gt;&amp;lt;!DOCTYPE html PUBLIC &amp;quot;-//W3C//DTD XHTML 1.0 Strict//EN&amp;quot; &amp;quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&amp;quot;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;&lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;html&lt;/span&gt; &lt;span style="color: #000066;"&gt;xmlns&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;http://www.w3.org/1999/xhtml&amp;quot;&lt;/span&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;  &lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;body&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;    &lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;script&lt;/span&gt; &lt;span style="color: #000066;"&gt;type&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;text/javascript&amp;quot;&lt;/span&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;&lt;span style="color: #339933;"&gt;&amp;lt;![CDATA[&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;&lt;span style="color: #339933;"&gt;    /*  */&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;&lt;span style="color: #339933;"&gt;    if (1 &amp;lt; 2) {}&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;&lt;span style="color: #339933;"&gt;    /*  */&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;&lt;span style="color: #339933;"&gt;    ]]&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;    &lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/script&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;  &lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/body&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;&lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/html&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/pre&gt;&lt;/blockquote&gt;


&lt;p&gt;Ok, now there is CDATA in the output but it is not safely commented out. And it does not seem possible to get it that way. And how about creating CDATA explicitly as a text? Maybe with disabled output escaping that would work? Let's see.

&lt;h5&gt;Example 3&lt;/h5&gt; 
&lt;blockquote class="code"&gt;&lt;pre class="xml" style="font-family:monospace;"&gt;&lt;ol&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;&lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;?xml&lt;/span&gt; &lt;span style="color: #000066;"&gt;version&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;1.0&amp;quot;&lt;/span&gt; &lt;span style="color: #000066;"&gt;encoding&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;UTF-8&amp;quot;&lt;/span&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;&lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;xsl:transform&lt;/span&gt; &lt;span style="color: #000066;"&gt;version&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;1.0&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;&lt;span style="color: #009900;"&gt; &lt;span style="color: #000066;"&gt;xmlns:xsl&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;http://www.w3.org/1999/XSL/Transform&amp;quot;&lt;/span&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt; &lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;xsl:output&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;&lt;span style="color: #009900;"&gt;  &lt;span style="color: #000066;"&gt;method&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;xml&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;&lt;span style="color: #009900;"&gt;  &lt;span style="color: #000066;"&gt;encoding&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;utf-8&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;&lt;span style="color: #009900;"&gt;  &lt;span style="color: #000066;"&gt;doctype-public&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;-//W3C//DTD XHTML 1.0 Strict//EN&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;&lt;span style="color: #009900;"&gt;  &lt;span style="color: #000066;"&gt;doctype-system&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;&lt;span style="color: #009900;"&gt;  &lt;span style="color: #000066;"&gt;indent&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;yes&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;&lt;span style="color: #009900;"&gt;  &lt;span style="color: #000066;"&gt;cdata-section-elements&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;&lt;span style="color: #009900;"&gt;  &lt;span style="color: #000066;"&gt;omit-xml-declaration&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;yes&amp;quot;&lt;/span&gt; &lt;span style="color: #000000; font-weight: bold;"&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt; &lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;xsl:template&lt;/span&gt; &lt;span style="color: #000066;"&gt;match&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;/&amp;quot;&lt;/span&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;  &lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;html&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;   &lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;body&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;    &lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;script&lt;/span&gt; &lt;span style="color: #000066;"&gt;type&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;text/javascript&amp;quot;&lt;/span&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;     &lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;xsl:text&lt;/span&gt; &lt;span style="color: #000066;"&gt;disable-output-escaping&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;yes&amp;quot;&lt;/span&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;      /* &lt;span style="color: #ddbb00;"&gt;&amp;amp;lt;&lt;/span&gt;![CDATA[ */&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;     &lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/xsl:text&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;     &lt;span style="color: #339933;"&gt;&amp;lt;![CDATA[&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;&lt;span style="color: #339933;"&gt;      if (1 &amp;lt; 2) {}&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;&lt;span style="color: #339933;"&gt;     ]]&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;     &lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;xsl:text&lt;/span&gt; &lt;span style="color: #000066;"&gt;disable-output-escaping&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;yes&amp;quot;&lt;/span&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;      /* ]]&lt;span style="color: #ddbb00;"&gt;&amp;amp;gt;&lt;/span&gt; */&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;     &lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/xsl:text&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;    &lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/script&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;   &lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/body&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;  &lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/html&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt; &lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/xsl:template&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;&lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/xsl:transform&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/pre&gt;&lt;/blockquote&gt;

&lt;h5&gt;The above example will output:&lt;/h5&gt; 
&lt;blockquote class="code"&gt;&lt;pre class="xml" style="font-family:monospace;"&gt;&lt;ol&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;&lt;span style="color: #00bbdd;"&gt;&amp;lt;!DOCTYPE html PUBLIC &amp;quot;-//W3C//DTD XHTML 1.0 Strict//EN&amp;quot; &amp;quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&amp;quot;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;&lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;html&lt;/span&gt; &lt;span style="color: #000066;"&gt;xmlns&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;http://www.w3.org/1999/xhtml&amp;quot;&lt;/span&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;  &lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;body&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;    &lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;script&lt;/span&gt; &lt;span style="color: #000066;"&gt;type&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;text/javascript&amp;quot;&lt;/span&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;      /* &lt;span style="color: #339933;"&gt;&amp;lt;![CDATA[ */&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;&lt;span style="color: #339933;"&gt;      if (1 &amp;amp;lt; 2) {}&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;&lt;span style="color: #339933;"&gt;      /* ]]&amp;gt;&lt;/span&gt; */&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;     &lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/script&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;  &lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/body&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;&lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/html&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/pre&gt;&lt;/blockquote&gt;

&lt;p&gt;That's definitely some progress, CDATA is in place. Now the &amp;amp;lt; in the JavaScript code should become &amp;lt; again. Why not to put the whole JavaScript code into another xsl:text tag with disable escaping? Well, that's why:&lt;/p&gt;

&lt;h5&gt;Example 4&lt;/h5&gt; 
&lt;blockquote class="code"&gt;&lt;pre class="xml" style="font-family:monospace;"&gt;&lt;ol&gt;&lt;li style="font-weight: normal; vertical-align:top;" start="16"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;    &lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;script&lt;/span&gt; &lt;span style="color: #000066;"&gt;type&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;text/javascript&amp;quot;&lt;/span&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;     &lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;xsl:text&lt;/span&gt; &lt;span style="color: #000066;"&gt;disable-output-escaping&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;yes&amp;quot;&lt;/span&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;      /* &lt;span style="color: #ddbb00;"&gt;&amp;amp;lt;&lt;/span&gt;![CDATA[ */&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;     &lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/xsl:text&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;     &lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;xsl:text&lt;/span&gt; &lt;span style="color: #000066;"&gt;disable-output-escaping&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;yes&amp;quot;&lt;/span&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;     &lt;span style="color: #339933;"&gt;&amp;lt;![CDATA[&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;&lt;span style="color: #339933;"&gt;      if (1 &amp;lt; 2) {}&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;&lt;span style="color: #339933;"&gt;     ]]&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;     &lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/xsl:text&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;     &lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;xsl:text&lt;/span&gt; &lt;span style="color: #000066;"&gt;disable-output-escaping&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;yes&amp;quot;&lt;/span&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;      /* ]]&lt;span style="color: #ddbb00;"&gt;&amp;amp;gt;&lt;/span&gt; */&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;     &lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/xsl:text&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;    &lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/script&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/pre&gt;&lt;/blockquote&gt; 

&lt;h5&gt;The above example will output:&lt;/h5&gt; 
&lt;blockquote class="code"&gt;&lt;pre class="xml" style="font-family:monospace;"&gt;&lt;ol&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;&lt;span style="color: #00bbdd;"&gt;&amp;lt;!DOCTYPE html PUBLIC &amp;quot;-//W3C//DTD XHTML 1.0 Strict//EN&amp;quot; &amp;quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&amp;quot;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;&lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;html&lt;/span&gt; &lt;span style="color: #000066;"&gt;xmlns&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;http://www.w3.org/1999/xhtml&amp;quot;&lt;/span&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;  &lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;body&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;    &lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;script&lt;/span&gt; &lt;span style="color: #000066;"&gt;type&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;text/javascript&amp;quot;&lt;/span&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;      /* &lt;span style="color: #339933;"&gt;&amp;lt;![CDATA[ */&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;&lt;span style="color: #339933;"&gt;      if (1 &amp;amp;lt; 2) {}&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;&lt;span style="color: #339933;"&gt;      /* ]]&amp;gt;&lt;/span&gt; */&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;     &lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/script&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;  &lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/body&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;&lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/html&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/pre&gt;&lt;/blockquote&gt;

&lt;p&gt;Is it a dead end or maybe xsl:text element is not the best choice after all? It has to be something with disable-output-escaping attribute. Another such an element is xsl:value-of. Assuming that the JavaScript code exists only in the template and not in the processed XML structure, value-of needs an xsl:variable to read value from.&lt;/p&gt;

&lt;h5&gt;Example 5&lt;/h5&gt; 
&lt;blockquote class="code"&gt;&lt;pre class="xml" style="font-family:monospace;"&gt;&lt;ol&gt;&lt;li style="font-weight: normal; vertical-align:top;" start="16"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;   &lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;xsl:variable&lt;/span&gt; &lt;span style="color: #000066;"&gt;name&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;s1&amp;quot;&lt;/span&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;    &lt;span style="color: #339933;"&gt;&amp;lt;![CDATA[&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;&lt;span style="color: #339933;"&gt;     if (1 &amp;lt; 2) {}&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;&lt;span style="color: #339933;"&gt;    ]]&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;    &lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/xsl:variable&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;   &lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;script&lt;/span&gt; &lt;span style="color: #000066;"&gt;type&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;text/javascript&amp;quot;&lt;/span&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;     &lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;xsl:text&lt;/span&gt; &lt;span style="color: #000066;"&gt;disable-output-escaping&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;yes&amp;quot;&lt;/span&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;      /* &lt;span style="color: #ddbb00;"&gt;&amp;amp;lt;&lt;/span&gt;![CDATA[ */&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;     &lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/xsl:text&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;     &lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;xsl:value-of&lt;/span&gt; &lt;span style="color: #000066;"&gt;select&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;$s1&amp;quot;&lt;/span&gt; &lt;span style="color: #000066;"&gt;disable-output-escaping&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;yes&amp;quot;&lt;/span&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;     &lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;xsl:text&lt;/span&gt; &lt;span style="color: #000066;"&gt;disable-output-escaping&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;yes&amp;quot;&lt;/span&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;      /* ]]&lt;span style="color: #ddbb00;"&gt;&amp;amp;gt;&lt;/span&gt; */&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;     &lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/xsl:text&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;    &lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/script&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/pre&gt;&lt;/blockquote&gt;

&lt;h5&gt;The above example will output:&lt;/h5&gt; 
&lt;blockquote class="code"&gt;&lt;pre class="xml" style="font-family:monospace;"&gt;&lt;ol&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;&lt;span style="color: #00bbdd;"&gt;&amp;lt;!DOCTYPE html PUBLIC &amp;quot;-//W3C//DTD XHTML 1.0 Strict//EN&amp;quot; &amp;quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&amp;quot;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;&lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;html&lt;/span&gt; &lt;span style="color: #000066;"&gt;xmlns&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;http://www.w3.org/1999/xhtml&amp;quot;&lt;/span&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;  &lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;body&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;    &lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;script&lt;/span&gt; &lt;span style="color: #000066;"&gt;type&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;text/javascript&amp;quot;&lt;/span&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;      /* &lt;span style="color: #339933;"&gt;&amp;lt;![CDATA[ */&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;&lt;span style="color: #339933;"&gt;     if (1 &amp;lt; 2) {}&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;&lt;span style="color: #339933;"&gt;      /* ]]&amp;gt;&lt;/span&gt; */&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;     &lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/script&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;  &lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/body&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;&lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/html&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/pre&gt;&lt;/blockquote&gt;

&lt;p&gt;And that worked! It is not very flexible solution, though. Defining variable for every JavaScript in the template seems to be acceptable only if necessary. Luckily xsl:value-of can also read value of a parameter passed to an xsl:template. That's how I got to the template you can find at the top of the page.&lt;/p&gt;

&lt;p&gt;Thank you for reading. I hope you found it useful.&lt;/p&gt;

&lt;h4&gt;Update - 21.05.2010&lt;/h4&gt;
&lt;p&gt;At the beginning the template looked like this:&lt;/p&gt;
&lt;blockquote class="code"&gt;&lt;pre class="xml" style="font-family:monospace;"&gt;&lt;ol&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt; &lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;xsl:template&lt;/span&gt; &lt;span style="color: #000066;"&gt;name&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;javascript&amp;quot;&lt;/span&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;  &lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;xsl:param&lt;/span&gt; &lt;span style="color: #000066;"&gt;name&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;code&amp;quot;&lt;/span&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;  &lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;script&lt;/span&gt; &lt;span style="color: #000066;"&gt;type&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;text/javascript&amp;quot;&lt;/span&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;   &lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;xsl:text&lt;/span&gt; &lt;span style="color: #000066;"&gt;disable-output-escaping&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;yes&amp;quot;&lt;/span&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;   /* &lt;span style="color: #ddbb00;"&gt;&amp;amp;lt;&lt;/span&gt;![CDATA[ */ &lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/xsl:text&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;   &lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;xsl:value-of&lt;/span&gt; &lt;span style="color: #000066;"&gt;select&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;$code&amp;quot;&lt;/span&gt; &lt;span style="color: #000066;"&gt;disable-output-escaping&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;yes&amp;quot;&lt;/span&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;   &lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;xsl:text&lt;/span&gt; &lt;span style="color: #000066;"&gt;disable-output-escaping&lt;/span&gt;=&lt;span style="color: #ff0000;"&gt;&amp;quot;yes&amp;quot;&lt;/span&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;   /* ]]&lt;span style="color: #ddbb00;"&gt;&amp;amp;gt;&lt;/span&gt; */&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;   &lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/xsl:text&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt;  &lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/script&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style="font-weight: normal; vertical-align:top;"&gt;&lt;div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"&gt; &lt;span style="color: #009900;"&gt;&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;lt;/xsl:template&lt;span style="color: #000000; font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/pre&gt;&lt;/blockquote&gt;

&lt;p&gt;However it turned out that on some PHP installations XSLT adds CDATA inside &amp;lt;script&amp;gt; tag even if it's not specified in the &amp;lt;xsl:output&amp;gt;. Therefore &amp;lt;script&amp;gt; tag has to be generated as a text rather than being part of interpreted XML.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Jacek&lt;/em&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2074903243668094130-3618150790108112832?l=float-middle.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/Tn2ATr7cSuZoBH4hhwuGm022KwE/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Tn2ATr7cSuZoBH4hhwuGm022KwE/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/Tn2ATr7cSuZoBH4hhwuGm022KwE/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Tn2ATr7cSuZoBH4hhwuGm022KwE/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/FloatMiddle/~4/NStiAQUqiP4" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://float-middle.blogspot.com/feeds/3618150790108112832/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://float-middle.blogspot.com/2010/05/how-to-put-cdata-into-script-tag-in.html#comment-form" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2074903243668094130/posts/default/3618150790108112832?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2074903243668094130/posts/default/3618150790108112832?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/FloatMiddle/~3/NStiAQUqiP4/how-to-put-cdata-into-script-tag-in.html" title="How to put CDATA into script tag in XSLT" /><author><name>Jacek Ciolek</name><uri>https://profiles.google.com/103748721182438044687</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-tzHE9XYxfZE/AAAAAAAAAAI/AAAAAAAAAAA/XK7j2YkcrrY/s512-c/photo.jpg" /></author><thr:total>2</thr:total><feedburner:origLink>http://float-middle.blogspot.com/2010/05/how-to-put-cdata-into-script-tag-in.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C04DRnw6eSp7ImA9WxFTEkk.&quot;"><id>tag:blogger.com,1999:blog-2074903243668094130.post-7181189850287288716</id><published>2010-04-02T21:55:00.003+01:00</published><updated>2010-04-02T21:59:37.211+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-04-02T21:59:37.211+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="PHP 5 Certification" /><title>Zend PHP 5 Certification Exam - review</title><content type="html">&lt;p class="lead"&gt;
This time it's about the Zend PHP5 exam itself, not about PHP. I have taken the exam today and singing loudly in my car on the way back home I thought: the guys who are about to take it might want to know how it goes. And this is the story about what happens when you decide to go into the lion's cave armed with your brain and that only.&lt;/p&gt;

&lt;p&gt;Well, it's not that bad. People I met in the exam centre were very friendly. I was taking my exam in Feltham, in the test center run by TSM Consultants UK Ltd. Poor folks were working even though it was bank holiday. They said it was all right, though.&lt;/p&gt;

&lt;p&gt;They are serving as a test spot for some insane number of vendors, one of them being Zend. It is all very professional. When I booked the exam, I was asked to turn up about 15 minutes before the exam starts. I was also told to have two forms of identification on me, at least one with a picture of my lovely face. I complied, of course, and I am glad I did. It is not just talks - they take it really seriously. No id? Then they wave you goodbye and invite you some other time when you can be bothered to read the instruction before coming.&lt;/p&gt;

&lt;p&gt;I was being checked in by a nice lady who asked me to read the terms and conditions. I learned I was not allowed to take anything with me to the examination room - mobile, jacket, rack sack even my beloved coffee had to be left behind. They gave me a locker for my valuables, though, so I put there my coffee. I am joking, my jailbroken iPhone of course. And I had to use the toilet beforehand because if you leave the room once the exam has started there is no coming back.&lt;/p&gt;

&lt;p&gt;When I was ready we entered the exam room. It was poket-size with about 5 computers standing around the walls. There was also proper Big Brother equipment. That's right. You are being watched, listened in and recorded during the exam. Who cares after all? If you know you are not going to make it you can always smash a few monitors and hope for becoming famous on YouTube after they release you from custody.&lt;/p&gt;

&lt;p&gt;Speaking of the monitors - they were nice biggies, so I had no trouble reading the questions. If the chairs were a bit more comfy I would not complain, though. That's because the room was equipped with budget low-end office chairs. On the other hand the exam lasts for 90 minutes only, so being brave fellow I gritted my teeth and took my seat. The countdown timer started after I accepted the terms and condition and when the first question appeared on the screen.&lt;/p&gt;

&lt;p&gt;After a few questions I realised the exam was not very different from the Zend PHP 5 Certification Mock Exam. It is similar type of questions and if you succeeded with a few of these mock exams you should be fine. The whole exam consists of 70 questions served in random order. For each question you may add a comment or mark it for later review. That last feature turned out quite handy when I gave all answers and wanted to come back to those which I was not entirely sure about. Review screen showed me links to all the questions and indicated the marked ones. Finally I decided I was ready and after answering zillion times 'yes' to a question going like: 'are you sure you want to finished the exam?' I saw big, beautiful and smiling at me from the screen:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;CONGRATULATIONS!&lt;/strong&gt;&lt;br/&gt;
You have passed Zend PHP 5 Certification Exam.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2074903243668094130-7181189850287288716?l=float-middle.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/NJmhc86Nm98MLONVED6IYwcKofs/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/NJmhc86Nm98MLONVED6IYwcKofs/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/NJmhc86Nm98MLONVED6IYwcKofs/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/NJmhc86Nm98MLONVED6IYwcKofs/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/FloatMiddle/~4/hckng79ZDc8" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://float-middle.blogspot.com/feeds/7181189850287288716/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://float-middle.blogspot.com/2010/04/zend-php-5-certification-exam-review.html#comment-form" title="3 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2074903243668094130/posts/default/7181189850287288716?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2074903243668094130/posts/default/7181189850287288716?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/FloatMiddle/~3/hckng79ZDc8/zend-php-5-certification-exam-review.html" title="Zend PHP 5 Certification Exam - review" /><author><name>Jacek Ciolek</name><uri>https://profiles.google.com/103748721182438044687</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-tzHE9XYxfZE/AAAAAAAAAAI/AAAAAAAAAAA/XK7j2YkcrrY/s512-c/photo.jpg" /></author><thr:total>3</thr:total><feedburner:origLink>http://float-middle.blogspot.com/2010/04/zend-php-5-certification-exam-review.html</feedburner:origLink></entry><entry gd:etag="W/&quot;Ck8CSX8yfSp7ImA9WxBVFEg.&quot;"><id>tag:blogger.com,1999:blog-2074903243668094130.post-2776225215017186581</id><published>2010-02-17T23:50:00.002Z</published><updated>2010-02-17T23:54:28.195Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-02-17T23:54:28.195Z</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="PHP" /><category scheme="http://www.blogger.com/atom/ns#" term="PHP5" /><title>PHP: References To Array Elements Are Risky</title><content type="html">&lt;p class="lead"&gt;References to array elements can bite! And it is not only the case with referencing in foreach loop. It seems that creating a reference to an array element replaces that element itself with a reference. If you then copy such an array and change the elements inside copy you can overwrite original value!&lt;/p&gt;All of the presented code was tested on Mac (PHP 5.2.11), Linux (PHP 5.2.6-1+lenny4) and Windows XP (PHP 5.3.0) using &lt;a href="http://float-middle.blogspot.com/2010/02/php-cross-platform-testing-lab-on-mac.html"&gt;PHP cross platform testing lab on Mac&lt;/a&gt; based on &lt;a href="http://www.virtualbox.org/"&gt;VirtualBox&lt;/a&gt;.&lt;br /&gt;
&lt;h4&gt;Changing copy affects original array&lt;/h4&gt;Sounds impossible? I agree. I couldn't believe it myself. Nevertheless here is the proof:&lt;br /&gt;
&lt;h5&gt;Example 1&lt;/h5&gt;&lt;blockquote class="code"&gt;&lt;pre class="php" style="font-family:monospace;"&gt;&lt;span style="color: #000088;"&gt;$a&lt;/span&gt; &lt;span style="color: #339933;"&gt;=&lt;/span&gt; &lt;a href="http://www.php.net/array"&gt;&lt;span style="color: #990000;"&gt;array&lt;/span&gt;&lt;/a&gt;&lt;span style="color: #009900;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;'one'&lt;/span&gt;&lt;span style="color: #339933;"&gt;,&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;'two'&lt;/span&gt;&lt;span style="color: #339933;"&gt;,&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;'three'&lt;/span&gt;&lt;span style="color: #339933;"&gt;,&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;'four'&lt;/span&gt;&lt;span style="color: #009900;"&gt;&amp;#41;&lt;/span&gt;&lt;span style="color: #339933;"&gt;;&lt;/span&gt; 
&lt;span style="color: #000088;"&gt;$a2&lt;/span&gt; &lt;span style="color: #339933;"&gt;=&lt;/span&gt; &lt;span style="color: #339933;"&gt;&amp;amp;&lt;/span&gt;&lt;span style="color: #000088;"&gt;$a&lt;/span&gt;&lt;span style="color: #009900;"&gt;&amp;#91;&lt;/span&gt;&lt;span style="color: #cc66cc;"&gt;2&lt;/span&gt;&lt;span style="color: #009900;"&gt;&amp;#93;&lt;/span&gt;&lt;span style="color: #339933;"&gt;;&lt;/span&gt; 
&amp;nbsp;
&lt;span style="color: #000088;"&gt;$b&lt;/span&gt; &lt;span style="color: #339933;"&gt;=&lt;/span&gt; &lt;span style="color: #000088;"&gt;$a&lt;/span&gt;&lt;span style="color: #339933;"&gt;;&lt;/span&gt; 
&lt;span style="color: #000088;"&gt;$b&lt;/span&gt;&lt;span style="color: #009900;"&gt;&amp;#91;&lt;/span&gt;&lt;span style="color: #cc66cc;"&gt;1&lt;/span&gt;&lt;span style="color: #009900;"&gt;&amp;#93;&lt;/span&gt; &lt;span style="color: #339933;"&gt;=&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;'two again'&lt;/span&gt;&lt;span style="color: #339933;"&gt;;&lt;/span&gt; 
&lt;span style="color: #000088;"&gt;$b&lt;/span&gt;&lt;span style="color: #009900;"&gt;&amp;#91;&lt;/span&gt;&lt;span style="color: #cc66cc;"&gt;2&lt;/span&gt;&lt;span style="color: #009900;"&gt;&amp;#93;&lt;/span&gt; &lt;span style="color: #339933;"&gt;=&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;'reference bites'&lt;/span&gt;&lt;span style="color: #339933;"&gt;;&lt;/span&gt; 
&amp;nbsp;
&lt;a href="http://www.php.net/var_dump"&gt;&lt;span style="color: #990000;"&gt;var_dump&lt;/span&gt;&lt;/a&gt;&lt;span style="color: #009900;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #000088;"&gt;$a&lt;/span&gt;&lt;span style="color: #339933;"&gt;,&lt;/span&gt; &lt;span style="color: #000088;"&gt;$b&lt;/span&gt;&lt;span style="color: #009900;"&gt;&amp;#41;&lt;/span&gt;&lt;span style="color: #339933;"&gt;;&lt;/span&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;h5&gt;The above example will output:&lt;/h5&gt;&lt;blockquote class="output"&gt;&lt;pre&gt;array(4) {
  [0]=&gt;
  string(3) "one"
  [1]=&gt;
  string(3) "two"
  [2]=&gt;
  &amp;string(15) "reference bites"
  [3]=&gt;
  string(4) "four"
}
array(4) {
  [0]=&gt;
  string(3) "one"
  [1]=&gt;
  string(9) "two again"
  [2]=&gt;
  &amp;string(15) "reference bites"
  [3]=&gt;
  string(4) "four"
}
&lt;/pre&gt;&lt;/blockquote&gt;&lt;h4&gt;Changing copy of a copy affects original array too&lt;/h4&gt;If you look at the dump carefully you will see that $a[2] and $b[2] are displayed as references here. That would mean the element has been replaced with a reference. And if you copy a reference you just get what? Same reference, right? So any copy of $a would contain that reference. Going forward any copy of a copy of $a would contain that same reference. Let's check it:&lt;br /&gt;
&lt;h5&gt;Example 2&lt;/h5&gt;&lt;blockquote class="code"&gt;&lt;pre class="php" style="font-family:monospace;"&gt;&lt;span style="color: #000088;"&gt;$a&lt;/span&gt; &lt;span style="color: #339933;"&gt;=&lt;/span&gt; &lt;a href="http://www.php.net/array"&gt;&lt;span style="color: #990000;"&gt;array&lt;/span&gt;&lt;/a&gt;&lt;span style="color: #009900;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;'one'&lt;/span&gt;&lt;span style="color: #339933;"&gt;,&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;'two'&lt;/span&gt;&lt;span style="color: #339933;"&gt;,&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;'three'&lt;/span&gt;&lt;span style="color: #339933;"&gt;,&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;'four'&lt;/span&gt;&lt;span style="color: #009900;"&gt;&amp;#41;&lt;/span&gt;&lt;span style="color: #339933;"&gt;;&lt;/span&gt; 
&lt;span style="color: #000088;"&gt;$a2&lt;/span&gt; &lt;span style="color: #339933;"&gt;=&lt;/span&gt; &lt;span style="color: #339933;"&gt;&amp;amp;&lt;/span&gt;&lt;span style="color: #000088;"&gt;$a&lt;/span&gt;&lt;span style="color: #009900;"&gt;&amp;#91;&lt;/span&gt;&lt;span style="color: #cc66cc;"&gt;2&lt;/span&gt;&lt;span style="color: #009900;"&gt;&amp;#93;&lt;/span&gt;&lt;span style="color: #339933;"&gt;;&lt;/span&gt; 
&amp;nbsp;
&lt;span style="color: #000088;"&gt;$b&lt;/span&gt; &lt;span style="color: #339933;"&gt;=&lt;/span&gt; &lt;span style="color: #000088;"&gt;$a&lt;/span&gt;&lt;span style="color: #339933;"&gt;;&lt;/span&gt; 
&lt;span style="color: #000088;"&gt;$c&lt;/span&gt; &lt;span style="color: #339933;"&gt;=&lt;/span&gt; &lt;span style="color: #000088;"&gt;$b&lt;/span&gt;&lt;span style="color: #339933;"&gt;;&lt;/span&gt; 
&lt;span style="color: #000088;"&gt;$c&lt;/span&gt;&lt;span style="color: #009900;"&gt;&amp;#91;&lt;/span&gt;&lt;span style="color: #cc66cc;"&gt;2&lt;/span&gt;&lt;span style="color: #009900;"&gt;&amp;#93;&lt;/span&gt; &lt;span style="color: #339933;"&gt;=&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;'references bites more'&lt;/span&gt;&lt;span style="color: #339933;"&gt;;&lt;/span&gt; 
&lt;span style="color: #000088;"&gt;$b&lt;/span&gt;&lt;span style="color: #009900;"&gt;&amp;#91;&lt;/span&gt;&lt;span style="color: #cc66cc;"&gt;1&lt;/span&gt;&lt;span style="color: #009900;"&gt;&amp;#93;&lt;/span&gt; &lt;span style="color: #339933;"&gt;=&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;'two again'&lt;/span&gt;&lt;span style="color: #339933;"&gt;;&lt;/span&gt; 
&lt;span style="color: #000088;"&gt;$a&lt;/span&gt;&lt;span style="color: #009900;"&gt;&amp;#91;&lt;/span&gt;&lt;span style="color: #cc66cc;"&gt;0&lt;/span&gt;&lt;span style="color: #009900;"&gt;&amp;#93;&lt;/span&gt; &lt;span style="color: #339933;"&gt;=&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;'one more'&lt;/span&gt;&lt;span style="color: #339933;"&gt;;&lt;/span&gt; 
&lt;a href="http://www.php.net/var_dump"&gt;&lt;span style="color: #990000;"&gt;var_dump&lt;/span&gt;&lt;/a&gt;&lt;span style="color: #009900;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #000088;"&gt;$a&lt;/span&gt;&lt;span style="color: #339933;"&gt;,&lt;/span&gt; &lt;span style="color: #000088;"&gt;$b&lt;/span&gt;&lt;span style="color: #339933;"&gt;,&lt;/span&gt; &lt;span style="color: #000088;"&gt;$c&lt;/span&gt;&lt;span style="color: #009900;"&gt;&amp;#41;&lt;/span&gt;&lt;span style="color: #339933;"&gt;;&lt;/span&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;h5&gt;The above example will output:&lt;/h5&gt;&lt;blockquote class="output"&gt;&lt;pre&gt;array(4) {
  [0]=&gt;
  string(8) "one more"
  [1]=&gt;
  string(3) "two"
  [2]=&gt;
  &amp;string(21) "references bites more"
  [3]=&gt;
  string(4) "four"
}
array(4) {
  [0]=&gt;
  string(3) "one"
  [1]=&gt;
  string(9) "two again"
  [2]=&gt;
  &amp;string(21) "references bites more"
  [3]=&gt;
  string(4) "four"
}
array(4) {
  [0]=&gt;
  string(3) "one"
  [1]=&gt;
  string(3) "two"
  [2]=&gt;
  &amp;string(21) "references bites more"
  [3]=&gt;
  string(4) "four"
}
&lt;/pre&gt;&lt;/blockquote&gt;&lt;h4&gt;Tricky "foreach" with reference explained&lt;/h4&gt;As you can see, the only element affected is the one referenced. That can lead to serious potential problems. Working on a copy of an array with scalar elements seems to be not as safe as one may thought. However, that explains one of the biggest pitfalls of iterating arrays in PHP: foreach with reference. The following is rather common knowledge:&lt;br /&gt;
&lt;h5&gt;Example 3&lt;/h5&gt;&lt;blockquote class="code"&gt;&lt;pre class="php" style="font-family:monospace;"&gt;&lt;span style="color: #000088;"&gt;$a&lt;/span&gt; &lt;span style="color: #339933;"&gt;=&lt;/span&gt; &lt;a href="http://www.php.net/array"&gt;&lt;span style="color: #990000;"&gt;array&lt;/span&gt;&lt;/a&gt;&lt;span style="color: #009900;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;'one'&lt;/span&gt;&lt;span style="color: #339933;"&gt;,&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;'two'&lt;/span&gt;&lt;span style="color: #339933;"&gt;,&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;'three'&lt;/span&gt;&lt;span style="color: #339933;"&gt;,&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;'four'&lt;/span&gt;&lt;span style="color: #009900;"&gt;&amp;#41;&lt;/span&gt;&lt;span style="color: #339933;"&gt;;&lt;/span&gt; 
&lt;span style="color: #b1b100;"&gt;foreach&lt;/span&gt; &lt;span style="color: #009900;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #000088;"&gt;$a&lt;/span&gt; &lt;span style="color: #b1b100;"&gt;as&lt;/span&gt; &lt;span style="color: #339933;"&gt;&amp;amp;&lt;/span&gt;&lt;span style="color: #000088;"&gt;$v&lt;/span&gt;&lt;span style="color: #009900;"&gt;&amp;#41;&lt;/span&gt; &lt;span style="color: #009900;"&gt;&amp;#123;&lt;/span&gt;&lt;span style="color: #009900;"&gt;&amp;#125;&lt;/span&gt; 
&lt;span style="color: #b1b100;"&gt;foreach&lt;/span&gt; &lt;span style="color: #009900;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #000088;"&gt;$a&lt;/span&gt; &lt;span style="color: #b1b100;"&gt;as&lt;/span&gt; &lt;span style="color: #000088;"&gt;$v&lt;/span&gt;&lt;span style="color: #009900;"&gt;&amp;#41;&lt;/span&gt; &lt;span style="color: #009900;"&gt;&amp;#123;&lt;/span&gt;&lt;span style="color: #009900;"&gt;&amp;#125;&lt;/span&gt; 
&lt;a href="http://www.php.net/var_dump"&gt;&lt;span style="color: #990000;"&gt;var_dump&lt;/span&gt;&lt;/a&gt;&lt;span style="color: #009900;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #000088;"&gt;$a&lt;/span&gt;&lt;span style="color: #009900;"&gt;&amp;#41;&lt;/span&gt;&lt;span style="color: #339933;"&gt;;&lt;/span&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;h5&gt;The above example will output:&lt;/h5&gt;&lt;blockquote class="output"&gt;&lt;pre&gt;array(4) {
  [0]=&gt;
  string(3) "one"
  [1]=&gt;
  string(3) "two"
  [2]=&gt;
  string(5) "three"
  [3]=&gt;
  &amp;string(5) "three"
}
&lt;/pre&gt;&lt;/blockquote&gt;But what was the explanation for that, again? It is quite clear that $v keeps reference to $a[3] after the foreach loop is finished. So what values does $v (effectively $a[3]) get within the next foreach loop? Let's see:&lt;br /&gt;
&lt;h5&gt;Example 4&lt;/h5&gt;&lt;blockquote class="code"&gt;&lt;pre class="php" style="font-family:monospace;"&gt;&lt;span style="color: #000088;"&gt;$a&lt;/span&gt; &lt;span style="color: #339933;"&gt;=&lt;/span&gt; &lt;a href="http://www.php.net/array"&gt;&lt;span style="color: #990000;"&gt;array&lt;/span&gt;&lt;/a&gt;&lt;span style="color: #009900;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;'one'&lt;/span&gt;&lt;span style="color: #339933;"&gt;,&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;'two'&lt;/span&gt;&lt;span style="color: #339933;"&gt;,&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;'three'&lt;/span&gt;&lt;span style="color: #339933;"&gt;,&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;'four'&lt;/span&gt;&lt;span style="color: #009900;"&gt;&amp;#41;&lt;/span&gt;&lt;span style="color: #339933;"&gt;;&lt;/span&gt; 
&lt;span style="color: #b1b100;"&gt;foreach&lt;/span&gt; &lt;span style="color: #009900;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #000088;"&gt;$a&lt;/span&gt; &lt;span style="color: #b1b100;"&gt;as&lt;/span&gt; &lt;span style="color: #339933;"&gt;&amp;amp;&lt;/span&gt;&lt;span style="color: #000088;"&gt;$v&lt;/span&gt;&lt;span style="color: #009900;"&gt;&amp;#41;&lt;/span&gt; &lt;span style="color: #009900;"&gt;&amp;#123;&lt;/span&gt;&lt;span style="color: #009900;"&gt;&amp;#125;&lt;/span&gt; 
&lt;span style="color: #b1b100;"&gt;foreach&lt;/span&gt; &lt;span style="color: #009900;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #000088;"&gt;$a&lt;/span&gt; &lt;span style="color: #b1b100;"&gt;as&lt;/span&gt; &lt;span style="color: #000088;"&gt;$v&lt;/span&gt;&lt;span style="color: #009900;"&gt;&amp;#41;&lt;/span&gt; &lt;span style="color: #009900;"&gt;&amp;#123;&lt;/span&gt; 
 &lt;a href="http://www.php.net/var_dump"&gt;&lt;span style="color: #990000;"&gt;var_dump&lt;/span&gt;&lt;/a&gt;&lt;span style="color: #009900;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #000088;"&gt;$a&lt;/span&gt;&lt;span style="color: #009900;"&gt;&amp;#91;&lt;/span&gt;&lt;span style="color: #cc66cc;"&gt;3&lt;/span&gt;&lt;span style="color: #009900;"&gt;&amp;#93;&lt;/span&gt;&lt;span style="color: #009900;"&gt;&amp;#41;&lt;/span&gt;&lt;span style="color: #339933;"&gt;;&lt;/span&gt; 
&lt;span style="color: #009900;"&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;h5&gt;The above example will output:&lt;/h5&gt;&lt;blockquote class="output"&gt;&lt;pre&gt;string(3) "one"
string(3) "two"
string(5) "three"
string(5) "three"
&lt;/pre&gt;&lt;/blockquote&gt;Well, it's quite obvious. Or is it? As the &lt;a href="http://php.net/manual/en/control-structures.foreach.php"&gt;foreach manual page&lt;/a&gt; states: "unless the array is referenced, foreach operates on a copy of the specified array and not the array itself". I would assume that "array is referenced" means array elements are referenced like this: &lt;code&gt;foreach ($a as &amp;$v) {}&lt;/code&gt; Apparently that is not the case with the second loop and it should work on a copy. Let's have a look what exactly would happen if the second foreach loop really worked on a solid copy:&lt;br /&gt;
&lt;h5&gt;Example 5&lt;/h5&gt;&lt;blockquote class="code"&gt;&lt;pre class="php" style="font-family:monospace;"&gt;&lt;span style="color: #000088;"&gt;$a&lt;/span&gt; &lt;span style="color: #339933;"&gt;=&lt;/span&gt; &lt;a href="http://www.php.net/array"&gt;&lt;span style="color: #990000;"&gt;array&lt;/span&gt;&lt;/a&gt;&lt;span style="color: #009900;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #0000ff;"&gt;'one'&lt;/span&gt;&lt;span style="color: #339933;"&gt;,&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;'two'&lt;/span&gt;&lt;span style="color: #339933;"&gt;,&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;'three'&lt;/span&gt;&lt;span style="color: #339933;"&gt;,&lt;/span&gt; &lt;span style="color: #0000ff;"&gt;'four'&lt;/span&gt;&lt;span style="color: #009900;"&gt;&amp;#41;&lt;/span&gt;&lt;span style="color: #339933;"&gt;;&lt;/span&gt; 
&lt;span style="color: #000088;"&gt;$b&lt;/span&gt; &lt;span style="color: #339933;"&gt;=&lt;/span&gt; &lt;span style="color: #000088;"&gt;$a&lt;/span&gt;&lt;span style="color: #339933;"&gt;;&lt;/span&gt; 
&lt;span style="color: #b1b100;"&gt;foreach&lt;/span&gt; &lt;span style="color: #009900;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #000088;"&gt;$a&lt;/span&gt; &lt;span style="color: #b1b100;"&gt;as&lt;/span&gt; &lt;span style="color: #339933;"&gt;&amp;amp;&lt;/span&gt;&lt;span style="color: #000088;"&gt;$v&lt;/span&gt;&lt;span style="color: #009900;"&gt;&amp;#41;&lt;/span&gt; &lt;span style="color: #009900;"&gt;&amp;#123;&lt;/span&gt;&lt;span style="color: #009900;"&gt;&amp;#125;&lt;/span&gt; 
&lt;span style="color: #b1b100;"&gt;foreach&lt;/span&gt; &lt;span style="color: #009900;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #000088;"&gt;$b&lt;/span&gt; &lt;span style="color: #b1b100;"&gt;as&lt;/span&gt; &lt;span style="color: #000088;"&gt;$v&lt;/span&gt;&lt;span style="color: #009900;"&gt;&amp;#41;&lt;/span&gt; &lt;span style="color: #009900;"&gt;&amp;#123;&lt;/span&gt;&lt;span style="color: #009900;"&gt;&amp;#125;&lt;/span&gt; 
&lt;a href="http://www.php.net/var_dump"&gt;&lt;span style="color: #990000;"&gt;var_dump&lt;/span&gt;&lt;/a&gt;&lt;span style="color: #009900;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #000088;"&gt;$a&lt;/span&gt;&lt;span style="color: #009900;"&gt;&amp;#41;&lt;/span&gt;&lt;span style="color: #339933;"&gt;;&lt;/span&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;h5&gt;The above example will output:&lt;/h5&gt;&lt;blockquote class="output"&gt;&lt;pre&gt;array(4) {
  [0]=&gt;
  string(3) "one"
  [1]=&gt;
  string(3) "two"
  [2]=&gt;
  string(5) "three"
  [3]=&gt;
  &amp;string(4) "four"
}
&lt;/pre&gt;&lt;/blockquote&gt;I imagine you did expect this result. Beware references to array elements and thanks for reading. I hope you found this article useful. Please don't think twice before you leave your comment.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2074903243668094130-2776225215017186581?l=float-middle.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/vjXonNAlK4_0rs7Tb8GluAlmeb4/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/vjXonNAlK4_0rs7Tb8GluAlmeb4/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/vjXonNAlK4_0rs7Tb8GluAlmeb4/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/vjXonNAlK4_0rs7Tb8GluAlmeb4/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/FloatMiddle/~4/WPq9ueLCAV8" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://float-middle.blogspot.com/feeds/2776225215017186581/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://float-middle.blogspot.com/2010/02/php-references-to-array-elements-are.html#comment-form" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2074903243668094130/posts/default/2776225215017186581?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2074903243668094130/posts/default/2776225215017186581?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/FloatMiddle/~3/WPq9ueLCAV8/php-references-to-array-elements-are.html" title="PHP: References To Array Elements Are Risky" /><author><name>Jacek Ciolek</name><uri>https://profiles.google.com/103748721182438044687</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-tzHE9XYxfZE/AAAAAAAAAAI/AAAAAAAAAAA/XK7j2YkcrrY/s512-c/photo.jpg" /></author><thr:total>1</thr:total><feedburner:origLink>http://float-middle.blogspot.com/2010/02/php-references-to-array-elements-are.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUENQn4-eCp7ImA9WxFbEUs.&quot;"><id>tag:blogger.com,1999:blog-2074903243668094130.post-971809291852917636</id><published>2010-02-07T21:31:00.010Z</published><updated>2010-07-03T14:28:13.050+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-07-03T14:28:13.050+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="PHP" /><category scheme="http://www.blogger.com/atom/ns#" term="10.6" /><category scheme="http://www.blogger.com/atom/ns#" term="VirtualBox" /><category scheme="http://www.blogger.com/atom/ns#" term="mac" /><title>PHP: Cross Platform Testing Lab on Mac How To</title><content type="html">&lt;p class="lead"&gt;Taking PHP development seriously, it is not very uncommon practice to do cross-platform tests of own code. With virtual machines it is dead easy to test your PHP code on three popular systems (Mac OS X, Linux and Windows) using only one physical machine. To make it even more pleasant all systems can share PHP code from one location hence there is no need to copy every time you want to test. And here comes the cream: you can get fully-blown eye-candy virtualizer for free.&lt;/p&gt;&lt;h4&gt;VirtualBox is good and is free!&lt;/h4&gt;Yes, that is correct. &lt;a href="http://www.virtualbox.org/"&gt;VirtualBox&lt;/a&gt; is free and made by SUN. It is good piece of software, very reliable and easy to use. You can get VirtualBox for Windows, Mac or Linux.&lt;br /&gt;
&lt;h4&gt;VirtualBox performance on Mac Mini&lt;/h4&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_RbwT9UpEI_8/S28oujy6lgI/AAAAAAAAAgQ/BJMsor8WyWI/s1600-h/vbox+-+activity+monitor.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="148" src="http://2.bp.blogspot.com/_RbwT9UpEI_8/S28oujy6lgI/AAAAAAAAAgQ/BJMsor8WyWI/s200/vbox+-+activity+monitor.png" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;I used VirtualBox to create Vrtual Cross-Platform PHP Lab on my Mac Mini run by Snow Leopard (10.6.2). My Mac was armed with&amp;nbsp;1.83GHz Intel Core 2 Duo CPU and 2BG of RAM. I have created one virtual machine for Windows XP SP2 and one for Debian 5.03 "lenny". Each virtual machine was limited to 256MB of memory and 2GB of hard drive space.&lt;br /&gt;
&lt;br /&gt;
Running both virtual boxes with AMPs on them along with MAMP on the hosting Mac did not visibly affect overall host system responsiveness. I could have Chrome, Firefox, Aptana, Preview, iTunes, Skype and Activity Monitor running concurrently and smoothly. Only Spaces (9 desktops) were a bit more choppy than usual.&amp;nbsp;Each of the virtual boxes was also responsive.&lt;br /&gt;
&lt;br /&gt;
Both guest systems were visible and accessible over the local network. They could easily obtain IP addresses from DHCP server existing within the network. All the network communication was also reliable except for situations when one of the boxes (either real or virtual one) generated heavy traffic on the network interface. Downloading 100MB from Internet at 200kB/s was enough to cause connection disruption.&lt;br /&gt;
&lt;h4&gt;Set up Mac OS X host system&lt;/h4&gt;If you are PHP developer working on Mac, probably you already have half of the work done. Nevertheless assuming you are starting from scratch the following steps need to be accomplished:&lt;br /&gt;
&lt;div&gt;&lt;ol&gt;&lt;li&gt;&lt;a href="http://www.mamp.info/en/index.html"&gt;Download MAMP&lt;/a&gt;&amp;nbsp;(Mac OS X AMP) and install it.&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.virtualbox.org/wiki/Downloads"&gt;Download VirtualBox for Mac&lt;/a&gt;&amp;nbsp;and install it.&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;Both packages come with nice Macish installers and therefore the whole process is really straightforward.&lt;br /&gt;
&lt;h4&gt;Create WAMP virtual machine on your Mac&lt;/h4&gt;&lt;div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_RbwT9UpEI_8/S28u680f1_I/AAAAAAAAAgg/AunvvSOMkug/s1600-h/vbox+-+windows.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="158" src="http://4.bp.blogspot.com/_RbwT9UpEI_8/S28u680f1_I/AAAAAAAAAgg/AunvvSOMkug/s200/vbox+-+windows.jpg" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;Now it's time to create your Windows virtual machine and set it up. I used Windows XP because it is relatively lightweight and fast compared to alternatives. VirtualBox is not fussy though and allows you to prepare virtual machine for many different operating systems including quite a few versions of Windows. Here is a step by step guide which tells you how to create a virtual machine, install Windows (XP) on it and configure WAMP to access PHP projects stored in the host filesystem:&lt;/div&gt;&lt;h5&gt;Create new virtual machine for Windows.&lt;/h5&gt;Simply go to &lt;b&gt;Machine -&amp;gt; New&lt;/b&gt;. Then just follow the guide, it takes about 2 minutes. There are no difficult questions and if you want to know more - the help is really good. I have created Virtual Machine called "virtual-winxp" with 256MB of RAM and 2GB of new virtual hard drive being dynamically expanding storage. The network adapter I have chosen was bridged adapter. The latter is important if you want to have access to LAN and Internet from your the guest OS and be able to access the guest OS from your Mac.&lt;br /&gt;
&lt;h5&gt;Install your preferred version of Windows.&lt;/h5&gt;My Win XP installation process was real time. When installer announced 30 minutes left - it was 30 indeed minutes. Network name of my Win XP was again "virtual-winxp".&lt;br /&gt;
&lt;h5&gt;&lt;a href="http://www.wampserver.com/en/download.php"&gt;Download WAMP&lt;/a&gt;&amp;nbsp;and install it&lt;/h5&gt;Nothing I could think of to add here.&lt;br /&gt;
&lt;h5&gt;Install VirtualBox Guest Additions&lt;/h5&gt;Go to &lt;b&gt;Devices -&amp;gt; CD/DVD Devices&lt;/b&gt; and choose VBoxGuestAdditions.iso. You can do so even when the guest OS is running. Virtual CD will appear in your drive and you will know what to do. &lt;b&gt;VirtualBox Guest Additions are essential if you want to share your PHP code with the host OS.&lt;/b&gt;&lt;br /&gt;
&lt;h5&gt;Configure shared folder&lt;/h5&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_RbwT9UpEI_8/S28xuIZmsHI/AAAAAAAAAgw/vajh5ZPMZFQ/s1600-h/vbox---add-shared-folder.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="121" src="http://4.bp.blogspot.com/_RbwT9UpEI_8/S28xuIZmsHI/AAAAAAAAAgw/vajh5ZPMZFQ/s200/vbox---add-shared-folder.png" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;That would allow you to share your PHP code with the host OS. Go to &lt;b&gt;Devices -&amp;gt; Shared Folders&lt;/b&gt;... and click "Add shared folder" icon - the one with "+" sign. Then choose your projects folder from Mac, say &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;/Applications/MAMP/htdocs/projects&lt;/span&gt;&amp;nbsp;and name it, say "projects". Now that folder will be accessible from Windows as pseudo network drive &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;\\vboxsrv\projects&lt;/span&gt;. It is probably a good idea to make it permanent if you don't want to repeat this step every time you start your guest OS.&lt;br /&gt;
&lt;h5&gt;Configure your WAMP to use projects folder&lt;/h5&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_RbwT9UpEI_8/S285-Rlht7I/AAAAAAAAAhg/q53BO0bFWE0/s1600-h/vbox---windows-wamp-alias-2.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="101" src="http://4.bp.blogspot.com/_RbwT9UpEI_8/S285-Rlht7I/AAAAAAAAAhg/q53BO0bFWE0/s200/vbox---windows-wamp-alias-2.png" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;Let's assume you want to access your PHP projects through your WAMP as &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;http://virtual-winxp/projects&lt;/span&gt;. Go to your Windows, click on the WAMP icon in system tray, choose &lt;b&gt;Apache -&amp;gt; Alias directories -&amp;gt; Add an alias&lt;/b&gt;. When the command window appears, type in the alias name "projects".&lt;br /&gt;
&lt;a href="http://2.bp.blogspot.com/_RbwT9UpEI_8/S285z89VH3I/AAAAAAAAAhY/kjS13EslJ3g/s1600-h/vbox---windows-wamp-alias-1.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="101" src="http://2.bp.blogspot.com/_RbwT9UpEI_8/S285z89VH3I/AAAAAAAAAhY/kjS13EslJ3g/s200/vbox---windows-wamp-alias-1.png" width="200" /&gt;&lt;/a&gt;On the second screen enter the real directory name being "//vboxsrv/projects". Forward slashes are not a mistake, Apache for Windows likes it like that. Your WAMP should restart and when you go to &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;http://localhost/projects&lt;/span&gt; you should see your Mac projects directory.&lt;br /&gt;
&lt;h5&gt;Make your WAMP visible for your Mac&lt;/h5&gt;If you prefer to test results of your PHP on your Mac (who wouldn't) rather than on the guest OS, it might be a good idea, to make your WAMP visible in the local network. All you need to do is click on your WAMP icon in system tray, choose "Put Online" and wait till the Apache restarts.&lt;br /&gt;
&lt;h4&gt;Create LAMP virtual machine on your Mac&lt;/h4&gt;&lt;div&gt;Preparing Linux virtual box was even easier because there was no clicking involved! Ok, in fact I was installing &lt;a href="http://www.debian.org/"&gt;Debian&lt;/a&gt; without GUI, so I needed to amend a couple of files manually. No rocket science though, just some config files.&lt;/div&gt;&lt;div&gt;&lt;h5&gt;Create new virtual machine for your Linux&lt;/h5&gt;Similar procedure as for virtual machine for Windows, only different name ("virtual-debian" in my case). Settings exactly the same: 256MB RAM, 2GB virtual HDD expanding storage and bridged network adapter. Please remember, that the bridged network adapter is&amp;nbsp;important if you want to access LAN and Internet from your guest OS and also access the guest OS from your Mac.&lt;br /&gt;
&lt;h5&gt;Install your preferred distribution of Linux&lt;/h5&gt;I have chosen &lt;a href="http://www.debian.org/distrib/"&gt;Debian&lt;/a&gt; because it has very good package management and I like it. The hostname I set for it was again "virtual-debian".&lt;br /&gt;
&lt;h5&gt;Install nano&lt;/h5&gt;As mentioned before, you might need to change a few config files. If you are not familiar with vim it is probably a good idea to install more friendly console editor. When logged in as root run:&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;#aptitude install nano&lt;/span&gt;&lt;br /&gt;
&lt;h5&gt;&lt;a href="http://wiki.debian.org/LaMp"&gt;Install LAMP for Debian&lt;/a&gt;&lt;/h5&gt;Just follow the link, it's all in there.&lt;br /&gt;
&lt;h5&gt;Prepare for installing VirtualBox Guest Additions&lt;/h5&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_RbwT9UpEI_8/S283DS0fS2I/AAAAAAAAAhQ/1dOlX3WF4QY/s1600-h/vbox---debian-find-kernel.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="123" src="http://2.bp.blogspot.com/_RbwT9UpEI_8/S283DS0fS2I/AAAAAAAAAhQ/1dOlX3WF4QY/s200/vbox---debian-find-kernel.png" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;These are installed as a kernel modules which are being compiled for you by the installer. That means that you need to install kernel headers beforehand. First of all find out what kernel you are running:&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt; #uname -r&lt;/span&gt;&lt;br /&gt;
I got result like this:&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;2.6.26-2-amd64&lt;/span&gt;&lt;br /&gt;
Once you know the version it's time to install headers. Simply repeat the version at the end of linux-headers package:&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;#aptitude install linux-headers-2.6.26-2-amd64&lt;/span&gt;&lt;br /&gt;
The installer might ask you a few questions, for example about installing additional packages. It's safe to answer "yes" to all of them.&lt;br /&gt;
&lt;h5&gt;Install VirtualBox Guest Additions&lt;/h5&gt;Again, go to&amp;nbsp;&lt;b&gt;Devices -&amp;gt; CD/DVD Devices&lt;/b&gt;&amp;nbsp;and choose VBoxGuestAdditions.iso. You can do so even when the guest OS is running. Virtual CD will become ready for you to mount and access it:&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;#mount /media/cdrom&lt;/span&gt;&lt;br /&gt;
Then you need to copy installer to your hard drive:&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;#cd /media/cdrom&lt;br /&gt;
#cp VBoxLinuxAdditions-amd64.run /~&lt;/span&gt;&lt;br /&gt;
and run it:&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;#cd&lt;br /&gt;
#./VBoxLinuxAdditions-amd64.run&lt;/span&gt;&lt;br /&gt;
&lt;h5&gt;Configure shared folder&lt;/h5&gt;Same as with Windows virtual box.&amp;nbsp;That would allow you to share your PHP code with the host OS. Go to&amp;nbsp;&lt;b&gt;Devices -&amp;gt; Shared Folders&lt;/b&gt;... and click "Add shared folder" icon - the one with "+" sign. Then choose your projects folder from Mac, say&amp;nbsp;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;/Applications/MAMP/htdocs/projects&lt;/span&gt;&amp;nbsp;and name it, say "projects". Now that folder will be available to mount from your Linux (Debian) as...&amp;nbsp;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;projects&lt;/span&gt;&amp;nbsp;(read next point for explanation). It is probably a good idea to make it permanent if you don't want to repeat this step every time you start your guest OS.&lt;br /&gt;
&lt;h5&gt;Configure your Debian to mount shared folder on startup&lt;/h5&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_RbwT9UpEI_8/S2822cCISLI/AAAAAAAAAhI/Vp36smmtIhY/s1600-h/vbox---debian-fstab.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="123" src="http://3.bp.blogspot.com/_RbwT9UpEI_8/S2822cCISLI/AAAAAAAAAhI/Vp36smmtIhY/s200/vbox---debian-fstab.png" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;Now everything is set up and ready we only need to mount projects folder from your Mac on your Linux virtual box. Assuming you want to access your projects folder as&amp;nbsp;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;http://virtual-debian/projects&lt;/span&gt;&amp;nbsp;and you don't want to mess around with Apache config too much (at least at this point) simple create the mount point and mount:&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;#cd /var/www/&lt;br /&gt;
#mkdir projects&lt;br /&gt;
#mount -t vboxsf projects projects&lt;/span&gt;&lt;br /&gt;
Now inside projects directory you should see contents of your Mac projects directory. To make this mount occur every time you start your Linux, you need to add a line to &lt;span class="Apple-style-span" style="font-family: Times;"&gt;/etc/fstab&lt;/span&gt; config file. Open the file:&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;#nano /etc/fstab&lt;/span&gt;&lt;br /&gt;
and add the following line:&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;projects &amp;nbsp; &amp;nbsp;/var/www/projects &amp;nbsp; &amp;nbsp;vboxsf &amp;nbsp; &amp;nbsp;ro &amp;nbsp; &amp;nbsp;0 &amp;nbsp; &amp;nbsp;0&lt;/span&gt;&lt;br /&gt;
Save the file and you are sorted. From now on, whenever you boot Linux the folder will be mounted for you and ready to use. And don't worry about the mount error - it's because default Linux mount happens before the vboxadd service is loaded.&lt;br /&gt;
&lt;h4&gt;Setup Fixed IP Addresses for your Virtual Farm&lt;/h4&gt;&lt;div&gt;My virtual boxes get IP addresses from DHCP server running within my network. Their IPs used to change every now and then and I must admit I found it quite annoying. To avoid that problem I have assigned IP addresses statically to both virtual boxes on my DHCP server. Now they still receive the whole information package (DNS, gateway and so on) but their IPs are same every time.&lt;/div&gt;&lt;h4&gt;Access your virtual boxes by names&lt;/h4&gt;&lt;div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_RbwT9UpEI_8/S281wg2aN2I/AAAAAAAAAg4/9Fxx-0g1lYQ/s1600-h/vbox---hosts.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="149" src="http://2.bp.blogspot.com/_RbwT9UpEI_8/S281wg2aN2I/AAAAAAAAAg4/9Fxx-0g1lYQ/s200/vbox---hosts.png" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;If you prefer to access your virtual boxes via their names (like virtual-winxp) rather then IPs you may want to add them to your &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;/etc/hosts&lt;/span&gt; file on your Mac. It's dead easy and takes no time. Simply run your Terminal.app (it's in &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;/Applications/Utilities&lt;/span&gt; directory) and switch to root:&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;$su -&lt;/span&gt;&lt;br /&gt;
here you enter your password, and then edit the &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;/etc/hosts&lt;/span&gt; file:&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;#nano /etc/hosts&lt;/span&gt;&lt;br /&gt;
Here you need to add one line for each virtual box. First IP then the name you like, for example:&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;192.168.0.11 &amp;nbsp; &amp;nbsp;virtual-debian&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;192.168.0.12 &amp;nbsp; &amp;nbsp;virtual-winxp&lt;/span&gt;&lt;br /&gt;
Save it and job done.&lt;br /&gt;
&lt;br /&gt;
Thanks for reading. I hope you found this guide useful, it worked for you and made you a bit happier. Please don't think twice before you leave your comment.&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/2074903243668094130-971809291852917636?l=float-middle.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/xbqg8NGG3VZL8-zAi6tusEeDn7Y/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/xbqg8NGG3VZL8-zAi6tusEeDn7Y/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/xbqg8NGG3VZL8-zAi6tusEeDn7Y/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/xbqg8NGG3VZL8-zAi6tusEeDn7Y/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/FloatMiddle/~4/tragqzeCBac" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://float-middle.blogspot.com/feeds/971809291852917636/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://float-middle.blogspot.com/2010/02/php-cross-platform-testing-lab-on-mac.html#comment-form" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2074903243668094130/posts/default/971809291852917636?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2074903243668094130/posts/default/971809291852917636?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/FloatMiddle/~3/tragqzeCBac/php-cross-platform-testing-lab-on-mac.html" title="PHP: Cross Platform Testing Lab on Mac How To" /><author><name>Jacek Ciolek</name><uri>https://profiles.google.com/103748721182438044687</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-tzHE9XYxfZE/AAAAAAAAAAI/AAAAAAAAAAA/XK7j2YkcrrY/s512-c/photo.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/_RbwT9UpEI_8/S28oujy6lgI/AAAAAAAAAgQ/BJMsor8WyWI/s72-c/vbox+-+activity+monitor.png" height="72" width="72" /><thr:total>1</thr:total><feedburner:origLink>http://float-middle.blogspot.com/2010/02/php-cross-platform-testing-lab-on-mac.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkMBQ3kyfip7ImA9WxBXGEg.&quot;"><id>tag:blogger.com,1999:blog-2074903243668094130.post-8785478258008854070</id><published>2010-01-27T23:43:00.003Z</published><updated>2010-01-30T13:34:12.796Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-01-30T13:34:12.796Z</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="PHP" /><title>PHP: array_rand does not shuffle!</title><content type="html">&lt;p class="lead"&gt;PHP function &lt;a href="http://php.net/manual/en/function.array-rand.php"&gt;array_rand()&lt;/a&gt; does not shuffle results anymore and behaves like &lt;a href="http://www.php.net/manual/en/function.array-keys.php"&gt;array_keys()&lt;/a&gt; in some circumstances.&lt;/p&gt;
&lt;p&gt;Yes, that is correct. The function array_rand() gets random key (or keys) from given array. Funny thing is that it does not shuffle the keys anymore. So the following code:&lt;/p&gt;
&lt;blockquote class="code"&gt;
&lt;code&gt;&lt;span style="color: #000000"&gt; 
&lt;span style="color: #0000BB"&gt;&amp;lt;?php&lt;br /&gt;$a&amp;nbsp;&lt;/span&gt;&lt;span style="color: #007700"&gt;=&amp;nbsp;array&amp;nbsp;(&lt;/span&gt;&lt;span style="color: #0000BB"&gt;5&amp;nbsp;&lt;/span&gt;&lt;span style="color: #007700"&gt;=&amp;gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: #DD0000"&gt;'key&amp;nbsp;5'&lt;/span&gt;&lt;span style="color: #007700"&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="color: #DD0000"&gt;'key&amp;nbsp;after&amp;nbsp;5'&lt;/span&gt;&lt;span style="color: #007700"&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="color: #0000BB"&gt;3&amp;nbsp;&lt;/span&gt;&lt;span style="color: #007700"&gt;=&amp;gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: #DD0000"&gt;'key&amp;nbsp;3'&lt;/span&gt;&lt;span style="color: #007700"&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="color: #DD0000"&gt;'a'&amp;nbsp;&lt;/span&gt;&lt;span style="color: #007700"&gt;=&amp;gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: #DD0000"&gt;'key&amp;nbsp;a'&lt;/span&gt;&lt;span style="color: #007700"&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="color: #0000BB"&gt;1&amp;nbsp;&lt;/span&gt;&lt;span style="color: #007700"&gt;=&amp;gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: #DD0000"&gt;'key&amp;nbsp;1'&lt;/span&gt;&lt;span style="color: #007700"&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="color: #0000BB"&gt;0&amp;nbsp;&lt;/span&gt;&lt;span style="color: #007700"&gt;=&amp;gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: #DD0000"&gt;'key&amp;nbsp;0'&lt;/span&gt;&lt;span style="color: #007700"&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="color: #DD0000"&gt;'key&amp;nbsp;after&amp;nbsp;0'&lt;/span&gt;&lt;span style="color: #007700"&gt;,);&lt;br /&gt;&lt;/span&gt;&lt;span style="color: #0000BB"&gt;print_r&lt;/span&gt;&lt;span style="color: #007700"&gt;(&lt;/span&gt;&lt;span style="color: #0000BB"&gt;$a&lt;/span&gt;&lt;span style="color: #007700"&gt;);&lt;br /&gt;&lt;/span&gt;&lt;span style="color: #0000BB"&gt;print_r&lt;/span&gt;&lt;span style="color: #007700"&gt;(&lt;/span&gt;&lt;span style="color: #0000BB"&gt;array_rand&lt;/span&gt;&lt;span style="color: #007700"&gt;(&lt;/span&gt;&lt;span style="color: #0000BB"&gt;$a&lt;/span&gt;&lt;span style="color: #007700"&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="color: #0000BB"&gt;5&lt;/span&gt;&lt;span style="color: #007700"&gt;));&lt;br /&gt;&lt;/span&gt;&lt;span style="color: #0000BB"&gt;print_r&lt;/span&gt;&lt;span style="color: #007700"&gt;(&lt;/span&gt;&lt;span style="color: #0000BB"&gt;array_rand&lt;/span&gt;&lt;span style="color: #007700"&gt;(&lt;/span&gt;&lt;span style="color: #0000BB"&gt;$a&lt;/span&gt;&lt;span style="color: #007700"&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="color: #0000BB"&gt;count&lt;/span&gt;&lt;span style="color: #007700"&gt;(&lt;/span&gt;&lt;span style="color: #0000BB"&gt;$a&lt;/span&gt;&lt;span style="color: #007700"&gt;));&lt;br /&gt;&lt;/span&gt;&lt;span style="color: #0000BB"&gt;print_r&lt;/span&gt;&lt;span style="color: #007700"&gt;(&lt;/span&gt;&lt;span style="color: #0000BB"&gt;array_keys&lt;/span&gt;&lt;span style="color: #007700"&gt;(&lt;/span&gt;&lt;span style="color: #0000BB"&gt;$a&lt;/span&gt;&lt;span style="color: #007700"&gt;);&lt;br /&gt;&lt;/span&gt;&lt;span style="color: #0000BB"&gt;?&amp;gt;&lt;/span&gt; 
&lt;/span&gt; 
&lt;/code&gt;
&lt;/blockquote&gt;
&lt;p&gt;would produce that result:&lt;/p&gt;
&lt;blockquote class="output"&gt;&lt;pre&gt;
Array
(
    [5] =&amp;gt; key 5
    [6] =&amp;gt; key after 5
    [3] =&amp;gt; key 3
    [a] =&amp;gt; key a
    [1] =&amp;gt; key 1
    [0] =&amp;gt; key 0
    [7] =&amp;gt; key after 0
)
Array
(
    [0] =&amp;gt; 3
    [1] =&amp;gt; a
    [2] =&amp;gt; 1
    [3] =&amp;gt; 0
    [4] =&amp;gt; 7
)
Array
(
    [0] =&amp;gt; 5
    [1] =&amp;gt; 6
    [2] =&amp;gt; 3
    [3] =&amp;gt; a
    [4] =&amp;gt; 1
    [5] =&amp;gt; 0
    [6] =&amp;gt; 7
)
Array
(
    [0] =&amp;gt; 5
    [1] =&amp;gt; 6
    [2] =&amp;gt; 3
    [3] =&amp;gt; a
    [4] =&amp;gt; 1
    [5] =&amp;gt; 0
    [6] =&amp;gt; 7
)
&lt;/pre&gt;&lt;/blockquote&gt;
&lt;p&gt;That means, that getting randomly array-size number of keys from the array array_rand($a, count($a)) give exactly same result as getting all the keys in order array_keys($a).&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2074903243668094130-8785478258008854070?l=float-middle.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/dORSsXTZw1CJHNSX0LsiC0Izc0k/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/dORSsXTZw1CJHNSX0LsiC0Izc0k/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/dORSsXTZw1CJHNSX0LsiC0Izc0k/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/dORSsXTZw1CJHNSX0LsiC0Izc0k/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/FloatMiddle/~4/sv9kAxB4Y_g" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://float-middle.blogspot.com/feeds/8785478258008854070/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://float-middle.blogspot.com/2010/01/php-arrayrand-does-not-shuffle.html#comment-form" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2074903243668094130/posts/default/8785478258008854070?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2074903243668094130/posts/default/8785478258008854070?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/FloatMiddle/~3/sv9kAxB4Y_g/php-arrayrand-does-not-shuffle.html" title="PHP: array_rand does not shuffle!" /><author><name>Jacek Ciolek</name><uri>https://profiles.google.com/103748721182438044687</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-tzHE9XYxfZE/AAAAAAAAAAI/AAAAAAAAAAA/XK7j2YkcrrY/s512-c/photo.jpg" /></author><thr:total>2</thr:total><feedburner:origLink>http://float-middle.blogspot.com/2010/01/php-arrayrand-does-not-shuffle.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkIBRHk4cCp7ImA9WxBXGEs.&quot;"><id>tag:blogger.com,1999:blog-2074903243668094130.post-63521039104399368</id><published>2010-01-22T01:29:00.004Z</published><updated>2010-01-30T15:15:55.738Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-01-30T15:15:55.738Z</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="PHP" /><category scheme="http://www.blogger.com/atom/ns#" term="PHP5" /><title>PHP: Array Pointer in Undefined State</title><content type="html">&lt;p class="lead"&gt;Array pointer in PHP may become "undefined" and that is when you try to move it after the last of before the first element. But what is more surprising - copying an array remaining in that state... resets the pointer.&lt;/p&gt;

&lt;p&gt;First let's create a messy array and see how it dumps:&lt;/p&gt;
&lt;blockquote class="code"&gt;&lt;pre&gt;
$a = array (5 =&amp;gt; 'key 5', 'key after 5', 3 =&amp;gt; 'key 3', 'a' =&amp;gt; 'key a', 1 =&amp;gt; 'key 1', 0 =&amp;gt; 'key 0', 'key after 0',);
var_dump($a);
&lt;/pre&gt;&lt;/blockquote&gt;

&lt;p&gt;The result (as expected):&lt;/p&gt;
&lt;blockquote class="output"&gt;&lt;pre&gt;
array(7) {
  [5]=&amp;gt;
  string(5) "key 5"
  [6]=&amp;gt;
  string(11) "key after 5"
  [3]=&amp;gt;
  string(5) "key 3"
  ["a"]=&amp;gt;
  string(5) "key a"
  [1]=&amp;gt;
  string(5) "key 1"
  [0]=&amp;gt;
  string(5) "key 0"
  [7]=&amp;gt;
  string(11) "key after 0"
}
&lt;/pre&gt;&lt;/blockquote&gt;

&lt;h4&gt;When Array Pointer Becomes Undefined&lt;/h4&gt;
&lt;p&gt;Let's try and go beyond the last element in the array:&lt;/p&gt;
&lt;blockquote class="code"&gt;&lt;pre&gt;
// move the pointer to the last element
end($a);

// move the pointer one element further
next($a);

// ... and see where we are
var_dump(key($a), current($a));

// try to go back
prev($a);

// ... and see where we are
var_dump(key($a), current($a));
&lt;/pre&gt;&lt;/blockquote&gt;

&lt;p&gt;The above code will produce the following result:&lt;/p&gt;
&lt;blockquote class="output"&gt;&lt;pre&gt;
NULL
bool(false)

NULL
bool(false)
&lt;/pre&gt;&lt;/blockquote&gt;
&lt;p&gt;Which simply means that the array pointer becomes "undefined" if moved after last element. In fact the pointer is not "after" the last element because you cannot move it back with &lt;pre&gt;prev()&lt;/pre&gt; function. It simply remains in undefined state.&lt;/p&gt;

&lt;h4&gt;Copying Array Resets The Pointer&lt;/h4&gt;
&lt;p&gt;When you copy an array, the array pointer is copied as well and it points to the same element as in the original. But what happens when the pointer is undefined? Will the copy inherit that as well? Let's consider the code:&lt;/p&gt;
&lt;blockquote class="code"&gt;&lt;pre&gt;
// copy the array
$b = $a;

// check state of the original
print ('original: key() and current()' . PHP_EOL);
var_dump(key($a), current($a));

// check state of the copy
print ('copy: key() and current()' . PHP_EOL);
var_dump(key($b), current($b));
&lt;/pre&gt;&lt;/blockquote&gt;
&lt;p&gt;And the result:&lt;/p&gt;
&lt;blockquote class="output"&gt;&lt;pre&gt;
original: key() and current()
int(5)
string(5) "key 5"

copy: key() and current()
NULL
bool(false)
&lt;/pre&gt;&lt;/blockquote&gt;
&lt;p&gt;Just as anticipated, the copy has its pointer in undefined state. But what happened to the original? Apparently copying the array worked like &lt;pre&gt;reset()&lt;/pre&gt; and moved the pointer to the first element! Needless to say, copying the array preserves the pointer's value if it's defined:&lt;/p&gt;
&lt;blockquote class="code"&gt;&lt;pre&gt;
// move the pointer to the last element
end($a);

// move the pointer to one element before last
prev($a);

// see where we are
print ('key() and current()' . PHP_EOL);
var_dump(key($a), current($a));

// copy the array
$b = $a;

// check state of the original
print ('original: key() and current()' . PHP_EOL);
var_dump(key($a), current($a));

// check state of the copy
print ('copy: key() and current()' . PHP_EOL);
var_dump(key($b), current($b));
&lt;/pre&gt;&lt;/blockquote&gt;
&lt;p&gt;And the output:&lt;/p&gt;
&lt;blockquote class="output"&gt;&lt;pre&gt;
key() and current()
int(0)
string(5) "key 0"

original: key() and current()
int(0)
string(5) "key 0"

copy: key() and current()
int(0)
string(5) "key 0"
&lt;/pre&gt;&lt;/blockquote&gt;

&lt;h4&gt;Moving Array Pointer Before First Element&lt;/h4&gt;
&lt;p&gt;All the above applies to the situation when you move the pointer "before" the first element. But don't take my word for it - try it out.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2074903243668094130-63521039104399368?l=float-middle.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/Bk_N-l7IZtN964AGW_aup90E4A8/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Bk_N-l7IZtN964AGW_aup90E4A8/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/Bk_N-l7IZtN964AGW_aup90E4A8/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Bk_N-l7IZtN964AGW_aup90E4A8/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/FloatMiddle/~4/obQXlJGMB9E" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://float-middle.blogspot.com/feeds/63521039104399368/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://float-middle.blogspot.com/2010/01/php-array-pointer-in-undefined-state.html#comment-form" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2074903243668094130/posts/default/63521039104399368?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2074903243668094130/posts/default/63521039104399368?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/FloatMiddle/~3/obQXlJGMB9E/php-array-pointer-in-undefined-state.html" title="PHP: Array Pointer in Undefined State" /><author><name>Jacek Ciolek</name><uri>https://profiles.google.com/103748721182438044687</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-tzHE9XYxfZE/AAAAAAAAAAI/AAAAAAAAAAA/XK7j2YkcrrY/s512-c/photo.jpg" /></author><thr:total>1</thr:total><feedburner:origLink>http://float-middle.blogspot.com/2010/01/php-array-pointer-in-undefined-state.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkINQ388eyp7ImA9WxBQFUU.&quot;"><id>tag:blogger.com,1999:blog-2074903243668094130.post-1121865198757294066</id><published>2010-01-15T16:59:00.006Z</published><updated>2010-01-15T20:49:52.173Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-01-15T20:49:52.173Z</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="PHP" /><category scheme="http://www.blogger.com/atom/ns#" term="PHP 5 Certification" /><title>PHP5: Bitwise Left Shift Goes in Cycle</title><content type="html">&lt;p class="lead"&gt;Going through ZEND PHP Certification Study Guide I came across a bit confusing example. It says that bitwise left shift by 32 positions on integer value of 1 performed on 32-bit machine would give 0 as a result.&lt;/p&gt;&lt;br /&gt;Reading through the guide I usually write small snippets of code to check things myself and remember them better. So I did this time. To my big surprise, the result was different from what I had read. Here is the code:&lt;br /&gt;&lt;blockquote class="code"&gt;&lt;pre&gt;&lt;br /&gt;&amp;lt;?php&lt;br /&gt;$x = 1;&lt;br /&gt;echo $x &amp;lt;&amp;lt; 32;&lt;br /&gt;// outputs 1&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;I wanted to find out what was going on, so I tried:&lt;br /&gt;&lt;blockquote class="code"&gt;&lt;pre&gt;&lt;br /&gt;&amp;lt;?php&lt;br /&gt;$x = 1;&lt;br /&gt;print ('PHP_INT_SIZE: ' . PHP_INT_SIZE . "\n");&lt;br /&gt;$maxBits = PHP_INT_SIZE * 8;&lt;br /&gt;&lt;br /&gt;$format = '%0' . $maxBits . "b\n";&lt;br /&gt;&lt;br /&gt;for ($i = $maxBits - 1; $i &amp;lt;= $maxBits + 1; $i++ ) {&lt;br /&gt; printf('x &amp;lt;&amp;lt; ' . $i . ': ' . $format, $x &amp;lt;&amp;lt; $i);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;for ($i = $maxBits * 2 - 1; $i &amp;lt;= $maxBits * 2 + 1; $i++ ) {&lt;br /&gt; printf('x &amp;lt;&amp;lt; ' . $i . ': ' . $format, $x &amp;lt;&amp;lt; $i);&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;And here is the result I got:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;PHP_INT_SIZE: 4&lt;br /&gt;x &amp;lt;&amp;lt; 31: 10000000000000000000000000000000&lt;br /&gt;x &amp;lt;&amp;lt; 32: 00000000000000000000000000000001&lt;br /&gt;x &amp;lt;&amp;lt; 33: 00000000000000000000000000000010&lt;br /&gt;x &amp;lt;&amp;lt; 63: 10000000000000000000000000000000&lt;br /&gt;x &amp;lt;&amp;lt; 64: 00000000000000000000000000000001&lt;br /&gt;x &amp;lt;&amp;lt; 65: 00000000000000000000000000000010&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;That means that bitwise shifting left goes in cycle modulo architecture-defined-number-of-bits. On 32-bit machine shift left by 32 bits gives same result as no shift at all (32 % 32 = 0). Shift by 33 is same as shift by 1 (33 % 32 = 1).&lt;br /&gt;But is it really true? How about shifting different value than 1? I tried to shift 2 and here is the result:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;PHP_INT_SIZE: 4&lt;br /&gt;x &amp;lt;&amp;lt; 31: 00000000000000000000000000000000&lt;br /&gt;x &amp;lt;&amp;lt; 32: 00000000000000000000000000000010&lt;br /&gt;x &amp;lt;&amp;lt; 33: 00000000000000000000000000000100&lt;br /&gt;x &amp;lt;&amp;lt; 63: 00000000000000000000000000000000&lt;br /&gt;x &amp;lt;&amp;lt; 64: 00000000000000000000000000000010&lt;br /&gt;x &amp;lt;&amp;lt; 65: 00000000000000000000000000000100&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;I checked the results on Mac (PHP 5.2.6), Windows (PHP 5.3) and Linux (PHP 5.2.12) and they were identical. It looks like new language feature which wasn't present while the ZEND PHP Certification Study Guide has been created. Although the &lt;a href="http://php.net/manual/en/language.operators.bitwise.php"&gt;Bitwise Operators manual page&lt;/a&gt; warns: "Don't left shift in case it results to number longer than 32 bits."&lt;br /&gt;It's for another discussion whether to use it or not. Anyway, I guess it's good to know.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2074903243668094130-1121865198757294066?l=float-middle.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/nj03mcPWNnPZgS9hi9Mn2kvpviM/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/nj03mcPWNnPZgS9hi9Mn2kvpviM/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/nj03mcPWNnPZgS9hi9Mn2kvpviM/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/nj03mcPWNnPZgS9hi9Mn2kvpviM/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/FloatMiddle/~4/FcaO0S5ThHQ" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://float-middle.blogspot.com/feeds/1121865198757294066/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://float-middle.blogspot.com/2010/01/php5-bitwise-left-shift-goes-in-cycle.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2074903243668094130/posts/default/1121865198757294066?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2074903243668094130/posts/default/1121865198757294066?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/FloatMiddle/~3/FcaO0S5ThHQ/php5-bitwise-left-shift-goes-in-cycle.html" title="PHP5: Bitwise Left Shift Goes in Cycle" /><author><name>Jacek Ciolek</name><uri>https://profiles.google.com/103748721182438044687</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-tzHE9XYxfZE/AAAAAAAAAAI/AAAAAAAAAAA/XK7j2YkcrrY/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://float-middle.blogspot.com/2010/01/php5-bitwise-left-shift-goes-in-cycle.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEcEQ3o_cCp7ImA9WxNVFUg.&quot;"><id>tag:blogger.com,1999:blog-2074903243668094130.post-1689090103090701638</id><published>2009-10-20T19:33:00.016+01:00</published><updated>2009-10-26T10:13:22.448Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-10-26T10:13:22.448Z</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="jailbroken" /><category scheme="http://www.blogger.com/atom/ns#" term="iPhone" /><category scheme="http://www.blogger.com/atom/ns#" term="xcode" /><title>Xcode 3.2.1 and Jailbroken iPhone 3.1.2 is Build &amp; Go!</title><content type="html">&lt;p class="lead"&gt;XCode 3.2.1 on Snow Leopard plays nicely with jailbroken iPhone OS 3.1.2. You can do Buid &amp;amp; Go and even debug directly on the device. &lt;a href="http://float-middle.blogspot.com/2009/10/xcode-32-build-go-with-jailbroken.html"&gt;The  procedure described for XCode 3.2 and iPhone OS 3.1&lt;/a&gt; is exactly the same. However, I have been asked a couple of times to put it all together and make a step-by-step guide and this seem to be a good occasion.&lt;/p&gt;&lt;h4&gt;First things first: a jailbroken iPhone 3.1.2&lt;/h4&gt;&lt;h4&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_RbwT9UpEI_8/St5KqFH7-mI/AAAAAAAAAfk/Y8DDGrfLL6o/s1600-h/installdpatch.png"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 150px; height: 225px;" src="http://4.bp.blogspot.com/_RbwT9UpEI_8/St5KqFH7-mI/AAAAAAAAAfk/Y8DDGrfLL6o/s400/installdpatch.png" alt="" id="BLOGGER_PHOTO_ID_5394831490426862178" border="0" /&gt;&lt;/a&gt;&lt;/h4&gt; If your iPhone is already jailbroken, you should know what to do. I used &lt;a href="http://blog.iphone-dev.org/post/211802082/pwnage-pie"&gt;P&lt;/a&gt;&lt;a href="http://blog.iphone-dev.org/post/211802082/pwnage-pie"&gt;wnage Tool 3.1.4&lt;/a&gt; and the good news is that this time there is no need to enter DFU mode!&lt;br /&gt;&lt;br /&gt;If your iPhone is still jailed, it would be probably a good idea to read through the &lt;a href="http://blog.iphone-dev.org/post/211802082/pwnage-pie"&gt;Pwnage Tool 3.1.4 release news&lt;/a&gt; and maybe have a look at the &lt;a href="http://float-middle.blogspot.com/2009/06/jailbroken-iphone-os-30-is-out.html"&gt;jailbreaking step-by-step guide&lt;/a&gt; which works for me every time.&lt;br /&gt;&lt;br /&gt;Once your iPhone is jailbroken, open Cydia go to the "Manage" tab, select "Sources" and add &lt;span style="font-family:courier new;"&gt;http://iphone.org.hk/apt/&lt;/span&gt;. Then install "Installd Patch" (see image). This is crucial for installing  your own application on your iPhone using XCode.&lt;br /&gt;&lt;h4&gt;Obtain a self-signing identity&lt;br /&gt;&lt;/h4&gt; Jailbroken or not iPhone needs software to be signed. If this is your first time, you  need to create your own signing certificate. The whole process  is described in detail in the &lt;a href="http://developer.apple.com/mac/library/documentation/Security/Conceptual/CodeSigningGuide/Procedures/Procedures.html#//apple_ref/doc/uid/TP40005929-CH4-SW2"&gt;original Apple document titled "Obtaining Signing Identity"&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;h4&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_RbwT9UpEI_8/St5LyrVkqiI/AAAAAAAAAfs/U_u0I-jyfTg/s1600-h/signingidentity.png"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 280px; height: 227px;" src="http://3.bp.blogspot.com/_RbwT9UpEI_8/St5LyrVkqiI/AAAAAAAAAfs/U_u0I-jyfTg/s400/signingidentity.png" alt="" id="BLOGGER_PHOTO_ID_5394832737635183138" border="0" /&gt;&lt;/a&gt;&lt;/h4&gt; Make sure you create the certificate in the default "login" keychain. For avoidance of doubt you would probably like to call your identity "iPhone Developer". This EXACT name is being used in most of the online resources I have seen so far.&lt;br /&gt;&lt;br /&gt;Once you have the certificate, switch to  XCode and go to &lt;span style="font-weight: bold;"&gt;Project -&gt; Edit Project Settings&lt;/span&gt;, scroll to &lt;span style="font-weight: bold;"&gt;Code Signing / Code Signing Identity / Any iPhone OS Device&lt;/span&gt; and change the value to your freshly created identity name, probably "iPhone Developer" (see image). This step needs to be repeated for each of the existing projects. All new projects should get the value automatically.&lt;br /&gt;&lt;h4&gt;Make XCode 3.2.1 compile for your iPhone 3.1.2&lt;br /&gt;&lt;/h4&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_RbwT9UpEI_8/St9jHaoDriI/AAAAAAAAAgE/ROCs4z2tngE/s1600-h/infoplist.png"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 280px; height: 210px;" src="http://2.bp.blogspot.com/_RbwT9UpEI_8/St9jHaoDriI/AAAAAAAAAgE/ROCs4z2tngE/s400/infoplist.png" alt="" id="BLOGGER_PHOTO_ID_5395139857670712866" border="0" /&gt;&lt;/a&gt;Self-signing certificate is good enough for you, it should be so for XCode. Let's tell him. In the file:&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;/Developer/Platforms/iPhoneOS.platform/Info.plist&lt;/span&gt;&lt;br /&gt;find line 46 and replace &lt;span style="font-family:courier new;"&gt;"XCiPhoneOSCodeSignContext"&lt;/span&gt; with "&lt;span style="font-family:courier new;"&gt;XCCodeSignContext&lt;/span&gt;" (see image). Repeat the operation for line 79 and save the file.&lt;br /&gt;&lt;br /&gt;If you want to stop here because you don't need debugging, just restart XCode and you should be able to use Build &amp;amp; Go to compile and install applications on your iPhone directly from XCode.&lt;br /&gt;&lt;h4&gt;Make XCode 3.2.1 debug on your iPhone 3.1.2&lt;/h4&gt;There is some small work to be done if you want to make your XCode 3.2.1 debug on your iPhone 3.1.2 for you. First of all you need to have &lt;a href="http://float-middle.com/downloads/ldids.zip"&gt;ldid and ldid2&lt;/a&gt;. ldid is a replacement for codesign, which adds entitlements necessary for debugging. We have lost the feature in previous part and now it is time to get around. ldid2 is a shell script which makes use of ldid.&lt;br /&gt;&lt;br /&gt;After you have downloaded the archive, unpack the files and put them  into &lt;span style="font-family:courier new;"&gt;/usr/local/bin&lt;/span&gt; directory. Then make sure they are both executable.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_RbwT9UpEI_8/St9eOgxz37I/AAAAAAAAAf8/8FPvh2gW39c/s1600-h/codesign.png"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 280px; height: 208px;" src="http://3.bp.blogspot.com/_RbwT9UpEI_8/St9eOgxz37I/AAAAAAAAAf8/8FPvh2gW39c/s400/codesign.png" alt="" id="BLOGGER_PHOTO_ID_5395134482023178162" border="0" /&gt;&lt;/a&gt;The last step would be to tell XCode it needs to use ldid2 instead of codesign. In the file: &lt;span style="font-family:courier new;"&gt;/Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Plug-ins/iPhoneOS Build System Support.xcplugin/Contents/Resources/iPhoneCodeSign.xcspec&lt;/span&gt; find line 12 and replace "&lt;span style="font-family:courier new;"&gt;/usr/bin/codesign"&lt;/span&gt; with &lt;span style="font-family:courier new;"&gt;"/usr/local/bin/ldid2"&lt;/span&gt; (see image).&lt;br /&gt;&lt;br /&gt;Now restart XCode and you should be able to do Build &amp;amp; Go and debug directly on your iPhone.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Update (26/10/2009)&lt;/span&gt;&lt;br /&gt;Well, almost. Just one tiny thing remaining. For every project you want to debug, you need to add -gta flag to "Other Code Signing Flags" in the project settings.&lt;br /&gt;&lt;br /&gt;I hope you found this guide useful, it worked for you and made you a bit happier. Please don't think twice before you leave your comment.&lt;br /&gt;&lt;br /&gt;Thanks for reading,&lt;br /&gt;Jacek&lt;br /&gt;&lt;h4&gt;Acknowledgements&lt;/h4&gt;This guide could not be possible if not for two great articles:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://networkpx.blogspot.com/2009/09/compiling-iphoneos-31-apps-with-xcode.html"&gt;Compiling iPhoneOS (3.1) apps with Xcode 3.2 without Provisioning Profile&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.alexwhittemore.com/?p=270"&gt;Developing for a jailbroken iPhone, A to Z (iPhone 3.0)&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2074903243668094130-1689090103090701638?l=float-middle.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/IZd5fK7urGp8nSV3mbh7o5vDr5o/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/IZd5fK7urGp8nSV3mbh7o5vDr5o/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/IZd5fK7urGp8nSV3mbh7o5vDr5o/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/IZd5fK7urGp8nSV3mbh7o5vDr5o/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/FloatMiddle/~4/0pTUKKfFVfI" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://float-middle.blogspot.com/feeds/1689090103090701638/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://float-middle.blogspot.com/2009/10/xcode-321-and-jailbroken-iphone-312-is.html#comment-form" title="38 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2074903243668094130/posts/default/1689090103090701638?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2074903243668094130/posts/default/1689090103090701638?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/FloatMiddle/~3/0pTUKKfFVfI/xcode-321-and-jailbroken-iphone-312-is.html" title="Xcode 3.2.1 and Jailbroken iPhone 3.1.2 is Build &amp; Go!" /><author><name>Jacek Ciolek</name><uri>https://profiles.google.com/103748721182438044687</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-tzHE9XYxfZE/AAAAAAAAAAI/AAAAAAAAAAA/XK7j2YkcrrY/s512-c/photo.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/_RbwT9UpEI_8/St5KqFH7-mI/AAAAAAAAAfk/Y8DDGrfLL6o/s72-c/installdpatch.png" height="72" width="72" /><thr:total>38</thr:total><feedburner:origLink>http://float-middle.blogspot.com/2009/10/xcode-321-and-jailbroken-iphone-312-is.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkANR3Y5cSp7ImA9WxNVEUg.&quot;"><id>tag:blogger.com,1999:blog-2074903243668094130.post-6617236906751271237</id><published>2009-10-02T23:51:00.014+01:00</published><updated>2009-10-21T20:53:16.829+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-10-21T20:53:16.829+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="jailbroken" /><category scheme="http://www.blogger.com/atom/ns#" term="iPhone" /><category scheme="http://www.blogger.com/atom/ns#" term="xcode" /><title>XCode 3.2 Build &amp; Go with jailbroken iPhone 3.1</title><content type="html">&lt;p class="lead"&gt;XCode 3.2 on Snow Leopard works fine with jailbroken iPhone 3.1! And even better: Build &amp;amp; Go works as well as debugging on the device. I tried a couple of different ways to get there, went through a few blogs and here is the conclusion.&lt;/p&gt;Update (21/10/2009):&lt;br /&gt;&lt;a href="http://float-middle.blogspot.com/2009/10/xcode-321-and-jailbroken-iphone-312-is.html"&gt;XCode 3.2.1  works fine with iPhone 3.1.2 as well&lt;/a&gt;&lt;br /&gt;&lt;h4&gt;Xcode 3.2 and iPhone 3.1&lt;/h4&gt;&lt;ol&gt;&lt;li&gt;First of all you need a&lt;a href="http://float-middle.blogspot.com/2009/06/jailbroken-iphone-os-30-is-out.html"&gt; jailbroken iPhone&lt;/a&gt;. The procedure for 3.1 is same as for 3.0, only &lt;a href="http://blog.iphone-dev.org/post/202796266/all-aboard-the-update-train"&gt;the Pwnage Tool is in new version&lt;/a&gt;.&lt;/li&gt;&lt;li&gt;Follow first three steps of the &lt;a href="http://www.alexwhittemore.com/?p=270"&gt;"Developing for a jailbroken iPhone" guide&lt;/a&gt; and disregard completely anything after "Add the special 3.0 sauce:". We are not going to patch the binary this time. &lt;span style="font-weight: bold;"&gt;Make sure you have installed "Installd Patch" on your iPhone. It is critical.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;Follow the section "I want to compile" from the &lt;a href="http://networkpx.blogspot.com/2009/09/compiling-iphoneos-31-apps-with-xcode.html"&gt;"Compiling iPhoneOS (3.1) apps with Xcode 3.2 without Provisioning Profile"&lt;/a&gt; Guide. At this stage you should be able to compile application and install it on your iPhone. Keep in mind that you have Installd Patch installed. This is something the author was not aware of.&lt;/li&gt;&lt;li&gt;If you want to debug on your device, all you need to do is to follow &lt;span style="font-weight: bold;"&gt;only first four steps&lt;/span&gt; from the section "I want to install and debug too". This is because you can already install and following the first four steps allows you do debug.&lt;/li&gt;&lt;/ol&gt;That's pretty much it. Now you should be able to use Build &amp;amp; Run, Install and Debug your app directly on your jailbroken iPhone 3.1 using XCode 3.2. Enjoy!&lt;br /&gt;&lt;br /&gt;&lt;h4&gt;Leftovers from Xcode 3.1.3 and iPhone 3.0&lt;/h4&gt;If you made Xcode 3.1.3 work with iPhone 3.0 before following the &lt;a href="http://www.alexwhittemore.com/?p=270"&gt;"Developing for a jailbroken iPhone" guide&lt;/a&gt; you may have added "New Run Script Build Phase" for your projects. As it is no longer necessary, you may want to do some housekeeping and get rid of the scripts. Here is how to do it:&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_RbwT9UpEI_8/SsaSSqZWpMI/AAAAAAAAAfc/Vr0PSYAsRIg/s1600-h/XCode.png"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 311px; height: 220px;" src="http://1.bp.blogspot.com/_RbwT9UpEI_8/SsaSSqZWpMI/AAAAAAAAAfc/Vr0PSYAsRIg/s400/XCode.png" alt="" id="BLOGGER_PHOTO_ID_5388154853511308482" border="0" /&gt;&lt;/a&gt;In order to remove the scripts you need to open your project, then in the left hand pane called "Groups &amp;amp; Files" (the one showing tree view of your project) find "Targets". Expand if necessary and there you should see your app name. Expand again and there you should get a few entries including "Run Script" - which you were looking for. It is described in the documentation included in the XCode (/Developer/Platforms/iPhoneOS.platform/Developer/Documentation/DocSets/com.apple.adc.documentation.AppleiPhone3_1.iPhoneLibrary.docset/Contents/Resources/Documents/documentation/DeveloperTools/Conceptual/XcodeBuildSystem/200-Build_Phases/bs_build_phases.html) and illustrated on the left.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2074903243668094130-6617236906751271237?l=float-middle.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/YKRE7T8GJTzYot4pHImvmU2WXro/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/YKRE7T8GJTzYot4pHImvmU2WXro/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/YKRE7T8GJTzYot4pHImvmU2WXro/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/YKRE7T8GJTzYot4pHImvmU2WXro/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/FloatMiddle/~4/xT72cefeWc0" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://float-middle.blogspot.com/feeds/6617236906751271237/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://float-middle.blogspot.com/2009/10/xcode-32-build-go-with-jailbroken.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2074903243668094130/posts/default/6617236906751271237?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2074903243668094130/posts/default/6617236906751271237?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/FloatMiddle/~3/xT72cefeWc0/xcode-32-build-go-with-jailbroken.html" title="XCode 3.2 Build &amp; Go with jailbroken iPhone 3.1" /><author><name>Jacek Ciolek</name><uri>https://profiles.google.com/103748721182438044687</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-tzHE9XYxfZE/AAAAAAAAAAI/AAAAAAAAAAA/XK7j2YkcrrY/s512-c/photo.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/_RbwT9UpEI_8/SsaSSqZWpMI/AAAAAAAAAfc/Vr0PSYAsRIg/s72-c/XCode.png" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://float-middle.blogspot.com/2009/10/xcode-32-build-go-with-jailbroken.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkIMQHY9fip7ImA9WxNQGEo.&quot;"><id>tag:blogger.com,1999:blog-2074903243668094130.post-8585672865582989734</id><published>2009-09-25T10:08:00.002+01:00</published><updated>2009-09-25T11:29:41.866+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-09-25T11:29:41.866+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="PHP 5 Certification" /><title>PHP5: Sending headers</title><content type="html">&lt;p class="lead"&gt;Http headers can be sent only before any other output. This is a simple requirement and funny how big impact it may have on application architecture and how many tricky questions may be asked about it. Here is one from the Zend PHP 5 Certification Mock Exam.&lt;/p&gt;&lt;p&gt;You will find correct answer in bold.&lt;/p&gt;&lt;blockquote class="question"&gt;One can ensure that headers can always be sent from a PHP script by doing what?&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Enable header buffering in PHP 5&lt;/li&gt;&lt;li&gt;Set the header.force INI directive to true&lt;/li&gt;&lt;li&gt;Enable output buffering in PHP 5&lt;/li&gt;&lt;li&gt;There is no way to ensure that headers can always be set, they must always be checked&lt;/li&gt;&lt;li style="font-weight: bold;"&gt;None of the above&lt;/li&gt;&lt;/ul&gt;&lt;/blockquote&gt;&lt;br /&gt;The &lt;a href="http://php.net/manual/en/function.header.php"&gt;header documentation page&lt;/a&gt; says: "As of PHP 4, you can use output buffering to get around this problem". That obviously makes sense on the contrary to header buffering suggested by the first answer. Header buffering would not help because the troublemaker here is premature output.&lt;br /&gt;According to &lt;a href="http://php.net/manual/en/index.php"&gt;PHP manual&lt;/a&gt; there is no such directive as header.force and does not seem to have much sense as well, which shoots off the second answer.&lt;br /&gt;The third one has some potential but is not correct - output buffering has been avaiable since PHP4.&lt;br /&gt;And as output buffering seems to combat the problem successfully, the fourth answer is there only to trick you.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2074903243668094130-8585672865582989734?l=float-middle.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/f8Y_xbO_zLVqnMvwTV4cJtiF0PM/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/f8Y_xbO_zLVqnMvwTV4cJtiF0PM/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/f8Y_xbO_zLVqnMvwTV4cJtiF0PM/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/f8Y_xbO_zLVqnMvwTV4cJtiF0PM/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/FloatMiddle/~4/xO6UQg4ywOg" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://float-middle.blogspot.com/feeds/8585672865582989734/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://float-middle.blogspot.com/2009/09/php5-sending-headers.html#comment-form" title="3 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2074903243668094130/posts/default/8585672865582989734?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2074903243668094130/posts/default/8585672865582989734?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/FloatMiddle/~3/xO6UQg4ywOg/php5-sending-headers.html" title="PHP5: Sending headers" /><author><name>Jacek Ciolek</name><uri>https://profiles.google.com/103748721182438044687</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-tzHE9XYxfZE/AAAAAAAAAAI/AAAAAAAAAAA/XK7j2YkcrrY/s512-c/photo.jpg" /></author><thr:total>3</thr:total><feedburner:origLink>http://float-middle.blogspot.com/2009/09/php5-sending-headers.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUAAQHg4cCp7ImA9WxNQF0Q.&quot;"><id>tag:blogger.com,1999:blog-2074903243668094130.post-4589963604072381197</id><published>2009-09-24T12:48:00.004+01:00</published><updated>2009-09-24T13:02:21.638+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-09-24T13:02:21.638+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="PHP" /><title>PHP: empty $_FILES array</title><content type="html">This experience might be really time consuming. You get a simple form with a simple input field of type="file" and on the server side you get nothing. The $_FILES array is empty as a whistle.&lt;br /&gt;&lt;br /&gt;You can get really frustrated after checking whether file_uploads = 1, upload_temp_dir is accessible and upload_max_filesize is big enough and everything seems fine.&lt;br /&gt;&lt;br /&gt;In this case it's worth checking if the troublemaker is not... the form itself. If there is no enctype="multipart/form-data" in the form tag, you may want to try it. Here is an example of working file upload:&lt;br /&gt;&lt;blockquote class="code"&gt;&lt;pre&gt;&lt;br /&gt;&amp;lt;form name="form" action="index.php" method="post" enctype="multipart/form-data"&amp;gt;&lt;br /&gt; &amp;lt;fieldset&amp;gt;&lt;br /&gt;  &amp;lt;label&amp;gt;Upload file&amp;lt;/label&amp;gt;&lt;br /&gt;  &amp;lt;input type="file" name="userfile" /&amp;gt;&lt;br /&gt; &amp;lt;/fieldset&amp;gt;&lt;br /&gt; &amp;lt;fieldset&amp;gt;&lt;br /&gt;  &amp;lt;input type="submit" value="OK" /&amp;gt;&lt;br /&gt; &amp;lt;/fieldset&amp;gt;&lt;br /&gt;$lt;/form&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;I have found a &lt;a href="http://getluky.net/2004/10/04/apachephp-_files-array-mysteriously-empty/"&gt;Nice thread about the above issue&lt;/a&gt; which you might be interested in as well.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2074903243668094130-4589963604072381197?l=float-middle.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/G8JtSmQbshwRoj0vP1sKpVWQkGo/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/G8JtSmQbshwRoj0vP1sKpVWQkGo/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/G8JtSmQbshwRoj0vP1sKpVWQkGo/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/G8JtSmQbshwRoj0vP1sKpVWQkGo/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/FloatMiddle/~4/FO21zVzsDuc" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://float-middle.blogspot.com/feeds/4589963604072381197/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://float-middle.blogspot.com/2009/09/php-empty-files-array.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2074903243668094130/posts/default/4589963604072381197?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2074903243668094130/posts/default/4589963604072381197?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/FloatMiddle/~3/FO21zVzsDuc/php-empty-files-array.html" title="PHP: empty $_FILES array" /><author><name>Jacek Ciolek</name><uri>https://profiles.google.com/103748721182438044687</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-tzHE9XYxfZE/AAAAAAAAAAI/AAAAAAAAAAA/XK7j2YkcrrY/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://float-middle.blogspot.com/2009/09/php-empty-files-array.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEQEQ30_fip7ImA9WxNQF0w.&quot;"><id>tag:blogger.com,1999:blog-2074903243668094130.post-839037365579725029</id><published>2009-09-16T22:42:00.004+01:00</published><updated>2009-09-23T14:25:02.346+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-09-23T14:25:02.346+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="PHP 5 Certification" /><category scheme="http://www.blogger.com/atom/ns#" term="Session" /><title>Zend PHP 5 Certification Mock Exam: how to destroy a session</title><content type="html">Here is another question about sessions from the Zend PHP 5 Certification Mock Exam. Good answers are in bold:&lt;br /&gt;&lt;blockquote class="question"&gt;To destroy a PHP session completely, one must which of the following?&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Regenerate the session ID using &lt;span style="font-family:courier new;"&gt;session_regenerate_id()&lt;/span&gt;&lt;/li&gt;&lt;li style="font-weight: bold;"&gt;If cookies are used, destroy it         &lt;/li&gt;&lt;li&gt;Use &lt;span style="font-family:courier new;"&gt;session_demolish()&lt;/span&gt; to completely destroy the session         &lt;/li&gt;&lt;li&gt;Change the session name using &lt;span style="font-family:courier new;"&gt;session_name()         &lt;/span&gt;&lt;/li&gt;&lt;li style="font-weight: bold;"&gt;Destroy the session data using &lt;span style="font-family:courier new;"&gt;session_destroy() &lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/blockquote&gt;A few words of explanation. To destroy a session we need to remove all the data associated with the session and try to prevent the client from requesting the session using the id. Usually the session id is stored on the client side as a cookie. In this case, we need to destroy the cookie, which means that the second answer is correct. To remove all the data stored associated with the  session, we need to use &lt;span style="font-family:courier new;"&gt;session_destroy&lt;/span&gt; function, and this also means the last answer is correct. It is described briefly on the &lt;a href="http://php.net/manual/en/function.session-destroy.php"&gt;session_destroy manual page&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Regarding three remaining answers, &lt;a href="http://php.net/manual/en/function.session-regenerate-id.php"&gt;regenerating session id&lt;/a&gt; is useful for preventing &lt;a href="http://en.wikipedia.org/wiki/Session_fixation"&gt;session fixation&lt;/a&gt;. There is not such a function as &lt;span style="font-family:courier new;"&gt;session_demolish()&lt;/span&gt; described in PHP manual. &lt;a href="http://php.net/manual/en/function.session-name.php"&gt;Changing session name&lt;/a&gt; does not remove the data, it simply changes the  name of the cookie storing the session id.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2074903243668094130-839037365579725029?l=float-middle.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/FfkHa_6fSTAW0ZyeuNOZf52DYH8/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/FfkHa_6fSTAW0ZyeuNOZf52DYH8/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/FfkHa_6fSTAW0ZyeuNOZf52DYH8/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/FfkHa_6fSTAW0ZyeuNOZf52DYH8/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/FloatMiddle/~4/5kutZ49k6i4" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://float-middle.blogspot.com/feeds/839037365579725029/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://float-middle.blogspot.com/2009/09/zend-php-5-certification-mock-exam-how.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2074903243668094130/posts/default/839037365579725029?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2074903243668094130/posts/default/839037365579725029?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/FloatMiddle/~3/5kutZ49k6i4/zend-php-5-certification-mock-exam-how.html" title="Zend PHP 5 Certification Mock Exam: how to destroy a session" /><author><name>Jacek Ciolek</name><uri>https://profiles.google.com/103748721182438044687</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-tzHE9XYxfZE/AAAAAAAAAAI/AAAAAAAAAAA/XK7j2YkcrrY/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://float-middle.blogspot.com/2009/09/zend-php-5-certification-mock-exam-how.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEQFQH45eSp7ImA9WxNQF0w.&quot;"><id>tag:blogger.com,1999:blog-2074903243668094130.post-6014724294434229797</id><published>2009-09-01T20:37:00.006+01:00</published><updated>2009-09-23T14:25:11.021+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-09-23T14:25:11.021+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="PHP 5 Certification" /><title>Zend PHP 5 Certification Mock Exam: magic function</title><content type="html">&lt;span style="font-family:verdana;"&gt;One of the Zend PHP 5 Certification Mock Exam questions shows recursive function called "magic". The question reads as follows (correct answer in bold):&lt;/span&gt;&lt;br /&gt;&lt;blockquote class="question"&gt;&lt;span style="font-family:verdana;"&gt;What does the following function do, when passed two integer values for $p and $q?&lt;/span&gt;&lt;pre&gt;&lt;code&gt;&lt;/code&gt;&lt;blockquote class="code"&gt;&amp;lt;?php&lt;br /&gt;function magic($p, $q) {&lt;br /&gt;return ($q == 0)&lt;br /&gt;    ? $p&lt;br /&gt;    : magic($q, $p % $q);&lt;br /&gt;}&lt;br /&gt;?&amp;gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;/pre&gt;&lt;ul style="font-family: verdana;"&gt;&lt;li&gt;Loops infinitely&lt;/li&gt;&lt;li&gt;Switches the values of $p and $q&lt;/li&gt;&lt;li&gt;Determines if they are both even or odd&lt;/li&gt;&lt;li style="font-weight: bold;"&gt;Determines the greatest common divisor between them&lt;/li&gt;&lt;li&gt;Calculates the modulus between the two&lt;/li&gt;&lt;/ul&gt;&lt;/blockquote&gt;&lt;span style="font-family:verdana;"&gt;It turns out that the function is simply on of the &lt;/span&gt;&lt;a style="font-family: verdana;" href="http://en.wikipedia.org/wiki/Euclidean_algorithm#Implementations"&gt;Euclidean algorithm implementations&lt;/a&gt;&lt;span style="font-family:verdana;"&gt;. If you do not remember from your math class how it works, here is the the &lt;a style="font-family: verdana;" href="http://en.wikipedia.org/wiki/Euclidean_algorithm#Procedure"&gt;Euclidean algorithm procedure&lt;/a&gt; described.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2074903243668094130-6014724294434229797?l=float-middle.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/5S3eKkbJobQDrH3YStmWu4WEu4E/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/5S3eKkbJobQDrH3YStmWu4WEu4E/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/5S3eKkbJobQDrH3YStmWu4WEu4E/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/5S3eKkbJobQDrH3YStmWu4WEu4E/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/FloatMiddle/~4/nU3BhyYCd34" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://float-middle.blogspot.com/feeds/6014724294434229797/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://float-middle.blogspot.com/2009/09/zend-php-5-certification-mock-exam.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2074903243668094130/posts/default/6014724294434229797?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2074903243668094130/posts/default/6014724294434229797?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/FloatMiddle/~3/nU3BhyYCd34/zend-php-5-certification-mock-exam.html" title="Zend PHP 5 Certification Mock Exam: magic function" /><author><name>Jacek Ciolek</name><uri>https://profiles.google.com/103748721182438044687</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-tzHE9XYxfZE/AAAAAAAAAAI/AAAAAAAAAAA/XK7j2YkcrrY/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://float-middle.blogspot.com/2009/09/zend-php-5-certification-mock-exam.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEQGQHg8eip7ImA9WxNQF0w.&quot;"><id>tag:blogger.com,1999:blog-2074903243668094130.post-6627990260058518527</id><published>2009-08-21T19:18:00.016+01:00</published><updated>2009-09-23T14:25:21.672+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-09-23T14:25:21.672+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="javascript" /><category scheme="http://www.blogger.com/atom/ns#" term="accessibility" /><title>Gracefully downgradable javascript for accessibility</title><content type="html">&lt;span style=";font-family:verdana;font-size:130%;"  &gt;JavaScript contributes by a great deal to user experience on the Web and it does not have to be an obstacle for accessibility. The goal is to allow the user access all of the website's content when JS is enabled as well as when it is disabled.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;Let's consider two versions of the webpage: one is interactive JavaScript enriched and the other one is just static. I think it is safe bet that both of them initially share same markup and only differences occur in styling.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;If we stop to think about it, we have just one markup with two possible stylings applied to it. If we could detect within CSS which version of styling should be applied that would solve the case. Of course CSS on its own have no such ability but that is exactly where the "C" from CSS comes to aid: Cascading.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;JavaScript, when enabled, can amend DOM. In particular it can add a class to body tag, say "js-enabled". Having styles for specific areas of the webpage, cascaded down through .js-enabled class allows you to differentiate between JS enabled and disabled state on the CSS level.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;The simplest example would be a definition list. We want to display all the terms but not the definitions. The latter would be expanded and visible only when corresponding term was clicked, which needs some simple JavaScript functionality to work. On the other hand, when JS is not available the user should be able to see the whole list: the terms along with the definitions. We could do it using this CSS:&lt;/span&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;pre class="code"&gt;.js-enabled dd {display:none;}&lt;br /&gt;.js-enabled dd.expanded {display: block;}&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;JavaScript would add the class "expanded" whenever there is a need to show the definition. Simply removing the class would hide the element again. I am not going to go into details of the implementation as it is not very interesting. What is interesting though is when to add the class "js-enabled" to the body tag.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;If it was added after the document has been fully loaded (for example from within the "document.onload" event handler), the list would be rendered without the "js-enabled" class at first and both terms and definitions would be visible. Then adding the class would cause hiding all the definitions and as a result ugly jumping of content on the page. To prevent this effect we have to add "js-enabled" class as soon as the body tag is available for manipulating but before the document has been rendered:&lt;/span&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;pre class="code"&gt;&lt;br /&gt;&amp;lt;body&amp;gt;&lt;br /&gt;&amp;lt;script type="text/javascript"&amp;gt;&lt;br /&gt;try {&lt;br /&gt;    document.getElementsByTagName("body")[0].className += " js-enabled";&lt;br /&gt;} catch(e) {}&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;br /&gt;...&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2074903243668094130-6627990260058518527?l=float-middle.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/84USs2ywI64KNjXKJGGV1bUo81A/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/84USs2ywI64KNjXKJGGV1bUo81A/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/84USs2ywI64KNjXKJGGV1bUo81A/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/84USs2ywI64KNjXKJGGV1bUo81A/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/FloatMiddle/~4/ibpVL9BxFqE" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://float-middle.blogspot.com/feeds/6627990260058518527/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://float-middle.blogspot.com/2009/08/gracefully-downgradable-javascript-for.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2074903243668094130/posts/default/6627990260058518527?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2074903243668094130/posts/default/6627990260058518527?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/FloatMiddle/~3/ibpVL9BxFqE/gracefully-downgradable-javascript-for.html" title="Gracefully downgradable javascript for accessibility" /><author><name>Jacek Ciolek</name><uri>https://profiles.google.com/103748721182438044687</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-tzHE9XYxfZE/AAAAAAAAAAI/AAAAAAAAAAA/XK7j2YkcrrY/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://float-middle.blogspot.com/2009/08/gracefully-downgradable-javascript-for.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkUESXo7cSp7ImA9WxNWEEo.&quot;"><id>tag:blogger.com,1999:blog-2074903243668094130.post-6396944335539744194</id><published>2009-08-19T09:30:00.013+01:00</published><updated>2009-10-09T09:50:08.409+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-10-09T09:50:08.409+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="jailbroken" /><category scheme="http://www.blogger.com/atom/ns#" term="iPhone" /><category scheme="http://www.blogger.com/atom/ns#" term="xcode" /><title>XCode 3.1.3 works with jailbroken iPhone 3.0</title><content type="html">&lt;span style=";font-family:verdana;font-size:130%;"  &gt;As my iPhone development is not something I do on daily basis, it took me some time to realize that development on jailbroken iPhone is possible again!&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=";font-family:verdana;font-size:100%;"  &gt;&lt;a href="http://www.alexwhittemore.com/?p=270"&gt;Great article describing step-by-step how to make your XCode work for you again&lt;/a&gt;. I can confirm it works, just read through carefully.&lt;br /&gt;&lt;br /&gt;Update (09/10/2009):&lt;br /&gt;&lt;a href="http://float-middle.blogspot.com/2009/10/xcode-32-build-go-with-jailbroken.html"&gt;You can make Xcode 3.2 work with iPhone 3.1 - build &amp;amp; go + debugging&lt;/a&gt;.&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2074903243668094130-6396944335539744194?l=float-middle.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/SLs-QKJQ-nlXtjZMWEyrtt9GS9c/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/SLs-QKJQ-nlXtjZMWEyrtt9GS9c/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/SLs-QKJQ-nlXtjZMWEyrtt9GS9c/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/SLs-QKJQ-nlXtjZMWEyrtt9GS9c/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/FloatMiddle/~4/ejHryX1bCo0" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://float-middle.blogspot.com/feeds/6396944335539744194/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://float-middle.blogspot.com/2009/08/xcode-313-works-with-jailbroken-iphone.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2074903243668094130/posts/default/6396944335539744194?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2074903243668094130/posts/default/6396944335539744194?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/FloatMiddle/~3/ejHryX1bCo0/xcode-313-works-with-jailbroken-iphone.html" title="XCode 3.1.3 works with jailbroken iPhone 3.0" /><author><name>Jacek Ciolek</name><uri>https://profiles.google.com/103748721182438044687</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-tzHE9XYxfZE/AAAAAAAAAAI/AAAAAAAAAAA/XK7j2YkcrrY/s512-c/photo.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://float-middle.blogspot.com/2009/08/xcode-313-works-with-jailbroken-iphone.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkQDR3c-eip7ImA9WxJbF0U.&quot;"><id>tag:blogger.com,1999:blog-2074903243668094130.post-791086880570003779</id><published>2009-07-21T18:04:00.009+01:00</published><updated>2009-07-28T14:39:36.952+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-07-28T14:39:36.952+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="PDF" /><category scheme="http://www.blogger.com/atom/ns#" term="PHP" /><title>Error: There was a problem reading this document (109)</title><content type="html">&lt;span style="font-size:130%;"&gt;&lt;span style="font-family:verdana;"&gt;Usually browsers armed with Acrobat Reader plugin can open .pdf files directly. Unfortunately sometimes it so happens that a user gets the 109 error and is unable to open the document before they save it locally.&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;There are a couple of solutions suggested all around the Web, one of them being to give a user  choice between saving file locally or open it in Adobe Reader window. One of the ways to do it is changing MIME type of the .pdf file and Content-Disposition header. Instead of default &lt;span style="font-family:courier new;"&gt;application/pdf&lt;/span&gt; we would be serving more generic &lt;span style="font-family:courier new;"&gt;application/octet-stream&lt;/span&gt;. &lt;span style="font-family:courier new;"&gt;Content-Disposition&lt;/span&gt; header has to be set as &lt;span style="font-family:courier new;"&gt;attachment&lt;/span&gt;. Here is an example PHP script which sends any existing .pdf file from the script's directory:&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;$file = $_GET['file'] . '.pdf';&lt;br /&gt;&lt;br /&gt;if (preg_match('/^[a-zA-Z0-9_\-]+\.pdf$/', $file)&lt;br /&gt;       &amp;amp;&amp;amp; file_exists($file)) {&lt;br /&gt;   header('Content-Type: application/octet-stream');&lt;br /&gt;   header('Content-Disposition: attachment; filename=' . $file);&lt;br /&gt;   readfile($file);&lt;br /&gt;} else {&lt;br /&gt;   header("HTTP/1.0 404 Not Found");&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;Even though it works, it is not very elegant. We might want to link directly to .pdf documents instead of pdf.php?file=document.pdf and serve the files transparently through the php script.&lt;br /&gt;For Apache users it is quite easy to achieve. An example &lt;span style="font-family:courier new;"&gt;.htaccess&lt;/span&gt; file:&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;RewriteEngine On&lt;br /&gt;RewriteBase /your.directory.with.documents/pdf&lt;br /&gt;RewriteCond %{REQUEST_FILENAME} -f&lt;br /&gt;RewriteRule ^(.+)\.pdf$  ./pdf.php?file=$1 [L,NC,QSA]&lt;span style="font-family:Georgia,serif;"&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/blockquote&gt;A few words of explanation:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Third line says to redirect to &lt;span style="font-family:courier new;"&gt;pdf.php&lt;/span&gt; script only valid requests for existing files.&lt;/li&gt;&lt;li&gt;Fourth line rewrites requests for .pdf files only as this is all we are interested in. The script gets filename without extension, eg. "document.pdf" is passed to the script as "document".&lt;/li&gt;&lt;li&gt;More about rewrite_mod for apache you can find in the &lt;a href="http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html"&gt;documentation&lt;/a&gt;.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2074903243668094130-791086880570003779?l=float-middle.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/2FPsRApjEsE7LS2glvKB2dFaMYo/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/2FPsRApjEsE7LS2glvKB2dFaMYo/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/2FPsRApjEsE7LS2glvKB2dFaMYo/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/2FPsRApjEsE7LS2glvKB2dFaMYo/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/FloatMiddle/~4/1Zi7tXon-rw" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://float-middle.blogspot.com/feeds/791086880570003779/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://float-middle.blogspot.com/2009/07/error-there-was-problem-reading-this.html#comment-form" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2074903243668094130/posts/default/791086880570003779?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2074903243668094130/posts/default/791086880570003779?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/FloatMiddle/~3/1Zi7tXon-rw/error-there-was-problem-reading-this.html" title="Error: There was a problem reading this document (109)" /><author><name>Jacek Ciolek</name><uri>https://profiles.google.com/103748721182438044687</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-tzHE9XYxfZE/AAAAAAAAAAI/AAAAAAAAAAA/XK7j2YkcrrY/s512-c/photo.jpg" /></author><thr:total>2</thr:total><feedburner:origLink>http://float-middle.blogspot.com/2009/07/error-there-was-problem-reading-this.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DUQNR3Y_fip7ImA9WxJbEEk.&quot;"><id>tag:blogger.com,1999:blog-2074903243668094130.post-6901282032472030289</id><published>2009-07-14T22:16:00.008+01:00</published><updated>2009-07-20T00:49:56.846+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-07-20T00:49:56.846+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="TSconfig" /><category scheme="http://www.blogger.com/atom/ns#" term="Typo3" /><category scheme="http://www.blogger.com/atom/ns#" term="TypoScript" /><title>Custom Paragraph Classes in Typo3 RTE</title><content type="html">&lt;span style="font-size:130%;"&gt;&lt;span style="font-family:verdana;"&gt;Sometimes it is important to apply custom classes to paragraphs in RTE. Typo3 allows you to customize the "Block style" list easily. All it takes is a few lines of Typo Script in page TSconfig.&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;Let's add class &lt;span style="font-family:courier new;"&gt;lead&lt;/span&gt; for leading paragraph. We want this class to appear as "Leading paragraph" and be indicated with slightly bigger font on the "Block style" list. Here is how to do it in page TSconfig:&lt;br /&gt;&lt;blockquote style="font-family: courier new;"&gt;&lt;pre&gt;RTE {&lt;br /&gt;   classes.lead {&lt;br /&gt;       name = Leading paragraph&lt;br /&gt;       value = font-size:1.4em;&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;   default {&lt;br /&gt;       contentCSS = fileadmin/templates/css/rte.css&lt;br /&gt;       proc.allowedClasses = lead&lt;br /&gt;       classesParagraph = lead&lt;br /&gt;   }&lt;br /&gt;}&lt;/pre&gt;&lt;/blockquote&gt;&lt;span style="font-size:100%;"&gt;A few words of explanation:&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;ol&gt;&lt;li&gt;&lt;span style=";font-family:verdana;font-size:100%;"  &gt;&lt;span style="font-family:courier new;"&gt;RTE.default.contentCSS&lt;/span&gt; defines css file used by RTE to render text in the editing window. It is required that the class we want to add is defined in this file&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=";font-family:verdana;font-size:100%;"  &gt;&lt;span style="font-family:courier new;"&gt;RTE.classes.lead&lt;/span&gt; defines the entry for the "Block style" list; the value is inline style used to preview the class in the drop-down&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=";font-family:verdana;font-size:100%;"  &gt;&lt;span style="font-family:courier new;"&gt;RTE.default.proc.allowedClasses&lt;/span&gt; tells RTE not to strip these classes when saving content to the database&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=";font-family:verdana;font-size:100%;"  &gt;&lt;span style="font-family:courier new;"&gt;RTE.default.classesParagraph&lt;/span&gt; associates given class with paragraph, so you can see the selector on the "Block style" list when you choose "Paragraph" from the "Type of block" drop-down.&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;span style="font-family:verdana;"&gt;Further details (and much more) you can find in the &lt;/span&gt;&lt;a style="font-family: verdana;" href="http://typo3.org/documentation/document-library/extension-manuals/rtehtmlarea/1.4.4/view/4/4/"&gt;page TSconfing documentation&lt;/a&gt;&lt;span style="font-family:verdana;"&gt;.&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2074903243668094130-6901282032472030289?l=float-middle.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/5pRv_kOtFhF76U_Hy2mWU3V0fAY/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/5pRv_kOtFhF76U_Hy2mWU3V0fAY/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/5pRv_kOtFhF76U_Hy2mWU3V0fAY/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/5pRv_kOtFhF76U_Hy2mWU3V0fAY/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/FloatMiddle/~4/_Qd86z3tTg4" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://float-middle.blogspot.com/feeds/6901282032472030289/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://float-middle.blogspot.com/2009/07/custom-paragraph-classes-in-typo3-rte.html#comment-form" title="4 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2074903243668094130/posts/default/6901282032472030289?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2074903243668094130/posts/default/6901282032472030289?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/FloatMiddle/~3/_Qd86z3tTg4/custom-paragraph-classes-in-typo3-rte.html" title="Custom Paragraph Classes in Typo3 RTE" /><author><name>Jacek Ciolek</name><uri>https://profiles.google.com/103748721182438044687</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-tzHE9XYxfZE/AAAAAAAAAAI/AAAAAAAAAAA/XK7j2YkcrrY/s512-c/photo.jpg" /></author><thr:total>4</thr:total><feedburner:origLink>http://float-middle.blogspot.com/2009/07/custom-paragraph-classes-in-typo3-rte.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C0MCSXw7fyp7ImA9WxNXE00.&quot;"><id>tag:blogger.com,1999:blog-2074903243668094130.post-2876409047902698103</id><published>2009-07-11T14:40:00.015+01:00</published><updated>2009-09-30T10:04:28.207+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-09-30T10:04:28.207+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="PHP 5 Certification" /><title>Stopping PHP Script Execution</title><content type="html">&lt;span style=";font-family:georgia;font-size:130%;"  &gt;Do you know all the ways of stopping PHP script execution? Put your knowledge to a test with this question from the Zend PHP 5 Certification Mock Exam.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;The question is as follows. Correct answers in bold.&lt;br /&gt;&lt;/span&gt;&lt;blockquote class="question"&gt;What would go in place of ?????? below to make this script execute without a fatal error?&lt;br /&gt;&lt;pre class="code"&gt;&amp;lt;?php&lt;br /&gt;&lt;br /&gt;$a = 1;&lt;br /&gt;$b = 0;&lt;br /&gt;&lt;br /&gt;??????&lt;br /&gt;&lt;br /&gt;$c = $a / $b;&lt;br /&gt;?&amp;gt;&lt;/pre&gt;&lt;ul  style="font-family:courier new;"&gt;&lt;li  style="font-family:courier new;"&gt;&lt;span style="font-size:100%;"&gt;quit();&lt;/span&gt;&lt;/li&gt;&lt;li  style="font-weight: bold;font-family:courier new;"&gt;&lt;span style="font-size:100%;"&gt;die();&lt;/span&gt;&lt;/li&gt;&lt;li  style="font-family:courier new;"&gt;&lt;span style="font-size:100%;"&gt;stop();&lt;/span&gt;&lt;/li&gt;&lt;li  style="font-weight: bold;font-family:courier new;"&gt;&lt;span style="font-size:100%;"&gt;__halt_compiler();&lt;/span&gt;&lt;/li&gt;&lt;li style="font-weight: bold; font-family: courier new;"&gt;exit();&lt;/li&gt;&lt;/ul&gt;&lt;/blockquote&gt;&lt;span style="font-family:courier new;"&gt;die() &lt;/span&gt;and &lt;span style="font-family:courier new;"&gt;exit()&lt;/span&gt; are quite obvious, &lt;span style="font-family:courier new;"&gt;stop()&lt;/span&gt; and &lt;span style="font-family:courier new;"&gt;quit()&lt;/span&gt; do not exist and what about &lt;span style="font-family:courier new;"&gt;__halt_compiler()&lt;/span&gt;? The latter  was introduces in PHP5. &lt;a href="http://php.net/manual/en/function.halt-compiler.php"&gt;Manual page&lt;/a&gt; says it stops the execution of the compiler and nothing  after this call is executed.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2074903243668094130-2876409047902698103?l=float-middle.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/j5VtvKjrVN1ybJu6cxNVEIpM8d0/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/j5VtvKjrVN1ybJu6cxNVEIpM8d0/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/j5VtvKjrVN1ybJu6cxNVEIpM8d0/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/j5VtvKjrVN1ybJu6cxNVEIpM8d0/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/FloatMiddle/~4/jALXKKK3ilo" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://float-middle.blogspot.com/feeds/2876409047902698103/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://float-middle.blogspot.com/2009/07/stopping-php-script-execution.html#comment-form" title="4 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2074903243668094130/posts/default/2876409047902698103?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2074903243668094130/posts/default/2876409047902698103?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/FloatMiddle/~3/jALXKKK3ilo/stopping-php-script-execution.html" title="Stopping PHP Script Execution" /><author><name>Jacek Ciolek</name><uri>https://profiles.google.com/103748721182438044687</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-tzHE9XYxfZE/AAAAAAAAAAI/AAAAAAAAAAA/XK7j2YkcrrY/s512-c/photo.jpg" /></author><thr:total>4</thr:total><feedburner:origLink>http://float-middle.blogspot.com/2009/07/stopping-php-script-execution.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CE8BQXcyfCp7ImA9WxJUE0w.&quot;"><id>tag:blogger.com,1999:blog-2074903243668094130.post-2652461498068803927</id><published>2009-07-07T20:56:00.007+01:00</published><updated>2009-07-11T12:47:30.994+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-07-11T12:47:30.994+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="TSconfig" /><category scheme="http://www.blogger.com/atom/ns#" term="Typo3" /><category scheme="http://www.blogger.com/atom/ns#" term="TypoScript" /><title>Custom Frames for Content Elements in Typo3</title><content type="html">&lt;span style="font-size:130%;"&gt;&lt;span style="font-family:georgia;"&gt;The "Frame" option for Content Element in Typo3 becomes handy. What if default list does not suit your needs? You need to customize it then.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;It is not difficult, event though not very easy to find. The functionality is built upon two different lists. One is a list of frame ids and corresponding labels visible in the BE. &lt;/span&gt;&lt;span style="font-family:verdana;"&gt;For each of these ids the other list defines actual "frame" - wrapper  visible in the FE.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;The first list is defined in &lt;a href="http://typo3.org/documentation/document-library/core-documentation/doc_core_tsconfig/4.2.0/view/1/3/"&gt;page TSconfig&lt;/a&gt; as it is dealing with the back end. Here is an example:&lt;br /&gt;&lt;blockquote&gt;&lt;pre style="font-family: courier new;"&gt;TCEFORM.tt_content.section_frame {&lt;br /&gt;  removeItems = 5,6,10,11,12,20,21&lt;br /&gt;  altLabels.1 = Rounded&lt;br /&gt;  addItems.2 = Highlighted&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;Second line removes all the default items from the list, except for the one with id=1. Third line amends label of that element setting it to 'Rounded'. Finally, the fourth line adds new item to the list with id=2 and label 'Highlighted'.&lt;br /&gt;&lt;br /&gt;The second list is defined in &lt;a href="http://typo3.org/documentation/document-library/references/doc_core_tsref/4.2.0/view/"&gt;TS template&lt;/a&gt; as it is dealing with the front end. The example:&lt;br /&gt;&lt;blockquote&gt;&lt;pre style="font-family: courier new;"&gt;tt_content.stdWrap.innerWrap.cObject {&lt;br /&gt;  1 = TEXT&lt;br /&gt;  1.value = &amp;lt;div class="rounded"&amp;gt;|&amp;lt;/div&amp;gt;&lt;br /&gt;  2 = TEXT&lt;br /&gt;  2.value = &amp;lt;div class="highlighted"&amp;gt;|&amp;lt;/div&amp;gt;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2074903243668094130-2652461498068803927?l=float-middle.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/Ye-8A6io2nn0RDXvCiZAa5D3FhY/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Ye-8A6io2nn0RDXvCiZAa5D3FhY/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/Ye-8A6io2nn0RDXvCiZAa5D3FhY/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Ye-8A6io2nn0RDXvCiZAa5D3FhY/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/FloatMiddle/~4/xHq8e_qWkwE" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://float-middle.blogspot.com/feeds/2652461498068803927/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://float-middle.blogspot.com/2009/07/custom-frames-for-content-elements-in.html#comment-form" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2074903243668094130/posts/default/2652461498068803927?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2074903243668094130/posts/default/2652461498068803927?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/FloatMiddle/~3/xHq8e_qWkwE/custom-frames-for-content-elements-in.html" title="Custom Frames for Content Elements in Typo3" /><author><name>Jacek Ciolek</name><uri>https://profiles.google.com/103748721182438044687</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh4.googleusercontent.com/-tzHE9XYxfZE/AAAAAAAAAAI/AAAAAAAAAAA/XK7j2YkcrrY/s512-c/photo.jpg" /></author><thr:total>2</thr:total><feedburner:origLink>http://float-middle.blogspot.com/2009/07/custom-frames-for-content-elements-in.html</feedburner:origLink></entry></feed>

