<?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>QuintusQuill - Console</title>
	<atom:link href="http://quintusquill.com/console/feed/" rel="self" type="application/rss+xml" />
	<link>http://quintusquill.com/console</link>
	<description></description>
	<lastBuildDate>Sat, 31 Oct 2009 05:11:57 +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>Apple Design Awards 2009 Winners</title>
		<link>http://quintusquill.com/console/2009/06/apple-design-awards-2009-winners/</link>
		<comments>http://quintusquill.com/console/2009/06/apple-design-awards-2009-winners/#comments</comments>
		<pubDate>Wed, 10 Jun 2009 08:17:08 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Apple Design Awards]]></category>
		<category><![CDATA[WWDC]]></category>

		<guid isPermaLink="false">http://quintusquill.com/console/?p=60</guid>
		<description><![CDATA[The winners of the Apple Design Awards 2009 have been announced. To my excitement, two applications whose UI, design, and functionality I love were among the winners: Things and Versions.
While I haven&#8217;t bought the desktop version of Things yet (it&#8217;s a bit too pricey), I have bought the iPhone version and it is beautiful! I [...]]]></description>
			<content:encoded><![CDATA[<p>The winners of the <a href="http://developer.apple.com/wwdc/ada/">Apple Design Awards 2009</a> have been announced. To my excitement, two applications whose UI, design, and functionality I love were among the winners: <a href="http://culturedcode.com/things">Things</a> and <a href="http://www.versionsapp.com/">Versions</a>.<span id="more-60"></span><br />
While I haven&#8217;t bought the desktop version of Things yet (it&#8217;s a bit too pricey), I have bought the <a href="http://culturedcode.com/things/iphone/">iPhone version</a> and it is <em>beautiful</em>! I am very fussy with the user experience of iPhone apps (in fact, all applications), and there is not a single thing I can complain about with the iPhone version of Things.</p>
<p>When Versions came out of beta, I, like many, had to decide which Subversion GUI I was going to use: <a href="http://www.versionsapp.com/">Versions</a> or <a href="http://www.zennaware.com/cornerstone/">Cornerstone</a>? After testing the two, I chose the former because its icons were beautiful and because, as well as being functional, the whole application felt lightweight. Everything—the user interface, the user experience, and the functionality—was beautifully crafted.</p>
<p>So, congratulations to these two, and to all the ADA winners!</p>
]]></content:encoded>
			<wfw:commentRss>http://quintusquill.com/console/2009/06/apple-design-awards-2009-winners/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>10 useful iPhone tips &amp; tricks</title>
		<link>http://quintusquill.com/console/2009/05/10-useful-iphone-tips-tricks/</link>
		<comments>http://quintusquill.com/console/2009/05/10-useful-iphone-tips-tricks/#comments</comments>
		<pubDate>Fri, 22 May 2009 22:42:02 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[iPod Touch]]></category>
		<category><![CDATA[Shortcuts]]></category>
		<category><![CDATA[Tips & Tricks]]></category>

		<guid isPermaLink="false">http://quintusquill.com/console/?p=58</guid>
		<description><![CDATA[While browsing through the Tap Tap Tap blog, I found a great article on 10 useful iPhone tips &#038; tricks. Many of the shortcuts I already knew about, but there were several new ones that I found quite useful!
]]></description>
			<content:encoded><![CDATA[<p>While browsing through the <a href="http://www.taptaptap.com/">Tap Tap Tap</a> blog, I found a great article on <a href="http://www.taptaptap.com/blog/10-useful-iphone-tips-and-tricks/">10 useful iPhone tips &#038; tricks</a>. Many of the shortcuts I already knew about, but there were several new ones that I found quite useful!</p>
]]></content:encoded>
			<wfw:commentRss>http://quintusquill.com/console/2009/05/10-useful-iphone-tips-tricks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>1234567890!</title>
		<link>http://quintusquill.com/console/2009/02/1234567890/</link>
		<comments>http://quintusquill.com/console/2009/02/1234567890/#comments</comments>
		<pubDate>Fri, 13 Feb 2009 23:48:58 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://quintusquill.com/console/?p=56</guid>
		<description><![CDATA[We just passed 1234567890 seconds since 1 January 1970!

]]></description>
			<content:encoded><![CDATA[<p>We just passed 1234567890 seconds since 1 January 1970!</p>
<p><img src="http://quintusquill.com/console/wp-content/uploads/Time-1234567890.png" alt="" /></p>
]]></content:encoded>
			<wfw:commentRss>http://quintusquill.com/console/2009/02/1234567890/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WebKit Reaches r40000</title>
		<link>http://quintusquill.com/console/2009/01/webkit-reaches-r40000/</link>
		<comments>http://quintusquill.com/console/2009/01/webkit-reaches-r40000/#comments</comments>
		<pubDate>Sun, 18 Jan 2009 21:06:54 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[WebKit]]></category>

		<guid isPermaLink="false">http://quintusquill.com/console/?p=54</guid>
		<description><![CDATA[Just a quick note: WebKit has reached revision 40000!

]]></description>
			<content:encoded><![CDATA[<p>Just a quick note: WebKit has reached revision 40000!</p>
<p><img src="http://quintusquill.com/console/wp-content/uploads/webkit-reaches-r40000.png" alt="" /></p>
]]></content:encoded>
			<wfw:commentRss>http://quintusquill.com/console/2009/01/webkit-reaches-r40000/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting Weird Results from parseInt?</title>
		<link>http://quintusquill.com/console/2009/01/getting-weird-results-from-parseint/</link>
		<comments>http://quintusquill.com/console/2009/01/getting-weird-results-from-parseint/#comments</comments>
		<pubDate>Mon, 12 Jan 2009 23:17:48 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://quintusquill.com/console/?p=52</guid>
		<description><![CDATA[If you pass parseInt a number with a zero in front of it, such as &#8220;020&#8243;, without specifying a radix, you may get funny results&#8230;


parseInt("020");	// Result: 16

This is because when the input string begins with &#8220;0&#8243;, parseInt assumes the radix is 8 (octal), and converts the string to an octal number. Perhaps it&#8217;s just me, [...]]]></description>
			<content:encoded><![CDATA[<p>If you pass <code>parseInt</code> a number with a zero in front of it, such as &#8220;020&#8243;, without specifying a radix, you may get funny results&#8230;</p>
<p><span id="more-52"></span></p>
<pre>
parseInt("020");	// Result: 16
</pre>
<p>This is because when the input string begins with &#8220;0&#8243;, <code>parseInt</code> assumes the radix is 8 (octal), and converts the string to an octal number. Perhaps it&#8217;s just me, but I don&#8217;t usually work in octals!</p>
<p>You can avoid this problem by supplying it with the radix that you want to use.</p>
<pre>
parseInt("020", 10);	// Result: 20
</pre>
<p>For more information, I recommend that you read the <a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Functions/parseInt#Description">parseInt</a> page at the Mozilla Developer Centre.</p>
]]></content:encoded>
			<wfw:commentRss>http://quintusquill.com/console/2009/01/getting-weird-results-from-parseint/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting the Path to a User&#8217;s Home Directory in a Dashboard Widget</title>
		<link>http://quintusquill.com/console/2009/01/getting-the-path-to-a-users-home-directory-in-a-dashboard-widget/</link>
		<comments>http://quintusquill.com/console/2009/01/getting-the-path-to-a-users-home-directory-in-a-dashboard-widget/#comments</comments>
		<pubDate>Sun, 11 Jan 2009 09:44:38 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Dashboard]]></category>
		<category><![CDATA[Terminal]]></category>

		<guid isPermaLink="false">http://quintusquill.com/console/?p=50</guid>
		<description><![CDATA[There may be times when you want to get the path to a user&#8217;s home directory in your Dashboard widget. If, like normal, the widget is located in the user&#8217;s local Widgets directory (~/Library/Widgets/), we could extract the path from window.location.href. However, this approach is pretty limited, because it requires the widget to be located [...]]]></description>
			<content:encoded><![CDATA[<p>There may be times when you want to get the path to a user&#8217;s home directory in your Dashboard widget. If, like normal, the widget is located in the user&#8217;s local Widgets directory (<code>~/Library/Widgets/</code>), we could extract the path from <code>window.location.href</code>. However, this approach is pretty limited, because it requires the widget to be located somewhere in the user&#8217;s home directory. What if, for some reason, the user moves our widget into the main Widgets directory (<code>/Library/Widgets/</code>)? This is unlikely, but it is possible. Also, this approach won&#8217;t work when we run the widget in Dashcode, because Dashcode temporarily stores the widget in a system folder that isn&#8217;t located in the user&#8217;s home directory.</p>
<p>Luckily, there&#8217;s a solution&#8230;</p>
<p><span id="more-50"></span></p>
<p>The following Terminal command will give us the path to the user&#8217;s home directory:</p>
<pre>
echo ~
</pre>
<p>For example, in my user area, this command returns:</p>
<pre>
/Users/steve
</pre>
<p>So, to get the path from within our Dashboard widget, we wrap up the Terminal command in a <code>widget.system</code> call:</p>
<pre>
widget.system("/bin/echo ~", function() {

	var output = this.outputString;

	// Output includes a line break that we have to remove
	var pathToHome = output.replace("\n", "");

};
</pre>
<p>Using this approach, we will be able to accurately determine the path to the user&#8217;s home directory, regardless of the location of the widget.</p>
]]></content:encoded>
			<wfw:commentRss>http://quintusquill.com/console/2009/01/getting-the-path-to-a-users-home-directory-in-a-dashboard-widget/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Clearing Dashcode&#8217;s Image Cache</title>
		<link>http://quintusquill.com/console/2009/01/clearing-dashcodes-image-cache/</link>
		<comments>http://quintusquill.com/console/2009/01/clearing-dashcodes-image-cache/#comments</comments>
		<pubDate>Tue, 06 Jan 2009 03:00:31 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://quintusquill.com/console/?p=48</guid>
		<description><![CDATA[If you&#8217;re working with images a lot in your dashboard widget, you may notice that Dashcode caches them between runs. This is not very kind of Dashcode because this doesn&#8217;t happen in Dashboard itself, and since our widget is destined for the Dashboard, we want to know how it will perform there.

Luckily, there is a [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re working with images a lot in your dashboard widget, you may notice that Dashcode caches them between runs. This is not very kind of Dashcode because this doesn&#8217;t happen in Dashboard itself, and since our widget is destined for the Dashboard, we want to know how it will perform <em>there</em>.</p>
<p><span id="more-48"></span>
<p>Luckily, there is a solution! While it is running in Dashcode, refresh the widget (Command-R—with the widget in focus, of course). Not only does this perform the way it does in Dashboard, but it also happens to clear Dashcode&#8217;s annoying cache&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://quintusquill.com/console/2009/01/clearing-dashcodes-image-cache/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dashcode Evaluator Shortcut</title>
		<link>http://quintusquill.com/console/2009/01/dashcode-evaluator-shortcut/</link>
		<comments>http://quintusquill.com/console/2009/01/dashcode-evaluator-shortcut/#comments</comments>
		<pubDate>Mon, 05 Jan 2009 02:24:19 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://quintusquill.com/console/?p=46</guid>
		<description><![CDATA[I just noticed that Dashcode&#8217;s evaluator has a Terminal-like shortcut. By pressing the up-arrow key, you can insert a previous statement that you entered.You can choose which statement you want by pressing the up/down-arrow keys to go back/forward (respectively). When you want to repeatedly execute the same command, this saves a lot of typing!

]]></description>
			<content:encoded><![CDATA[<p>I just noticed that Dashcode&#8217;s evaluator has a Terminal-like shortcut. By pressing the up-arrow key, you can insert a previous statement that you entered.<span id="more-46"></span>You can choose which statement you want by pressing the up/down-arrow keys to go back/forward (respectively). When you want to repeatedly execute the same command, this saves a lot of typing!</p>
<p><img src="http://quintusquill.com/console/wp-content/uploads/dashcode-evaluator-shortcut.png" alt="dashcode-evaluator-shortcut.png" /></p>
]]></content:encoded>
			<wfw:commentRss>http://quintusquill.com/console/2009/01/dashcode-evaluator-shortcut/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Espresso Public Beta 1 Released</title>
		<link>http://quintusquill.com/console/2008/12/espresso-public-beta-1-released/</link>
		<comments>http://quintusquill.com/console/2008/12/espresso-public-beta-1-released/#comments</comments>
		<pubDate>Tue, 30 Dec 2008 06:42:12 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://quintusquill.com/console/?p=44</guid>
		<description><![CDATA[After a long wait, the first public beta of MacRabbit&#8217;s new application &#8220;Espresso&#8221; has been released! You can download it from the Espresso webpage. (I had to reload the page to see the download link, as Safari had the old version in its cache.)
]]></description>
			<content:encoded><![CDATA[<p>After a long wait, the first public beta of <a href="http://macrabbit.com/">MacRabbit</a>&#8217;s new application &#8220;Espresso&#8221; has been released! You can download it from the <a href="http://macrabbit.com/espresso/">Espresso webpage</a>. (I had to reload the page to see the download link, as Safari had the old version in its cache.)</p>
]]></content:encoded>
			<wfw:commentRss>http://quintusquill.com/console/2008/12/espresso-public-beta-1-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Redirecting Users from Site Root</title>
		<link>http://quintusquill.com/console/2008/12/redirecting-users-from-site-root/</link>
		<comments>http://quintusquill.com/console/2008/12/redirecting-users-from-site-root/#comments</comments>
		<pubDate>Tue, 23 Dec 2008 09:30:02 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[.htaccess]]></category>

		<guid isPermaLink="false">http://quintusquill.com/console/?p=42</guid>
		<description><![CDATA[I recently decided that since I didn&#8217;t currently have much on my home page (which resides at the root level of my site), it would be better to redirect users to the Console page until I had more to put on my home page. Here&#8217;s a mini-tutorial on how to redirect visitors from the root [...]]]></description>
			<content:encoded><![CDATA[<p>I recently decided that since I didn&#8217;t currently have much on my home page (which resides at the root level of my site), it would be better to redirect users to the Console page until I had more to put on my home page. Here&#8217;s a mini-tutorial on how to redirect visitors from the root of your site to another page of your choice.</p>
<p><span id="more-42"></span></p>
<p>There&#8217;s only one step! Insert the following rule into your <code>.htaccess</code> Apache file:</p>
<pre>
# This will only redirect a request that begins and ends with a slash (i.e. a request to the root)
RedirectMatch ^/$ <em>[Path or URL to redirect users to]</em></pre>
<p>Obviously you replace <code><em>[Path or URL to redirect users to]</em></code> with the actual path/URL to which you want to redirect users. For example, to redirect users to the Console section on my site, I&#8217;d write either:</p>
<pre>
# Using a URL
RedirectMatch ^/$ http://quintusquill.com/console/
</pre>
<p>&#8230;or:</p>
<pre>
# Using a Path
RedirectMatch ^/$ /console/
</pre>
<p>The reason why we use the <code>RedirectMatch</code> command instead of the regular <code>Redirect</code> command is that if we write, for example:</p>
<pre>Redirect / http://quintusquill.com/console/</pre>
<p>&#8230;it redirects <em>all</em> requests to http://quintusquill.com/console/—not just those going to the root. So if the user requests, say, http://quintusquill.com/about/, they will be redirected to http://quintusquill.com/console/about/ (not what we want!).</p>
<p>Thankfully, using the <code>RedirectMatch</code> command, we are able (by using a regular expression) to only redirect requests to the site root.</p>
]]></content:encoded>
			<wfw:commentRss>http://quintusquill.com/console/2008/12/redirecting-users-from-site-root/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OS X Web Sharing &#8211; It helps to have Apache running</title>
		<link>http://quintusquill.com/console/2008/11/os-x-web-sharing-it-helps-to-have-apache-running/</link>
		<comments>http://quintusquill.com/console/2008/11/os-x-web-sharing-it-helps-to-have-apache-running/#comments</comments>
		<pubDate>Sat, 08 Nov 2008 06:55:50 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://quintusquill.com/console/?p=40</guid>
		<description><![CDATA[I recently wanted to use Mac OS X Personal Web Sharing on my computer (to test webpages on my iPod Touch across the local network). I hadn&#8217;t used Web Sharing for a long time, as I use MAMP for most of my local-web-server-testing needs these days. Unfortunately, getting Web Sharing running wasn&#8217;t to be just [...]]]></description>
			<content:encoded><![CDATA[<p>I recently wanted to use Mac OS X Personal Web Sharing on my computer (to test webpages on my iPod Touch across the local network). I hadn&#8217;t used Web Sharing for a long time, as I use <a href="http://www.mamp.info/en/mamp.html">MAMP</a> for most of my local-web-server-testing needs these days. Unfortunately, getting Web Sharing running wasn&#8217;t to be just one-click away&#8230;</p>
<p><span id="more-40"></span></p>
<p>After enabling &#8220;Web Sharing&#8221; in System Preferences, I opened the URL for &#8220;Your computer&#8217;s website&#8221; in Safari and received a &#8220;Safari can’t find the server&#8221; message.</p>
<p>After a bit of troubleshooting, the <code>httpd.conf</code> file certainly wasn&#8217;t the culprit—it was exactly the same as the <code>httpd.conf</code> file on another Mac where Web Sharing worked successfully.</p>
<p>It was Console (<code>/Applications/Utilites/Console.app</code>) that identified the problem. Among several Apache error messages was the following:</p>
<pre class="wrap">(2)No such file or directory: httpd: could not open error log file /private/var/log/apache2/error_log. Unable to open logs.</pre>
<p>For some reason, the <code>apache2</code> folder was missing in <code>/private/var/log/</code>, and as a result, the Apache web server never started. Safari couldn&#8217;t access the page because the web server wasn&#8217;t running!</p>
<p>The solution was to simply create the folder <code>apache2</code> in <code>/private/var/log/</code>.</p>
]]></content:encoded>
			<wfw:commentRss>http://quintusquill.com/console/2008/11/os-x-web-sharing-it-helps-to-have-apache-running/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Testing for the Existence of Remote Files</title>
		<link>http://quintusquill.com/console/2008/10/testing-for-the-existence-of-remote-files/</link>
		<comments>http://quintusquill.com/console/2008/10/testing-for-the-existence-of-remote-files/#comments</comments>
		<pubDate>Tue, 21 Oct 2008 06:55:31 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://quintusquill.com/console/?p=38</guid>
		<description><![CDATA[There are plenty of cases where you might want to check whether a remote file (a text document or an image) exists. We can do this using a HEAD XMLHttpRequest.
Set up your XMLHttpRequest like normal:
var request = new XMLHttpRequest();

request.onreadystatechange = function()
{
 if (request.readyState == 4) {
  if (request.status == 200) {
   [Code [...]]]></description>
			<content:encoded><![CDATA[<p>There are plenty of cases where you might want to check whether a remote file (a text document or an image) exists. We can do this using a HEAD XMLHttpRequest.</p>
<p>Set up your XMLHttpRequest like normal:</p>
<pre>var request = new XMLHttpRequest();

request.onreadystatechange = function()
{
 if (request.readyState == 4) {
  if (request.status == 200) {
   [Code to Execute if File Exists...]
  }
  else {
   [Code to Execute if File Doesn't Exist...]
  }
 }
}</pre>
<p>When you open it, however, replace &#8220;GET&#8221; with &#8220;HEAD&#8221; (<code>url</code> is the URL of your file):</p>
<pre>request.open("HEAD", url, true);</pre>
<p>Finally, send it like normal:</p>
<pre>request.send("");</pre>
<p>This is very good way to quickly determine if an image exists—it&#8217;s much faster than creating a new <code>Image</code> object, assigning it a <code>src</code>, then setting up <code>onload</code> and <code>onerror</code> handlers.</p>
<p>If you are going to need to test for files often, I&#8217;d recommend that you put the code into a function:</p>
<pre>function testFile(url)
{
 // Setup options
 var options = arguments[1];
 if (!options) { options = {}; }

 // Create the request

 var request = new XMLHttpRequest();

 request.onreadystatechange = function()
 {
  if (request.readyState == 4) {
   if (request.status == 200) {
    // File Exists
    if (options.onSuccess) { options.onSuccess(); }
   }
   else {
    // File Doesn't Exist
    if (options.onFailure) { options.onFailure(); }
   }
  }
 }

 request.open("HEAD", url, true);
 request.send("");
}</pre>
<p>Then you can call it like this:</p>
<pre>testFile("<a style="text-decoration: none;" href="http://quintusquill.com/anImage.jpg">http://quintusquill.com/anImage.jpg</a>", {
 onSuccess: function() {
  alert("File Exists!");
 },
 onFailure: function() {
  alert("File Doesn't Exist!");
 }
});</pre>
<p>Since we&#8217;ve set up the function to use &#8220;options&#8221; (see <a style="text-decoration: none;" href="http://quintusquill.com/console/feed/INSERT%20LINK%20HERE!">here</a> for more on options), you don&#8217;t have to provide either the <code>onSuccess</code> or <code>onFailure</code> callbacks (however, you won&#8217;t get any answer if you don&#8217;t specify at least one of them).</p>
]]></content:encoded>
			<wfw:commentRss>http://quintusquill.com/console/2008/10/testing-for-the-existence-of-remote-files/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Merging All Windows in Safari</title>
		<link>http://quintusquill.com/console/2008/10/merging-all-windows-in-safari/</link>
		<comments>http://quintusquill.com/console/2008/10/merging-all-windows-in-safari/#comments</comments>
		<pubDate>Tue, 21 Oct 2008 05:56:18 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://quintusquill.com/console/?p=5</guid>
		<description><![CDATA[A handy feature in Safari which you may not know about is Window &#62; Merge All Windows. As the command name suggests, this command merges all the windows and tabs that are currently open in Safari into tabs in a single window.

Since I often control-click on a link in an interesting post while browsing my [...]]]></description>
			<content:encoded><![CDATA[<p>A handy feature in Safari which you may not know about is <em style="font-weight: bold;">Window &gt; Merge All Windows</em>. As the command name suggests, this command merges all the windows and tabs that are currently open in Safari into tabs in a single window.</p>
<p><span id="more-5"></span></p>
<p>Since I often control-click on a link in an interesting post while browsing my RSS feeds in Mail and choose <em style="font-weight: bold;">Open Link behind Mail</em>, I end up getting lots of windows open in Safari once I&#8217;ve finished reading my RSS feeds.</p>
<p>And so, the ability to merge all windows into tabs quickly and conveniently becomes a very important and useful one indeed!</p>
]]></content:encoded>
			<wfw:commentRss>http://quintusquill.com/console/2008/10/merging-all-windows-in-safari/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Introducing Dazzle</title>
		<link>http://quintusquill.com/console/2008/09/introducing-dazzle/</link>
		<comments>http://quintusquill.com/console/2008/09/introducing-dazzle/#comments</comments>
		<pubDate>Mon, 29 Sep 2008 22:47:11 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://quintusquill.com/console/?p=35</guid>
		<description><![CDATA[I&#8217;ve finally released &#8220;Dazzle&#8221;, a &#8220;check for updates&#8221; JavaScript framework for Dashboard widgets. It was inspired by Andy Matuschak&#8217;s Sparkle framework for Cocoa applications.
Dazzle uses appcasts to determine if a new update is available, and if there is, displays an alert box to the user, telling them that a new version is available and giving them [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve finally released &#8220;Dazzle&#8221;, a &#8220;check for updates&#8221; JavaScript framework for Dashboard widgets. It was inspired by Andy Matuschak&#8217;s <a style="text-decoration: none;" href="http://sparkle.andymatuschak.org/">Sparkle</a> framework for Cocoa applications.</p>
<p>Dazzle uses appcasts to determine if a new update is available, and if there is, displays an alert box to the user, telling them that a new version is available and giving them the option to download the update or dismiss the alert box. Dazzle currently uses Safari to download and install the update, and so, by default, opens the URL in Safari regardless of the user&#8217;s default browser (you can change this, however).</p>
<p>Dazzle also can display a link to the release notes for the widget in the alert box, although the link is hidden by default.</p>
<p>I&#8217;ve tried to make Dazzle customisable, so that you can tweak Dazzle&#8217;s behaviour without actually modifying the Dazzle code.</p>
<p>There are instructions on the Dazzle main page on how to get it working in your widget. There is also a &#8220;Guide&#8221; page to show you Dazzle&#8217;s features (and how to use them), and a &#8220;Reference&#8221; page, which lists all of Dazzle&#8217;s methods/options with a brief description of each.</p>
<ul>
<li><a style="text-decoration: none;" href="http://quintusquill.com/code/dazzle/">Dazzle Main Page</a></li>
<li><a style="text-decoration: none;" href="http://quintusquill.com/code/dazzle/guide/">Dazzle Guide</a></li>
<li><a style="text-decoration: none;" href="http://quintusquill.com/code/dazzle/reference/">Dazzle Reference</a></li>
</ul>
<p>Finally, here&#8217;s a screenshot of the demo widget included with Dazzle, &#8220;DazzleDemo&#8221;:</p>
<p><img src="http://quintusquill.com/console/wp-content/uploads/DazzleDemo.jpg" alt="DazzleDemo Screenshot" /></p>
]]></content:encoded>
			<wfw:commentRss>http://quintusquill.com/console/2008/09/introducing-dazzle/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Determining OS Version in Dashboard Widgets</title>
		<link>http://quintusquill.com/console/2008/09/determining-os-version-in-dashboard-widgets/</link>
		<comments>http://quintusquill.com/console/2008/09/determining-os-version-in-dashboard-widgets/#comments</comments>
		<pubDate>Sat, 20 Sep 2008 02:21:31 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://quintusquill.com/console/?p=33</guid>
		<description><![CDATA[There are various times when you might want to know the version of the user&#8217;s operating system when performing some operation in your Dashboard Widget. While you can find it using AppleScript, there is a better way: the sw_vers Terminal command (which is located in /usr/bin/).
This is the output of the command on my computer at the [...]]]></description>
			<content:encoded><![CDATA[<p>There are various times when you might want to know the version of the user&#8217;s operating system when performing some operation in your Dashboard Widget. While you can find it using AppleScript, there is a better way: the <code>sw_vers</code> Terminal command (which is located in <code>/usr/bin/</code>).</p>
<p>This is the output of the command on my computer at the time of writing:</p>
<pre>ProductName: Mac OS X
ProductVersion: 10.5.4
BuildVersion: 9E17</pre>
<p>Obviously, we need to extract the &#8220;10.5.4″ part.</p>
<p>I have done this by firstly extracting the &#8220;ProductVersion: 10.5.4″ part using a regular expression, and then deleting the &#8220;ProductVersion: &#8221; part.</p>
<p>The resulting code is as follows:</p>
<pre>widget.system("/usr/bin/sw_vers", function() {

 // Note that the "match" method returns an array.
 // The matched string, which is what we want,
 // is the first element in that array:

 var versionString = this.outputString.match(/ProductVersion:\t.*/)[0];

 // We delete the "ProductVersion: "
 // part by replacing it with nothing: 

 var version = versionString.replace("ProductVersion: ", "");
});</pre>
]]></content:encoded>
			<wfw:commentRss>http://quintusquill.com/console/2008/09/determining-os-version-in-dashboard-widgets/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Resizing Dashboard Widgets</title>
		<link>http://quintusquill.com/console/2008/09/resizing-dashboard-widgets/</link>
		<comments>http://quintusquill.com/console/2008/09/resizing-dashboard-widgets/#comments</comments>
		<pubDate>Mon, 08 Sep 2008 07:16:34 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://quintusquill.com/console/?p=31</guid>
		<description><![CDATA[Dashboard widgets have a certain width and height (often specified in your Info.plist file). If your widget content moves outside this region (such as it might during an animation), it will get clipped.
One way to solve this problem is to specify large width and height values in the Info.plist file. However, this results in a [...]]]></description>
			<content:encoded><![CDATA[<p>Dashboard widgets have a certain width and height (often specified in your Info.plist file). If your widget content moves outside this region (such as it might during an animation), it will get clipped.</p>
<p>One way to solve this problem is to specify large width and height values in the Info.plist file. However, this results in a gigantic ripple effect (much bigger than the widget itself) when the widget is launched—a bad user experience.</p>
<p>Luckily, there is a much better way to do this, which doesn’t involve hacks or a bad user experience:</p>
<pre>window.resizeTo(width, height);</pre>
<p>In your Info.plist file, set the width and height keys to the initial width and height of the widget. Whenever the size of your widget changes, call <code>window.resizeTo(width, height)</code>, passing in the new width and height values of your widget. Dashboard will then know the new dimensions of your widget and your content will not get clipped.</p>
<p>There is also a <code>window.resizeBy(width, height)</code> method, where the width and height values are <em>added</em> to the existing width and height values of the widget area.</p>
<p>Note that neither of these methods resize the <em>content</em> of your widget—you have to do this yourself.</p>
<p>Now for some examples:</p>
<pre>// Initial Width of Widget = 300; Initial Height of Widget = 200;

window.resizeTo(300, 300);

// Result: Width of Widget = 300; Height of Widget = 300;</pre>
<pre>// Initial Width of Widget = 300; Initial Height of Widget = 200;

window.resizeBy(300, 300);

// Result: Width of Widget = 600; Height of Widget = 500;</pre>
<p>Also, you can obtain the current width of the widget area using <code>window.innerWidth</code>, and the current height by using <code>window.innerHeight</code>:</p>
<pre>// Width of Widget = 300; Height of Widget = 200;

var w = window.innerWidth;
alert(w); // Result: 300

var h = window.innerHeight;
alert(h); // Result: 200</pre>
<p>You can read more about resizing dashboard widgets <a style="text-decoration: none;" href="http://developer.apple.com/documentation/AppleApplications/Conceptual/Dashboard_ProgTopics/Articles/Resizing.html">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://quintusquill.com/console/2008/09/resizing-dashboard-widgets/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Determining the Size of Enclosures</title>
		<link>http://quintusquill.com/console/2008/09/determining-the-size-of-enclosures/</link>
		<comments>http://quintusquill.com/console/2008/09/determining-the-size-of-enclosures/#comments</comments>
		<pubDate>Sun, 07 Sep 2008 20:34:31 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://quintusquill.com/console/?p=29</guid>
		<description><![CDATA[When you define an enclosure in an RSS feed, you have to specify a length attribute, which specifies the size in bytes of the file attached in the enclosure.
This is actually quite simple: the Finder’s “Get Info” window not only shows how many KB, MB, or GB the file takes up on disk, but also what [...]]]></description>
			<content:encoded><![CDATA[<p>When you define an enclosure in an RSS feed, you have to specify a <code>length</code> attribute, which specifies the size in bytes of the file attached in the enclosure.</p>
<p>This is actually quite simple: the Finder’s “Get Info” window not only shows how many KB, MB, or GB the file takes up on disk, but also what this is in bytes (this info can be found in “General”).</p>
<p><img src="http://quintusquill.com/console/wp-content/uploads/SafariGetInfo.png" alt="" /></p>
<p>Simply take out the commas, and there’s the enclosure’s <code>length</code>!</p>
]]></content:encoded>
			<wfw:commentRss>http://quintusquill.com/console/2008/09/determining-the-size-of-enclosures/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Removing Glow from Selected Text Field</title>
		<link>http://quintusquill.com/console/2008/09/removing-glow-from-selected-text-field/</link>
		<comments>http://quintusquill.com/console/2008/09/removing-glow-from-selected-text-field/#comments</comments>
		<pubDate>Wed, 03 Sep 2008 07:35:59 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://quintusquill.com/console/?p=26</guid>
		<description><![CDATA[In WebKit, whenever a text field or a search field is selected (focused), a blue glow is drawn around its perimeter. In some cases, it may be desirable to remove this glow. This is actually quite simple: set theoutline CSS property to none.
outline: none;
The above code results in:


Notice that when you select the text field, no [...]]]></description>
			<content:encoded><![CDATA[<p>In WebKit, whenever a text field or a search field is selected (focused), a blue glow is drawn around its perimeter. In some cases, it may be desirable to remove this glow. This is actually quite simple: set the<code>outline</code> CSS property to <code>none</code>.</p>
<pre>outline: none;</pre>
<p>The above code results in:</p>
<form>
<input type="text" /></form>
<p>Notice that when you select the text field, no blue glow appears around its perimeter (you’ll have to be using WebKit to see it correctly).</p>
<p>Of course, there are very few cases when you would want to do this (or to be more precise, <em>should</em> do this), but its always nice to know its possible…</p>
]]></content:encoded>
			<wfw:commentRss>http://quintusquill.com/console/2008/09/removing-glow-from-selected-text-field/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Introduction to Namespaces in XML</title>
		<link>http://quintusquill.com/console/2008/08/introduction-to-namespaces-in-xml/</link>
		<comments>http://quintusquill.com/console/2008/08/introduction-to-namespaces-in-xml/#comments</comments>
		<pubDate>Sat, 30 Aug 2008 01:04:35 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://quintusquill.com/console/?p=24</guid>
		<description><![CDATA[Namespaces were introduced in order to avoid conflicts with names of XML elements and attributes. For example, say you have a “table” element (thanks to W3Schools for this example). It could apply to either a piece of furniture or an HTML element used for displaying data. If, for some reason, these two pieces of code needed [...]]]></description>
			<content:encoded><![CDATA[<p>Namespaces were introduced in order to avoid conflicts with names of XML elements and attributes. For example, say you have a “table” element (thanks to W3Schools for this <a style="text-decoration: none;" href="http://www.w3schools.com/XML/xml_namespaces.asp">example</a>). It could apply to either a piece of furniture or an HTML element used for displaying data. If, for some reason, these two pieces of code needed to be combined, there would be a conflict. To avoid these conflicts and to give these elements unique identifiers, we use namespaces.</p>
<p>Throughout this post, I shall use custom (namespaced) RSS elements/attributes from the <a style="text-decoration: none;" href="http://sparkle.andymatuschak.org/">Sparkle</a> framework as examples.</p>
<h3>About Namespaces</h3>
<p>A namespaced element looks like this:</p>
<pre>&lt;sparkle:releaseNotesURL&gt;&lt;/sparkle:releaseNotesURL&gt;

// "sparkle" is the namespace and "releaseNotesURL" is the element name</pre>
<p>A namespaced attribute looks like this:</p>
<pre>&lt;enclosure sparkle:version="1.0" url="foo.zip" /&gt;

// "sparkle" is the namespace and "version" is the attribute name</pre>
<p>A URL must also be associated with the namespace. This is usually specified on the root element using the <code>xmlns</code> attribute:</p>
<pre>&lt;rss version="2.0" xmlns:sparkle="<a style="text-decoration: none;" href="http://www.andymatuschak.org/xml-namespaces/sparkle">http://www.andymatuschak.org/xml-namespaces/sparkle</a>"&gt;
 &lt;!-- Declaring the "sparkle" namespace on the "rss" element --&gt;
&lt;/rss&gt;</pre>
<p>The <code>xmlns</code> URL doesn’t have to be a real URL, as it’s just an identifier for the namespace, but people often use it to reference a page describing/documenting the namespace.</p>
<h3>Parsing Namespaces</h3>
<p>When parsing XML, you may have to parse a namespaced element or attribute.</p>
<p>At first, you might try to extract the <code>releaseNotesURL</code> element like this (where <code>response</code> is the response XML from an XMLHttpRequest):</p>
<pre>response.getElementsByTagName("sparkle:releaseNotesURL")[0];</pre>
<p>However, this doesn’t work. You have to use <code>getElementsByTagNameNS</code>:</p>
<pre>response.getElementsByTagNameNS("<a style="text-decoration: none;" href="http://www.andymatuschak.org/xml-namespaces/sparkle">http://www.andymatuschak.org/xml-namespaces/sparkle</a>", "releaseNotesURL")[0];</pre>
<p>Note here that <code>getElementsByTagNameNS</code> takes two parameters: the namespace URL and the actual element name.</p>
<p>The same applies to attributes. To extract the <code>version</code> attribute from an enclosure element (assuming that the variable <code>enclosure</code> has already been declared):</p>
<pre>enclosure.getAttributeNS("<a style="text-decoration: none;" href="http://www.andymatuschak.org/xml-namespaces/sparkle">http://www.andymatuschak.org/xml-namespaces/sparkle</a>", "version");</pre>
<p>An interesting thing to note is that the latest version of Safari supports</p>
<pre>enclosure.getAttribute("sparkle:version");</pre>
<p>…but it doesn’t support</p>
<pre>enclosure.getElementsByTagName("sparkle:releaseNotesURL");</pre>
<p>So, for now, it’s safest to always use the namespace methods…</p>
<p>That’s it for now!</p>
]]></content:encoded>
			<wfw:commentRss>http://quintusquill.com/console/2008/08/introduction-to-namespaces-in-xml/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating Functions with Optional Arguments in Javascript</title>
		<link>http://quintusquill.com/console/2008/08/creating-functions-with-optional-arguments-in-javascript/</link>
		<comments>http://quintusquill.com/console/2008/08/creating-functions-with-optional-arguments-in-javascript/#comments</comments>
		<pubDate>Sun, 03 Aug 2008 06:51:58 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://quintusquill.com/console/?p=16</guid>
		<description><![CDATA[In this post, I will show you how to create functions with optional arguments, or parameters, in Javascript. For example, in our demo function doSomething, the user can specify an “onComplete” function to call when finished “doing something”, but doesn’t have to specify one if is not needed.
First, we declare our function:
function doSomething()
{
 // Code to [...]]]></description>
			<content:encoded><![CDATA[<p>In this post, I will show you how to create functions with optional arguments, or parameters, in Javascript. For example, in our demo function <code>doSomething</code>, the user can specify an “onComplete” function to call when finished “doing something”, but doesn’t have to specify one if is not needed.</p>
<p>First, we declare our function:</p>
<pre>function doSomething()
{
 // Code to do something...
}</pre>
<p>Note that we do <strong>not</strong> include the “onComplete” argument in the function declaration. If we did this, then the user would be required to supply a value for the “onComplete” argument (and if they didn’t, there would be an error).</p>
<p>Javascript has an “arguments” array for each function, containing (logically) all the arguments passed in by the user. We can use this to implement optional arguments, as long as we know the order of the optional arguments (in this case, we don’t have to worry, since there is only one optional argument):</p>
<pre>if (arguments.length &gt; 0) {
 var onCompleteFunction = arguments[0];
}</pre>
<p>Here, we check to see if the arguments array contains anything, and if there is, get the first item (which will be the “onComplete” function) and assign it to a variable named “onCompleteFunction”.</p>
<p>When we’ve finished “doing something”, we can see whether there is an <code>onCompleteFunction</code> variable, and if so, call the function contained by the variable:</p>
<pre>if (onCompleteFunction)
 onCompleteFunction();</pre>
<p>Note: Since the if statement only has one line of code, we can omit the opening and closing braces to make it as simple as possible.</p>
<p>And there it is! The final function should look similar this:</p>
<pre>function doSomething()
{
 if (arguments.length &gt; 0) {
  var onCompleteFunction = arguments[0];
 }

 // Code to do something…

 if (onCompleteFunction)
  onCompleteFunction();
}</pre>
<p>The user can then call it like this:</p>
<pre>doSomething();</pre>
<p>…or like this:</p>
<pre>doSomething(function() {
 alert("Done!");
});</pre>
<p>Either one of these is valid, and will not produce any errors.</p>
]]></content:encoded>
			<wfw:commentRss>http://quintusquill.com/console/2008/08/creating-functions-with-optional-arguments-in-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Interface Builder Easter Egg</title>
		<link>http://quintusquill.com/console/2008/07/interface-builder-easter-egg/</link>
		<comments>http://quintusquill.com/console/2008/07/interface-builder-easter-egg/#comments</comments>
		<pubDate>Sat, 19 Jul 2008 07:29:34 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://quintusquill.com/console/?p=14</guid>
		<description><![CDATA[If you add a new text view (NSTextView) to your Interface Builder project, it will have the following text:
Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea [...]]]></description>
			<content:encoded><![CDATA[<p>If you add a new text view (NSTextView) to your Interface Builder project, it will have the following text:</p>
<blockquote><p>Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum Et harumd und lookum like Greek to me, dereud facilis est er expedit distinct. Nam liber te conscient to factor tum poen legum odioque civiuda.</p></blockquote>
<p>OK, just typical Lorem Ipsum text—what’s so special about that? Look at the second last line…</p>
<blockquote><p>…Et harumd und lookum like Greek to me,</p></blockquote>
<p>Looks like someone had a bit of fun there!</p>
]]></content:encoded>
			<wfw:commentRss>http://quintusquill.com/console/2008/07/interface-builder-easter-egg/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Quick Look Now Supports CSS</title>
		<link>http://quintusquill.com/console/2008/07/quick-look-now-supports-css/</link>
		<comments>http://quintusquill.com/console/2008/07/quick-look-now-supports-css/#comments</comments>
		<pubDate>Fri, 18 Jul 2008 07:52:35 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://quintusquill.com/console/?p=12</guid>
		<description><![CDATA[Just a quick note: I finally installed the latest version of Apple’s Developer Tools (officially called “Xcode 3.1 Developer Tools”), and one of the things that I noticed after the installation is that I can finally view CSS (Cascading Style Sheet) files in Quick Look.
A subtle, but welcome, addition!
]]></description>
			<content:encoded><![CDATA[<p>Just a quick note: I finally installed the latest version of Apple’s Developer Tools (officially called “Xcode 3.1 Developer Tools”), and one of the things that I noticed after the installation is that I can finally view CSS (Cascading Style Sheet) files in Quick Look.</p>
<p>A subtle, but welcome, addition!</p>
]]></content:encoded>
			<wfw:commentRss>http://quintusquill.com/console/2008/07/quick-look-now-supports-css/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Create a Simple Timer in JavaScript</title>
		<link>http://quintusquill.com/console/2008/07/how-to-create-a-simple-timer-in-javascript/</link>
		<comments>http://quintusquill.com/console/2008/07/how-to-create-a-simple-timer-in-javascript/#comments</comments>
		<pubDate>Tue, 15 Jul 2008 09:43:47 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://quintusquill.com/console/?p=8</guid>
		<description><![CDATA[Since I’m going to release my QQTimer class soon, I thought it would be an appropriate time to write a little tutorial on how to create a simple timer in JavaScript.
The idea is simple: we record the current time when the user starts the timer, record the current time when the user stops the timer, [...]]]></description>
			<content:encoded><![CDATA[<p>Since I’m going to release my QQTimer class soon, I thought it would be an appropriate time to write a little tutorial on how to create a simple timer in JavaScript.</p>
<p>The idea is simple: we record the current time when the user starts the timer, record the current time when the user stops the timer, and then subtract the two to find out how much time has elapsed.</p>
<p>The trick is to get both numbers into a format on which we can perform standard mathematical calculations. The JavaScript method <code>getTime()</code> works well for this, as it returns the number of milliseconds since 1 January 1970.</p>
<p>First, we create our class “Timer”:</p>
<pre>function Timer() {}</pre>
<p>We’ll have have three instance variables:</p>
<ul>
<li><code>startTime</code> &#8211; This will store the time when we start the timer</li>
<li><code>stopTime</code> &#8211; This will store the time when we stop the timer</li>
<li><code>stopped</code> &#8211; This will store a boolean indicating whether the timer has been stopped or not</li>
</ul>
<p>Here’s what our completed object constructor function looks like:</p>
<pre>function Timer()
{
 this.startTime = 0;
 this.stopTime = 0;
 this.stopped = true;
}</pre>
<p>Now we’ll add three methods:</p>
<ul>
<li><code>start()</code> &#8211; This will start the timer</li>
<li><code>stop()</code> &#8211; This will stop the timer</li>
<li><code>getElapsedTime()</code> &#8211; If the timer has been stopped, then this will get the elapsed time between when the timer was started and when it was stopped; if the timer hasn’t been stopped yet, it will get the elapsed time since the timer was started</li>
<li><code>clear()</code> &#8211; This will reset all the values</li>
</ul>
<p>The <code>start</code> method will simply set <code>this.startTime</code> to the value of the <code>getTime()</code> method:</p>
<pre>Timer.prototype.start = function()
{
 var currentDate = new Date();
 this.startTime = currentDate.getTime();
}</pre>
<p>The <code>stop</code> method is almost identical to the <code>start</code> method, except that this time we set <code><em>this.stopTime</em></code> to the value of the <code>getTime()</code> method:</p>
<pre>Timer.prototype.stop = function()
{
 var currentDate = new Date();
 this.stopTime = currentDate.getTime();
}</pre>
<p>The <code>getElapsedTime</code> method will check whether the timer has been stopped or not, then return either the start time subtracted from the stop time, or the start time subtracted from the current time (respectively):</p>
<pre>Timer.prototype.getElapsedTime = function()
{
 if (this.stopped) {
  return (this.stopTime - this.startTime)
 }
 else {
  var currentDate = new Date();
  return (currentDate.getTime() - this.startTime)
 }
}</pre>
<p>Finally, the <code>clear:</code> method resets all our instance variables. It is exactly the same code as in the initialisation function:</p>
<pre>Timer.prototype.clear = function()
{
 this.startTime = 0;
 this.stopTime = 0;
 this.stopped = true;
}</pre>
<p>And that’s it. You’ve now created a simple timer class using JavaScript!</p>
]]></content:encoded>
			<wfw:commentRss>http://quintusquill.com/console/2008/07/how-to-create-a-simple-timer-in-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Making your Application Faceless</title>
		<link>http://quintusquill.com/console/2008/07/making-your-application-faceless/</link>
		<comments>http://quintusquill.com/console/2008/07/making-your-application-faceless/#comments</comments>
		<pubDate>Tue, 08 Jul 2008 06:34:29 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://quintusquill.com/console/?p=3</guid>
		<description><![CDATA[Have you ever wanted to make your application not appear in the dock and not display its own main menu bar?
For example, say you have an application which is to be accessed as a menu icon in the Status Bar (where you have the icons, or sometimes, text, for Airport, Volume, Date/Time, Spotlight etc.). This [...]]]></description>
			<content:encoded><![CDATA[<p>Have you ever wanted to make your application not appear in the dock and not display its own main menu bar?</p>
<p>For example, say you have an application which is to be accessed as a menu icon in the <a href="http://developer.apple.com/documentation/Cocoa/Conceptual/StatusBar/Concepts/aboutstatusbars.html#//apple_ref/doc/uid/20000995">Status Bar</a> (where you have the icons, or sometimes, text, for Airport, Volume, Date/Time, Spotlight etc.). This application only wants to be visible in the status bar &#8211; it doesn’t want to have its own main menu bar or appear in the dock.</p>
<p>Simply go into the Info.plist file in your Xcode project and add the following:</p>
<pre>
<key>LSUIElement</key>
<string>1</string>
</pre>
<p>Save, Build, and Run. Your application should display any windows it is supposed to show at startup, but now it will not appear in the dock or have its own menu bar.</p>
]]></content:encoded>
			<wfw:commentRss>http://quintusquill.com/console/2008/07/making-your-application-faceless/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hello World!</title>
		<link>http://quintusquill.com/console/2008/07/hello-world/</link>
		<comments>http://quintusquill.com/console/2008/07/hello-world/#comments</comments>
		<pubDate>Sat, 05 Jul 2008 22:41:07 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://quintusquill.com/console/?p=1</guid>
		<description><![CDATA[Website * quillWebsite = [[Website alloc] init];
or…
var quillWebsite = new Website();
Welcome to QuintusQuill!
]]></description>
			<content:encoded><![CDATA[<pre>Website * quillWebsite = [[Website alloc] init];</pre>
<p>or…</p>
<pre>var quillWebsite = new Website();</pre>
<p>Welcome to QuintusQuill!</p>
]]></content:encoded>
			<wfw:commentRss>http://quintusquill.com/console/2008/07/hello-world/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
