<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>NewInstance &#187; Windows</title>
	<atom:link href="http://en.newinstance.it/category/windows/feed/" rel="self" type="application/rss+xml" />
	<link>http://en.newinstance.it</link>
	<description>Welcome to the official blog of Luigi R. Viggiano. Beware of imitations.</description>
	<lastBuildDate>Mon, 09 Jan 2012 20:29:03 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Using VMWare to run Windows in a Sandbox</title>
		<link>http://en.newinstance.it/2011/07/01/using-vmware-to-run-windows-in-a-sandbox/</link>
		<comments>http://en.newinstance.it/2011/07/01/using-vmware-to-run-windows-in-a-sandbox/#comments</comments>
		<pubDate>Fri, 01 Jul 2011 10:12:17 +0000</pubDate>
		<dc:creator>Luigi</dc:creator>
				<category><![CDATA[Lifehacks]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[OSX]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Unix]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[sandbox]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[virtual machine]]></category>
		<category><![CDATA[vmware]]></category>

		<guid isPermaLink="false">http://en.newinstance.it/?p=1098</guid>
		<description><![CDATA[Being a Unix user (Linux/OSX) I need sometime to run some Windows utility in a Virtual Machine. But I don&#8217;t want to break the virtual machine, installing and uninstalling things, or accidentally, or by the wast hordes of viruses and malwares that infestate Windows. So, here I found how to do it: How to discard [...]]]></description>
			<content:encoded><![CDATA[<p><!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic -->Being a Unix user (Linux/OSX) I need sometime to run some Windows utility in a Virtual Machine. But I don&#8217;t want to break the virtual machine, installing and uninstalling things, or accidentally, or by the wast hordes of viruses and malwares that infestate Windows. </p>
<p>So, here I found how to do it: <a href="http://communities.vmware.com/message/722101">How to discard changes in VMWare player?</a></p>
<p><b>Q:</b> Running a virtual machine, how can I ensure that the changes gets discarded after I close it?</p>
<p><b>A:</b> Shutdown the VM cleanly. Edit the vmx and add this line if the VM uses a scsi-disk</p>
<pre>
scsi0:0.mode = "independent-nonpersistent"
</pre>
<p>or this if the VM uses an IDE-disk</p>
<pre>
ide0:0.mode = "independent-nonpersistent"
</pre>
<p>Alternatively, use this two lines:</p>
<pre>
snapshot.action = "autoRevert"
snapshot.disabled = "TRUE"
</pre>
<p>Several ways lead to Rome.  Both ways should work, but don&#8217;t mix them.
<div id="crp_related">
<h4>Related Posts:</h4>
<ul>
<li><a href="http://en.newinstance.it/2006/07/05/free-virtualization-for-windows-with-qemu/" rel="bookmark" class="crp_title">Free Virtualization for Windows with Qemu</a></li>
<li><a href="http://en.newinstance.it/2008/03/04/ubuntu-710-on-lenovo-t61/" rel="bookmark" class="crp_title">Ubuntu 7.10 on Lenovo T61</a></li>
<li><a href="http://en.newinstance.it/2009/08/28/linux-ram-disks/" rel="bookmark" class="crp_title">Linux RAM Disks</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/11/26/karmic-and-luks-usb-drive-encryption-made-almost-easy/" rel="bookmark" class="crp_title">Karmic and Luks: USB drive encryption made (almost) easy</a></li>
</ul>
</div>
<div class="shr-publisher-1098"></div>
<p><!-- Start Shareaholic LikeButtonSetBottom Automatic -->
<div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div>
<div class='shareaholic-like-buttonset' style='float:none;height:30px;'><a class='shareaholic-fblike' data-shr_layout='button_count' data-shr_showfaces='false' data-shr_href='http%3A%2F%2Fen.newinstance.it%2F2011%2F07%2F01%2Fusing-vmware-to-run-windows-in-a-sandbox%2F' data-shr_title='Using+VMWare+to+run+Windows+in+a+Sandbox'></a><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='true' data-shr_href='http%3A%2F%2Fen.newinstance.it%2F2011%2F07%2F01%2Fusing-vmware-to-run-windows-in-a-sandbox%2F' data-shr_title='Using+VMWare+to+run+Windows+in+a+Sandbox'></a><a class='shareaholic-tweetbutton' data-shr_count='none' data-shr_href='http%3A%2F%2Fen.newinstance.it%2F2011%2F07%2F01%2Fusing-vmware-to-run-windows-in-a-sandbox%2F' data-shr_title='Using+VMWare+to+run+Windows+in+a+Sandbox'></a></div>
<div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div>
<p><!-- End Shareaholic LikeButtonSetBottom Automatic --></p>
]]></content:encoded>
			<wfw:commentRss>http://en.newinstance.it/2011/07/01/using-vmware-to-run-windows-in-a-sandbox/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Java4ever</title>
		<link>http://en.newinstance.it/2010/07/19/java4ever/</link>
		<comments>http://en.newinstance.it/2010/07/19/java4ever/#comments</comments>
		<pubDate>Mon, 19 Jul 2010 19:07:19 +0000</pubDate>
		<dc:creator>Luigi</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Life, universe and everything]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[4ever]]></category>
		<category><![CDATA[forever]]></category>
		<category><![CDATA[funny]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://en.newinstance.it/?p=663</guid>
		<description><![CDATA[A super funny video about a young and rebel Java developer grown in a Microsoft family. Hope you'll enjoy as I did. I think the original source of the video is here. Related Posts: Java Life (Code Hard) rap music video Lady Java Javaprxy.dll closes Internet Explorer Give color to your code! Android.jar sources]]></description>
			<content:encoded><![CDATA[<p><!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic -->A super funny video about a young and rebel Java developer grown in a Microsoft family.</p>
<p><img src="http://en.newinstance.it/wp-content/plugins/html5-and-flash-video-player/default_video_player.gif" /></p>
<p>Hope you'll enjoy as I did.</p>
<p>I think the original source of the video is <a href="http://jz10.java.no/java-4-ever-trailer.html">here</a>.
<div id="crp_related">
<h4>Related Posts:</h4>
<ul>
<li><a href="http://en.newinstance.it/2011/12/06/java-life-code-hard-rap-music-video/" rel="bookmark" class="crp_title">Java Life (Code Hard) rap music video</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/2005/07/06/javaprxydll-closes-internet-explorer/" rel="bookmark" class="crp_title">Javaprxy.dll closes Internet Explorer</a></li>
<li><a href="http://en.newinstance.it/2006/12/02/give-color-to-your-code/" rel="bookmark" class="crp_title">Give color to your code!</a></li>
<li><a href="http://en.newinstance.it/2010/05/18/androidjar-sources/" rel="bookmark" class="crp_title">Android.jar sources</a></li>
</ul>
</div>
<div class="shr-publisher-663"></div>
<p><!-- Start Shareaholic LikeButtonSetBottom Automatic -->
<div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div>
<div class='shareaholic-like-buttonset' style='float:none;height:30px;'><a class='shareaholic-fblike' data-shr_layout='button_count' data-shr_showfaces='false' data-shr_href='http%3A%2F%2Fen.newinstance.it%2F2010%2F07%2F19%2Fjava4ever%2F' data-shr_title='Java4ever'></a><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='true' data-shr_href='http%3A%2F%2Fen.newinstance.it%2F2010%2F07%2F19%2Fjava4ever%2F' data-shr_title='Java4ever'></a><a class='shareaholic-tweetbutton' data-shr_count='none' data-shr_href='http%3A%2F%2Fen.newinstance.it%2F2010%2F07%2F19%2Fjava4ever%2F' data-shr_title='Java4ever'></a></div>
<div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div>
<p><!-- End Shareaholic LikeButtonSetBottom Automatic --></p>
]]></content:encoded>
			<wfw:commentRss>http://en.newinstance.it/2010/07/19/java4ever/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://dl.dropbox.com/u/2109153/Blog/JavaZoneTrailer.flv" length="23610061" type="video/x-flv" />
		</item>
		<item>
		<title>Sharing keyboard and mouse on multiple computers</title>
		<link>http://en.newinstance.it/2010/05/03/sharing-keyboard-and-mouse-on-multiple-computers/</link>
		<comments>http://en.newinstance.it/2010/05/03/sharing-keyboard-and-mouse-on-multiple-computers/#comments</comments>
		<pubDate>Mon, 03 May 2010 15:23:21 +0000</pubDate>
		<dc:creator>Luigi</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[Lifehacks]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[How-To]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[OSX]]></category>
		<category><![CDATA[Tricks]]></category>

		<guid isPermaLink="false">http://en.newinstance.it/2010/05/03/sharing-keyboard-and-mouse-on-multiple-computers/</guid>
		<description><![CDATA[If you have more than one laptop/computer on your desktop, you may find yourself jumping from a keyboard to another to make use of them. In this article I explain how I configured my laptops to share keyboard and mouse using synergy. It is always a good thing to have a second monitor, for example [...]]]></description>
			<content:encoded><![CDATA[<p><!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic -->If you have more than one laptop/computer on your desktop, you may find yourself jumping from a keyboard to another to make use of them. In this article I explain how I configured my laptops to share keyboard and mouse using synergy.</p>
<p>It is always a good thing to have a second monitor, for example to read documentation while doing some development, or for listening to music or watching videos while doing things that do not require full attention.<br />
I have an ancient (10 years old) Dell Inspiron 8600 laptop on which the keyboard and the touchpad are starting to lose efficiency, but still it has a great display and an unrivaled audio system. The keyboard is pretty different from the macbook I am using daily, and dealing with different keyboards may not be so enjoyable. Also being an old generation laptop, the keyboard it's not very pleasant to the touch, and sometime it loses some key press. </p>
<p>With <a href="http://synergy2.sourceforge.net/">Synergy</a>, it is possible to control remote computers with a single keyboard and mouse. So now, I can work on my MacBook running OSX Snow Leopard and control also the second laptop, the ancient Dell on my desk running Ubuntu 10.4, without switching keyboard or mouse. A second thing that comes for free with Synergy is the clipboard sharing; this means that you can cut-and-paste across the computers you are using: it is very helpful.<br />
You can find more information about synergy at the <a href="http://synergy2.sourceforge.net/">official site</a>.</p>
<p>First of all, you need to install synergy executable files on all the computers you need to control. Download it from <a href="http://sourceforge.net/projects/synergy2/files/">here</a>. Then, ensure that the computer can see each others on the network, using ip address or dns names. If they can ping each others, usually it should be enough.<br />
On ubuntu you can install synergy using apt-get, while on the mac you can download the executables packed into a tarball and unpack them in a any folder you like, in my case I used ~/opt/synergy-1.3.1.</p>
<p>I want to use my mac's keyboard and mouse to control the dell laptop. You can have a single controller computer and many controlled computers. The controller will need the synergy server, while the controlled computers will run the client.<br />
So on my macbook I created a configuration file which describes computers I want to control and what edge of the screen is the "border" from which the mouse will jump on the other computers. I placed it under ~/etc/synergy.conf :</p>
<pre>
section: screens
    dell:
    macbook:
end

section: links
    dell:
        left = macbook
    macbook:
        right = dell
end
</pre>
<p>The above configuration describe my screens configuration and the links between the laptops. Basicallly I am telling that I have two screens, the dell one and the macbook. And for the dell I have a macbook on the left, and for the macbook I have the dell on the right. There are many other options, but here I am just using the defaults. The full documentation on the configuration options can be found <a href="http://synergy2.sourceforge.net/configuration.html">here</a>.</p>
<p>Then I have to start the Synergy server on the macbook using the command:</p>
<pre>
$ synergys --config ~/etc/synergy.conf
</pre>
<p>On the dell computer then I need to run the client, who will connect to the macbook (the controller laptop) and act consequently. To do so, I can connect the client launching one of the following commands</p>
<pre>

// supposing 192.168.1.123 is the ip of my macbook
$ synergyc 192.168.1.123

// in my network I can refer the server as macbook.local or just macbook.
$ synergyc macbook.local
// or
$ synergyc macbook
</pre>
<p>After doing so, you should be able to move your mouse from one computer to the other(s) just passing through the edges of the screens, and control all the computers on your desk.</p>
<p>If something goes wrong, you can use the -f option to run the client and the server in foreground, and the -d to enable debug tracing. </p>
<p>If you still have troubles with command line tools, you may want to try <a href="http://www.volker-lanz.de/en/software/qsynergy/">QSynergy</a>, which is a graphical user interface over synergy.</p>
<p>Yet it is missing some "file sharing" feature; it would be very good if synergy was able to copy files dragging and dropping files from a desk to another, but at the moment, this is missing.  Installing OpenSSH can do what is missing: file transfers (scp) and remote ssh logins should be enough to complete synergy desktop integration.</p>
<p>Here there is a video that visually explains what you can do with Synergy:</p>
<p><object width="480" height="385"><param name="movie" value="http://www.youtube.com/v/UdP1Rei2muw&#038;hl=en_US&#038;fs=1&#038;"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/UdP1Rei2muw&#038;hl=en_US&#038;fs=1&#038;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"></embed></object></p>
<p>It looks like in the video she forgot to start the client; btw it is just needed to launch the synergyc executable as I explained above.</p>
<p>And here, a guy shared his mouse and keyboard over 7 computers using synergy:</p>
<p><object width="480" height="385"><param name="movie" value="http://www.youtube.com/v/Id3GHAruhAk&#038;hl=en_US&#038;fs=1&#038;"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/Id3GHAruhAk&#038;hl=en_US&#038;fs=1&#038;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"></embed></object></p>
<p>Have fun.
<div id="crp_related">
<h4>Related Posts:</h4>
<ul>
<li><a href="http://en.newinstance.it/2008/11/10/wassup-yesterday-and-today/" rel="bookmark" class="crp_title">Wassup yesterday and today</a></li>
<li><a href="http://en.newinstance.it/2009/01/06/reinventing-the-wheel/" rel="bookmark" class="crp_title">Reinventing the wheel.</a></li>
<li><a href="http://en.newinstance.it/2005/12/23/ubuntu-on-my-laptop/" rel="bookmark" class="crp_title">Ubuntu on my laptop</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/2008/11/01/the-intrepid-ibex-on-dell-inspiron-8600/" rel="bookmark" class="crp_title">The Intrepid Ibex on Dell Inspiron 8600</a></li>
</ul>
</div>
<div class="shr-publisher-419"></div>
<p><!-- Start Shareaholic LikeButtonSetBottom Automatic -->
<div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div>
<div class='shareaholic-like-buttonset' style='float:none;height:30px;'><a class='shareaholic-fblike' data-shr_layout='button_count' data-shr_showfaces='false' data-shr_href='http%3A%2F%2Fen.newinstance.it%2F2010%2F05%2F03%2Fsharing-keyboard-and-mouse-on-multiple-computers%2F' data-shr_title='Sharing+keyboard+and+mouse+on+multiple+computers'></a><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='true' data-shr_href='http%3A%2F%2Fen.newinstance.it%2F2010%2F05%2F03%2Fsharing-keyboard-and-mouse-on-multiple-computers%2F' data-shr_title='Sharing+keyboard+and+mouse+on+multiple+computers'></a><a class='shareaholic-tweetbutton' data-shr_count='none' data-shr_href='http%3A%2F%2Fen.newinstance.it%2F2010%2F05%2F03%2Fsharing-keyboard-and-mouse-on-multiple-computers%2F' data-shr_title='Sharing+keyboard+and+mouse+on+multiple+computers'></a></div>
<div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div>
<p><!-- End Shareaholic LikeButtonSetBottom Automatic --></p>
]]></content:encoded>
			<wfw:commentRss>http://en.newinstance.it/2010/05/03/sharing-keyboard-and-mouse-on-multiple-computers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tomboy on Mac (and Windows)</title>
		<link>http://en.newinstance.it/2009/01/29/tomboy-on-mac-and-windows/</link>
		<comments>http://en.newinstance.it/2009/01/29/tomboy-on-mac-and-windows/#comments</comments>
		<pubDate>Thu, 29 Jan 2009 05:15:56 +0000</pubDate>
		<dc:creator>Luigi</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[Lifehacks]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://en.newinstance.it/2009/01/29/tomboy-on-mac-and-windows/</guid>
		<description><![CDATA[Finally Tomboy is available on Mac! It's the best note taking application I've ever seen. Give it a try. Update: latest version: Mono 2.2 Tomboy 0.13.4 Related Posts: Gnome Panel Freezes Font size problem with Gnome using Motif applications Ganymede and Subversive, finally got installed and working Cool tool: Windows Live Writer How to save [...]]]></description>
			<content:encoded><![CDATA[<p><!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic -->Finally <a href="http://projects.gnome.org/tomboy/">Tomboy</a> is available on Mac!</p>
<p><a href="http://automorphic.blogspot.com/2008/10/tomboy-preview-for-windows-and-mac.html"><img src="http://2.bp.blogspot.com/_brJXLM5a6qM/SPxYY_l0HcI/AAAAAAAADvc/izkTcE0t7KE/s400/tomboy-mac-dock-small.png" alt="Tomboy on mac" /><br />
</a></p>
<p>It's the best note taking application I've ever seen. <a href="http://automorphic.blogspot.com/2008/10/tomboy-preview-for-windows-and-mac.html">Give it a try</a>.</p>
<p>Update: latest version:<br />
<a href="http://ftp.novell.com/pub/mono/archive/2.2/macos-10-universal/5/">Mono 2.2</a><br />
<a href="http://ftp.gnome.org/pub/GNOME/binaries/mac/tomboy/0.13/">Tomboy 0.13.4</a>
<div id="crp_related">
<h4>Related Posts:</h4>
<ul>
<li><a href="http://en.newinstance.it/2008/05/23/gnome-panel-freezes/" rel="bookmark" class="crp_title">Gnome Panel Freezes</a></li>
<li><a href="http://en.newinstance.it/2006/02/01/font-size-problem-with-gnome-using-motif-applications/" rel="bookmark" class="crp_title">Font size problem with Gnome using Motif applications</a></li>
<li><a href="http://en.newinstance.it/2008/09/03/ganymede-and-subversive-finally-got-installed-and-working/" rel="bookmark" class="crp_title">Ganymede and Subversive, finally got installed and working</a></li>
<li><a href="http://en.newinstance.it/2006/08/16/cool-tool-windows-live-writer/" rel="bookmark" class="crp_title">Cool tool: Windows Live Writer</a></li>
<li><a href="http://en.newinstance.it/2008/10/14/how-to-save-70-euro-booking-your-flight-with-lufthansa/" rel="bookmark" class="crp_title">How to save 70 euro booking your flight with Lufthansa</a></li>
</ul>
</div>
<div class="shr-publisher-349"></div>
<p><!-- Start Shareaholic LikeButtonSetBottom Automatic -->
<div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div>
<div class='shareaholic-like-buttonset' style='float:none;height:30px;'><a class='shareaholic-fblike' data-shr_layout='button_count' data-shr_showfaces='false' data-shr_href='http%3A%2F%2Fen.newinstance.it%2F2009%2F01%2F29%2Ftomboy-on-mac-and-windows%2F' data-shr_title='Tomboy+on+Mac+%28and+Windows%29'></a><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='true' data-shr_href='http%3A%2F%2Fen.newinstance.it%2F2009%2F01%2F29%2Ftomboy-on-mac-and-windows%2F' data-shr_title='Tomboy+on+Mac+%28and+Windows%29'></a><a class='shareaholic-tweetbutton' data-shr_count='none' data-shr_href='http%3A%2F%2Fen.newinstance.it%2F2009%2F01%2F29%2Ftomboy-on-mac-and-windows%2F' data-shr_title='Tomboy+on+Mac+%28and+Windows%29'></a></div>
<div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div>
<p><!-- End Shareaholic LikeButtonSetBottom Automatic --></p>
]]></content:encoded>
			<wfw:commentRss>http://en.newinstance.it/2009/01/29/tomboy-on-mac-and-windows/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Wine &amp; Excel: Error accessing file. Network connection may have been lost</title>
		<link>http://en.newinstance.it/2008/04/25/wine-excel-error-accessing-file-network-connection-may-have-been-lost/</link>
		<comments>http://en.newinstance.it/2008/04/25/wine-excel-error-accessing-file-network-connection-may-have-been-lost/#comments</comments>
		<pubDate>Fri, 25 Apr 2008 14:52:38 +0000</pubDate>
		<dc:creator>Luigi</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://en.newinstance.it/2008/04/25/wine-excel-error-accessing-file-network-connection-may-have-been-lost/</guid>
		<description><![CDATA[I&#8217;ve successfully installed Microsoft Office XP on Linux using Wine. It works quite fine and it&#8217;s really fast. I got some problems with Macros in Excel, and in particular I was getting the error &#8220;Error accessing file. Network connection may have been lost&#8221; on every startup. But I found a way to avoid that annoying [...]]]></description>
			<content:encoded><![CDATA[<p><!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><img src="http://img402.imageshack.us/img402/4162/screenshotmicrosoftvisuuv0.png" alt="Excel Error" /></p>
<p>I&#8217;ve successfully installed Microsoft Office XP on Linux using Wine. It works quite fine and it&#8217;s really fast. I got some problems with Macros in Excel, and in particular I was getting the error &#8220;<a href="http://www.codeweavers.com/support/tickets/browse/?ticket_id=111762">Error accessing file. Network connection may have been lost</a>&#8221; on every startup. But I found a way to avoid that annoying message to be displayed: from the Tools Menu, select &#8220;Add-ins&#8221; and disable the &#8220;Euro Currency Tools&#8221;.<br />
Surprisingly I didn&#8217;t found anything on internet on how to avoid the error, so I had to struggle with Excel options for some hours to get rid of that.</p>
<div id="crp_related">
<h4>Related Posts:</h4>
<ul>
<li><a href="http://en.newinstance.it/2006/11/03/excel-file-generation-made-easyer/" rel="bookmark" class="crp_title">Excel file generation made easy(er)</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>
<li><a href="http://en.newinstance.it/2010/01/08/3g-usb-stick-on-ubuntu/" rel="bookmark" class="crp_title">3G USB Stick on Ubuntu</a></li>
<li><a href="http://en.newinstance.it/2007/08/29/wordpress-database-error-cant-open-file-wp_commentsmyi-errno-145/" rel="bookmark" class="crp_title">WordPress database error: [Can't open file: 'wp_comments.MYI'. (errno: 145)]</a></li>
<li><a href="http://en.newinstance.it/2008/07/02/disappointed-by-ganymede/" rel="bookmark" class="crp_title">Disappointed by Ganymede</a></li>
</ul>
</div>
<div class="shr-publisher-281"></div>
<p><!-- Start Shareaholic LikeButtonSetBottom Automatic -->
<div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div>
<div class='shareaholic-like-buttonset' style='float:none;height:30px;'><a class='shareaholic-fblike' data-shr_layout='button_count' data-shr_showfaces='false' data-shr_href='http%3A%2F%2Fen.newinstance.it%2F2008%2F04%2F25%2Fwine-excel-error-accessing-file-network-connection-may-have-been-lost%2F' data-shr_title='Wine+%26+Excel%3A+Error+accessing+file.+Network+connection+may+have+been+lost'></a><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='true' data-shr_href='http%3A%2F%2Fen.newinstance.it%2F2008%2F04%2F25%2Fwine-excel-error-accessing-file-network-connection-may-have-been-lost%2F' data-shr_title='Wine+%26+Excel%3A+Error+accessing+file.+Network+connection+may+have+been+lost'></a><a class='shareaholic-tweetbutton' data-shr_count='none' data-shr_href='http%3A%2F%2Fen.newinstance.it%2F2008%2F04%2F25%2Fwine-excel-error-accessing-file-network-connection-may-have-been-lost%2F' data-shr_title='Wine+%26+Excel%3A+Error+accessing+file.+Network+connection+may+have+been+lost'></a></div>
<div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div>
<p><!-- End Shareaholic LikeButtonSetBottom Automatic --></p>
]]></content:encoded>
			<wfw:commentRss>http://en.newinstance.it/2008/04/25/wine-excel-error-accessing-file-network-connection-may-have-been-lost/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Remote Desktop and the Black Screen</title>
		<link>http://en.newinstance.it/2008/04/01/remote-desktop-and-the-black-screen/</link>
		<comments>http://en.newinstance.it/2008/04/01/remote-desktop-and-the-black-screen/#comments</comments>
		<pubDate>Mon, 31 Mar 2008 22:03:15 +0000</pubDate>
		<dc:creator>Luigi</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://en.newinstance.it/2008/04/01/remote-desktop-and-the-black-screen/</guid>
		<description><![CDATA[Got the problem this evening, and I&#8217;ve been getting crazy for a couple of hours. Quick solution for the inpatients: the &#8220;fast user switching&#8221; and the &#8220;welcome screen&#8221; feature in XP makes Remote Desktop not work properly. So, disable it and you&#8217;ll solve 90% of rdesktop problems. (Notice that those two options needs to be [...]]]></description>
			<content:encoded><![CDATA[<p><!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic -->Got <a href="http://www.google.com/search?q=rdesktop+black+screen">the problem</a> this evening, and I&#8217;ve been getting crazy for a couple of hours. </p>
<p>Quick solution for the inpatients: the &#8220;fast user switching&#8221; and the &#8220;welcome screen&#8221; feature in XP makes Remote Desktop not work properly. So, disable it and you&#8217;ll solve 90% of rdesktop problems. (Notice that those two options needs to be enabled in order to make the <a href="https://help.ubuntu.com/community/SeamlessVirtualization">Seamless RDP</a> work)</p>
<p>What happens is that the &#8220;fast user switching&#8221; misfeature drops connections on logout (and don&#8217;t starts connections on startup until some user logs in). If there is no user logged in or if the user logs out, the networks gets disabled, and you cannot connect using Remote Desktop.<br />
When you try to open a remote desktop and the same user is already logged in locally, the local user gets disconnected and computer display the &#8220;fast user switching&#8221; screen, but doing that also drops all the connections, and from the remote desktop client you get a black screen (just after inserting the user name and password).</p>
<p>How to solve:</p>
<p>1. Disable the &#8220;fast user switching&#8221; and the &#8220;welcome screen&#8221;<br />
Open User Accounts in Control Panel.<br />
Click Change the way users log on or off.<br />
Clear the &#8220;Use Fast User Switching&#8221; check box.<br />
Clear the &#8220;Welcome Screen&#8221; checkbox.<br />
Apply the changes.</p>
<p>2. If you still get disconnections on user logout, try setting up the KeepRasConnections key on the registry:<br />
Open regedit and go to the path:<br />
HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon<br />
Create a new String value, or modify the existing value, called &#8220;KeepRasConnections&#8221; and set it to &#8220;1&#8243;.<br />
Exit your registry and restart Windows, as usual</p>
<p>This should work. It did, for me.
<div id="crp_related">
<h4>Related Posts:</h4>
<ul>
<li><a href="http://en.newinstance.it/2005/07/28/bug-parade/" rel="bookmark" class="crp_title">Bug Parade</a></li>
<li><a href="http://en.newinstance.it/2005/09/02/improving-security-on-openssh/" rel="bookmark" class="crp_title">Improving security on OpenSSH</a></li>
<li><a href="http://en.newinstance.it/2008/03/04/ubuntu-710-on-lenovo-t61/" rel="bookmark" class="crp_title">Ubuntu 7.10 on Lenovo T61</a></li>
<li><a href="http://en.newinstance.it/2008/06/27/the-passwords-hell/" rel="bookmark" class="crp_title">The passwords hell</a></li>
<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>
</ul>
</div>
<div class="shr-publisher-279"></div>
<p><!-- Start Shareaholic LikeButtonSetBottom Automatic -->
<div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div>
<div class='shareaholic-like-buttonset' style='float:none;height:30px;'><a class='shareaholic-fblike' data-shr_layout='button_count' data-shr_showfaces='false' data-shr_href='http%3A%2F%2Fen.newinstance.it%2F2008%2F04%2F01%2Fremote-desktop-and-the-black-screen%2F' data-shr_title='Remote+Desktop+and+the+Black+Screen'></a><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='true' data-shr_href='http%3A%2F%2Fen.newinstance.it%2F2008%2F04%2F01%2Fremote-desktop-and-the-black-screen%2F' data-shr_title='Remote+Desktop+and+the+Black+Screen'></a><a class='shareaholic-tweetbutton' data-shr_count='none' data-shr_href='http%3A%2F%2Fen.newinstance.it%2F2008%2F04%2F01%2Fremote-desktop-and-the-black-screen%2F' data-shr_title='Remote+Desktop+and+the+Black+Screen'></a></div>
<div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div>
<p><!-- End Shareaholic LikeButtonSetBottom Automatic --></p>
]]></content:encoded>
			<wfw:commentRss>http://en.newinstance.it/2008/04/01/remote-desktop-and-the-black-screen/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Things that Windows Mobile smartphones can&#8217;t do</title>
		<link>http://en.newinstance.it/2008/03/28/things-that-windows-mobile-cellphones-cant-do/</link>
		<comments>http://en.newinstance.it/2008/03/28/things-that-windows-mobile-cellphones-cant-do/#comments</comments>
		<pubDate>Thu, 27 Mar 2008 23:09:40 +0000</pubDate>
		<dc:creator>Luigi</dc:creator>
				<category><![CDATA[Hardware]]></category>
		<category><![CDATA[Life, universe and everything]]></category>
		<category><![CDATA[Opinions]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://it.newinstance.it/2008/03/28/things-that-windows-mobile-cellphones-cant-do/</guid>
		<description><![CDATA[Who designed Windows Mobile should be killed, but very slowly&#8230; I have an HTC3300 with Windows Mobile 5.0, and as a phone, my Nokia 3210 was much better. Also my Palm Tungsten T2 was much better to handle contacts, TODO lists, calendar, notes, etc. Actually I continue using the Tungsten T2 as PIM, because of [...]]]></description>
			<content:encoded><![CDATA[<p><!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic -->Who designed Windows Mobile should be killed, but very slowly&#8230;</p>
<p>I have an HTC3300 with Windows Mobile 5.0, and as a phone, my Nokia 3210 was much better. Also my Palm Tungsten T2 was much better to handle contacts, TODO lists, calendar, notes, etc. Actually I continue using the Tungsten T2 as PIM, because of how stupid Windows Mobile is. At the beginning I thought that it was me that was not still accustomed with the new software. But now it&#8217;s one year that I try to use it and I still get puzzled by the stupid Windows Mobile.</p>
<p>Some things that almost all the phones can do and Windows Mobile can&#8217;t:</p>
<ul>
<li>Assign more than one mobile phone number to a contact</li>
<li>Send an SMS to a phone number that is not classified as &#8220;mobile phone number&#8221; in the address book</li>
<li>Assign a ring tone to a Contact Group</li>
<li>Assign a tone to SMS notification</li>
</ul>
<p>Moreover, the feature to add and edit contacts has been probably designed by someone escaped from a mental hygienic institute: you have to scroll up and down to search the few fields you need to fill, and the controls to cancel or confirm your changes are almost hidden.<br />
Other applications are bad as well. For example the graffiti help doesn&#8217;t give you the correct information on how to write most of special characters (like $, €, etc)</p>
<p>Most of <a href="http://euro.palm.com/it/it/products/smartphones/index.html">latest Palm smart phones</a> are using Windows Mobile. That&#8217;s a real pity. Palm already did a bad choice when they moved from Graffiti 1 to Graffiti 2. Fortunately I found the way to use Graffiti 1 on the Tungsten T2.</p>
<p>I&#8217;ll never buy another Windows Mobile handy or PIM, I hope that device producers will find a better OS to install on their products. Windows Mobile must die.</p>
<div id="crp_related">
<h4>Related Posts:</h4>
<ul>
<li><a href="http://en.newinstance.it/2008/03/28/how-to-filter-phone-calls-from-any-mobile-phone/" rel="bookmark" class="crp_title">How to filter phone calls from any mobile phone</a></li>
<li><a href="http://en.newinstance.it/2008/06/22/my-best-buy-of-2007/" rel="bookmark" class="crp_title">My best buy of 2007</a></li>
<li><a href="http://en.newinstance.it/2011/07/01/using-vmware-to-run-windows-in-a-sandbox/" rel="bookmark" class="crp_title">Using VMWare to run Windows in a Sandbox</a></li>
<li><a href="http://en.newinstance.it/2010/01/08/3g-usb-stick-on-ubuntu/" rel="bookmark" class="crp_title">3G USB Stick on Ubuntu</a></li>
<li><a href="http://en.newinstance.it/2008/03/05/changing-the-mac-address-on-linux-and-windows/" rel="bookmark" class="crp_title">Changing the MAC Address on Linux and Windows</a></li>
</ul>
</div>
<div class="shr-publisher-275"></div>
<p><!-- Start Shareaholic LikeButtonSetBottom Automatic -->
<div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div>
<div class='shareaholic-like-buttonset' style='float:none;height:30px;'><a class='shareaholic-fblike' data-shr_layout='button_count' data-shr_showfaces='false' data-shr_href='http%3A%2F%2Fen.newinstance.it%2F2008%2F03%2F28%2Fthings-that-windows-mobile-cellphones-cant-do%2F' data-shr_title='Things+that+Windows+Mobile+smartphones+can%27t+do'></a><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='true' data-shr_href='http%3A%2F%2Fen.newinstance.it%2F2008%2F03%2F28%2Fthings-that-windows-mobile-cellphones-cant-do%2F' data-shr_title='Things+that+Windows+Mobile+smartphones+can%27t+do'></a><a class='shareaholic-tweetbutton' data-shr_count='none' data-shr_href='http%3A%2F%2Fen.newinstance.it%2F2008%2F03%2F28%2Fthings-that-windows-mobile-cellphones-cant-do%2F' data-shr_title='Things+that+Windows+Mobile+smartphones+can%27t+do'></a></div>
<div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div>
<p><!-- End Shareaholic LikeButtonSetBottom Automatic --></p>
]]></content:encoded>
			<wfw:commentRss>http://en.newinstance.it/2008/03/28/things-that-windows-mobile-cellphones-cant-do/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Multiple IP on a single network interface</title>
		<link>http://en.newinstance.it/2007/08/09/multiple-ip-on-a-single-network-interface/</link>
		<comments>http://en.newinstance.it/2007/08/09/multiple-ip-on-a-single-network-interface/#comments</comments>
		<pubDate>Thu, 09 Aug 2007 10:28:30 +0000</pubDate>
		<dc:creator>Luigi</dc:creator>
				<category><![CDATA[Internet]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://en.newinstance.it/2007/08/09/multiple-ip-on-a-single-network-interface/</guid>
		<description><![CDATA[If you use tools like netswitcher to configure on the fly more profiles for accessing the networks from home / office / Internet Cafe you may have a look at netsh command line provided by Windows, that can do this and more weird things, like binding more IP addresses to your network interface. For example, [...]]]></description>
			<content:encoded><![CDATA[<p><!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic -->If you use tools like <a href="http://www.netswitcher.com/">netswitcher</a> to configure on the fly more profiles for accessing the networks from home / office / Internet Cafe you may have a look at <a href="http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/netsh.mspx?mfr=true">netsh</a> command line provided by Windows, that can do this and more weird things, like binding more IP addresses to your network interface.</p>
<p>For example, at home I have a WIFI access point and I don&#8217;t use DHCP. But I don&#8217;t want to expose the administration console of the access point to Internet, so I put the administration console on a different subnet that is only accessible by air if you are around it. On my laptop then I need to access the Internet subnet (192.168.125.*) routed by the access point and the Intranet subnet (10.21.35.*) to access the access-point administration console, using only my WIFI network card.<br />
This is the script &#8220;WIFI Home Static IP.nsh&#8221; to do that:</p>
<pre>
interface ip
set address name="Wireless Network Connection" source=static addr=192.168.125.77 mask=255.255.255.0 gateway=192.168.125.1 gwmetric=0
add address name="Wireless Network Connection" addr=10.21.35.2  mask=255.255.255.0
set dns name="Wireless Network Connection" source=static addr=192.168.178.1
</pre>
<p>The above script sets two IP addresses and related subnets details for the interface called &#8220;Wireless Network Connection&#8221;. The interface name comes from the Network Connections dialog of Windows.</p>
<p>To execute the script you use the command:<br />
<code>netsh -f "WIFI Home Static IP.nsh"</code></p>
<p>Executing that, this is my ipconfig output</p>
<pre>
Scheda Ethernet Wireless Network Connection:

        Suffisso DNS specifico per connessione:
        Indirizzo IP. . . . . . . . . . . . . : 10.21.35.2
        Subnet mask . . . . . . . . . . . . . : 255.255.255.0
        Indirizzo IP. . . . . . . . . . . . . : 192.168.125.77
        Subnet mask . . . . . . . . . . . . . : 255.255.255.0
        Gateway predefinito . . . . . . . . . : 192.168.125.1
</pre>
<p>And to restore the default IP settings for other networks (using DHCP for obtaining single IP and DNS) I use this other script called &#8220;WI-FI DHCP.nsh&#8221;:</p>
<pre>
interface ip
set address name="Wireless Network Connection" source=dhcp
set dns name="Wireless Network Connection" source=dhcp
</pre>
<p>The above lines sets IP and DNS address to be obtained automatically from the DHCP (that is the default behavior), for my Wireless Network Connection.</p>
<p>To do things quickly I associated the <code>.nsh</code> file extension to the command <code>netsh -f "%1"</code> and now I can switch network settings just clicking on an icon.</p>
<p>Learning to create netsh scripts can help much if you bring your laptop in different networks.
<div id="crp_related">
<h4>Related Posts:</h4>
<ul>
<li><a href="http://en.newinstance.it/2008/03/05/changing-the-mac-address-on-linux-and-windows/" rel="bookmark" class="crp_title">Changing the MAC Address on Linux and Windows</a></li>
<li><a href="http://en.newinstance.it/2005/06/11/automatic-proxy-switching/" rel="bookmark" class="crp_title">Automatic Proxy Switching</a></li>
<li><a href="http://en.newinstance.it/2008/04/25/wine-excel-error-accessing-file-network-connection-may-have-been-lost/" rel="bookmark" class="crp_title">Wine &#038; Excel: Error accessing file. Network connection may have been lost</a></li>
<li><a href="http://en.newinstance.it/2009/12/03/ipod-touch-with-linux/" rel="bookmark" class="crp_title">Ipod touch with Linux</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>
</ul>
</div>
<div class="shr-publisher-257"></div>
<p><!-- Start Shareaholic LikeButtonSetBottom Automatic -->
<div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div>
<div class='shareaholic-like-buttonset' style='float:none;height:30px;'><a class='shareaholic-fblike' data-shr_layout='button_count' data-shr_showfaces='false' data-shr_href='http%3A%2F%2Fen.newinstance.it%2F2007%2F08%2F09%2Fmultiple-ip-on-a-single-network-interface%2F' data-shr_title='Multiple+IP+on+a+single+network+interface'></a><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='true' data-shr_href='http%3A%2F%2Fen.newinstance.it%2F2007%2F08%2F09%2Fmultiple-ip-on-a-single-network-interface%2F' data-shr_title='Multiple+IP+on+a+single+network+interface'></a><a class='shareaholic-tweetbutton' data-shr_count='none' data-shr_href='http%3A%2F%2Fen.newinstance.it%2F2007%2F08%2F09%2Fmultiple-ip-on-a-single-network-interface%2F' data-shr_title='Multiple+IP+on+a+single+network+interface'></a></div>
<div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div>
<p><!-- End Shareaholic LikeButtonSetBottom Automatic --></p>
]]></content:encoded>
			<wfw:commentRss>http://en.newinstance.it/2007/08/09/multiple-ip-on-a-single-network-interface/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>MSWord generation made easy(er)</title>
		<link>http://en.newinstance.it/2007/03/23/msword-generation-made-easyer/</link>
		<comments>http://en.newinstance.it/2007/03/23/msword-generation-made-easyer/#comments</comments>
		<pubDate>Fri, 23 Mar 2007 15:30:48 +0000</pubDate>
		<dc:creator>Luigi</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://it.newinstance.it/2007/03/23/msword-generation-made-easyer/</guid>
		<description><![CDATA[In my swing application the requirement was that the user had to be able to issue an action, from a menu or from a button, that generates a letter from a defined msword template filled with data load from the database. Then the application should launch msword to make a preview that the user can [...]]]></description>
			<content:encoded><![CDATA[<p><!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic -->In my swing application the requirement was that the user had to be able to issue an action, from a menu or from a button, that generates a letter from a defined msword template filled with data load from the database. Then the application should launch msword to make a preview that the user can manually complete or edit, then save or print.</p>
<p>But, Microsoft Word file format is not public, and generating such kind of file from Java is not that easy. There are libraries, like <a href="http://jakarta.apache.org/poi/">jakarta POI</a>, but they are quite complex, and limited; and generating a print layout using those Java API could become a nightmare.<br />
The solution, as for the <a href="http://it.newinstance.it/2006/11/03/excel-file-generation-made-easyer/">excel example</a>, is to create a textual format from a word document, that can be easily manipulated: <a href="http://it.wikipedia.org/wiki/Rich_Text_Format">RTF</a>.<br />
RTF, as msword, supports textfields that can be referenced by bookmarks and can be filled modifying the content of the file.</p>
<p>I got the templates, then I added textfield associating them to a bookmark:<br />
<a href="http://it.newinstance.it/wp-content/uploads/2007/03/msword-textfield.jpg" target="_blank"><br />
<img id="image228" src="http://it.newinstance.it/wp-content/uploads/2007/03/msword-textfield.jpg" alt="MSWord Textfields" height="390" width="475"/></a><br />
<em>Example of a template with textfields. Click to maximize</em></p>
<p>For example, the rtf source code for the &#8220;name&#8221; bookmark in above image, will look like:</p>
<pre style="height: 60px;">
{\\field{\\*\\fldinst {\\lang2057\\langfe1040\\langnp2057 {\\*\\<strong>bkmkstart name</strong>} FORMTEXT }{\\lang2057\\langfe1040\\langnp2057 {\\*\\datafield 0000000000000000046e616d6500000000000000000000000000
}{\\*\\formfield{\\fftype0\\fftypetxt0{\\*\\ffname name}}}}}{\\<strong>fldrslt</strong> {\\lang1024\\langfe1024\\noproof\\langnp2057 <span style="background: yellow">\\u8194\\'20\\u8194\\'20\\u8194\\'20\\u8194\\'20\\u8194\\'20</span>}}}{\\lang2057\\langfe1040\\langnp2057 {\\*\\<strong>bkmkend name</strong>}
</pre>
<p>I agree, not that easy to understand. The thing is that, if you modify the <span style="background: yellow">highlited text</span> you get the field filled with your value. In bold the keywords I used in my code to locate the position of the text to replace.<br />
So, it becomes just a matter of searching the template file for field values identified by the bookmark, and replacing it with the desired value. </p>
<p>Here&#8217;s a simplified version of the class that does this job:</p>
<pre class="java" style="max-height: 300px; height: 300px;"><span class="line_number"> 1</span><span class="code"><span class="java_keyword">package</span> it.newinstance.util.rtf;
<span class="line_number"> 2</span>
<span class="line_number"> 3</span><span class="java_keyword">import</span> java.io.FileOutputStream;
<span class="line_number"> 4</span><span class="java_keyword">import</span> java.io.IOException;
<span class="line_number"> 5</span><span class="java_keyword">import</span> java.io.InputStream;
<span class="line_number"> 6</span>
<span class="line_number"> 7</span><span class="java_keyword">public</span> <span class="java_keyword">class</span> RTF <span class="parenthesis">{</span>
<span class="line_number"> 8</span>    <span class="java_keyword">private</span> StringBuilder builder;
<span class="line_number"> 9</span>
<span class="line_number">10</span>    <span class="java_keyword">public</span> RTF<span class="parenthesis">(</span>InputStream in<span class="parenthesis">)</span> <span class="java_keyword">throws</span> IOException <span class="parenthesis">{</span>
<span class="line_number">11</span>        builder = <span class="java_keyword">new</span> StringBuilder<span class="parenthesis">(</span><span class="numeric_constant">16384</span>);
<span class="line_number">12</span>        <span class="java_primitive_type">int</span> ch;
<span class="line_number">13</span>        <span class="java_keyword">while</span> <span class="parenthesis">((</span>ch = in.read<span class="parenthesis">())</span> != -<span class="numeric_constant">1</span>)
<span class="line_number">14</span>            builder.append<span class="parenthesis">((</span><span class="java_primitive_type">char</span><span class="parenthesis">)</span> ch<span class="parenthesis">)</span>;
<span class="line_number">15</span>    <span class="parenthesis">}</span>
<span class="line_number">16</span>
<span class="line_number">17</span>    <span class="java_keyword">public</span> <span class="java_primitive_type">boolean</span> set<span class="parenthesis">(</span>String fieldName, String fieldValue<span class="parenthesis">)</span> <span class="parenthesis">{</span>
<span class="line_number">18</span>        <span class="java_primitive_type">int</span> bkmkStart = builder.indexOf<span class="parenthesis">(</span><span class="string_constant">&quot;\\bkmkstart &quot;</span> + fieldName<span class="parenthesis">)</span>;
<span class="line_number">19</span>        <span class="java_keyword">if</span> <span class="parenthesis">(</span>bkmkStart == -<span class="numeric_constant">1</span>) <span class="java_keyword">return</span> <span class="java_keyword">false</span>;
<span class="line_number">20</span>
<span class="line_number">21</span>        <span class="java_primitive_type">int</span> fldrsltStart = builder.indexOf<span class="parenthesis">(</span><span class="string_constant">&quot;\\fldrslt&quot;</span>, bkmkStart<span class="parenthesis">)</span>;
<span class="line_number">22</span>        <span class="java_keyword">if</span> <span class="parenthesis">(</span>fldrsltStart == -<span class="numeric_constant">1</span>) <span class="java_keyword">return</span> <span class="java_keyword">false</span>;
<span class="line_number">23</span>
<span class="line_number">24</span>        <span class="java_primitive_type">int</span> start = builder.indexOf<span class="parenthesis">(</span><span class="string_constant">&quot;{&quot;</span>, fldrsltStart<span class="parenthesis">)</span>;
<span class="line_number">25</span>        <span class="java_keyword">if</span> <span class="parenthesis">(</span>start == -<span class="numeric_constant">1</span>) <span class="java_keyword">return</span> <span class="java_keyword">false</span>;
<span class="line_number">26</span>
<span class="line_number">27</span>        <span class="java_primitive_type">int</span> end = builder.indexOf<span class="parenthesis">(</span><span class="string_constant">&quot;}&quot;</span>, fldrsltStart<span class="parenthesis">)</span>;
<span class="line_number">28</span>        <span class="java_keyword">if</span> <span class="parenthesis">(</span>end == -<span class="numeric_constant">1</span>) <span class="java_keyword">return</span> <span class="java_keyword">false</span>;
<span class="line_number">29</span>
<span class="line_number">30</span>        builder.replace<span class="parenthesis">(</span>builder.indexOf<span class="parenthesis">(</span><span class="string_constant">&quot; &quot;</span>, start<span class="parenthesis">)</span> + <span class="numeric_constant">1</span>, end, fieldValue<span class="parenthesis">)</span>;
<span class="line_number">31</span>        <span class="java_keyword">return</span> <span class="java_keyword">true</span>;
<span class="line_number">32</span>    <span class="parenthesis">}</span>
<span class="line_number">33</span>
<span class="line_number">34</span>    <span class="java_keyword">public</span> <span class="java_primitive_type">byte</span><span class="parenthesis">[]</span> getBytes<span class="parenthesis">()</span> <span class="parenthesis">{</span>
<span class="line_number">35</span>        <span class="java_keyword">return</span> builder.toString<span class="parenthesis">()</span>.getBytes<span class="parenthesis">()</span>;
<span class="line_number">36</span>    <span class="parenthesis">}</span>
<span class="line_number">37</span>
<span class="line_number">38</span>    <span class="java_keyword">public</span> <span class="java_primitive_type">void</span> launchMSWord<span class="parenthesis">()</span> <span class="java_keyword">throws</span> IOException <span class="parenthesis">{</span>
<span class="line_number">39</span>        runMSWord<span class="parenthesis">(</span>saveTempFile<span class="parenthesis">())</span>;
<span class="line_number">40</span>    <span class="parenthesis">}</span>
<span class="line_number">41</span>
<span class="line_number">42</span>    <span class="java_keyword">private</span> String saveTempFile<span class="parenthesis">()</span> <span class="java_keyword">throws</span> IOException <span class="parenthesis">{</span>
<span class="line_number">43</span>        String tmpDir = System.getProperties<span class="parenthesis">()</span>.getProperty<span class="parenthesis">(</span><span class="string_constant">&quot;java.io.tmpdir&quot;</span><span class="parenthesis">)</span>;
<span class="line_number">44</span>        <span class="java_primitive_type">long</span> time = System.currentTimeMillis<span class="parenthesis">()</span>;
<span class="line_number">45</span>        String filename = tmpDir + <span class="string_constant">&quot;print_&quot;</span> + time + <span class="string_constant">&quot;.rtf&quot;</span>;
<span class="line_number">46</span>
<span class="line_number">47</span>        FileOutputStream out = <span class="java_keyword">new</span> FileOutputStream<span class="parenthesis">(</span>filename<span class="parenthesis">)</span>;
<span class="line_number">48</span>        <span class="java_keyword">try</span> <span class="parenthesis">{</span>
<span class="line_number">49</span>            out.write<span class="parenthesis">(</span>getBytes<span class="parenthesis">())</span>;
<span class="line_number">50</span>        <span class="parenthesis">}</span> <span class="java_keyword">finally</span> <span class="parenthesis">{</span>
<span class="line_number">51</span>            out.close<span class="parenthesis">()</span>;
<span class="line_number">52</span>        <span class="parenthesis">}</span>
<span class="line_number">53</span>        <span class="java_keyword">return</span> filename;
<span class="line_number">54</span>    <span class="parenthesis">}</span>
<span class="line_number">55</span>
<span class="line_number">56</span>    <span class="java_keyword">private</span> <span class="java_primitive_type">void</span> runMSWord<span class="parenthesis">(</span>String filename<span class="parenthesis">)</span> <span class="java_keyword">throws</span> IOException <span class="parenthesis">{</span>
<span class="line_number">57</span>        String osName = System.getProperties<span class="parenthesis">()</span>.getProperty<span class="parenthesis">(</span><span class="string_constant">&quot;os.name&quot;</span><span class="parenthesis">)</span>;
<span class="line_number">58</span>        <span class="java_keyword">if</span> <span class="parenthesis">(</span>osName.indexOf<span class="parenthesis">(</span><span class="string_constant">&quot;Windows&quot;</span><span class="parenthesis">)</span> != -<span class="numeric_constant">1</span>) <span class="parenthesis">{</span>
<span class="line_number">59</span>            String command =
<span class="line_number">60</span>                <span class="string_constant">&quot;rundll32 SHELL32.DLL,ShellExec_RunDLL winword &quot;</span> + filename;
<span class="line_number">61</span>            Runtime.getRuntime<span class="parenthesis">()</span>.exec<span class="parenthesis">(</span>command, <span class="java_keyword">null</span>, <span class="java_keyword">null</span><span class="parenthesis">)</span>;
<span class="line_number">62</span>        <span class="parenthesis">}</span> <span class="java_keyword">else</span> <span class="parenthesis">{</span>
<span class="line_number">63</span>            System.out.println<span class="parenthesis">(</span><span class="string_constant">&quot;Not in Windows; open yourself &quot;</span> + filename<span class="parenthesis">)</span>;
<span class="line_number">64</span>        <span class="parenthesis">}</span>
<span class="line_number">65</span>    <span class="parenthesis">}</span>
<span class="line_number">66</span><span class="parenthesis">}</span></span>
</pre>
<p>You construct the RTF object giving an InputStream to the template file; all the job of replacement is made in <tt>set</tt> method, then you can get resulting bytes with <tt>getBytes()</tt>, or just call <tt>launchMSWord()</tt> if you want to pupup Microsoft Word to the user (this works only on standalone applications).<br />
The above code is a slow prototype, as string search and replacement is made in the easiest way for this post to be simple to understand and to read, so I made a much faster version (that also check to not making mess with the rtf code) that you can find at <a href="http://newinstance-util.googlecode.com/svn/trunk/util/src/it/newinstance/util/rtf/RTF.java">this link</a>. I used this class with very big and complex msword templates containing images, tables, etc. without problems.<br />
A thing that should be added to this class, is character escaping: I didn&#8217;t implemented it yet.</p>
<p>Here&#8217;s an example of usage:</p>
<pre class="java" style="height: 192px"><span class="line_number"> 1</span><span class="code">String resourceName = <span class="string_constant">&quot;/sample-module.rtf&quot;</span>;
<span class="line_number"> 2</span>RTF rtf = <span class="java_keyword">new</span> RTF<span class="parenthesis">(</span>Sample.<span class="java_keyword">class</span>.getResourceAsStream<span class="parenthesis">(</span>resourceName<span class="parenthesis">))</span>;
<span class="line_number"> 3</span>
<span class="line_number"> 4</span>rtf.set<span class="parenthesis">(</span><span class="string_constant">&quot;name&quot;</span>, <span class="string_constant">&quot;Foo&quot;</span><span class="parenthesis">)</span>;
<span class="line_number"> 5</span>rtf.set<span class="parenthesis">(</span><span class="string_constant">&quot;surname&quot;</span>, <span class="string_constant">&quot;Bar&quot;</span><span class="parenthesis">)</span>;
<span class="line_number"> 6</span>rtf.set<span class="parenthesis">(</span><span class="string_constant">&quot;birthday&quot;</span>, <span class="string_constant">&quot;10/10/2010&quot;</span><span class="parenthesis">)</span>;
<span class="line_number"> 7</span>rtf.set<span class="parenthesis">(</span><span class="string_constant">&quot;address&quot;</span>, <span class="string_constant">&quot;Sample Test Address&quot;</span><span class="parenthesis">)</span>;
<span class="line_number"> 8</span>rtf.set<span class="parenthesis">(</span><span class="string_constant">&quot;phone&quot;</span>, <span class="string_constant">&quot;+010 010101010&quot;</span><span class="parenthesis">)</span>;
<span class="line_number"> 9</span>rtf.set<span class="parenthesis">(</span><span class="string_constant">&quot;test&quot;</span>, <span class="string_constant">&quot;testtesttest&quot;</span><span class="parenthesis">)</span>;
<span class="line_number">10</span>
<span class="line_number">11</span>rtf.launchMSWord<span class="parenthesis">()</span>;</span>
</pre>
<p>As for the <a href="http://it.newinstance.it/2006/11/03/excel-file-generation-made-easyer/">excel example</a>, this class can be used in web applications using application/msword content type, so that the browser will associate the file to word.</p>
<p>For a runnable example, I put an eclipse project on subversion with some of my stuff, at this URL:<br />
<a href="http://newinstance-util.googlecode.com/svn/trunk/util/">http://newinstance-util.googlecode.com/svn/trunk/util/</a><br />
After opening the project in eclipse, the class to launch is<br />
<a href="http://newinstance-util.googlecode.com/svn/trunk/util/src/it/newinstance/util/rtf/Sample.java">src/it/newinstance/util/rtf/Sample.java</a><br />
No junit testcases, sorry :-)<br />
The template is located under the <a href="http://newinstance-util.googlecode.com/svn/trunk/util/resources/">resources</a> folder.</p>
<p>The advantage of using this template-based approach over java-api based generation, is that you can take a template from the user and achieve a document that fully respects the given layout. Also you can easily handle layout change.<br />
Doing document generation using a programming language is much more a matter of art than document layout design.
<div id="crp_related">
<h4>Related Posts:</h4>
<ul>
<li><a href="http://en.newinstance.it/2008/10/24/always-on-getter-and-setters/" rel="bookmark" class="crp_title">Always on getter and setters</a></li>
<li><a href="http://en.newinstance.it/2008/11/04/dynamic-tests-with-junit-3/" rel="bookmark" class="crp_title">Dynamic tests with JUnit 3</a></li>
<li><a href="http://en.newinstance.it/2008/10/24/the-repetita-juvant-principle/" rel="bookmark" class="crp_title">The Repetita Juvant Principle</a></li>
<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/11/22/random-thoughts-about-unchecked-exceptions/" rel="bookmark" class="crp_title">Random thoughts about unchecked exceptions</a></li>
</ul>
</div>
<div class="shr-publisher-229"></div>
<p><!-- Start Shareaholic LikeButtonSetBottom Automatic -->
<div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div>
<div class='shareaholic-like-buttonset' style='float:none;height:30px;'><a class='shareaholic-fblike' data-shr_layout='button_count' data-shr_showfaces='false' data-shr_href='http%3A%2F%2Fen.newinstance.it%2F2007%2F03%2F23%2Fmsword-generation-made-easyer%2F' data-shr_title='MSWord+generation+made+easy%28er%29'></a><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='true' data-shr_href='http%3A%2F%2Fen.newinstance.it%2F2007%2F03%2F23%2Fmsword-generation-made-easyer%2F' data-shr_title='MSWord+generation+made+easy%28er%29'></a><a class='shareaholic-tweetbutton' data-shr_count='none' data-shr_href='http%3A%2F%2Fen.newinstance.it%2F2007%2F03%2F23%2Fmsword-generation-made-easyer%2F' data-shr_title='MSWord+generation+made+easy%28er%29'></a></div>
<div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div>
<p><!-- End Shareaholic LikeButtonSetBottom Automatic --></p>
]]></content:encoded>
			<wfw:commentRss>http://en.newinstance.it/2007/03/23/msword-generation-made-easyer/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Associating JAD to class files</title>
		<link>http://en.newinstance.it/2007/01/11/associating-jad-to-class-files/</link>
		<comments>http://en.newinstance.it/2007/01/11/associating-jad-to-class-files/#comments</comments>
		<pubDate>Thu, 11 Jan 2007 17:44:49 +0000</pubDate>
		<dc:creator>Luigi</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://it.newinstance.it/2007/01/11/associating-jad-to-class-files/</guid>
		<description><![CDATA[Decompiling Java class files is often useful. I use to associate .class extension to Jad decompiler. To do that, I use a batch file, called &#8220;jad.cmd&#8221; that calls jad.exe with proper parameters. Jad.exe must be in the same folder of jad.cmd. Associating .class extension to jad.cmd let you decompile it on screen (in command prompt) [...]]]></description>
			<content:encoded><![CDATA[<p><!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic -->Decompiling Java class files is often useful. I use to associate .class extension to <a href="http://www.kpdus.com/jad.html">Jad decompiler</a>.<br />
To do that, I use a batch file, called &#8220;jad.cmd&#8221; that calls jad.exe with proper parameters. Jad.exe must be in the same folder of jad.cmd.</p>
<p>Associating .class extension to jad.cmd let you decompile it on screen (in command prompt) just double clicking on class files.</p>
<pre class="code">
@echo off
title JAD: decompiling...
%~dp0jad.exe -ff -nl -nonlb -o -p -pi99 -space -stat %1
title JAD: %~nx1
pause&gt; nul
</pre>
<div id="crp_related">
<h4>Related Posts:</h4>
<ul>
<li><a href="http://en.newinstance.it/2009/12/03/ipod-touch-with-linux/" rel="bookmark" class="crp_title">Ipod touch with Linux</a></li>
<li><a href="http://en.newinstance.it/2006/07/02/command-line-shortcuts-on-folder-and-drives/" rel="bookmark" class="crp_title">Command line shortcuts on folder and drives.</a></li>
<li><a href="http://en.newinstance.it/2010/05/17/attaching-sources-to-androidjar-in-eclipse/" rel="bookmark" class="crp_title">Attaching sources to android.jar in Eclipse</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>
<li><a href="http://en.newinstance.it/2008/03/28/how-to-filter-phone-calls-from-any-mobile-phone/" rel="bookmark" class="crp_title">How to filter phone calls from any mobile phone</a></li>
</ul>
</div>
<div class="shr-publisher-223"></div>
<p><!-- Start Shareaholic LikeButtonSetBottom Automatic -->
<div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div>
<div class='shareaholic-like-buttonset' style='float:none;height:30px;'><a class='shareaholic-fblike' data-shr_layout='button_count' data-shr_showfaces='false' data-shr_href='http%3A%2F%2Fen.newinstance.it%2F2007%2F01%2F11%2Fassociating-jad-to-class-files%2F' data-shr_title='Associating+JAD+to+class+files'></a><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='true' data-shr_href='http%3A%2F%2Fen.newinstance.it%2F2007%2F01%2F11%2Fassociating-jad-to-class-files%2F' data-shr_title='Associating+JAD+to+class+files'></a><a class='shareaholic-tweetbutton' data-shr_count='none' data-shr_href='http%3A%2F%2Fen.newinstance.it%2F2007%2F01%2F11%2Fassociating-jad-to-class-files%2F' data-shr_title='Associating+JAD+to+class+files'></a></div>
<div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div>
<p><!-- End Shareaholic LikeButtonSetBottom Automatic --></p>
]]></content:encoded>
			<wfw:commentRss>http://en.newinstance.it/2007/01/11/associating-jad-to-class-files/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

