<?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/"
	 xmlns:slash="http://purl.org/rss/1.0/modules/slash/" 
>

<channel>
	<title>Daniel Bergey &#187; Code</title>
	<atom:link href="http://danielbergey.com/motion/category/code/feed/" rel="self" type="application/rss+xml" />
	<link>http://danielbergey.com/motion</link>
	<description>Commotion</description>
	<lastBuildDate>Mon, 02 Nov 2009 02:45:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Seriously, go plug in your computer.</title>
		<link>http://danielbergey.com/motion/2009/11/seriously-go-plug-in-your-computer/</link>
		<comments>http://danielbergey.com/motion/2009/11/seriously-go-plug-in-your-computer/#comments</comments>
		<pubDate>Sun, 01 Nov 2009 13:24:10 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[applescript]]></category>
		<category><![CDATA[launchd]]></category>
		<category><![CDATA[macbook]]></category>
		<category><![CDATA[power]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://danielbergey.com/motion/?p=662</guid>
		<description><![CDATA[This happens a lot: I&#8217;ll be programming along, in the zone, so much that even the low-power alert doesn&#8217;t dissuade me from my task: That&#8217;s bad. Because inevitably, I&#8217;ll be just in the middle of a thought when the computer shuts off, ten minutes later. I don&#8217;t actually lose anything, of course, because MacBooks are [...]]]></description>
			<content:encoded><![CDATA[<p>This happens a lot: I&#8217;ll be programming along, in the zone, so much that even the low-power alert doesn&#8217;t dissuade me from my task:</p>

<div align="center" style="margin: -25px -45px;"><img src="http://danielbergey.com/motion/wp-content/uploads/2009/11/reservepower.png" alt="reservepower.png" border="0" width="555" height="243" style="border-width: 0;" /></div>

<p>That&#8217;s bad. Because inevitably, I&#8217;ll be just in the middle of a thought when the computer shuts off, ten minutes later. I don&#8217;t actually <em>lose</em> anything, of course, because MacBooks are usually smart about keeping enough power to stay alive. <em>(Note: haven&#8217;t used anything else for a while; other platforms may do just as well. <acronym title="Your Mileage May Vary">YMMV</a>.)</em></p>

<p>Still. It happened so much that I decided to do something about it:</p>

<div align="center" style="margin: -25px -45px;"><img src="http://danielbergey.com/motion/wp-content/uploads/2009/11/seriouslyplugin.png" alt="seriouslyplugin.png" border="0" width="500" height="233" style="border-width: 0;" /></div>

<p>I made a new text file, named it <code>"batterywarning"</code> and threw it in <code>/Applications/Scripts/</code> with the following contents:</p>

<pre><code>#!/usr/bin/env ruby

`pmset -g batt` =~ /discharging; (\d+:(\d+)) remaining/;
if $1 &amp;&amp; $1 &lt; '0:10' then
  nums = %w{ zero one two three four five six seven eight nine ten }
  mins = nums[$2.to_i] ? (nums[$2.to_i] +" minute"+ ($2=='01' ? '' : 's')) : $1
  exec "osascript -e 'tell application \"AppleScript Runner\" to "+
    "display alert \"Seriously, go plug in your computer.\" "+
    "message \"There&amp;rsquo;s only about "+ mins + " left! "+
    "How many times do you need to be told?\" as warning'"
end
</code></pre>

<p>The gist: when run, the script checks the current estimated remaining time on the battery. If it&#8217;s below 10 minutes (the point at which the native warning appears), it displays its own alert box warning the user of their procrastinatory folly. If there is more than 10 minutes remaining, it does nothing.</p>

<p>I made the script executable (<code>chmod +x /path/to/script</code>), and configured <code>launchd</code> to run it every minute by creating a plist named <code>"com.dbergey.batterywarning.plist"</code> in <code>~/Library/LaunchAgents/</code> thusly:</p>

<pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt;
&lt;plist version="1.0"&gt;
&lt;dict&gt;
    &lt;key&gt;Label&lt;/key&gt;
    &lt;string&gt;com.dbergey.batterywarning&lt;/string&gt;
    &lt;key&gt;ProgramArguments&lt;/key&gt;
    &lt;array&gt;
        &lt;string&gt;/Applications/Scripts/batterywarning&lt;/string&gt;
    &lt;/array&gt;
    &lt;key&gt;LowPriorityIO&lt;/key&gt;
    &lt;true/&gt;
    &lt;key&gt;StartInterval&lt;/key&gt;
    &lt;integer&gt;60&lt;/integer&gt;
&lt;/dict&gt;
&lt;/plist&gt;
</code></pre>

<p>Then, from the command line, I did this to tell <code>launchd</code> about it:</p>

<pre><code>launchctl load ~/Library/LaunchAgents/com.dbergey.batterywarning.plist 
</code></pre>

<p>And it worked! Hopefully I will be more proactive about plugging in when warned up to 10 times before shutoff. <img src='http://danielbergey.com/motion/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<div class="smartshare" style="display: none;"></div>]]></content:encoded>
			<wfw:commentRss>http://danielbergey.com/motion/2009/11/seriously-go-plug-in-your-computer/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	<slash:comments>2</slash:comments>
	</item>
		<item>
		<title>IE Version Reporting in jQuery</title>
		<link>http://danielbergey.com/motion/2008/09/ie-version-reporting-in-jquery/</link>
		<comments>http://danielbergey.com/motion/2008/09/ie-version-reporting-in-jquery/#comments</comments>
		<pubDate>Thu, 25 Sep 2008 04:40:07 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[webdesign]]></category>

		<guid isPermaLink="false">http://www.danielbergey.com/weblog/?p=524</guid>
		<description><![CDATA[Lately in the course of programming events, it came to my attention that under some circumstances IE 7 identifies itself as both IE 6 and IE 7 in the same userAgent string. Worse, I discovered to my horror that jQuery reports it as IE 6 if the IE 6 declaration happens to be ordered last. [...]]]></description>
			<content:encoded><![CDATA[<p>Lately in the course of programming events, it came to my attention that under some circumstances IE 7 identifies itself as both IE 6 and IE 7 in the same userAgent string. Worse, I discovered to my horror that jQuery reports it as IE 6 if the IE 6 declaration happens to be ordered last. This would never do.</p>

<p>The following code snippet will refine jQuery&#8217;s browser detection (tested in 1.2.6, <a href="http://dev.jquery.com/ticket/3402">patch submitted for 1.3</a>), and makes sure that if two or more IE version declarations are present in the userAgent string, jQuery reports the highest of them.</p>

<p><style>
code[language=javascript] {
    font: 10px &#8220;bitstream vera sans mono&#8221;, monaco, courier;
    line-height: 140%;
    white-space: pre;
    padding: 0&#160;20px 12px 20px;
    background: #eee;
    color: #666;
    display: block;
    border: 3px solid #ccc;
    border-width: 2px 0;
    overflow: auto;
}
</style>
<code language="javascript">
// Ensure that we report the highest IE version present in the userAgent string
if ( jQuery.browser.msie )
    jQuery.browser.version = (userAgent.match( /ie ([\d.]+)/ig ) || [])
        .sort().pop().replace( /[^\d.]/g, '' );
</code></p>

<p>To use it, you can either paste it into your jquery.js just after the browser detection stuff (harder), or include it as a script plugin after your jQuery script tag (easier).</p>

<div class="warning"><b>Disclaimer:</b> I&#8217;ve done some rudimentary testing, but you&#8217;re responsible for testing it in your own web project.</div>

<p>This all comes about for several reasons: the True IE 6 obviously won&#8217;t be mentioning IE 7 because it didn&#8217;t exist at release time, but the True IE 7 might want to pretend it was IE 6 for compatibility with older pages. There&#8217;s also apparently <a href="http://jamazon.co.uk/web/2008/07/23/an-ie7-bug-that-returns-msie-60-user-agent-string/">a situation</a> wherein an extra-long Windows registry entry will overwhelm IE 7 to the point where it falls back to reporting itself as IE 6.</p>

<p>If similar situations arise after IE 8 (final) is released, this code should take care of those, too. I say &#8220;should,&#8221; because I obviously don&#8217;t know what IE&#8217;s going to do in the future. (Sometimes I don&#8217;t even know what IE&#8217;s doing <em>right now</em>.)</p>
<div class="smartshare" style="display: none;"></div>]]></content:encoded>
			<wfw:commentRss>http://danielbergey.com/motion/2008/09/ie-version-reporting-in-jquery/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	<slash:comments>3</slash:comments>
	</item>
		<item>
		<title>Targeting IE7 with CSS rules</title>
		<link>http://danielbergey.com/motion/2007/07/targeting-ie7-with-css-rules/</link>
		<comments>http://danielbergey.com/motion/2007/07/targeting-ie7-with-css-rules/#comments</comments>
		<pubDate>Tue, 03 Jul 2007 23:58:54 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Internet]]></category>

		<guid isPermaLink="false">http://www.danielbergey.com/weblog/2007/07/03/targeting-ie7-with-css-rules/</guid>
		<description><![CDATA[In times past, if you absolutely had to have a hack in your CSS files to target that pesky IE problem, you used to be able to use the Underscore Hack. This useful hack came about because the CSS parser in IE6 ignores the underscore character (_), applying the rule as though it were the [...]]]></description>
			<content:encoded><![CDATA[<p>In times past, if you absolutely had to have a hack in your CSS files to target that pesky IE problem, you used to be able to use the <a href="http://wellstyled.com/css-underscore-hack.html">Underscore Hack</a>. This useful hack came about because the CSS parser in IE6 ignores the underscore character (_), applying the rule as though it were the name alone. If, for example, your PNG didn&#8217;t look nice in IE6, you could do something like this:</p>

<pre><code>#mydiv {
    background: url(wonderful.png);
    _background: url(wonderful.gif); /* IE rule overrides */
}
</code></pre>

<p>In IE7, however, Microsoft fixed that bug, and now the parser treats _named properties as unique, <a href="http://www.w3.org/TR/CSS21/syndata.html#tokenization">in accordance with CSS 2.1</a>. The result being that you can still use the underscore hack to target IE6 only with a rule, which is useful for when you&#8217;re working around some other bug that was fixed in IE7.</p>

<p>But what if you need to hack your CSS in IE7? You can use a period (.) instead of an underscore to prefix your property names. This method can be used to target both IE7 and IE6, or just IE7 with some creative jiggling:</p>

<pre><code>/* targeting IE7 only */
#mydiv {
    margin-top: 10px;
    .margin-top: 20px; /* affects both IE6 &amp; IE7 */
    _margin-top: 10px; /* reapply first rule to IE6 */
}
</code></pre>

<p>The period doesn&#8217;t validate, unfortunately. But neither does the underscore, for that matter, even though it&#8217;s allowed under the W3C spec. And your best bet for future-proofing is still <a href="http://www.quirksmode.org/css/condcom.html">conditional comments</a>. But for the moment &#8212; which means until some future version of IE changes it &#8212; this seems like a relatively clean way to work around the layout issues still present in IE7.</p>
<div class="smartshare" style="display: none;"></div>]]></content:encoded>
			<wfw:commentRss>http://danielbergey.com/motion/2007/07/targeting-ie7-with-css-rules/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<slash:comments>0</slash:comments>
	</item>
		<item>
		<title>PHP Preview in BBEdit</title>
		<link>http://danielbergey.com/motion/2006/09/php-preview-in-bbedit/</link>
		<comments>http://danielbergey.com/motion/2006/09/php-preview-in-bbedit/#comments</comments>
		<pubDate>Mon, 11 Sep 2006 02:46:09 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Mac]]></category>

		<guid isPermaLink="false">http://www.danielbergey.com/weblog/2006/09/10/php-preview-in-bbedit/</guid>
		<description><![CDATA[I do almost all my work in BBEdit, because I use a remote server on which to test my PHP. But I&#8217;ve been using HyperEdit for almost everything else, including mocking up CSS, working with JavaScript, and cranking out non-work PHP. This is completely because of HyperEdit&#8217;s integrated PHP preview. I can code in the [...]]]></description>
			<content:encoded><![CDATA[<p>
I do almost all my work in <a href="http://bbedit.com/products/bbedit/">BBEdit</a>, because I use a remote server on which to test my PHP. But I&#8217;ve been using <a href="http://www.tumultco.com/HyperEdit/">HyperEdit</a> for almost everything else, including mocking up CSS, working with JavaScript, and cranking out non-work PHP. This is completely because of HyperEdit&#8217;s integrated PHP preview. I can code in the left pane, and instantly see my code in the right pane without switching to a browser. However, I find that text editing gets slower the more code you type, and the developer hasn&#8217;t really released an update in a while. That&#8217;s not his fault, I think he&#8217;s in school. But the fact remains that I like BBEdit better for sheer text editing polish.
</p>

<p style="text-align:center;">
<img src="http://www.danielbergey.com/weblog/wp-content/uploads/2006/09/200609102354.jpg" height="198" width="448" border="0" hspace="4" vspace="4" alt="200609102354" />
</p>

<p>
BBEdit has a previewing feature, too, but it takes a little finagling to get it to parse PHP code. I finally figured out how to do it. First, make sure Personal Web Sharing is enabled, and then put this code in a file named <strong>BBEditPHPPreview.php</strong> in your <code>~/Sites/</code> directory:
</p>

<blockquote>
<code>&lt;?php
<br />ini_set('display_errors',1);
<br />error_reporting(E_ALL);
<br />include $_GET['file'];
<br />?&gt;</code>
</blockquote>

<p>
Then, set up a site in BBEdit&#8217;s HTML Web Sites preference pane to look like this (substituting your own username for &#8216;dbergey&#8217;, of course):
</p>

<p style="text-align:center;">
<img src="http://www.danielbergey.com/weblog/wp-content/uploads/2006/09/200609102318.jpg" height="530" width="477" border="0" hspace="4" vspace="4" alt="200609102318" />
</p>

<p>
One caveat is that the file you&#8217;re editing has to exist on disk in one form or another. BBEdit&#8217;s good about creating and rendering files with unsaved changes, but not completely new and as-of-yet unsaved files.
</p>

<p>
It&#8217;s not a complete replacement for HyperEdit&#8217;s two-paned approach, but with my Butler/AppleScript window-resizing hotkeys, I doubt it will be such a big issue for me.
</p>

<p>
My one niggling issue is that the preview doesn&#8217;t update <em>instantly</em>, like HyperEdit&#8217;s did. I haven&#8217;t found any way to remove BBEdit&#8217;s ~2 second updating delay. I even checked out the Help menu&#8217;s &#8220;Secret Preferences&#8221; item. How cool is that name, anyway?
</p>
<div class="smartshare" style="display: none;"></div>]]></content:encoded>
			<wfw:commentRss>http://danielbergey.com/motion/2006/09/php-preview-in-bbedit/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<slash:comments>0</slash:comments>
	</item>
		<item>
		<title>Rich text blog editor (with inline images)</title>
		<link>http://danielbergey.com/motion/2005/08/rich-text-blog-editor/</link>
		<comments>http://danielbergey.com/motion/2005/08/rich-text-blog-editor/#comments</comments>
		<pubDate>Thu, 04 Aug 2005 05:10:50 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Blogging]]></category>
		<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://www.danielbergey.com/weblog/archives/2005/08/04/rich-text-blog-editor/</guid>
		<description><![CDATA[While composing a blog entry today (which was subsequently eaten by a Safari crash, despite Saft valiantly saving my tabs), I became frustrated by the difficulty of putting screenshots and text together into a simple blog post. So, here&#8217;s my idea: Someone needs to write a blog editor, similar to MarsEdit or ecto, that supports [...]]]></description>
			<content:encoded><![CDATA[<p>While composing a blog entry today (which was subsequently eaten by a Safari crash, despite Saft valiantly saving my tabs), I became frustrated by the difficulty of putting screenshots and text together into a simple blog post.</p>

<p>So, here&#8217;s my idea: Someone needs to write a blog editor, similar to MarsEdit or ecto, that supports simple HTML, graphical tables and image insertion.</p>

<p>Let&#8217;s see what current OS X frameworks and applications can do in this vein:</p>

<ul>
    <li>TextEdit can export HTML and has a decent table creation interface, but chokes on saving images into its HTML, opting for a &#8220;Web Archive&#8221; file instead. These Web Archives aren&#8217;t packages as I originally thought; they contain their images inline in the file, relying on a file:///myimage.tiff URL scheme to refer to them.</li>
    <li>Safari now supports the contentEditable property on objects, but requires quite a bit of JavaScript to fill in the cracks make it into anything useful.</li>
    <li>Mail.app somehow exploits Safari&#8217;s contentEditable system to create a decent-yet-buggy rich text editing environment. This might be the closest thing to what I&#8217;m looking for. I wonder if the framework is documented anywhere, or &#8230; heh &#8230; how many hacks they had to use besides implementing contentEditable in WebKit?</li>
</ul>

<p>Maybe a better solution would be to create a WordPress plugin to which one can upload a Web Archive and automatically create a post, saving the embedded images out into a unique directory keyed to the post slug. I thought of saving the images right into the database, but that would lock the user into using the plugin forever. It&#8217;s not good practice to store data in a non-standard way.</p>

<p>Since writing the previous paragraphs, I&#8217;ve found out about textutil, which you can run web archives through to convert them to plain old HTML and JPGs (if images are in the archive). Why not create an AppleScript Studio app that uses XML-RPC and textutil to simply allow the user to utilize the existing OS X rich text editing environment (like in TextEdit), and upload a post to WP.</p>

<p>Better yet, how about just making rich text editing a feature of the next version of MarsEdit or ecto? <a href="http://www.inessential.com/">Brent</a>? <a href="http://www.kung-foo.tv/">Adriaan</a>? Are you listening? <img src='http://danielbergey.com/motion/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  (Remember, I paid for MarsEdit and donated for Kung-Tunes.) Seems like I heard something about that in plans for one or the other of those two.</p>

<p><b>Update:</b> I haven&#8217;t played with ecto in a while, it seems. ecto supports rich text editing, but not with inline images. Gotta have those inline images. No reason not to. TextEdit does it. C&#8217;mon.</p>
<div class="smartshare" style="display: none;"></div>]]></content:encoded>
			<wfw:commentRss>http://danielbergey.com/motion/2005/08/rich-text-blog-editor/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
	<slash:comments>6</slash:comments>
	</item>
		<item>
		<title>Safari Crasher</title>
		<link>http://danielbergey.com/motion/2005/07/safari-crasher/</link>
		<comments>http://danielbergey.com/motion/2005/07/safari-crasher/#comments</comments>
		<pubDate>Fri, 08 Jul 2005 21:27:26 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://www.danielbergey.com/weblog/?p=329</guid>
		<description><![CDATA[This code crashes Safari 2.0 (412), the build included in Mac OS X 10.4.1. I&#8217;ve no idea why. If you type something in the field and then click or tab away, Safari (or any other WebCore instance) instantly freezes and/or quits. But it doesn&#8217;t always happen the first time. &#60;input type="text" onblur="this.type='password';" onfocus="this.type='text';" /&#62; View [...]]]></description>
			<content:encoded><![CDATA[<p>This code crashes Safari 2.0 (412), the build included in Mac OS X 10.4.1. I&#8217;ve no idea why. If you type something in the field and then click or tab away, Safari (or any other WebCore instance) instantly freezes and/or quits. But it doesn&#8217;t always happen the first time.</p>

<p style="text-align: center;"><code>&lt;input type="text" onblur="this.type='password';" onfocus="this.type='text';" /&gt;</code></p>

<p><a href="#" onclick="document.getElementById('quickCodeHide').style.display='block';return false;">View an actual crashing field</a> (don&#8217;t if you have open tabs that you want to keep).</p>

<p id="quickCodeHide" style="display: none; text-align: center;">
    <b>Type and tab away:</b> <input type="text" onblur="this.type='password';" onfocus="this.type='text';" />
</p>

<p>FireFox handles it just fine, though some internal JavaScript errors show up in the JavaScript Console. IE just complains of an error &#8230; it doesn&#8217;t know how to set the <code>.type</code> of an <code>input type="text"</code>.</p>

<p>I should <a href="http://webkit.opendarwin.org/quality/reporting.html">submit a WebCore bug</a>, but I&#8217;ve never done that before. Looks like I have to search for the issue in <a href="http://bugzilla.opendarwin.org/query.cgi?format=specific&amp;product=WebKit">BugZilla</a> first.</p>

<p>Can anyone confirm this?</p>
<div class="smartshare" style="display: none;"></div>]]></content:encoded>
			<wfw:commentRss>http://danielbergey.com/motion/2005/07/safari-crasher/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	<slash:comments>2</slash:comments>
	</item>
		<item>
		<title>Email can be bad for you</title>
		<link>http://danielbergey.com/motion/2004/12/email-can-be-bad-for-you/</link>
		<comments>http://danielbergey.com/motion/2004/12/email-can-be-bad-for-you/#comments</comments>
		<pubDate>Wed, 01 Dec 2004 21:50:14 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Work]]></category>

		<guid isPermaLink="false">http://danielbergey.com/weblog/archives/2004/12/01/email-can-be-bad-for-you/</guid>
		<description><![CDATA[Andy sent me this article describing why email can be bad for you, and how to be more productive in general. (Homestar: &#8220;Ow &#8230; those things are BAD for you!&#8221;) Let&#8217;s take the concentration impact first.&#160; I&#8217;m a software engineer, and programming requires extended periods of concentration.&#160; Actually this isn&#8217;t unique to programming, a lot [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://andyfowler.com/">Andy</a> sent me this article describing <a href="http://www.w-uh.com/articles/030308-tyranny_of_email.html">why email can be bad for you</a>, and how to be more productive in general. <i>(<a href="http://www.homestarrunner.com/sbemail41.html">Homestar</a>: &#8220;Ow &#8230; those things are BAD for you!&#8221;)</i></p>

<blockquote><p>Let&#8217;s take the concentration impact first.&#160; I&#8217;m a software engineer, and programming requires extended periods of concentration.&#160; Actually this isn&#8217;t unique to programming, a lot of fields require that you concentrate.&#160; (Probably just about everything worth doing requires some concentration!)</p><hr align="center" width="50%"><p>I maintain that programming cannot be done in less than three-hour windows.&#160; It takes three hours to spin up to speed, gather your concentration, shift into &#8220;right brain mode&#8221;, and really focus on a problem.&#160; Effective programmers organize their day to have at least one three-hour window, and hopefully two or three.&#160; (This is why good programmers often work late at night.&#160; They don&#8217;t get interrupted as much&#8230;)</p>
</blockquote>

<p>That last part is something I knew, but had never seen put into words before. Now that I have some tangible ground to stand upon, maybe I can structure my work-environment a little better. Like closing <a href="http://www.apple.com/macosx/features/mail/">Apple Mail</a> and <a href="http://ranchero.com/netnewswire/">NetNewsWire</a> &#8230; unless I&#8217;m really looking for <a href="http://www.aelki.com/">a special email</a>.</p>
<div class="smartshare" style="display: none;"></div>]]></content:encoded>
			<wfw:commentRss>http://danielbergey.com/motion/2004/12/email-can-be-bad-for-you/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	<slash:comments>2</slash:comments>
	</item>
		<item>
		<title>Order of Critical Permission</title>
		<link>http://danielbergey.com/motion/2003/12/order-of-critical-permission/</link>
		<comments>http://danielbergey.com/motion/2003/12/order-of-critical-permission/#comments</comments>
		<pubDate>Thu, 11 Dec 2003 06:39:54 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Work]]></category>

		<guid isPermaLink="false">http://danielbergey.com/weblog/archives/2003/12/11/order-of-critical-permission/</guid>
		<description><![CDATA[As I vehemently instructed Guy tonight, there is a strict order of operations that governs when you are allowed to criticize my work. I made most of it up on the spot. Functionality Appearance Optimization Mind you, the &#8216;strictness&#8217; doesn&#8217;t pertain to me, it just means you can&#8217;t say, &#8220;That looks dumb,&#8221; when I haven&#8217;t [...]]]></description>
			<content:encoded><![CDATA[<p>As I vehemently instructed <a href="http://guy.pa.net">Guy</a> tonight, there is a strict order of operations that governs when you are allowed to criticize my work. I made most of it up on the spot.</p>

<ol>
<li><b>Functionality</b><div style="margin-left: 1em;"></div></li>
<li><b>Appearance</b></li>
<li><b>Optimization</b></li>
</ol>

<p>Mind you, the &#8216;strictness&rsquo; doesn&#8217;t pertain to <i>me</i>, it just means you can&rsquo;t say, &ldquo;That looks dumb,&rdquo; when I haven&rsquo;t even gotten it all working properly yet.</p>

<p>And you can&rsquo;t say, &ldquo;Dude, that&rsquo;s slow,&rdquo; when the graphics and display code aren&rsquo;t optimized yet.</p>

<p>So I said all this to Guy in Lindsay&rsquo;s hearing. Lindsay immediately protested in his very polite way that one should optimize one&rsquo;s code from the beginning rather than waiting until the end. He&rsquo;s right, of course. But my point is this: It&rsquo;s annoying for someone to call attention to issues in projects that haven&#8217;t been declared ready for criticism.</p>

<p>Also, I really like Sarah McLachlan&rsquo;s <a href="http://phobos.apple.com/WebObjects/MZStore.woa/wa/viewAlbum?playlistId=3130172&#38;selectedItemId=3129664">Angel</a>.</p>
<div class="smartshare" style="display: none;"></div>]]></content:encoded>
			<wfw:commentRss>http://danielbergey.com/motion/2003/12/order-of-critical-permission/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<slash:comments>0</slash:comments>
	</item>
		<item>
		<title>The application formerly known as Hydra (TAFKAH)</title>
		<link>http://danielbergey.com/motion/2003/09/the-application-formerly-known-as-hydra-tafkah/</link>
		<comments>http://danielbergey.com/motion/2003/09/the-application-formerly-known-as-hydra-tafkah/#comments</comments>
		<pubDate>Thu, 18 Sep 2003 14:23:20 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[Work]]></category>

		<guid isPermaLink="false">http://danielbergey.com/weblog/archives/2003/09/18/the-application-formerly-known-as-hydra-tafkah/</guid>
		<description><![CDATA[Somehow my influence has apparantly had an effect on Sam. Not only did he finally get a 17&#8221; PowerBook, but he subsequently switched to Interarchy and BBEdit for his FTP client and text editor. Since we work together, many times on the same project, we&#8217;ve been trying for the past couple of days to set [...]]]></description>
			<content:encoded><![CDATA[<p>Somehow my influence has apparantly had an effect on Sam. Not only did he finally get a <a href="http://www.apple.com/powerbook/index17.html">17&#8221; PowerBook</a>, but he subsequently switched to <a href="http://www.interarchy.com/">Interarchy</a> and <a href="http://www.barebones.com/products/bbedit/">BBEdit</a> for his FTP client and text editor. Since we work together, many times on the same project, we&#8217;ve been trying for the past couple of days to set up <a href="http://www.codingmonkeys.de/subethaedit/">the application formerly known as Hydra</a> (now SubEthaEdit) to work with Interarchy the same way, via <a href="http://www.apple.com/applescript/">AppleScript</a>.
<br /><br />
We finally got frustrated at Hydra&#8217;s lack of AppleScript support, and moved on to other things. But I wrote to Peter N Lewis, Interarchy&#8217;s author, via the discussion list (a first for me), and he pointed out that if I were to set Internet Config&#8217;s <tt>ftp-editor</tt> value to <tt>SubEthaEdit</tt>, intelligent FTP clients (Interarchy, <a href="http://www.panic.com/transmit/">Transmit</a>, <a href="http://members.ozemail.com.au/~pli/netfinder/">NetFinder</a>) would use it exactly the same way as BBEdit. Hooray for AppleEvents, and kudos to <a href="http://www.barebones.com/">Bare Bones</a> for opening their <a href="http://www.barebones.com/support/develop/odbsuite.shtml">ODB Editor Suite</a>.</p>
<div class="smartshare" style="display: none;"></div>]]></content:encoded>
			<wfw:commentRss>http://danielbergey.com/motion/2003/09/the-application-formerly-known-as-hydra-tafkah/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	<slash:comments>1</slash:comments>
	</item>
		<item>
		<title>Super Text-to-Numbers Converter</title>
		<link>http://danielbergey.com/motion/2003/04/super-text-to-numbers-converter/</link>
		<comments>http://danielbergey.com/motion/2003/04/super-text-to-numbers-converter/#comments</comments>
		<pubDate>Tue, 15 Apr 2003 03:29:34 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://danielbergey.com/weblog/archives/2003/04/14/super-text-to-numbers-converter/</guid>
		<description><![CDATA[Okay, I couldn&#8217;t find a script to do this, so I was forced to perform the horrible task of writing it myself. I needed a way to check for a valid text-number, like &#8220;one hundred twenty-three&#8221;, and convert it to digital format, as in &#8220;123&#8221;. I think it&#8217;s pretty foolproof now, although PHP&#8217;s number_format doesn&#8217;t [...]]]></description>
			<content:encoded><![CDATA[<p>Okay, I couldn&#8217;t find a script to do this, so I was forced to perform the horrible task of writing it myself. I needed a way to check for a valid text-number, like &#8220;one hundred twenty-three&#8221;, and convert it to digital format, as in &#8220;123&#8221;. I think it&#8217;s pretty foolproof now, although PHP&#8217;s number_format doesn&#8217;t like to work with exponential notation. So numbers below &#8220;one quadrillion&#8221; should work; numbers above will drop low digits. Not really a big deal for me. Feel free to <a href="http://www.danielbergey.com/xtalk/text_to_num.php">play with it</a>, and try to break it.</p>

<blockquote><a href="http://www.danielbergey.com/xtalk/text_to_num.php">Super Text-to-Numbers Converter</a></blockquote>
<div class="smartshare" style="display: none;"></div>]]></content:encoded>
			<wfw:commentRss>http://danielbergey.com/motion/2003/04/super-text-to-numbers-converter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<slash:comments>0</slash:comments>
	</item>
	</channel>
</rss>

