<?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>/home/ilja/</title>
	<atom:link href="http://homeilja.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://homeilja.wordpress.com</link>
	<description>Computer science, programming, web development, etc.</description>
	<lastBuildDate>Wed, 14 Oct 2009 02:03:03 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='homeilja.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>/home/ilja/</title>
		<link>http://homeilja.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://homeilja.wordpress.com/osd.xml" title="/home/ilja/" />
	<atom:link rel='hub' href='http://homeilja.wordpress.com/?pushpress=hub'/>
		<item>
		<title>How to automatically send mails of portage elogs using ssmtp</title>
		<link>http://homeilja.wordpress.com/2009/10/14/how-to-automatically-send-mails-of-portage-elogs-using-ssmtp/</link>
		<comments>http://homeilja.wordpress.com/2009/10/14/how-to-automatically-send-mails-of-portage-elogs-using-ssmtp/#comments</comments>
		<pubDate>Wed, 14 Oct 2009 01:22:57 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[Computer science]]></category>
		<category><![CDATA[Gentoo]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[cat]]></category>
		<category><![CDATA[compilation]]></category>
		<category><![CDATA[conky]]></category>
		<category><![CDATA[elog]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[emerge]]></category>
		<category><![CDATA[log]]></category>
		<category><![CDATA[make.conf]]></category>
		<category><![CDATA[package]]></category>
		<category><![CDATA[portage]]></category>
		<category><![CDATA[ssmtp]]></category>

		<guid isPermaLink="false">http://homeilja.wordpress.com/?p=55</guid>
		<description><![CDATA[If you&#8217;re updating your Gentoo system less frequently, then emerge takes usually a lot of time. During the compilation portage prints some important infos into the console. To not miss them you could read the logs or you can let ssmtp send you an email every time a package compilation is finished. To do this [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=homeilja.wordpress.com&amp;blog=9770710&amp;post=55&amp;subd=homeilja&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re updating your Gentoo system less frequently, then emerge takes usually a lot of time. During the compilation portage prints some important infos into the console. To not miss them you could read the logs or you can let ssmtp send you an email every time a package compilation is finished. To do this add the following code to your <em>/etc/make.conf</em>:</p>
<p><pre class="brush: bash;">
PORTAGE_ELOG_SYSTEM=&quot;save mail&quot;
PORTAGE_ELOG_CLASSES=&quot;warn error log info&quot;
PORTAGE_ELOG_MAILURI=&quot;email@example.com /usr/sbin/ssmtp&quot;
PORTAGE_ELOG_MAILFROM=&quot;email@example.com&quot;
PORTAGE_ELOG_MAILSUBJECT=&quot;The package \${PACKAGE} was successfully compiled on your computer&quot;
</pre></p>
<p>Now portage will send all <em>warn</em>, <em>error</em>, <em>log</em> and <em>info</em> messages to <em>email@example.com</em>. If not done so far, you should probably emerge and configure ssmtp first:</p>
<p><pre class="brush: bash;">
ilja@ilja ~ $ emerge -av ssmtp

ilja@ilja ~ $ cat /etc/ssmtp/ssmtp.conf
root=email@example.com
mailhub=smtp.example.com:465
rewriteDomain=mail.example.com
hostname=smtp.example.com
FromLineOverride=YES
UseTLS=YES
AuthUser=email@example.com
AuthPass=MySecretPassword
</pre></p>
<p>Here is an example email sent by portage:</p>
<p><pre class="brush: plain;">
Subject: The package app-admin/conky-1.6.1 was successfully compiled on your computer
From: email@example.com
Date: Wed, 14 Oct 2009 03:06:17 +0200
To: email@example.com

INFO: prepare
Applying conky-1.6.1-stdio.patch ...

LOG: postinst
You can find the sample configuration file at
/etc/conky/conky.conf.  To customize it, copy
/etc/conky/conky.conf to ~/.conkyrc and edit
it to your liking.

For more info on Conky's new features,
please look at the README and ChangeLog:
/usr/share/doc/conky-1.6.1/README.bz2
/usr/share/doc/conky-1.6.1/ChangeLog.bz2
There are also pretty html docs available
on Conky's site or in /usr/share/doc/conky-1.6.1

Also see http://www.gentoo.org/doc/en/conky-howto.xml

Vim syntax highlighting for conkyrc now enabled with
USE=vim-syntax, for Nano with USE=nano-syntax
</pre></p>
<br />Posted in Computer science, Gentoo, Linux Tagged: cat, compilation, conky, elog, email, emerge, Gentoo, Linux, log, make.conf, package, portage, ssmtp <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/homeilja.wordpress.com/55/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/homeilja.wordpress.com/55/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/homeilja.wordpress.com/55/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/homeilja.wordpress.com/55/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/homeilja.wordpress.com/55/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/homeilja.wordpress.com/55/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/homeilja.wordpress.com/55/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/homeilja.wordpress.com/55/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/homeilja.wordpress.com/55/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/homeilja.wordpress.com/55/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/homeilja.wordpress.com/55/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/homeilja.wordpress.com/55/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/homeilja.wordpress.com/55/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/homeilja.wordpress.com/55/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=homeilja.wordpress.com&amp;blog=9770710&amp;post=55&amp;subd=homeilja&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://homeilja.wordpress.com/2009/10/14/how-to-automatically-send-mails-of-portage-elogs-using-ssmtp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0eb9124c298c6a22ea4bba5ded02b69d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ilja</media:title>
		</media:content>
	</item>
		<item>
		<title>Upload images to imageshack using bash</title>
		<link>http://homeilja.wordpress.com/2009/10/14/upload-images-to-imageshack-using-bash/</link>
		<comments>http://homeilja.wordpress.com/2009/10/14/upload-images-to-imageshack-using-bash/#comments</comments>
		<pubDate>Tue, 13 Oct 2009 23:48:14 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[Computer science]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[curl]]></category>
		<category><![CDATA[find]]></category>
		<category><![CDATA[for]]></category>
		<category><![CDATA[grep]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[images]]></category>
		<category><![CDATA[imageshack]]></category>
		<category><![CDATA[imageshack.us]]></category>
		<category><![CDATA[parse]]></category>
		<category><![CDATA[pastebin]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[upload]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://homeilja.wordpress.com/?p=49</guid>
		<description><![CDATA[Found a nice little script on mroddball.wordpress.com. It uses curl to upload images to ImageShack: If you invoke the above command the image will be uploaded and you get an xml file like this: You can use grep to parse the image link from the xml file: You could also use find, for etc. to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=homeilja.wordpress.com&amp;blog=9770710&amp;post=49&amp;subd=homeilja&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Found a nice little script on <a title="Mroddball" href="http://mroddball.wordpress.com/2009/10/13/upload-images-to-imageshack-from-command-line/" target="_blank">mroddball.wordpress.com</a>. It uses curl to upload images to <a title="ImageShack" href="http://imageshack.us/" target="_blank">ImageShack</a>:</p>
<p><pre class="brush: bash;">curl -H Expect: -F fileupload=&quot;@example.jpg&quot; -F xml=yes -# &quot;http://www.imageshack.us/index.php&quot;
</pre></p>
<p>If you invoke the above command the image will be uploaded and you get an xml file like this:</p>
<p><pre class="brush: xml;">&lt;?xml version=&quot;1.0&quot; encoding=&quot;iso-8859-1&quot;?&gt;&lt;links&gt;
    &lt;image_link&gt;http://img123.imageshack.us/img123/4567/example.jpg &lt;/image_link&gt;
    &lt;thumb_link&gt;http://img123.imageshack.us/img123/4567/example.th.jpg &lt;/thumb_link&gt;
    &lt;ad_link&gt;http://img123.imageshack.us/my.php?image=example.jpg &lt;/ad_link&gt;
    &lt;thumb_exists&gt;no&lt;/thumb_exists&gt;
    &lt;total_raters&gt;0&lt;/total_raters&gt;
    &lt;ave_rating&gt;0.0&lt;/ave_rating&gt;
    &lt;image_location&gt;img123/4567/example.jpg&lt;/image_location&gt;
    &lt;thumb_location&gt;img123/4567/example.th.jpg&lt;/thumb_location&gt;
    &lt;server&gt;img123&lt;/server&gt;
    &lt;image_name&gt;bricks.jpg&lt;/image_name&gt;
    &lt;done_page&gt;http://img123.imageshack.us/content.php?page=done&amp;amp;l=img123/4567/example.jpg&lt;/done_page&gt;
    &lt;resolution&gt;64x64&lt;/resolution&gt;
    &lt;filesize&gt;11771&lt;/filesize&gt;
    &lt;image_class&gt;r&lt;/image_class&gt;
&lt;/links&gt;
</pre></p>
<p>You can use <em>grep</em> to parse the image link from the xml file:</p>
<p><pre class="brush: bash;">curl -H Expect: -F fileupload=&quot;@example.jpg&quot; -F xml=yes -# &quot;http://www.imageshack.us/index.php&quot; | grep image_link | grep -o  http[^\&lt;]*
</pre></p>
<p>You could also use <em>find</em>, <em>for</em> etc. to upload as many pictures as you like at the same time. The whole script is located on <a title="ImageShack script on pastebin" href="http://pastebin.com/f46bd93ab" target="_blank">pastebin</a>. Visit <a title="Mroddball" href="http://mroddball.wordpress.com/2009/10/13/upload-images-to-imageshack-from-command-line/" target="_blank">mroddball.wordpress.com</a> for further information.</pre>
<br />Posted in Computer science, Linux Tagged: bash, curl, find, for, grep, image, images, imageshack, imageshack.us, Linux, parse, pastebin, script, upload, xml <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/homeilja.wordpress.com/49/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/homeilja.wordpress.com/49/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/homeilja.wordpress.com/49/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/homeilja.wordpress.com/49/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/homeilja.wordpress.com/49/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/homeilja.wordpress.com/49/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/homeilja.wordpress.com/49/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/homeilja.wordpress.com/49/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/homeilja.wordpress.com/49/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/homeilja.wordpress.com/49/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/homeilja.wordpress.com/49/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/homeilja.wordpress.com/49/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/homeilja.wordpress.com/49/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/homeilja.wordpress.com/49/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=homeilja.wordpress.com&amp;blog=9770710&amp;post=49&amp;subd=homeilja&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://homeilja.wordpress.com/2009/10/14/upload-images-to-imageshack-using-bash/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0eb9124c298c6a22ea4bba5ded02b69d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ilja</media:title>
		</media:content>
	</item>
		<item>
		<title>PhotoSketch: Internet Image Montage</title>
		<link>http://homeilja.wordpress.com/2009/10/09/photosketch-internet-image-montage/</link>
		<comments>http://homeilja.wordpress.com/2009/10/09/photosketch-internet-image-montage/#comments</comments>
		<pubDate>Fri, 09 Oct 2009 03:15:08 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[Computer science]]></category>
		<category><![CDATA[background]]></category>
		<category><![CDATA[blending]]></category>
		<category><![CDATA[CIELUV]]></category>
		<category><![CDATA[cluster]]></category>
		<category><![CDATA[clustering]]></category>
		<category><![CDATA[color]]></category>
		<category><![CDATA[composition]]></category>
		<category><![CDATA[computation]]></category>
		<category><![CDATA[contour]]></category>
		<category><![CDATA[Converting]]></category>
		<category><![CDATA[dilation]]></category>
		<category><![CDATA[discard]]></category>
		<category><![CDATA[ellipse]]></category>
		<category><![CDATA[flickr]]></category>
		<category><![CDATA[freehand]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[grabcut]]></category>
		<category><![CDATA[histogram]]></category>
		<category><![CDATA[horizon line]]></category>
		<category><![CDATA[labels]]></category>
		<category><![CDATA[PhotoSketch]]></category>
		<category><![CDATA[pictures]]></category>
		<category><![CDATA[realistic]]></category>
		<category><![CDATA[segmentation]]></category>
		<category><![CDATA[separation]]></category>
		<category><![CDATA[shape]]></category>
		<category><![CDATA[sketch]]></category>
		<category><![CDATA[Tsinghua University]]></category>
		<category><![CDATA[yahoo]]></category>

		<guid isPermaLink="false">http://homeilja.wordpress.com/?p=40</guid>
		<description><![CDATA[PhotoSketch is a system created by Chinese students. It automatically composes simple freehand sketches into realistic pictures. How it works: Step 1: The user draws simple items on the screen. Every item can be drawn as a shape contour or an ellipse, which is the default. All items and the background must be annotated with [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=homeilja.wordpress.com&amp;blog=9770710&amp;post=40&amp;subd=homeilja&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>PhotoSketch is a system created by Chinese students. It automatically composes simple freehand sketches into realistic pictures.</p>
<div id="attachment_41" class="wp-caption alignnone" style="width: 710px"><img class="size-full wp-image-41" title="PhotoSketch" src="http://homeilja.files.wordpress.com/2009/10/photosketch.jpg?w=700&#038;h=217" alt="PhotoSketch pipeline" width="700" height="217" /><p class="wp-caption-text">PhotoSketch pipeline (Source: Tsinghua University)</p></div>
<p>How it works:</p>
<p><strong>Step 1:</strong> The user draws simple items on the screen. Every item can be drawn as a shape contour or an ellipse, which is the default. All items and the background must be annotated with text labels, so that the system knows how to interpret the figures.</p>
<p><strong>Step 2:</strong> The system searches the Internet (currently flickr, google and yahoo) for pictures applicable to the given text labels and downloads a lot of them.</p>
<p><strong>Step 3:</strong> Now the system tries to exclude false discoveries and chooses the most fitting pictures:</p>
<p style="padding-left:30px;"><strong>Choosing appropriate background pictures:</strong><br />
The first approach is to cluster all pictures by its <a title="CIELUV color space" href="http://en.wikipedia.org/wiki/CIELUV_color_space" target="_blank">L*, u*, v*</a> histograms. All pictures in the biggest cluster will be used for the next step. Example: If the user did annotate the background as &#8220;beach&#8221;, then the pictures should mostly consist of yellow and blue colors. Therefore these pictures should be all together in the biggest cluster. All pictures with much red or green will be divided into smaller clusters and thus they will be excluded. The next approach ensures that the horizon lines in the pictures are aligned well. Finally a <a title="Segmentation" href="http://en.wikipedia.org/wiki/Segmentation_%28image_processing%29" target="_blank">segmentation</a> algorithm tests how many segments of the background pictures are covered by the items. The lesser the better.</p>
<p style="padding-left:30px;"><strong>Choosing appropriate item pictures:</strong><br />
The first approach is to discard all pictures with complicated backgrounds, because in these pictures the separation of the figure from the background is hard to accomplish. Next the items  will be segmented. This will be done by iteratively applying dilation and a <a title="Grabcut" href="http://en.wikipedia.org/wiki/Grabcut" target="_blank">grabcut</a> algorithm until the result or the computation limit is reached. The segmented pictures will then be compared with the item shapes drawn by the user to get all pictures that match the shape best. Finally the pictures will be clustered to get only the consistent ones.</p>
<p style="padding-left:30px;">
<p><strong>Step 4:</strong> The images are composed seamlessly into several compositions by a novel self-made <a title="Alpha compositing" href="http://en.wikipedia.org/wiki/Alpha_compositing" target="_blank">blending</a> method. The user can then choose the best one and refine the composition.</p>
<p>In the experiments (&#8220;two PCs with 2.66 GHz Quad core CPUs and 6 GB RAM&#8221;) the total computation took about 15*n+5 minutes (n = number of items). To compute a full scene with e.g. 6 items it takes about 95 minutes beginning with downloading of the pictures till the composition arrives. With a slow Internet connection it would probably take much longer to download all the pictures. But I think it pays off. Can&#8217;t wait to try it out.</p>
<p>More info and the paper can be found <a title="PhotoSketch" href="http://cg.cs.tsinghua.edu.cn/montage/main.htm" target="_blank"><strong>here</strong></a>.</p>
<br />Posted in Computer science Tagged: background, blending, CIELUV, cluster, clustering, color, composition, computation, contour, Converting, dilation, discard, ellipse, flickr, freehand, Google, grabcut, histogram, horizon line, labels, PhotoSketch, pictures, realistic, segmentation, separation, shape, sketch, Tsinghua University, yahoo <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/homeilja.wordpress.com/40/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/homeilja.wordpress.com/40/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/homeilja.wordpress.com/40/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/homeilja.wordpress.com/40/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/homeilja.wordpress.com/40/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/homeilja.wordpress.com/40/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/homeilja.wordpress.com/40/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/homeilja.wordpress.com/40/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/homeilja.wordpress.com/40/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/homeilja.wordpress.com/40/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/homeilja.wordpress.com/40/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/homeilja.wordpress.com/40/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/homeilja.wordpress.com/40/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/homeilja.wordpress.com/40/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=homeilja.wordpress.com&amp;blog=9770710&amp;post=40&amp;subd=homeilja&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://homeilja.wordpress.com/2009/10/09/photosketch-internet-image-montage/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0eb9124c298c6a22ea4bba5ded02b69d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ilja</media:title>
		</media:content>

		<media:content url="http://homeilja.files.wordpress.com/2009/10/photosketch.jpg" medium="image">
			<media:title type="html">PhotoSketch</media:title>
		</media:content>
	</item>
		<item>
		<title>How to get your external IP address using bash</title>
		<link>http://homeilja.wordpress.com/2009/10/08/how-to-get-your-external-ip-address-using-bash/</link>
		<comments>http://homeilja.wordpress.com/2009/10/08/how-to-get-your-external-ip-address-using-bash/#comments</comments>
		<pubDate>Thu, 08 Oct 2009 13:29:11 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[adress]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[checkip]]></category>
		<category><![CDATA[external]]></category>
		<category><![CDATA[grep]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[ifconfig]]></category>
		<category><![CDATA[IP]]></category>
		<category><![CDATA[parse]]></category>
		<category><![CDATA[router]]></category>
		<category><![CDATA[wget]]></category>

		<guid isPermaLink="false">http://homeilja.wordpress.com/?p=34</guid>
		<description><![CDATA[If you are behind a router, ifconfig won&#8217;t give you your external IP address. As a possible solution you can (w)get it from http://checkip.dyndns.org/ and grep your external IP from the html file: Posted in Linux Tagged: adress, bash, checkip, external, grep, html, ifconfig, IP, Linux, parse, router, wget<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=homeilja.wordpress.com&amp;blog=9770710&amp;post=34&amp;subd=homeilja&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>If you are behind a router, <a title="ifconfig manpage" href="http://linux.die.net/man/8/ifconfig" target="_blank">ifconfig</a> won&#8217;t give you your external IP address. As a possible solution you can (w)get it from <a title="http://checkip.dyndns.org/" href="http://checkip.dyndns.org/" target="_blank">http://checkip.dyndns.org/</a> and grep your external IP from the html file:<br />
<pre class="brush: bash;"> wget http://checkip.dyndns.org/ -qO - | grep -Eo '\&lt;[[:digit:]]{1,3}(\.[[:digit:]]{1,3}){3}\&gt;'
</pre></p>
<br />Posted in Linux Tagged: adress, bash, checkip, external, grep, html, ifconfig, IP, Linux, parse, router, wget <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/homeilja.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/homeilja.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/homeilja.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/homeilja.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/homeilja.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/homeilja.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/homeilja.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/homeilja.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/homeilja.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/homeilja.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/homeilja.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/homeilja.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/homeilja.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/homeilja.wordpress.com/34/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=homeilja.wordpress.com&amp;blog=9770710&amp;post=34&amp;subd=homeilja&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://homeilja.wordpress.com/2009/10/08/how-to-get-your-external-ip-address-using-bash/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0eb9124c298c6a22ea4bba5ded02b69d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ilja</media:title>
		</media:content>
	</item>
		<item>
		<title>Converting date string to Date</title>
		<link>http://homeilja.wordpress.com/2009/10/07/converting-date-string-to-date/</link>
		<comments>http://homeilja.wordpress.com/2009/10/07/converting-date-string-to-date/#comments</comments>
		<pubDate>Wed, 07 Oct 2009 05:20:01 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Converting]]></category>
		<category><![CDATA[Date]]></category>
		<category><![CDATA[Javadoc]]></category>
		<category><![CDATA[pattern]]></category>
		<category><![CDATA[pitfalls]]></category>
		<category><![CDATA[SimpleDateFormat]]></category>

		<guid isPermaLink="false">http://homeilja.wordpress.com/?p=28</guid>
		<description><![CDATA[Let&#8217;s assume you got a date representing as a String e.g. 2009-04-23T11:07:00. Now you want to convert this String into a Date object. This could be done by the class SimpleDateFormat. To use this class you have to pass the date and time format specified by a pattern string. All the possible pattern letters and [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=homeilja.wordpress.com&amp;blog=9770710&amp;post=28&amp;subd=homeilja&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Let&#8217;s assume you got a date representing as a String e.g. <em>2009-04-23T11:07:00</em>. Now you want to convert this String into a Date object. This could be done by the class <a title="SimpleDateFormat" href="http://java.sun.com/javase/6/docs/api/java/text/SimpleDateFormat.html" target="_blank">SimpleDateFormat</a>. To use this class you have to pass the date and time format specified by a pattern string. All the possible pattern letters and some examples could be found on the <a title="Javadoc SimpleDateFormat" href="http://java.sun.com/javase/6/docs/api/java/text/SimpleDateFormat.html" target="_blank">Javadoc site</a>.</p>
<p>Here is a simple example:</p>
<p><pre class="brush: java;"> final String dateFormatString = &quot;yyyy-MM-dd'T'HH:mm:ss&quot;;
 final SimpleDateFormat sdf = new SimpleDateFormat(dateFormatString);
 final Date date = sdf.parse(&quot;2009-04-23T11:07:00&quot;)
</pre></p>
<p>If you use SimpleDateFormat then you should probably consider some <a title="SimpleDateFormat pitfalls" href="http://eyalsch.wordpress.com/2009/05/29/sdf/" target="_blank">pitfalls</a>.</p>
<br />Posted in Java Tagged: Converting, Date, Java, Javadoc, pattern, pitfalls, SimpleDateFormat <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/homeilja.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/homeilja.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/homeilja.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/homeilja.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/homeilja.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/homeilja.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/homeilja.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/homeilja.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/homeilja.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/homeilja.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/homeilja.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/homeilja.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/homeilja.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/homeilja.wordpress.com/28/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=homeilja.wordpress.com&amp;blog=9770710&amp;post=28&amp;subd=homeilja&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://homeilja.wordpress.com/2009/10/07/converting-date-string-to-date/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0eb9124c298c6a22ea4bba5ded02b69d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ilja</media:title>
		</media:content>
	</item>
		<item>
		<title>Persisting Java Beans into RDF (The easy way)</title>
		<link>http://homeilja.wordpress.com/2009/10/07/persisting-java-beans-into-rdf-the-easy-way/</link>
		<comments>http://homeilja.wordpress.com/2009/10/07/persisting-java-beans-into-rdf-the-easy-way/#comments</comments>
		<pubDate>Wed, 07 Oct 2009 01:34:59 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Semantic Web]]></category>
		<category><![CDATA[Bean]]></category>
		<category><![CDATA[Jena]]></category>
		<category><![CDATA[jenabean]]></category>
		<category><![CDATA[Maven]]></category>
		<category><![CDATA[N-Triples]]></category>
		<category><![CDATA[N3]]></category>
		<category><![CDATA[POM]]></category>
		<category><![CDATA[RDF]]></category>
		<category><![CDATA[RDF/XML]]></category>
		<category><![CDATA[SPARQL]]></category>

		<guid isPermaLink="false">http://homeilja.wordpress.com/?p=19</guid>
		<description><![CDATA[RDF is the common structure in the Semantic Web to describe and model information in the web. It can be described in diverse syntax formats like RDF/XML, N3 and N-Triples. All these formats are plain text. If you want to use RDF in Java there are some nice Semantic Web frameworks like Jena. With Jena [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=homeilja.wordpress.com&amp;blog=9770710&amp;post=19&amp;subd=homeilja&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a title="RDF" href="http://www.w3.org/RDF/" target="_blank">RDF</a> is the common structure in the <a title="Semantic Web" href="http://www.w3.org/2001/sw/" target="_blank">Semantic Web</a> to describe and model information in the web. It can be described in diverse syntax formats like RDF/XML, N3 and N-Triples. All these formats are plain text. If you want to use RDF in Java there are some nice Semantic Web frameworks like <a title="Jena" href="http://jena.sourceforge.net/" target="_blank">Jena</a>. With Jena you can read RDF data, make some computation on that data and finally write the resulting data into RDF.</p>
<p>Nevertheless you can not easily convert your Java Beans into RDF with Jena. There is mostly hard work to do this. But there is a solution: <a title="jenabean" href="http://code.google.com/p/jenabean/" target="_blank">jenabean</a>. Jenabean is an easy to use Beans to RDF converter using Jena. To use jenabeans in your project just add this dependency to your Maven POM file:</p>
<p><pre class="brush: xml;"> &lt;dependency&gt;
    &lt;groupId&gt;com.thewebsemantic&lt;/groupId&gt;
    &lt;artifactId&gt;jenabean&lt;/artifactId&gt;
    &lt;version&gt;1.0.1&lt;/version&gt;
 &lt;/dependency&gt;
</pre></p>
<p>You should also add this Maven repository to your POM file:</p>
<p><pre class="brush: xml;"> &lt;repository&gt;
    &lt;id&gt;Jenabean&lt;/id&gt;
    &lt;url&gt;http://jenabean.googlecode.com/svn/trunk/repo &lt;/url&gt;
 &lt;/repository&gt;</pre></p>
<p>Let&#8217;s assume we want to persist this Java Bean into RDF:</p>
<p><pre class="brush: java;"> @Namespace(&quot;http://example.org/blog&quot;)
public class Blog {
    @Id private String id;
    private List&lt;Publisher&gt; publisher;
    private String title;
    private List&lt;BlogEntry&gt; blogEntries;
    private String link;
}
</pre></p>
<p>As you can see, I already used two annotations from jenabean. The meanings of these annotations should be self explainable. Read the <a title="jenabean wiki" href="http://code.google.com/p/jenabean/w/list" target="_blank">jenabean wiki</a> to get more explanation to this.</p>
<p>Now let&#8217;s persist the bean into RDF:</p>
<p><pre class="brush: java;">public void saveAsRDF(final Blog blog) {
    final OntModel m = ModelFactory.createOntologyModel();
    final Bean2RDF writer = new Bean2RDF(m);
    writer.save(blog);
    m.write(System.out);
}
</pre></p>
<p>In this example the RDF was written to System.out. You can also write it into the file system. Or if you like you can write the data back to the Java Bean representation:</p>
<p><pre class="brush: java;"> final RDF2Bean reader = new RDF2Bean(m);
 final Collection&lt;Blog&gt; blog2 = reader.load(Blog.class);
</pre></p>
<p>You could also run a <a title="SPARQL" href="http://www.w3.org/TR/rdf-sparql-query/" target="_blank">SPARQL</a> query against this model. You should consult the jenabean wiki to get more into this.</p>
<br />Posted in Java, Semantic Web Tagged: Bean, Java, Jena, jenabean, Maven, N-Triples, N3, POM, RDF, RDF/XML, Semantic Web, SPARQL <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/homeilja.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/homeilja.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/homeilja.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/homeilja.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/homeilja.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/homeilja.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/homeilja.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/homeilja.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/homeilja.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/homeilja.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/homeilja.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/homeilja.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/homeilja.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/homeilja.wordpress.com/19/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=homeilja.wordpress.com&amp;blog=9770710&amp;post=19&amp;subd=homeilja&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://homeilja.wordpress.com/2009/10/07/persisting-java-beans-into-rdf-the-easy-way/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0eb9124c298c6a22ea4bba5ded02b69d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ilja</media:title>
		</media:content>
	</item>
		<item>
		<title>How to add external jar files into your Maven project</title>
		<link>http://homeilja.wordpress.com/2009/10/05/how-to-add-external-jar-files-into-your-maven-project/</link>
		<comments>http://homeilja.wordpress.com/2009/10/05/how-to-add-external-jar-files-into-your-maven-project/#comments</comments>
		<pubDate>Mon, 05 Oct 2009 01:45:31 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[Google]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[dependencies]]></category>
		<category><![CDATA[Google Data API]]></category>
		<category><![CDATA[Maven]]></category>
		<category><![CDATA[POM]]></category>

		<guid isPermaLink="false">http://homeilja.wordpress.com/?p=13</guid>
		<description><![CDATA[Maven is a wonderful tool for managing Java software projects. If you want to include some dependencies to your project, you just have to edit the POM file. Maven will automatically download the appropriate libs and put them into your build classpath. It also automatically downloads all the other libs, that are dependent to the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=homeilja.wordpress.com&amp;blog=9770710&amp;post=13&amp;subd=homeilja&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a title="Maven" href="http://maven.apache.org/" target="_blank">Maven</a> is a wonderful tool for managing Java software projects. If you want to include some dependencies to your project, you just have to edit the POM file. Maven will automatically download the appropriate libs and put them into your build classpath. It also automatically downloads all the other libs, that are dependent to the libs in the POM file.</p>
<p>But there is a problem: Maven can only manage libs, which are in the Maven repositories. So if you want to include an external lib, you have to insert the lib into your local Maven repository.</p>
<p>Example: Right now there is no Maven repository for the <a title="Java Client Library" href="http://code.google.com/apis/gdata/articles/java_client_lib.html" target="_blank">Java Client Libraries</a> of <a title="Google Data API" href="http://code.google.com/apis/gdata/" target="_blank">Google Data API</a>. You have to download the libs manually from <a title="Java Client Library download" href="http://code.google.com/p/gdata-java-client/downloads/list" target="_blank">here</a>. Then you can install them into your local Maven repository:</p>
<p><pre class="brush: bash;">mvn install:install-file -DgroupId=google-lib -DartifactId=gdata-blogger -Dversion=2.0 -Dpackaging=jar -DgeneratePom=true -Dfile=external_libs/gdata-blogger-2.0.jar
mvn install:install-file -DgroupId=google-lib -DartifactId=gdata-core -Dversion=1.0 -Dpackaging=jar -DgeneratePom=true -Dfile=external_libs/gdata-core-1.0.jar
mvn install:install-file -DgroupId=google-lib -DartifactId=gdata-media -Dversion=1.0 -Dpackaging=jar -DgeneratePom=true -Dfile=external_libs/gdata-media-1.0.jar</pre></p>
<p>This is only a cutout. There are much more Google Data libs you can include.</p>
<p>To use these libs in your project, just add these lines into your POM file:</p>
<p><pre class="brush: xml;"> &lt;dependency&gt;
    &lt;groupId&gt;google-lib&lt;/groupId&gt;
    &lt;artifactId&gt;gdata-blogger&lt;/artifactId&gt;
    &lt;version&gt;2.0&lt;/version&gt;
    &lt;scope&gt;compile&lt;/scope&gt;
 &lt;/dependency&gt;
 &lt;dependency&gt;
    &lt;groupId&gt;google-lib&lt;/groupId&gt;
    &lt;artifactId&gt;gdata-core&lt;/artifactId&gt;
    &lt;version&gt;1.0&lt;/version&gt;
    &lt;scope&gt;compile&lt;/scope&gt;
 &lt;/dependency&gt;
 &lt;dependency&gt;
    &lt;groupId&gt;google-lib&lt;/groupId&gt;
    &lt;artifactId&gt;gdata-media&lt;/artifactId&gt;
    &lt;version&gt;1.0&lt;/version&gt;
    &lt;scope&gt;compile&lt;/scope&gt;
 &lt;/dependency&gt;
 &lt;dependency&gt;
    &lt;groupId&gt;com.google.collections&lt;/groupId&gt;
    &lt;artifactId&gt;google-collections&lt;/artifactId&gt;
    &lt;version&gt;1.0-rc2&lt;/version&gt;
 &lt;/dependency&gt;</pre></p>
<p>The last dependency <em>com.google.collections</em> is needed by the Google Data libs. But as this lib is already in the Maven repositories, you don&#8217;t have to download this lib and all its dependencies. Maven will do it for you automatically.</p>
<br />Posted in Google, Java Tagged: dependencies, Google Data API, Java, Maven, POM <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/homeilja.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/homeilja.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/homeilja.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/homeilja.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/homeilja.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/homeilja.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/homeilja.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/homeilja.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/homeilja.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/homeilja.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/homeilja.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/homeilja.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/homeilja.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/homeilja.wordpress.com/13/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=homeilja.wordpress.com&amp;blog=9770710&amp;post=13&amp;subd=homeilja&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://homeilja.wordpress.com/2009/10/05/how-to-add-external-jar-files-into-your-maven-project/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0eb9124c298c6a22ea4bba5ded02b69d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ilja</media:title>
		</media:content>
	</item>
		<item>
		<title>Retrieving blog posts from WordPress over XML-RPC</title>
		<link>http://homeilja.wordpress.com/2009/10/04/retrieving-blog-posts-from-wordpress-over-xml-rpc/</link>
		<comments>http://homeilja.wordpress.com/2009/10/04/retrieving-blog-posts-from-wordpress-over-xml-rpc/#comments</comments>
		<pubDate>Sun, 04 Oct 2009 01:13:23 +0000</pubDate>
		<dc:creator>ilja</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[blog]]></category>
		<category><![CDATA[Maven]]></category>
		<category><![CDATA[POM]]></category>
		<category><![CDATA[retrieving]]></category>
		<category><![CDATA[WordPress API]]></category>
		<category><![CDATA[XML-RPC]]></category>

		<guid isPermaLink="false">http://homeilja.wordpress.com/?p=5</guid>
		<description><![CDATA[To retrieve all the blog posts from WordPress you can use the WordPress API, which uses the XML-RPC protocol. I will show you how this could be done in Java. First, we need the Apache XML-RPC lib. If you use Maven, then you should insert this into your pom file: If necessary, change the above [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=homeilja.wordpress.com&amp;blog=9770710&amp;post=5&amp;subd=homeilja&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>To retrieve all the blog posts from WordPress you can use the <a title="WordPress API" href="http://codex.wordpress.org/XML-RPC_wp" target="_blank">WordPress API</a>, which uses the <a title="XML-RPC protocol" href="http://www.xmlrpc.com/" target="_blank">XML-RPC protocol</a>. I will show you how this could be done in Java.</p>
<p>First, we need the <a title="Apache XML-RPC" href="http://ws.apache.org/xmlrpc/index.html" target="_blank">Apache XML-RPC</a> lib. If you use Maven, then you should insert this into your pom file:</p>
<p><pre class="brush: xml;">&lt;dependency&gt;
   &lt;groupId&gt;org.apache.xmlrpc&lt;/groupId&gt;
   &lt;artifactId&gt;xmlrpc-client&lt;/artifactId&gt;
   &lt;version&gt;3.1.2&lt;/version&gt;
&lt;/dependency&gt;</pre></p>
<p>If necessary, change the above version to a newer one. If you dont use Maven, then you should download and insert the lib to your project manually.</p>
<p>Before we start grabbing the blog posts, some initializing has to be done:</p>
<p><pre class="brush: java;">final XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
config.setServerURL(new URL(&quot;https://homeilja.wordpress.com/xmlrpc.php&quot;));

final XmlRpcClient client = new XmlRpcClient();
client.setConfig(config);</pre></p>
<p>Now the XmlRpcClient knows from which blog we want to retrieve our posts. Note, that you must provide the XML-RPC url of your blog. Typically you just need to set <em>/xmlrpc.php</em> at the end of your blog url.</p>
<p>Now we can interact with our WordPress installation over XML-RPC. If you want to know what methods are supported, you should look into the <em>xmlrpc.php</em> of your WordPress source. Here are all the methods from WordPress 2.8.4:</p>
<p><pre class="brush: php;"> // WordPress API
 'wp.getUsersBlogs'        =&gt; 'this:wp_getUsersBlogs',
 'wp.getPage'            =&gt; 'this:wp_getPage',
 'wp.getPages'            =&gt; 'this:wp_getPages',
 'wp.newPage'            =&gt; 'this:wp_newPage',
 'wp.deletePage'            =&gt; 'this:wp_deletePage',
 'wp.editPage'            =&gt; 'this:wp_editPage',
 'wp.getPageList'        =&gt; 'this:wp_getPageList',
 'wp.getAuthors'            =&gt; 'this:wp_getAuthors',
 'wp.getCategories'        =&gt; 'this:mw_getCategories',        // Alias
 'wp.getTags'            =&gt; 'this:wp_getTags',
 'wp.newCategory'        =&gt; 'this:wp_newCategory',
 'wp.deleteCategory'        =&gt; 'this:wp_deleteCategory',
 'wp.suggestCategories'    =&gt; 'this:wp_suggestCategories',
 'wp.uploadFile'            =&gt; 'this:mw_newMediaObject',    // Alias
 'wp.getCommentCount'    =&gt; 'this:wp_getCommentCount',
 'wp.getPostStatusList'    =&gt; 'this:wp_getPostStatusList',
 'wp.getPageStatusList'    =&gt; 'this:wp_getPageStatusList',
 'wp.getPageTemplates'    =&gt; 'this:wp_getPageTemplates',
 'wp.getOptions'            =&gt; 'this:wp_getOptions',
 'wp.setOptions'            =&gt; 'this:wp_setOptions',
 'wp.getComment'            =&gt; 'this:wp_getComment',
 'wp.getComments'        =&gt; 'this:wp_getComments',
 'wp.deleteComment'        =&gt; 'this:wp_deleteComment',
 'wp.editComment'        =&gt; 'this:wp_editComment',
 'wp.newComment'            =&gt; 'this:wp_newComment',
 'wp.getCommentStatusList' =&gt; 'this:wp_getCommentStatusList',

 // Blogger API
 'blogger.getUsersBlogs' =&gt; 'this:blogger_getUsersBlogs',
 'blogger.getUserInfo' =&gt; 'this:blogger_getUserInfo',
 'blogger.getPost' =&gt; 'this:blogger_getPost',
 'blogger.getRecentPosts' =&gt; 'this:blogger_getRecentPosts',
 'blogger.getTemplate' =&gt; 'this:blogger_getTemplate',
 'blogger.setTemplate' =&gt; 'this:blogger_setTemplate',
 'blogger.newPost' =&gt; 'this:blogger_newPost',
 'blogger.editPost' =&gt; 'this:blogger_editPost',
 'blogger.deletePost' =&gt; 'this:blogger_deletePost',

 // MetaWeblog API (with MT extensions to structs)
 'metaWeblog.newPost' =&gt; 'this:mw_newPost',
 'metaWeblog.editPost' =&gt; 'this:mw_editPost',
 'metaWeblog.getPost' =&gt; 'this:mw_getPost',
 'metaWeblog.getRecentPosts' =&gt; 'this:mw_getRecentPosts',
 'metaWeblog.getCategories' =&gt; 'this:mw_getCategories',
 'metaWeblog.newMediaObject' =&gt; 'this:mw_newMediaObject',

 // MetaWeblog API aliases for Blogger API
 // see http://www.xmlrpc.com/stories/storyReader$2460
 'metaWeblog.deletePost' =&gt; 'this:blogger_deletePost',
 'metaWeblog.getTemplate' =&gt; 'this:blogger_getTemplate',
 'metaWeblog.setTemplate' =&gt; 'this:blogger_setTemplate',
 'metaWeblog.getUsersBlogs' =&gt; 'this:blogger_getUsersBlogs',

 // MovableType API
 'mt.getCategoryList' =&gt; 'this:mt_getCategoryList',
 'mt.getRecentPostTitles' =&gt; 'this:mt_getRecentPostTitles',
 'mt.getPostCategories' =&gt; 'this:mt_getPostCategories',
 'mt.setPostCategories' =&gt; 'this:mt_setPostCategories',
 'mt.supportedMethods' =&gt; 'this:mt_supportedMethods',
 'mt.supportedTextFilters' =&gt; 'this:mt_supportedTextFilters',
 'mt.getTrackbackPings' =&gt; 'this:mt_getTrackbackPings',
 'mt.publishPost' =&gt; 'this:mt_publishPost',

 // PingBack
 'pingback.ping' =&gt; 'this:pingback_ping',
 'pingback.extensions.getPingbacks' =&gt; 'this:pingback_extensions_getPingbacks',

 'demo.sayHello' =&gt; 'this:sayHello',
 'demo.addTwoNumbers' =&gt; 'this:addTwoNumbers'</pre></p>
<p>We first have to use the method <em>wp.getUsersBlogs</em>, to get all blogs of the user:</p>
<p><pre class="brush: java;">final Object[] params = { new String(&quot;myName&quot;), new String(&quot;myPassword&quot;) };

final Object[] obj = (Object[]) client.execute(&quot;wp.getUsersBlogs&quot;, params);

for (final Object o : obj) {
   final Map m = (Map) o;
   final boolean isAdmin = (Boolean) m.get(&quot;isAdmin&quot;);
   final String url = (String) m.get(&quot;url&quot;);
   final String blogId = (String) m.get(&quot;blogid&quot;);
   final String blogName = (String) m.get(&quot;blogName&quot;);
   final String xmlRpcUrl = (String) m.get(&quot;xmlrpc&quot;);
}</pre></p>
<p>As you can see, we must provide the account name and password of the blog. The interesting part of the retrieved data is the<em> blogId</em>, as this is needed to retrieve the posts from our blog.</p>
<p>Ok, lets start the grabbing:</p>
<p><pre class="brush: java;">final Object[] params = { blogId, new String(&quot;myName&quot;), new String(&quot;myPassword&quot;), 9999 };

final Object[] obj = (Object[]) client.execute(&quot;metaWeblog.getRecentPosts&quot;, params);

for (final Object o : obj) {
   final Map m = (Map) o;
   final String postid = (String) m.get(&quot;postid&quot;);
   final String mt_allow_comment = (String) m.get(&quot;mt_allow_comment&quot;);
   final String permaLink = (String) m.get(&quot;permaLink&quot;);
   final String post_status = (String) m.get(&quot;post_status&quot;);
   final String link = (String) m.get(&quot;link&quot;);
   final String mt_excerpt = (String) m.get(&quot;mt_excerpt&quot;);
   final String userid = (String) m.get(&quot;userid&quot;);
   final String mt_text_more = (String) m.get(&quot;mt_text_more&quot;);
   final int mt_allow_pings = (Integer) m.get(&quot;mt_allow_pings&quot;);
   final String mt_keywords = (String) m.get(&quot;mt_keywords&quot;);
   final String title = (String) m.get(&quot;title&quot;);
   final Date date_created_gmt = (Date) m.get(&quot;date_created_gmt&quot;);
   final String wp_password = (String) m.get(&quot;wp_password&quot;);
   final String description = (String) m.get(&quot;description&quot;);
   final Date dateCreated = (Date) m.get(&quot;dateCreated&quot;);
   final Object[] categories = (Object[]) m.get(&quot;categories&quot;);
   for (final Object cat : categories) {
      final String category = (String) cat;
   }
   final String wp_author_id = (String) m.get(&quot;wp_author_id&quot;);
   final String wp_slug = (String) m.get(&quot;wp_slug&quot;);
   final String wp_author_display_name = (String) m.get(&quot;wp_author_display_name&quot;);
}</pre></p>
<p>Thats it. If you wonder what the <em>9999</em> means in the code: With this number you can tell WordPress how many of your latest posts you want to grab. So if you want to grab all your posts, then you have to give it a big number. <em>9999</em> should be ok in most cases.</p>
<div id="_mcePaste" style="overflow:hidden;position:absolute;left:-10000px;top:1799px;width:1px;height:1px;">
<pre>
<pre>new String("myName")</pre>
</pre>
</div>
<br />Posted in Java, Wordpress Tagged: Apache, blog, Java, Maven, POM, retrieving, Wordpress, WordPress API, XML-RPC <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/homeilja.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/homeilja.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/homeilja.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/homeilja.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/homeilja.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/homeilja.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/homeilja.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/homeilja.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/homeilja.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/homeilja.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/homeilja.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/homeilja.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/homeilja.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/homeilja.wordpress.com/5/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=homeilja.wordpress.com&amp;blog=9770710&amp;post=5&amp;subd=homeilja&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://homeilja.wordpress.com/2009/10/04/retrieving-blog-posts-from-wordpress-over-xml-rpc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0eb9124c298c6a22ea4bba5ded02b69d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ilja</media:title>
		</media:content>
	</item>
	</channel>
</rss>
