<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>NewInstance</title>
	
	<link>http://en.newinstance.it</link>
	<description>Welcome to the official blog of Luigi R. Viggiano. Beware of imitations.</description>
	<lastBuildDate>Thu, 10 May 2012 20:28:35 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/newinstance/blog" /><feedburner:info uri="newinstance/blog" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:browserFriendly></feedburner:browserFriendly><item>
		<title>Freedom</title>
		<link>http://en.newinstance.it/2012/04/19/freedom/</link>
		<comments>http://en.newinstance.it/2012/04/19/freedom/#comments</comments>
		<pubDate>Wed, 18 Apr 2012 22:32:17 +0000</pubDate>
		<dc:creator>Luigi</dc:creator>
				<category><![CDATA[Life, universe and everything]]></category>

		<guid isPermaLink="false">http://en.newinstance.it/?p=1280</guid>
		<description><![CDATA[Freedom, a photo by Luigi R. Viggiano on Flickr. A kid flying a kite. Picture taken 2 years ago in Düsseldorf, on the Rhine promenade, during a sunny day. Related Posts: Sunset on Salzburg The Azure Window, in Gozo Island, Malta Venetian Mask Düsseldorf Cityscape Silhouette Back to life]]></description>
			<content:encoded><![CDATA[<p><!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic -->
<div style="margin: 0 0 10px 0; padding: 0; font-size: 0.8em; line-height: 1.6em;"><a href="http://www.flickr.com/photos/lviggiano/6938265264/" title="Freedom"><img src="http://farm8.staticflickr.com/7105/6938265264_9d7346e0c8.jpg" alt="Freedom by Luigi R. Viggiano" /></a><br/><span style="margin: 0;"><a href="http://www.flickr.com/photos/lviggiano/6938265264/">Freedom</a>, a photo by <a href="http://www.flickr.com/photos/lviggiano/">Luigi R. Viggiano</a> on Flickr.</span></div>
<p>A kid flying a kite.</p>
<p>Picture taken 2 years ago in Düsseldorf, on the Rhine promenade, during a sunny day.</p>
<div id="crp_related">
<h4>Related Posts:</h4>
<ul>
<li><a href="http://en.newinstance.it/2011/11/02/sunset-on-salzburg/" rel="bookmark" class="crp_title">Sunset on Salzburg</a></li>
<li><a href="http://en.newinstance.it/2012/01/08/the-azure-window-in-gozo-island-malta/" rel="bookmark" class="crp_title">The Azure Window, in Gozo Island, Malta</a></li>
<li><a href="http://en.newinstance.it/2011/09/06/venetian-mask/" rel="bookmark" class="crp_title">Venetian Mask</a></li>
<li><a href="http://en.newinstance.it/2011/07/29/dusseldorf-cityscape-silhouette/" rel="bookmark" class="crp_title">Düsseldorf Cityscape Silhouette</a></li>
<li><a href="http://en.newinstance.it/2011/05/22/back-to-life/" rel="bookmark" class="crp_title">Back to life</a></li>
</ul>
</div>
<div class="shr-publisher-1280"></div>
<p><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic --></p>
]]></content:encoded>
			<wfw:commentRss>http://en.newinstance.it/2012/04/19/freedom/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to query HTTP:BL for spamming IP addresses</title>
		<link>http://en.newinstance.it/2012/04/18/how-to-query-httpbl-for-spamming-ip-addresses/</link>
		<comments>http://en.newinstance.it/2012/04/18/how-to-query-httpbl-for-spamming-ip-addresses/#comments</comments>
		<pubDate>Wed, 18 Apr 2012 15:20:47 +0000</pubDate>
		<dc:creator>Luigi</dc:creator>
				<category><![CDATA[Internet]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[antispam]]></category>
		<category><![CDATA[black list]]></category>
		<category><![CDATA[dns]]></category>
		<category><![CDATA[http:bl]]></category>
		<category><![CDATA[ip]]></category>
		<category><![CDATA[lookup]]></category>
		<category><![CDATA[project honey pot]]></category>
		<category><![CDATA[spam]]></category>

		<guid isPermaLink="false">http://en.newinstance.it/?p=1272</guid>
		<description><![CDATA[If you don&#8217;t know Project Honey Pot, go and have a look. They offer a service for querying IP addresses and check if they are listed in those involving in spamming or threatening activities. So, if your visitor has a black listed IP you can block him from accessing or doing something sensitive. Since it [...]]]></description>
			<content:encoded><![CDATA[<p><!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic -->If you don&#8217;t know <a href="http://www.projecthoneypot.org/">Project Honey Pot</a>, go and have a look.</p>
<p>They offer a service for querying IP addresses and check if they are listed in those involving in spamming or threatening activities. So, if your visitor has a black listed IP you can block him from accessing or doing something sensitive.</p>
<p>Since it is missing a Java library to use the service, I implemented a <a href="http://c2.com/cgi/wiki?SpikeSolution">Spike</a> following the <a href="http://www.projecthoneypot.org/httpbl_api.php">HTTP:BL API</a> specifications.</p>
<p>This is not production code, is just some (ugly) code I wrote to test how it works. </p>
<pre class="brush:java">
import static java.lang.Integer.parseInt;
import static java.lang.System.out;

import java.net.InetAddress;
import java.net.UnknownHostException;

// see: http://www.projecthoneypot.org/httpbl_api.php
public class HttpBlackListChecker {

	public static void main(String[] args) throws Exception {
		if (args.length == 0) help();
		String ip = args[0];
		out.println("Querying HTTP:BL for IP: " + ip);
		String reversed = reversed(ip);
		// get your own key at http://www.projecthoneypot.org/httpbl_configure.php
		String accessKey = "abcdefghijkl";
		String domain = "dnsbl.httpbl.org";
		String lookup = accessKey + "." + reversed + "." + domain;
		out.println("Lookup for: "+ lookup);
	    try {
	    	String addr = InetAddress.getByName(lookup).getHostAddress();
	    	translate(addr);
		} catch (UnknownHostException e) {
			out.println("The IP specified is not listed in HTTP:BL");
		}
	}

	private static void help() {
		out.println("Please specify an ip address to check");
		System.exit(1);
	}

	private static void translate(String addr) {
		String[] split = split(addr);
		out.println("Response Code: " + addr);
		out.println("Result: " + (split[0].equals("127") ? "found" : "error"));
		out.println("Days since last activity: " + split[1]);
		out.println("Treat score (0..255): " + split[2]);
		out.print("Type of visitor: ");
		int type  = parseInt(split[3]);
		switch (type) {
		case 0:
			out.println("Search Engine");
			break;
		case 1:
			out.println("Suspicious");
			break;
		case 2:
			out.println("Harvester");
			break;
		case 3:
			out.println("Suspicious &#038; Harvester");
			break;
		case 4:
			out.println("Comment Spammer");
			break;
		case 5:
			out.println("Suspicious &#038; Comment Spammer");
			break;
		case 6:
			out.println("Harvester &#038; Comment Spammer");
			break;
		case 7:
			out.println("Suspicious &#038; Harvester &#038; Comment Spammer");
			break;
		default:
			out.println("Unknown");
			break;
		}
	}

	private static String reversed(String ip) {
		String[] split = split(ip);
		String reversed = null;
		for (String chunk : split)
			reversed = (reversed == null) ?
						chunk :
						chunk + "." + reversed;
		return reversed;
	}

	private static String[] split(String ip) {
		return ip.split("\\.");
	}
}
</pre>
<p>This code won&#8217;t work if you don&#8217;t request an <a href="http://www.projecthoneypot.org/httpbl_configure.php">API key from here</a> and replace it at line #16.</p>
<p>Sample output specifying one spamming IP (91.207.8.78):</p>
<pre>
Querying HTTP:BL for IP: 91.207.8.78
Lookup for: abcdefghijkl.78.8.207.91.dnsbl.httpbl.org
Response Code: 127.1.61.5
Result: found
Days since last activity: 1
Treat score (0..255): 61
Type of visitor: Suspicious &#038; Comment Spammer
</pre>
<p>Notice that some ISP DNS server redirect to a &#8220;courtesy page&#8221; of the ISP itself, when you specify a non-existent host. In this case you&#8217;ll get some wrong repose code when the IP is not listed. You&#8217;ll see &#8220;Result: error&#8221; in the output, instead of &#8220;The IP specified is not listed in HTTP:BL&#8221;. The fault in this case if of your ISP.
<div id="crp_related">
<h4>Related Posts:</h4>
<ul>
<li><a href="http://en.newinstance.it/2005/11/19/listening-changes-on-a-text-file-unix-tail-implementation-with-java/" rel="bookmark" class="crp_title">Listening changes on a text file (Unix Tail implementation with Java)</a></li>
<li><a href="http://en.newinstance.it/2010/04/30/wake-on-lan/" rel="bookmark" class="crp_title">Wake on LAN</a></li>
<li><a href="http://en.newinstance.it/2009/03/12/generic-type-inference-and-varargs-to-make-code-smaller/" rel="bookmark" class="crp_title">Generic Type Inference and varargs to make code smaller</a></li>
<li><a href="http://en.newinstance.it/2005/06/07/stringbuffer-considered-harmuful/" rel="bookmark" class="crp_title">StringBuffer considered harmuful</a></li>
<li><a href="http://en.newinstance.it/2009/03/27/mocking-jndi/" rel="bookmark" class="crp_title">Mocking JNDI</a></li>
</ul>
</div>
<div class="shr-publisher-1272"></div>
<p><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic --></p>
]]></content:encoded>
			<wfw:commentRss>http://en.newinstance.it/2012/04/18/how-to-query-httpbl-for-spamming-ip-addresses/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Self executing jar files</title>
		<link>http://en.newinstance.it/2012/04/17/self-executing-jar-files/</link>
		<comments>http://en.newinstance.it/2012/04/17/self-executing-jar-files/#comments</comments>
		<pubDate>Tue, 17 Apr 2012 21:33:30 +0000</pubDate>
		<dc:creator>Luigi</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[OSX]]></category>
		<category><![CDATA[Unix]]></category>
		<category><![CDATA[Bash]]></category>
		<category><![CDATA[jar]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[self-executing]]></category>
		<category><![CDATA[tip]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[trick]]></category>
		<category><![CDATA[unix]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://en.newinstance.it/?p=1247</guid>
		<description><![CDATA[I personally always felt bad about the fact that we have to provide a shell script which runs the executable jar file. It would be nice if we could provide a self contained executable in a single file, right? I just discovered a trick which works on unix, but it can possibly be adapted on [...]]]></description>
			<content:encoded><![CDATA[<p><!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic -->I personally always felt bad about the fact that we have to provide a shell script which runs the executable jar file. It would be nice if we could provide a self contained executable in a single file, right?</p>
<p>I just discovered a trick which works on unix, but it can possibly be adapted on Windows.</p>
<p>Ingredients:<br />
- a jar<br />
- a bash script</p>
<p>Let&#8217;s start with the jar. Create an HelloWorld.java file:</p>
<pre class="brush:java">
public class HelloWorld {
    public static void main(String[] args) {
        System.out.println("Hello World!");
    }
}
</pre>
<p>I like to indicate the Main Class in the manifest, so we create a MANIFEST.MF:</p>
<pre>
$ echo Main-Class: HelloWorld > MANIFEST.MF
</pre>
<p>now, let&#8217;s put the jar together:</p>
<pre>
$ javac HelloWorld.java
$ jar -cvmf MANIFEST.MF hello.jar HelloWorld.class
</pre>
<p>You can try it:</p>
<pre>
$ java -jar hello.jar
</pre>
<p>It should print &#8220;Hello World!&#8221;. No surprise.</p>
<p>Now, let&#8217;s create, once and for all, the bash script &#8220;stub.sh&#8221;</p>
<pre>
#!/bin/sh
java -jar $0 $*
exit
</pre>
<p>Now let&#8217;s put together our self-executable java program:</p>
<pre>
$ cat stub.sh hello.jar > hello.sh
$ chmod +x hello.sh
</pre>
<p>And now we can run it! </p>
<pre>
$ ./hello.sh
Hello World!
</pre>
<p>Cool uh?</p>
<p>I think, you can create a stub.bat on Windows; possibly you should just replace the first line with &#8220;@echo off&#8221; and the &#8220;$0 $*&#8221; with &#8220;%0 %1 %2 %3 %4 %5&#8230;&#8221;. It should work. Don&#8217;t ask me to test the Windows version. I&#8217;m allergic.</p>
<p><strong>Update:</strong><br />
A shorter version of the stub script:</p>
<pre>
#!/usr/bin/java -jar
</pre>
<p>For windows, this should translate to stub.bat:</p>
<pre>
@java -jar %0 %1 %2 %3 %4 %5
exit
</pre>
<p>For windows, depending on <a href="http://www.google.com/search?q=windows+concatenate+binary+files">what you use to concatenate files</a> (copy /b should work) make sure there is a newline between the end of the stub.bat and the beginning of the jar file. I didn&#8217;t test on Windows, but I&#8217;m pretty sure it will work. Let me know, if otherwise.
<div id="crp_related">
<h4>Related Posts:</h4>
<ul>
<li><a href="http://en.newinstance.it/2010/04/06/how-to-create-launchers-in-osx/" rel="bookmark" class="crp_title">How to create launchers in OSX</a></li>
<li><a href="http://en.newinstance.it/2009/05/07/java-native-compilation/" rel="bookmark" class="crp_title">Java native compilation</a></li>
<li><a href="http://en.newinstance.it/2010/04/30/wake-on-lan/" rel="bookmark" class="crp_title">Wake on LAN</a></li>
<li><a href="http://en.newinstance.it/2011/02/27/how-to-create-a-statically-linked-version-of-git-binaries/" rel="bookmark" class="crp_title">How to create a statically linked version of git binaries</a></li>
<li><a href="http://en.newinstance.it/2009/03/05/ant-macrodefs/" rel="bookmark" class="crp_title">Ant macrodefs</a></li>
</ul>
</div>
<div class="shr-publisher-1247"></div>
<p><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic --></p>
]]></content:encoded>
			<wfw:commentRss>http://en.newinstance.it/2012/04/17/self-executing-jar-files/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>OSX, Internet Sharing interfere with the standby sleep on MacBook Pro</title>
		<link>http://en.newinstance.it/2012/04/16/osx-internet-sharing-interfere-with-the-standby-sleep-on-macbook-pro/</link>
		<comments>http://en.newinstance.it/2012/04/16/osx-internet-sharing-interfere-with-the-standby-sleep-on-macbook-pro/#comments</comments>
		<pubDate>Mon, 16 Apr 2012 13:01:12 +0000</pubDate>
		<dc:creator>Luigi</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[Errors]]></category>
		<category><![CDATA[Hardware]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[Opinions]]></category>
		<category><![CDATA[OSX]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[apple]]></category>
		<category><![CDATA[ethernet]]></category>
		<category><![CDATA[internet]]></category>
		<category><![CDATA[internet sharing]]></category>
		<category><![CDATA[lion]]></category>
		<category><![CDATA[MacBook]]></category>
		<category><![CDATA[macbook pro]]></category>
		<category><![CDATA[os x]]></category>
		<category><![CDATA[preferences]]></category>
		<category><![CDATA[problem]]></category>
		<category><![CDATA[sharing]]></category>
		<category><![CDATA[sleep]]></category>
		<category><![CDATA[smc]]></category>
		<category><![CDATA[solution]]></category>
		<category><![CDATA[system]]></category>
		<category><![CDATA[system preferences]]></category>
		<category><![CDATA[wifi]]></category>
		<category><![CDATA[Workaround]]></category>

		<guid isPermaLink="false">http://en.newinstance.it/?p=1240</guid>
		<description><![CDATA[Yesterday I noticed that when I close the lid of my MacBook Pro the light in front of the case was not indicating that the computer was going to sleep normally. Still the fans were running and when I opened the lid, I saw that it was not resuming from sleep properly, presenting a strange [...]]]></description>
			<content:encoded><![CDATA[<p><!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic -->Yesterday I noticed that when I close the lid of my MacBook Pro the light in front of the case was not indicating that the computer was going to sleep normally. Still the fans were running and when I opened the lid, I saw that it was not resuming from sleep properly, presenting a strange behavior: it asks for a password for a second or so, then the screen goes black again, and I need to turn it on manually pressing the light buttons (fn+F1/F2) then the screen appears again.</p>
<p>I debugged the problem and I discovered the cause.</p>
<p>The cause is that I enabled &#8220;Internet Sharing&#8221; from the &#8220;Sharing&#8221; item in the &#8220;System Preferences&#8221;. Basically I am sharing the WIFI internet to set of devices connected to the Ethernet.<br />
If the WIFI is enabled (and connected) and the Internet Sharing is enabled, my MacBook hangs while doing the sleep process. </p>
<p>After resetting the SMC and trying several times to close all possible apps which may interfere, I finally found that the Internet Sharing is affecting this behavior.<br />
Another workaround I found is to disable the WIFI. In this way the &#8220;Internet Sharing&#8221; is also disabled and the problem doesn&#8217;t happen anymore.</p>
<p>I reported the bug to Apple, and I hope they will have a look and try to solve it. To me, it is obviously a BUG in the Internet Sharing feature, which by the way it&#8217;s superb.
<div id="crp_related">
<h4>Related Posts:</h4>
<ul>
<li><a href="http://en.newinstance.it/2010/05/03/sharing-keyboard-and-mouse-on-multiple-computers/" rel="bookmark" class="crp_title">Sharing keyboard and mouse on multiple computers</a></li>
<li><a href="http://en.newinstance.it/2009/11/25/suspendresume-in-karmic-2/" rel="bookmark" class="crp_title">Suspend/Resume in Karmic /2</a></li>
<li><a href="http://en.newinstance.it/2008/04/01/remote-desktop-and-the-black-screen/" rel="bookmark" class="crp_title">Remote Desktop and the Black Screen</a></li>
<li><a href="http://en.newinstance.it/2007/07/17/my-new-wifi-antenna/" rel="bookmark" class="crp_title">My new WIFI antenna</a></li>
<li><a href="http://en.newinstance.it/2007/08/09/multiple-ip-on-a-single-network-interface/" rel="bookmark" class="crp_title">Multiple IP on a single network interface</a></li>
</ul>
</div>
<div class="shr-publisher-1240"></div>
<p><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic --></p>
]]></content:encoded>
			<wfw:commentRss>http://en.newinstance.it/2012/04/16/osx-internet-sharing-interfere-with-the-standby-sleep-on-macbook-pro/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>The Azure Window, in Gozo Island, Malta</title>
		<link>http://en.newinstance.it/2012/01/08/the-azure-window-in-gozo-island-malta/</link>
		<comments>http://en.newinstance.it/2012/01/08/the-azure-window-in-gozo-island-malta/#comments</comments>
		<pubDate>Sun, 08 Jan 2012 13:29:31 +0000</pubDate>
		<dc:creator>Luigi</dc:creator>
				<category><![CDATA[Life, universe and everything]]></category>

		<guid isPermaLink="false">http://en.newinstance.it/?p=1235</guid>
		<description><![CDATA[The Azure Window, in Gozo Island, Malta, a photo by Luigi R. Viggiano on Flickr. New year, new life. Got my camera bag stolen with all the gears in my hometown Turin. Yesterday I was looking back to the old pictures, and I found some good ones made with a 10 year old super compact [...]]]></description>
			<content:encoded><![CDATA[<p><!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic -->
<div style="margin: 0 0 10px 0; padding: 0; font-size: 0.8em; line-height: 1.6em;"><a href="http://www.flickr.com/photos/lviggiano/6654083029/" title="The Azure Window, in Gozo Island, Malta"><img src="http://farm8.staticflickr.com/7031/6654083029_764190ff5d.jpg" alt="The Azure Window, in Gozo Island, Malta by Luigi R. Viggiano" /></a><br/><span style="margin: 0;"><a href="http://www.flickr.com/photos/lviggiano/6654083029/">The Azure Window, in Gozo Island, Malta</a>, a photo by <a href="http://www.flickr.com/photos/lviggiano/">Luigi R. Viggiano</a> on Flickr.</span></div>
<p>New year, new life. Got my camera bag stolen with all the gears in my hometown Turin. Yesterday I was looking back to the old pictures, and I found some good ones made with a 10 year old super compact camera, Pentax Optio S. I found this one and I like it. Unfortunately I lost also this camera too, during the misadventure in Turin.</p>
<div id="crp_related">
<h4>Related Posts:</h4>
<ul>
<li><a href="http://en.newinstance.it/2012/04/19/freedom/" rel="bookmark" class="crp_title">Freedom</a></li>
<li><a href="http://en.newinstance.it/2011/09/06/venetian-mask/" rel="bookmark" class="crp_title">Venetian Mask</a></li>
<li><a href="http://en.newinstance.it/2011/11/02/sunset-on-salzburg/" rel="bookmark" class="crp_title">Sunset on Salzburg</a></li>
<li><a href="http://en.newinstance.it/2011/07/29/dusseldorf-cityscape-silhouette/" rel="bookmark" class="crp_title">Düsseldorf Cityscape Silhouette</a></li>
<li><a href="http://en.newinstance.it/2011/05/22/back-to-life/" rel="bookmark" class="crp_title">Back to life</a></li>
</ul>
</div>
<div class="shr-publisher-1235"></div>
<p><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic --></p>
]]></content:encoded>
			<wfw:commentRss>http://en.newinstance.it/2012/01/08/the-azure-window-in-gozo-island-malta/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Java Life (Code Hard) rap music video</title>
		<link>http://en.newinstance.it/2011/12/06/java-life-code-hard-rap-music-video/</link>
		<comments>http://en.newinstance.it/2011/12/06/java-life-code-hard-rap-music-video/#comments</comments>
		<pubDate>Tue, 06 Dec 2011 21:16:45 +0000</pubDate>
		<dc:creator>Luigi</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Life, universe and everything]]></category>
		<category><![CDATA[2011]]></category>
		<category><![CDATA[JavaOne]]></category>
		<category><![CDATA[life]]></category>
		<category><![CDATA[music]]></category>
		<category><![CDATA[oracle]]></category>
		<category><![CDATA[rap]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://en.newinstance.it/?p=1228</guid>
		<description><![CDATA[Another funny video I found around. Related Posts: Java4ever Lady Java Android.jar sources Android sdk 2.2_r2 sources Suspend/Resume problem in Ubuntu Karmic 9.10 running on MacBook Pro 5.1]]></description>
			<content:encoded><![CDATA[<p><!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic -->Another funny video I found around.</p>
<p><img src="http://en.newinstance.it/wp-content/plugins/html5-and-flash-video-player/default_video_player.gif" /></p>
<div id="crp_related">
<h4>Related Posts:</h4>
<ul>
<li><a href="http://en.newinstance.it/2010/07/19/java4ever/" rel="bookmark" class="crp_title">Java4ever</a></li>
<li><a href="http://en.newinstance.it/2010/08/31/lady-java/" rel="bookmark" class="crp_title">Lady Java</a></li>
<li><a href="http://en.newinstance.it/2010/05/18/androidjar-sources/" rel="bookmark" class="crp_title">Android.jar sources</a></li>
<li><a href="http://en.newinstance.it/2010/12/01/android-sdk-2-2_r2-sources/" rel="bookmark" class="crp_title">Android sdk 2.2_r2 sources</a></li>
<li><a href="http://en.newinstance.it/2009/11/20/suspendresume-problem-in-ubuntu-karmic-910-running-on-macbook-pro-51/" rel="bookmark" class="crp_title">Suspend/Resume problem in Ubuntu Karmic 9.10 running on MacBook Pro 5.1</a></li>
</ul>
</div>
<div class="shr-publisher-1228"></div>
<p><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic --></p>
]]></content:encoded>
			<wfw:commentRss>http://en.newinstance.it/2011/12/06/java-life-code-hard-rap-music-video/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://dl.dropbox.com/u/2109153/Blog/The%20Java%20Life%20Rap%20Music%20Video.flv" length="27539780" type="video/x-flv" />
		</item>
		<item>
		<title>I/O Exception handling</title>
		<link>http://en.newinstance.it/2011/11/29/io-exception-handling/</link>
		<comments>http://en.newinstance.it/2011/11/29/io-exception-handling/#comments</comments>
		<pubDate>Tue, 29 Nov 2011 13:53:16 +0000</pubDate>
		<dc:creator>Luigi</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Opinions]]></category>
		<category><![CDATA[anti-patterns]]></category>
		<category><![CDATA[exception handling]]></category>
		<category><![CDATA[exceptions]]></category>
		<category><![CDATA[patterns]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://en.newinstance.it/?p=1223</guid>
		<description><![CDATA[I very much prefer this approach: OutputStream out = new MyOutputStream(...); //may throw IOException try { //use the stream } finally { out.close(); } than this: OutputStream out = null; try { out = new MyOutputStream(...); //may throw IOException //use the stream } finally { if (out != null) { out.close(); } } I just [...]]]></description>
			<content:encoded><![CDATA[<p><!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic -->I very much prefer this approach:</p>
<pre class="brush:java">
OutputStream out = new MyOutputStream(...); //may throw IOException
try {
    //use the stream
} finally {
    out.close();
}
</pre>
<p>than this:</p>
<pre class="brush:java">
OutputStream out = null;
try {
    out = new MyOutputStream(...); //may throw IOException
    //use the stream
} finally {
    if (out != null) {
        out.close();
    }
}
</pre>
<p>I just find the first example correct and the second incorrect. I see the second &#8216;pattern&#8217; everywhere. </p>
<p>Opinions?
<div id="crp_related">
<h4>Related Posts:</h4>
<ul>
<li><a href="http://en.newinstance.it/2006/11/19/reading-javadocs-from-inside-the-original-zip-file/" rel="bookmark" class="crp_title">Reading Javadocs from inside the original zip file</a></li>
<li><a href="http://en.newinstance.it/2008/06/24/null-is-throwable/" rel="bookmark" class="crp_title">Null is throwable</a></li>
<li><a href="http://en.newinstance.it/2005/11/19/listening-changes-on-a-text-file-unix-tail-implementation-with-java/" rel="bookmark" class="crp_title">Listening changes on a text file (Unix Tail implementation with Java)</a></li>
<li><a href="http://en.newinstance.it/2010/09/10/using-files-in-your-interfaces-is-not-a-good-idea/" rel="bookmark" class="crp_title">Using Files in your interfaces is NOT a good idea</a></li>
<li><a href="http://en.newinstance.it/2006/10/19/automatic-transaction-management-with-pojos/" rel="bookmark" class="crp_title">Automatic transaction management with POJOs</a></li>
</ul>
</div>
<div class="shr-publisher-1223"></div>
<p><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic --></p>
]]></content:encoded>
			<wfw:commentRss>http://en.newinstance.it/2011/11/29/io-exception-handling/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Sunset on Salzburg</title>
		<link>http://en.newinstance.it/2011/11/02/sunset-on-salzburg/</link>
		<comments>http://en.newinstance.it/2011/11/02/sunset-on-salzburg/#comments</comments>
		<pubDate>Wed, 02 Nov 2011 10:44:03 +0000</pubDate>
		<dc:creator>Luigi</dc:creator>
				<category><![CDATA[Life, universe and everything]]></category>

		<guid isPermaLink="false">http://en.newinstance.it/2011/11/02/sunset-on-salzburg/</guid>
		<description><![CDATA[Sunset on Salzburg, a photo by Luigi R. Viggiano on Flickr. I got very positive comments about this picture I made yesterday evening in Salzburg. My only picture in flickr explore was another sunset I shot in Dusseldorf, and this one is getting good attention today, so I hope it will be my second flickr [...]]]></description>
			<content:encoded><![CDATA[<p><!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic -->
<div style="margin: 0 0 10px 0; padding: 0; font-size: 0.8em; line-height: 1.6em;"><a href="http://www.flickr.com/photos/lviggiano/6303880402/" title="Sunset on Salzburg"><img src="http://farm7.static.flickr.com/6226/6303880402_06d581043e.jpg" alt="Sunset on Salzburg by Luigi R. Viggiano" /></a><br/><span style="margin: 0;"><a href="http://www.flickr.com/photos/lviggiano/6303880402/">Sunset on Salzburg</a>, a photo by <a href="http://www.flickr.com/photos/lviggiano/">Luigi R. Viggiano</a> on Flickr.</span></div>
<p>I got very positive comments about this picture I made yesterday evening in Salzburg. My only picture in flickr explore was another sunset I shot in Dusseldorf, and this one is getting good attention today, so I hope it will be my second flickr explore pic.<br />
Some work colleagues suggested a bit of fill light at the base. I actually used some vignette effect to focus the viewer attention on the center; if the composition was a little bit better I could have cropped the base area a little bit more still keeping the sun and the mountains in the right position. <br />
Still, it looks like everybody likes this shot. So here I share it also on my blog.</p>
<div id="crp_related">
<h4>Related Posts:</h4>
<ul>
<li><a href="http://en.newinstance.it/2012/04/19/freedom/" rel="bookmark" class="crp_title">Freedom</a></li>
<li><a href="http://en.newinstance.it/2011/09/06/venetian-mask/" rel="bookmark" class="crp_title">Venetian Mask</a></li>
<li><a href="http://en.newinstance.it/2012/01/08/the-azure-window-in-gozo-island-malta/" rel="bookmark" class="crp_title">The Azure Window, in Gozo Island, Malta</a></li>
<li><a href="http://en.newinstance.it/2011/07/29/dusseldorf-cityscape-silhouette/" rel="bookmark" class="crp_title">Düsseldorf Cityscape Silhouette</a></li>
<li><a href="http://en.newinstance.it/2011/06/18/hyatt-hotel-looks-like-blade-runner-scene/" rel="bookmark" class="crp_title">Hyatt Hotel, looks like a Blade Runner scene</a></li>
</ul>
</div>
<div class="shr-publisher-1219"></div>
<p><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic --></p>
]]></content:encoded>
			<wfw:commentRss>http://en.newinstance.it/2011/11/02/sunset-on-salzburg/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Venetian Mask</title>
		<link>http://en.newinstance.it/2011/09/06/venetian-mask/</link>
		<comments>http://en.newinstance.it/2011/09/06/venetian-mask/#comments</comments>
		<pubDate>Tue, 06 Sep 2011 09:31:05 +0000</pubDate>
		<dc:creator>Luigi</dc:creator>
				<category><![CDATA[Life, universe and everything]]></category>

		<guid isPermaLink="false">http://en.newinstance.it/2011/09/06/venetian-mask/</guid>
		<description><![CDATA[Venetian Mask, a photo by Luigi R. Viggiano on Flickr. I made many pictures of those masks in Roman shops. In some shops I saw same sign saying &#34;no picture please&#34;. Eventually the idea to shot those colorful masks is not too original, and the shop owners get tired of people coming in just for [...]]]></description>
			<content:encoded><![CDATA[<p><!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic -->
<div style="margin: 0 0 10px 0; padding: 0; font-size: 0.8em; line-height: 1.6em;"><a href="http://www.flickr.com/photos/lviggiano/6093830418/" title="Venetian Mask"><img src="http://farm7.static.flickr.com/6089/6093830418_20ccfd909c.jpg" alt="Venetian Mask by Luigi R. Viggiano" /></a><br/><span style="margin: 0;"><a href="http://www.flickr.com/photos/lviggiano/6093830418/">Venetian Mask</a>, a photo by <a href="http://www.flickr.com/photos/lviggiano/">Luigi R. Viggiano</a> on Flickr.</span></div>
<p>I made many pictures of those masks in Roman shops. In some shops I saw same sign saying &quot;no picture please&quot;. Eventually the idea to shot those colorful masks is not too original, and the shop owners get tired of people coming in just for pictures. BTW those masks are for sure the most colorful subjects I found so far. And here&#8217;s another one.<br />
The price for the most funny sign in a souvenir shop goes to the one with &quot;for the sake of our health we don&#8217;t provide touristic informations!&quot;, wow :-)<br />
In my &#8216;venetian masks&#8217; set, this one above is definitely my favorite.</p>
<div id="crp_related">
<h4>Related Posts:</h4>
<ul>
<li><a href="http://en.newinstance.it/2011/11/02/sunset-on-salzburg/" rel="bookmark" class="crp_title">Sunset on Salzburg</a></li>
<li><a href="http://en.newinstance.it/2012/04/19/freedom/" rel="bookmark" class="crp_title">Freedom</a></li>
<li><a href="http://en.newinstance.it/2012/01/08/the-azure-window-in-gozo-island-malta/" rel="bookmark" class="crp_title">The Azure Window, in Gozo Island, Malta</a></li>
<li><a href="http://en.newinstance.it/2011/07/29/dusseldorf-cityscape-silhouette/" rel="bookmark" class="crp_title">Düsseldorf Cityscape Silhouette</a></li>
<li><a href="http://en.newinstance.it/2011/06/18/hyatt-hotel-looks-like-blade-runner-scene/" rel="bookmark" class="crp_title">Hyatt Hotel, looks like a Blade Runner scene</a></li>
</ul>
</div>
<div class="shr-publisher-1214"></div>
<p><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic --></p>
]]></content:encoded>
			<wfw:commentRss>http://en.newinstance.it/2011/09/06/venetian-mask/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Superdrive not working anymore</title>
		<link>http://en.newinstance.it/2011/08/25/superdrive-not-working-anymore/</link>
		<comments>http://en.newinstance.it/2011/08/25/superdrive-not-working-anymore/#comments</comments>
		<pubDate>Thu, 25 Aug 2011 11:28:02 +0000</pubDate>
		<dc:creator>Luigi</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[Errors]]></category>
		<category><![CDATA[Hardware]]></category>
		<category><![CDATA[OSX]]></category>
		<category><![CDATA[apple]]></category>
		<category><![CDATA[burning]]></category>
		<category><![CDATA[dvd]]></category>
		<category><![CDATA[lion]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[MacBook]]></category>
		<category><![CDATA[nvram]]></category>
		<category><![CDATA[pram]]></category>
		<category><![CDATA[problem]]></category>
		<category><![CDATA[smc]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[superdrive]]></category>

		<guid isPermaLink="false">http://en.newinstance.it/?p=1203</guid>
		<description><![CDATA[After installing OS X Lion I tried to burn a DVD in my macbook, and it turns out that this is what I get using Disk Utility: I tried several DVDs (DVD+R, DVD-R, different brands, and tried to burn at different speed), with no luck. Also it refuses to read movie DVDs. But it can [...]]]></description>
			<content:encoded><![CDATA[<p><!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic -->After installing OS X Lion I tried to burn a DVD in my macbook, and it turns out that this is what I get using Disk Utility:</p>
<p><img src="http://en.newinstance.it/wp-content/uploads/2011/08/Screen-Shot-2011-08-25-at-1.08.27-PM.png" alt="" title="Screen Shot 2011-08-25 at 1.08.27 PM" width="482" height="262" class="alignnone size-full wp-image-1204" /></p>
<p>I tried several DVDs (DVD+R, DVD-R, different brands, and tried to burn at different speed), with no luck. Also it refuses to read movie DVDs. But it can read the Snow Leopard DVD, so I hope that at least it can read common data DVDs.</p>
<p>I tried to reset the SMC and PRAM/NVRAM, no luck again.</p>
<p>Still remains to try some other burning software.</p>
<p>Reading support forums and searching on google has been a waste of time so far.<br />
I don&#8217;t know if this is a side effect of Lion installation, or it is just a coincidence, but since now Apple didn&#8217;t ship any update. Only I find it quite suspicious that if you just search for &#8220;Lion superdrive&#8221; you find many people having problems with those two. </p>
<p>I used my DVD very few times, if it is an <a href="https://discussions.apple.com/thread/2309664?start=0&#038;tstart=0">hardware problem</a> it means that the claimed superior hardware quality of Apple is just another myth. </p>
<p>Big disappointment by Apple, either if it is a software or hardware problem. Super&#8230;drive.
<div id="crp_related">
<h4>Related Posts:</h4>
<ul>
<li><a href="http://en.newinstance.it/2011/07/28/osx-lion-some-steps-in-the-right-direction/" rel="bookmark" class="crp_title">OSX Lion: some steps in the right direction</a></li>
<li><a href="http://en.newinstance.it/2009/03/12/apple-mightymouse-dont-buy-it/" rel="bookmark" class="crp_title">Apple MightyMouse: don&#8217;t buy it.</a></li>
<li><a href="http://en.newinstance.it/2011/05/25/fan-control-for-macbook/" rel="bookmark" class="crp_title">Fan Control for MacBook</a></li>
<li><a href="http://en.newinstance.it/2009/02/26/the-new-macbook-pro-clicking-hard-disk/" rel="bookmark" class="crp_title">The new MacBook Pro clicking hard disk</a></li>
<li><a href="http://en.newinstance.it/2011/02/10/eclipse-save-actions/" rel="bookmark" class="crp_title">Eclipse Save Actions</a></li>
</ul>
</div>
<div class="shr-publisher-1203"></div>
<p><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic --></p>
]]></content:encoded>
			<wfw:commentRss>http://en.newinstance.it/2011/08/25/superdrive-not-working-anymore/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
	</channel>
</rss>

