<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>World Gone Web &#187; PHP</title>
	<atom:link href="http://www.samanthahalfon.net/worldgoneweb/category/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.samanthahalfon.net/worldgoneweb</link>
	<description></description>
	<lastBuildDate>Sat, 17 Apr 2010 22:51:03 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=abc</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Chive, alternative to PHPMyAdmin</title>
		<link>http://www.samanthahalfon.net/worldgoneweb/2010/chive-alternative-to-phpmyadmin/</link>
		<comments>http://www.samanthahalfon.net/worldgoneweb/2010/chive-alternative-to-phpmyadmin/#comments</comments>
		<pubDate>Mon, 05 Apr 2010 16:33:11 +0000</pubDate>
		<dc:creator>shalfon</dc:creator>
				<category><![CDATA[Computing]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[chive]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[phpmyadmin]]></category>
		<category><![CDATA[sql browser]]></category>
		<category><![CDATA[yii]]></category>

		<guid isPermaLink="false">http://www.samanthahalfon.net/worldgoneweb/?p=348</guid>
		<description><![CDATA[

I don&#8217;t remember how I&#8217;ve heard about Chive, a young alternative to PhpMyAdmin (version 0.3 was released less than a week ago). I believe it was a link on twitter.
There seem to be two policies when it comes to a MySQL browser for web developers: the desktop app or the web app. A lot of [...]]]></description>
			<content:encoded><![CDATA[
<div class="topsy_widget_data topsy_theme_blue" style="float: right;margin-left: 0.75em;"><script type="text/javascript" src="http://button.topsy.com/widget/retweet-big?url=http://www.samanthahalfon.net/worldgoneweb/2010/chive-alternative-to-phpmyadmin/&amp;shorturl=http://bit.ly/cx1hfj&amp;title=Chive%2C+alternative+to+PHPMyAdmin&amp;theme=blue&amp;nick=samo9789&amp;order=count,retweet,badge&amp;txt_tweet=tweet&amp;txt_retweet=retweet"></script></div><p><a href="http://www.samanthahalfon.net/worldgoneweb/wp-content/uploads/2010/04/Screen-shot-2010-04-05-at-6.24.13-PM.png"><img src="http://www.samanthahalfon.net/worldgoneweb/wp-content/uploads/2010/04/Screen-shot-2010-04-05-at-6.24.13-PM.png" alt="" title="Screen shot 2010-04-05 at 6.24.13 PM" width="350" height="200" class="aligncenter size-full wp-image-349" /></a></p>
<p>I don&#8217;t remember how I&#8217;ve heard about <a href="http://www.chive-project.com/">Chive</a>, a young alternative to PhpMyAdmin (version 0.3 was released less than a week ago). I believe it was a link on twitter.<br />
There seem to be two policies when it comes to a MySQL browser for web developers: the desktop app or the web app. A lot of people seem to use PHPMyAdmin though I gave it up several years ago. First for the MySQL QueryBrowser, later on for SequelPro (OS X).  SequelPro does everything I need, connect via socket, tcp or ssh which is extremly useful. Still, sometimes, to install a PHPMyAdmin (or something similar) on a remote server or a dev server can be handy. So I tried Chive. </p>
<p>The installation couldnt be easier. Just unrar the package, place it in your document root somewhere and it works. Chive runs on the Yii PHP framework and, as far as I can tell, it&#8217;s pretty fast. The interface is less cluttered than PHPMyAdmin. Of course, you have to get some work done with a tool like that to judge of its efficiency but it looks like a nice alternative to PHPMyAdmin to me. Actually, the <a href="http://www.chive-project.com/Features">feature list comparaison</a> on the Chive website is impressive (considering the age of the project). I will definitely recommend it to developers I work with because I hate using PHPMyAdmin when pairing with them. </p>
<p>If you have any use for a web based MySQL Browserm check Chive out:</p>
<li><a href="http://www.chive-project.com/">Chive homepage</a></li>
<li><a href="https://launchpad.net/chive">Chive&#8217;s source code on launchpad</a></li>

]]></content:encoded>
			<wfw:commentRss>http://www.samanthahalfon.net/worldgoneweb/2010/chive-alternative-to-phpmyadmin/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Linking to Twitter and Facebook from a website</title>
		<link>http://www.samanthahalfon.net/worldgoneweb/2010/linking-to-twitter-and-facebook-from-a-website/</link>
		<comments>http://www.samanthahalfon.net/worldgoneweb/2010/linking-to-twitter-and-facebook-from-a-website/#comments</comments>
		<pubDate>Mon, 08 Mar 2010 22:07:48 +0000</pubDate>
		<dc:creator>shalfon</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Teeorama]]></category>
		<category><![CDATA[bitly]]></category>
		<category><![CDATA[colorbox]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[lightbox]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://www.samanthahalfon.net/worldgoneweb/?p=313</guid>
		<description><![CDATA[

This week I&#8217;ve worked on a social lightbox for Teeorama allowing our visitors to tweet or write on their Facebook walls from our tee-shirt shop.The lightbox itself is built using ColorBox, a powerful and customizable lightbox library built on JQuery (MIT License). The Twitter tool is fairly easy to setup, I used bit.ly to generate [...]]]></description>
			<content:encoded><![CDATA[
<div class="topsy_widget_data topsy_theme_blue" style="float: right;margin-left: 0.75em;"><script type="text/javascript" src="http://button.topsy.com/widget/retweet-big?url=http://www.samanthahalfon.net/worldgoneweb/2010/linking-to-twitter-and-facebook-from-a-website/&amp;shorturl=http://bit.ly/9g5Ibd&amp;title=Linking+to+Twitter+and+Facebook+from+a+website&amp;theme=blue&amp;nick=samo9789&amp;order=count,retweet,badge&amp;txt_tweet=tweet&amp;txt_retweet=retweet"></script></div><p><img src="http://www.samanthahalfon.net/worldgoneweb/wp-content/uploads/2010/02/Screen-shot-2010-02-24-at-10.40.48-PM.png" alt="" title="Teeorama Social Lightbox" width="400" height="240" class="aligncenter size-full wp-image-314" /></p>
<p><img src="http://www.samanthahalfon.net/worldgoneweb/wp-content/uploads/2010/02/Screen-shot-2010-02-24-at-10.41.05-PM.png" alt="" title="Share on Facebook/Twitter" width="53" height="218" class="alignleft size-full wp-image-315" />This week I&#8217;ve worked on a social lightbox for <a href="http://teeorama.com/">Teeorama</a> allowing our visitors to <a href="http://www.twitter.com/">tweet</a> or write on their <a href="http://www.facebook.com/">Facebook</a> walls from <a href="http://teeorama.com/">our tee-shirt shop</a>.The lightbox itself is built using <a href="http://colorpowered.com/colorbox/">ColorBox</a>, a powerful and customizable lightbox library built on <a href="http://jquery.com/">JQuery</a> (MIT License). The <a href="http://www.twitter.com/">Twitter</a> tool is fairly easy to setup, I used <a href="http://bit.ly/">bit.ly</a> to generate the shortened URL of the current page and placed it, along with a default content, in the text box. When the user clicks on submit, he or she is redirected to twitter. The update box contains what was typed in the teeorama box and one click on the update button is enough to validate the tweet.The follow button is even simpler, it is nothing but a link to <a href="https://twitter.com/teeorama">teeorama&#8217;s twitter account</a>.<a href="http://www.facebook.com/">Facebook</a> is both more powerful (you can publish to your wall without leaving the teeorama page) and a bit trickier to setup.First, you need to head over to developers.facebook.com/setup.php to register your site as a Connect enabled website. Upload the <em>xd_receiver.htm</em> file to your server and validate. You now have access to your <a href="http://www.facebook.com/developers/apps.php">Facebook Connect</a> Tools, API documentation and sandbox as well as to a gallery of widgets or code samples you can use. I chose to use the <em>Comment Box</em>.</p>
<p><img src="http://www.samanthahalfon.net/worldgoneweb/wp-content/uploads/2010/02/Screen-shot-2010-02-24-at-10.39.40-PM.png" alt="" title="Facebook Connect Tools" width="400" height="194" class="alignleft size-full wp-image-317" /></p>

]]></content:encoded>
			<wfw:commentRss>http://www.samanthahalfon.net/worldgoneweb/2010/linking-to-twitter-and-facebook-from-a-website/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Where are your users from, part 2</title>
		<link>http://www.samanthahalfon.net/worldgoneweb/2010/where-are-your-users-from-part-2/</link>
		<comments>http://www.samanthahalfon.net/worldgoneweb/2010/where-are-your-users-from-part-2/#comments</comments>
		<pubDate>Mon, 22 Feb 2010 17:51:39 +0000</pubDate>
		<dc:creator>shalfon</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[GeoIP]]></category>

		<guid isPermaLink="false">http://www.samanthahalfon.net/worldgoneweb/?p=309</guid>
		<description><![CDATA[

Recently, I wrote about geolocalisation of your users/visitors based on the IP to Country table. After using it for a couple of months, I found it painful to have to regularly update the table (even if some people came up with an automatic work around based on PERL scripts for example).
So, I decided to find another way [...]]]></description>
			<content:encoded><![CDATA[
<div class="topsy_widget_data topsy_theme_blue" style="float: right;margin-left: 0.75em;"><script type="text/javascript" src="http://button.topsy.com/widget/retweet-big?url=http://www.samanthahalfon.net/worldgoneweb/2010/where-are-your-users-from-part-2/&amp;shorturl=http://bit.ly/d4h3aq&amp;title=Where+are+your+users+from%2C+part+2&amp;theme=blue&amp;nick=samo9789&amp;order=count,retweet,badge&amp;txt_tweet=tweet&amp;txt_retweet=retweet"></script></div><p><img class="aligncenter size-full wp-image-310" title="the_world" src="http://www.samanthahalfon.net/worldgoneweb/wp-content/uploads/2010/02/the_world.jpg" alt="" width="300" height="139" /></p>
<p>Recently, I wrote about geolocalisation of your users/visitors based on the IP to Country table. After using it for a couple of months, I found it painful to have to regularly update the table (even if some people came up with an <a title="IP to Country" href="http://www.celtnet.org.uk/info/IP-to-country-converter.php" target="_blank">automatic work around based on PERL scripts</a> for example).</p>
<p>So, I decided to find another way to solve the problem and gave the <a href="http://www.maxmind.com/app/mod_geoip" target="_blank">GeoIP Apache module by MaxMind</a> a try. The installation is as simple as can be:</p>
<div class="codecolorer-container bash dawn" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">aptitude</span> <span style="color: #c20cb9; font-weight: bold;">install</span> libapache2-mod-geoip<br />
a2enmod geoip<br />
<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>apache2 restart</div></td></tr></tbody></table></div>
<p>Once the module is setup, you can use the following PHP code to obtain the Country Code (2 letters)</p>
<div class="codecolorer-container php dawn" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000088;">$countryCode</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;GEOIP_COUNTRY_CODE&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>Finally, here is a <a href="http://www.worldatlas.com/aatlas/ctycodes.htm" target="_blank">list of country codes and the associated country names</a>.</p>
<p>If yo</p>
<p>That&#8217;s it, quick and simple.</p>

]]></content:encoded>
			<wfw:commentRss>http://www.samanthahalfon.net/worldgoneweb/2010/where-are-your-users-from-part-2/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Setting up Code Igniter</title>
		<link>http://www.samanthahalfon.net/worldgoneweb/2010/setting-up-code-igniter/</link>
		<comments>http://www.samanthahalfon.net/worldgoneweb/2010/setting-up-code-igniter/#comments</comments>
		<pubDate>Sat, 13 Feb 2010 08:40:33 +0000</pubDate>
		<dc:creator>shalfon</dc:creator>
				<category><![CDATA[Computing]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[codeigniter]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[virtual host]]></category>

		<guid isPermaLink="false">http://www.samanthahalfon.net/worldgoneweb/?p=286</guid>
		<description><![CDATA[
A few months ago, we jumped into Teeorama, a PHP based online tee-shirt store front end for Spreadshirt. We finally completed the project and we&#8217;re planning on opening it to the public tomorrow. By the way, if you feel you could use a new Geek shirt, please head over to teeorama.com before reading on&#8230;

When I [...]]]></description>
			<content:encoded><![CDATA[
<div class="topsy_widget_data topsy_theme_blue" style="float: right;margin-left: 0.75em;"><script type="text/javascript" src="http://button.topsy.com/widget/retweet-big?url=http://www.samanthahalfon.net/worldgoneweb/2010/setting-up-code-igniter/&amp;shorturl=http://bit.ly/9bmTvI&amp;title=Setting+up+Code+Igniter&amp;theme=blue&amp;nick=samo9789&amp;order=count,retweet,badge&amp;txt_tweet=tweet&amp;txt_retweet=retweet"></script></div><p>A few months ago, we jumped into <a href="http://www.teeorama.com" target="_blank">Teeorama</a>, a PHP based online tee-shirt store front end for <a href="http://www.spreadshirt.net" target="_blank">Spreadshirt</a>. We finally completed the project and we&#8217;re planning on opening it to the public tomorrow. By the way, if you feel you could use a new Geek shirt, please head over to <a href="http://www.teeorama.com" target="_blank">teeorama.com</a> before reading on&#8230;</p>
<p style="text-align: center;"><a href="http://www.teeorama.com"><img class="aligncenter size-full wp-image-289" title="Teeorama" src="http://www.samanthahalfon.net/worldgoneweb/wp-content/uploads/2010/02/Screen-shot-2010-02-13-at-9.45.31-AM.png" alt="" width="413" height="215" /></a></p>
<p>When I started the development, I decided to use both a PHP and a Javascript framework I didn&#8217;t know. I had two reasons for doing that:</p>
<ul>
<li>It&#8217;s always interesting to play with new code. You get to see how other people/framework solved common problems, how some libraries make this or that easier  to use for the developer. You also sometimes realize some other things are carried out better in the framework you are used to. Either way, it is a good learning experience.</li>
<li>Also, I wanted to stay away from the stack we use at work to not be tempted and not be able to just copy over bits of our blueKiwi framework into my code</li>
</ul>
<p>So, I picked <a href="http://codeigniter.com/" target="_blank">CodeIgniter</a> and <a href="http://jquery.com/" target="_blank">jQuery</a> to build my website. In the end, I am very pleased with the experience of working with these two tools. CodeIgniter is exactly what it claims to be: a very light but powerful framework that does not try to command the way you work. Of course, jQuery is just as powerful as its reputation. It&#8217;s incredibly easy to get used to and I haven&#8217;t found anything it couldn&#8217;t do.</p>
<p style="text-align: center;"><a href="http://www.codeigniter.com"><img class="aligncenter size-full wp-image-288" title="Screen shot 2010-02-13 at 9.44.03 AM" src="http://www.samanthahalfon.net/worldgoneweb/wp-content/uploads/2010/02/Screen-shot-2010-02-13-at-9.44.03-AM.png" alt="" width="438" height="118" /></a></p>
<p>Anyway, this post is about setting up Code Igniter. There is a Code Igniter <a href="http://codeigniter.com/downloads/" target="_blank">user_guide</a> (included in the downloaded zip file) to do just that and it would take you about two seconds to get going. The thing is, I did not like the way Code Igniter was laid out in my folder. I wanted to be able to place the framework in a library folder within my application folder and make my web folder (containing the images, javascript and css files) the document root therefore keeping my application folder out of exposure to the Web.</p>
<p>This is also possible though it does involve some minor tweaking of CodeIgniter base code.</p>
<p>First, here is my chosen folder layout</p>
<p style="text-align: center;"><img class="aligncenter" style="max-width: 800px;" src="http://www.samanthahalfon.net/worldgoneweb/wp-content/uploads/2010/02/Screen-shot-2010-02-13-at-9.25.18-AM.png" alt="" width="348" height="603" /></p>
<p>Second, as I said, I made the web folder the target of my Apache virtual host.<br />
Here is my virtual host for this application</p>
<div class="codecolorer-container apache dawn" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br /></div></td><td><div class="apache codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #00007f;">ServerAdmin</span> your_email<br />
<span style="color: #00007f;">ServerName</span> project_domain<br />
<span style="color: #00007f;">AddDefaultCharset</span> UTF-8<br />
<span style="color: #00007f;">DocumentRoot</span> /var/www/project/web<br />
<br />
<span style="color: #00007f;">RewriteEngine</span> <span style="color: #0000ff;">On</span><br />
<span style="color: #00007f;">RewriteCond</span> $1 !^/?(index\.php|test|images|web|js|css)<br />
<span style="color: #00007f;">RewriteRule</span> ^(.*)$ /index.php/$<span style="color: #ff0000;">1</span> [L]</div></td></tr></tbody></table></div>
<p>Finally, in order for all this to work, you need to tweak a couple of CodeIgniter files</p>
<p>define the system and application folders paths as follow in index.php:</p>
<div class="codecolorer-container php dawn" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000088;">$docRootPath</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/dirname"><span style="color: #990000;">dirname</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'DOCUMENT_ROOT'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$system_folder</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$docRootPath</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;/application/libraries/codeigniter&quot;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$application_folder</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$docRootPath</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;/application&quot;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>Also, modify the CodeIgniter.php file at the bottom of index.php to:</p>
<div class="codecolorer-container php dawn" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #b1b100;">require_once</span> BASEPATH<span style="color: #339933;">.</span><span style="color: #0000ff;">'CodeIgniter'</span><span style="color: #339933;">.</span>EXT<span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>Finally, edit CodeIgniter.php in order to replace all occurrences of &#8220;codeigniter/&#8221; by &#8220;&#8221; (nothing)</p>
<p>You should be setup. Happy coding!</p>
<div class="zemanta-pixie"><img class="zemanta-pixie-img" src="http://img.zemanta.com/pixy.gif?x-id=7b05c7fd-fca7-88bc-bd59-fc928be8bb46" alt="" /></div>

]]></content:encoded>
			<wfw:commentRss>http://www.samanthahalfon.net/worldgoneweb/2010/setting-up-code-igniter/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>CKEditor, enable the image or flash upload</title>
		<link>http://www.samanthahalfon.net/worldgoneweb/2010/ckeditor-enable-the-image-or-flash-upload/</link>
		<comments>http://www.samanthahalfon.net/worldgoneweb/2010/ckeditor-enable-the-image-or-flash-upload/#comments</comments>
		<pubDate>Fri, 22 Jan 2010 17:18:39 +0000</pubDate>
		<dc:creator>shalfon</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[ckeditor]]></category>
		<category><![CDATA[upload]]></category>

		<guid isPermaLink="false">http://www.samanthahalfon.net/worldgoneweb/?p=232</guid>
		<description><![CDATA[
CKEditor is a greatly improved version of the famous FCKEditor. The generated source code is clean and well indented, the whole thing loads faster and feels less buggy. It even looks better.
What I really like though, is the new settings that allow for precise definition of what we want to encode or not and how [...]]]></description>
			<content:encoded><![CDATA[
<div class="topsy_widget_data topsy_theme_blue" style="float: right;margin-left: 0.75em;"><script type="text/javascript" src="http://button.topsy.com/widget/retweet-big?url=http://www.samanthahalfon.net/worldgoneweb/2010/ckeditor-enable-the-image-or-flash-upload/&amp;shorturl=http://bit.ly/4DUFdQ&amp;title=CKEditor%2C+enable+the+image+or+flash+upload&amp;theme=blue&amp;nick=samo9789&amp;order=count,retweet,badge&amp;txt_tweet=tweet&amp;txt_retweet=retweet"></script></div><p><a href="http://ckeditor.com/" target="_blank">CKEditor</a> is a greatly improved version of the famous FCKEditor. The generated source code is clean and well indented, the whole thing loads faster and feels less buggy. It even looks better.</p>
<p>What I really like though, is the new settings that allow for precise definition of what we want to encode or not and how we wish to handled pasted code (expecially coming from Word processors)</p>
<p>CKeditor is a rather recent version and some documentation will surely arrive soon, in the meantime, <a title="CKeditor file upload" href="http://docs.cksource.com/CKEditor_3.x/Developers_Guide/File_Browser_%28Uploader%29" target="_blank">the file upload isn&#8217;t very documented</a>.</p>
<p>Nevertheless, with some <a title="Stack Overflow CK editor upload" href="http://stackoverflow.com/questions/1498628/how-can-you-integrate-a-custom-file-browser-uploader-with-ckeditor" target="_blank">Stack Overflow</a> help, it all comes together pretty quickly :</p>
<ul>
<li>enable the file upload in the configuration by adding the following to your configuration file</li>
</ul>
<div class="codecolorer-container javascript dawn" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">config.<span style="color: #660066;">filebrowserUploadUrl</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">'/fckupload'</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<ul>
<li>Code your upload method that will be called when the URL defined in the configuration is called upon</li>
<li>Then, that&#8217;s the undocumented part, in JavaScript, call method required by CKEditor which is sent to you in the URL (below is a PHP example)</li>
</ul>
<div class="codecolorer-container php dawn" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">function</span> upload<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// do upload</span><br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// get file Url</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;script type=&quot;text/javascript&quot;&gt;window.parent.CKEDITOR.tools.callFunction('</span><span style="color: #339933;">.</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getHttpParam</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;CKEditorFuncNum&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">', &quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$fileUrl</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;);&lt;/script&gt;'</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.samanthahalfon.net/worldgoneweb/2010/ckeditor-enable-the-image-or-flash-upload/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Where are your users from?</title>
		<link>http://www.samanthahalfon.net/worldgoneweb/2010/where-are-your-users-from/</link>
		<comments>http://www.samanthahalfon.net/worldgoneweb/2010/where-are-your-users-from/#comments</comments>
		<pubDate>Thu, 21 Jan 2010 22:27:56 +0000</pubDate>
		<dc:creator>shalfon</dc:creator>
				<category><![CDATA[Computing]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[ip]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://www.samanthahalfon.net/worldgoneweb/?p=225</guid>
		<description><![CDATA[
If you ever wonder where your readers are from, if you ever need to adjust your application to the origins of its users; you can determine the geographic location of a connection by using an IP to Country table.
I should start by saying that I do not always like the way websites use this feature. [...]]]></description>
			<content:encoded><![CDATA[
<div class="topsy_widget_data topsy_theme_blue" style="float: right;margin-left: 0.75em;"><script type="text/javascript" src="http://button.topsy.com/widget/retweet-big?url=http://www.samanthahalfon.net/worldgoneweb/2010/where-are-your-users-from/&amp;title=Where+are+your+users+from%3F&amp;theme=blue&amp;nick=samo9789&amp;order=count,retweet,badge&amp;txt_tweet=tweet&amp;txt_retweet=retweet"></script></div><p>If you ever wonder where your readers are from, if you ever need to adjust your application to the origins of its users; you can determine the geographic location of a connection by using an IP to Country table.</p>
<p>I should start by saying that I do not always like the way websites use this feature. As much as I appreciate, let&#8217;s say, Yamaha, to redirect me from www.yamaha.com to fr.yamaha.com based on my location ; I can not stand for Google or Wikipedia to assume that I either speak French or intend to search French speaking contents.</p>
<p>Another thing I absolutely can not stand is of Skype (for example) to prompt me to download the French version of its application just because I am browsing the Web from France. I can not tolerate any French speaking applications to be installed on my computer. Actually, Mac OS X is such a treat on that point because I can have a French bought CD of Snow Leopard and still install my system in English. All the OEM Windows systems I purchased in my country of residence were bound to remain in (poorly-translated) French. I actually would always keep my license number handy but use a pirated English (but otherwise equivalent) version just so that my Start button would actually spell &#8216;Start&#8217;.</p>
<p>Anyway, the IP to Country determination can still come in handy and here&#8217;s how I made it work for me (using PHP/MySQL). I am aware that it is possible to do the www.yamaha.com to fr.yamaha.com redirection simply using geolocated aliases. Hosting providers such as OVH usually provide this functionality.</p>
<ol>
<li>Download the IP to Country.csv database (and update it there after) from <a title="Ip to Country" href="http://ip-to-country.webhosting.info/" target="_blank">http://ip-to-country.webhosting.info/</a></li>
<li>Create a table to hold the data</li>
<li>Import the data from the csv file into that table</li>
</ol>
<div class="codecolorer-container sql dawn" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br /></div></td><td><div class="sql codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">mysql<span style="color: #66cc66;">&gt;</span> <span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">TABLE</span> iptocountry <span style="color: #66cc66;">&#40;</span>ip_from int<span style="color: #66cc66;">&#40;</span>4<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span> ip_to int<span style="color: #66cc66;">&#40;</span>4<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span> country_code2 char<span style="color: #66cc66;">&#40;</span>2<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span> country_code3 char<span style="color: #66cc66;">&#40;</span>3<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span> country_name varchar<span style="color: #66cc66;">&#40;</span>50<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;<br />
mysql<span style="color: #66cc66;">&gt;</span> <span style="color: #993333; font-weight: bold;">LOAD</span> <span style="color: #993333; font-weight: bold;">DATA</span> <span style="color: #993333; font-weight: bold;">INFILE</span> <span style="color: #ff0000;">'ip-to-country.csv'</span> <span style="color: #993333; font-weight: bold;">INTO</span> <span style="color: #993333; font-weight: bold;">TABLE</span> iptocountry <span style="color: #993333; font-weight: bold;">FIELDS</span> terminated <span style="color: #993333; font-weight: bold;">BY</span> <span style="color: #ff0000;">','</span> <span style="color: #993333; font-weight: bold;">ENCLOSED</span> <span style="color: #993333; font-weight: bold;">BY</span> <span style="color: #ff0000;">'&quot;'</span> <span style="color: #993333; font-weight: bold;">LINES</span> terminated <span style="color: #993333; font-weight: bold;">BY</span> <span style="color: #ff0000;">'<span style="color: #000099; font-weight: bold;">\n</span>'</span>;</div></td></tr></tbody></table></div>
<p>Then, from your PHP code, you can get the country code for example, using the code below</p>
<div class="codecolorer-container php dawn" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">function</span> _ipAddressToIpValue<span style="color: #009900;">&#40;</span><span style="color: #000088;">$ip</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$ip</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$ips</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/split"><span style="color: #990000;">split</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;\.&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$ip</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #000088;">$ips</span><span style="color: #009900;">&#91;</span>3<span style="color: #009900;">&#93;</span> <span style="color: #339933;">+</span> <span style="color: #000088;">$ips</span><span style="color: #009900;">&#91;</span>2<span style="color: #009900;">&#93;</span> <span style="color: #339933;">*</span> 256 <span style="color: #339933;">+</span> <span style="color: #000088;">$ips</span><span style="color: #009900;">&#91;</span>1<span style="color: #009900;">&#93;</span> <span style="color: #339933;">*</span> 256 <span style="color: #339933;">*</span> 256 <span style="color: #339933;">+</span> <span style="color: #000088;">$ips</span><span style="color: #009900;">&#91;</span>0<span style="color: #009900;">&#93;</span> <span style="color: #339933;">*</span> 256 <span style="color: #339933;">*</span> 256 <span style="color: #339933;">*</span> <span style="color: #cc66cc;">256</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #000088;">$ipValue</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>_ipAddressToIpValue<span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;REMOTE_ADDR&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$queryResults</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>db<span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>query<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;SELECT country_name FROM iptocountry WHERE &quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$ipValue</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot; BETWEEN ip_from AND ip_to&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$res</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$queryResults</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>result_array<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><a href="http://www.php.net/count"><span style="color: #990000;">count</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$res</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$countryCode</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$res</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;country_name&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
<p>The code above is using Code Igniter to query the database. I suppose it is self explanatory enough to be transposed to any other DAO you might be using.</p>

]]></content:encoded>
			<wfw:commentRss>http://www.samanthahalfon.net/worldgoneweb/2010/where-are-your-users-from/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>PHP Help as a Man Page (with Pear)</title>
		<link>http://www.samanthahalfon.net/worldgoneweb/2010/php-help-as-a-man-page-with-pear/</link>
		<comments>http://www.samanthahalfon.net/worldgoneweb/2010/php-help-as-a-man-page-with-pear/#comments</comments>
		<pubDate>Fri, 15 Jan 2010 23:05:33 +0000</pubDate>
		<dc:creator>shalfon</dc:creator>
				<category><![CDATA[Computing]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[pear]]></category>
		<category><![CDATA[pman]]></category>
		<category><![CDATA[vi]]></category>

		<guid isPermaLink="false">http://www.samanthahalfon.net/worldgoneweb/?p=211</guid>
		<description><![CDATA[
Alexandre blogged last week about how to install pman and add a contextual help within VI for PHP functions. Tthis post is merely a quick note of the procedure. I like the speed of pman as opposed to browsing php.net. I didn&#8217;t install the VI part, I use Textmate these days.
The procedure is actually straight [...]]]></description>
			<content:encoded><![CDATA[
<div class="topsy_widget_data topsy_theme_blue" style="float: right;margin-left: 0.75em;"><script type="text/javascript" src="http://button.topsy.com/widget/retweet-big?url=http://www.samanthahalfon.net/worldgoneweb/2010/php-help-as-a-man-page-with-pear/&amp;shorturl=http://bit.ly/6EfPTm&amp;title=PHP+Help+as+a+Man+Page+%28with+Pear%29&amp;theme=blue&amp;nick=samo9789&amp;order=count,retweet,badge&amp;txt_tweet=tweet&amp;txt_retweet=retweet"></script></div><p><img class="alignleft size-full wp-image-214" title="terminal" src="http://www.samanthahalfon.net/worldgoneweb/wp-content/uploads/2010/01/terminal.jpeg" alt="terminal" width="110" height="110" /><a title="Alexandre Heimburger" href="http://www.alheim.fr/">Alexandre</a> blogged last week about <a href="http://alheim.fr/2010/01/integrer-dans-vi-des-man-pages-unix-pour-la-documentation-php/" target="_blank">how to install pman and add a contextual help within VI for PHP functions</a>. Tthis post is merely a quick note of the procedure. I like the speed of pman as opposed to browsing <a title="PHP" href="http://www.php.net" target="_blank">php.net</a>. I didn&#8217;t install the VI part, I use Textmate these days.</p>
<p>The procedure is actually straight forward: add the doc.php.net channel to pear then install pman</p>
<div class="codecolorer-container bash dawn" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">pear channel-discover doc.php.net<br />
<br />
pear <span style="color: #c20cb9; font-weight: bold;">install</span> doc.php.net<span style="color: #000000; font-weight: bold;">/</span>pman</div></td></tr></tbody></table></div>
<p>If everything went fine, try</p>
<div class="codecolorer-container bash dawn" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">pman substr</div></td></tr></tbody></table></div>
<p>Thanks to @alheim for the tip!</p>

]]></content:encoded>
			<wfw:commentRss>http://www.samanthahalfon.net/worldgoneweb/2010/php-help-as-a-man-page-with-pear/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Installing PHP Unit on Mac OS X running Zend Server CE</title>
		<link>http://www.samanthahalfon.net/worldgoneweb/2009/installing-php-unit-on-mac-os-x-running-zend-server-ce/</link>
		<comments>http://www.samanthahalfon.net/worldgoneweb/2009/installing-php-unit-on-mac-os-x-running-zend-server-ce/#comments</comments>
		<pubDate>Wed, 02 Dec 2009 16:23:02 +0000</pubDate>
		<dc:creator>shalfon</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[phpunit]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[unit tests]]></category>
		<category><![CDATA[zend]]></category>

		<guid isPermaLink="false">http://www.samanthahalfon.net/worldgoneweb/?p=180</guid>
		<description><![CDATA[
The main trick is not to mix pear as is /usr/bin/pear and /usr/local/zend/bin/pear. If you have already installed PHPUnit using the default Mac OS X Pear, do not mix /usr/bin/phpunit and /usr/local/zend/bin/phpunit.
That confusion out of the way, it seems the pear installed with the zend server is far from up to date. RUpdate it as [...]]]></description>
			<content:encoded><![CDATA[
<div class="topsy_widget_data topsy_theme_blue" style="float: right;margin-left: 0.75em;"><script type="text/javascript" src="http://button.topsy.com/widget/retweet-big?url=http://www.samanthahalfon.net/worldgoneweb/2009/installing-php-unit-on-mac-os-x-running-zend-server-ce/&amp;title=Installing+PHP+Unit+on+Mac+OS+X+running+Zend+Server+CE&amp;theme=blue&amp;nick=samo9789&amp;order=count,retweet,badge&amp;txt_tweet=tweet&amp;txt_retweet=retweet"></script></div><p>The main trick is not to mix pear as is /usr/bin/pear and /usr/local/zend/bin/pear. If you have already installed PHPUnit using the default Mac OS X Pear, do not mix /usr/bin/phpunit and /usr/local/zend/bin/phpunit.</p>
<p>That confusion out of the way, it seems the pear installed with the zend server is far from up to date. RUpdate it as follow :</p>
<div class="codecolorer-container bash dawn" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;"># remove the reg file for pear.php.net as its wrong</span><br />
<span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>zend<span style="color: #000000; font-weight: bold;">/</span>share<span style="color: #000000; font-weight: bold;">/</span>pear<span style="color: #000000; font-weight: bold;">/</span>.channels<span style="color: #000000; font-weight: bold;">/</span>pear.php.net.reg<br />
<span style="color: #666666; font-style: italic;"># remove the .channels as it is obsolete</span><br />
<span style="color: #c20cb9; font-weight: bold;">mv</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>zend<span style="color: #000000; font-weight: bold;">/</span>share<span style="color: #000000; font-weight: bold;">/</span>pear<span style="color: #000000; font-weight: bold;">/</span>.channels <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>zend<span style="color: #000000; font-weight: bold;">/</span>share<span style="color: #000000; font-weight: bold;">/</span>pear<span style="color: #000000; font-weight: bold;">/</span>.channels.old<br />
<span style="color: #666666; font-style: italic;"># now lets get the correct settings</span><br />
<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>zend<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>pear channel-update pear.php.net<br />
<span style="color: #666666; font-style: italic;"># update the pear installer</span><br />
<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>zend<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>pear upgrade pear</div></td></tr></tbody></table></div>
<p>All this done, proceeed with the PHPUnit install</p>
<div class="codecolorer-container bash dawn" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;"># phpunit moved from pear to there own pear server, so you need to add there channel</span><br />
<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>zend<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>pear channel-discover pear.phpunit.de<br />
<span style="color: #666666; font-style: italic;"># now you can add phpunit</span><br />
<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>zend<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>pear <span style="color: #c20cb9; font-weight: bold;">install</span> <span style="color: #660033;">-a</span> phpunit<span style="color: #000000; font-weight: bold;">/</span>PHPUnit</div></td></tr></tbody></table></div>
<p>That&#8217;s it! Below are a couple of links to helpful pages.</p>
<ul>
<li>http://akrabat.com/php/some-notes-on-zend-server-ce-for-mac-os-x</li>
<li>http://wiki.originalwebware.co.uk/ZendServer_phpunit</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://www.samanthahalfon.net/worldgoneweb/2009/installing-php-unit-on-mac-os-x-running-zend-server-ce/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Open Flash Chart, IE6 ad SSL: dangerous mix</title>
		<link>http://www.samanthahalfon.net/worldgoneweb/2009/167/</link>
		<comments>http://www.samanthahalfon.net/worldgoneweb/2009/167/#comments</comments>
		<pubDate>Wed, 04 Nov 2009 20:48:49 +0000</pubDate>
		<dc:creator>samo</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.samanthahalfon.net/worldgoneweb/?p=167</guid>
		<description><![CDATA[
I recently used Open Flash Chart to display statistics in a PHP based application. The library proved pozerful and easy to use. When the development was completed and moved to the production server (over https) the charts failed to display for IE6 (and Safari) users. Instead, the browser would try and download the page as [...]]]></description>
			<content:encoded><![CDATA[
<div class="topsy_widget_data topsy_theme_blue" style="float: right;margin-left: 0.75em;"><script type="text/javascript" src="http://button.topsy.com/widget/retweet-big?url=http://www.samanthahalfon.net/worldgoneweb/2009/167/&amp;title=Open+Flash+Chart%2C+IE6+ad+SSL%3A+dangerous+mix&amp;theme=blue&amp;nick=samo9789&amp;order=count,retweet,badge&amp;txt_tweet=tweet&amp;txt_retweet=retweet"></script></div><p>I recently used Open Flash Chart to display statistics in a PHP based application. The library proved pozerful and easy to use. When the development was completed and moved to the production server (over https) the charts failed to display for IE6 (and Safari) users. Instead, the browser would try and download the page as a file.</p>
<p>After trying to set all kinds of headers in my PHP code to override this strange behavior, I realized that OpenFlashChart adds its own headers (type=text) to the output.</p>
<p>To solve the problem, I simply commented out the lines</p>
<div class="codecolorer-container php dawn" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #b1b100;">echo</span> <a href="http://www.php.net/headers_sent"><span style="color: #990000;">headers_sent</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> ?<span style="color: #0000ff;">'yes'</span><span style="color: #339933;">:</span><span style="color: #0000ff;">'no'</span><span style="color: #339933;">;</span><br />
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span><a href="http://www.php.net/headers_sent"><span style="color: #990000;">headers_sent</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><br />
<a href="http://www.php.net/header"><span style="color: #990000;">header</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'content-type: text; charset: utf-8'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>from open-flash-chart.php at line 1828.</p>
<p>That fixed it for me. Hope it helps</p>

]]></content:encoded>
			<wfw:commentRss>http://www.samanthahalfon.net/worldgoneweb/2009/167/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Add any HTML to your Wordpress posts with EmbedIt (plugin &#8211; tweaked)</title>
		<link>http://www.samanthahalfon.net/worldgoneweb/2009/add-any-html-to-your-wordpress-posts-with-embedit-plugin-tweaked/</link>
		<comments>http://www.samanthahalfon.net/worldgoneweb/2009/add-any-html-to-your-wordpress-posts-with-embedit-plugin-tweaked/#comments</comments>
		<pubDate>Fri, 21 Aug 2009 21:33:28 +0000</pubDate>
		<dc:creator>shalfon</dc:creator>
				<category><![CDATA[Computing]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[World]]></category>
		<category><![CDATA[world wide angle]]></category>

		<guid isPermaLink="false">http://www.samanthahalfon.net/worldgoneweb/?p=159</guid>
		<description><![CDATA[
We were in need of a Wordpress plugin allowing us to add any HTML code in our posts for our Filmmaking blog World Wide Angle. Looking around on Google a little I stumbled upon EmbedIt by Matteo Ionescu. The plugin allows you to add a tag in your code like [HTMLx] and have it replace [...]]]></description>
			<content:encoded><![CDATA[
<div class="topsy_widget_data topsy_theme_blue" style="float: right;margin-left: 0.75em;"><script type="text/javascript" src="http://button.topsy.com/widget/retweet-big?url=http://www.samanthahalfon.net/worldgoneweb/2009/add-any-html-to-your-wordpress-posts-with-embedit-plugin-tweaked/&amp;title=Add+any+HTML+to+your+Wordpress+posts+with+EmbedIt+%28plugin+-+tweaked%29&amp;theme=blue&amp;nick=samo9789&amp;order=count,retweet,badge&amp;txt_tweet=tweet&amp;txt_retweet=retweet"></script></div><p>We were in need of a Wordpress plugin allowing us to add any HTML code in our posts for our <a href="http://www.wwangle.com/blog">Filmmaking blog World Wide Angle</a>. Looking around on Google a little I stumbled upon <a href="http://www.matteoionescu.com/wordpress/embed-html/">EmbedIt</a> by <a title="Matteo Ionescu" href="http://www.matteoionescu.com/">Matteo Ionescu</a>. The plugin allows you to add a tag in your code like [HTMLx] and have it replace by anything you enter as a meta info on your post with that same key HTMLx (where x is a number). (If this last line of explanation proved difficult to comprehend, you can read Matteo&#8217;s how to on his plugin page in details).</p>
<p>The plugin worked great and met the demand perfectly. I was curious to see if the HTML would also show in the RSS feed for the posts so I checked out the code to see how the whole thing worked. This is by reading the code that I realized that we could only place a maximum of 9 segments of HTML in any given post. I thought we were unlikely to reach this limit and moved on to something else.</p>
<p>Eventually, we did come to a situation when we wanted to write a post containing more than 9 segments of HTML. I therefore decided to improve the plugin myself. Starting from Matteo&#8217;s code I done a quick search on the Wordpress method he used: <a href="http://codex.wordpress.org/Function_Reference/get_post_meta">get_post_meta</a>. That lead me to a <a href="http://codex.wordpress.org/Custom_Fields">Wordpress Codex page about Custom Fields</a> where I found out about the function <a href="http://codex.wordpress.org/Function_Reference/get_post_custom_keys">get_post_custom_keys</a>. Putting all these methods together and adding a little brain grease I came up with the following:</p>
<div class="codecolorer-container php dawn" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;height:300px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">add_filter<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'the_content'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'substitute'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">function</span> substitute<span style="color: #009900;">&#40;</span><span style="color: #000088;">$content</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; <span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$post</span><span style="color: #339933;">;</span><br />
&nbsp; <span style="color: #666666; font-style: italic;">// get the html of the whole current post/page</span><br />
&nbsp; <span style="color: #000088;">$out</span><span style="color: #339933;">=</span><span style="color: #000088;">$content</span><span style="color: #339933;">;</span><br />
&nbsp; <span style="color: #000088;">$metadata</span> <span style="color: #339933;">=</span> get_post_custom_keys<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><a href="http://www.php.net/is_array"><span style="color: #990000;">is_array</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$metadata</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;</span>amp<span style="color: #339933;">;&amp;</span>amp<span style="color: #339933;">;</span> <a href="http://www.php.net/count"><span style="color: #990000;">count</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$metadata</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;</span>0<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$metadata</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$key</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000088;">$out</span><span style="color: #339933;">.</span><a href="http://www.php.net/substr"><span style="color: #990000;">substr</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$key</span><span style="color: #339933;">,</span> 0<span style="color: #339933;">,</span> 4<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><a href="http://www.php.net/substr"><span style="color: #990000;">substr</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$key</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">4</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">&quot;HTML&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$html</span> <span style="color: #339933;">=</span> get_post_meta<span style="color: #009900;">&#40;</span><span style="color: #000088;">$post</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>ID<span style="color: #339933;">,</span> <span style="color: #000088;">$key</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">''</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$out</span><span style="color: #339933;">=</span><a href="http://www.php.net/str_replace"><span style="color: #990000;">str_replace</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'['</span><span style="color: #339933;">.</span><span style="color: #000088;">$key</span><span style="color: #339933;">.</span><span style="color: #0000ff;">']'</span><span style="color: #339933;">,</span><span style="color: #000088;">$html</span><span style="color: #339933;">,</span> <span style="color: #000088;">$out</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; <span style="color: #b1b100;">return</span> <span style="color: #000088;">$out</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
<p>This new version of the plugin will search the custom fields for fields named HTMLxx and, when found, replace [HTMLxx] in the content by the value of the custom field. No more 1 to 9 restriction <img src='http://www.samanthahalfon.net/worldgoneweb/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>That done, I will submit the improved code to the plugin author and return to the redaction of my original post on <a href="http://www.wwangle.com/blog">World Wide Angle</a>.</p>

]]></content:encoded>
			<wfw:commentRss>http://www.samanthahalfon.net/worldgoneweb/2009/add-any-html-to-your-wordpress-posts-with-embedit-plugin-tweaked/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
	</channel>
</rss>
