<?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>Jay Knight &#187; programming</title>
	<atom:link href="http://jk3.us/tag/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://jk3.us</link>
	<description>...or something along those lines</description>
	<lastBuildDate>Mon, 31 Oct 2011 21:22:03 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Open Source Linux Phone</title>
		<link>http://jk3.us/2006/08/16/open-source-linux-phone/</link>
		<comments>http://jk3.us/2006/08/16/open-source-linux-phone/#comments</comments>
		<pubDate>Wed, 16 Aug 2006 18:19:12 +0000</pubDate>
		<dc:creator>Jay</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://jk3.us/2006/08/16/open-source-linux-phone/</guid>
		<description><![CDATA[Trolltech will be shipping a linux-based phone for developers in September. The device will be sold with a developer kit with everything (presumably) you need to write/rewrite software for it. It will connect to cell networks via GSM/GPRS and have &#8230; <a href="http://jk3.us/2006/08/16/open-source-linux-phone/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Trolltech will be shipping a linux-based phone for developers in September.  The device will be sold with a developer kit with everything (presumably) you need to write/rewrite software for it.  It will connect to cell networks via GSM/GPRS and have builtin wifi.  (Story <a href="http://www.linuxdevices.com/news/NS8030785497.html">here</a>).</p>
<p>Depending on the price, I really think I want one of these.  I&#8217;m thinking of using the wifi for communications over jabber+jingle and/or SIP in addition to web and email.</p>
<p>If I end up getting one, you can bet that I&#8217;ll be posting about it&#8230; you know, my birthday is in September <img src='http://jk3.us/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://jk3.us/2006/08/16/open-source-linux-phone/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>More Microsummaries</title>
		<link>http://jk3.us/2006/07/20/more-microsummaries/</link>
		<comments>http://jk3.us/2006/07/20/more-microsummaries/#comments</comments>
		<pubDate>Thu, 20 Jul 2006 20:51:18 +0000</pubDate>
		<dc:creator>Jay</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://jk3.us/2006/07/20/more-microsummaries/</guid>
		<description><![CDATA[This Microsummary thing is fun! I keep coming across sites/pages that should have them, so I keep makin em. I threw up a little script to allow viewing and installing the ones I&#8217;ve made. I propose a wiki-ish microsummary generator &#8230; <a href="http://jk3.us/2006/07/20/more-microsummaries/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>This <a href="http://jk3.us/2006/07/12/microsummaries/">Microsummary</a> thing is fun!  I keep coming across sites/pages that should have them, so I keep makin em.  I threw up <a title="Jay's Microsummaries" href="http://dev.jk3.us/microsummaries/">a little script</a> to allow viewing and installing the ones I&#8217;ve made.  I propose a wiki-ish microsummary generator site to allow folks to submit ones they&#8217;ve made for others&#8217; use.  But I&#8217;ll just keep putting mine up here for now.</p>
<p>Also, I&#8217;ll be putting up links to other peoples lists of generators.  If you&#8217;ve got one let me know.</p>
]]></content:encoded>
			<wfw:commentRss>http://jk3.us/2006/07/20/more-microsummaries/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Microsummaries</title>
		<link>http://jk3.us/2006/07/12/microsummaries/</link>
		<comments>http://jk3.us/2006/07/12/microsummaries/#comments</comments>
		<pubDate>Wed, 12 Jul 2006 22:48:37 +0000</pubDate>
		<dc:creator>Jay</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://jk3.us/2006/07/12/microsummaries/</guid>
		<description><![CDATA[Microsummaries are a fun little addition to the upcoming Firefox 2.0 (and currently in the Beta 1 release). Basically, your bookmark titles can update automatically to give you a quick view of what&#8217;s happening on the site. As an example &#8230; <a href="http://jk3.us/2006/07/12/microsummaries/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Microsummaries are a fun little addition to the upcoming Firefox 2.0 (and currently in the Beta 1 release).  Basically, your bookmark titles can update automatically to give you a quick view of what&#8217;s happening on the site.  As an example (and my first generator), check out this screen shot of the current weather conditions in Tupelo, MS:</p>
<p><img width="128" height="43" alt="NWS Current Observation Microsummary Bookmark" src="http://jk3.us/wp-content/uploads/2006/07/weather_summary.thumbnail.png" /></p>
<p>Dang, it&#8217;s hot&#8230; and I just had to glance at my bookmarks toolbar to know that <img src='http://jk3.us/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />   These microsummaries are very flexible, they can be specified by site owners or generated by user xml files.  This lousy blog will surely have microsummary goodness soon enough.</p>
<p>To get your weather, add the <a href="//jk3.us/wp-content/nws-current-observation.xml');">current weather observation microsummary generator</a>, bookmark the appropriate XML file (not RSS) from <a href="http://www.weather.gov/data/current_obs/">http://www.weather.gov/data/current_obs/</a>, go to the bookmarks properties and check out the drop down box for the title.  Ideally, this would work with the more human readable weather page instead of the xml feed, but I didn&#8217;t feel like figuring out the XPaths to the pieces of data I needed, I&#8217;ll leave that to someone else&#8230; or maybe I&#8217;ll do it later.</p>
<p>As a side note, this firefox beta crashed 3 times while writing this post, but the new session restore feature brought me back almost exactly where I was&#8230; thanks to having saved periodically.  Also during the course of writing this, my bookmark title changed to &#8217;96 F &#8211; Fair&#8217;&#8230; I thought it was late enough to be cooling off <img src='http://jk3.us/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
<p>Update: Here&#8217;s <a href="//jk3.us/wp-content/google-weather-current.xml');">a generator</a> for <a title="Weather for 38655" href="http://www.google.com/search?q=weather%3A38655">google weather</a> (change the zip code in the url, if you actually use their form, the url will no longer match).</p>
]]></content:encoded>
			<wfw:commentRss>http://jk3.us/2006/07/12/microsummaries/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Read-only select elements in HTML</title>
		<link>http://jk3.us/2006/07/06/read-only-select-elements-in-html/</link>
		<comments>http://jk3.us/2006/07/06/read-only-select-elements-in-html/#comments</comments>
		<pubDate>Thu, 06 Jul 2006 22:11:55 +0000</pubDate>
		<dc:creator>Jay</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://jk3.us/2006/07/06/read-only-select-elements-in-html/</guid>
		<description><![CDATA[In HTML 4, form elements can be defined as &#8220;readonly&#8221; so that the user can&#8217;t modify the value. However, you&#8217;ll notice that select controls (the drop-down lists) do not support the readonly attribute, just input and textarea controls. Can anyone &#8230; <a href="http://jk3.us/2006/07/06/read-only-select-elements-in-html/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>In HTML 4, form elements can be defined as &#8220;<a title="Read-only Controls" href="http://www.w3.org/TR/1998/REC-html40-19980424/interact/forms.html#h-17.12.2">readonly</a>&#8221; so that the user can&#8217;t modify the value. However, you&#8217;ll notice that select controls (the drop-down lists) do not support the readonly attribute, just input and textarea controls. Can anyone out there please explain the rational behind this? It seems perfectly reasonable to have a readonly select box, especially if it is put into that state by a script.</p>
<p>I think my workaround will consist of making them disabled so they cannot be editted, and enabling them via a script right before the form submits so that the values for those controls are submitted (disabled controls are not <a title="Successful controls" href="http://www.w3.org/TR/1998/REC-html40-19980424/interact/forms.html#h-17.12.2">successful</a> and are not &#8220;valid for submission&#8221;).</p>
<p>If anyone can explain why selects can&#8217;t be made readonly, or give me a better solution for simulating readonly-ness, please share.</p>

<!-- Start of #1 shortcode -->
<script type="text/javascript"><!--
google_ad_client = "ca-pub-9645012178760617";
/* jk3.us blog post horizontal */
google_ad_slot = "0964181340";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
<!-- End of #1 shortcode -->

]]></content:encoded>
			<wfw:commentRss>http://jk3.us/2006/07/06/read-only-select-elements-in-html/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Xpath translations</title>
		<link>http://jk3.us/2006/02/13/xpath-translations/</link>
		<comments>http://jk3.us/2006/02/13/xpath-translations/#comments</comments>
		<pubDate>Tue, 14 Feb 2006 02:33:18 +0000</pubDate>
		<dc:creator>Jay</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://jk3.us/?p=33</guid>
		<description><![CDATA[I&#8217;m certainly no expert in the vast realm that is XML. I like it, and I hope it succeeds, and I want to learn it more&#8230; so here&#8217;s a question that someone can answer for me before I do days &#8230; <a href="http://jk3.us/2006/02/13/xpath-translations/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m certainly no expert in the vast realm that is XML.  I like  it, and I hope it succeeds, and I want to learn it more&#8230; so here&#8217;s a question that someone can answer for me before I do days of research and find nothing:</p>
<p>Is there any standard (or at least reliable) way to &#8220;translate&#8221; a relative XPath expression into one that is absolute.   A successful translation would be one that returned the exact same value/node-set as the original when evaluated in the same context.    If such a solution exists&#8230; I&#8217;m guessing it would involve lots of &#8220;position()&#8221; calls.</p>
<p>Anyone?</p>
]]></content:encoded>
			<wfw:commentRss>http://jk3.us/2006/02/13/xpath-translations/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>vimdiff</title>
		<link>http://jk3.us/2006/02/03/vimdiff/</link>
		<comments>http://jk3.us/2006/02/03/vimdiff/#comments</comments>
		<pubDate>Fri, 03 Feb 2006 16:34:55 +0000</pubDate>
		<dc:creator>Jay</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://jk3.us/?p=31</guid>
		<description><![CDATA[Not long ago, I found out about vimdiff. Basically, vim will open two files with a vertical split and highlight differences between them. You can navigate through the files and use :diffput and :diffget to synchronize blocks of the file. &#8230; <a href="http://jk3.us/2006/02/03/vimdiff/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Not long ago, I found out about vimdiff.  Basically, vim will open two files with a vertical split and highlight differences between them.  You can navigate through the files and use :diffput and :diffget to synchronize blocks of the file.  My programming life doesn&#8217;t involve patches and version control and all that, but it is still an invaluable tool.</p>
<p>One place I&#8217;ve found it particularly useful is when upgrading ebuilds in gentoo.  If your new package has a new config file in /etc, portage will not overwrite your current config, but will put the new file next to it.  For example, an update to /etc/apache2/httpd.conf would be placed at /etc/apache2/._cfg0000_httpd.conf.  For non-trivial updates (where etc-update/dispatch-conf aren&#8217;t really practical), it&#8217;s nice to be able to see the two versions side-by-side and update blocks at a time where needed.</p>
<p>So, not a tool I use everyday, but one that I&#8217;m very glad to have discovered.  Check out <a href="http://vimdoc.sourceforge.net/htmldoc/diff.html#vimdiff">the docs</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://jk3.us/2006/02/03/vimdiff/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Upload to Flickr with Perl</title>
		<link>http://jk3.us/2005/06/22/upload-to-flickr-with-perl/</link>
		<comments>http://jk3.us/2005/06/22/upload-to-flickr-with-perl/#comments</comments>
		<pubDate>Wed, 22 Jun 2005 14:33:07 +0000</pubDate>
		<dc:creator>Jay</dc:creator>
				<category><![CDATA[Pictrus]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://jk3.us/?p=6</guid>
		<description><![CDATA[So, I&#8217;m writing Pictr.us in perl. And It is supposed to be able to upload images to flickr. After reading some sketchy documentation, I finally figured out how to accomplish this. It&#8217;s suprisingly easy. I&#8217;m using the LWP::UserAgent module for &#8230; <a href="http://jk3.us/2005/06/22/upload-to-flickr-with-perl/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>So, I&#8217;m writing <a href="http://pictr.us/">Pictr.us</a> in perl.  And It is supposed to be able to <a href="http://flickr.com/services/api/upload.api.html">upload images</a> to <a href="http://flickr.com/">flickr</a>.  After reading some sketchy documentation, I finally figured out how to accomplish this.  It&#8217;s suprisingly easy.</p>
<p>I&#8217;m using the <a href="http://search.cpan.org/~gaas/libwww-perl/lib/LWP/UserAgent.pm">LWP::UserAgent</a> module for all of my api requests to flickr, and it turns out that LWP will make the POST request with little hassle:</p>
<pre>

#####################
#
# function: flickr_upload
# parameters: filename, ...  (array of filenames)
# returns: array of flickr photo_ids
#
# TODO: make error checking more robust
#
#####################
sub flickr_upload {
    my @filenames = @_;
    my @picids;
    foreach my $filename (@filenames) {
        my @filearray = ($filename, $filename);
        my %vals;
        $vals{'email'} = $flickr_email;
        $vals{'password'} = $flickr_passwd;
        $vals{'photo'} = \@filearray;
        my $res = $ua-&gt;post(
            'http://www.flickr.com/tools/uploader_go.gne',
             \%vals, 'Content-type' =&gt; 'form-data');
        my $doc = $parser-&gt;parse_string($res-&gt;content);
        my @stati = $doc-&gt;getElementsByTagName('status');
        if ($stati[0]-&gt;firstChild-&gt;data eq 'ok') {
            my @idnodes=$doc-&gt;getElementsByTagName('photoid');
            push @picids, $idnodes[0]-&gt;firstChild-&gt;data;
        } else {
            print "Something bad happened....";
        }

    }
    return @picids;
# Now go to:
#'http://www.flickr.com/tools/uploader_edit.gne?ids='.
#join ',',@picids;
}
</pre>
<p>This is the key line:</p>
<pre>
        my $res = $ua-&gt;post(
             'http://www.flickr.com/tools/uploader_go.gne',
              \%vals, 'Content-type' =&gt; 'form-data');
</pre>
<p>The first parameter is obviously the URL to post to.  The second is a reference to a hash that contains the key=&gt;value pairs (basically, the form fields).  Notice that the value of &#8216;photo&#8217; is an array reference.  This tells LWP that this is a file upload.  The first (0th) element in that array is the name of the file to upload, the second is the name to tell flickr for the file, I just used the same name.  This array can also contain additional values that I didn&#8217;t used, <a href="http://search.cpan.org/~gaas/libwww-perl-5.803/lib/HTTP/Request/Common.pm">info here</a>.  The third parameter is the Content type header.  This is very important.  If you leave it off LWP will try to use the &#8220;key=value&amp;key=value&amp;&#8230;.&#8221; syntax, and it really has to be multipart form data.</p>
<p>The rest is pretty simple.  I&#8217;m using <a href="http://search.cpan.org/dist/XML-LibXML/">XML::LibXML</a> to parse the responses from flickr.</p>
]]></content:encoded>
			<wfw:commentRss>http://jk3.us/2005/06/22/upload-to-flickr-with-perl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

