<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.0.1" -->
<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/"
	>

<channel>
	<title>phpied.com</title>
	<link>http://www.phpied.com</link>
	<description>Stoyan's blog about (x)html, ajax, bookmarklets, browsers, css, firebug, javascript, json, mdb2, mysql, pear, performance, php, phpbb, tools, yslow, yui, writing, music,... life and everything.</description>
	<pubDate>Thu, 08 May 2008 21:02:58 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.0.1</generator>
	<language>en</language>
			<item>
		<title>Back to Bulgaria</title>
		<link>http://www.phpied.com/back-to-bulgaria/</link>
		<comments>http://www.phpied.com/back-to-bulgaria/#comments</comments>
		<pubDate>Thu, 08 May 2008 21:02:58 +0000</pubDate>
		<dc:creator>Stoyan</dc:creator>
		
	<category>News/personal</category>
	<category>Bulgaria</category>
		<guid isPermaLink="false">http://www.phpied.com/back-to-bulgaria/</guid>
		<description><![CDATA[I spent the 10 hours flight LA-Munich mainly standing up, walking or sitting on the armrest while the two kids occupied three chairs sleeping, which was totally fine, who wants to sit for 10 hours with cranky underslept kids. Then spent two hours with the noisiest kids on the Munich airport and two more on [...]]]></description>
			<content:encoded><![CDATA[<p>I spent the 10 hours flight LA-Munich mainly standing up, walking or sitting on the armrest while the two kids occupied three chairs sleeping, which was totally fine, who wants to sit for 10 hours with cranky underslept kids. Then spent two hours with the noisiest kids on the Munich airport and two more on the Munich-Sofia plane. The little one said "Daddy, we going into the plane's belly" and yeah, that's exactly how I felt at the end of the journey: as something that has been into someone's belly and then followed its natural way back to the light of day.</p>
<p>The important thing is that we're here now and the joy of getting together grandparents and grandchildren: priceless. Other than that Bulgaria is cool, unseasonably.
</p>
]]></content:encoded>
			<wfw:commentRSS>http://www.phpied.com/back-to-bulgaria/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>Load a photo in a canvas, then flip</title>
		<link>http://www.phpied.com/photo-canvas-tag-flip/</link>
		<comments>http://www.phpied.com/photo-canvas-tag-flip/#comments</comments>
		<pubDate>Sun, 04 May 2008 04:35:40 +0000</pubDate>
		<dc:creator>Stoyan</dc:creator>
		
	<category>JavaScript</category>
	<category>images</category>
	<category>canvas</category>
		<guid isPermaLink="false">http://www.phpied.com/photo-canvas-tag-flip/</guid>
		<description><![CDATA[ 
Today our family went to the yearly photo session with the girls. We took one shot that can be looked normally, as well as upside down, so I was wondering can you flip an image using a canvas tag. Turns out, yes, you can and it's pretty easy. 
&#187; Demo is here.
How to load [...]]]></description>
			<content:encoded><![CDATA[<p><img id="image375" src="http://www.phpied.com/wp-content/uploads/2008/05/zlati-nathalie.jpg" alt="zlati-nathalie.jpg" /> </p>
<p>Today our family went to the yearly photo session with the girls. We took one shot that can be looked normally, as well as upside down, so I was wondering can you flip an image using a canvas tag. Turns out, yes, you can and it's pretty easy. </p>
<p><a href="http://www.phpied.com/wp-content/uploads/2008/05/canvas.html">&raquo; Demo is here.</a></p>
<h3>How to load an image in a <code>canvas</code> tag?</h3>
<p>Start unpretentiously with an empty <code>canvas</code> tag:</p>
<div class="hl-main">
<pre><span class="hl-brackets">&lt;</span><span class="hl-reserved">canvas</span><span class="hl-code"> </span><span class="hl-var">id</span><span class="hl-code">=</span><span class="hl-quotes">&quot;</span><span class="hl-string">canvas</span><span class="hl-quotes">&quot;</span><span class="hl-brackets">&gt;</span><span class="hl-brackets">&lt;/</span><span class="hl-reserved">canvas</span><span class="hl-brackets">&gt;</span></pre>
</div>
<p>Now the javascript. Two variables to store a handle to the canvas element and the 2D context of the canvas:</p>
<div class="hl-main">
<pre><span class="hl-reserved">var</span><span class="hl-code"> </span><span class="hl-identifier">can</span><span class="hl-code"> = </span><span class="hl-builtin">document</span><span class="hl-code">.</span><span class="hl-identifier">getElementById</span><span class="hl-brackets">(</span><span class="hl-quotes">'</span><span class="hl-string">canvas</span><span class="hl-quotes">'</span><span class="hl-brackets">)</span><span class="hl-code">;
</span><span class="hl-reserved">var</span><span class="hl-code"> </span><span class="hl-identifier">ctx</span><span class="hl-code"> = </span><span class="hl-identifier">can</span><span class="hl-code">.</span><span class="hl-identifier">getContext</span><span class="hl-brackets">(</span><span class="hl-quotes">'</span><span class="hl-string">2d</span><span class="hl-quotes">'</span><span class="hl-brackets">)</span><span class="hl-code">;</span></pre>
</div>
<p>Now let's load an image into the canvas. Using the <code>new Image()</code> constructor you can create an image object, then set its <code>src</code> property to point to the location of the image file. Then set an <code>onload</code> handler for the image which is an anonymous function to be called when the image is done loading. There you put the image inside the canvas using the <code>drawImage()</code> method of the canvas context. </p>
<div class="hl-main">
<pre><span class="hl-reserved">var</span><span class="hl-code"> </span><span class="hl-identifier">img</span><span class="hl-code"> = </span><span class="hl-reserved">new</span><span class="hl-code"> </span><span class="hl-builtin">Image</span><span class="hl-brackets">(</span><span class="hl-brackets">)</span><span class="hl-code">;
</span><span class="hl-identifier">img</span><span class="hl-code">.</span><span class="hl-identifier">onload</span><span class="hl-code"> = </span><span class="hl-reserved">function</span><span class="hl-brackets">(</span><span class="hl-brackets">)</span><span class="hl-brackets">{</span><span class="hl-code">
    </span><span class="hl-identifier">can</span><span class="hl-code">.</span><span class="hl-identifier">width</span><span class="hl-code"> = </span><span class="hl-identifier">img</span><span class="hl-code">.</span><span class="hl-identifier">width</span><span class="hl-code">;
    </span><span class="hl-identifier">can</span><span class="hl-code">.</span><span class="hl-identifier">height</span><span class="hl-code"> = </span><span class="hl-identifier">img</span><span class="hl-code">.</span><span class="hl-identifier">height</span><span class="hl-code">;
    </span><span class="hl-identifier">ctx</span><span class="hl-code">.</span><span class="hl-identifier">drawImage</span><span class="hl-brackets">(</span><span class="hl-identifier">img</span><span class="hl-code">, </span><span class="hl-number">0</span><span class="hl-code">, </span><span class="hl-number">0</span><span class="hl-code">, </span><span class="hl-identifier">img</span><span class="hl-code">.</span><span class="hl-identifier">width</span><span class="hl-code">, </span><span class="hl-identifier">img</span><span class="hl-code">.</span><span class="hl-identifier">height</span><span class="hl-brackets">)</span><span class="hl-code">;
</span><span class="hl-brackets">}</span><span class="hl-code">
</span><span class="hl-identifier">img</span><span class="hl-code">.</span><span class="hl-identifier">src</span><span class="hl-code"> = </span><span class="hl-quotes">'</span><span class="hl-string">zlati-nathalie.jpg</span><span class="hl-quotes">'</span><span class="hl-code">;</span></pre>
</div>
<p>You can also notice how the dimensions of the canvas are adjusted to match the dimensions of the image.</p>
<h3>How to flip the image upside down</h3>
<p>The  canvas context provides a <code>rotate()</code> method. The rotation always happens around the top left corner of the image, so we first <code>translate()</code> the image to the bottom right. This way when the image is rotated, it fits back into the canvas. (There is also a one pixel correction, I have no idea why, just saw that the image wasn't flipping exactly otherwise). Assigning this functionality to the <code>onclick</code>:</p>
<div class="hl-main">
<pre><span class="hl-identifier">can</span><span class="hl-code">.</span><span class="hl-identifier">onclick</span><span class="hl-code"> = </span><span class="hl-reserved">function</span><span class="hl-brackets">(</span><span class="hl-brackets">)</span><span class="hl-code"> </span><span class="hl-brackets">{</span><span class="hl-code">
    </span><span class="hl-identifier">ctx</span><span class="hl-code">.</span><span class="hl-identifier">translate</span><span class="hl-brackets">(</span><span class="hl-identifier">img</span><span class="hl-code">.</span><span class="hl-identifier">width</span><span class="hl-code">-</span><span class="hl-number">1</span><span class="hl-code">, </span><span class="hl-identifier">img</span><span class="hl-code">.</span><span class="hl-identifier">height</span><span class="hl-code">-</span><span class="hl-number">1</span><span class="hl-brackets">)</span><span class="hl-code">;
    </span><span class="hl-identifier">ctx</span><span class="hl-code">.</span><span class="hl-identifier">rotate</span><span class="hl-brackets">(</span><span class="hl-builtin">Math</span><span class="hl-code">.</span><span class="hl-identifier">PI</span><span class="hl-brackets">)</span><span class="hl-code">;
    </span><span class="hl-identifier">ctx</span><span class="hl-code">.</span><span class="hl-identifier">drawImage</span><span class="hl-brackets">(</span><span class="hl-identifier">img</span><span class="hl-code">, </span><span class="hl-number">0</span><span class="hl-code">, </span><span class="hl-number">0</span><span class="hl-code">, </span><span class="hl-identifier">img</span><span class="hl-code">.</span><span class="hl-identifier">width</span><span class="hl-code">, </span><span class="hl-identifier">img</span><span class="hl-code">.</span><span class="hl-identifier">height</span><span class="hl-brackets">)</span><span class="hl-code">;
</span><span class="hl-brackets">}</span><span class="hl-code">;</span></pre>
</div>
<p>C'est tout! Once again, <a href="http://www.phpied.com/wp-content/uploads/2008/05/canvas.html">the demo is here</a>.</p>
]]></content:encoded>
			<wfw:commentRSS>http://www.phpied.com/photo-canvas-tag-flip/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>Firefox/Firebug extension creator wizard</title>
		<link>http://www.phpied.com/firefox-firebug-extension-creator-wizard/</link>
		<comments>http://www.phpied.com/firefox-firebug-extension-creator-wizard/#comments</comments>
		<pubDate>Sat, 26 Apr 2008 09:38:31 +0000</pubDate>
		<dc:creator>Stoyan</dc:creator>
		
	<category>firefox</category>
	<category>firebug</category>
		<guid isPermaLink="false">http://www.phpied.com/firefoxfirebug-extension-creator-wizard/</guid>
		<description><![CDATA[
Always wanted to create a Firefox extension? Or a Firebug extension? Here's an easy way to take off the ground, no more excuses.
Firefox Extensions
The way most people get started with creating a Firefox extension is copying an existing extension and tweaking. This is not the best way as you can guess, the best way is [...]]]></description>
			<content:encoded><![CDATA[<p><img id="image372" src="http://www.phpied.com/wp-content/uploads/2008/04/puzzle.png" alt="puzzle.png" style="float: left; padding-right: 10px" /></p>
<p>Always wanted to create a Firefox extension? Or a Firebug extension? Here's an easy way to take off the ground, no more excuses.</p>
<h3>Firefox Extensions</h3>
<p>The way most people get started with creating a Firefox extension is copying an existing extension and tweaking. This is not the best way as you can guess, the best way is to read documentation (where exists), but who cares about reading documentation. It's a fact that there are specific predefined files, directories and conventions you need to follow in order to get started with even the simplest "Hello World". Well, with my new tool, this is taken care of, so you can literally turn any piece of JavaScript (a bookmarklet for example) into a browser extension. Not bad, eh?</p>
<h3>The tool</h3>
<p>The tool is located at <a href="http://tools.w3clubs.com/ext/">http://tools.w3clubs.com/ext/</a></p>
<p>It's basically just a simple form you fill out with your name, URL, extension name, etc, then a working extension is generated for you. You then install your own extension and just start modifying it. So your new extension is ready in under a minute.</p>
<h3>Firebug extensions</h3>
<p>I did this tool a while ago for personal needs and it has been working for me with no worries. Today before making it public, I thought of adding the option to generate Firebug extensions too. You knew Firebug is extensible and you can add new tabs, right? Yahoo!'s <a href="http://developer.yahoo.com/yslow/">YSlow</a> is an example of a Firebug extension.</p>
<p>I followed <a href="http://www.softwareishard.com/blog/">Honza</a>'s Firebug tutorials <a href="http://www.softwareishard.com/blog/?p=3">part I</a> and <a href="http://www.softwareishard.com/blog/?p=4">II</a> and it worked beautifully. Honza is a Firebug contributor and these tutorials are excellently written and highly recommended, even if you use my tool to generate the code, it's still a good idea to know why things are what/where they are.</p>
<p>So there you go, same <a href="http://tools.w3clubs.com/ext/">tool for creating both Firefox and Firebug extensions</a>. </p>
<p>Have fun with the tool, but be aware that writing extensions is addictive, don't say I didn't warn you. As always, any feedback is appreciated.
</p>
]]></content:encoded>
			<wfw:commentRSS>http://www.phpied.com/firefox-firebug-extension-creator-wizard/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>Editing made easy: 6 words to cut out</title>
		<link>http://www.phpied.com/editing-made-easy-6-words-to-cut-out/</link>
		<comments>http://www.phpied.com/editing-made-easy-6-words-to-cut-out/#comments</comments>
		<pubDate>Sat, 26 Apr 2008 07:57:28 +0000</pubDate>
		<dc:creator>Stoyan</dc:creator>
		
	<category>writing</category>
		<guid isPermaLink="false">http://www.phpied.com/editing-made-easy-6-words-to-cut-out/</guid>
		<description><![CDATA[When you write something: a book, an article, an email&#8230; cut out needless words. The copy after editing should be shorter. Writing is not speaking, it must be tighter. (And, if you find an email is getting longer, just phone the person, he'll never read the email anyway) 
I've read somewhere Mark Twain was saying [...]]]></description>
			<content:encoded><![CDATA[<p>When you write something: a book, an article, an email&#8230; cut out needless words. The copy after editing should be shorter. Writing is not speaking, it must be tighter. (And, if you find an email is getting longer, just phone the person, he'll never read the email anyway) </p>
<p>I've read somewhere Mark Twain was saying that "very" should always be cut out. I started paying attention to my use of "very" and found that a sentence only wins after I un-very it. </p>
<p>Today I came across <a href="http://www.dailywritingtips.com/five-words-you-can-cut/">this article</a> listing 5 more words to cut out. So here's the list of no-no words, should make any editing process much easier:</p>
<ul>
<li>very</li>
<li>really</li>
<li>just</li>
<li>quite</li>
<li>perhaps/maybe</li>
<li>that</li>
</ul>
<p>Check the comments too, there was an interesting insight about words we use to "temper" our speech which we should probably omit when writing, words such as "slightly", "a bit", "somewhat".</p>
<p>And here's another <a href="http://www.lifehack.org/articles/communication/improve-your-writing-with-these-editing-tips.html">excellent piece on editing</a> I just found:</p>
<blockquote><p>there is no good writing, only good re-writing</p></blockquote>
]]></content:encoded>
			<wfw:commentRSS>http://www.phpied.com/editing-made-easy-6-words-to-cut-out/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>Sancta Simplicitas: minimalistic WordPress theme using YUI CSS</title>
		<link>http://www.phpied.com/sancta-simplicitas-minimalistic-wordpress-theme-using-yui-css/</link>
		<comments>http://www.phpied.com/sancta-simplicitas-minimalistic-wordpress-theme-using-yui-css/#comments</comments>
		<pubDate>Fri, 25 Apr 2008 08:56:55 +0000</pubDate>
		<dc:creator>Stoyan</dc:creator>
		
	<category>WordPress</category>
	<category>yui</category>
		<guid isPermaLink="false">http://www.phpied.com/sancta-simplicitas-minimalistic-wordpress-theme-using-yui-css/</guid>
		<description><![CDATA[ 
Sancta Simplicitas is a WordPress theme that uses YUI CSS utilities: reset, base, fonts, grids. It's very minimalistic in a sense that it's pretty much all white and simple. Hence the name. The theme is probably not usable by itself, but it's a base on top of which you can create your own themes. [...]]]></description>
			<content:encoded><![CDATA[<p><img id="image368" src="http://www.phpied.com/wp-content/uploads/2008/04/screenshot.png" alt="Sancta Simplicitas Wordpress theme screenshot" /> </p>
<p>Sancta Simplicitas is a WordPress theme that uses YUI CSS utilities: reset, base, fonts, grids. It's very minimalistic in a sense that it's pretty much all white and simple. Hence the name. The theme is probably not usable by itself, but it's a base on top of which you can create your own themes. </p>
<p>When creating a new WordPress theme, people usually take the default Kubrick theme but I personally find Kubrick too much. So Sancta Simplicitas has a very minimal stylesheet and is based on the WordPress classic theme.</p>
<p>The fact that it uses YUI grids makes it trivial to tweak: fixed size vs full width, width of the sidebar, position of the sidebar. Basically right after the <code>&lt;body&gt;</code> there's this:</p>
<div class="hl-main">
<pre><span class="hl-brackets">&lt;</span><span class="hl-reserved">div</span><span class="hl-code"> </span><span class="hl-var">id</span><span class="hl-code">=</span><span class="hl-quotes">&quot;</span><span class="hl-string">doc3</span><span class="hl-quotes">&quot;</span><span class="hl-code"> </span><span class="hl-var">class</span><span class="hl-code">=</span><span class="hl-quotes">&quot;</span><span class="hl-string">yui-t5</span><span class="hl-quotes">&quot;</span><span class="hl-brackets">&gt;</span></pre>
</div>
<p>Changing the id <code>doc3</code> to <code>doc</code>, <code>doc2</code>, <code>doc4</code> or <code>doc5</code> will give you different widths of the content. The default <code>doc3</code> is full width. Then changing the class name <code>yui-t5</code> will give you different position and width of the sidebar. <code>yui-t1</code>, <code>yui-t2</code> and <code>yui-t3</code> put the sidebar on the left hand side, <code>yui-t4</code>, <code>yui-t5</code> and <code>yui-t6</code> place it to the right. You can go even crazier from here, nesting grids to get a two-column sidebar and so on, it's really easy with YUI grids and <a href="http://developer.yahoo.com/yui/grids/">the docs are here</a>.</p>
<h3>Download Sancta Simplicitas</h3>
<p>&raquo; <a id="p367" href="http://www.phpied.com/wp-content/uploads/2008/04/sansim.zip">sansim.zip</a>
</p>
]]></content:encoded>
			<wfw:commentRSS>http://www.phpied.com/sancta-simplicitas-minimalistic-wordpress-theme-using-yui-css/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>strftime() in JavaScript</title>
		<link>http://www.phpied.com/strftime-in-javascript/</link>
		<comments>http://www.phpied.com/strftime-in-javascript/#comments</comments>
		<pubDate>Fri, 25 Apr 2008 07:41:09 +0000</pubDate>
		<dc:creator>Stoyan</dc:creator>
		
	<category>JavaScript</category>
	<category>php</category>
		<guid isPermaLink="false">http://www.phpied.com/strftime-in-javascript/</guid>
		<description><![CDATA[Philip "Bluesmoon" Tellis has posted a tiny (under 3K minified) JavaScript library to format dates, inspired by PHP's strftime()
Examples:


d.strftime('%Y/%m/%d')
» en: 2008/04/25
» fr: 2008/04/25
» de: 2008/04/25

d.strftime('%A, %d %B')
» en: Friday, 25 April
» fr: Vendredi, 25 Avril
» de: Freitag, 25 April

There's also a demo to fiddle with.
I've previously had fun with kinda like the opposite: translating human-readable [...]]]></description>
			<content:encoded><![CDATA[<p>Philip "Bluesmoon" Tellis <a href="http://tech.bluesmoon.info/2008/04/strftime-in-javascript.html">has posted</a> a tiny (under 3K minified) JavaScript library to format dates, inspired by PHP's <a href="http://php.net/strftime">strftime()</a></p>
<p>Examples:</p>
<blockquote>
<pre>
d.strftime('%Y/%m/%d')
» en: 2008/04/25
» fr: 2008/04/25
» de: 2008/04/25

d.strftime('%A, %d %B')
» en: Friday, 25 April
» fr: Vendredi, 25 Avril
» de: Freitag, 25 April</pre>
</blockquote>
<p>There's also a <a href="http://hacks.bluesmoon.info/strftime/demo.html">demo</a> to fiddle with.</p>
<p>I've previously <a href="http://www.phpied.com/files/time-parser/time-parser.htm">had fun</a> with kinda like the opposite: translating human-readable <em>times</em> into JS Date objects. Also <a href="http://simon.incutio.com/archive/2003/10/06/betterDateInput">here</a> and <a href="http://datebox.inimit.com/">here</a> you have <a href="http://php.net/strtotime">strtotime()</a> look-alikes that take human-readable <em>dates</em> and turn them into Date objects.
</p>
]]></content:encoded>
			<wfw:commentRSS>http://www.phpied.com/strftime-in-javascript/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>A collection of writing tips</title>
		<link>http://www.phpied.com/a-collection-of-writing-tips/</link>
		<comments>http://www.phpied.com/a-collection-of-writing-tips/#comments</comments>
		<pubDate>Sat, 19 Apr 2008 07:25:47 +0000</pubDate>
		<dc:creator>Stoyan</dc:creator>
		
	<category>writing</category>
		<guid isPermaLink="false">http://www.phpied.com/a-collection-of-writing-tips/</guid>
		<description><![CDATA[A collection of writing tips here, includes advise from Stephen King, Paul Graham, Scott Adams and others.
In the end, if you want to write well I believe it all boils down to:

write - daily
edit - cut out needless words
read - everything you can lay your hands on

It's so simple and yet we keep looking for [...]]]></description>
			<content:encoded><![CDATA[<p>A collection of writing tips <a href="http://pigpog.com/node/1059">here</a>, includes advise from Stephen King, Paul Graham, Scott Adams and others.</p>
<p>In the end, if you want to write well I believe it all boils down to:</p>
<ol>
<li>write - daily</li>
<li>edit - cut out needless words</li>
<li>read - everything you can lay your hands on</li>
</ol>
<p>It's so simple and yet we keep looking for the "secret". Same with dieting: all boils down to a/don't eat junk and optionally b/exercise. But we keep looking for the shortcut, the miracle diet that will allow us to "take it off and keep it off" while lying on couch on front of the TV.
</p>
]]></content:encoded>
			<wfw:commentRSS>http://www.phpied.com/a-collection-of-writing-tips/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>Rules for fast web pages</title>
		<link>http://www.phpied.com/rules-for-fast-web-pages/</link>
		<comments>http://www.phpied.com/rules-for-fast-web-pages/#comments</comments>
		<pubDate>Mon, 14 Apr 2008 16:57:20 +0000</pubDate>
		<dc:creator>Stoyan</dc:creator>
		
	<category>performance</category>
	<category>yahoo</category>
		<guid isPermaLink="false">http://www.phpied.com/rules-for-fast-web-pages/</guid>
		<description><![CDATA[&#8230; just updated.
http://developer.yahoo.com/performance/rules.html
The list (used to be 13 items, then 14, now 34) is becoming too overwhelming so it's now split into categories:

content
server
cookie
css
javascript
images
mobile

Act now to improve you page loading speed, your user will thank you later 

]]></description>
			<content:encoded><![CDATA[<p>&#8230; just updated.</p>
<p><a href="http://developer.yahoo.com/performance/rules.html">http://developer.yahoo.com/performance/rules.html</a></p>
<p>The list (used to be 13 items, then 14, now 34) is becoming too overwhelming so it's now split into categories:</p>
<ul>
<li style="background: #F36E15; color: white; padding: 5px; display: inline;">content</li>
<li style="background: #EBCC11; color: white; padding: 5px; display: inline;">server</li>
<li style="background: #704503; color: white; padding: 5px; display: inline;">cookie</li>
<li style="background: #0B9BC5; color: white; padding: 5px; display: inline;">css</li>
<li style="background: #8EC912; color: white; padding: 5px; display: inline;">javascript</li>
<li style="background: #872307; color: white; padding: 5px; display: inline;">images</li>
<li style="background: #004BB4; color: white; padding: 5px; display: inline;">mobile</li>
</ul>
<p>Act now to improve you page loading speed, your user will thank you later <img src='http://www.phpied.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />
</p>
]]></content:encoded>
			<wfw:commentRSS>http://www.phpied.com/rules-for-fast-web-pages/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>When client-only validation is good for business</title>
		<link>http://www.phpied.com/when-client-only-validation-is-good-for-business/</link>
		<comments>http://www.phpied.com/when-client-only-validation-is-good-for-business/#comments</comments>
		<pubDate>Sun, 13 Apr 2008 05:09:54 +0000</pubDate>
		<dc:creator>Stoyan</dc:creator>
		
	<category>JavaScript</category>
	<category>(x)HTML</category>
		<guid isPermaLink="false">http://www.phpied.com/when-client-only-validation-is-good-for-business/</guid>
		<description><![CDATA[You should never never ever rely on client-side validation only. Client-side validation is for enhancing user experience, server-side is the validation. This is a rule, never to be broken. But here's a funny story how skipping the server-side validation actually helped.
This is a real story, but the actual names have been replaced in XXX, just [...]]]></description>
			<content:encoded><![CDATA[<div style="border: 1px solid #eeeeee; padding: 10px; margin: 10px;">You should never never ever rely on client-side validation only. Client-side validation is for enhancing user experience, server-side is <em>the</em> validation. This is a rule, never to be broken. But here's a funny story how skipping the server-side validation actually helped.</div>
<p>This is a real story, but the actual names have been replaced in XXX, just not to make other people look bad <img src='http://www.phpied.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>There is this site called xxxxxxxxx.com that charges you $XX membership access. Having just moved from Canada, last year I didn't have a US credit card to pay the fee and tried to use my Canadian visa. Problem: the input field for postal code (zip code) accepts 5 characters only, since the zip codes in US a like 90404, 90066 and so on. A Canadian postal code is like H0H-0H0 or H0H0H0, six characters. So seemed like I couldn't pay online. Or could I?</p>
<p>Checking the source code with Firebug gives me this:</p>
<p><img id="image363" src="http://www.phpied.com/wp-content/uploads/2008/04/client.png" alt="client.png" /></p>
<p>From here it's trivial to change <code>maxlength</code> attribute of the input. Even with IE it's super easy just to type in the address bar something like:<br />
<code>javascript:document.getElementsByName('XXXXXXX')[0].maxLength = 100;</code></p>
<p>So I did change it, typed my Canadian CC#, Canadian postal code and submitted the form, crossing fingers that the developers who built the site were too pressed by deadlines to do a proper server-side validation. Lo and behold, it worked!</p>
<p>At the end with the help of an innocent client-side tweak I got what I needed (membership), xxxxxxxx.com got more business, and everybody's happy.</p>
<p>There's a lesson in this: sometimes being too strict in data validation for things that don't matter is just in your way.<br />
And another: don't assume all your potential clients are from US.
</p>
]]></content:encoded>
			<wfw:commentRSS>http://www.phpied.com/when-client-only-validation-is-good-for-business/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>Santa Monica apartment hunting</title>
		<link>http://www.phpied.com/santa-monica-appartment-hunting/</link>
		<comments>http://www.phpied.com/santa-monica-appartment-hunting/#comments</comments>
		<pubDate>Sun, 13 Apr 2008 03:16:53 +0000</pubDate>
		<dc:creator>Stoyan</dc:creator>
		
	<category>News/personal</category>
	<category>California</category>
		<guid isPermaLink="false">http://www.phpied.com/santa-monica-appartment-hunting/</guid>
		<description><![CDATA[Time goes by. Feels like yesterday, but it's actually been a whole year since I moved to LA together with the family. Guess the wonderful present we received a month ago from our landlord - $500 rent increase. W00t! Needless to say, we've been apartment hunting ever since. 
The Yahoo! office is at a great [...]]]></description>
			<content:encoded><![CDATA[<p>Time goes by. Feels like yesterday, but it's actually been a whole year since I moved to LA together with the family. Guess the wonderful present we received a month ago from our <a href="http://www.archstoneapartments.com/Apartments/California/Los_Angeles/Archstone_Westside/">landlord</a> - $500 rent increase. <em>W00t!</em> Needless to say, we've been apartment hunting ever since. </p>
<p>The <a href="http://maps.yahoo.com/#mvt=m&#038;lat=34.030727&#038;lon=-118.47402&#038;zoom=17&#038;q1=2450%20Broadway%2C%20Santa%20Monica%2C%20CA%2090404">Yahoo! office</a> is at a great location, Santa Monica, 23 blocks from the beach. And since I wanted to be close to the office, so that I spend more time with the family and less time stuck in the world-famous LA traffic, we wanted to find a place nearby. </p>
<p>It just occurred to me that (for the things that matter to us) the formula for apartment hunting in West LA is:</p>
<blockquote><p>"Price, school, washer/dryer in unit: pick any two"</p></blockquote>
<p>It's crazy how expensive housing is here. It's crazy how few apartments have washer in the unit (the idea of washing your baby's clothes together with some dude's smelly nikes is insane, but apparently totally acceptable here). And it's crazy how the school regions are divided - our street is in the region of <a href="http://www.greatschools.net/modperl/browse_school/ca/2223">a perfect school</a> (rating 10 of 10), but two blocks from here, it's <a href="http://www.greatschools.net/modperl/browse_school/ca/2345">totally different</a> (rating 4 of 10). And you're not allowed to pick the school, you just have to enroll in the school for your region.</p>
<p>I checked Burbank (another Y! office) and Sunnyvale (Y!'s HQ): nowhere, I mean nowhere, the situation is that tragic as here. For the same money and often much less you can get excellent apartments (or houses) with great schools. California is expensive, but LA and especially the beach areas are just beyond expensive. </p>
<p>Anyway, I can go on, but ranting isn't my style and it only makes me more miserable <img src='http://www.phpied.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  On the bright side you live close to Hollywood, Beverly Hills and celebrities (like I care), you can "make it" as an actor (which I'm not), you can hit nice clubs where some of your <a href="http://music.yahoo.com/ar-313714---The-Doors">favorite bands</a> played (never done it, kids and all) or strip clubs (not me, hello, I'm a father of two girls).</p>
<p><img id="image360" src="http://www.phpied.com/wp-content/uploads/2008/04/disney.jpg" alt="disney.jpg" /></p>
<p>On the really bright side we can hang out with Cinderella in Disneyland (hello, I'm a father of two girls) and <a href="http://flickr.com/search?q=santa%20monica%20beach">hit the beach</a>. Which we do. We have to, I mean, to make up for the insane rent <img src='http://www.phpied.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' />
</p>
]]></content:encoded>
			<wfw:commentRSS>http://www.phpied.com/santa-monica-appartment-hunting/feed/</wfw:commentRSS>
		</item>
	</channel>
</rss>
