tag:blogger.com,1999:blog-57252625250020681262024-02-19T22:38:49.652-08:00Undefined is not a functionUnknownnoreply@blogger.comBlogger9125tag:blogger.com,1999:blog-5725262525002068126.post-70847452357550653572012-05-14T11:29:00.000-07:002012-05-14T11:29:32.964-07:00Deleting Orphan Raw Images after JPEGs have been Removed<div dir="ltr" style="text-align: left;" trbidi="on">
I have been looking for a quick and dirty solution for removing unwanted files that have been copied from a camera that creates both raw and jpg files for shot pictures.<br />
<br />
The python script below is very useful when you are working on a computer where no advanced tool, such as Adobe Lightroom, are available. You can use a simple image viewer, such as the one provided by Gnome or Irfanview on Windows, and browse through your images in a folder removing all unwanted pictures (the jpg version).<br />
<br />
The python script below moves all raw images ("*.CR2") with no corresponding jpg ("*.JPG") version to a sub folder "deleted". You can check than of the deleted folder and remove them manually. Alternatively replace "<span style="font-family: 'Courier New', Courier, monospace;">shutil.move(file, './deleted')</span>" with "<span style="font-family: 'Courier New', Courier, monospace;">os.remove(file)</span>" if you want to have the files deleted instead of moved.<br />
<br />
The file extension naming is the one used by Canon. A modified version for other cameras might be not that difficult to write. <br />
<br />
<script src="https://gist.github.com/2695433.js">
</script>
</div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-5725262525002068126.post-31834418977954709562010-11-05T13:46:00.000-07:002010-11-05T13:46:27.872-07:00jQuery and Node.js<div xmlns='http://www.w3.org/1999/xhtml'>jQuery makes it really easy to select certain parts not only of a HTML page but also of an XML document. So if you just want to parse some (and not too big) XML file or do not care too much ab the speed of your parser a combination of node.js and jquery can help a lot and make some stuff really less painful. <br />
<br />
So what is needed (ubuntu linux):<br />
<ul><li>Install node.js on ubuntu: http://ec2-50-16-39-169.compute-1.amazonaws.com/blog/?p=1688</li>
<li>Download jquery (you could also include an online version - google is your friend): I use <a href='http://code.jquery.com/jquery-1.4.2.min.js'>jquery-1.4.2.min.js</a> (1.4.3 did not work for me)</li>
</ul>Then try this example:<script src='https://gist.github.com/664635.js'> </script><br />
<br />
Type into a terminal:<br />
<font face='Courier New'>> node helloJQueryNode.js</font><br />
<br />
It should write to the console:<br />
<font face='Courier New'>> Hello World, It works! Really!</font><br />
<br />
Now a more complex example:<br />
<script src='https://gist.github.com/664739.js'> </script><br />
again Type into a terminal:<br />
<font face='Courier New'>> node xmlTest.js</font><br />
<br />
It should write to the console:<br />
<font face='Courier New'>> 229.29</font><br />
<br />
Pretty simple!! So what does it do? So you have got an <a href='http://www.w3schools.com/xml/plant_catalog.xml'>XML file</a>. Node js fetches the file and jQuery is used for parsing. Well using jQuery <a href='http://api.jquery.com/category/selectors/'>selector syntax</a> to extract the stuff you are looking for from an XML file is typically a lot easier than for example using <a href='http://www.w3.org/TR/xpath20/'>XPath</a>.<br />
Okay, as already mentioned for big XML files and if you have lots of files to crawl *I* would use more likely Java (<a href='http://hc.apache.org/httpclient-3.x/'>apache httpclient</a> + a fast STAX-parser such as <a href='http://woodstox.codehaus.org/'>Woodstox</a>). For very simple tasks Node.js + jQuery is really a good choice.<br />
<br />
Some more about Node.js:<br />
http://net.tutsplus.com/tutorials/javascript-ajax/learning-serverside-javascript-with-node-js/</div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-5725262525002068126.post-68626264068255641452010-10-29T12:12:00.000-07:002010-10-29T12:12:22.452-07:00How to convert SVG files to pdf with Inkscape<p>This short post concerns windows. I usually have a folder with my standard batch files in a folder which is on the classpath (e.g. <font face="Courier New">C:\Users\me\work\tools\bat\</font> ).</p><p>In this folder I have got to batch files:</p><ul><li><font face="Courier New">inkscape.bat</font> containing this line: <font face="Courier New">"C:\Program Files\Inkscape\inkscape.exe" %*</font> <ul><li>don’t forget the qoutes if you white spaces in your path to inkscape </li>
<li>%* mean hand over all provided parameters/ arguments <p><font face="Courier New"></font></p></li>
</ul></li>
<li><font face="Courier New">svg2pdf </font><font face="Trebuchet MS">containing this line: </font><font face="Courier New">inkscape "%CD%\%1" -D --export-pdf "%CD%\%1.pdf"</font> <ul><li>%1 stands for the first provided parameter – you could modify this to check if there is a second parameter given and use that one as output file </li>
<li>%CD% stands for current directory </li>
<li>-D stands for export only the drawing area.0 The allowed parameters for inkscape can be found in the <a href="http://inkscape.modevia.com/inkscape-man.html">manual</a>. </li>
</ul></li>
</ul><p>In an command window you navigate to the folder desired (in windows xp navigate to folder and press <font face="Courier New">[Windows Key] + [r]</font> and enter <font face="Courier New">cmd</font> – in windows 7 navigate to the parent folder of your desired folder and press<font face="Courier New"> [Shift]</font> + your right mouse key and select “Open command window here”) and enter for example: <font face="Courier New">svg2pdf foo.svg</font></p><p>One cool thing is with svgs it is easy to change the font for the used text. You simple replace the font name. Here is a simple python script for that and that additionally calls inkscape after that to convert the file – of course this works only if you have got python installed:</p><script src="http://gist.github.com/654106.js"> </script><br />
<p> </p><p>One other cool thing about inkscape is: If you have got a tool such as <a href="http://www.umlet.com/">UMLet</a> which can export to svg but renders fonts as lines (pdf export is not an option – you want to replace the used standard font and you can not afford an acrobat licence), you can not replace the fonts in the svg. You can use Inkscape to convert the pdf to an svg via a simple command: <font face="Courier New">inkscape foo.pdf --export-plain-svg foo.svg </font>or you can create a batch file analogue to the one above (e.g. svg2svg.bat):  <font face="Courier New">inkscape "%CD%\%1" -D --export-plain-svg "%CD%\%1.svg".</font> Having a svg now, you can replace the font in the svg and then export the svg to a pdf.</p><p><font style="background-color: #ffff00">Note:</font> <font style="background-color: #ffff00">I had sometimes problems with the newest versions of inkscape rendering fonts as lines in the resulting pdf and therefore losing the plain text.</font> With version 0.46 it keeps the text as text. That might have to do with additional parameters or whatever. I do not care. Keep it simple make it work…</p>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-5725262525002068126.post-33180102322640667172009-12-11T13:26:00.000-08:002010-10-29T11:45:10.991-07:00Playing around with JavaScript, Tag Clouds, DeliciousThis is a post about an usage of a <a href="http://www.roytanck.com/2008/03/15/wp-cumulus-released/">Cumulus Tag Cloud</a> for <a href="http://www.delicious.com/">delicious user</a> I wrote. After providing a delicious name the application fetches your tags plus their frequency of usage for the corresponding delicious user. It can be found <a href="http://woidda.de/tagcloud_v1">here</a>.<br />
Here an example screenshot.<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh9cs8DKBZMnMODdOgCfESWD9ZS_pcTtFboWz4aJS2-3b64DHJJTBRMKcY8uZyOeBi7yACPuRqQImLSLxJCLJWX40F7E3X7AYqZ-ZgkJo2uChDC0bc6Cjj3euNI6s3rds0RQ7wPRmmRIuJV/s1600-h/image%5B8%5D.png"><img alt="image" border="0" height="170" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgjX3oP2cGCSgWmBe3bBhvLJy-nuDerCw4s_ESt8wDarIw7wvoLQJ9xKXxj2c-kUnIBfReP7t0dB9BQnHTccrorn3gmpV4Sv4UdXpu-5aBU_z7AOHlgmEXc_DlHXIfHzesa9xgqZtKWJ9mb/?imgmax=800" style="border: 0px none; display: inline;" title="image" width="244" /></a> <br />
This is done<b><span style="color: red;"> solely client side</span></b> (no connection to my server, okay but delicious of course) by combining several JavaScript libraries (<a href="http://jquery.com/">jquery</a>, <a href="http://plugins.jquery.com/project/URLEncode">jquery URLEncode plugin</a>, <a href="http://code.google.com/p/swfobject/">swfobject</a>) and a flash <a href="http://www.roytanck.com/2008/03/15/wp-cumulus-released/">tag cloud</a> component. <br />
1. The tags for a user are fetched from delicious. The <a href="http://en.wikipedia.org/wiki/Same_origin_policy">same origin policy</a> is bypassed with a little old trick (*): <br />
<pre>var script = document.createElement('script');
script.setAttribute('src', 'http://feeds.delicious.com/v2/json/tags/' + user + '?callback=doTagCloud');
document.getElementsByTagName('head')[0].appendChild(script);</pre><br />
This trick inserts a script element in the head section of a html page. In html it will something like that:<br />
<pre><script type="text/javascript" src="'http://feeds.delicious.com/v2/json/tags/{user}?callback=doTagCloud"></script>
</pre><br />
By providing a callback the actually loaded JavaScript code has the form:<br />
<br />
<pre>doTagCloud({".net":1,"\\todo":1,"\"design":1, […]});</pre>the function doTagCloud is called with the filled in tags.<br />
2. The tags are sorted, pruned and rendered with the computed relative font weights.<br />
<pre>swfobject.embedSWF("flash/tagcloud.swf", "tagCloud", "400", "500",
"7.0.0", false, flashvars, params, attributes);
</pre><pre> </pre><br />
(*) I am no big fan of the <a href="http://en.wikipedia.org/wiki/Same_origin_policy">same origin policy</a> since it does not actually prevent serious cross scripting attacks but on the other hand it hinders developing advanced client side mash ups without data proxies.Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-5725262525002068126.post-54634561725632847112009-09-10T09:54:00.001-07:002009-09-10T09:59:21.543-07:00European Summer School in Information Retrieval (ESSIR) 2009 in Padua<p>I have been on a Summer School about Information Retrieval in Padua last week - <a href="http://essir2009.dei.unipd.it/">ESSIR 2009</a>. In general it was <strong><em>awesome. </em></strong>I met many interesting people, had a lot of fun and also gathered some input concerning my current work. Most of the talks were <em><strong>excellent</strong></em> and really led me to some new insights about Information retrieval in </p> <p>general. </p> <p>Talks I liked most - no special order or distinction between quality (or my interests in the topic) of the talk:</p> <ul> <li>The User in Interactive Information Retrieval Evaluation - Peter Ingwersen</li> <li>Information Retrieval in Context - Ian Ruthven</li> <li>Web Mining and Next-Generation Search - Aristides Gionis</li> <li>Indexing Techniques - Mark Sanderson</li> </ul> <p>Here are some pics:</p> <p><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi6P4B8MYKWQTGW6ScwqqptFaGjElqB-fKLCUZcB5HCcB30IY4YH6c_zocbOdiOjAQV3p8gXvMYl2UoxaKVF2x2w0CfP3rB6qbekjHxeQVmurWnvujRLFtyelINCuRppw1UCxXVDyJbjZG6/s1600-h/image%5B2%5D.png"><img style="border-bottom: 0px; border-left: 0px; border-top: 0px; border-right: 0px" border="0" alt="image" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEios16V0mGfCON4SFuQ3Y_8oxwi4_8jkT3ZA9tQhxjBWLAgjJbn3tP0_y4fXlhlrkWuqepnsQOi-5l_RLRZh2kpebIsOJjZeac2Np1o5uPpY03F7cQaiWlHz2PT6yrCr1JCZjxtc4belwtO/?imgmax=800" width="244" height="164" /></a> <a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg_d59mN7OJflcksfiX5CyYc5P62MA_B4lG4_GnMhExkyid0Cl5T5F5blziAB6_VuML_4IAF_-unaE5WNMCSdmmmaI3M-MXOuI9wsyPN7khbWm5Fw4UgczOJ_c-Q1bDL6XjxeWZ48gqXIlw/s1600-h/image%5B5%5D.png"><img style="border-bottom: 0px; border-left: 0px; border-top: 0px; border-right: 0px" border="0" alt="image" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhBOX1Qy2fWNdbhbquBVZatzQ7Jq106bnD1DWX3bgp6uesdLgQH5qrLs_qlQlceg8nV3UfamNo6-8A2hsOZYtH1SjQnAzzH9rnbtP48bLoVlFoTtjf7fW7FCE4GS_GAJu-F2A45Fes0LXNt/?imgmax=800" width="244" height="164" /></a> </p> <p><img style="border-bottom: 0px; border-left: 0px; border-top: 0px; border-right: 0px" border="0" alt="image" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgzdAC1I3bsTtdanfB13qS0iZJp6WuToNr3262m0wpu9wksOBwSyc_68h9TUCPwXJKR8Bs8pI6st5HB1kkvqGJ05eATzCES94d8bUnDk6EHHZMo1wQSZrcPQj4DrssMNxHWj4i8NbAd07gG/?imgmax=800" width="244" height="164" /> <a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhNbT9TGvLdRfqP0ZAKo4mkRa8vyZQUboK4THJFyBfv389onzdQfJ9hJo_69LlhOPLvh8wm20LGa9_-0NZ6wHZ7eAMjiw1U6XYWXtKkNNVjvWRgnRU8sBywncU5E0BJ2nDo7mdK17LZyLz4/s1600-h/image%5B11%5D.png"><img style="border-bottom: 0px; border-left: 0px; border-top: 0px; border-right: 0px" border="0" alt="image" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQSVq7P43LJmmfmkk6IMZehCpdO9iVT1MhNccdHK1H2nDmrG_XOE0v5U-lCRv1qF-AWh1NGQpnu4B6TnsjN-BRglCnnItl6Rt5kZwLDVrbNNVmF2xGu461O5kSl98l7lQM9KxHn57nrmRw/?imgmax=800" width="244" height="164" /></a> </p> <p>There are also some more pics at <a href="http://www.flickr.com/photos/tags/essir2009/">flickr</a>.</p> Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-5725262525002068126.post-67006242713296596422009-08-17T11:00:00.001-07:002009-12-11T13:28:36.612-08:00JSLint with Eclipse<p>Some simple steps to check your JavaScript Code with <a href="http://www.jslint.com/lint.html">JSLint</a>:</p><ol><li>download and install <a href="http://www.mozilla.org/rhino/">JSRhino</a> </li>
<li>make it somehow available, e.g. create a js.bat (one line: <em>java -jar "path/to/rhino/js.jar" %* </em>)  </li>
<li>download <a href="http://www.jslint.com/lint.html">JSLint</a> and put it in some folder, e.g. /path/to/jslint.js </li>
<li>Add an external tool configuration in Eclipse: <p><strong>Location:</strong> <em>path/to/js.bat</em></p><p><strong>Working Directory:</strong> <em>${workspace_loc} </em></p><p><strong>Arguments:</strong> <em>path/to/jslint.js ${resource_loc}</em></p></li>
<li>you can now check your JavaScript code with JSLint by calling this external tool.</li>
</ol><p>Enjoy.</p><p>P.S.: There is a very interessting <a href="http://www.youtube.com/watch?v=hQVTIJBZook">talk by Douglas Crockford</a>  (creator of JSON and JSLint) at google tech talk that highlights the good and bad aspects of JavaScript. I liked that a lot. </p>Unknownnoreply@blogger.com3tag:blogger.com,1999:blog-5725262525002068126.post-10209485607100513782009-07-06T14:17:00.001-07:002009-08-17T11:03:26.679-07:00This is just a test post<p><a href="http://download.live.com/writer">Windows Live Writer</a> is just awesome to publish to your blog.</p><br /><p><br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiilho2ZRlOKvm-hwX95Hxz_cIWERl-VBDNyMoALvBh_zcHbdHodv0MsALIDMiv_pIwL9BSQp5b1z_Ap-s7smTrY2fPtvg1d0t2Yt9dM1dScDNpUPygvR3H8vXCI0Y2BoHWy2Y_QD85TBtB/s1600-h/IMG_1157_small%5B2%5D.jpg"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="164" alt="IMG_1157_small" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh2RAFZpjmnb1sFfgKxFhro2itbet254fRM1ZRyVCGZBRVpGrqqcH3y0Ln7lUq73ZNKsO1MI_77biSyD91h6lzyQ0YrmhUBeGtVxnmrYiKv6wFvLJ4A7_lartY1CDQ-rbu50is7Ci8BjIMB/?imgmax=800" width="244" border="0" /></a></p> <p>I like that picture. </p>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-5725262525002068126.post-20890616757861059022008-09-15T13:57:00.000-07:002008-09-28T05:07:26.206-07:00Clay Shirky about television and somehow waste of timeThis is a <a href="http://blip.tv/file/855937/">talk</a> of Clay Shirky at Web 2.0 Expo SF 2008.<br /><br />He explains in a very entertaining way (in short) that people in the current generation watch too much tv and that in the time e.g. the people in US sit in front of their tv the whole wikipipedia could be written a many thousand times.<br /><br />The new generation seems to use the media in a more active way. They write blog post and are more active in stating their opinion.<br /><br />A quote:<br /><span style="font-style:italic;">TV Reporter: Where do people find all the time to do wikipedia?<br />Clay Shirky: No one who works in TV gets to ask that question.<br />You know where the times comes from. It comes from the cognitive surplus you have been masking for the last 50 years.<br /></span><br /><br />P.S.<br />Clay Shirky is known not only to the "tagging world" for his widely-read blog post with the title: <a href="http://www.shirky.com/writings/ontology_overrated.html">"Ontology is Overrated: Categories, Links, and Tags"</a>. Tom Gruber refers to this post in an often cited article: <a href="http://tomgruber.org/writing/ontology-of-folksonomy.htm">"Ontology of Folksonomy: A Mash-up of Apples and Oranges"</a>. But that is an other story...Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-5725262525002068126.post-4578767296817485982008-09-15T13:45:00.000-07:002009-09-10T10:27:50.130-07:00Moday after Nepomuk Summerschool<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://farm4.static.flickr.com/3036/2858599913_8a736d78c9.jpg?v=0"><img style="float:left; margin:5px 5px 5px 5px;cursor:pointer; cursor:hand;width: 200px;" src="http://farm4.static.flickr.com/3036/2858599913_8a736d78c9.jpg?v=0" border="0" alt="" /></a><br />
<br />
<br />
Today was my first day after the <a href="http://summerschool.nepomuk.semanticdesktop.org/">nepomuk summerschool</a> in Malta.<br />
It was great to meet all this interesting individuals and to exchange thoughts and experiences related to semantic web technologies. People were mostly from europe but also two guys from usa and brazil attended the school.<br />
<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://farm4.static.flickr.com/3272/2859444480_82a8568146.jpg?v=0"><img style="float:left; margin:5px 5px 5px 5px;cursor:pointer; cursor:hand;width: 200px;" src="http://farm4.static.flickr.com/3272/2859444480_82a8568146.jpg?v=0" border="0" alt="" /></a><br />
Experimenting with user interface design techniques was one of the things I liked most. And of course the mini project we did where really fun. My team also won a small price for our mini project with the name "<a href="http://dev.nepomuk.semanticdesktop.org/wiki/SummerSchool/SemanticIrcClient">chatomuk</a>" ;-)Unknownnoreply@blogger.com0