<?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:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Juggling Bits</title>
	<atom:link href="http://jugglingbits.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://jugglingbits.wordpress.com</link>
	<description>thomas11's technical blog</description>
	<lastBuildDate>Sat, 01 Jun 2013 06:33:21 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='jugglingbits.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Juggling Bits</title>
		<link>http://jugglingbits.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://jugglingbits.wordpress.com/osd.xml" title="Juggling Bits" />
	<atom:link rel='hub' href='http://jugglingbits.wordpress.com/?pushpress=hub'/>
		<item>
		<title>GMail mailing list fail</title>
		<link>http://jugglingbits.wordpress.com/2010/12/10/gmail-mailing-list-fail/</link>
		<comments>http://jugglingbits.wordpress.com/2010/12/10/gmail-mailing-list-fail/#comments</comments>
		<pubDate>Fri, 10 Dec 2010 07:27:50 +0000</pubDate>
		<dc:creator>thomas11</dc:creator>
				<category><![CDATA[Stuff]]></category>

		<guid isPermaLink="false">http://jugglingbits.wordpress.com/2010/12/10/gmail-mailing-list-fail/</guid>
		<description><![CDATA[Google has the image of a hacker-friendly company, a company that despite its growth still (occasionally) listens to its advanced users. Google is also an active Open Source contributor. Why oh why, then, does GMail still not have a &#8220;reply to list&#8221; functionality? It&#8217;s been requested many times, and if it was offered as a [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jugglingbits.wordpress.com&#038;blog=6812373&#038;post=380&#038;subd=jugglingbits&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Google has the image of a hacker-friendly company, a company that despite its growth still (occasionally) listens to its advanced users. Google is also an active Open Source contributor.</p>
<p>Why oh why, then, does GMail still not have a &#8220;reply to list&#8221; functionality? It&#8217;s <a href="https://groups.google.com/group/gmail-labs-suggest-a-labs-feature/browse_thread/thread/79f3f668f54b0b0f/d6b66fa48f2d850c?lnk=gst&amp;q=reply+to+list#d6b66fa48f2d850c">been</a> <a href="https://groups.google.com/group/gmail-labs-suggest-a-labs-feature/browse_thread/thread/80c044355450364/bd663c2bdbfd296f?lnk=gst&amp;q=reply+to+list#bd663c2bdbfd296f">requested</a> <a href="https://groups.google.com/group/gmail-labs-suggest-a-labs-feature/browse_thread/thread/dc5fdfb751dabe85/8ce6b6a9df3df423?lnk=gst&amp;q=reply+to+list#8ce6b6a9df3df423">many</a> <a href="https://groups.google.com/group/gmail-labs-suggest-a-labs-feature/browse_thread/thread/7149658bf6eb1504/57ad5d6e8371572b?lnk=gst&amp;q=reply+to+list#57ad5d6e8371572b">times</a>, and if it was offered as a Google Mail Labs feature, it wouldn&#8217;t clutter the interface for non-technical people. How do the Google engineers themselves participate in mailing lists, by cutting and pasting between the Cc: and To: fields?</p>
<p>Seriously, it&#8217;s about time.</p>
<p>Rant off.</p>
<br />Filed under: <a href='http://jugglingbits.wordpress.com/category/stuff/'>Stuff</a> Tagged: <a href='http://jugglingbits.wordpress.com/tag/stuff/'>Stuff</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jugglingbits.wordpress.com/380/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jugglingbits.wordpress.com/380/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jugglingbits.wordpress.com&#038;blog=6812373&#038;post=380&#038;subd=jugglingbits&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jugglingbits.wordpress.com/2010/12/10/gmail-mailing-list-fail/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/2a4078b8bf5d17530101db7ab2de6bfa?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif&#38;r=G" medium="image">
			<media:title type="html">thomas11</media:title>
		</media:content>
	</item>
		<item>
		<title>Java anonymous classes are too verbose</title>
		<link>http://jugglingbits.wordpress.com/2010/11/11/java-anonymous-classes-are-too-verbose/</link>
		<comments>http://jugglingbits.wordpress.com/2010/11/11/java-anonymous-classes-are-too-verbose/#comments</comments>
		<pubDate>Thu, 11 Nov 2010 08:13:01 +0000</pubDate>
		<dc:creator>thomas11</dc:creator>
				<category><![CDATA[Nitty Gritty]]></category>
		<category><![CDATA[functional]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://jugglingbits.wordpress.com/2010/11/11/java-anonymous-classes-are-too-verbose/</guid>
		<description><![CDATA[Java doesn&#8217;t have first-class functions or closures, but you can emulate some of that with anonymous classes. Alas, they are just too cumbersome and verbose&#8212;it&#8217;s not elegant anymore if you need more LoC than with the iterative loop. Recently at work, I wanted to execute some code for each member of a List, and I [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jugglingbits.wordpress.com&#038;blog=6812373&#038;post=375&#038;subd=jugglingbits&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Java doesn&#8217;t have first-class functions or closures, but you can emulate some of that with anonymous classes. Alas, they are just too cumbersome and verbose&#8212;it&#8217;s not elegant anymore if you need more LoC than with the iterative loop.</p>
<p>Recently at work, I wanted to execute some code for each member of a List, and I needed to know which iteration step I was at. A straightforward solution is, obviously, the classic for loop:</p>
<pre><code>
for (int i = 0; i &lt; keyword.getSynonyms(); i++) {
    String synonym = keyword.getSynonyms().get(i);
    // do something
}
</code></pre>
<p>That&#8217;s fine in many cases, but it has two problems. The extra line to get at the List element is annoying. More importantly, depending on the List implementation the <code>get(i)</code> operation might be in O(n), requiring another scan of the list each time.</p>
<p>So we could iterate normally and count ourselves:</p>
<pre><code>
int order = 0;
for (String synonym : keyword.getSynonyms())
{
    // do something
    order++;
}
</code></pre>
<p>It&#8217;s better, but I needed several such loops, and I wondered if I couldn&#8217;t write all that plumbing just once. I came up with this:</p>
<pre><code>
public abstract class Counting&lt;T, E extends Throwable&gt;
{
    public void loop(Iterable&lt;T&gt; things) throws E
    {
        int step = 0;
        for (T t : things)
        {
            iteration(t, step);
            step++;
        }
    }

    public abstract void iteration(T thing, int step) throws E;
}
</code></pre>
<p>As the loop body can throw exceptions, and we might want to declare the specific kind of exception, this needs to be an additional generic type. This breaks if you need more than one exception type.</p>
<p>The above loop then becomes</p>
<pre><code>
new Counting&lt;String, SQLException&gt;()
{
    @Override public void iteration(String synonym, int step)
        throws SQLException
    {
        // do something
    }
}.loop( keyword.getSynonyms() );
</code></pre>
<p>Hmmm. Even after writing an abstract class to extract the repeated parts, and not counting my preference for opening-brace-on-new-line, I still haven&#8217;t saved a single line. Can I have <code>map</code> and first-class functions, please? Time for Scala?</p>
<br />Filed under: <a href='http://jugglingbits.wordpress.com/category/nitty-gritty/'>Nitty Gritty</a> Tagged: <a href='http://jugglingbits.wordpress.com/tag/functional/'>functional</a>, <a href='http://jugglingbits.wordpress.com/tag/java/'>java</a>, <a href='http://jugglingbits.wordpress.com/tag/nitty-gritty/'>Nitty Gritty</a>, <a href='http://jugglingbits.wordpress.com/tag/programming/'>programming</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jugglingbits.wordpress.com/375/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jugglingbits.wordpress.com/375/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jugglingbits.wordpress.com&#038;blog=6812373&#038;post=375&#038;subd=jugglingbits&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jugglingbits.wordpress.com/2010/11/11/java-anonymous-classes-are-too-verbose/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/2a4078b8bf5d17530101db7ab2de6bfa?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif&#38;r=G" medium="image">
			<media:title type="html">thomas11</media:title>
		</media:content>
	</item>
		<item>
		<title>RDF or not in Gen2Phen &#8211; 6th Assembly Meeting</title>
		<link>http://jugglingbits.wordpress.com/2010/10/04/rdf-or-not-in-gen2phen-6th-assembly-meeting/</link>
		<comments>http://jugglingbits.wordpress.com/2010/10/04/rdf-or-not-in-gen2phen-6th-assembly-meeting/#comments</comments>
		<pubDate>Mon, 04 Oct 2010 05:38:25 +0000</pubDate>
		<dc:creator>thomas11</dc:creator>
				<category><![CDATA[Academia]]></category>
		<category><![CDATA[uniprot]]></category>
		<category><![CDATA[rdf]]></category>
		<category><![CDATA[travel]]></category>
		<category><![CDATA[semanticweb]]></category>
		<category><![CDATA[gen2phen]]></category>
		<category><![CDATA[montpellier]]></category>
		<category><![CDATA[work]]></category>

		<guid isPermaLink="false">http://jugglingbits.wordpress.com/?p=368</guid>
		<description><![CDATA[This is a personal account and not necessarily my employer&#8216;s view. Until two weeks ago, I had never heard of Gen2Phen. Then my colleague Livia asked me to join her to go to their 6th general assembly meeting and present something about UniProt in RDF. Gen2Phen is a big consortium, including SIB, working on genotype-to-phenotype [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jugglingbits.wordpress.com&#038;blog=6812373&#038;post=368&#038;subd=jugglingbits&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p><em>This is a personal account and not necessarily <a href="http://www.isb-sib.ch">my employer</a>&#8216;s view.</em></p>
<p>Until two weeks ago, I had never heard of <a href="http://www.gen2phen.org">Gen2Phen</a>. Then my colleague Livia asked me to join her to go to their <a href="http://www.gen2phen.org/event/6th-general-assembly-meeting-montpellier-france">6th general assembly meeting</a> and present something about UniProt in RDF.</p>
<p>Gen2Phen is a big consortium, including SIB, working on genotype-to-phenotype information. They have two years to go in their grant, and are thinking about adopting SemWeb technologies to enhance data exchange and integration, data interpretation, and to impress funding agencies. Therefore, they invited someone&#8212;me in the end&#8212; from <a href="http://www.isb-sib.ch/">SIB</a> to speak about our experiences.</p>
<p>My presentation consisted of two parts, an introduction to RDF and why we provide it, and a tour of <a href="http://www.uniprot.org/">UniProt</a>&#8216;s RDF. I aimed for 15 minutes, and got only five to present it due to the packed schedule. So I explained the very gist of &#8220;why RDF&#8221;, showed some examples, and talked about the problems we are encountering.</p>
<p>The problems got, predictably, most attention. Semantic Web &#8220;believers&#8221; spreading the vision are plenty. Hands-on experiences with complex data sets such as UniProt&#8217;s are rarer. I need to write about this in depth at some point. Suffice it to say, I think I dampened some enthusiasm. This despite the fact that I repeatedly stressed that I think of RDF and related technologies as valuable building blocks in the bigger picture, and as clear steps forward on some problems. But the Semantic Web seems to be an all-or-nothing affair for most people.</p>
<p>Tony Brooks is right in saying that given there are only two years left to go for Gen2Phen, it might be late to start with SemWeb technology. A large modeling effort and uncertain scalability challenges could delay the benefits until it&#8217;s too late. On the other hand, it&#8217;s not that much work to start experimenting. Install Virtuoso and D2R, fire up Protege, write some RDF using Jena, and get a feeling for the whole thing. Design some RDF schema that expresses the basics of the information at the heart of Gen2Phen, and see if existing systems can add it as in- and output format. That would be my recommendation, which I might or might not have gotten across &#8212; it was a packed event about an unfamiliar project where the SemWeb was only one of many sessions, so communication was somewhat difficult.</p>
<p>The meeting as such was very nice. Good conversations and awesome food &#8212; La Maison de la Lozere in Montpellier was brilliant. So was the city itself; I enjoyed wandering around the beautiful old town.</p>
<p>One other presentation I found interesting was Gudmundur Thorisson&#8217;s about <a href="http://www.orcid.org">ORCID</a>. This initiative aims to unambiguously researchers with an ID instead of their name, which might occur many times. ORCID will then map an article&#8217;s DOI to the IDs of the authors, when it&#8217;s submitted. Also, and perhaps even more important, ORCID aims to do the same for data sets. Science really needs more, larger, better data sets in the open for people to analyze and train their algorithms on, but currently there is very little benefit for researchers to publish them. ORCID is not really functioning yet, but is backed by more than 120 organizations, and so has a decent chance at becoming the de facto norm in academia.</p>
<br />Filed under: <a href='http://jugglingbits.wordpress.com/category/academia/'>Academia</a> Tagged: <a href='http://jugglingbits.wordpress.com/tag/academia/'>Academia</a>, <a href='http://jugglingbits.wordpress.com/tag/gen2phen/'>gen2phen</a>, <a href='http://jugglingbits.wordpress.com/tag/montpellier/'>montpellier</a>, <a href='http://jugglingbits.wordpress.com/tag/rdf/'>rdf</a>, <a href='http://jugglingbits.wordpress.com/tag/semanticweb/'>semanticweb</a>, <a href='http://jugglingbits.wordpress.com/tag/travel/'>travel</a>, <a href='http://jugglingbits.wordpress.com/tag/uniprot/'>uniprot</a>, <a href='http://jugglingbits.wordpress.com/tag/work/'>work</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jugglingbits.wordpress.com/368/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jugglingbits.wordpress.com/368/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jugglingbits.wordpress.com&#038;blog=6812373&#038;post=368&#038;subd=jugglingbits&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jugglingbits.wordpress.com/2010/10/04/rdf-or-not-in-gen2phen-6th-assembly-meeting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/2a4078b8bf5d17530101db7ab2de6bfa?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif&#38;r=G" medium="image">
			<media:title type="html">thomas11</media:title>
		</media:content>
	</item>
		<item>
		<title>FrOSCamp 2010 Zuerich</title>
		<link>http://jugglingbits.wordpress.com/2010/10/01/froscamp-2010-zuerich/</link>
		<comments>http://jugglingbits.wordpress.com/2010/10/01/froscamp-2010-zuerich/#comments</comments>
		<pubDate>Fri, 01 Oct 2010 06:14:05 +0000</pubDate>
		<dc:creator>thomas11</dc:creator>
				<category><![CDATA[Presentation]]></category>
		<category><![CDATA[froscamp2010]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[rdf]]></category>

		<guid isPermaLink="false">http://jugglingbits.wordpress.com/2010/10/01/froscamp-2010-zuerich/</guid>
		<description><![CDATA[So, another one of those belated meeting/event reports: on 2010-09-17, I was in Zurich for the first-ever FrOSCamp. It was an Open Source/Free Software event with an exhibition floor, talks, and &#8220;a fancy party with creative commons licensed beer and music&#8221;&#8212;what&#8217;s not to like! I presented my &#8220;Praktisches RDF in Perl&#8221; talk that I recycled [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jugglingbits.wordpress.com&#038;blog=6812373&#038;post=367&#038;subd=jugglingbits&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>So, another one of those belated meeting/event reports: on 2010-09-17, I was in Zurich for the first-ever <a href="http://wiki.froscamp.org/Welcome">FrOSCamp</a>. It was an Open Source/Free Software event with an exhibition floor, talks, and &#8220;a fancy party with creative commons licensed beer and music&#8221;&#8212;what&#8217;s not to like!</p>
<p>I presented my &#8220;Praktisches RDF in Perl&#8221; talk that I recycled from the <a href="https://jugglingbits.wordpress.com/2010/06/20/semantic-hacking-rdf-in-perl-presentation/">German Perl Workshop</a>, to spread the word some more. This time, I had prepared an English version, but as I only had German speakers in the audience, I presented in German.</p>
<p>Unfortunately my presentation only drew a handful of people this time. Note to self: work on the abstract some more. I had suspected that my FrOSCamp one was wordy and not catchy, but didn&#8217;t get around to rewriting it. At least the audience were pretty engaged and asked lots of questions, which I prefer to a larger crowd that&#8217;s half asleep.</p>
<p>The presentation was recorded and is now <a href="http://www.multimedia.ethz.ch/conferences/2010/froscamp/?doi=10.3930/ETHZ/AV-13ff192d-43b9-4628-9ff4-6e4f69f2e01f">online as slides+audio</a>. This was a first for me. I could forget about it while presenting, but I was pretty nervous listening to it for the first time, not sure what mess of incoherent rambling and half-finished sentences to expect. Fortunately, I found it ok in the end. Of course, I found several things to improve, but I guess that&#8217;s expected for someone who doesn&#8217;t present often and is just getting started. My list of the main points to improve is:</p>
<ul>
<li>The introduction should be much shorter and more focussed. A bit like a sales pitch, not as in being obnoxious and fake, but as in focussed on getting the audience&#8217;s attention and appreciation for the topic.</li>
<li>Too many sentences didn&#8217;t flow properly. Simply doing one or two more dry runs should fix that.</li>
<li>Have some more visualizations such as diagrams on the slides.</li>
</ul>
<p>On the other hand, I was pleased with a few things about my presentation: the style of having little text on the slides and more verbal explanation worked well, the code samples seemed to be the right size to digest during a talk, and the questions at the end showed that people had gotten the key points.</p>
<p>Before my presentation, I got to see <a href="http://www.renee-baecker.de/">Renee Baecker</a>&#8216;s talk about <a href="http://search.cpan.org/perldoc?Perl::Critic">Perl::Critic</a>. I&#8217;m using it on my code and thus knew the basics, but I appreciated the advanced example towards the end, where Renee walked us through writing our own critic rules. This works via <a href="http://search.cpan.org/perldoc?PPI">PPI</a>, so you can find patterns in the AST that match the constructs you want to check. I also found it interesting to hear Renee&#8217;s personal experience with the severity levels: he&#8217;s typically on 3, sometimes 2, but 1 is too harsh.</p>
<p>Other than that, I was mainly hanging out at the Perl booth, a first for me! The booth was staffed by Renee and Roman from Winterthur (CH), two really nice guys whom I had a great time with, discussing everything from Perl modules to freelancing.</p>
<p>BTW, remember the blurb from the FrOSCamp website I quoted at the top about creative commons licensed beer? <a href="http://www.freebeer.ch/">That wasn&#8217;t a joke</a>. FreeBeer is an organic beer, produced by an independent brewery near Zurich, and the recipe is online under a CC license. And it tastes great! A cloudy, full blonde just how I like it :-)</p>
<br />Filed under: <a href='http://jugglingbits.wordpress.com/category/presentation/'>Presentation</a> Tagged: <a href='http://jugglingbits.wordpress.com/tag/froscamp2010/'>froscamp2010</a>, <a href='http://jugglingbits.wordpress.com/tag/perl/'>perl</a>, <a href='http://jugglingbits.wordpress.com/tag/presentation/'>Presentation</a>, <a href='http://jugglingbits.wordpress.com/tag/programming/'>programming</a>, <a href='http://jugglingbits.wordpress.com/tag/rdf/'>rdf</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jugglingbits.wordpress.com/367/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jugglingbits.wordpress.com/367/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jugglingbits.wordpress.com&#038;blog=6812373&#038;post=367&#038;subd=jugglingbits&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jugglingbits.wordpress.com/2010/10/01/froscamp-2010-zuerich/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/2a4078b8bf5d17530101db7ab2de6bfa?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif&#38;r=G" medium="image">
			<media:title type="html">thomas11</media:title>
		</media:content>
	</item>
		<item>
		<title>Bash history essentials</title>
		<link>http://jugglingbits.wordpress.com/2010/09/22/bash-history-essentials/</link>
		<comments>http://jugglingbits.wordpress.com/2010/09/22/bash-history-essentials/#comments</comments>
		<pubDate>Wed, 22 Sep 2010 18:39:25 +0000</pubDate>
		<dc:creator>thomas11</dc:creator>
				<category><![CDATA[Nitty Gritty]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[tools]]></category>

		<guid isPermaLink="false">http://jugglingbits.wordpress.com/2010/09/22/bash-history-essentials/</guid>
		<description><![CDATA[I&#8217;ve been using the Bash history since a long time, but in a rather limited way. I&#8217;d use the &#8220;history&#8221; command, !&#60;num&#62; to execute command again, !* to get all parameters of the last command, and Ctrl-r to match previous commands. This article by symkat showed me a lot more interesting history features. Here&#8217;s my [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jugglingbits.wordpress.com&#038;blog=6812373&#038;post=363&#038;subd=jugglingbits&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>I&#8217;ve been using the Bash history since a long time, but in a rather limited way. I&#8217;d use the &#8220;history&#8221; command, <code>!&lt;num&gt;</code> to execute command again, <code>!*</code> to get all parameters of the last command, and Ctrl-r to match previous commands.</p>
<p><a href="http://symkat.com/90/understanding-bash-history/">This article</a> by symkat showed me a lot more interesting history features.</p>
<p>Here&#8217;s my personal list of what a productive developer needs to know about Bash history:</p>
<ul>
<li><code>history</code>: Show the history in case you get lost.</li>
<li><code>!&lt;num&gt;</code>: Execute line again, where is the number shown by <code>history</code>.</li>
<li>Ctrl-p: Browse the history backwards. Also on cursor-up, but doesn&#8217;t make you leave touch typing position.</li>
<li>Ctrl-r: Search backwards. Invaluable. Matches can anchor anywhere. Pressing it repeatedly shows older matches.</li>
<li><code>!$</code>: Substitutes for the last word of the previous line. Very useful for doing something else with the same thing. For example, you might first say <code>ls -R very/long/path</code>, then <code>du !$</code> to show the directory&#8217;s size.</li>
<li>Esc-. or Alt-. (that&#8217;s Alt-PERIOD): Like <code>!$</code>, but Bash inserts the word into your current line right away, so you can check or modify it.</li>
</ul>
<p>Also, setting the HISTCONTROL environment variable to &#8220;Ignoreboth&#8221; to ignore duplicate history entries and commands starting with a space is a must.</p>
<br />Filed under: <a href='http://jugglingbits.wordpress.com/category/nitty-gritty/'>Nitty Gritty</a> Tagged: <a href='http://jugglingbits.wordpress.com/tag/bash/'>bash</a>, <a href='http://jugglingbits.wordpress.com/tag/nitty-gritty/'>Nitty Gritty</a>, <a href='http://jugglingbits.wordpress.com/tag/shell/'>shell</a>, <a href='http://jugglingbits.wordpress.com/tag/tools/'>tools</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jugglingbits.wordpress.com/363/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jugglingbits.wordpress.com/363/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jugglingbits.wordpress.com&#038;blog=6812373&#038;post=363&#038;subd=jugglingbits&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jugglingbits.wordpress.com/2010/09/22/bash-history-essentials/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/2a4078b8bf5d17530101db7ab2de6bfa?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif&#38;r=G" medium="image">
			<media:title type="html">thomas11</media:title>
		</media:content>
	</item>
		<item>
		<title>Simple Frame Initialization</title>
		<link>http://jugglingbits.wordpress.com/2010/09/11/simple-frame-initialization/</link>
		<comments>http://jugglingbits.wordpress.com/2010/09/11/simple-frame-initialization/#comments</comments>
		<pubDate>Sat, 11 Sep 2010 15:30:50 +0000</pubDate>
		<dc:creator>thomas11</dc:creator>
				<category><![CDATA[Stuff]]></category>
		<category><![CDATA[elisp]]></category>
		<category><![CDATA[emacs]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://jugglingbits.wordpress.com/2010/09/11/simple-frame-initialization/</guid>
		<description><![CDATA[Is anyone else confused by the variety and complexity of packages for Emacs session management out there? I read through some of the documentation recently, but in the end I was overwhelmed and didn&#8217;t install anything. Session management is about open files, buffer positions and the like on the one hand, and about the frame [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jugglingbits.wordpress.com&#038;blog=6812373&#038;post=358&#038;subd=jugglingbits&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Is anyone else confused by the variety and complexity of <a href="http://www.emacswiki.org/emacs/SessionManagement">packages for Emacs session management</a> out there? I read through some of the documentation recently, but in the end I was overwhelmed and didn&#8217;t install anything.</p>
<p>Session management is about open files, buffer positions and the like on the one hand, and about the frame configuration on the other hand. I realized that my actual use case for frame session management was so simple that I could trivially implement it myself.</p>
<p>All I really wanted was that my Emacs would launch in fullscreen, and split it into two or three vertical windows, depending on whether I was using the laptop screen or the larger external screen. If I could accept the two-split as default, and run a function to create the three-window setup when needed, then all I&#8217;d need were some small initialization functions.</p>
<p>Like almost everything else, Emacs exposes its window and frame handling in an ELisp API. So here we go:</p>
<pre><code>
(defun my-big-screen ()
  "Set up frame for external screen, with three windows."
  (interactive)
  (my-initialize-frame 3))

(defun my-small-screen ()
  "Set up frame for laptop screen, with two windows."
  (interactive)
  (my-initialize-frame 2))

(defun my-initialize-frame (columns)
  "Set current frame to fullscreen and split it into COLUMNS
vertical windows."
  (set-frame-parameter nil :fullscreen t)
  (delete-other-windows)
  (dotimes (not-used (1- columns))
    (split-window-horizontally))
  (balance-windows))
</code></pre>
<p>This is not rocket science and I hope it didn&#8217;t bore the Planet Emacsen readers, but maybe it encourages people to get creative with their Emacs&#8217; frames and windows. Start with the Emacs Lisp manual, chapters 28 (Windows) and 29 (Frames).</p>
<br />Filed under: <a href='http://jugglingbits.wordpress.com/category/stuff/'>Stuff</a> Tagged: <a href='http://jugglingbits.wordpress.com/tag/elisp/'>elisp</a>, <a href='http://jugglingbits.wordpress.com/tag/emacs/'>emacs</a>, <a href='http://jugglingbits.wordpress.com/tag/programming/'>programming</a>, <a href='http://jugglingbits.wordpress.com/tag/stuff/'>Stuff</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jugglingbits.wordpress.com/358/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jugglingbits.wordpress.com/358/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jugglingbits.wordpress.com&#038;blog=6812373&#038;post=358&#038;subd=jugglingbits&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jugglingbits.wordpress.com/2010/09/11/simple-frame-initialization/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/2a4078b8bf5d17530101db7ab2de6bfa?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif&#38;r=G" medium="image">
			<media:title type="html">thomas11</media:title>
		</media:content>
	</item>
		<item>
		<title>Java memory problems</title>
		<link>http://jugglingbits.wordpress.com/2010/07/09/java-memory-problems/</link>
		<comments>http://jugglingbits.wordpress.com/2010/07/09/java-memory-problems/#comments</comments>
		<pubDate>Fri, 09 Jul 2010 16:48:21 +0000</pubDate>
		<dc:creator>thomas11</dc:creator>
				<category><![CDATA[Nitty Gritty]]></category>
		<category><![CDATA[garbage-collection]]></category>
		<category><![CDATA[heap]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[memory]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://jugglingbits.wordpress.com/?p=349</guid>
		<description><![CDATA[At work, I recently wrote up a page for our internal wiki about Java memory problems and how to debug them. It&#8217;s quite simplified and short as it&#8217;s geared towards beginning or intermediate Java developers. Nevertheless it might be useful to someone out there. We first look at the most essential Java memory basics, then [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jugglingbits.wordpress.com&#038;blog=6812373&#038;post=349&#038;subd=jugglingbits&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>At work, I recently wrote up a page for our internal wiki about Java memory problems and how to debug them. It&#8217;s quite simplified and short as it&#8217;s geared towards beginning or intermediate Java developers. Nevertheless it might be useful to someone out there.</p>
<p>We first look at the most essential Java memory basics, then see how we can track down out-of-memory problems. I&#8217;ve thrown in the most useful references.</p>
<p><span id="more-349"></span></ol>
<h2>Java memory basics</h2>
<p>This section is over-simplified to keep it simple.</p>
<p>Objects are placed on a memory region called the <em>heap</em>. The size of the heap depends on the Java parameters <code>-Xms</code> for the initial size, and <code>-Xmx</code> for the maximum size; for example, <code>-Xms512m -Xmx768m</code>.</p>
<p>Objects are not needed anymore when there are no more references to them; they are <em>unreachable</em>. The Java virtual machine will clean these up and free the memory they occupied. This happens when the heap is starting to fill up, or otherwise in somewhat regular intervals, but not directly after an object becomes obsolete. <strong>Careful</strong>: This means that when you look at how much memory Java is using (see below for how to do that), the figure is only valid right after garbage collection. Otherwise, old objects are still using memory.</p>
<p>When the heap is full, but all objects on it are still needed, you run out of memory and the virtual machine gives up and throws a <code>java.lang.OutOfMemoryError</code>. There is also a variant of this exception that says &#8220;GC overhead limit exceeded&#8221;. This means that there&#8217;s a tiny bit of memory left, but garbage collection can free so little of it that it needs to kick in so soon after its last run finished that most of the program&#8217;s time is spent in garbage collection.</p>
<h3>Memory leaks</h3>
<p>You have a <em>memory leak</em> when you create objects that are never garbage collected, even after you wouldn&#8217;t need them anymore. You recognize a memory leak when your memory usage goes up and up while the load stays the same.</p>
<p>Usually, this happens when you put objects into a data structure which you keep using, such as a Map, and don&#8217;t delete or overwrite objects in that data structure once you don&#8217;t need them anymore.. You might not see any reference to your object in your code, but the data structure needs one to track its members. For instance, when using a Map as a cache to look up objects by ID, the cache will grow continuously as the Map will hold a reference to each object ever stored in it, so the garbage collection can never release anything you put in.</p>
<h3>References</h3>
<ul>
<li><a class="vt-p" href="http://java.sun.com/docs/books/performance/1st_edition/html/JPAppGC.fm.html">The Truth About Garbage Collection</a></li>
<li><a class="vt-p" href="http://java.sun.com/docs/books/jls/third_edition/html/j3TOC.html">The Java Language Specification</a></li>
</ul>
<h2>Tracking down memory problems</h2>
<p>There are two principal ways of examining the memory usage of a Java process. You can connect to the running process to observe its behavior and collect some statistics. And you can create a <em>heap dump</em>, which is basically the complete heap at a certain point in time written out to a file, and analyse it with tools. The latter is the only way to know for sure what objects are using how much memory.</p>
<h3>Examining a running Java process</h3>
<p>We&#8217;ll stick to one tool here, jconsole. There are many more out there, but jconsole is easy, versatile and part of the standard Java SDK. It connects to a running Java process via JMX.</p>
<p>Start it and choose your java process. The &#8220;Memory&#8221; tab shows the heap usage; right-click to save the numbers as CSV. Click &#8220;Perform GC&#8221; to run garbage collection before you start an operation you want to test, so your tests always start at the same base line. The &#8220;VM Summary&#8221; and &#8220;MBeans&#8221; tabs have all kinds of information. You can also create a heap dump, see the section below.</p>
<h3>Heap dumps</h3>
<p>For analysing heap dumps you can use the <a class="vt-p" href="http://www.eclipse.org/mat/">Eclipse Memory Analyzer (MAT)</a>. Get the stand-alone download as the Eclipse integration is buggy as of 2010-06.</p>
<p>There are several ways to obtain heap dumps. You should always run your Java processes with the <code>-XX:+HeapDumpOnOutOfMemoryError</code> so you can examine what ate all your memory, should this happen.</p>
<p>You can get a heap dump from a running process directly from MAT via &#8220;Acquire heap dump&#8221;. jconsole can do it, too: in the MBeans tab, select com.sun.management-&gt;HotSpotDiagnostic-&gt;Operations-&gt;dumpHeap, and click the dumpHeap button.</p>
<p>MAT is quite self-explanatory. Run the &#8220;Leak suspects&#8221; report and examine the candidates.</p>
<h3>References</h3>
<ul>
<li><a class="vt-p" href="http://java.sun.com/developer/technicalArticles/J2SE/monitoring/">Monitoring and Managing Java SE 6 Platform Applications</a></li>
<li><a class="vt-p" href="http://java.sun.com/javase/6/webnotes/trouble/TSG-VM/html/memleaks.html">Troubleshooting Memory Leaks</a></li>
</ul>
<h2>Optimizing memory usage and performance</h2>
<p>This is a complex topic, and lots could (and has been) written on it. For now, here are just some references and notes.</p>
<p>The <code>jstat</code> utility is part of the Java SDK. It prints out statistics on the console. You can use it like this: <code>jstat -gc &lt;PID&gt; 30s</code> to print out garbage collection statistics of the Java process with every 30 seconds.</p>
<h3>References</h3>
<ul>
<li><a class="vt-p" href="http://java.sun.com/performance/reference/whitepapers/tuning.html">Java Tuning White Paper</a></li>
<li><a class="vt-p" href="http://java.sun.com/javase/technologies/hotspot/gc/gc_tuning_6.html">Java SE 6 HotSpot[tm] Virtual Machine Garbage Collection Tuning</a></li>
<li><a class="vt-p" href="http://www.ibm.com/developerworks/library/j-jtp01274.html">Java theory and practice: Garbage collection and performance (very good article)</a></li>
</ul>
<br />Filed under: <a href='http://jugglingbits.wordpress.com/category/nitty-gritty/'>Nitty Gritty</a> Tagged: <a href='http://jugglingbits.wordpress.com/tag/garbage-collection/'>garbage-collection</a>, <a href='http://jugglingbits.wordpress.com/tag/heap/'>heap</a>, <a href='http://jugglingbits.wordpress.com/tag/java/'>java</a>, <a href='http://jugglingbits.wordpress.com/tag/memory/'>memory</a>, <a href='http://jugglingbits.wordpress.com/tag/nitty-gritty/'>Nitty Gritty</a>, <a href='http://jugglingbits.wordpress.com/tag/programming/'>programming</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jugglingbits.wordpress.com/349/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jugglingbits.wordpress.com/349/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jugglingbits.wordpress.com&#038;blog=6812373&#038;post=349&#038;subd=jugglingbits&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jugglingbits.wordpress.com/2010/07/09/java-memory-problems/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/2a4078b8bf5d17530101db7ab2de6bfa?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif&#38;r=G" medium="image">
			<media:title type="html">thomas11</media:title>
		</media:content>
	</item>
		<item>
		<title>Semantic hacking: RDF in Perl</title>
		<link>http://jugglingbits.wordpress.com/2010/06/20/semantic-hacking-rdf-in-perl-presentation/</link>
		<comments>http://jugglingbits.wordpress.com/2010/06/20/semantic-hacking-rdf-in-perl-presentation/#comments</comments>
		<pubDate>Sun, 20 Jun 2010 08:13:40 +0000</pubDate>
		<dc:creator>thomas11</dc:creator>
				<category><![CDATA[Presentation]]></category>
		<category><![CDATA[gpw2010]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[rdf]]></category>
		<category><![CDATA[semantic]]></category>

		<guid isPermaLink="false">http://jugglingbits.wordpress.com/2010/06/20/semantic-hacking-rdf-in-perl-presentation/</guid>
		<description><![CDATA[Last week, I attended the German Perl Workshop 2010. It was a fun event and I&#8217;ll write more on it in the next post. I gave a 20-minute presentation there called &#8220;Semantisches Hacking: RDF in Perl‎&#8221;. At Swiss-Prot, we do all our RDF work in Java, but I got interested in how things look on [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jugglingbits.wordpress.com&#038;blog=6812373&#038;post=346&#038;subd=jugglingbits&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Last week, I attended the <a href="http://conferences.yapceurope.org/gpw2010/">German Perl Workshop 2010</a>. It was a fun event and I&#8217;ll write more on it in the next post.</p>
<p>I gave a 20-minute presentation there called &#8220;Semantisches Hacking: RDF in Perl‎&#8221;. At <a href="http://www.isb-sib.ch/groups/geneva-/swiss-prot-i-xenarios.html">Swiss-Prot</a>, we do all our RDF work in Java, but I got interested in how things look on the Perl side, and the <a href="https://jugglingbits.wordpress.com/2010/03/09/biohackathon-2010/">Biohackathon</a> in February got me started on exploring that.</p>
<p>Executive summary: The RDF-in-Perl community is organized at <a href="http://www.perlrdf.org">www.perlrdf.org</a>, and the core of the available modules is <a href="http://search.cpan.org/dist/RDF-Trine/">RDF::Trine</a> and <a href="http://search.cpan.org/dist/RDF-Query/">RDF::Query</a> by Gregory Williams. For example code, have a look at <a href="">my simple demo scripts</a>.</p>
<p>At the workshop, I had an audience of about 50-100 people, none of whom had ever worked with RDF or seriously looked into it. So I first introduced RDF in the simplest way possible, as there wasn&#8217;t much time, then showed off RDF::Trine and RDF::Query with code examples.</p>
<p>The talk was well received, and I had some interesting conversations afterward where people wanted to know more about RDF. Their questions mainly centered around ontologies/vocabularies, the additional time required to do this properly, and how to build an app on top of a triple store. I had talked about integrating RDF into existing apps in my presentation, for instance using Trine&#8217;s support for RDFa, as_hashref, JSON and other possibilities.</p>
<p>Here are the links to <a href="http://github.com/thomas11/perl-rdf-talk">the slides</a> (in German), <a href="http://github.com/thomas11/perl-rdf-experiments">the scripts</a> I took the code snippets from, and the <a href="http://conferences.yapceurope.org/gpw2010/talk/2609">workshop page for the talk</a>.</p>
<p>I think I managed to raise some awareness for RDF and perlrdf.org, and an understanding of the core ideas in an audience where almost no one had had any exposure to these topics, and showed some example code in a way the audience seemed to be able to follow, so I&#8217;d say it was a success.</p>
<br />Filed under: <a href='http://jugglingbits.wordpress.com/category/presentation/'>Presentation</a> Tagged: <a href='http://jugglingbits.wordpress.com/tag/gpw2010/'>gpw2010</a>, <a href='http://jugglingbits.wordpress.com/tag/perl/'>perl</a>, <a href='http://jugglingbits.wordpress.com/tag/presentation/'>Presentation</a>, <a href='http://jugglingbits.wordpress.com/tag/rdf/'>rdf</a>, <a href='http://jugglingbits.wordpress.com/tag/semantic/'>semantic</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jugglingbits.wordpress.com/346/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jugglingbits.wordpress.com/346/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jugglingbits.wordpress.com&#038;blog=6812373&#038;post=346&#038;subd=jugglingbits&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jugglingbits.wordpress.com/2010/06/20/semantic-hacking-rdf-in-perl-presentation/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/2a4078b8bf5d17530101db7ab2de6bfa?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif&#38;r=G" medium="image">
			<media:title type="html">thomas11</media:title>
		</media:content>
	</item>
		<item>
		<title>Links, where Perl is very much alive</title>
		<link>http://jugglingbits.wordpress.com/2010/06/18/links-where-perl-is-very-much-alive/</link>
		<comments>http://jugglingbits.wordpress.com/2010/06/18/links-where-perl-is-very-much-alive/#comments</comments>
		<pubDate>Fri, 18 Jun 2010 06:17:22 +0000</pubDate>
		<dc:creator>thomas11</dc:creator>
				<category><![CDATA[Elsewhere]]></category>
		<category><![CDATA[links]]></category>
		<category><![CDATA[perl]]></category>

		<guid isPermaLink="false">http://jugglingbits.wordpress.com/?p=338</guid>
		<description><![CDATA[Yeah, I guess my weekly links effort didn&#8217;t go so well. Nevertheless, I do still collect interesting links, so let&#8217;s restart with a less ambitious irregular series of &#8220;Links&#8221; posts. Many programmers today consider Perl to be dying. That is because they read too many shiny new Ruby and Javascript blogs, instead of checking out [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jugglingbits.wordpress.com&#038;blog=6812373&#038;post=338&#038;subd=jugglingbits&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Yeah, I guess my weekly links effort didn&#8217;t go so well. Nevertheless, I do still collect interesting links, so let&#8217;s restart with a less ambitious irregular series of &#8220;Links&#8221; posts.</p>
<p>Many programmers today consider Perl to be dying. That is because they read too many shiny new Ruby and Javascript blogs, instead of checking out what the Perl community is actually up to. Damian Conway <a href="http://www.oreillygmt.co.uk/2010/05/damian-conway-on-perl-and-its-future.html">says it way better than I could</a>.</p>
<p>The slogan of the day, of recent years actually, in the Perl world <a href="http://www.enlightenedperl.org/">is</a> <a href="http://search.cpan.org/dist/Modern-Perl/lib/Modern/Perl.pm">Modern</a> <a href="http://conferences.yapceurope.org/gpw2010/">Perl</a>. Once you&#8217;re ready to get started yourself, get brian d foy&#8217;s timely new <a href="http://www.amazon.com/Effective-Perl-Programming-Idiomatic-Development/dp/0321496949/ref=sr_1_1?ie=UTF8&amp;s=books&amp;qid=1275145369&amp;sr=1-1">Effective Perl Programming</a>.</p>
<p>And if you miss the good old days of obfuscated Perl, see the nice <a href="http://stackoverflow.com/questions/161872/hidden-features-of-perl#163481">Hidden features of Perl</a> collection. You will also find some serious, readable and useful tricks.</p>
<br />Filed under: <a href='http://jugglingbits.wordpress.com/category/elsewhere/'>Elsewhere</a> Tagged: <a href='http://jugglingbits.wordpress.com/tag/elsewhere/'>Elsewhere</a>, <a href='http://jugglingbits.wordpress.com/tag/links/'>links</a>, <a href='http://jugglingbits.wordpress.com/tag/perl/'>perl</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jugglingbits.wordpress.com/338/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jugglingbits.wordpress.com/338/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jugglingbits.wordpress.com&#038;blog=6812373&#038;post=338&#038;subd=jugglingbits&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jugglingbits.wordpress.com/2010/06/18/links-where-perl-is-very-much-alive/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/2a4078b8bf5d17530101db7ab2de6bfa?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif&#38;r=G" medium="image">
			<media:title type="html">thomas11</media:title>
		</media:content>
	</item>
		<item>
		<title>Announcing delim-kill.el</title>
		<link>http://jugglingbits.wordpress.com/2010/05/16/announcing-delim-kill-el/</link>
		<comments>http://jugglingbits.wordpress.com/2010/05/16/announcing-delim-kill-el/#comments</comments>
		<pubDate>Sun, 16 May 2010 19:02:27 +0000</pubDate>
		<dc:creator>thomas11</dc:creator>
				<category><![CDATA[Own Code]]></category>
		<category><![CDATA[editing]]></category>
		<category><![CDATA[elisp]]></category>
		<category><![CDATA[emacs]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://jugglingbits.wordpress.com/2010/05/16/announcing-delim-kill-el/</guid>
		<description><![CDATA[A few weeks ago, I had the chance to attend a few courses on Perl and one on giving technical presentations, held by Perl guru and uber-geek Damien Conway. They were fantastic&#8212;just like the ones last year&#8212;so I should really write a post of its own about them. Strongly recommended. But for now, this is [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jugglingbits.wordpress.com&#038;blog=6812373&#038;post=334&#038;subd=jugglingbits&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>A few weeks ago, I had the chance to attend a few courses on Perl and one on giving technical presentations, held by Perl guru and uber-geek <a href="http://en.wikipedia.org/wiki/Damian_Conway">Damien Conway</a>. They were fantastic&#8212;just like the ones last year&#8212;so I should really write a post of its own about them. Strongly recommended.</p>
<p>But for now, this is about one particular thing he said about editing: you need to have a shortcut in your editor that cuts or copies the text between two given characters around cursor, or point in Emacs lingo. This lets you do many frequent editing tasks easily. Say you&#8217;re going through a source file and want to move <code>{}</code>-delimited blocks around, or copy the field you&#8217;re on in a CSV file, or the current section in a Markdown file (from <code>#</code> to the next <code>#</code>, roughly).</p>
<p>Damian showed this off in Vim. I knew right away that I wanted it in Emacs. There are of course specialized functions for doing things with certain groups of delimiters, such as the ubiquitous sexp-based functions in Emacs, <a href="http://www.emacswiki.org/emacs/NavigatingParentheses">described</a> <a href="http://www.emacswiki.org/emacs/ParenthesisMatching">extensively</a> on the EmacsWiki. But these rely on pre-configured groups of delimiters, and to kill the text, you have to do one extra operation. I liked the idea of having a single function, and thus key binding, to do all of it. And most importantly, it seemed an interesting challenge for my still-developing Emacs and Lisp skills, so I didn&#8217;t even do a lot of research before I dug right in and wrote <a href="http://github.com/thomas11/delim-kill">delim-kill.el</a>.</p>
<blockquote><p> delim-kill.el contains a single convenience function for editing structured data: delim-kill. Given two characters FROM and TO, delim-kill kills the text between the first occurrence of FROM before point and the first occurrence of TO after point. FROM and TO may be identical.</p>
<p>If FROM and TO are not identical, the function preserves the balance between the two characters: For each FROM that is encountered while looking for TO, one additional TO is required; and vice versa. For example, in &#8220;{ foo X{bar} baz }&#8221;, with X being point and &#8220;{&#8221; and &#8220;}&#8221; as delimiters, the text &#8220;{ foo {bar} baz }&#8221; will be killed, not &#8220;{ foo {bar}&#8221;.
</p></blockquote>
<p>I had fun writing this. It turned out to be a bit harder than I expected, mainly due to all the corner cases like point being on one of the delimiters&#8212;like most programming, really. I wrote plenty of unit tests to be sure to handle these cases. It&#8217;s very little code now, but when I first had a working version, it was twice as big. Once I had it working, I could see lots of symmetry between the different cases that I could extract into shared code.</p>
<p>Also, I finally learned the condition-case error handling of Emacs. And being able to pass functions as arguments is just great, coming from my mostly-Java day job.</p>
<p>Try it out if it sounds useful to you, and let me know what you think.</p>
<p><em>Slightly edited 2010-05-16.</em></p>
<br />Filed under: <a href='http://jugglingbits.wordpress.com/category/own-code/'>Own Code</a> Tagged: <a href='http://jugglingbits.wordpress.com/tag/editing/'>editing</a>, <a href='http://jugglingbits.wordpress.com/tag/elisp/'>elisp</a>, <a href='http://jugglingbits.wordpress.com/tag/emacs/'>emacs</a>, <a href='http://jugglingbits.wordpress.com/tag/own-code/'>Own Code</a>, <a href='http://jugglingbits.wordpress.com/tag/programming/'>programming</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jugglingbits.wordpress.com/334/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jugglingbits.wordpress.com/334/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jugglingbits.wordpress.com&#038;blog=6812373&#038;post=334&#038;subd=jugglingbits&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jugglingbits.wordpress.com/2010/05/16/announcing-delim-kill-el/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/2a4078b8bf5d17530101db7ab2de6bfa?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif&#38;r=G" medium="image">
			<media:title type="html">thomas11</media:title>
		</media:content>
	</item>
	</channel>
</rss>
