<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" version="2.0">

<channel>
	<title>BadMagicNumber</title>
	
	<link>http://nicklothian.com/blog</link>
	<description>My Blog, Take 4</description>
	<lastBuildDate>Thu, 26 Aug 2010 03:41:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/Badmagicnumber" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="badmagicnumber" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Perfect Advertising</title>
		<link>http://nicklothian.com/blog/2010/08/25/perfect-advertising/</link>
		<comments>http://nicklothian.com/blog/2010/08/25/perfect-advertising/#comments</comments>
		<pubDate>Thu, 26 Aug 2010 03:41:15 +0000</pubDate>
		<dc:creator>Nick Lothian</dc:creator>
				<category><![CDATA[blogging]]></category>
		<category><![CDATA[tech]]></category>
		<category><![CDATA[advertising]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://nicklothian.com/blog/?p=458</guid>
		<description><![CDATA[I was at a StartUp Club event last night and had a brief discussion with someone who had the thesis that all advertising by companies is evil and therefor will soon (?) be overtaken by personal recommendations from your social circle. I disagree with that for a number of reasons (eg, your social circle may [...]]]></description>
			<content:encoded><![CDATA[<p>I was at a <a href="http://startupclub.com.au/">StartUp Club</a> event last night and had a brief discussion with someone who had the thesis that all advertising by companies is evil and therefor will soon (?) be overtaken by personal recommendations from your social circle.</p>
<p>I disagree with that for a number of reasons (eg, your social circle may not be best qualified to make a recommendation etc etc), but during the course of the discussion I was surprised when no one recognized the term <em>Perfect Advertising</em>. A quick bit of Googling today only turned up <a href="http://glinden.blogspot.com/2008/10/google-describes-perfect-advertising.html">one decent post</a>, and yet I&#8217;m sure this isn&#8217;t a concept I&#8217;ve invented.</p>
<p><em><strong>Perfect Advertising is the idea that a person sees no advertising until they need something, and at that point a single advertisement is presented to them that matches their requirements perfectly.</strong></em></p>
<p>The example last night was jogging shoes. The original argument was that you will get shoe recommendations from your friends. My counterpoint was that it would be easy to get better recommendations by instrumenting your body and taking advice from sports scientists, and in a world with perfect advertising you would be presented with a single choice of shoes, in the correct size that compensated perfectly for your <a href="http://en.wikipedia.org/wiki/Foot_type">over or under pronation</a>. That&#8217;s not a recommendation your friends are likely to be qualified to make, but of course perfect advertising would take into account the views of your social circle, too (eg: will you be socially ostracized by buying Nike shoes, or will you be laughed at for buying <a href="http://www.vibramfivefingers.com/">Vibrum Five Fingers</a>?)</p>
<p>This might seem a distant goal, but none the less it&#8217;s an important concept because it shows the weakness in social advertising systems (the lack of intent) as well as a weakness in search advertising systems (the lack of context).</p>
<p>Is it easier to add context to search advertising or derive intent in social advertising? That&#8217;s the $100 billon question (literally), and I don&#8217;t have the answer.</p>
<p><em><br />
</em></p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Badmagicnumber?a=KeCAr-xWglY:hf8dqgWrvOE:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/Badmagicnumber?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Badmagicnumber?a=KeCAr-xWglY:hf8dqgWrvOE:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/Badmagicnumber?d=yIl2AUoC8zA" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Badmagicnumber/~4/KeCAr-xWglY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://nicklothian.com/blog/2010/08/25/perfect-advertising/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mobile Monday Adelaide: Business Angels in South Australia</title>
		<link>http://nicklothian.com/blog/2010/05/17/mobile-monday-adelaide-business-angels-in-south-australia/</link>
		<comments>http://nicklothian.com/blog/2010/05/17/mobile-monday-adelaide-business-angels-in-south-australia/#comments</comments>
		<pubDate>Tue, 18 May 2010 01:28:35 +0000</pubDate>
		<dc:creator>Nick Lothian</dc:creator>
				<category><![CDATA[tech]]></category>
		<category><![CDATA[adelaide]]></category>
		<category><![CDATA[investing]]></category>

		<guid isPermaLink="false">http://nicklothian.com/blog/?p=451</guid>
		<description><![CDATA[I went along to the Mobile Monday meeting on Business Angels in South Australia. Pretty good event, all up. Nick Foskett gave a pretty good and honest talk about the state of Angel investment in South Australia. A quick summary from memory only : SA Angles Inc was formed in 2007, but spent quite a [...]]]></description>
			<content:encoded><![CDATA[<p>I went along to the Mobile Monday meeting on <a href="http://mobilemondayadelaide.net/2010/05/04/business-angels-in-south-australia/">Business Angels in South Australia</a>. Pretty good event, all up.</p>
<p><a href="http://au.linkedin.com/in/nickfoskett">Nick Foskett</a> gave a pretty good and honest talk about the state of Angel investment in South Australia. A quick summary from memory only : <a href="http://www.saangels.com.au/">SA Angles Inc</a> was formed in 2007, but spent quite a while figuring out how they should do investments (solution: don&#8217;t form a fund) and who should be involved. They have 17 people who are actively seeking investment opportunities.</p>
<p>Since they formed they have had 41 pitches and made one investment. I can&#8217;t remember the exact amount invested (I think it was 400K), but it was by a number of members who all invested in the region of 25K each.</p>
<p>Nick mentioned that a number of the early pitches were under-prepared. People couldn&#8217;t give answers on basic financial predictions, and had no idea how much money they wanted or how much of the company they would give up for that amount.</p>
<p>He also mentioned a couple of other reasons why investments were declined:</p>
<ul>
<li>People trying to create jobs for themselves.</li>
</ul>
<p style="padding-left: 60px;">I&#8217;m paraphrasing here, but this was about people who had a reasonable idea for a small business, but not something that would generate enough returns to be an attractive business. To me, this was about developing a <a href="http://www.briefing.com/GeneralInfo/Investor/ToolBox/LearningCenter/edu_Scalable_Models.htm">scalable business model</a>.</p>
<ul style="padding-left: 30px;">
<li>Nothing more than an idea</li>
</ul>
<p style="padding-left: 60px;">Apparently people think investors will give them a million dollars for a good idea. I had thought that had died out ten years ago, but maybe not.</p>
<ul style="padding-left: 30px;">
<li>Lack of defensible advantage</li>
</ul>
<p style="padding-left: 60px;">Nick mentioned how easy it is to outsource writing code, and talked about how important it is for your idea to have something that would stop others replicating your success and taking your money. When he was talking about this I thought he meant traditional forms of IP protection (Patents, etc), but speaking to him later it was clear that applications where there was a genuine first-mover advantage and/or network effects are also ok.</p>
<p>Then it was question time. Umm yeah.</p>
<p>The most interesting question was one <a href="http://www.kublermdk.com/">Michael Kubler</a> asked about the expected returns. The short answer was 5 times the investment in 5 years was too long, but many would be happy with 5x in a couple of years.</p>
<p>But the first &#8220;question&#8221; was something different. Some guy and his business (?) partner decided it would be useful for the room to hear their long rant about how terrible it was no one would invest in them and that people in the US would love them but they wanted to stay here and how terrible it was that the SA Angels group had received 41 pitches and only invested in one etc etc etc.</p>
<p>There is no denying that 1/41 isn&#8217;t a great ratio, but Nick had already spent quite a while talking about the reasons for it, and they sounded reasonable to me. I&#8217;m sure there are some opportunities they should have taken (and speaking to Nick later he confirmed that), but it seems pointless to blame investors for being overly conservative when people come asking for investment and don&#8217;t even have an idea of what kind of revenue they think they will get.</p>
<p>More importantly, the overly aggressive and downright rude way the questioner&#8217;s point was presented was offputting.</p>
<p>One exchange went something like this:</p>
<p>Questioner: <em>Why are investors here so conservative when we KNOW we could get money in the States very easily.</em></p>
<p>Nick: <em>Well if you can get money from the US&#8230;.</em></p>
<p>Questioner&#8217;s partner (interjecting): <em>Oh.. we could</em></p>
<p>Nick: <em>then that is something you should pursue.</em></p>
<p>Of course, this may have been part of the little known &#8220;<em>be rude to potential investors and make them hate you before you ask them for money</em>&#8221; strategy. Someone should study the success of that method some more.</p>
<p>Anyway, on a better note I was fortunate enough to talk briefly to Nick afterwards, and asked about (very) early stage investment &#8211; ie, pre-revenue. He was quite open to that, but rightly pointed out that it is much riskier, so would cost a larger stake in the company.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Badmagicnumber?a=miSOibjnL7A:P4IEB2fW8wE:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/Badmagicnumber?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Badmagicnumber?a=miSOibjnL7A:P4IEB2fW8wE:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/Badmagicnumber?d=yIl2AUoC8zA" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Badmagicnumber/~4/miSOibjnL7A" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://nicklothian.com/blog/2010/05/17/mobile-monday-adelaide-business-angels-in-south-australia/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Google Buzz, babies &amp; bathwater</title>
		<link>http://nicklothian.com/blog/2010/03/29/google-buzz-babies-bathwater/</link>
		<comments>http://nicklothian.com/blog/2010/03/29/google-buzz-babies-bathwater/#comments</comments>
		<pubDate>Mon, 29 Mar 2010 22:39:06 +0000</pubDate>
		<dc:creator>Nick Lothian</dc:creator>
				<category><![CDATA[social networks]]></category>
		<category><![CDATA[tech]]></category>
		<category><![CDATA[Google Buzz]]></category>

		<guid isPermaLink="false">http://nicklothian.com/blog/?p=448</guid>
		<description><![CDATA[There is a saying here in Australia: &#8220;Don&#8217;t throw the baby out with the bathwater&#8221;. I&#8217;m not sure it it&#8217;s common elsewhere, but basically it&#8217;s a warning not to discard the good along with the bad. When Google Buzz was released, people were shocked at the automatic management of contacts. I suspect that people inside [...]]]></description>
			<content:encoded><![CDATA[<p>There is a saying here in Australia: &#8220;Don&#8217;t throw the baby out with the bathwater&#8221;. I&#8217;m not sure it it&#8217;s common elsewhere, but basically it&#8217;s a warning not to discard the good along with the bad.</p>
<p>When Google Buzz was released, people were shocked at the automatic management of contacts. I suspect that people inside Google were quite surprised at this &#8211; after all, it was just a logical extension of what they had been doing within Gmail and Gtalk for years.</p>
<p>I also suspect that within Google it isn&#8217;t widely known how much people <strong><em>hate</em></strong> this feature. Personally, I&#8217;m no privacy freak, but I&#8217;m continually annoyed by the fact that I get random people showing up on my GTalk list just because we corresponded about some random open source project 5 years ago or something. I&#8217;ve also heard that a lot of Googlers have stopped using public GTalk because too many external people interrupt them. There is a lot I could say about the rudeness of strangers who just want help to diagnose problems etc, but for the moment I&#8217;ll just say that software should encourage desired behavior and discourage things you don&#8217;t want to happen.</p>
<p>However &#8211; I don&#8217;t think Google is wrong in thinking that computers could do a better job than humans of managing contacts for them. I&#8217;d love the auto-follow-on-buzz (and auto-add-to-GTalk) feature if it did it <em>almost</em> as well as I could do it myself. At the moment I tolerate the feature in GTalk because &#8211; while I know I could do better myself &#8211; I know from services like Facebook that the continual grouping and pruning of contact lists is a game I don&#8217;t have time for.</p>
<p>After the push-back Google got on automatic contact management in Buzz, it would be tempting to just give up on the problem. I don&#8217;t think they should do that &#8211; instead of pulling away from the problem they should invest in solving it.</p>
<p>Because then maybe I won&#8217;t hate my GTalk contact list anymore.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Badmagicnumber?a=6oQAi7efhIo:3eMw0Mn0Y1U:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/Badmagicnumber?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Badmagicnumber?a=6oQAi7efhIo:3eMw0Mn0Y1U:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/Badmagicnumber?d=yIl2AUoC8zA" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Badmagicnumber/~4/6oQAi7efhIo" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://nicklothian.com/blog/2010/03/29/google-buzz-babies-bathwater/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using Flash to shim a webcam to Canvas</title>
		<link>http://nicklothian.com/blog/2009/12/15/using-flash-to-shim-a-webcam-to-canvas/</link>
		<comments>http://nicklothian.com/blog/2009/12/15/using-flash-to-shim-a-webcam-to-canvas/#comments</comments>
		<pubDate>Wed, 16 Dec 2009 00:09:58 +0000</pubDate>
		<dc:creator>Nick Lothian</dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[tech]]></category>

		<guid isPermaLink="false">http://nicklothian.com/blog/?p=441</guid>
		<description><![CDATA[A couple of weeks ago I posted my work on developing virtual keypad using HTML5 video. That worked surprisingly well, but had some unfortunate requirements in that HTML5 doesn&#8217;t really support access to webcams. Flash Does. I&#8217;ve developed a Flash shim, which gets access to your webcam, and copies frames to data urls which can [...]]]></description>
			<content:encoded><![CDATA[<p>A couple of weeks ago I posted my work on developing <a href="http://nicklothian.com/blog/2009/11/18/augmented-reality-virtual-keyboard-using-html-5-video/">virtual keypad using HTML5 video</a>. That worked surprisingly well, but had some unfortunate requirements in that HTML5 doesn&#8217;t really support access to webcams.</p>
<p>Flash Does.</p>
<p>I&#8217;ve developed a Flash shim, which gets access to your webcam, and copies frames to data urls which can be used in HTML DOM images.</p>
<p>This works well, within some limits:</p>
<ul>
<li>The performance of the Flash-&gt;Javascript interface is adequate for normal use, but drops off as the data being copied across increases in size. This means that you need to have a postage stamp sized (80&#215;60) video in flash to get adequate performance in HTML (~25 fps).</li>
<li>Chrome (and Safari?) leaks memory when new data URLs are created. (See <a href="http://code.google.com/p/chromium/issues/detail?id=25047">bug</a>). Apart from that, this technique works on both Chrome &amp; Firefox, but my virtual keypad is Firefox only ATM</li>
<li>I don&#8217;t really know Flash. I downloaded the Flex SDK a few days ago and started hacking, so I&#8217;m pretty sure <a href="http://demo.nicklothian.com/flashcamshim/cam.mxml">my Flash code</a> sucks.</li>
</ul>
<p><a href="http://demo.nicklothian.com/flashcamshim/">Here&#8217;s a demo</a>. Take a look at the <a href="http://nicklothian.com/blog/2009/11/18/augmented-reality-virtual-keyboard-using-html-5-video/">previous post</a> to see how you are supposed to use it. I started work on making a proper Javascript API for it, but yeah&#8230; The code is on GitHub, though: <a href="http://github.com/nlothian/FlashCamShim">http://github.com/nlothian/FlashCamShim</a></p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Badmagicnumber?a=dKjtIBz6NXA:pkyosA6Tu_g:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/Badmagicnumber?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Badmagicnumber?a=dKjtIBz6NXA:pkyosA6Tu_g:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/Badmagicnumber?d=yIl2AUoC8zA" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Badmagicnumber/~4/dKjtIBz6NXA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://nicklothian.com/blog/2009/12/15/using-flash-to-shim-a-webcam-to-canvas/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Augmented Reality Virtual Keyboard using HTML 5 video</title>
		<link>http://nicklothian.com/blog/2009/11/18/augmented-reality-virtual-keyboard-using-html-5-video/</link>
		<comments>http://nicklothian.com/blog/2009/11/18/augmented-reality-virtual-keyboard-using-html-5-video/#comments</comments>
		<pubDate>Wed, 18 Nov 2009 07:47:20 +0000</pubDate>
		<dc:creator>Nick Lothian</dc:creator>
				<category><![CDATA[tech]]></category>

		<guid isPermaLink="false">http://nicklothian.com/blog/?p=417</guid>
		<description><![CDATA[I&#8217;ve been pretty impressed with some of the stuff ARKit can do, as well as the Microsoft Surface demos. I decided that we need to do that on the web, too, so I build a virtual keypad, using HTML5 video and a webcam. In HTML5, a common (example 1, example 2) pattern is to take [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been pretty impressed with some of the stuff <a href="http://www.youtube.com/watch?v=TeGdWu9tl1A">ARKit</a> can do, as well as the <a href="http://www.youtube.com/watch?v=Zxk_WywMTzc">Microsoft Surface demos</a>.</p>
<p>I decided that we need to do that on the web, too, so I build a virtual keypad, using HTML5 video and a webcam.</p>
<p>In HTML5, a common (<a href="http://people.mozilla.com/~prouget/demos/tracker/tracker.xhtml">example 1</a>, <a href="http://www.mozbox.org/pub/green/index.xhtml">example 2</a>) pattern is to take an image from a video, copy it to a canvas and manipulate it here using Javascript. That&#8217;s the general pattern I&#8217;ve used.</p>
<p>I use a colored marker (setup in a calibration phase) and track its location. In order to take account of brightness changes, etc, I do cosine similarity tests on average color vectors for each &#8220;key&#8221; on the keypad using the <a href="http://sylvester.jcoglan.com/">Sylvester Javascript vector library</a>.</p>
<p>I think there&#8217;s a fair bit of potential for video based interfaces. I&#8217;d like to see a combination of this and the <a href="http://www.randomthink.net/labs/html5drums/?/lab/html5drums/">HTML5 drumkit</a>, for example.</p>
<p>You can try it out here: <a href="http://demo.nicklothian.com/keypad/">http://demo.nicklothian.com/keypad/</a>. You&#8217;ll need to be using Firefox 3.5+.</p>
<p>Here&#8217;s a demo video (ironically as an embedded flash video):</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="665" height="513" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="play" value="true" /><param name="src" value="http://nicklothian.com/blog/wp-content/uploads/2009/11/keypad.swf" /><embed type="application/x-shockwave-flash" width="665" height="513" src="http://nicklothian.com/blog/wp-content/uploads/2009/11/keypad.swf" play="true"></embed></object></p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Badmagicnumber?a=9Kl4JdHLOIA:5xNXQrxzbQw:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/Badmagicnumber?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Badmagicnumber?a=9Kl4JdHLOIA:5xNXQrxzbQw:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/Badmagicnumber?d=yIl2AUoC8zA" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Badmagicnumber/~4/9Kl4JdHLOIA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://nicklothian.com/blog/2009/11/18/augmented-reality-virtual-keyboard-using-html-5-video/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Using a webcam with HTML 5  via VLC</title>
		<link>http://nicklothian.com/blog/2009/11/17/using-a-webcam-with-html-5-via-vlc/</link>
		<comments>http://nicklothian.com/blog/2009/11/17/using-a-webcam-with-html-5-via-vlc/#comments</comments>
		<pubDate>Wed, 18 Nov 2009 00:18:36 +0000</pubDate>
		<dc:creator>Nick Lothian</dc:creator>
				<category><![CDATA[tech]]></category>

		<guid isPermaLink="false">http://nicklothian.com/blog/?p=391</guid>
		<description><![CDATA[HTML 5 includes the &#60;video&#62; tag to enable embedding of video. Unfortunately, and unlike Flash, there is no way to directly use a webcam with it. However, if you want to experiment with it some VLC+Apache magic can help. Firstly, you need to setup VLC to do HTTP streaming. These instructions are for windows, but [...]]]></description>
			<content:encoded><![CDATA[<p>HTML 5 includes the &lt;video&gt; tag to enable embedding of video.</p>
<p>Unfortunately, and unlike Flash, there is no way to directly use a webcam with it. However, if you want to experiment with it some VLC+Apache magic can help.</p>
<p>Firstly, you need to setup VLC to do HTTP streaming. These instructions are for windows, but it works on Linux, too (Linux seems a lot less stable. I suspect that is a Firefox problem rather than VLC, though). VLC can be somewhat obtuse to use, so here&#8217;s how I got it working</p>
<h3>Step 1: Open VLC and select streaming</h3>
<p><img class="alignnone size-full wp-image-404" title="VLC - Select Streaming" src="http://nicklothian.com/blog/wp-content/uploads/2009/11/vlc1.png" alt="VLC - Select Streaming" width="367" height="387" /></p>
<h3>Step 2: Select Capture Device</h3>
<p><img class="alignnone size-full wp-image-405" title="VLC Select Capture Device" src="http://nicklothian.com/blog/wp-content/uploads/2009/11/vlc2.png" alt="VLC Select Capture Device" width="500" height="403" /></p>
<p>Click the &#8220;Stream&#8221; button.</p>
<h3>Step 3: Stream Dialog</h3>
<p><img class="alignnone size-full wp-image-407" title="VLC Stream Dialog" src="http://nicklothian.com/blog/wp-content/uploads/2009/11/vlc3.png" alt="VLC Stream Dialog" width="500" height="349" /></p>
<p>Click the &#8220;Next&#8221; button.</p>
<h3>Step 4: Add stream destination</h3>
<p><img class="alignnone size-full wp-image-408" title="VLC Add Destination" src="http://nicklothian.com/blog/wp-content/uploads/2009/11/vlc4.png" alt="VLC Add Destination" width="500" height="327" /></p>
<p>Select &#8220;HTTP&#8221;, check &#8220;Display Locally&#8221;, select the &#8220;Video &#8211; Thora + Vorbis (OGG)&#8221; profile and click &#8220;Add&#8221;</p>
<h3>Step 5: Configure the stream</h3>
<p><img class="alignnone size-full wp-image-409" title="VLC Configure Stream" src="http://nicklothian.com/blog/wp-content/uploads/2009/11/vlc5.png" alt="VLC Configure Stream" width="500" height="430" /></p>
<p>Note that I changed the port from the default of 8080 to 8081. This is optional, but note what port you use. Verify the profile is correct, and click the &#8220;Next&#8221; button.</p>
<h3>Step 6: Modify the stream path</h3>
<p><img class="alignnone size-full wp-image-410" title="VLC Modify Stream Path" src="http://nicklothian.com/blog/wp-content/uploads/2009/11/vlc6.png" alt="VLC Modify Stream Path" width="500" height="287" /></p>
<p>Carefully alter the &#8220;Generated stream output string&#8221; to include &#8220;/stream.ogg&#8221; after the port. You need to do this because Firefox uses the file extension to work out how to handle the file (in the absence of correct headers).</p>
<p>Click Stream, and VLC should display a window showing your webcam.</p>
<h3>Step 7: Verify streaming is working</h3>
<p>Go to http://localhost:8081/stream.ogg in Firefox. Chrome kind of works, too, sometime (I usually get the first frame, and then it stops playing).</p>
<h3>Optional Step</h3>
<p>This stream can be embedded in a webpage using the URL above. However, if you want to manipulate it in Javascript at all you will quickly run into the same-origin restriction. It&#8217;s possible to get around this by using Apache to proxy the stream onto the same site you serve yout pages and javascript from.</p>
<h3>Step 8: Configure Apache to Proxy Stream</h3>
<p>I use mod_proxy, and add the following:</p>
<pre><tt>ProxyPass /stream/stream.ogg http://localhost:8081/stream.ogg</tt></pre>
<p>That will allow you to view the stream from http://yourwebserver:port/stream/stream.ogg.</p>
<p>In my next post I aim to show something you can do with this stream.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Badmagicnumber?a=LvLqB64aeNE:2yTUKDl-1RE:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/Badmagicnumber?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Badmagicnumber?a=LvLqB64aeNE:2yTUKDl-1RE:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/Badmagicnumber?d=yIl2AUoC8zA" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Badmagicnumber/~4/LvLqB64aeNE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://nicklothian.com/blog/2009/11/17/using-a-webcam-with-html-5-via-vlc/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Chrome Extension: Chrome Reload</title>
		<link>http://nicklothian.com/blog/2009/11/13/chrome-extension-chrome-reload/</link>
		<comments>http://nicklothian.com/blog/2009/11/13/chrome-extension-chrome-reload/#comments</comments>
		<pubDate>Fri, 13 Nov 2009 10:20:09 +0000</pubDate>
		<dc:creator>Nick Lothian</dc:creator>
				<category><![CDATA[tech]]></category>

		<guid isPermaLink="false">http://nicklothian.com/blog/?p=399</guid>
		<description><![CDATA[I wrote my first Chrome extension. The APIs are pretty nice. From the project page: Chrome-Reload is an extension for the Chrome web browser to allow automatic periodic reloading of a page. It allows the you to configure how often each page reloads and see a count-down until the next load. This is useful for [...]]]></description>
			<content:encoded><![CDATA[<p>I wrote my first Chrome extension. The APIs are pretty nice.</p>
<p>From the <a href="http://code.google.com/p/chrome-reload/">project page</a>:</p>
<blockquote><p>
Chrome-Reload is an extension for the Chrome web browser to allow automatic periodic reloading of a page. It allows the you to configure how often each page reloads and see a count-down until the next load.</p>
<p>This is useful for scenarios such as monitoring constantly changing pages (eg, search results), or for keeping sessions alive in web applications. </p></blockquote>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Badmagicnumber?a=xPJtPnS3qs8:-MgWiK3y5Tw:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/Badmagicnumber?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Badmagicnumber?a=xPJtPnS3qs8:-MgWiK3y5Tw:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/Badmagicnumber?d=yIl2AUoC8zA" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Badmagicnumber/~4/xPJtPnS3qs8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://nicklothian.com/blog/2009/11/13/chrome-extension-chrome-reload/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Solr+Cassandra</title>
		<link>http://nicklothian.com/blog/2009/10/27/solr-cassandra-solandra/</link>
		<comments>http://nicklothian.com/blog/2009/10/27/solr-cassandra-solandra/#comments</comments>
		<pubDate>Wed, 28 Oct 2009 03:15:21 +0000</pubDate>
		<dc:creator>Nick Lothian</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[tech]]></category>
		<category><![CDATA[cassandra]]></category>
		<category><![CDATA[solr]]></category>

		<guid isPermaLink="false">http://nicklothian.com/blog/?p=392</guid>
		<description><![CDATA[I&#8217;ve been a big fan of Solr for quite a long time, and have used it extensively at work. I noticed a few weeks ago that Jake Luciani had managed to get Lucene (which Solr uses) working on Cassandra (Facebook&#8217;s highly scalable keystore). The next step had an obvious name: Solandra &#8211; Solr running on [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been a big fan of <a href="http://lucene.apache.org/solr/">Solr</a> for quite a long time, and have used it extensively at work.</p>
<p>I noticed a few weeks ago that <a href="http://3.rdrail.net/blog/">Jake Luciani</a> had managed to get Lucene (which Solr uses) <a href="http://github.com/tjake/Lucandra">working </a>on <a href="http://incubator.apache.org/cassandra/">Cassandra</a> (Facebook&#8217;s highly scalable keystore).</p>
<p>The next step had an obvious name: Solandra &#8211; Solr running on Cassandra.</p>
<p>Basically there wasn&#8217;t too much to getting it going in the limited form it is now &#8211; a few minor changes to Jake&#8217;s Lucandra code, a custom Solr FieldType (exactly why I needed this I&#8217;m unsure) and correctly configured solrconfig.xml and schema.xml files.</p>
<p>I haven&#8217;t tested updates, so you&#8217;ll probably need Jake&#8217;s <a href="http://github.com/tjake/Lucandra/blob/master/test/lucandra/demo/BookmarksDemo.java">BookmarkDemo</a> to load data in.</p>
<p>My changes to the Lucandra index reader include hard coding (!) the fields returned by getFieldNames(..) to match the Solr schema and the fields added in the demo.</p>
<p>If anyone is interested, the code is available: <a href="http://nicklothian.com/files/solandra28102009.zip">solandra.zip</a>. You&#8217;ll need to be a Java developer to use it, though.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Badmagicnumber?a=9AW0m5-jewI:WU1ZrdwzRT8:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/Badmagicnumber?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Badmagicnumber?a=9AW0m5-jewI:WU1ZrdwzRT8:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/Badmagicnumber?d=yIl2AUoC8zA" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Badmagicnumber/~4/9AW0m5-jewI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://nicklothian.com/blog/2009/10/27/solr-cassandra-solandra/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Cross domain, cross window Javascript communication</title>
		<link>http://nicklothian.com/blog/2009/08/05/cross-domain-cross-window-javascript-communication/</link>
		<comments>http://nicklothian.com/blog/2009/08/05/cross-domain-cross-window-javascript-communication/#comments</comments>
		<pubDate>Thu, 06 Aug 2009 02:24:34 +0000</pubDate>
		<dc:creator>Nick Lothian</dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[tech]]></category>

		<guid isPermaLink="false">http://nicklothian.com/blog/?p=379</guid>
		<description><![CDATA[The scenario: A typical meeting, they want to pop up our search screen, select an item and have it post back via Javascript the selected item. &#8220;Sure, no problem&#8221; I say. &#8220;Can you do cross domain Javascript like that&#8221; their dev asks, and I think for a second about all the IFrame proxy hacks I&#8217;ve [...]]]></description>
			<content:encoded><![CDATA[<p>The scenario: A typical meeting, they want to pop up our search screen, select an item and have it post back via Javascript the selected item. &#8220;Sure, no problem&#8221; I say. &#8220;Can you do cross domain Javascript like that&#8221; their dev asks, and I think for a second about all the IFrame proxy hacks I&#8217;ve seen and say &#8220;yeah, no problems&#8221;.</p>
<p>Doh.</p>
<p>So I get back to work, and talk to Ben-out-local-Javascript-god, who points me at the location-fragment for communication hack (see, for example <a href="http://tagneto.blogspot.com/2006/06/cross-domain-frame-communication-with.html">Cross Domain Frame Communication with Fragment Identifiers (for Comet?)</a>) and away I go.</p>
<p>I quickly discover that all the documentation on that is for use with frames, not windows, and windows work slightly different. For example, the parent window can&#8217;t poll the child for it&#8217;s location.hash, nor can the child set the parent&#8217;s location.hash. </p>
<p>Doh Doh.</p>
<p>Anyway to cut a long story short and to document it for anyone else, you can make it work. The child window needs to contain a iframe from the parent domain, then proxy communication though that. Modern non IE browsers can use <a href="http://ejohn.org/blog/cross-window-messaging/">Window.postMessage</a> to do the same thing (Actually, IE8 supports Window.postMessage, too, but I couldn&#8217;t get it to work properly).</p>
<p>The core of the IE specific code looks like this. The child window uses this object:</p>
<p><code></p>
<pre>
/*
  XDCommsChild - Cross Domain Communication, Child Object.

   Create this in the child window with the address of the xdomaincomms.html file on the same domain as the parent window
*/
var XDCommsChild = function(xdomaincommsAddress) {
    this.xdomaincommsAddress = xdomaincommsAddress;

    this.isIe = isInternetExplorer();

    if (isIe) {
        // need hidden frame for communication. IE8 is supposed to support postMessage, but I can't get it to work properly
        document.writeln("<iframe style='display:none' name='xdcomms' src='" + this.xdomaincommsAddress + "' width='1px' height='1px'></iframe>")
    }

    this.postBack = function(data) {
        if (isIe) {
            // this method tested against IE6,7 &#038; 8
            window.open(this.xdomaincommsAddress + '#data=' + data, 'xdcomms'); // MUST use window.open. frame.src or frame.location both fail
        } else {
            // for everything else - tested against Firefox 3, Chrome, Safari
            window.opener.postMessage(data, '*'); // should really restrict the domain data can come from here
        }
    }

    this.postBackAndCloseWindow = function(data){
        this.postBack(data);
        setTimeout("window.close()", 200); // need to use a timeout to make sure the javascript in the frame has executed if we are using that communication model
    }
}
</pre>
<p></code></p>
<p>Then the included proxy frame (deployed on the parent domain) looks like this:</p>
<p><code> </p>
<pre>
           var hash = null;

            function sendData() {
                hash = location.hash;
                if (hash != null &#038;&#038; hash.length > 1) {
                    window.parent.opener.location.hash=hash;
                    location.hash = '#';
                }
            }

            setInterval("sendData()", 50);
</pre>
<p></code></p>
<p>The the parent window uses this object:</p>
<p><code></p>
<pre>
/*
  XDCommsParent - Cross Domain Communication, Parent Object.

   Create this in the parent window with a callback function that will recieve data.
*/
var XDCommsParent = function(dataRecievedCallback) {
    this.dataRecievedCallback = dataRecievedCallback;

    this.isIe = isInternetExplorer();

    this.receiveMessage = function(event) {
        dataRecievedCallback(event.data);
    }

    if (this.isIe) {
        window.setInterval("pollForData()", 200);
    } else {
        window.addEventListener("message", this.receiveMessage, false);
    }

}
</pre>
<p></code></p>
<p>The final piece of the solution is calling it from the child window. I do this:</p>
<p><code></p>
<pre>
&lt;button onclick="javascript:xDCommsChild.postBackAndCloseWindow(document.getElementById('thevalue').value);"&gt;Send to Parent Window&lt;/button&gt;
</pre>
<p></code></p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Badmagicnumber?a=L6t3kpJCPFk:JBL89iAS2w8:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/Badmagicnumber?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Badmagicnumber?a=L6t3kpJCPFk:JBL89iAS2w8:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/Badmagicnumber?d=yIl2AUoC8zA" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Badmagicnumber/~4/L6t3kpJCPFk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://nicklothian.com/blog/2009/08/05/cross-domain-cross-window-javascript-communication/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Fixing Firefox performance and lock-ups on Linux</title>
		<link>http://nicklothian.com/blog/2009/05/05/fixing-firefox-performance-and-lock-ups-on-linux/</link>
		<comments>http://nicklothian.com/blog/2009/05/05/fixing-firefox-performance-and-lock-ups-on-linux/#comments</comments>
		<pubDate>Tue, 05 May 2009 23:32:18 +0000</pubDate>
		<dc:creator>Nick Lothian</dc:creator>
				<category><![CDATA[random]]></category>
		<category><![CDATA[tech]]></category>

		<guid isPermaLink="false">http://nicklothian.com/blog/?p=373</guid>
		<description><![CDATA[I&#8217;ve been using Ubuntu (8.04 then 8.10) reasonably heavily over the last 12 months or so as my main operating system on two of my home computers (a Dell Mini 9&#8243; and a quad core desktop). I&#8217;ve been pretty happy with it except for the infuriating habit Firefox has for &#8220;locking up&#8221; periodically. The symptoms [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been using Ubuntu (8.04 then 8.10) reasonably heavily over the last 12 months or so as my main operating system on two of my home computers (a Dell Mini 9&#8243; and a quad core desktop).</p>
<p>I&#8217;ve been pretty happy with it except for the infuriating habit Firefox has for &#8220;locking up&#8221; periodically. The symptoms of this include non-reponsiveness, screen freezing and even the computer being unusable for 30 seconds at a time. The only clue I had was there seemed to be large amounts of disk usage.</p>
<p>After a while bitching and moaning about it I got so annoyed I started looking for a fix. </p>
<p>The first thing I tried was the Chromium Linux nightly builds. Google says &#8220;blogging about this isn&#8217;t helpful&#8221;, so I won&#8217;t except to say that I&#8217;ve got pretty high expectations of Chrome on Linux and so far I haven&#8217;t had to re-apprise that.</p>
<p>All the same, I wanted to fix Firefox. The next thing I tried was moving Firefox cache to a RAM drive. That&#8217;s pretty easy &#8211; just set it to use a directory under /dev/shm/ for the cache location. </p>
<p>I think that improved the situation marginally, but not enough to call it a fix.</p>
<p>The next thing I tried was to raise a <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=491413">Firefox bug</a>. Somewhat to my surprise that got linked to <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=421482">another bug</a> which was marked as fixed.</p>
<p>The comments on that bug are quite long, but the story is this:</p>
<ul>
<li>Firefox uses <a href="http://www.sqlite.org/">SQLite</a> as a database for its history and bookmarks.</li>
<li>SQLite, being a database is very concerned about <a href="http://www.sqlite.org/lockingv3.html">data integrity</a>, and to implement this it relies on the fsync system call.</li>
<li>fsync has performance issues on ext3 filesystems. See for example, <a href="http://lwn.net/Articles/328363/">http://lwn.net/Articles/328363/</a>:<br />
<blockquote><p>
The problem, in short, is this: the ext3 filesystem, when running in the default data=ordered mode, can exhibit lengthy stalls when some process calls fsync() to flush data to disk. This issue most famously manifested itself as the much-lamented Firefox system-freeze problem, but it goes beyond just Firefox.
</p></blockquote>
<li>SQLite has a no-sync mode, which trades reliability for performance.</li>
<li>Firefox can use this mode via a config setting.</li>
</ul>
<p>So the outcome of all that is this:</p>
<p><strong>Create a new config key &#8220;toolkit.storage.synchronous&#8221; and set it to the integer 0 to stop Firefox lock-ups on Linux </strong>(but be aware that there is some chance a power failure could cause loss of your history and/or bookmarks).</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Badmagicnumber?a=xDMvsJBeZ38:xIHZHH7Qd1E:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/Badmagicnumber?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Badmagicnumber?a=xDMvsJBeZ38:xIHZHH7Qd1E:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/Badmagicnumber?d=yIl2AUoC8zA" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Badmagicnumber/~4/xDMvsJBeZ38" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://nicklothian.com/blog/2009/05/05/fixing-firefox-performance-and-lock-ups-on-linux/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss><!-- Dynamic Page Served (once) in 0.336 seconds --><!-- Cached page served by WP-Cache -->
