<?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>John Beales &#187; Hints, Techniques &amp; More</title>
	<atom:link href="http://johnbeales.com/category/hints-techniques-more/feed/" rel="self" type="application/rss+xml" />
	<link>http://johnbeales.com</link>
	<description></description>
	<lastBuildDate>Sun, 20 Nov 2011 02:59:39 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<atom:link rel='hub' href='http://johnbeales.com/?pushpress=hub'/>
		<item>
		<title>Getting Started with HTML5</title>
		<link>http://johnbeales.com/20100210/getting-started-with-html5/</link>
		<comments>http://johnbeales.com/20100210/getting-started-with-html5/#comments</comments>
		<pubDate>Wed, 10 Feb 2010 14:33:07 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[Hints, Techniques & More]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[web design]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://johnbeales.com/?p=360</guid>
		<description><![CDATA[I&#8217;m working on a project now were we&#8217;ve decided to go with as pure HTML5 as posible, and it&#8217;s a breath of fresh air. Things work more or less how they should, and Internet Explorer is even playing along, with a little help. Getting started was a bit of a trick, though, as it can [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m working on a project now were we&#8217;ve decided to go with as pure HTML5 as posible, and it&#8217;s a breath of fresh air.  Things work more or less how they should, and Internet Explorer is even playing along, with a little help.  Getting started was a bit of a trick, though, as it can be hard to find information on how HTML5 works without diving into specification documents, which is never fun, or easy, (if you don&#8217;t want to read the story, <a href="#HTML5Resources">skip straight to the resources</a>).</p>

<p>I hadn&#8217;t been following the development of HTML5 with more than a passing interest. I figured that when it was ready, then I would start using it.  I also understood that there were different parts that may reach completion at different times, and was keeping my eye open for some sort of &#8220;completion&#8221; signal.  2009&#8242;s <a href="http://24ways.org">24 Ways</a> was that signal for me.  There were several articles on using HTML5 features along with their CSS3 counterparts, and enough evidence that browser support is there to start my investigation.</p>

<p>Here&#8217;s the deal:  Basic HTML5 support is pretty good in webkit-based browsers, alright, (read usable), in Gecko, and kind of lacking in Internet Explorer.  However, if you can rely on Javascript being present, (which I can in my project), there&#8217;s an <a href="http://code.google.com/p/html5shiv/">HTML5 Shiv Javascript</a> by <a href="http://remysharp.com">Remy Sharp</a> that makes it so that you can style HTML5 in Internet Explorer.  Add it using a conditional comment and you&#8217;re good to go.</p>

<p>So, we have useable cross-browser support, but where do we turn to learn about which tags are in, which are out, the correct doctype and mime-type, and all that?  We could read the specification, (and we will have to read a bit, at least), but it would be nice if there was an introduction to HTML5 somewhere.  It turns out that Robert Nyman has written an <a href="http://robertnyman.com/2009/10/14/an-introduction-to-html5/">Introduction to HTML5</a>.  It&#8217;s detailed enough to get you started, but not so detailed that you get lost, (like the spec), and if you&#8217;re looking to be convinced of the value of HTML5, check out <a href="http://24ways.org/2009/html5-tool-of-satan-or-yule-of-santa">HTML5: Tool of Satan, or Yule of Santa?</a>, <a href="http://24ways.org/2009/have-a-field-day-with-html5-forms">Have a Field Day with HTML5 Forms</a>, and <a href="http://24ways.org/2009/breaking-out-the-edges-of-the-browser">Breaking out the Edges of the Browser</a> from <a href="http://24ways.org/2009">24 Ways 2009</a>.</p>

<p>Once you dive a little deeper you&#8217;ll find that there are elements of HTML5 that you need more in-depth information for, so it&#8217;s time to turn to the spec.  However, there are 2 groups, (<a href="http://w3.org">W3C</a> and <a href="http://www.whatwg.org/">WHATWG</a>), working on HTML5, and therefore 2 spec documents, (fun!).  Fortunately, the two groups have the same editor, so they&#8217;re more or less working on the same thing.  I find the <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/">WHATWG HTML5 document</a> easier to read, but if you prefer the W3C version, <a href="http://dev.w3.org/html5/spec/Overview.html">go nuts</a>.</p>

<p>Finally, the whole content-type debate that&#8217;s been going on for what seems like centuries is still a mess.  In HTML5 you&#8217;re supposed to include a Document Type Definition and there should be no namespaces on the HTML element if you&#8217;re serving as text/html, and you&#8217;re supposed to serve in application/xhtml+xml if you want to use namespaces, or force XML validation, or anything like that.  The problem is that Internet Explorer really doesn&#8217;t like application/xhtml+xml, (it shows the raw XML document), so if you need a namespace for some reason, (for example, you want to use Facebook Connect on the site), you can&#8217;t serve valid markup.</p>

<p>So, that&#8217;s it.  HTML5 has arrived, or at least parts of it.  If you can rely on Javascript being present, or rely on IE users not using your web app, you can go ahead and start using it.  Here&#8217;s a quick recap of the resources:</p>

<ul id="HTML5Resources">
<li><a href="http://robertnyman.com/2009/10/14/an-introduction-to-html5/">Introduction to HTML5</a> by <a href="http://robertnyman.com">Robert Nyman</a></li>
<li><a href="http://code.google.com/p/html5shiv/">HTML5 Shiv Script</a> by <a href="http://remysharp.com">Remy Sharp</a></li>
<li>HTML5 Spec from <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/">WHATWG</a> and the <a href="http://dev.w3.org/html5/spec/Overview.html">W3C</a></li>
<li>From <a href="http://24ways.org/2009">24 Ways 2009</a>:
<ul>
<li><a href="http://24ways.org/2009/html5-tool-of-satan-or-yule-of-santa">HTML5: Tool of Satan, or Yule of Santa?</a></li>
<li><a href="http://24ways.org/2009/have-a-field-day-with-html5-forms">Have a Field Day with HTML5 Forms</a></li>
<li><a href="http://24ways.org/2009/breaking-out-the-edges-of-the-browser">Breaking Out the Edges of the Browser</a>, (also by Remy Sharp)</li>
</ul>
</li>
</ul>]]></content:encoded>
			<wfw:commentRss>http://johnbeales.com/20100210/getting-started-with-html5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using Spaces to Work Around VMWare Fusion&#8217;s Limitations</title>
		<link>http://johnbeales.com/20100124/using-spaces-to-work-around-vmware-fusions-limitations/</link>
		<comments>http://johnbeales.com/20100124/using-spaces-to-work-around-vmware-fusions-limitations/#comments</comments>
		<pubDate>Sun, 24 Jan 2010 19:56:01 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[Hints, Techniques & More]]></category>
		<category><![CDATA[fusion]]></category>
		<category><![CDATA[os x]]></category>
		<category><![CDATA[osx spaces]]></category>
		<category><![CDATA[spaces]]></category>
		<category><![CDATA[unity]]></category>
		<category><![CDATA[vmware fusion]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://johnbeales.com/?p=337</guid>
		<description><![CDATA[It appears that when running Windows as a virtual machine in VMWare Fusion, (I&#8217;m using version 3.0.1), any windows programs that I am running with elevated permissions, (&#8220;run as administrator&#8221;), don&#8217;t appear in the OS X dock with Fusion in unity mode. What&#8217;s more, if I can see a portion of the window and I [...]]]></description>
			<content:encoded><![CDATA[<p>It <a href="http://communities.vmware.com/thread/246349?tstart=15">appears</a> that when running Windows as a virtual machine in VMWare Fusion, (I&#8217;m using version 3.0.1), any windows programs that I am running with elevated permissions, (&#8220;run as administrator&#8221;), don&#8217;t appear in the OS X dock with Fusion in unity mode.  What&#8217;s more, if I can see a portion of the window and I click it, it doesn&#8217;t come to the foreground.</p>
<p>My workaround for this, which worked very well, was to run Fusion in fullscreen mode in another Space.  Then I was able to do my OS X testing in one space, flip to Windows to make changes very easily, (The default to move between spaces is ctrl + (arrow key), but I changed it to cmd + (arrow key) and it is much easier for me), and keep my E-mail &#038; stuff open in a third space.  </p>
<p>If you don&#8217;t have spaces active, in OS X 10.6 they&#8217;re in System Preferences > Exposé &#038; Spaces > Spaces then just check the box that says &#8220;Enable Spaces&#8221; and adjust your shortcuts at the bottom of the window, if desired.</p>
]]></content:encoded>
			<wfw:commentRss>http://johnbeales.com/20100124/using-spaces-to-work-around-vmware-fusions-limitations/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting MacPorts to work Snow Leopard</title>
		<link>http://johnbeales.com/20090828/getting-macports-to-work-snow-leopard/</link>
		<comments>http://johnbeales.com/20090828/getting-macports-to-work-snow-leopard/#comments</comments>
		<pubDate>Fri, 28 Aug 2009 17:30:16 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[Hints, Techniques & More]]></category>
		<category><![CDATA[How To]]></category>
		<category><![CDATA[10.6]]></category>
		<category><![CDATA[broken]]></category>
		<category><![CDATA[doesn't work]]></category>
		<category><![CDATA[download]]></category>
		<category><![CDATA[fix]]></category>
		<category><![CDATA[fixed]]></category>
		<category><![CDATA[install]]></category>
		<category><![CDATA[macports]]></category>
		<category><![CDATA[os x]]></category>
		<category><![CDATA[snow leopard]]></category>
		<category><![CDATA[solution]]></category>

		<guid isPermaLink="false">http://johnbeales.com/?p=298</guid>
		<description><![CDATA[Impatient? Skip to the process and go right to the solution. I&#8217;m writing this using my shiny new OS X 10.6 Snow Leopard installation. So far it&#8217;s pretty good. I haven&#8217;t tried any heavy lifting so I don&#8217;t know if it&#8217;s really that much faster. This is the first in a series of posts on [...]]]></description>
			<content:encoded><![CDATA[<p>Impatient?  Skip to the process and go right to the <a href="#solution">solution</a>.</p>
<p>I&#8217;m writing this using my shiny new OS X 10.6 Snow Leopard installation.  So far it&#8217;s pretty good.  I haven&#8217;t tried any heavy lifting so I don&#8217;t know if it&#8217;s really that much faster.</p>
<p>This is the first in a series of posts on how to get things working in Snow Leopard that got eaten during the installation.  First up:  MacPorts.</p>
<p>I ran into some issues with <a href="http://mysql.com">MySQL</a>, (more on that later), and since my MySQL install is a <a href="http://macports.org">MacPort</a> I thought I would do an update to make sure things were working properly.  However, this is what happened when I typed <code>sudo port list installed</code>:</p>
<blockquote><p><code>dlopen(/opt/local/share/macports/Tcl/pextlib1.0/Pextlib.dylib, 10): no suitable image found.  Did find:<br />
	/opt/local/share/macports/Tcl/pextlib1.0/Pextlib.dylib: no matching architecture in universal wrapper<br />
    while executing<br />
"load /opt/local/share/macports/Tcl/pextlib1.0/Pextlib.dylib"<br />
    ("package ifneeded Pextlib 1.0" script)<br />
    invoked from within<br />
"package require Pextlib 1.0"<br />
    (file "/opt/local/bin/port" line 40)</code></p></blockquote>
<p>So, I tried <code>sudo port selfupdate</code> and ran into the same problem.  Whatever port command I tried I got the same response, clearly I needed to take some sort of action.  After a quick look at the MacPorts website I figured I should update my Xcode Tools to the Snow Leopard version, so I did that, (there&#8217;s an installer in the Optional Installs folder on the Snow Leopard disk) and tried <code>sudo port list installed</code> again, and got the same response as before.</p>
<p>Some quick Googling &#038; reading resulted in no quick answer, so I figured that since I don&#8217;t really have anything irreplaceable in my MySQL databases I would download the Snow Leopard DMG from the <a href="http://macports.org/install.php">MacPorts download page</a>, install, and see what happened.  That&#8217;s the solution!  <span id="solution">Just download the Snow Leopard DMG and re-install.</span>  All of your ports will still be there, and mine seem to be working so far.</p>
]]></content:encoded>
			<wfw:commentRss>http://johnbeales.com/20090828/getting-macports-to-work-snow-leopard/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>PHP&#8217;s mysql_connect() Reuses Connections by Default</title>
		<link>http://johnbeales.com/20090825/phps-mysql_connect-reuses-connections-by-default/</link>
		<comments>http://johnbeales.com/20090825/phps-mysql_connect-reuses-connections-by-default/#comments</comments>
		<pubDate>Tue, 25 Aug 2009 18:49:10 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[Hints, Techniques & More]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[mysql_connect]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://johnbeales.com/?p=287</guid>
		<description><![CDATA[As I mentioned yesterday, I&#8217;m doing some work in WordPress right now, and a few minutes ago I tweeted that my custom code is messing with WP&#8217;s wp_get_archives() and wp_list_categories() functions, well, I found the problem. I am including the 4RoadService.com header &#038; utilities files in my WordPress theme, and I am using the same [...]]]></description>
			<content:encoded><![CDATA[<p>As I <a href="http://johnbeales.com/20090824/endpoints-a-little-secret-for-url-manipulation-in-wordpress/">mentioned yesterday</a>, I&#8217;m doing some work in WordPress right now, and a few minutes ago I <a href="http://twitter.com/johnbeales/status/3539887850">tweeted</a> that my custom code is messing with WP&#8217;s <code>wp_get_archives()</code> and <code>wp_list_categories()</code> functions, well, I found the problem.</p>
<p>I am including the 4RoadService.com header &#038; utilities files in my WordPress theme, and I am using the same user here on my test server for both the main 4RoadService.com database and the WordPress database. It turns out that when the 4RoadService.com database connection was initialized, since it uses the same connection info as the WordPress database, the existing connection was just reused, (this behaviour, by the way, is well described <a href="http://ca.php.net/manual/en/function.mysql-connect.php">in the PHP documentation</a>), then when the 4RoadService.com connection was told to use the main 4RoadService database it did, thus switching our one and only connection away from the WordPress database, and making WordPress think that there were no posts on the blog.</p>
<p>Fortunately, there is a quick workaround, just add one more attribute to the <code>mysql_connect()</code> function so it looks like this:</p>
<blockquote><p><code>$dblink = mysql_connect($host, $user, $pass, true);</code></p></blockquote>
<p>This way a new connection is established, and the WordPress connection is left alone.</p>
<p>I am left wondering why, in the loop, WordPress was able to see my posts, perhaps it establishes a second database connection in there.  However, I&#8217;m not going to spend the afternoon poking through the guts of WordPress. </p>
]]></content:encoded>
			<wfw:commentRss>http://johnbeales.com/20090825/phps-mysql_connect-reuses-connections-by-default/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Endpoints: A little secret for URL manipulation in WordPress</title>
		<link>http://johnbeales.com/20090824/endpoints-a-little-secret-for-url-manipulation-in-wordpress/</link>
		<comments>http://johnbeales.com/20090824/endpoints-a-little-secret-for-url-manipulation-in-wordpress/#comments</comments>
		<pubDate>Tue, 25 Aug 2009 04:17:57 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[Cool]]></category>
		<category><![CDATA[Hints, Techniques & More]]></category>
		<category><![CDATA[4roadservice.com]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://johnbeales.com/?p=281</guid>
		<description><![CDATA[Today I&#8217;ve been setting up WordPress as the News section of a website which loads its pages via AJAX requests whenever possible, but falls back on normal HTTP requests when the AJAX loads are not possible. The when the AJAX requests are initiated from Javascript, /outputxml/ is added to the end of the URL. This [...]]]></description>
			<content:encoded><![CDATA[<p>Today I&#8217;ve been setting up <a href="http://wordpress.org">WordPress</a> as the News section of a website which loads its pages via AJAX requests whenever possible, but falls back on normal <abbr title="HyperText Transfer Protocol">HTTP</abbr> requests when the <abbr title="Asynchronous Javascript over XML">AJAX loads are not possible.</p>
<p>The when the AJAX requests are initiated from Javascript, /outputxml/ is added to the end of the URL.  This gets translated, with some mod_rewrite magic, to a <code>$_GET</code> parameter called output.  /outputxhtml is also possible but since that&#8217;s the default it doesn&#8217;t get used very much.</p>
<p>After, (mostly), building the WordPress theme I started testing, and as I expected I ran into some problems when /outputxml/ was added to the end of the WordPress URLs.  I got 404 errors, which makes total sense.  I thought I could get around this by simply doing a little extra mod_rewrite magic, however, it seems there&#8217;s not way to simply replace /outputxml somewhere in a url with an empty string using mod_rewrite alone.  After some time, I stumbled upon an underdocumented WordPress function:  <code>WP_Rewrite::add_endpoint</code> and its friend, <code>add_rewrite_endpoint</code>.  These functions make it so that WordPress recognizes /category/post-name/trackback, and /category/post-name/outputxml.  Excellent!  </p>
<p>I just had to create a plugin, make sure that WordPress wouldn&#8217;t kill my $_GET['output'] variable, add 1 line to my .htaccess and I was good to go.</p>
<p>References:</p>
<ul>
<li><a href="http://codex.wordpress.org/Query_Overview">codex.wordpress.org/Query_Overview</a> &#8211; explains the steps WordPress goes through when responding to a request</li>
<li><a href="http://codex.wordpress.org/User:DavidHouse/WP_Rewrite_API#add_rewrite_endpoint.28.29">codex.wordpress.org/User:DavidHouse/WP_Rewrite_API#add_rewrite_endpoint.28.29</a> &#8211; the most human add_rewrite_endpoint documentation</li>
</ul>
<p></abbr></p>
<p>And this is what my plugin looks like, (for educational purposes only.  I am not distributing it):<br />
<code><br />
function fourRS_outputxml_activate() {<br />
	global $wp_rewrite;<br />
	<del>add_rewrite_endpoint('outputxml',array(EP_PERMALINK, EP_PAGES));</del><br />
	<ins>add_rewrite_endpoint('outputxml',EP_ALL);</ins>       </p>
<p>	$wp_rewrite->flush_rules();<br />
}<br />
register_activation_hook( __FILE__, 'fourRS_outputxml_activate');</p>
<p>function fourRS_outputxml_deactivate() {<br />
	global $wp_rewrite;<br />
	$wp_rewrite->flush_rules();<br />
}</p>
<p>register_deactivation_hook( __FILE__, 'fourRS_outputxml_deactivate');</p>
<p>/* Makes it so WP doesn't eat my nice $_GET variable */<br />
function fourRS_parameter_queryvars( $qvars )<br />
{<br />
	$qvars[] = 'output';<br />
	return $qvars;<br />
}<br />
add_filter('query_vars', 'fourRS_parameter_queryvars' );</code></p>
<p><strong>Edit (August 25, 2009):</strong> Changed the attrbutes in the add_rewrite_endpoint() function.</p>
]]></content:encoded>
			<wfw:commentRss>http://johnbeales.com/20090824/endpoints-a-little-secret-for-url-manipulation-in-wordpress/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Using Microsoft&#8217;s VPC Images with VMWare Fusion</title>
		<link>http://johnbeales.com/20090522/using-microsofts-vpc-images-with-vmware-fusion/</link>
		<comments>http://johnbeales.com/20090522/using-microsofts-vpc-images-with-vmware-fusion/#comments</comments>
		<pubDate>Fri, 22 May 2009 13:52:55 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[Cool]]></category>
		<category><![CDATA[Hints, Techniques & More]]></category>
		<category><![CDATA[How To]]></category>
		<category><![CDATA[convert]]></category>
		<category><![CDATA[debugging]]></category>
		<category><![CDATA[internet explorer]]></category>
		<category><![CDATA[virtual pc]]></category>
		<category><![CDATA[virtualization]]></category>
		<category><![CDATA[vmware fusion]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://johnbeales.com/?p=248</guid>
		<description><![CDATA[We all know the sinking feeling when we have to test a website in Internet Explorer. You built the site, it looks beautiful in Firefox and maybe Safari too, but now you have to open up Internet Explorer 6, 7, and 8, and make sure it plays nice with all three of them. Even better, [...]]]></description>
			<content:encoded><![CDATA[<p>We all know the sinking feeling when we have to test a website in Internet Explorer.  You built the site, it looks beautiful in Firefox and maybe Safari too, but now you have to open up Internet Explorer 6, 7, and 8, and make sure it plays nice with all three of them.  Even better, Microsoft has made it so that you can only have one version of IE installed on a computer at a time. True, you can use things like <a href="http://tredosoft.com/Multiple_IE">Multiple IEs</a> or other similar products, but they never play quite right.</p>
<p>Fortunately, Microsoft has supplied us with <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=21eabb90-958f-4b64-b5f1-73d0a413c8ef&#038;displaylang=en">Virtual PC images</a> of Windows with Internet Explorer installed.  Unfortunately, Virtual PC is a Windows-only program so you need a PC to run them on.  Or do you?</p>
<p>You don&#8217;t!  If you&#8217;re using OS X you can use <a href="http://vmware.com/products/fusion/">VMWare Fusion</a> to run those Microsoft VPC images, after a little tweaking.  It is much easier if you have a copy of Windows available to you during the install process, (that&#8217;s how I did it), but I don&#8217;t believe this is an absolute necessity.  Here&#8217;s how it works:</p>
<p>Basically, you need to download the VPC images, extract them, and convert them into VMWare Fusion virtual machines.  It sounds trickier than it is.</p>
<p>First, download and extract the VPC images.  If you can use Windows to do this it&#8217;s easy, (the images have self-extractors), if not try <a href="http://p7zip.sourceforge.net/">p7zip</a>, (see instructions in <a href="http://communities.vmware.com/docs/DOC-7250">this forum thread</a>).</p>
<p>[edit: July 15, 2009]: Then, somehow, you have to convert your VHD files into VMC files.  The easiest way to do this is to use Microsoft&#8217;s VPC to make a new virtual machine from the VHD files, but you do need windows to do that. You will be converting these .VMC files into VMWare native virtual machines.<br />
[/edit]</p>
<p>To convert the VPC images to something else, use <a href="http://www.vmware.com/products/converter/">VMWare vCenter Converter</a>.  It&#8217;s a stand-alone program for Windows or Linux that easily converts VPC images to VMWare Fusion virtual machines, as well as several other formats.  You can even choose between Fusion 1.x and Fusion 2.x.  It will even install the VMWare tools pagkage for you.  I did the conversion under Windows, but there&#8217;s probably a way to get the linux version to run under OS X, at least hopefully.</p>
<p>Once the conversion is complete, fire up OS X &#038; VMWare Fusion and open your new Virtual PC image. There are some things that run on the first startup of each machine, give it a few minutes then hit cancel on all of the &#8220;Please insert the XP SP3 CD&#8221; messages that remain, it doesn&#8217;t seem to hurt Windows.  I think it&#8217;s looking for a battery driver in my case, (maybe I should try to install the Bootcamp battery driver?).</p>
<p>That&#8217;s it, enjoy testing.  I am able to run, slowly, all 3 IE versions with the Windows XP images, and my computer isn&#8217;t as slow as when I run only my Bootcamp Vista install under VMWare Fusion.  I&#8217;m thrilled to have these 3 new debugging tools at my disposal.</p>
]]></content:encoded>
			<wfw:commentRss>http://johnbeales.com/20090522/using-microsofts-vpc-images-with-vmware-fusion/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Using VLC to transcode an Axis Camera&#8217;s video stream, and stream it out again</title>
		<link>http://johnbeales.com/20080820/using-vlc-to-transcode-an-axis-cameras-video-stream-and-stream-it-out-again/</link>
		<comments>http://johnbeales.com/20080820/using-vlc-to-transcode-an-axis-cameras-video-stream-and-stream-it-out-again/#comments</comments>
		<pubDate>Wed, 20 Aug 2008 14:28:18 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[Hints, Techniques & More]]></category>
		<category><![CDATA[How To]]></category>
		<category><![CDATA[axis]]></category>
		<category><![CDATA[camera]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[h.264]]></category>
		<category><![CDATA[ip camera]]></category>
		<category><![CDATA[live streaming]]></category>
		<category><![CDATA[live video]]></category>
		<category><![CDATA[streaming]]></category>
		<category><![CDATA[transcode]]></category>
		<category><![CDATA[video]]></category>
		<category><![CDATA[vlc]]></category>
		<category><![CDATA[wowza]]></category>
		<category><![CDATA[wowza media server pro]]></category>

		<guid isPermaLink="false">http://johnbeales.com/?p=123</guid>
		<description><![CDATA[VLC likes to die when transcoding an rtsp stream from an Axis camera then re-streaming it.  However, by using a named pipe and two instances of VLC it is possible to make this work.]]></description>
			<content:encoded><![CDATA[<p>Recently, I&#8217;ve been working on streaming live video from IP cameras to a Flash player on a website.  It sounds simple, but not so much, (if you&#8217;re in a hurry, <a href="#vlc-transcode-solution">skip to the solution</a>).</p>
<p>The problem is that most IP cameras are not made for streaming live, full-motion, events to the web.  They&#8217;re made for surveillance at 11 <abbr title="Frames Per Second">FPS</abbr> in Motion JPEG format, (that&#8217;s just a bunch of JPEG images coming one after another).  This is obviously not ideal from a bandwidth perspective at all.  The cameras that our project uses are <a href="http://www.axis.com">Axis</a> 207 and 210 cameras.  These cameras are capable of streaming MPEG-4 video, and when you look at the video in a web browser it looks pretty good.  When I first saw that, I was excited &#8211; I could just stream into a Flash media server, (We&#8217;re using <a href="http://www.wowzamedia.com/">Wowza Media Server Pro</a> at the moment), and that would send everything off to the player, right?  Wrong.</p>
<p>It turns out that most, if not all, Axis products stream in MPEG4-ES, which flash cannot understand, and therefore our server rejects.  I had to find a way to change MP4V-ES to h.264.</p>
<p>The obvious solution to transcoding the video stream from MP4V-ES to h.264 is <a href="http://www.videolan.org">VLC</a>.  While it looks like a media player that can handle a lot of formats, under the surface lies a powerful, command-line based, transcoding and streaming program.  I discovered that, in theory, I should be able to issue one command to VLC and have it receive the MPEG4-ES stream from the camera, transcode it to h.264, and stream it to the Wowza, which would handle the rest.</p>
<p>I started by opening a file, transcoding it to h.264, and streaming it to Wowza:</p>
<p><code>vlc -vvv /path/to/file/Extremists.m4v --sout "#transcode{venc=x264,vcodec=x264,vb=500,scale=1,acodec=mp4a,ab=32,channels=2,samplerate=22100}:rtp{dst=SERVER-IP-ADDRESS,sdp=file:///path/to/wowza/content/myStream.sdp}"</code></p>
<p>It was a little rough, as the testing server doesn&#8217;t have a lot of processing power, but it worked.  Awesome.  Now I just have to hook it up to the stream from the camera, right?</p>
<p>I added the camera as the source and removed the sound:</p>
<p><code>vlc -vvv rtsp://camera-ip-address:554/mpeg4/1/media.amp --no-sout-audio --sout "#transcode{venc=x264,vcodec=x264,vb=200,scale=1}:rtp{dst=SERVER-IP-ADDRESS,sdp=file:///absolute/path/to/wowza/content/myStream.sdp}"</code></p>
<p>With Wowza already running on the server, I typed that in to terminal, and it started to look good.  Then PAF! I get this error:</p>
<p><code>[00000385] access_output_udp private debug: mmh, hole (147841635484807 &gt; 2s) -&gt; drop</code></p>
<p>VLC seems to think that a frame, or some piece of information has been delayed 147841635484807 seconds.  I highly doubt that, but VLC is convinced.  Try as I might, I was not able to get VLC to realize that the frame, (or whatever bit of info), was simply missing a timestamp or something.</p>
<p>So, I figured I would debug just the connection to the camera.  I opened a VNC session, and ran this:</p>
<p><code>vlc -vvv rtsp://camera-ip-address:554/mpeg4/1/media.amp</code></p>
<p>To see if I could view the video.  I could, so I tried saving it to a file:</p>
<p><code>vlc -vvv rtsp://CAMERA-IP-ADDRESS:554/mpeg4/media.amp --no-drop-late-frames --no-sout-audio --sout "#std{mux=ts,access=file,dst=/tmp/camstream.m4v}"</code></p>
<p>This worked also.  It appears that the problem only occurs when I am trying to open, transcode, and send out the stream all at once.</p>
<p id="vlc-transcode-solution">I realized, if I can transcode from a file and stream, and if I can capture a stream and save it to a file, I should be able to do both at the same time.  It works!  The steps are, make the pipe:</p>
<p><code>mkpipe /tmp/vpipe</code></p>
<p>Then capture the stream and save it to the pipe:</p>
<p><code>vlc -vvv rtsp://CAMERA-IP-ADDRESS:554/mpeg4/media.amp --no-drop-late-frames --no-sout-audio --sout "#std{mux=ts,access=file,dst=/tmp/vpipe}"</code></p>
<p>And finally read from the pipe, transcode, and stream to the flash server:</p>
<p><code>vlc -vvv /tmp/vpipe --no-sout-audio --sout "#transcode{venc=x264,vcodec=x264,vb=500,scale=1}:rtp{dst=SERVER-IP-ADDRESS,sdp=file:///path/to/wowza/content/myStream.sdp}"</code></p>
<p>Shazam!</p>
<p>There are a couple of caveats, though:</p>
<ul>
<li>This sucks major processing horsepower.  Make sure you&#8217;ve got enough</li>
<li>To make a stream work this way you have to have 2 copies of VLC running, plus your flash server.  That&#8217;s a lot of parts that could have a problem</li>
</ul>
<p>Because of these caveats, I am still looking for an alternate solution, and may stream MPEG-4 to browsers until Axis has its h.264 products ready later this year.</p>
<p>Yesterday, I did find a second possible solution.  Instead of using the first instance of VLC to capture the stream, it is sometimes possible to use Darwin Streaming Server to capture the stream, then use 1 instance of VLC to transcode it. This seems to use much less processing power, but is not 100% reliable either.</p>
]]></content:encoded>
			<wfw:commentRss>http://johnbeales.com/20080820/using-vlc-to-transcode-an-axis-cameras-video-stream-and-stream-it-out-again/feed/</wfw:commentRss>
		<slash:comments>51</slash:comments>
		</item>
		<item>
		<title>Font Size Reference</title>
		<link>http://johnbeales.com/20060918/font-size-reference/</link>
		<comments>http://johnbeales.com/20060918/font-size-reference/#comments</comments>
		<pubDate>Mon, 18 Sep 2006 19:26:37 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[Hints, Techniques & More]]></category>

		<guid isPermaLink="false">http://www.johnbeales.com/20060918/font-size-reference/</guid>
		<description><![CDATA[I usually designate a font size in my CSS on either the html or body tag using a percentage then size the rest of my document using ems. The reason I use a percentage value instead of just specifying the base font size in pixels is so that users can change their font size in [...]]]></description>
			<content:encoded><![CDATA[<p>I usually designate a font size in my CSS on either the <code>html</code> or <code>body</code> tag using a percentage then size the rest of my document using ems. The reason I use a percentage value instead of just specifying the base font size in pixels is so that users can change their font size in their browsers if they choose.</p>
<p>Since most, if not all, web browsers use 16px as their base font size I can set my base font size using this formula:</p>
<p><code>percentage = 100(base font size/16)</code></p>
<p>Just insert your desired base font size in <em>pixels</em> into the formula and you will have the correct percentage to use in your CSS.</p>
<p>And now a handy cheat sheet if you don&#8217;t want to do the math:</p>
<table>
<caption>Pixels to Percentage</caption>
<tr>
<th>Pixels</th>
<th>Percentage</th>
</tr>
<tr>
<td>8</td>
<td>50</td>
</tr>
<tr>
<td>9</td>
<td>56.25</td>
</tr>
<tr>
<td>10</td>
<td>62.5</td>
</tr>
<tr>
<td>11</td>
<td>68.75</td>
</tr>
<tr>
<td>12</td>
<td>75</td>
</tr>
<tr>
<td>13</td>
<td>81.25</td>
</tr>
<tr>
<td>14</td>
<td>87.5</td>
</tr>
<tr>
<td>15</td>
<td>93.75</td>
</tr>
<tr>
<td>16</td>
<td>100</td>
</tr>
<tr>
<td>17</td>
<td>106.25</td>
</tr>
<tr>
<td>18</td>
<td>112.5</td>
</tr>
</table>
<p>A quick disclaimer: there may be a browser out there that doesn&#8217;t use 16px as its base font size that I don&#8217;t know about.  Also, this works only if you haven&#8217;t already changed your font size somewhere else.</p></p>
]]></content:encoded>
			<wfw:commentRss>http://johnbeales.com/20060918/font-size-reference/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

