<?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>Ladysign Dev Blog &#187; Code</title>
	<atom:link href="http://www.ladysign-apps.com/blog/category/code/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ladysign-apps.com/blog</link>
	<description>Girls can code.</description>
	<lastBuildDate>Mon, 12 Dec 2011 16:58:15 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Semicolons after javascript statements</title>
		<link>http://www.ladysign-apps.com/blog/code/javascript/semicolons-after-javascript-statements/</link>
		<comments>http://www.ladysign-apps.com/blog/code/javascript/semicolons-after-javascript-statements/#comments</comments>
		<pubDate>Mon, 12 Dec 2011 14:16:06 +0000</pubDate>
		<dc:creator>Lee</dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://www.ladysign-apps.com/blog/?p=1030</guid>
		<description><![CDATA[<p>According to Javascript; the semicolon after a statement (for example a function), is optional.<br />
However, it&#8217;s much better to end your line with [......]</p><p class='read-more'><a href='http://www.ladysign-apps.com/blog/code/javascript/semicolons-after-javascript-statements/'>继续阅读</a></p>]]></description>
			<content:encoded><![CDATA[<p>According to Javascript; the semicolon after a statement (for example a function), is optional.<br />
However, it&#8217;s much better to end your line with a semicolon. A validator like JSLint for example, will throw a warning, even though<br />
the browser won&#8217;t, and accepts it.</p>
<p>See below, which strange things can happen when you won&#8217;t end your line with a semicolon.<br />
Javascript errors because of the order of javascript functions mixed with jQuery plugins&#8230;<br />
<a href="http://jsfiddle.net/bpsuW/11/">http://jsfiddle.net/bpsuW/11/</a></p>
<p>foo is a simple javascript function.<br />
Baz is a simple self running jQuery plugin. (because of the parentheses surrounding it).</p>
<p><code>foo = function(){<br />
    alert("function 1");<br />
}</p>
<p>(function(){<br />
    $.fn.Baz = function(opt){<br />
        alert("function 2");<br />
    }<br />
 })(jQuery)<br />
</code></p>
<p>See below the script, without strange javascript errors.<br />
<a href="http://jsfiddle.net/bpsuW/10/">http://jsfiddle.net/bpsuW/10/</a></p>
<p>The answer is really logical.<br />
Because there is no semicolon, the jQuery plugin (Baz) will directly execute, because of the parentheses.<br />
Like it&#8217;s a parameter of the javascript function you wrote before. (foo), and then throws errors.<br />
So:</p>
<p><code>foo(Baz)</code></p>
<p>When you mix your jQuery plugins with native javascript classes and functions in different orders; these kind of errors can happen.<br />
This scenario above shows you why you should <strong>always</strong> end your statements with a semicolon.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ladysign-apps.com/blog/code/javascript/semicolons-after-javascript-statements/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Create a Firefox Extension</title>
		<link>http://www.ladysign-apps.com/blog/code/browsers/create-a-ff-extension/</link>
		<comments>http://www.ladysign-apps.com/blog/code/browsers/create-a-ff-extension/#comments</comments>
		<pubDate>Mon, 05 Sep 2011 12:33:21 +0000</pubDate>
		<dc:creator>Lee</dc:creator>
				<category><![CDATA[browsers]]></category>
		<category><![CDATA[extensions]]></category>
		<category><![CDATA[browser plugin]]></category>
		<category><![CDATA[extension]]></category>
		<category><![CDATA[ff]]></category>
		<category><![CDATA[firefox]]></category>

		<guid isPermaLink="false">http://www.ladysign-apps.com/blog/?p=1023</guid>
		<description><![CDATA[<p><strong>Difficulty:</strong> 2 out of 5 stars</p>
<p>Create the startup files and folders via:<br />
<a href="https://addons.mozilla.org/en-US/developers/tools/builder/9b0cddaa3fc073e50a0e7e284ef64438">https://addons.mozilla.org/en-US/developers/tools/builder/9b0cddaa3fc073e50a0e7[......]</a></p><p class='read-more'><a href='http://www.ladysign-apps.com/blog/code/browsers/create-a-ff-extension/'>继续阅读</a></p>]]></description>
			<content:encoded><![CDATA[<p><strong>Difficulty:</strong> 2 out of 5 stars</p>
<p>Create the startup files and folders via:<br />
<a href="https://addons.mozilla.org/en-US/developers/tools/builder/9b0cddaa3fc073e50a0e7e284ef64438">https://addons.mozilla.org/en-US/developers/tools/builder/9b0cddaa3fc073e50a0e7e284ef64438</a></p>
<p>Prefill all the fields, and build the zip file.<br />
Unpack this zip file, and open:<br />
/chrome/content/overlay.js</p>
<p>You can edit this file.<br />
In chrome/skin/ are the files for editing the styles and logo.</p>
<p>After changing the files. Zip it in and rename the zip file to the xpi extension.<br />
Drag the xpi file in your FF browser.. And your own plugin is installed.</p>
<p>More info:<br />
<a href="https://addons.mozilla.org/en-US/developers/docs/getting-started">https://addons.mozilla.org/en-US/developers/docs/getting-started</a><br />
<a href="https://developer.mozilla.org/en/Code_snippets/Tabbed_browser">https://developer.mozilla.org/en/Code_snippets/Tabbed_browser</a><br />
<a href="https://developer.mozilla.org/en/XUL/tabbrowser#m-loadURI">https://developer.mozilla.org/en/XUL/tabbrowser#m-loadURI</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ladysign-apps.com/blog/code/browsers/create-a-ff-extension/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Create Chome Extension</title>
		<link>http://www.ladysign-apps.com/blog/code/browsers/create-chome-extension/</link>
		<comments>http://www.ladysign-apps.com/blog/code/browsers/create-chome-extension/#comments</comments>
		<pubDate>Fri, 02 Sep 2011 14:41:54 +0000</pubDate>
		<dc:creator>Lee</dc:creator>
				<category><![CDATA[api]]></category>
		<category><![CDATA[browsers]]></category>
		<category><![CDATA[extensions]]></category>
		<category><![CDATA[chrome]]></category>

		<guid isPermaLink="false">http://www.ladysign-apps.com/blog/?p=1019</guid>
		<description><![CDATA[<p><strong>Difficulty:</strong> 1 out of 5 stars</p>
<p>It&#8217;s really easy to create your own Chrome Extension.<br />
This simple extension just opens your personal website in a n[......]</p><p class='read-more'><a href='http://www.ladysign-apps.com/blog/code/browsers/create-chome-extension/'>继续阅读</a></p>]]></description>
			<content:encoded><![CDATA[<p><strong>Difficulty:</strong> 1 out of 5 stars</p>
<p>It&#8217;s really easy to create your own Chrome Extension.<br />
This simple extension just opens your personal website in a new tab.</p>
<p>1. Create a folder<br />
2. Create the following files:<br />
* manifest.json<br />
* background.html<br />
* icon.png<br />
3. Edit the manifest file:</p>
<pre class="brush: plain; title: ;">
{
  &quot;name&quot;: &quot;My website&quot;,
  &quot;version&quot;: &quot;1.0&quot;,
  &quot;description&quot;: &quot;Just browse to my website...&quot;,
  &quot;background_page&quot;: &quot;background.html&quot;,
  &quot;browser_action&quot;: {
    &quot;default_icon&quot;: &quot;icon.png&quot;,
    &quot;default_title&quot;: &quot;My website&quot;
  },
  &quot;permissions&quot;: [&quot;tabs&quot;]
}
</pre>
<p>4. Now edit the background.html file:</p>
<pre class="brush: plain; title: ;">
&lt; html&gt;
&lt; head&gt;
	&lt; script&gt;
	chrome.browserAction.onClicked.addListener(function(tab) {
		var createData = {
			url: &quot;http://www.ladysign-apps.com&quot;
		}
		//you can also specify a callback after page load...
		chrome.tabs.create(createData);
                //or to load a new window:
		//chrome.windows.create(createData);
	});
&lt; /script&gt;
&lt; /head&gt;
&lt; body&gt;
&lt; /body&gt;
&lt; /html&gt;
</pre>
<p>From the background.html you can include any other file you want to include in this package.</p>
<p>5. Now open Chrome.<br />
6. Open de extension tab: (Chrome Dev icon) > Extra / Tools > Extensions<br />
7. Click the load button, and point to your folder, to test extension.<br />
You will see the extension is added next to your addressbar.</p>
<p>Works?<br />
8. Now pack it: &#8211; Press the pack button; and point to your folder again.<br />
Chrome will now create a plugin of it; with an *.crx in the filename.<br />
It will also create *.pem key file, so it identifies your plugin for further updates&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ladysign-apps.com/blog/code/browsers/create-chome-extension/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery does not load 3G iphone safari</title>
		<link>http://www.ladysign-apps.com/blog/code/javascript/jquery-does-not-load-3g-iphone-safari/</link>
		<comments>http://www.ladysign-apps.com/blog/code/javascript/jquery-does-not-load-3g-iphone-safari/#comments</comments>
		<pubDate>Wed, 17 Aug 2011 09:25:39 +0000</pubDate>
		<dc:creator>Lee</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[3G]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[jquery mobile]]></category>
		<category><![CDATA[O2]]></category>
		<category><![CDATA[parse errors]]></category>
		<category><![CDATA[safari]]></category>
		<category><![CDATA[t-mobile]]></category>

		<guid isPermaLink="false">http://www.ladysign-apps.com/blog/?p=1017</guid>
		<description><![CDATA[<p><strong>Difficulty:</strong> 3 out of 5 stars</p>
<p>Today I found out a very strange thing&#8230; My jQuery Mobile website doesn&#8217;t work on iPhone Safari in 3G mode. In[......]</p><p class='read-more'><a href='http://www.ladysign-apps.com/blog/code/javascript/jquery-does-not-load-3g-iphone-safari/'>继续阅读</a></p>]]></description>
			<content:encoded><![CDATA[<p><strong>Difficulty:</strong> 3 out of 5 stars</p>
<p>Today I found out a very strange thing&#8230; My jQuery Mobile website doesn&#8217;t work on iPhone Safari in 3G mode. In WIFI mode my page is fully loaded, and jQuery Mobile works fine.<br />
I enabled debug messages on my iPhone. And then I found out that jquery.min.js gives me parse errors.</p>
<p><strong>Parse errors jQuery.min.js</strong><br />
From jQuery 1.5 and higher..  You&#8217;ll receive parse errors in jQuery and therefore also jQuery Mobile can not be loaded. &#8211; And probably also not the other scripts that use jQuery.</p>
<pre class="brush: jscript; title: ;">
javascript parse error line 3.
Can't find variable jQuery.
</pre>
<p>The problem seems to be with the mobile carrier&#8217;s transparent proxy. In this case T-Mobile / O2.<br />
I tethered my phone so that I could browse on 3G and the file downloaded is completely different from that downloaded through my wired connection. Also, the downloaded files MD5 sums didn&#8217;t match!</p>
<p>Check this:<br />
3G:</p>
<pre class="brush: jscript; title: ;">
H TTP/1.1 200 OK
C ontent-Encoding: gzip
S erver: Apache/2.2.9 (Unix) PHP/5.2.6
E tag: &quot;360ce-164ce-4a4b742e336c0&quot;
A ccept-Ranges: bytes
C ontent-Type: application/javascript
A ge: 1317
D ate: Thu, 16 Jun 2011 14:56:25 GMT
L ast-Modified: Thu, 02 Jun 2011 09:28:35 GMT
E xpires: Fri, 17 Jun 2011 14:56:25 GMT
T ransfer-Encoding: chunked
</pre>
<p>Wired:</p>
<pre class="brush: jscript; title: ;">
H TTP/1.1 200 OK
D ate: Thu, 16 Jun 2011 15:29:06 GMT
S erver: Apache/2.2.9 (Unix) PHP/5.2.6
L ast-Modified: Thu, 02 Jun 2011 09:28:35 GMT
E tag: &quot;360ce-164ce-4a4b742e336c0&quot;
A ccept-Ranges: bytes
C ontent-Length: 91342
K eep-Alive: timeout=5, max=100
C onnection: Keep-Alive
C ontent-Type: application/javascript
</pre>
<p><strong>How to solve?</strong><br />
Don&#8217;t serve your jQuery file yourself but use a CDN like google:<br />
<strong>http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js</strong></p>
<p>This did the trick!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ladysign-apps.com/blog/code/javascript/jquery-does-not-load-3g-iphone-safari/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Google Visualization API with Typo3 &amp; FF3.6</title>
		<link>http://www.ladysign-apps.com/blog/code/javascript/google-visualization-api-with-typo3-ff3-6/</link>
		<comments>http://www.ladysign-apps.com/blog/code/javascript/google-visualization-api-with-typo3-ff3-6/#comments</comments>
		<pubDate>Wed, 08 Jun 2011 12:22:03 +0000</pubDate>
		<dc:creator>Lee</dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[base href]]></category>
		<category><![CDATA[google chart]]></category>
		<category><![CDATA[google visualization]]></category>
		<category><![CDATA[Mootools]]></category>
		<category><![CDATA[typo3]]></category>

		<guid isPermaLink="false">http://www.ladysign-apps.com/blog/?p=1011</guid>
		<description><![CDATA[<p><strong>Difficulty:</strong> 4 out of 5 stars</p>
<p>I noticed this bug: my Google Visualization Charts were not working in FF3.6<br />
Strange enough it did work in all of the oth[......]</p><p class='read-more'><a href='http://www.ladysign-apps.com/blog/code/javascript/google-visualization-api-with-typo3-ff3-6/'>继续阅读</a></p>]]></description>
			<content:encoded><![CDATA[<p><strong>Difficulty:</strong> 4 out of 5 stars</p>
<p>I noticed this bug: my Google Visualization Charts were not working in FF3.6<br />
Strange enough it did work in all of the other browsers I tested (Chrome, FF4, IE7, IE8); deeping this problem down, I found out that Google Visualization Charts do work in FF3.6, but not when loaded from Typo3 CMS.<br />
Then I noticed that this bitch made the bug:</p>
<p><base href="path"> &#8211; Typo3 is setting a base path. The reason why Google Visualization API is buggy, is because they use relative paths.</p>
<p>Here&#8217;s the fix for Mootools:</p>
<pre class="brush: jscript; title: ;">
      google.setOnLoadCallback(drawChart);

		/**
		 * Google Visualization API crashes because of base href tag in TYPO3
		 * Quickfix
		 */
		function fixGoogleCharts(){
			var arrIframe = $(document.body).getElements('iframe[id*=Drawing_Frame_]');
		    arrIframe.each(function(el){
				var content = $(el).contentWindow.document.body;
				var arrG = ($(content).getElementsByTagName('g'));

				for(var i = 0; i&lt;arrG.length; i++){
					if(arrG[i].getAttribute('clip-path')) {
						arrG[i].setAttribute('clip-path', 'url(' + document.location + arrG[i].getAttribute('clip-path').substring(4))
					}
				}

		    });
		}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.ladysign-apps.com/blog/code/javascript/google-visualization-api-with-typo3-ff3-6/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

