<?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/"
	>

<channel>
	<title>Aymeric on software</title>
	<atom:link href="http://blog.barthe.ph/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.barthe.ph</link>
	<description>Because we needed another of these blogs...</description>
	<pubDate>Sun, 20 May 2012 07:56:04 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>That strange Flash resizing bug when using 32 bits WebViews on MacOS X</title>
		<link>http://blog.barthe.ph/2012/05/20/flash_resize_bug/</link>
		<comments>http://blog.barthe.ph/2012/05/20/flash_resize_bug/#comments</comments>
		<pubDate>Sun, 20 May 2012 07:55:27 +0000</pubDate>
		<dc:creator>Aymeric</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.barthe.ph/?p=920</guid>
		<description><![CDATA[Have you ever noticed some strange behavior when you resize a WebView hosting resizable Flash content? Does the Flash content seems to be play catch up with the resizing of the WebView?
If so you are particularly unlucky. The problem only arises if you have the following set of conditions:

The hosted flash content is resized when the [...]]]></description>
			<content:encoded><![CDATA[<p>Have you ever noticed some strange behavior when you resize a WebView hosting resizable Flash content? Does the Flash content seems to be play catch up with the resizing of the WebView?</p>
<p>If so you are particularly unlucky. The problem only arises if you have the following set of conditions:</p>
<ul>
<li>The hosted flash content is resized when the WebView itself is resized, a bit like in this <a href="http://2advanced.com/">website</a>.</li>
<li>Your process is running in 32 bit mode. The 64 bit mode seems to be immune, probably because Flash is hosted in an external process.</li>
<li>You app is running on 10.5 or 10.6. Other versions are immune, including 10.7.</li>
<li>You are running Flash 10.1 which includes the <a href="http://www.kaourantin.net/2010/02/core-animation.html">Core Animation</a> rendering model. At the time I write this, the latest version of Flash is 11.1.102.55 and it still has the bug.</li>
</ul>
<p>The resizing behavior made me think of Core Animation <a href="http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/CoreAnimation_guide/Articles/AnimatingLayers.html">implicit animations</a>. Core Animation introduced the notion of &#8216;layers&#8217; to the already existing &#8216;view&#8217; hierarchy in Cocoa. Views backed by layers are rendered using a more efficient hardware accelerated rendering pipeline than &#8216;vanilla&#8217; views. Each layer is associated to a set of properties such as position, opacity, etc… and whenever a property is changed, by default, the system generates an implicit animation. For instance, if you make the layer visible, you will have a fade-in effect. And you guessed it, if you resize it, some kind of resize animation. This approach makes it possible to make eye candy animations without introducing much complexity to the code. And of course, Core Animation makes it possible to make explicit animations for more complex cases&#8230;</p>
<p>My suspicion was reinforced when I discovered that older versions of the Flash plugin (10.0) which do not use the Core Animation rendering model were exempt from the problem.</p>
<p>According to <a href="http://www.kaourantin.net/2010/02/core-animation.html">the blog of an Adobe employee</a>, three rendering models are offered to plugins on the Mac platform: QuickDraw, Quartz and CoreAnimation. I quickly corroborated this by looking at Mozilla&#8217;s Plugin API documentation, and I discovered the notes on <a href="https://wiki.mozilla.org/NPAPI:CoreAnimationDrawingModel">NPDrawingModelCoreAnimation</a>. The drawing model of a plugin is chosen after a simple negotiation. First, the plugin checks what the browser advertises, and decides to choose the best model. Second, the browser checks what rendering model the plugin has chosen. In the case of Core Animation, it appears that the plugin <a href="https://wiki.mozilla.org/NPAPI:CoreAnimationDrawingModel#Vending_a_layer">creates its own CALayer</a> and provides it to the browser via <strong>NPP_GetValue</strong>.</p>
<p>To confirm my suspicions, I needed to access the layer returned by the plugin. But this turned out to be more complicated than I anticipated. I could not find any public API in the WebKit that gives me access to the &#8220;plugin instance&#8221;, which is the first parameter of NPP_GetValue. And since there must be one plugin instance per Flash object in the DOM, loading the flash plugin bundle directly from &#8220;Internet Plugin&#8221; would do no good. So, after reviewing the source code of the WebKit I opted to use the <strong>pluginLayer</strong> method from the <a href="http://www.opensource.apple.com/source/WebKit/WebKit-6531.9/mac/Plugins/WebNetscapePluginView.mm">WebNetscapePluginView</a> class. Both the method and the class and private APIs, but they looked like a fairly stable choice given the circumstances: the <strong>WebNetscapePluginView</strong> class name is hardcoded to &#8216;<span><strong>WebNetscapePluginDocumentView</strong>&#8216; via a macro because of an old bug in Acrobat&#8217;s plugin, and the &#8216;<strong>pluginLayer</strong>&#8216; method looks indispensable.</span></p>
<p>The next steps consisted in disabling the implicit animations. If you modify the property of a layer yourself, <a href="http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/CoreAnimation_guide/Articles/Transactions.html#//apple_ref/doc/uid/TP40006096-SW6">you can use CATransaction</a>. However in my case, the &#8216;bounds&#8217; property of the layer is modified internally by the WebView, as it reacts to the resize event. So the only options available are:</p>
<ul>
<li>Use <strong>setAction:</strong> on CALayer to set a new array of actions, which are set to NSNull</li>
<li>Associate a delegate via <strong>setDelegate:</strong> to the CALayer and implement <strong>actionForLayer:forKey:</strong> to return NSNull.</li>
<li>Or override <strong><span>actionForKey</span>:</strong> method for the target layer, via some kind of dark voodoo method swizzling.</li>
</ul>
<p>I opted to use the least intrusive methods, which is to <a href="http://stackoverflow.com/questions/2244147/disabling-implicit-animations-in-calayer-setneedsdisplayinrect">use setActions</a>. I soon discovered that it did not work, and that in fact the layer given by the plugin already had Null actions. However by digging in the layer hierarchy, I found out that 2 levels below the plugin root layer, the plugin had created a layer from a class named &#8216;<strong>FP_FPCAOpenGLLayer</strong>&#8216;, which did not override the default actions. There was my problem and as suspected it was a lame Flash bug.</p>
<h3>Fix / Workaround</h3>
<p>In my Cocoa application I intercept the <strong>webView:didFinishLoadForFrame:</strong> from the <strong>WebFrameLoadDelegate</strong>. There I run my own <strong>FixFlashResizingBug()</strong> function, which does the following:</p>
<ul>
<li>Browse the view hierarchy and look for &#8220;<strong>WebNetscapePluginDocumentView</strong>&#8220;.</li>
<li>For each &#8220;<strong>WebNetscapePluginDocumentView</strong>&#8221; it finds, try to call the &#8220;<strong>pluginLayer</strong>&#8221; method</li>
<li>Then drill two levels down the layer hierarchy, and look for a &#8220;<span><strong>FP_FPCAOpenGLLayer</strong>&#8220;</span></li>
<li>Set the actions of &#8220;<strong>FP_FPCAOpenGLLayer</strong>&#8220;<strong> </strong>to NSNull.</li>
</ul>
<p>Obviously this is fragile since it both relies on private WebKit API&#8217;s and manipulate internal structures of the Flash plugin directly, but I could not think of a better idea.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.barthe.ph/2012/05/20/flash_resize_bug/feed/</wfw:commentRss>
		</item>
		<item>
		<title>A history of the DMG file format</title>
		<link>http://blog.barthe.ph/2011/04/05/dmg_history/</link>
		<comments>http://blog.barthe.ph/2011/04/05/dmg_history/#comments</comments>
		<pubDate>Tue, 05 Apr 2011 10:02:06 +0000</pubDate>
		<dc:creator>Aymeric</dc:creator>
		
		<category><![CDATA[MacOS X]]></category>

		<category><![CDATA[UDIF]]></category>

		<category><![CDATA[dmg]]></category>

		<guid isPermaLink="false">http://blog.barthe.ph/?p=821</guid>
		<description><![CDATA[Disk images have always been popular on the Mac. They play a similar role to &#8220;ISO&#8221; images on other platforms, in the sense that they can be used to clone medias or can be mounted/unmounted as a virtual disks. However DMG images offer a LOT more functionalities than traditional ISO images:

They can hold a partition table, [...]]]></description>
			<content:encoded><![CDATA[<p>Disk images have always been popular on the Mac. They play a similar role to &#8220;ISO&#8221; images on other platforms, in the sense that they can be used to clone medias or can be mounted/unmounted as a virtual disks. However DMG images offer a <strong>LOT</strong> more functionalities than traditional ISO images:</p>
<ul>
<li>They can hold a partition table, and therefore contain more than one volume. (Typically a partition table with a single partition).</li>
<li>They may contain any kind of filesystem. (Typically <a href="http://en.wikipedia.org/wiki/HFS%2B">HFS+</a>).</li>
<li>Images can be compressed (via bzip2, zlib, or Apple&#8217;s own format for the old ones).</li>
<li>Images can be made as read-only, but also as read-write. (Installer images are typically read-only).</li>
<li>Read-write images can be sparse. That means the image file only grows as more content is put inside, rather than be pre-allocated to the full capacity of the virtual disk.</li>
<li>Images can have checksums to verify their integrity (options: several CRCs, MD5, several SHAs).</li>
<li>Images can embed Mac specific behaviors: contain a <a href="http://en.wikipedia.org/wiki/EULA">EULA</a>, have a custom icon, automatically mount when downloaded by Safari, etc&#8230;</li>
<li>And I probably forget a lot of other features (<a href="http://en.wikipedia.org/wiki/RTFM">RTFM</a>: &#8220;<strong>man hdiutils</strong>&#8220;).</li>
</ul>
<p>One of the initial motivations for using disk images, during the MacOS classic era, is that application files could not be reliably transmitted over non-Mac specific networks like the Internet. This limitation stems from the fact that files were divided into two logical parts, called &#8220;forks&#8221;: the &#8220;<strong>data fork</strong>&#8221; and the <strong>&#8220;resource fork&#8221;</strong>. The data fork is what is traditionally considered to be a file. The structure of the data is entirely determined by the developer. The resource fork on the other hand, contains a collection of data organized in a standard way and accessible through a dedicated API. Although it is possible to define custom resources, the OS would also provide lots of default types to hold classical information: user interface elements, rich text, pictures, etc&#8230;</p>
<p>On MacOS X, resource forks are still supported for backward compatibility reasons, but all application now use <a href="http://developer.apple.com/library/mac/#documentation/CoreFoundation/Conceptual/CFBundles/Introduction/Introduction.html">bundles</a> instead. A bundle appears as a single icon to the end user, but it is in reality a directory containing several files. The role that the resource fork used to play to organize data is now played by the file system: each resource appears as an individual file within a hierarchy of directories. Hence, a typical MacOS X application is composed of several files, and disk images remain useful to solve the problem of their distribution across networks.</p>
<p>In order to safely transport data, and installers, Apple chose to favor the usage of disk images rather self extracting installers. Since the early 90s, all Apple software installation disks have been distributed as either disk images or physical medias. Early Mac users would probably remember either using Apple&#8217;s DiskCopy, or <a href="http://www.atpm.com/5.10/shrinkwrap.shtml">Aladdin&#8217;s ShrinkWrap</a>, for creating or mounting disk images. The current DMG file format is a direct descendant of the &#8220;<strong>New Disk Image Format</strong>&#8221; (aka &#8220;NDIS&#8221;) that Apple introduced <a href="http://www.tidbits.com/static/html/TidBITS-339.html">with Disk Copy 6 in 1996.</a> This file format used the resource fork to store all the meta data: file version, partition table, type of compression, checksums, etc&#8230; and more importantly where to find the data for the virtual disk sectors. The data fork only contained the raw data (compressed or not) of the virtual disk.</p>
<p>The astute reader may have noticed that, since the NDIS images used forks, it was not suitable for safe redistribution across the Internet. Disk images had typically to be encoded with either <a href="http://en.wikipedia.org/wiki/BinHex">BinHex</a> or <a href="http://en.wikipedia.org/wiki/Uuencode">UUencode</a>. When Apple introduced MacOS X in 2001, they decided to solve the problem once and for all. They designed the DMG file format, which they called &#8220;<strong>Universal Disk Image Format</strong>&#8221; (aka &#8220;UDIF&#8221;). DMG is &#8220;flat&#8221; file format in the sense that it does not contain any forks, but it is basically a wrapper around the traditional &#8220;NDIS&#8221; format. A typical DMG file is a concatenation of the data fork, followed by the resource fork of an NDIS disk image.</p>
<p>Apple has never published the specifications of either the NDIS or the UDIF file format. The private <strong>DiskImage framework</strong> plays a central role in the implementation of DMG parsing and the mounting of disk images in general. The framework apparently supports plugins (see <strong>&#8220;hdiutil plugins&#8221;</strong>) but there is no developer documentation available. The only non-Apple plugin known was made by Connectix for VirtualPC images, during the PowerPC era (see <a href="http://crypto.nsa.org/vilefault/23C3-VileFault.pdf">Unlocking FireVault</a>). However it does not appear that either VMWare nor Parallels have been able to use the private framework in recent times.</p>
<p>Although it is sad the DiskImage framework is closed, the DMG file format itself, is a bit of an open secret. It has been successfully reverse engineered many times, and there are a few open source implementations:</p>
<ul>
<li>Several commercial software support it: <a href="http://www.mediafour.com/products/macdrive">MacDrive</a>, <a href="http://www.poweriso.com/">PowerISO</a>, <a href="http://www.magiciso.com/FAQ/FAQ0011.htm">MagicISO</a>.</li>
<li><strong>Vultur</strong>&#8217;s <a href="http://vu1tur.eu.org/tools/"><strong>dmg2iso</strong></a> is probably the older open source implementation. It is a quick and dirty perl script to convert a DMG file into an ISO. It is deprecated, and its replacement is a cleaner and more complete C implementation called <strong>dmg2img</strong><span>.</span></li>
<li><strong>Erik Larsson</strong> provides a series of Java tools that can parse DMG files. There is the simple <strong><a href="http://www.catacombae.org/dmgx.html">DMGExtractor</a></strong>, but also the more complete <strong><a href="http://www.catacombae.org/hfsx.html">HFSExplorer</a></strong> which provides a graphical interface to browse HFS+ volumes and DMG files.</li>
<li>Another interesting source is <strong><a href="https://github.com/planetbeing/libdmg-hfsplus">libdmg</a></strong> from <strong>planetbeing</strong>. It is a C library with UDIF and HFS+ support. It can be used to convert DMG from/to ISOs; extract files; or create DMG images from scratch. The project was initially started as a way to manipulate Apple&#8217;s software restore packages for iPhone devices.</li>
<li>Finally, <a href="http://www.7-zip.org/">7-zip</a> on Windows is able to open and extract DMG files.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.barthe.ph/2011/04/05/dmg_history/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Sharing a VPN connection with VMWare fusion</title>
		<link>http://blog.barthe.ph/2010/11/30/vmware-fusion-vpn-share/</link>
		<comments>http://blog.barthe.ph/2010/11/30/vmware-fusion-vpn-share/#comments</comments>
		<pubDate>Tue, 30 Nov 2010 18:05:25 +0000</pubDate>
		<dc:creator>Aymeric</dc:creator>
		
		<category><![CDATA[MacOS X]]></category>

		<category><![CDATA[Windows]]></category>

		<category><![CDATA[vmware]]></category>

		<guid isPermaLink="false">http://blog.barthe.ph/?p=679</guid>
		<description><![CDATA[Rationale
My company has set up a VPN access that can be used from home. This proved to be extremely useful last winter when I got snowed in, and I have used it occasionally ever since. The VPN system we use (Sonicwall) is not supported on MacOS X and Sonicwall provides a Windows only connection software. [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Rationale</strong></p>
<p>My company has set up a VPN access that can be used from home. This proved to be extremely useful last winter when I got snowed in, and I have used it occasionally ever since. The VPN system we use (<strong>Sonicwall</strong>) is not supported on MacOS X and Sonicwall provides a Windows only connection software. I have tried to use <a href="http://www.lobotomo.com/products/IPSecuritas">IPSecuritas</a> but I could not find a way to configure it properly. The commercial software <a href="http://www.equinux.com/us/products/vpntracker/index.html">VPN Tracker</a> worked like a charm, but when I saw the price (€99 excl VAT) I stopped considering it. For about half of that price ($60 excl VAT) you can get a license to VMWare Fusion. So I decided to go for that instead. The obvious disadvantage in using VMWare is that it uses a lot of resources, but this is not really a problem for me, and it&#8217;s kind of hard to configure, but this post should help you with that. The obvious advantage of VMWare is of course that it does much more than provide access to a VPN&#8230; <img src='http://blog.barthe.ph/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><strong>Summary of the setup</strong></p>
<p>My goal is to access the company network (10.100.10.x/24) from home on my iMac running Mac OS X 10.6. Since the VPN software is only supported on Windows, I connect to the VPN via Windows XP SP3 running inside VMWare Fusion. The virtual machine internet connection is provided via a NAT network interface connected to the iMac.</p>
<p>My setup consists in creating another network interface between the iMac and the VM. I then configure both Windows and MacOS X so that my packets get properly routed.</p>
<p>A picture is worth a thousand words.</p>
<p><div id="attachment_762" class="wp-caption aligncenter" style="width: 511px"><a href="http://blog.barthe.ph/wp-content/uploads/2010/11/vpn_sharing_setup.png"><img class="size-large wp-image-762" title="Overview of the VPN sharing setup" src="http://blog.barthe.ph/wp-content/uploads/2010/11/vpn_sharing_setup-1002x1024.png" alt="Overview of the VPN sharing setup" width="501" height="512" /></a><p class="wp-caption-text">Overview of the VPN sharing setup</p></div></p>
<p><strong>Setting up VMWare Fusion</strong></p>
<p>I assume that you have correctly installed the virtual machine, Windows XP, and that the VPN software works as expected. My network configuration uses NAT to provide internet access to the VM, but it is certainly possible to use other configurations.</p>
<p>The first thing to do is to create a new network interface to provide access to the VPN from the Mac to the VM.</p>
<p style="padding-left: 30px;"><strong>Steps</strong></p>
<ul>
<li>Switch off the VM</li>
<li>Go to &#8220;Settings&#8221;, &#8220;Network&#8221;</li>
<li>Add a network interface with the &#8220;+&#8221; button at the bottom.</li>
<li>Choose &#8220;The host only&#8221; option at the bottom.</li>
</ul>
<p><div id="attachment_710" class="wp-caption aligncenter" style="width: 310px"><a href="http://blog.barthe.ph/wp-content/uploads/2010/11/vpn_vmware_screenshot.png"><img class="size-medium wp-image-710" title="VPN VMWare network interface setup. " src="http://blog.barthe.ph/wp-content/uploads/2010/11/vpn_vmware_screenshot-300x198.png" alt="Create a network interface in VMWare" width="300" height="198" /></a><p class="wp-caption-text">Create a network interface in VMWare</p></div></p>
<p><strong>Setting up Windows XP</strong></p>
<p>The next part of the setup consists in configuring the newly created &#8220;Local Area Network 2&#8243; interface (LAN2) so that it shares the connection with the VPN. We need to share the internet connection from the &#8220;Virtual Private Network&#8221; interface to the LAN2 interface. We also need to enable IP packet routing.</p>
<p style="padding-left: 30px;"><strong>Steps</strong></p>
<div>
<ul>
<li><strong>Sharing the connection </strong>
<ul>
<li>Go to &#8220;Control Panel&#8221;, &#8220;Network Connections&#8221;.</li>
<li>Right click on the &#8220;Virtual Private Network&#8221; interface, select &#8220;properties&#8221;, go the the &#8220;advanced&#8221; tab and select the option &#8220;<strong>Allow other network users to connect through this computer&#8217;s Internet connection</strong>&#8220;.</li>
<li>In the combo box below select &#8220;Local Area Network 2&#8243;.</li>
<li>Deselect the option &#8220;Allow other network users to control or disable the shared Internet connection&#8221;.</li>
<li>Click on &#8220;Ok&#8221; to validate the settings.</li>
</ul>
</li>
<li><strong>Enabling IP routing </strong>
<ul>
<li>Open &#8220;regedit.exe&#8221;.</li>
<li>Go to &#8220;<em><span style="font-style: normal;"><strong>HKEY_LOCAL_MACHINE SYSTEM\CurrentControlSet\Services\Tcpip\Parameters</strong></span>&#8220;</em><span>. </span></li>
<li><span>Locate the key &#8220;</span><strong>IPEnableRouter</strong>&#8221; and set it to 1.</li>
<li>This setting is different on older or newer versions of Windows.</li>
</ul>
</li>
<li><strong>Set up Local Area Network 2 interface </strong>
<ul>
<li>Open the &#8220;Terminal.app&#8221; application on the Mac and type &#8220;ifconfig&#8221;.</li>
<li>Note the IP address (inet) associated to the &#8220;vmnet1&#8243; interface and the network mask. In my case it&#8217;s 192.168.245.1 and 0xffffff00.</li>
<li>Go the &#8220;Control Panel&#8221;, &#8220;Network Conections&#8221; on the VM</li>
<li>Open the &#8220;Local Area Network 2&#8243; interface properties window.</li>
<li>In the &#8220;general&#8221; tab, double click on the &#8220;TCP/IP&#8221; item.</li>
<li><strong>Choose an IP address on the same network than the one from the Mac</strong>, and set the network mask. In my case, I chose 192.168.245.2 and 255.255.255.0.</li>
<li>Click &#8220;Ok&#8221; to validate the settings</li>
</ul>
</li>
</ul>
</div>
<p><div id="attachment_754" class="wp-caption aligncenter" style="width: 310px"><a href="http://blog.barthe.ph/wp-content/uploads/2010/11/vpn_winxp_screenshot.png"><img class="size-medium wp-image-754" title="VMWare VPN Sharing. Windows XP setup" src="http://blog.barthe.ph/wp-content/uploads/2010/11/vpn_winxp_screenshot-300x138.png" alt="Setup of network interfaces on Windows XP" width="300" height="138" /></a><p class="wp-caption-text">Setup of network interfaces on Windows XP</p></div></p>
<p>At this stage, although this is not strictly necessary, you may want to enable the ping on Windows XP, to verify that your connection works.</p>
<ul>
<li>Go to &#8220;Control Panel&#8221;, &#8220;Windows Firewall&#8221;.</li>
<li>Go to the &#8220;advanced&#8221; tab and select &#8220;settings&#8221; in the &#8220;ICMP&#8221; section.</li>
<li>Enable the &#8220;allow incoming echo request&#8221; option.</li>
<li>On the Mac, open &#8220;Terminal.app&#8221;</li>
<li>Type &#8220;ping 192.168.245.2&#8243; and the Virtual machine, should normally reply to the ping. If it does not, you may have made a configuration mistake. Use &#8220;ifconfig&#8221; on the Mac and &#8220;ipconfig&#8221; on Windows to debug the issue.</li>
</ul>
<p><strong>Setting up Mac OS X</strong></p>
<p>At this stage we need to set up Mac OS X routing so that VPN addresses are resolved through the vmnet1 interface. We also optionally set up the company DNS. If you have not done it yet, you should connect to the VPN from the virtual machine.</p>
<p style="padding-left: 30px;"><strong>Steps</strong></p>
<ul>
<li>Once you are connected to the VPN on Windows, launch &#8220;cmd.exe&#8221; and type &#8220;ipconfig /all&#8221;.</li>
<li>Look for the following details: your IP address on the VPN network, the mask, and the addresses of the VPN.</li>
<li>In my example I have an IP of 10.100.10.212, a mask of 255.255.255.0 and two DNS servers at addresses 10.100.10.12 and 10.100.10.14</li>
<li>Go back to Mac OS X.</li>
<li>In the terminal type a command line similar to &#8220;<strong>sudo route -n add 10.100.10.0/24 192.168.245.2</strong>&#8220;. (Or alternatively if you do not wish to worry about the <a href="http://en.wikipedia.org/wiki/CIDR_notation">CIDR notation</a> for the mask, &#8220;<strong>sudo route -n add 10.100.10.0 192.168.245.2 255.255.255.0</strong>&#8220;)
<ul>
<li>The first partial IP corresponds to the IP of your network (normally the first digits, until the mask is zero).</li>
<li>The second IP is the IP of the VM on the LAN2 interface.</li>
<li>This line instructs MacOS X to route all IPs from the 10.100.10.x network to the 192.168.245.2 gateway, ie the virtual machine.</li>
</ul>
</li>
<li>You must the enable IP routing. Type &#8220;<strong>sudo sysctl -w net.inet.ip.forwarding=1</strong>&#8220;.</li>
</ul>
<p>At this stage you should be able to ping yourself on the VPN from the Mac. In my example &#8220;ping 10.100.10.212&#8243; should reply. Now what if it does not work</p>
<ul>
<li>Try &#8220;traceroute 10.100.10.212&#8243;. If you see your message routed through your normal internet connection, then something is wrong on the Mac. Otherwise it&#8217;s on Windows.</li>
<li>On the Mac &#8220;netstat -rn&#8221; will dump the route table.</li>
<li>Verify that you still have an internet connection, on the Mac and the VM. If you do trash your route table you may lose it entirely. (Try removing your incorrect route with &#8220;route delete &#8230;&#8221; and/or plug in and off your modem connection).</li>
</ul>
<p><strong>Optional steps to set up the DNS</strong></p>
<ul>
<li>Go to &#8220;System Preferences&#8221; on the Mac.</li>
<li>Select &#8220;Network&#8221;.</li>
<li>Click on &#8220;Advanced&#8221; at the bottom of the interface that provides your internet connection.</li>
<li>Go to the &#8220;DNS&#8221; tab. In the &#8220;DNS server&#8221; sections add the DNS servers of your VPN, on top of the list. In my case it&#8217;s 10.100.10.12 and 10.100.10.14.</li>
<li>Close, validate and do not forget to &#8220;apply&#8221; the settings.</li>
</ul>
<p><strong>Going further&#8230;<br />
</strong></p>
<ul>
<li>You can snapshot the Windows virtual machine to retrieve your settings next time.</li>
<li>On the Mac you can put the combination of the &#8220;route&#8221; and &#8220;sysctl&#8221; commands in a script to further automate the process. Maybe it&#8217;s possible to write a launchd script and do it at startup</li>
<li>I&#8217;m not sure how to configure the DNS from the command line, nor how to make the DNS of the company be used only for domains unknown from your regular DNS server.</li>
</ul>
<div><strong><br />
</strong></div>
]]></content:encoded>
			<wfw:commentRss>http://blog.barthe.ph/2010/11/30/vmware-fusion-vpn-share/feed/</wfw:commentRss>
		</item>
		<item>
		<title>First public release of DiskWave</title>
		<link>http://blog.barthe.ph/2010/03/12/first-release-whichsize/</link>
		<comments>http://blog.barthe.ph/2010/03/12/first-release-whichsize/#comments</comments>
		<pubDate>Fri, 12 Mar 2010 11:15:30 +0000</pubDate>
		<dc:creator>Aymeric</dc:creator>
		
		<category><![CDATA[DiskWave]]></category>

		<category><![CDATA[MacOS X]]></category>

		<category><![CDATA[My Software]]></category>

		<guid isPermaLink="false">http://blog.barthe.ph/?p=630</guid>
		<description><![CDATA[I have not been blogging a lot lately. The truth is that I have been busy coding.
WhichSize DiskWave is a freeware for MacOS X 10.6 (hence Intel Macs only for now) that can recursively size the directories on your drive. This allows to quickly identify and reclaim wasted space.
It is freely available here: http://diskwave.barthe.ph/
DiskWave was [...]]]></description>
			<content:encoded><![CDATA[<p>I have not been blogging a lot lately. The truth is that I have been busy coding.</p>
<p><span style="text-decoration: line-through;">WhichSize</span> DiskWave is a freeware for MacOS X 10.6 (hence Intel Macs only for now) that can recursively size the directories on your drive. This allows to quickly identify and reclaim wasted space.</p>
<p>It is freely available here: <a href="http://whichsize.barthe.ph/">http://diskwave.barthe.ph/</a></p>
<p>DiskWave was basically hacked in a weekend, but this is not a new idea. I already worked on a similar project, back in 2004, after discovering OmniDiskSweeper. I was appalled by the terrible performance of OmniDiskSweeper and quickly realized I could do a better job. So I learned Cocoa, ObjectiveC, the Carbon APIs, and came up painfully with a prototype only to discover that another software named WhatSize was free and worked very well. I also had a tricky memory leak due to a bug in Cocoa API.  So I quitted.</p>
<p>Fast forward to 2010. OmniDiskSweeper is no longer a shareware, but its performance is still bad.  WhatSize is no longer a freeware. The old freeware version of WhatSize I have is a PowerPC version, but since I moved to Snow Leopard, I felt like I did not want to install Rosetta. So here is DiskWave.</p>
<p>So this time, I did my homework, and it does not look like there is a suitable alternative. Here is the list of similar tools (on MacOS X) I came up with:</p>
<ul>
<li><a href="http://www.omnigroup.com/products/omnidisksweeper/">OmniDiskSweeper</a>.
<ul>
<li>Freeware (formerly shareware)</li>
<li>Slower because it relies on Cocoa APIs. It also consumes a lot of memory.</li>
<li>Does not have many more features than DiskWave. I hope to catch up pretty soon&#8230;</li>
</ul>
</li>
<li><a href="http://www.id-design.com/software/whatsize/index.php">WhatSize</a>
<ul>
<li>Shareware (formerly freeware)</li>
<li>Same speed.  Consumes a little bit more of memory, because it supports another feature that requires it</li>
<li>Does have many more features than DiskWave. Some of them, I never intend to get: fat binaries removal, locale removals, etc&#8230;</li>
<li>The thing that annoys me is that you can size/browse only one drive at a time.</li>
</ul>
</li>
<li><a href="http://www.daisydiskapp.com/">DaisyDisk</a>
<ul>
<li>Shareware</li>
<li>New kid on the block. The visualization is really awesome but&#8230; I do not find it that practical.</li>
<li>If I ever wish to play with CoreAnimation, I may add an animated sunburst view.</li>
</ul>
</li>
<li><a href="http://grandperspectiv.sourceforge.net/">GrandPerspective</a>
<ul>
<li>Opensource</li>
<li>Seems to work well and is properly maintained. But I do not like this kind of visualization.</li>
</ul>
</li>
<li><a href="http://www.derlien.com/">DiskInventory X</a>
<ul>
<li>Opensource</li>
<li>It looks like it is no longer maintained. I do not fancy the GUI. Same as GrandPerspective.</li>
</ul>
</li>
</ul>
<p>DiskWave being in its early infancy is somewhat limited in terms of features. I hope to gradually upgrade it. If you have ideas of features you would like to see added, just let me know.</p>
<p><strong>Reference</strong>:</p>
<ul>
<li>DiskWave homepage: <a href="http://diskwave.barthe.ph/">http://diskwave.barthe.ph/</a></li>
</ul>
<p><strong>Update</strong> April 12th 2010:</p>
<ul>
<li>Renamed WhichSize into DiskWave after receiving complaints from id design, inc.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.barthe.ph/2010/03/12/first-release-whichsize/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Force Windows to refresh the Desktop (and Start Menu)</title>
		<link>http://blog.barthe.ph/2010/02/23/force-desktop-refresh/</link>
		<comments>http://blog.barthe.ph/2010/02/23/force-desktop-refresh/#comments</comments>
		<pubDate>Tue, 23 Feb 2010 18:41:41 +0000</pubDate>
		<dc:creator>Aymeric</dc:creator>
		
		<category><![CDATA[Programming]]></category>

		<category><![CDATA[Windows]]></category>

		<category><![CDATA[c++]]></category>

		<category><![CDATA[win32]]></category>

		<guid isPermaLink="false">http://blog.barthe.ph/?p=616</guid>
		<description><![CDATA[Today I learned a new trick.
When you programatically delete a shortcut from the Desktop folder Windows is &#8220;generally&#8221; smart enough to update the Desktop and the &#8220;recently used programs&#8221; section of the Start Menu. But sometimes it does not work and you are left with a &#8220;ghost&#8221; icon.
As a regular end user, you can hit [...]]]></description>
			<content:encoded><![CDATA[<p>Today I learned a new trick.</p>
<p>When you programatically delete a shortcut from the Desktop folder Windows is &#8220;generally&#8221; smart enough to update the Desktop and the &#8220;recently used programs&#8221; section of the Start Menu. But sometimes it does not work and you are left with a &#8220;ghost&#8221; icon.</p>
<p>As a regular end user, you can hit the F5 key to force a refresh of the Desktop, but for the Start Menu you are left with no alternative than killing/restarting explorer.exe.</p>
<p>I was looking for a better solution for a custom installer application. And after a lot of MSDN scattering and googling around, Eureka, I finally found a magic incantation to programmatically force a refresh of the Desktop.</p>
<pre><code>SHChangeNotify (SHCNE_ASSOCCHANGED, 0, 0, 0);</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.barthe.ph/2010/02/23/force-desktop-refresh/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>

