<?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>Martin Falatic’s Techno Blog</title>
	<atom:link href="http://www.falatic.com/index.php/feed" rel="self" type="application/rss+xml" />
	<link>http://www.falatic.com</link>
	<description>Technobabble...</description>
	<lastBuildDate>Tue, 21 May 2013 16:16:39 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>On the proper use of the I2C bus in general and with the Logos RGB Matrix Backpack</title>
		<link>http://www.falatic.com/index.php/90/on-the-proper-use-of-the-i2c-bus-in-general-and-with-the-logos-rgb-matrix-backpack</link>
		<comments>http://www.falatic.com/index.php/90/on-the-proper-use-of-the-i2c-bus-in-general-and-with-the-logos-rgb-matrix-backpack#comments</comments>
		<pubDate>Tue, 21 May 2013 16:16:39 +0000</pubDate>
		<dc:creator>Martin Falatic</dc:creator>
				<category><![CDATA[Electronics]]></category>
		<category><![CDATA[Software and Hardware development]]></category>
		<category><![CDATA[Arduino]]></category>
		<category><![CDATA[I2C]]></category>
		<category><![CDATA[RaspberryPi]]></category>

		<guid isPermaLink="false">http://www.falatic.com/?p=90</guid>
		<description><![CDATA[Note: In the course of all this I created an improved Arduino I2C bus scanner. Check it out! First, a thank-you to Pierce from Logos Electromechanical who clued me in on what I was doing wrong with the backpack. It &#8230; <a class="more-link" href="http://www.falatic.com/index.php/90/on-the-proper-use-of-the-i2c-bus-in-general-and-with-the-logos-rgb-matrix-backpack">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>Note: In the course of all this I created <a href="https://github.com/MartyMacGyver/Arduino_I2C_Scanner" target="_blank">an improved Arduino I2C bus scanner</a>. Check it out!</p>
<p>First, a thank-you to Pierce from Logos Electromechanical who clued me in on what I was doing wrong with the backpack.</p>
<p>It turns out there are two common ways to detect an I2C device: address it and see if it ACKs (quick mode), or address it and try to read a byte from it (read mode). Some devices that aren&#8217;t set up to write don&#8217;t like to be read from and will cause problems if you try to do that (in this case, SDA gets pulled low and stays low!) I thought it was a bug but no, it&#8217;s actually how this device is supposed to work.</p>
<p>I selected an address for my backpack of 0&#215;58. It turns out that i2cdetect has some intelligence when it comes to its default behavior &#8211; it will decide based on the address how best to perform its test of that address. If the device address is in the ranges {0&#215;30:0&#215;37,0&#215;50:0x5f}, it will use read mode. Outside those ranges, it will use quick mode. See <a href="http://www.lm-sensors.org/browser/i2c-tools/trunk/tools/i2cdetect.c" target="_blank">the i2cdetect.c code</a> for how this was implemented in Linux.</p>
<p>So I chose&#8230; poorly &#8211; at least when it came to the address for the backpack (and keep in mind that the default address of this device is 0x7F, which is invalid for I2C, so you MUST select a valid address via solder bridging the appropriate pads!) Since the high (0&#215;40) bit is already &#8220;1&#8243; on this device, you can choose an address within the valid range of 0&#215;40:0&#215;77&#8230; I suggest something outside the 0&#215;50:0x5F range though, to avoid accidentally triggering this (otherwise, be careful to use &#8220;-q&#8221; with i2cdetect). You can quickly tell when you screw up and try to read from this device: everything else will drop from your I2C bus and detect will act like every I2C address is in use by a device! (Unplugging the backpack from the circuit and from its power source for a moment will reset its state.)</p>
<p>You can read more about the I2C protocol <a href="http://www.robot-electronics.co.uk/acatalog/I2C_Tutorial.html" target="_blank">here</a> and <a href="http://www.boldinventions.com/index.php?option=com_content&amp;view=article&amp;id=51:i2c-how-it-works-part-2&amp;catid=34:category-electronics-articles&amp;Itemid=53" target="_blank">here</a>, <a href="http://www.totalphase.com/support/kb/10039/" target="_blank">learn about special addressing modes here</a>, and <a href="http://www.nxp.com/documents/user_manual/UM10204.pdf" target="_blank">see the specs here</a>.</p>
<p><em>When using the Raspberry Pi model B note the I2C bus on the main header is numbered 1 (older boards have bus 0 on that header).</em></p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F90%2Fon-the-proper-use-of-the-i2c-bus-in-general-and-with-the-logos-rgb-matrix-backpack&amp;title=On%20the%20proper%20use%20of%20the%20I2C%20bus%20in%20general%20and%20with%20the%20Logos%20RGB%20Matrix%20Backpack" id="wpa2a_2"><img src="http://www.falatic.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.falatic.com/index.php/90/on-the-proper-use-of-the-i2c-bus-in-general-and-with-the-logos-rgb-matrix-backpack/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ah, Maker Faire! BeagleBone, HexBright, etc.</title>
		<link>http://www.falatic.com/index.php/85/ah-maker-faire-beaglebone-hexbright-etc</link>
		<comments>http://www.falatic.com/index.php/85/ah-maker-faire-beaglebone-hexbright-etc#comments</comments>
		<pubDate>Mon, 20 May 2013 01:33:52 +0000</pubDate>
		<dc:creator>Martin Falatic</dc:creator>
				<category><![CDATA[Electronics]]></category>
		<category><![CDATA[Arduino]]></category>
		<category><![CDATA[BeagleBone]]></category>
		<category><![CDATA[HexBright]]></category>
		<category><![CDATA[I2C]]></category>
		<category><![CDATA[RaspberryPi]]></category>

		<guid isPermaLink="false">http://www.falatic.com/?p=85</guid>
		<description><![CDATA[I had a great time at Maker Faire this weekend! I picked up a few items which I&#8217;ll quickly summarize here: First, I snagged a BeagleBone Black kit. I haven&#8217;t had a chance to open it up yet but it &#8230; <a class="more-link" href="http://www.falatic.com/index.php/85/ah-maker-faire-beaglebone-hexbright-etc">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>I had a great time at Maker Faire this weekend! I picked up a few items which I&#8217;ll quickly summarize here:</p>
<p>First, I snagged a BeagleBone Black kit. I haven&#8217;t had a chance to open it up yet but it looks promising, though <a href="http://letsmakerobots.com/node/37063" target="_blank">I wonder just how much trouble it&#8217;s going to be</a>&#8230; it sounds like it will be more daunting than my Raspberry Pi (which I&#8217;m finally making good use of!)</p>
<p>I also picked up a <a href="http://logos-electro.com/rgb-led-matrix-backpack-1" target="_blank">Logos Electromechanical Labs RGB LED Matrix Backpack</a> to fiddle with. I&#8217;ve been busy getting I2C devices working with my Rpi and thought this would be a fun addition! (I&#8217;ve previously fiddled with them on the Arduino, but the Wire library on Arduino leaves much to be desired in terms of correctness). <em><del>Sadly, while it works with the Arduino, the backpack appears to hose to I2C bus on the Rpi (note that since this backpack is a 5V device I am using <a href="http://www.adafruit.com/products/757" target="_blank">an appropriate level shifter</a> to interface it to the 3.3V Rpi). It seems that once it&#8217;s addressed (or even detected, e.g., via i2cdetect) it doesn&#8217;t correctly relinquish the bus until the backpack is disconnected and powered off. I&#8217;ve emailed them to see if they know why this is and how to fix it (I suspect it&#8217;s a firmware problem on the backpack, which is AVR-based&#8230; but I&#8217;m not sure how I&#8217;d update it yet).</del></em></p>
<p><strong>UPDATE:</strong> the backpack works fine with the Pi &#8211; it was the nut behind the wheel that was the problem. More in an upcoming post. <img src='http://www.falatic.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':-D' class='wp-smiley' /> </p>
<p>My most unique purchase was the <a href="http://www.hexbright.com/" target="_blank">HexBright FLEX 500 lumen Arduino-powered LED flashlight</a>! <img src='http://www.falatic.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':-D' class='wp-smiley' />  I was able to reprogram it pretty easily, though it doesn&#8217;t work with the Arduino IDE 1.5.x yet (also, when adding this target, merging their boards.txt to your boards.txt is the easy way to go&#8230; it didn&#8217;t work for me otherwise).</p>
<p>Note that I&#8217;m not thrilled with the charger that comes with the HexBright&#8230; I recently learned a <a href="http://www.eevblog.com/2012/11/20/eevblog-388-apple-clone-usb-charger-teardown/" target="_blank">LOT about off-brand USB chargers I was unaware of, particularly with regard to safety, from this EEVBlog post</a> among other places, and that makes me wary of chargers that look like knockoffs. While I&#8217;m happy to use cheaper parts when possible (I&#8217;m certainly not a hardware purist!), I expect the things I plug into my wall to have a a valid UL stamp on them at the very least. Bonus points if they spell the words right on it (&#8220;inter-mation equipment&#8221;? Looks like copy-pasta from a few other questionable chargers I&#8217;ve seen teardowns of &#8211; probably the same maker slaps whatever name you want on them). And no, that serial number is not &#8220;serial&#8221; at all on cheap chargers.</p>
<p><a href="http://www.falatic.com/wp-content/uploads/2013/05/20130519_181233.jpg"><img class="alignnone size-medium wp-image-86" alt="20130519_181233" src="http://www.falatic.com/wp-content/uploads/2013/05/20130519_181233-290x300.jpg" width="290" height="300" /></a></p>
<p>Again, not knocking the flashlight, which seems pretty solid&#8230; just not thrilled with the cheap USB plug-in charger it comes with. Now that I know more about what goes into these small form-factor chargers I can appreciate that you don&#8217;t want to skimp when it comes to quality on them.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F85%2Fah-maker-faire-beaglebone-hexbright-etc&amp;title=Ah%2C%20Maker%20Faire%21%20BeagleBone%2C%20HexBright%2C%20etc." id="wpa2a_4"><img src="http://www.falatic.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.falatic.com/index.php/85/ah-maker-faire-beaglebone-hexbright-etc/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Windows and the Case of the Unexpectedly Incorrect Desktop Icon</title>
		<link>http://www.falatic.com/index.php/75/windows-and-the-case-of-the-unexpectedly-incorrect-desktop-icon</link>
		<comments>http://www.falatic.com/index.php/75/windows-and-the-case-of-the-unexpectedly-incorrect-desktop-icon#comments</comments>
		<pubDate>Mon, 18 Mar 2013 07:09:39 +0000</pubDate>
		<dc:creator>Martin Falatic</dc:creator>
				<category><![CDATA[Windows]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[icons]]></category>
		<category><![CDATA[root cause]]></category>

		<guid isPermaLink="false">http://www.falatic.com/?p=75</guid>
		<description><![CDATA[Tonight I moved my installation of Eclipse to another folder. I made sure to update the registry accordingly&#8230; this is where NirSoft&#8217;s free RegScanner utility came in handy: it&#8217;s something like Agent Ransack (another awesome free utility) for registries. I found all the &#8230; <a class="more-link" href="http://www.falatic.com/index.php/75/windows-and-the-case-of-the-unexpectedly-incorrect-desktop-icon">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>Tonight I moved my installation of Eclipse to another folder. I made sure to update the registry accordingly&#8230; this is where <a href="http://www.nirsoft.net/utils/regscanner.html" target="_blank">NirSoft&#8217;s free RegScanner utility</a> came in handy: it&#8217;s something like <a href="http://www.mythicsoft.com/page.aspx?type=agentransack&amp;page=home" target="_blank">Agent Ransack</a> (another awesome free utility) for registries. I found all the instances of the old path, exported the .reg file, updated it, then imported it. It worked, and saved lots of tedium hunting through the registry manually for the same things.</p>
<p>Then, in the course of updating things I updated the software for my OWON oscilloscope. Up to this point everything worked fine, but when I put the &#8216;scopes icon on the desktop it was the Eclipse icon, not the one that is very clearly the one for the scope.</p>
<p><span id="more-75"></span>This bugged me, having dealt with the occasional desktop icon problem before. I figured my moving Eclipse did the deed, and I was determined to fix it. I did everything: re-selected the icon in its executable, changed it to some other apps&#8217; icon, <a href="http://superuser.com/questions/50363/desktop-icons-corrupted-in-windows-7-how-do-i-fix-this" target="_blank">cleared the icon cache db and rebooted (several times)</a>&#8230; nothing changed the fact that on the desktop this icon was for Eclipse and was nothing like the icons I was selecting. Put the shortcut anywhere else and the icon looked right, but not on the desktop.</p>
<p><em>Expectation:</em></p>
<pre style="padding-left: 30px;"><em><a href="http://www.falatic.com/wp-content/uploads/2013/03/Icon-expectation.jpg"><img class="size-full wp-image-81 alignnone" alt="Icon-expectation" src="http://www.falatic.com/wp-content/uploads/2013/03/Icon-expectation.jpg" width="48" height="48" /></a></em></pre>
<p><em>Reality:</em></p>
<pre style="padding-left: 30px;"><em><a href="http://www.falatic.com/wp-content/uploads/2013/03/Icon-reality.jpg"><img class="size-full wp-image-83 alignnone" alt="Icon-reality" src="http://www.falatic.com/wp-content/uploads/2013/03/Icon-reality.jpg" width="48" height="48" /></a></em></pre>
<p>At this point (actually, <a href="http://social.technet.microsoft.com/Forums/en-US/w7itproui/thread/d5efec0c-e967-4127-b217-15da34d7fb00/" target="_blank">right from the outset on some forums</a>) the drumbeat sound of the modern day version of &#8220;reinstall the OS&#8221; begins to echo across my search results: <em>roll back with System Restore&#8230; <em>roll back with System Restore! </em></em>Nope&#8230; no thanks! I didn&#8217;t come this far to trash everything else I&#8217;ve done today for the sake of a stubborn icon!</p>
<p>(Side-note: The MVP punter&#8217;s friends, &#8220;Run System Restore&#8221;, along with the other answers of &#8220;redirect the question to the third-party software maker&#8221; and &#8220;drown the question in data requests&#8221; seem ubiquitous when it comes to semi-official channels for Windows &#8220;support&#8221;. They&#8217;re right up there with &#8220;Go away kid &#8211; you bother me!&#8221; when it comes to help. <em>Fortunately</em> there are far better forums out there that think outside the &#8220;it can&#8217;t be Windows &#8211; it must be something you did!&#8221; box. <em>Unfortunately</em> some MVP ranks appear to come free with a box of Cracker Jacks.)</p>
<p>Looking deeper, I noticed a peculiar &#8220;.eclipseproduct&#8221; file in the OWON folder. That made me wonder if a) this app was made with Eclipse and b) the icons I was seeing weren&#8217;t all the icons in the executable (logically, one might be an Eclipse icon for some reason, perhaps a default placeholder!) I grabbed <a href="http://www.becyhome.de/becyicongrabber/description_eng.htm" target="_blank">BeCyIconGrabber</a> (another handy and free utility) to see exactly what icons were in the exe&#8230; and the true nature of the &#8220;problem&#8221; was revealed:</p>
<pre><a href="http://www.falatic.com/wp-content/uploads/2013/03/Icon-wellisntthatspecial.jpg"><img alt="Icon-wellisntthatspecial" src="http://www.falatic.com/wp-content/uploads/2013/03/Icon-wellisntthatspecial-300x57.jpg" width="300" height="57" /></a></pre>
<p>Well, isn&#8217;t that special! An executable can contain numerous icons, but they are usually identical except for sizing. In this case, the 256&#215;256 icon was defaulted to Eclipse&#8217;s (which appears to be the IDE used to develop the app).</p>
<p>Short of injecting a &#8220;corrected&#8221; icon into the .exe (not worth my time) it appears you would have to find a file with a valid 256&#215;256 icon and use it for your icon source instead &#8211; or just live with the unexpected but now understandable icon, safe in the knowledge that it was neither Windows&#8217; nor your own fault that this icon was stubbornly strange.</p>
<p>Funny how much better life is when you find the root cause, rather than hitting the system with the MVP&#8217;s flamethrower (bka <em>System Restore</em>), which would have solved exactly <em>nothing</em> here while adding a ton of work to re-do all the other work since that restore point was created!</p>
<p>And you can bet that if that didn&#8217;t work, &#8220;nuke it from orbit&#8221; (bka <em>re-install Windows</em>) would come next&#8230; what a great away to drive people to other OSes, even though Windows 7 is one of the most stable and robust versions of Windows out there. I&#8217;ve yet to encounter a non-virus problem in Windows that actually required doing a restore, let alone a re-install .. which has to count for something versus wearing a puffed-up acronym, parroting a troubleshooting script and racking up some sort of &#8220;points&#8221; for ineptitude in the process. (I&#8217;ve almost never found a useful answer on MS TechNet. At least on <a href="http://stackexchange.com/" target="_blank">StackExchange</a> answers are vetted by the community and points tend to <em>mean</em> something, while <a href="http://www.sevenforums.com" target="_blank">SevenForums</a> tends to have pretty solid answers when it comes to Windows.)</p>
<p><strong>tl;dr &#8211; If a particular desktop icon is stubbornly strange, particularly for a third-party app, it might be because its actually strange in the source file. If someone suggests system restore or re-installing Windows for a seemingly simple issue&#8230; look elsewhere for answers first.</strong></p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F75%2Fwindows-and-the-case-of-the-unexpectedly-incorrect-desktop-icon&amp;title=Windows%20and%20the%20Case%20of%20the%20Unexpectedly%20Incorrect%20Desktop%20Icon" id="wpa2a_6"><img src="http://www.falatic.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.falatic.com/index.php/75/windows-and-the-case-of-the-unexpectedly-incorrect-desktop-icon/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Github: long-time user, first-time contributor!</title>
		<link>http://www.falatic.com/index.php/72/github-long-time-user-first-time-contributor</link>
		<comments>http://www.falatic.com/index.php/72/github-long-time-user-first-time-contributor#comments</comments>
		<pubDate>Sun, 20 Jan 2013 14:16:46 +0000</pubDate>
		<dc:creator>Martin Falatic</dc:creator>
				<category><![CDATA[Software and Hardware development]]></category>

		<guid isPermaLink="false">http://www.falatic.com/?p=72</guid>
		<description><![CDATA[&#62; I&#8217;ve finally posted some hobby code to Github! &#60; In this case, an Arduino project I&#8217;ve been dabbling with for a few weeks now&#8230; I&#8217;ve successfully combined a Wii nunchuck controller and a long RGB LED strip (WS2811-based) using an Arduino &#8230; <a class="more-link" href="http://www.falatic.com/index.php/72/github-long-time-user-first-time-contributor">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>&gt; <a href="https://github.com/MartyMacGyver">I&#8217;ve finally posted some hobby code to Github!</a> &lt;</p>
<p>In this case, an Arduino project I&#8217;ve been dabbling with for a few weeks now&#8230; I&#8217;ve successfully combined a Wii nunchuck controller and a long RGB LED strip (WS2811-based) using an Arduino Mega. It&#8217;s very much a work-in-progress, but it&#8217;s the start of building a little body of work out there.</p>
<p>&nbsp;</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F72%2Fgithub-long-time-user-first-time-contributor&amp;title=Github%3A%20long-time%20user%2C%20first-time%20contributor%21" id="wpa2a_8"><img src="http://www.falatic.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.falatic.com/index.php/72/github-long-time-user-first-time-contributor/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Memristor simulation with LTspice &#8211; a practical example!</title>
		<link>http://www.falatic.com/index.php/69/memristor-simulation-with-ltspice-a-practical-example</link>
		<comments>http://www.falatic.com/index.php/69/memristor-simulation-with-ltspice-a-practical-example#comments</comments>
		<pubDate>Thu, 10 Jan 2013 09:47:46 +0000</pubDate>
		<dc:creator>Martin Falatic</dc:creator>
				<category><![CDATA[Electronics]]></category>

		<guid isPermaLink="false">http://www.falatic.com/?p=69</guid>
		<description><![CDATA[Lately I&#8217;ve been getting back into the EE groove with some random electronics projects (such as an Arduino-based LED strip driver). I&#8217;ve also been dabbling with different circuit simulators like Micro-Cap (which I used back in college but which is &#8230; <a class="more-link" href="http://www.falatic.com/index.php/69/memristor-simulation-with-ltspice-a-practical-example">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>Lately I&#8217;ve been getting back into the EE groove with some random electronics projects (such as <a href="http://www.youtube.com/watch?v=bcLGZKe4U_s" target="_blank">an Arduino-based LED strip driver</a>). I&#8217;ve also been dabbling with different circuit simulators like Micro-Cap (which I used back in college but which is VERY expensive for the regular version&#8230; still, it&#8217;s handy for quick little sims to learn new things, especially in the digital realm).</p>
<p>Today I stumbled on <a href="http://www.linear.com/designtools/software/#LTspice" target="_blank">LTspice from Linear Technology</a>, which I found to be surprisingly intuitive (and given that it&#8217;s based on the <a href="http://en.wikipedia.org/wiki/SPICE" target="_blank">venerable and powerful SPICE</a> it&#8217;s that much more worth learning). It&#8217;s not as animation-friendly as Micro-Cap but it&#8217;s pretty easy to make custom components (and where else can you simulate the <em>actual inner workings</em> of a <a href="http://www.electronics.dit.ie/staff/mtully/555%20folder/555%20timer.htm" target="_blank">555 timer</a> or a <a href="http://www.electronics.dit.ie/staff/mtully/741%20tutorial/741%20Op-Amp%20Tutorial.htm" target="_blank">741 op-amp</a>?) (And yes, the 741 is not something you&#8217;d reach for normally nowadays, but they are instructive nonetheless.)</p>
<p>Memristors have intrigued me since they made the news a few years back, when discoveries were made of practical memristive materials. <a href="http://en.wikipedia.org/wiki/Memristor" target="_blank">You can read more about them on Wikipedia</a> and so on, and though very subject is not without controversy I personally think they will prove to be a valuable technology going forward. I found them intriguing from both the EE and the MSE perspectives.</p>
<p>Side-note: if you find yourself wondering more about why a device does what it does (in my case, the humble MOSFET) than regurgitating Kirchoff&#8217;s Law and applying Thévenin&#8217;s theorem, you&#8217;re probably better off in Materials Science Engineering than Electrical Engineering. At least that&#8217;s what happened to me&#8230; that and a very grumpy EE prof who made it clear we&#8217;d all be obsolete, unemployed and grumpy like him soon anyway. And you can always fall back on CS when the semiconductor market tanks&#8230;</p>
<p>Given all that, today I decided to see if I could simulate a circuit with a memristor in it. Problem is, while some sims have memristors, LTspice does not, and apparently nobody out there has published a simple example that actually works (I found videos &#8211; who writes a text tutorial in a video? &#8211; and a broken webpage, but I never found a working sim). So, I made one&#8230; and after a few false starts I got it to work. Not bad for an evening at home!</p>
<p>To try my demo out, simply <a href="http://www.falatic.com/wp-content/uploads/2013/01/LTspice_memristor_sim_v1.00.zip">click here to download my LTspice-based memristor simulation</a> and follow the instructions in the README.txt file for how to install and use it.</p>
<p>And to reiterate, this is a demo based on the SPICE model of a memristor as described in one paper&#8230; this is for educational purposes only and no, I can&#8217;t help you with your homework. <img src='http://www.falatic.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':-D' class='wp-smiley' /> </p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F69%2Fmemristor-simulation-with-ltspice-a-practical-example&amp;title=Memristor%20simulation%20with%20LTspice%20%E2%80%93%20a%20practical%20example%21" id="wpa2a_10"><img src="http://www.falatic.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.falatic.com/index.php/69/memristor-simulation-with-ltspice-a-practical-example/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Exporting passwords from multiple Chrome profiles (to LastPass, ChromePass, et. al.)</title>
		<link>http://www.falatic.com/index.php/59/exporting-passwords-from-multiple-chrome-profiles</link>
		<comments>http://www.falatic.com/index.php/59/exporting-passwords-from-multiple-chrome-profiles#comments</comments>
		<pubDate>Mon, 16 Jul 2012 02:57:22 +0000</pubDate>
		<dc:creator>Martin Falatic</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://www.falatic.com/?p=59</guid>
		<description><![CDATA[Update 1 at the end. Note: this post applies to multiple utilities with this use case, such as NirSoft&#8217;s ChromePass and LastPass. This also applies only to Windows (though it may have similarities to workarounds for other OSes). Finally, BEWARE: this involves carefully &#8230; <a class="more-link" href="http://www.falatic.com/index.php/59/exporting-passwords-from-multiple-chrome-profiles">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p><strong>Update 1 at the end.</strong></p>
<p><strong>Note: this post applies to multiple utilities with this use case, such as <a href="http://www.nirsoft.net/utils/chromepass.html" target="_blank">NirSoft&#8217;s ChromePass</a> and <a href="https://lastpass.com/" target="_blank">LastPass</a>. This also applies only to Windows (though it may have similarities to workarounds for other OSes). Finally, <span style="color: #800000;">BEWARE: this involves carefully fiddling with some folder names. There be dragons!</span></strong></p>
<p>So, I recently decided to look at better password solutions than what the various browsers afford. I looked at <a href="http://keepass.info/" target="_blank">KeePass</a>, <a href="http://www.roboform.com/" target="_blank">RoboForm</a> and <a href="https://lastpass.com/" target="_blank">LastPass</a>. Your mileage may vary, but for now I&#8217;m trying out LastPass.</p>
<p>In the course of this I stumbled on the fact that it&#8217;s surprisingly cumbersome to import passwords from Chrome (a browser I&#8217;ve come to like but which is at times cryptic). I ended up  turning to <a href="http://www.nirsoft.net/utils/chromepass.html" target="_blank">NirSoft&#8217;s ChromePass</a> in an attempt to get the passwords exported from Chrome for later import. That failed, in the same way LastPass failed: it was happy to import one set of passwords only, no matter which Chrome profile was active. <strong>Note that the Windows login is the SAME in each case, thus there are multiple Chrome profiles visible at once.</strong></p>
<p>Turns out, the only profile ChromePass, LastPass and others ever refer to for password data is:<br />
<em>C:\Users\%USERNAME%\AppData\Local\Google\Chrome\User Data\Default</em></p>
<p>If you have multiple profiles you&#8217;ve used under this Windows login, you will have folders such as:<br />
<em>C:\Users\%USERNAME%\AppData\Local\Google\Chrome\User Data\Default<br />
</em><em>C:\Users\%USERNAME%\AppData\Local\Google\Chrome\User Data\Profile 1<br />
</em><em>C:\Users\%USERNAME%\AppData\Local\Google\Chrome\User Data\Profile 2<br />
</em><em>etc.</em></p>
<p>However, if you&#8217;ve removed and re-added profiles you may not even HAVE a profile folder called &#8220;Default&#8221; here! (Resulting in an empty password list when you attempt to use LastPass or ChromePass to get to them.)</p>
<p>Thus, if your current Chrome login happens to be in that profile folder, you&#8217;ll get the info from that, but if you have another Chrome login (or for other reasons no longer have the Default profile folder) you&#8217;d be outta luck &#8211; until now.</p>
<p>What to do? It&#8217;s surprisingly simple! If what you see when importing or exporting passwords is NOT what you expect to see (that is, you are seeing the Default profile only), do this:</p>
<ul>
<li><strong>Close Chrome (clear your cache first &#8211; always a good idea)</strong></li>
<li><strong>Temporarily rename the profile of interest to &#8220;Default&#8221; by renaming its folder accordingly (i</strong><strong>f Default already exists, rename it to something else temporarily before doing this). You may exercise some trial and error for multiple profiles.</strong></li>
<li><strong>Now, do what you need to do &#8211; whatever profile is in a folder called &#8220;Default&#8221; is the one that&#8217;ll open up in your utility/plugin. You can open Chrome and import passwords to LastPass, leave Chrome closed and use ChromePass to dump your passwords, etc.</strong></li>
<li><strong>Done? Close Chrome!</strong></li>
<li><strong>Rename the folders back to the way they were</strong></li>
</ul>
<p><strong><span style="color: #800000;">Again, BE CAREFUL!</span></strong><span style="color: #000000;"> Would that it be simpler, but at least it works. Hope you find this helpful! <img src='http://www.falatic.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </span></p>
<p>PS: When importing passwords to LastPass from Firefox or Chrome do be careful: I&#8217;ve already run into cases where not all passwords get imported. It&#8217;s a bit of a pain, but it should be worth the benefit of being better organized.</p>
<p>UPDATE 1: While this worked for ChromePass, <strong>LastPass (as a browser extension) can be a little more tricky: after renaming the Default profile (if necessary), COPY the profile of interest to a folder named &#8221;Default&#8221;. THEN open Chrome, do your import to LastPass, close Chrome, and remove the copy you made.</strong><strong> </strong></p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F59%2Fexporting-passwords-from-multiple-chrome-profiles&amp;title=Exporting%20passwords%20from%20multiple%20Chrome%20profiles%20%28to%20LastPass%2C%20ChromePass%2C%20et.%20al.%29" id="wpa2a_12"><img src="http://www.falatic.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.falatic.com/index.php/59/exporting-passwords-from-multiple-chrome-profiles/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Elementary! MySQL did it, in the CPU, with the the leap second!</title>
		<link>http://www.falatic.com/index.php/56/elementary-mysql-did-it-in-the-cpu-with-the-the-leap-second</link>
		<comments>http://www.falatic.com/index.php/56/elementary-mysql-did-it-in-the-cpu-with-the-the-leap-second#comments</comments>
		<pubDate>Sun, 01 Jul 2012 18:10:54 +0000</pubDate>
		<dc:creator>Martin Falatic</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.falatic.com/?p=56</guid>
		<description><![CDATA[I awoke to an alert from a small Ubuntu 12.04 server I have on Linode: lots of CPU usage this morning,which is odd since I haven&#8217;t logged in for a while. Hmm. Looked at the CPU graph first, and the &#8230; <a class="more-link" href="http://www.falatic.com/index.php/56/elementary-mysql-did-it-in-the-cpu-with-the-the-leap-second">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>I awoke to an alert from a small Ubuntu 12.04 server I have on <a href="http://www.linode.com/" target="_blank">Linode</a>: lots of CPU usage this morning,which is odd since I haven&#8217;t logged in for a while. Hmm. Looked at the CPU graph first, and the high usage was all since exactly midnight. Hmm again.</p>
<p>So, I groggily log in and start looking around, and immediately see that MySQL is using LOTS of CPU all by its lonesome. I immediately wondered if somehow a hacker got in or something (given the <a href="https://community.rapid7.com/community/metasploit/blog/2012/06/11/cve-2012-2122-a-tragically-comedic-security-flaw-in-mysql" target="_blank">recently reported MySQL bug</a>) so I went to look for some hints on investigating that. On a whim (remembering the odd timing of this) I searched Google for &#8220;mysqld went to 90% cpu at midnight&#8221;. Sure enough, it&#8217;s probably a bug.</p>
<p>Turns out, this weekend sports a rare &#8220;<a href="http://phys.org/news/2012-06-added.html" target="_blank">leap second</a>&#8220;&#8230; and that triggers a kernel bug which in turn causes MySQL to start eating CPU like a bad gambler at a casino buffet.</p>
<p>I found the following suggestion (found <a href="http://www.sheeri.com/content/mysql-and-leap-second-high-cpu-and-fix" target="_blank">here</a> and <a href="http://blog.mozilla.org/it/2012/06/30/mysql-and-the-leap-second-high-cpu-and-the-fix/" target="_blank">here</a>) worked well enough for me on its own (fingers crossed anyway):</p>
<pre>sudo date -s "`date`"  # &lt;-- Mind the backticks!</pre>
<p>I ran that and the problem immediately disappeared. I didn&#8217;t need to reboot or restart mysqld (rebooting would also fix it apparently, but restarting mysqld would not).</p>
<p>Hopefully this bit of advice serves you as well!</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F56%2Felementary-mysql-did-it-in-the-cpu-with-the-the-leap-second&amp;title=Elementary%21%20MySQL%20did%20it%2C%20in%20the%20CPU%2C%20with%20the%20the%20leap%20second%21" id="wpa2a_14"><img src="http://www.falatic.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.falatic.com/index.php/56/elementary-mysql-did-it-in-the-cpu-with-the-the-leap-second/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Android, Eclipse, XML files and weird error messages</title>
		<link>http://www.falatic.com/index.php/55/android-eclipse-xml-files-and-weird-error-messages</link>
		<comments>http://www.falatic.com/index.php/55/android-eclipse-xml-files-and-weird-error-messages#comments</comments>
		<pubDate>Wed, 29 Feb 2012 09:30:09 +0000</pubDate>
		<dc:creator>Martin Falatic</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.falatic.com/?p=55</guid>
		<description><![CDATA[More than once, I&#8217;ve gotten the following weird problem when looking at an XML layout for Android in Eclipse: Failed to parse file C:\Eclipse_workspace\ButtonTest2\res\drawable\arrow_1.xml Exception details are logged in Window &#62; Show View &#62; Error Log The error itself isn&#8217;t &#8230; <a class="more-link" href="http://www.falatic.com/index.php/55/android-eclipse-xml-files-and-weird-error-messages">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>More than once, I&#8217;ve gotten the following weird problem when looking at an XML layout for Android in Eclipse:</p>
<blockquote><p>Failed to parse file C:\Eclipse_workspace\ButtonTest2\res\drawable\arrow_1.xml<br />
Exception details are logged in Window &gt; Show View &gt; Error Log</p></blockquote>
<p>The error itself isn&#8217;t exactly informative, and certainly doesn&#8217;t make sense:</p>
<blockquote><p>org.xmlpull.v1.XmlPullParserException: PI must not start with xml (position:unknown @1:5 in java.io.InputStreamReader@1c167686)<br />
at org.kxml2.io.KXmlParser.exception(Unknown Source)<br />
&#8230;&#8230;.</p></blockquote>
<p>Hmm. XML files should start with an appropriate declaration line, yet this says my XML file shouldn&#8217;t have it. <a href="http://media.tumblr.com/tumblr_lv3b95UzuK1r2xg26.jpg" target="_blank">That&#8217;s&#8230; weird.</a> Normally I just remove the line til it stops complaining but as I&#8217;m playing with the second pre-release of r17 android SDK (some key components have been broken lately) and feeling bold I decided to understand this once and for all. What follows is the text of my answer <a href="http://stackoverflow.com/a/9496265/760905">on StackOverflow</a> earlier tonight:</p>
<hr />
<p>I&#8217;ve beaten my head against this wall a few times and now I have the answer (I *hate* mysterious behavior, especially when it seems to be random).</p>
<p>I just ran a 4-way test (Unix and DOS, with and without the binary &#8220;EF BB BF&#8221; BOM header/signature). <strong>I found that Eclipse does not put a binary BOM header into XML files it creates, period.</strong> If you add a file that has the `&#8221;&lt;?xml &#8230; ?&gt;&#8221;` declaration header, it works correctly ONLY if that binary signature is ABSENT. (Whether EOLs are Unix or DOS doesn&#8217;t matter). If you have *both* forms of header you get this problem. You can have one, the other, or neither, but never both.</p>
<p>So, if you create a new XML file in Eclipse you can expect (in 3.6 &#8211; 3.7.1 anyway) that it has no binary BOM header and you should properly put a `&#8221;&lt;?xml &#8230; ?&gt;&#8221;` declaration header in there to identify it as Unicode. If you IMPORT a project that has files with binary BOM header signatures or use an external editor that likes to add them, that&#8217;s where all this fun begins.</p>
<p><strong>Ideally, ensure XML files with declaration don&#8217;t have binary BOM header before importing them&#8230; otherwise, remove that `&#8221;&lt;?xml &#8230; ?&gt;&#8221;` declaration header whenever Eclipse complains&#8230; short of removing the binary header that&#8217;s all you can readily do.</strong> (It&#8217;d be nice if Eclipse handled this more consistently&#8230; or at least gave you a way to identify and fix the problem readily by removing the binary BOM header&#8230;)</p>
<p>* <em>If in doubt, examine the file with an external hex editor, preferably one that is NOT Unicode-aware (<a href="http://www.x-ways.net/winhex/" target="_blank">WinHex</a> worked for me, YMMV). Some text/hex editors will auto-detect Unicode and may auto-add a header when the file didn&#8217;t really have one.</em></p>
<hr />
<p>Postscript: I use <a href="http://www.ultraedit.com/" target="_blank">IDM&#8217;s UltraEdit / UltraCompare</a> primarily. They work great but they&#8217;re a little <em>too</em> good at determining if a file is Unicode or not, to the point where these four text files ALL had the binary BOM header in hex mode!! <a href="http://www.x-ways.net/winhex/" target="_blank">WinHex</a> showed the exact situation, and indeed only two of the files actually had that header. However, I&#8217;d like my regular editor to work correctly. Time to write IDM an email&#8230;</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F55%2Fandroid-eclipse-xml-files-and-weird-error-messages&amp;title=Android%2C%20Eclipse%2C%20XML%20files%20and%20weird%20error%20messages" id="wpa2a_16"><img src="http://www.falatic.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.falatic.com/index.php/55/android-eclipse-xml-files-and-weird-error-messages/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Thoughts on mobile app crash detection and recovery</title>
		<link>http://www.falatic.com/index.php/51/thoughts-on-mobile-app-crash-detection-and-recovery</link>
		<comments>http://www.falatic.com/index.php/51/thoughts-on-mobile-app-crash-detection-and-recovery#comments</comments>
		<pubDate>Thu, 20 Oct 2011 05:26:54 +0000</pubDate>
		<dc:creator>Martin Falatic</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[crash]]></category>
		<category><![CDATA[quality]]></category>
		<category><![CDATA[recovery]]></category>

		<guid isPermaLink="false">http://www.falatic.com/?p=51</guid>
		<description><![CDATA[As I work on updates to my app, I&#8217;m happy to see it&#8217;s working quite well. However, inevitably there will be some boundary case that causes an exception, and as I add features (and more importantly, persistent settings) an addition &#8230; <a class="more-link" href="http://www.falatic.com/index.php/51/thoughts-on-mobile-app-crash-detection-and-recovery">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p style="text-align: left;">As I work on updates to my app, I&#8217;m happy to see it&#8217;s working quite well. However, inevitably there will be some boundary case that causes an exception, and as I add features (and more importantly, persistent settings) an addition risk comes into play: failed restarts after a crash.</p>
<p><span id="more-51"></span><br />
Unlike a desktop app, where one could add a &#8220;safe mode&#8221; icon for such instances, there are few options in the mobile space. These include:</p>
<ul>
<li>Letting the user delete the application data manually via the Settings menu</li>
<li>Automatically resetting to defaults after a crash</li>
<li>Attempting to automatically work around the broken area</li>
<li>Asking the user on restart if they want to reset to defaults</li>
<li>Falling back to the last known-good configuration</li>
</ul>
<p>It&#8217;s one thing to <em>be</em> a power user, but another to be <em>forced</em> to become one thus the first option isn&#8217;t really practical. The second option guarantees recovery but may degrade the user experience (especially if there are lots of settings involved)&#8230; it should be a last resort, and a user choice. The third option is nice, but can become quite complex: this works best if settings are checkpointed frequently, but such frequent saves to flash memory are not usually a great idea. In addition, the more complex the fail-safe, the more likely it may cause a triggering exception.</p>
<p>Asking the user first is an important part of any solution, but it requires architecting a fail-safe startup sequence (one that is preference invariant). One can then offer the choice of a &#8220;fresh start&#8221; or the option of using a backed-up configuration, ensuring that the user has at least a chance of restoring to a previously working state with their settings intact.</p>
<p>A useful pattern for a single-instance app would be the following, using a persistent <em>IsRunning</em> flag:</p>
<ul>
<li>App launches</li>
<li>Load settings</li>
<li>Check if the <em> IsRunning</em> flag is set: if it is, then the last run exited abnormally (none of the normal exit points were hit which would&#8217;ve cleared the flag):</li>
<ul>
<li>Clear the <em>IsRunning</em> flag</li>
<li>Offer to restore from backup / defaults or attempt to continue as-is</li>
</ul>
<li>Initialize states and display initial UI presentation</li>
<li>Save the current settings with a backup name</li>
<li>Set the <em>IsRunning</em> flag</li>
<li>Save the settings normally</li>
<li>On normal app exit / backgrounding, clear the <em>IsRunning</em> flag and save settings normally</li>
</ul>
<p>There are other things you can do, including instrumenting for crash data collection and presenting the user an option to forward that data (anonymized!) to you for analysis.</p>
<p><strong>Software quality is as much about how well you avoid defects in the first place as it is about how gracefully you recover from them!<sup>†</sup></strong> Mistakes happen, especially in apps with complex GUIs. Errors should be as rare as possible, but when errors occur it&#8217;s the unrecoverable ones that lead to lost users. Solid error handling and recovery goes a long way towards satisfied users who stick around for the release that irons out the bug they encountered and worked around</p>
<p><strong><sup>†</sup></strong><em>This is a critical difference between hardware and software quality, especially for smaller shops. If you ship a physically defective device, the typical recourse is a return for repair or replacement &#8211; a costly proposition in terms of logistics as well as reworked hardware / waste. The quality patterns for software and hardware have commonalities but are generally quite different in practice: in general, hardware is by its very nature </em>far<em> more costly and less forgiving of quality failures. This is why popular hardware quality initiatives tend to translate poorly to the software space.</em></p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F51%2Fthoughts-on-mobile-app-crash-detection-and-recovery&amp;title=Thoughts%20on%20mobile%20app%20crash%20detection%20and%20recovery" id="wpa2a_18"><img src="http://www.falatic.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.falatic.com/index.php/51/thoughts-on-mobile-app-crash-detection-and-recovery/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Android, Honeycomb and the missing menu button&#8230;</title>
		<link>http://www.falatic.com/index.php/48/android-honeycomb-and-the-missing-menu-button</link>
		<comments>http://www.falatic.com/index.php/48/android-honeycomb-and-the-missing-menu-button#comments</comments>
		<pubDate>Wed, 12 Oct 2011 15:59:01 +0000</pubDate>
		<dc:creator>Martin Falatic</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[action bar]]></category>
		<category><![CDATA[Honeycomb]]></category>
		<category><![CDATA[menu]]></category>

		<guid isPermaLink="false">http://www.falatic.com/?p=48</guid>
		<description><![CDATA[I&#8217;ve been giving some thought to the loss of the menu button (replaced &#8211; in a way &#8211; by the action bar) in Honeycomb lately and I have to say it&#8217;s a damned peculiar choice. The argument is that by &#8230; <a class="more-link" href="http://www.falatic.com/index.php/48/android-honeycomb-and-the-missing-menu-button">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>I&#8217;ve been giving some thought to the loss of the menu button (replaced &#8211; in a way &#8211; by the action bar) in Honeycomb lately and I have to say it&#8217;s a damned peculiar choice. The argument is that by unifying the UI on Honeycomb fragmentation will be reduced, but for full-screen apps, taking away the menu button on API 11+ builds, from the region of the screen that cannot be hidden, <em>fosters</em> UI fragmentation.</p>
<p><span id="more-48"></span></p>
<p>Consider apps that are meant to be full-screen, and may be deeply interactive (such as a game). Having the action bar onscreen is not tenable, so one hides it. Whereas before you could use the menu button in the gutter (where &#8220;home&#8221; and &#8220;back&#8221; reside and indeed where &#8220;menu&#8221; appears &#8211; only for legacy apps), now you must either code your own button or invent a unique (<em>but intuitive!</em>) gesture to accomplish the end result of opening a custom menu or showing the action bar. If that&#8217;s not UI fragmentation I don&#8217;t know what is!</p>
<p>Though I find the action bar awkwardly placed and non-intuitive for in-app interactions, I understand the merit of having a unified UI. What I find fault with is the shortsighted decision to effectively remove an important <em>hard</em> button from Android (does <em>anyone</em> miss the &#8220;search&#8221; button?)</p>
<p>Now we have only two guaranteed (not hideable) buttons left, for the purpose of app navigation: &#8220;back&#8221; and &#8220;home&#8221; &#8211; along with a third new button for fast task switching (which is a little redundant&#8230; long-press on the home button could easily have the same effect without adding buttons). In addition (and likely for the foreseeable future) we have a &#8220;menu&#8221; button that only appears for legacy apps (thus that space in the toolbar is already &#8220;reserved&#8221; and will remain so for quite some time).</p>
<p>It&#8217;s too bad&#8230; there&#8217;s a strong argument for always having a &#8220;menu&#8221; button handy in an always-visible place. Maybe it unhides your action bar, or maybe it opens a custom menu, but removing it doesn&#8217;t help matters: it simply encourages a new kind of fragmentation for apps that don&#8217;t need an action bar onscreen normally. Now, instead of having a consistent way to perform that &#8220;open menu&#8221; action everyone gets to do it their own way (or leave the action bar open full-time, which significantly detracts from some apps).</p>
<p>One of many things that I <em>like</em> about Android is that the basic controls (home, menu, back) are intuitive and reasonable, balancing function with minimalism. Contrast this with the one overloaded hard button in another popular OS: much like a one-button mouse, oversimplification leads to confusion, reduced functionality and a fragmented UI as everyone works around the limitation differently according to their app&#8217;s design.</p>
<p><strong>The rationale for taking away the menu button &#8211; one of the three main &#8220;always-visible&#8221; navigation and control buttons for Android up to now &#8211; defies logic: it fails at reducing fragmentation and funnels developers (and thus users) into an awkward, one-size-fits-all paradigm that is the antithesis of Android. This loss of a &#8220;hard&#8221; menu button is an unwelcome reduction in basic functionality in an apparent nod to the oversimplification of other OSes. I don&#8217;t find fault with the existence of the action bar, but removing the dedicated menu button from the always-visible area of the screen was IMHO extremely shortsighted. Now, instead of having a convenient way to reveal a hidden action bar, one must figure out how to do this for each app that normally hides its action bar. All this for the sake of removing a button that appears anyway for legacy apps.<br />
</strong></p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F48%2Fandroid-honeycomb-and-the-missing-menu-button&amp;title=Android%2C%20Honeycomb%20and%20the%20missing%20menu%20button%E2%80%A6" id="wpa2a_20"><img src="http://www.falatic.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.falatic.com/index.php/48/android-honeycomb-and-the-missing-menu-button/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Building the Android emulator for Windows</title>
		<link>http://www.falatic.com/index.php/43/building-the-android-emulator-for-windows</link>
		<comments>http://www.falatic.com/index.php/43/building-the-android-emulator-for-windows#comments</comments>
		<pubDate>Sun, 25 Sep 2011 10:23:13 +0000</pubDate>
		<dc:creator>Martin Falatic</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[build]]></category>
		<category><![CDATA[Cygwin]]></category>
		<category><![CDATA[emulator]]></category>
		<category><![CDATA[Git]]></category>
		<category><![CDATA[MinGW]]></category>
		<category><![CDATA[qemu]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://www.falatic.com/?p=43</guid>
		<description><![CDATA[Today I&#8217;ve been investigating an argument parsing bug in Android&#8217;s emulator on Windows (a bug that may affect all platforms). The version I&#8217;m seeing the bug was in the Android SDK r12 version of the emulator [Yep, r13's out - &#8230; <a class="more-link" href="http://www.falatic.com/index.php/43/building-the-android-emulator-for-windows">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>Today I&#8217;ve been investigating an argument parsing bug in Android&#8217;s emulator on Windows (a bug that <em>may</em> affect all platforms). The version I&#8217;m seeing the bug was in the Android SDK r12 version of the emulator [Yep, r13's out - see note below.]</p>
<p>As part of this, I needed to rebuild the emulator. It was not as straightforward as I&#8217;d hoped so I decided to write up a little howto here in case others decide to try rebuilding it on Windows. It&#8217;s really not hard at all once you install a few prerequisites! [Note: You'll also find info here about building this via Linux.]</p>
<p><span id="more-43"></span></p>
<p><em>[<strong>Edit:</strong> As of this post the HEAD is 6e2f62...599648 <em>for platform_external_qemu</em>. While this post-r12 work WILL build in Windows with these procedures, I just found out that the older r12 code (tagged as </em>android-sdk-tools_r12<em>) will NOT build in Windows! You'd need to do r12-based builds in Linux with MinGW installed. It's interesting to see just how much was fixed since SDK r12... including, evidently, the very issue I discovered today! <del>Hopefully SDK r13 gets released soon.</del> Oh look, it's out! Interestingly, unlike r12 there is no corresponding r13 tag for this one... which is part of why I didn't notice it in the Git log (I saw the tools_r13 branch though there are lots of changes after that).]</em></p>
<p><span style="text-decoration: underline;"><strong>Note:</strong></span> If you choose other install dirs, adjust the values below accordingly!</p>
<p><strong>Install Python 2.6 or 2.7:</strong></p>
<ul>
<li>I used ActivePython 2.7.2.5 x64 (x86 should be equally good)</li>
<li>Download: <a href="http://www.activestate.com/activepython/downloads" target="_blank">http://www.activestate.com/activepython/downloads</a></li>
<li>Default bin dir for Python = C:\Python27</li>
</ul>
<p><strong>Install MinGW (it includes msys now):</strong></p>
<ul>
<li>Information: <a href="http://www.mingw.org/wiki/MinGW" target="_blank">http://www.mingw.org/wiki/MinGW</a></li>
<li>Download: <a href="http://sourceforge.net/projects/mingw/" target="_blank">http://sourceforge.net/projects/mingw/</a></li>
<li>Default bin dir for MinGW = C:\MinGW\bin</li>
<li>Default bin dir for msys = C:\MinGW\msys\1.0\bin</li>
</ul>
<p><strong>Install Git:</strong> I use <em>msysgit</em> because I also use (and happily recommend!) <a href="http://code.google.com/p/tortoisegit/" target="_blank">TortoiseGit 1.7.3.0</a>:</p>
<ul>
<li>Information: <a href="http://code.google.com/p/msysgit/" target="_blank">http://code.google.com/p/msysgit/</a></li>
<li>Download: <a href="http://code.google.com/p/msysgit/downloads/list" target="_blank">http://code.google.com/p/msysgit/downloads/list</a></li>
<ul>
<li>Git-1.7.4-preview20110204.exe works, 1.7.6 may as well</li>
</ul>
<li>Default bin dir for Git = C:\Git\bin</li>
</ul>
<p><strong>Open a command prompt and ensure your path is set correctly (omit duplicates as necessary, but ensure such entries weren&#8217;t eclipsed by other things you&#8217;ve installed, like Cygwin):</strong></p>
<pre class="brush: bash; light: true; title: ; notranslate">
set PATH=C:\MinGW\msys\1.0\bin;C:\MinGW\bin;C:\Python27;C:\Git\bin;%PATH%
</pre>
<p><strong>Clone the repository! (Because of the kernel.org outage we&#8217;re using <a href="https://github.com/android/platform_external_qemu" target="_blank">the github mirror</a>):</strong></p>
<pre class="brush: bash; light: true; title: ; notranslate">
mkdir H:\temp_repo
cd /D H:\temp_repo
git clone https://github.com/android/platform_external_qemu.git
</pre>
<p><strong>Start bash in the folder with the emulator sources (from this point on commands run at the bash prompt):</strong></p>
<pre class="brush: bash; light: true; title: ; notranslate">
cd /D H:\temp_repo\platform_external_qemu
bash
</pre>
<p><strong>Setting PS1 makes the prompt more verbose than the default <em>&#8220;bash-3.1$&#8221;</em> prompt:</strong></p>
<pre class="brush: bash; light: true; title: ; notranslate">
PS1='\[\e]0;\w\a\]\n\[\e[36m\]\u@\h \[\e[32m\]\w\[\e[0m\]\n\$ '
</pre>
<p><strong>There&#8217;s a small problem if you want the version string in the emulator to be fully formed:</strong></p>
<ul>
<li>In <em>Makefile.common</em>, ANDROID_BUILD_ID get set <em>only</em> if <em>BUILD_STANDALONE_EMULATOR == &#8220;&#8221;</em> &#8211; never if <em>BUILD_STANDALONE_EMULATOR == &#8216;true&#8217;</em> (which is what we&#8217;re building here). Here&#8217;s a fix for that, at least for the 13.x line of the emulator (line numbers may vary!):</li>
<ul>
<li>Broken: line 66: <em>ifeq ($(BUILD_STANDALONE_EMULATOR),)</em></li>
<li>Patched: line 66: <em>ifneq ($(BUILD_STANDALONE_EMULATOR),false)</em></li>
</ul>
<li><strong>If in doubt, ignore this tweak</strong>! Understand your -version output will not be very informative. That can quickly get annoying if you are building multiple versions&#8230;</li>
</ul>
<p><strong>Set some variables and run the build:</strong></p>
<pre class="brush: bash; light: true; title: ; notranslate">
# Customize this as desired
export ANDROID_SDK_TOOLS_REVISION=42
export ANDROID_BUILD_ID=custom

# Inserts your username and the timestamp in the build name
export MY_BUILD_TIMESTAMP=`date +%Y%m%d_%H%M%S`
export BUILD_ID=${USERNAME}
export BUILD_NUMBER=${MY_BUILD_TIMESTAMP}

# Executes the build
./android-rebuild.sh --static 2&gt;&amp;1 | \
   tee build_${USERNAME}-${MY_BUILD_TIMESTAMP}.log
</pre>
<p><strong>Check the version string of the emulator you just built:</strong></p>
<ul>
<li>Run this:</li>
<ul>
<li><em>objs/emulator.exe -version</em></li>
</ul>
<li>See output like this:</li>
<ul>
<li>Android emulator version 13.0 (build_id Marty-20110925_042430)</li>
</ul>
</ul>
<p><strong>Using the newly-built emulator:</strong></p>
<ul>
<li><strong></strong>The objects of interest in objs are:<em></em></li>
<ul>
<li><em>emulator.exe</em>, <em>emulator-arm.exe, </em><em>emulator-x86.exe</em></li>
</ul>
<li>You may need to copy them to <em>android-sdk-windows/tools</em> folder to use them (<strong>back up the originals first before replacing them!</strong>)</li>
</ul>
<p><strong>Notes on building via Linux:</strong></p>
<p style="padding-left: 30px;">As mentioned above, I managed to get all this to work on Windows just fine&#8230; technically, no source edits are necessary at this point to make it work. However, when I switched to the <em>android-sdk-tools_r12</em> tag it failed with:<em></em></p>
<p style="padding-left: 60px;"><em>cc1: error: unrecognized command line option &#8220;-mno-cygwin&#8221;</em></p>
<p style="padding-left: 30px;">Turns out this is a <a href="http://code.google.com/p/android/issues/detail?id=18949" target="_blank">known issue</a>&#8230; and in fact it was fixed in a later commit to the emulator code base! (I saw it as I was browsing the overall delta between r12 and the latest.) But, even with that fixed I couldn&#8217;t get r12 to build within Windows, so I went to Linux. I was already configured to build CyanogenMod, so everything was in place except MinGW. I installed <em>mingw32</em>, made that one fix to <em>android-rebuild.sh</em> and ran:</p>
<p style="padding-left: 60px;">./android-rebuild.sh &#8211;static &#8211;mingw</p>
<p style="padding-left: 30px;">And it worked just fine!</p>
<p style="padding-left: 30px;">(<strong>Note:</strong> the &#8211;mingw option is NOT used when building this within Windows&#8230; it&#8217;s a little confusing because of course we&#8217;re using MinGW <em>in</em> Windows, but that&#8217;s how it&#8217;s coded in their build system.)</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F43%2Fbuilding-the-android-emulator-for-windows&amp;title=Building%20the%20Android%20emulator%20for%20Windows" id="wpa2a_22"><img src="http://www.falatic.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.falatic.com/index.php/43/building-the-android-emulator-for-windows/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Windows: hybrid sleep and hibernation</title>
		<link>http://www.falatic.com/index.php/42/windows-hybrid-sleep-and-hibernation</link>
		<comments>http://www.falatic.com/index.php/42/windows-hybrid-sleep-and-hibernation#comments</comments>
		<pubDate>Thu, 08 Sep 2011 18:30:09 +0000</pubDate>
		<dc:creator>Martin Falatic</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[both]]></category>
		<category><![CDATA[hibernate]]></category>
		<category><![CDATA[hybrid sleep]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://www.falatic.com/?p=42</guid>
		<description><![CDATA[With the latest Windows (Vista and 7) you can select &#8220;Hybrid Sleep&#8221; as a suspend mode. In essence, it provides the fast restart of your usual sleep mode with the durability of hibernation: it writes the system state to disk &#8230; <a class="more-link" href="http://www.falatic.com/index.php/42/windows-hybrid-sleep-and-hibernation">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>With the latest Windows (Vista and 7) you can select &#8220;Hybrid Sleep&#8221; as a suspend mode. In essence, it provides the fast restart of your usual sleep mode with the durability of hibernation: it writes the system state to disk like hibernate, but if the system is &#8220;warm&#8221; (versus powered off) it&#8217;ll use the data in memory when coming out of sleep. If you power down during hybrid sleep (AFTER the data has been flushed to the hibernation file) the system will reboot on power up and will restore from disk.</p>
<p>This is all nice, but when you enable hybrid sleep you lose &#8220;hibernate&#8221; as a separate option. Perhaps this is to avoid confusion (<strong>remember: </strong><em><strong>hybrid sleep performs hibernation as part of its process, it just doesn&#8217;t completely power down</strong></em>). However, there are times I&#8217;d rather have the system fully hibernate instead of just sleeping (such as if I&#8217;m going to be away a few days). Since touching the power button once it&#8217;s in full hybrid sleep often re-awakens my system (and I don&#8217;t prefer to power down directly from any sleep state), I wanted a one-click solution.</p>
<p><strong>So, </strong><strong>if you use hybrid sleep and want to explicitly hibernate, run this (even as a regular user) and your system should hibernate rather than just enter hybrid sleep:</strong></p>
<pre>%windir%\system32\rundll32.exe PowrProf.dll, SetSuspendState 0,1,0</pre>
<p>This should also work if you DON&#8217;T use hybrid sleep and DO have the hibernation option&#8230; though if you have &#8220;hibernate&#8221; as an option you&#8217;re probably not looking for this sort of fix.</p>
<p>Disclaimers: If hibernation or hybrid sleep didn&#8217;t work before this won&#8217;t <em>make</em> hibernation work (e.g., if you have insufficient disk space or have explicitly disabled hibernation and hybrid sleep)&#8230; in that case this will likely send you into the typical sleep mode. You can usually tell the difference by noting the lengthy time spend writing data to the disk, followed by a clear power off. (Hybrid sleep does the same, except it goes into sleep mode &#8211; how your computer shows this will vary).</p>
<p>More info <a href="http://www.technologyquestions.com/technology/windows-xp/208549-powrprof-dll-setsuspendstate-0-1-0-caused-hibernation.html" target="_blank">here</a>.</p>
<p>&nbsp;</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F42%2Fwindows-hybrid-sleep-and-hibernation&amp;title=Windows%3A%20hybrid%20sleep%20and%20hibernation" id="wpa2a_24"><img src="http://www.falatic.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.falatic.com/index.php/42/windows-hybrid-sleep-and-hibernation/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Pinging with Python</title>
		<link>http://www.falatic.com/index.php/39/pinging-with-python</link>
		<comments>http://www.falatic.com/index.php/39/pinging-with-python#comments</comments>
		<pubDate>Tue, 06 Sep 2011 13:47:16 +0000</pubDate>
		<dc:creator>Martin Falatic</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Cygwin]]></category>
		<category><![CDATA[ICMP]]></category>
		<category><![CDATA[IP]]></category>
		<category><![CDATA[ping]]></category>
		<category><![CDATA[Python 3]]></category>
		<category><![CDATA[Unix]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://www.falatic.com/?p=39</guid>
		<description><![CDATA[2011-10-12 update: Brought in more changes from Jens Diemer&#8217;s new repository for the Python 2 version of this project. 2011-09-12 update: The version here is for Python 3.x as described below. Jens Diemer posted an updated version of this to &#8230; <a class="more-link" href="http://www.falatic.com/index.php/39/pinging-with-python">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p><em>2011-10-12 update: Brought in more changes from <a href="https://github.com/jedie/python-ping" target="_blank">Jens Diemer&#8217;s new repository for the Python 2 version of this project</a>.<br />
</em></p>
<p><em>2011-09-12 update: The version here is for Python 3.x as described below. <a href="https://github.com/jedie/python-code-snippets/blob/master/CodeSnippets/ping.py" target="_blank">Jens Diemer posted an updated version of this to GitHub</a> with corrections. It&#8217;s mainly a backport of this script to Python 2.x along with some cosmetic changes (and yes, I do like delimiting functions and such with comment lines &#8211; it makes code blocks far easier to distinguish, even in indentation-intensive Python). He added a bugfix to handle SIGBREAK better, which I&#8217;ve pulled into the code below.<br />
</em></p>
<p>A while back, when I decided to learn Python, I looked into writing my own sort of ping utility with it. Then I learned just how ridiculously arduous it is to perform this seemingly-simple function (essentially, you have to be running as root in Unix (or Administrator in Windows) to accomplish this, and generally speaking running scripts like this as root is considered bad form). But it can be done&#8230;</p>
<p><span id="more-39"></span></p>
<p>This intrigued me as a pet project but I moved on to other things, eventually picking up Python along the way (I&#8217;ve focused on Python 3.x since the Unicode handling is FAR better than it is in 2.7, not to mention its other improvements).</p>
<p>Recently, I decided to revisit the &#8220;ping with Python&#8221; idea, and searched around to see if anyone else had tackled it. Sure enough, <a href="http://www.g-loaded.eu/2009/10/30/python-ping/" target="_blank">I found George Notaras&#8217; site</a> which has a very nice implementation in 2.x as well as a recent commenter who created a 3.x port. Only problem was, the HTML is mangled there so neither script worked. As I delved into it, I managed to get the scripts working, and then decided to go the extra mile and make some enhancements and improvements. Along the way I ended up getting the source for ping (via Cygwin) and building it from scratch as well (particularly to understand the checksum routine, and for other hints in general).</p>
<p>It was rather pleasing to not only get this working but to make it work far better in terms of functionality and robustness, all the while reinforcing and extending my understanding of Python.</p>
<p>Note: The original C source for &#8220;ping&#8221; can be found <a href="http://ping127001.com/pingpage.htm" target="_blank">here</a> (you&#8217;ll need to extract it from ping.shar). Or just search for ping.c&#8230; for example, I found an identical copy of ping.c <a href="http://ws.edu.isoc.org/materials/src/ping.c" target="_blank">here</a>.</p>
<pre class="brush: python; title: ; notranslate">
#!/usr/bin/env python
# -*- coding: utf-8 -*-
 
&quot;&quot;&quot;
    A pure python ping implementation using raw sockets.
 
    (This is Python 3 port of https://github.com/jedie/python-ping)
 
    Note that ICMP messages can only be sent from processes running as root
    (in Windows, you must run this script as 'Administrator').
 
    Derived from ping.c distributed in Linux's netkit. That code is
    copyright (c) 1989 by The Regents of the University of California.
    That code is in turn derived from code written by Mike Muuss of the
    US Army Ballistic Research Laboratory in December, 1983 and
    placed in the public domain. They have my thanks.
 
    Bugs are naturally mine. I'd be glad to hear about them. There are
    certainly word - size dependencies here.
 
    Copyright (c) Matthew Dixon Cowles, &lt;http://www.visi.com/~mdc/&gt;.
    Distributable under the terms of the GNU General Public License
    version 2. Provided with no warranties of any sort.
 
    Original Version from Matthew Dixon Cowles:
      -&gt; ftp://ftp.visi.com/users/mdc/ping.py
 
    Rewrite by Jens Diemer:
      -&gt; http://www.python-forum.de/post-69122.html#69122
 
    Rewrite by George Notaras:
      -&gt; http://www.g-loaded.eu/2009/10/30/python-ping/
 
    Enhancements by Martin Falatic:
      -&gt; http://www.falatic.com/index.php/39/pinging-with-python
 
    Revision history
    ~~~~~~~~~~~~~~~~
 
    October 12, 2011
    --------------
    Merged updates from the main project
      -&gt; https://github.com/jedie/python-ping
 
    September 12, 2011
    --------------
    Bugfixes + cleanup by Jens Diemer
    Tested with Ubuntu + Windows 7
 
    September 6, 2011
    --------------
    Cleanup by Martin Falatic. Restored lost comments and docs. Improved
    functionality: constant time between pings, internal times consistently
    use milliseconds. Clarified annotations (e.g., in the checksum routine).
    Using unsigned data in IP &amp; ICMP header pack/unpack unless otherwise
    necessary. Signal handling. Ping-style output formatting and stats.
 
    August 3, 2011
    --------------
    Ported to py3k by Zach Ware. Mostly done by 2to3; also minor changes to
    deal with bytes vs. string changes (no more ord() in checksum() because
    &gt;source_string&lt; is actually bytes, added .encode() to data in
    send_one_ping()).  That's about it.
 
    March 11, 2010
    --------------
    changes by Samuel Stauffer:
    - replaced time.clock with default_timer which is set to
      time.clock on windows and time.time on other systems.
 
    November 8, 2009
    ----------------
    Improved compatibility with GNU/Linux systems.
 
    Fixes by:
     * George Notaras -- http://www.g-loaded.eu
    Reported by:
     * Chris Hallman -- http://cdhallman.blogspot.com
 
    Changes in this release:
     - Re-use time.time() instead of time.clock(). The 2007 implementation
       worked only under Microsoft Windows. Failed on GNU/Linux.
       time.clock() behaves differently under the two OSes[1].
 
    [1] http://docs.python.org/library/time.html#time.clock
 
    May 30, 2007
    ------------
    little rewrite by Jens Diemer:
     -  change socket asterisk import to a normal import
     -  replace time.time() with time.clock()
     -  delete &quot;return None&quot; (or change to &quot;return&quot; only)
     -  in checksum() rename &quot;str&quot; to &quot;source_string&quot;
 
    December 4, 2000
    ----------------
    Changed the struct.pack() calls to pack the checksum and ID as
    unsigned. My thanks to Jerome Poincheval for the fix.
 
    November 22, 1997
    -----------------
    Initial hack. Doesn't do much, but rather than try to guess
    what features I (or others) will want in the future, I've only
    put in what I need now.
 
    December 16, 1997
    -----------------
    For some reason, the checksum bytes are in the wrong order when
    this is run under Solaris 2.X for SPARC but it works right under
    Linux x86. Since I don't know just what's wrong, I'll swap the
    bytes always and then do an htons().
 
    ===========================================================================
    IP header info from RFC791
      -&gt; http://tools.ietf.org/html/rfc791)
 
    0                   1                   2                   3
    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |Version|  IHL  |Type of Service|          Total Length         |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |         Identification        |Flags|      Fragment Offset    |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |  Time to Live |    Protocol   |         Header Checksum       |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |                       Source Address                          |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |                    Destination Address                        |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |                    Options                    |    Padding    |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 
    ===========================================================================
    ICMP Echo / Echo Reply Message header info from RFC792
      -&gt; http://tools.ietf.org/html/rfc792
 
        0                   1                   2                   3
        0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
        |     Type      |     Code      |          Checksum             |
        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
        |           Identifier          |        Sequence Number        |
        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
        |     Data ...
        +-+-+-+-+-
 
    ===========================================================================
    ICMP parameter info:
      -&gt; http://www.iana.org/assignments/icmp-parameters/icmp-parameters.xml
 
    ===========================================================================
    An example of ping's typical output:
 
    PING heise.de (193.99.144.80): 56 data bytes
    64 bytes from 193.99.144.80: icmp_seq=0 ttl=240 time=127 ms
    64 bytes from 193.99.144.80: icmp_seq=1 ttl=240 time=127 ms
    64 bytes from 193.99.144.80: icmp_seq=2 ttl=240 time=126 ms
    64 bytes from 193.99.144.80: icmp_seq=3 ttl=240 time=126 ms
    64 bytes from 193.99.144.80: icmp_seq=4 ttl=240 time=127 ms
 
    ----heise.de PING Statistics----
    5 packets transmitted, 5 packets received, 0.0% packet loss
    round-trip (ms)  min/avg/max/med = 126/127/127/127
 
    ===========================================================================
&quot;&quot;&quot;
 
#=============================================================================#
import os, sys, socket, struct, select, time, signal
 
if sys.platform == &quot;win32&quot;:
    # On Windows, the best timer is time.clock()
    default_timer = time.clock
else:
    # On most other platforms the best timer is time.time()
    default_timer = time.time
 
#=============================================================================#
# ICMP parameters
 
ICMP_ECHOREPLY  =    0 # Echo reply (per RFC792)
ICMP_ECHO       =    8 # Echo request (per RFC792)
ICMP_MAX_RECV   = 2048 # Max size of incoming buffer
 
MAX_SLEEP = 1000
 
class MyStats:
    thisIP   = &quot;0.0.0.0&quot;
    pktsSent = 0
    pktsRcvd = 0
    minTime  = 999999999
    maxTime  = 0
    totTime  = 0
    fracLoss = 1.0
 
myStats = MyStats # Used globally
 
#=============================================================================#
def checksum(source_string):
    &quot;&quot;&quot;
    A port of the functionality of in_cksum() from ping.c
    Ideally this would act on the string as a series of 16-bit ints (host
    packed), but this works.
    Network data is big-endian, hosts are typically little-endian
    &quot;&quot;&quot;
    countTo = (int(len(source_string)/2))*2
    sum = 0
    count = 0
 
    # Handle bytes in pairs (decoding as short ints)
    loByte = 0
    hiByte = 0
    while count &lt; countTo:
        if (sys.byteorder == &quot;little&quot;):
            loByte = source_string[count]
            hiByte = source_string[count + 1]
        else:
            loByte = source_string[count + 1]
            hiByte = source_string[count]
        sum = sum + (hiByte * 256 + loByte)
        count += 2
 
    # Handle last byte if applicable (odd-number of bytes)
    # Endianness should be irrelevant in this case
    if countTo &lt; len(source_string): # Check for odd length
        loByte = source_string[len(source_string)-1]
        sum += loByte
 
    sum &amp;= 0xffffffff # Truncate sum to 32 bits (a variance from ping.c, which
                      # uses signed ints, but overflow is unlikely in ping)
 
    sum = (sum &gt;&gt; 16) + (sum &amp; 0xffff)    # Add high 16 bits to low 16 bits
    sum += (sum &gt;&gt; 16)                    # Add carry from above (if any)
    answer = ~sum &amp; 0xffff              # Invert and truncate to 16 bits
    answer = socket.htons(answer)
 
    return answer
 
#=============================================================================#
def do_one(destIP, timeout, mySeqNumber, numDataBytes):
    &quot;&quot;&quot;
    Returns either the delay (in ms) or None on timeout.
    &quot;&quot;&quot;
    global myStats
 
    delay = None
 
    try: # One could use UDP here, but it's obscure
        mySocket = socket.socket(socket.AF_INET, socket.SOCK_RAW, socket.getprotobyname(&quot;icmp&quot;))
    except socket.error as e:
        print(&quot;failed. (socket error: '%s')&quot; % e.args[1])
        raise # raise the original error
 
    my_ID = os.getpid() &amp; 0xFFFF
 
    sentTime = send_one_ping(mySocket, destIP, my_ID, mySeqNumber, numDataBytes)
    if sentTime == None:
        mySocket.close()
        return delay
 
    myStats.pktsSent += 1;
 
    recvTime, dataSize, iphSrcIP, icmpSeqNumber, iphTTL = receive_one_ping(mySocket, my_ID, timeout)
 
    mySocket.close()
 
    if recvTime:
        delay = (recvTime-sentTime)*1000
        print(&quot;%d bytes from %s: icmp_seq=%d ttl=%d time=%d ms&quot; % (
            dataSize, socket.inet_ntoa(struct.pack(&quot;!I&quot;, iphSrcIP)), icmpSeqNumber, iphTTL, delay)
        )
        myStats.pktsRcvd += 1;
        myStats.totTime += delay
        if myStats.minTime &gt; delay:
            myStats.minTime = delay
        if myStats.maxTime &lt; delay:
            myStats.maxTime = delay
    else:
        delay = None
        print(&quot;Request timed out.&quot;)
 
    return delay
 
#=============================================================================#
def send_one_ping(mySocket, destIP, myID, mySeqNumber, numDataBytes):
    &quot;&quot;&quot;
    Send one ping to the given &gt;destIP&lt;.
    &quot;&quot;&quot;
    destIP  =  socket.gethostbyname(destIP)
 
    # Header is type (8), code (8), checksum (16), id (16), sequence (16)
    myChecksum = 0
 
    # Make a dummy heder with a 0 checksum.
    header = struct.pack(
        &quot;!BBHHH&quot;, ICMP_ECHO, 0, myChecksum, myID, mySeqNumber
    )
 
    padBytes = []
    startVal = 0x42
    for i in range(startVal, startVal + (numDataBytes)):
        padBytes += [(i &amp; 0xff)]  # Keep chars in the 0-255 range
    data = bytes(padBytes)
 
    # Calculate the checksum on the data and the dummy header.
    myChecksum = checksum(header + data) # Checksum is in network order
 
    # Now that we have the right checksum, we put that in. It's just easier
    # to make up a new header than to stuff it into the dummy.
    header = struct.pack(
        &quot;!BBHHH&quot;, ICMP_ECHO, 0, myChecksum, myID, mySeqNumber
    )
 
    packet = header + data
 
    sendTime = time.time()
 
    try:
        mySocket.sendto(packet, (destIP, 1)) # Port number is irrelevant for ICMP
    except socket.error as e:
        print(&quot;General failure (%s)&quot; % (e.args[1]))
        return
 
    return sendTime
 
#=============================================================================#
def receive_one_ping(mySocket, myID, timeout):
    &quot;&quot;&quot;
    Receive the ping from the socket. Timeout = in ms
    &quot;&quot;&quot;
    timeLeft = timeout/1000
 
    while True: # Loop while waiting for packet or timeout
        startedSelect = time.time()
        whatReady = select.select([mySocket], [], [], timeLeft)
        howLongInSelect = (time.time() - startedSelect)
        if whatReady[0] == []: # Timeout
            return None, 0, 0, 0, 0
 
        timeReceived = time.time()
 
        recPacket, addr = mySocket.recvfrom(ICMP_MAX_RECV)
 
        ipHeader = recPacket[:20]
        iphVersion, iphTypeOfSvc, iphLength, \
        iphID, iphFlags, iphTTL, iphProtocol, \
        iphChecksum, iphSrcIP, iphDestIP = struct.unpack(
            &quot;!BBHHHBBHII&quot;, ipHeader
        )
 
        icmpHeader = recPacket[20:28]
        icmpType, icmpCode, icmpChecksum, \
        icmpPacketID, icmpSeqNumber = struct.unpack(
            &quot;!BBHHH&quot;, icmpHeader
        )
 
        if icmpPacketID == myID: # Our packet
            dataSize = len(recPacket) - 28
            return timeReceived, dataSize, iphSrcIP, icmpSeqNumber, iphTTL
 
        timeLeft = timeLeft - howLongInSelect
        if timeLeft &lt;= 0:
            return None, 0, 0, 0, 0
 
#=============================================================================#
def dump_stats():
    &quot;&quot;&quot;
    Show stats when pings are done
    &quot;&quot;&quot;
    global myStats
 
    print(&quot;\n----%s PYTHON PING Statistics----&quot; % (myStats.thisIP))
 
    if myStats.pktsSent &gt; 0:
        myStats.fracLoss = (myStats.pktsSent - myStats.pktsRcvd)/myStats.pktsSent
 
    print(&quot;%d packets transmitted, %d packets received, %0.1f%% packet loss&quot; % (
        myStats.pktsSent, myStats.pktsRcvd, 100.0 * myStats.fracLoss
    ))
 
    if myStats.pktsRcvd &gt; 0:
        print(&quot;round-trip (ms)  min/avg/max = %d/%0.1f/%d&quot; % (
            myStats.minTime, myStats.totTime/myStats.pktsRcvd, myStats.maxTime
        ))
 
    print()
    return
 
#=============================================================================#
def signal_handler(signum, frame):
    &quot;&quot;&quot;
    Handle exit via signals
    &quot;&quot;&quot;
    dump_stats()
    print(&quot;\n(Terminated with signal %d)\n&quot; % (signum))
    sys.exit(0)
 
#=============================================================================#
def verbose_ping(hostname, timeout = 1000, count = 3, numDataBytes = 55):
    &quot;&quot;&quot;
    Send &gt;count&lt; ping to &gt;destIP&lt; with the given &gt;timeout&lt; and display
    the result.
    &quot;&quot;&quot;
    global myStats
 
    signal.signal(signal.SIGINT, signal_handler)   # Handle Ctrl-C
    if hasattr(signal, &quot;SIGBREAK&quot;):
        # Handle Ctrl-Break e.g. under Windows
        signal.signal(signal.SIGBREAK, signal_handler)
 
    myStats = MyStats() # Reset the stats
 
    mySeqNumber = 0 # Starting value
 
    try:
        destIP = socket.gethostbyname(hostname)
        print(&quot;\nPYTHON PING %s (%s): %d data bytes&quot; % (hostname, destIP, numDataBytes))
    except socket.gaierror as e:
        print(&quot;\nPYTHON PING: Unknown host: %s (%s)&quot; % (hostname, e.args[1]))
        print()
        return
 
    myStats.thisIP = destIP
 
    for i in range(count):
        delay = do_one(destIP, timeout, mySeqNumber, numDataBytes)
 
        if delay == None:
            delay = 0
 
        mySeqNumber += 1
 
        # Pause for the remainder of the MAX_SLEEP period (if applicable)
        if (MAX_SLEEP &gt; delay):
            time.sleep((MAX_SLEEP - delay)/1000)
 
    dump_stats()
 
#=============================================================================#
if __name__ == '__main__':
 
    # These should work:
    verbose_ping(&quot;heise.de&quot;)
    verbose_ping(&quot;google.com&quot;)
 
    # Inconsistent on Windows w/ ActivePython (Python 3.2 resolves correctly
    # to the local host, but 2.7 tries to resolve to the local *gateway*)
    verbose_ping(&quot;localhost&quot;)
 
    # Should fail with 'getaddrinfo failed':
    verbose_ping(&quot;foobar_url.foobar&quot;)
 
    # Should fail (timeout), but it depends on the local network:
    verbose_ping(&quot;192.168.255.254&quot;)
 
    # Should fails with 'The requested address is not valid in its context':
    verbose_ping(&quot;0.0.0.0&quot;)
 
#=============================================================================#

</pre>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F39%2Fpinging-with-python&amp;title=Pinging%20with%20Python" id="wpa2a_26"><img src="http://www.falatic.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.falatic.com/index.php/39/pinging-with-python/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>New (old?) Twitter password stealer making the rounds&#8230;</title>
		<link>http://www.falatic.com/index.php/36/new-old-twitter-password-stealer-making-the-rounds</link>
		<comments>http://www.falatic.com/index.php/36/new-old-twitter-password-stealer-making-the-rounds#comments</comments>
		<pubDate>Sun, 14 Aug 2011 04:35:16 +0000</pubDate>
		<dc:creator>Martin Falatic</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[scams]]></category>
		<category><![CDATA[securiity]]></category>
		<category><![CDATA[social networking]]></category>
		<category><![CDATA[Twitter]]></category>

		<guid isPermaLink="false">http://www.falatic.com/?p=36</guid>
		<description><![CDATA[If you click a Twitter link and it sends you to a Twitter login page, beware&#8230; look closely at the address bar and ensure you&#8217;re actually at Twitter&#8217;s login page and not a thieving imposter&#8217;s page! Recently a friend on &#8230; <a class="more-link" href="http://www.falatic.com/index.php/36/new-old-twitter-password-stealer-making-the-rounds">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p><strong>If you click a Twitter link and it sends you to a Twitter login page, beware&#8230; look closely at the address bar and ensure you&#8217;re actually at Twitter&#8217;s login page and not a thieving imposter&#8217;s page!</strong></p>
<p><strong></strong>Recently a friend on Twitter sent a link as part of a message:</p>
<p>&#8220;<em>Look! it&#8217;s you in this picture.. [along with a tinyurl link]</em>&#8221;</p>
<p>Other variants of this exist, such as &#8220;<em>you&#8217;ll laugh when you see this pic of you</em>&#8230; <em> [along with a tinyurl link]</em>&#8220;.</p>
<p>Turns out, my friend&#8217;s account had been hijacked. (Yes, it really was a friend&#8230; I&#8217;ve seen this before with Twitter and other sites but it looks identical to an attack I saw about a month ago).</p>
<p><span id="more-36"></span>In this case, the bogus link went to a subpage on <strong>itwittiler.com</strong> (IP address 220.164.140.252), a domain registered in China - earlier today! The page <em>looks</em> like Twitter&#8217;s login page but it&#8217;s not. In fact, I sandboxed it and entered a bogus username/password to see if it&#8217;d redirect to Twitter no matter what was entered. No&#8230; it redirected me to a &#8220;StalkTrak&#8221; page, clearly malformed and totally bogus. Read <a href="http://nakedsecurity.sophos.com/2011/08/12/twitter-finally-released-a-stalkers-app-no-its-a-phishing-scam/" target="_blank">this Sophos security article</a> for more info.</p>
<p>Another subpage (found via some searching online) does redirect to Twitter, but to a user who doesn&#8217;t exist. In all cases, the first page you go to looks just like the Twitter login page (there are some subtle yet sloppy differences, but next time there might not be.)</p>
<p><strong>It&#8217;s quite likely the page is harvesting credentials along the way. If you get stung, go to the real Twitter homepage and reset your password pronto (after closing your browser windows).</strong></p>
<p>More info on <strong>itwittiler.com</strong>, via <em>whois</em>:</p>
<p>Domain Name: ITWITTILER.COM<br />
Registrar: JIANGSU BANGNING SCIENCE &amp; TECHNOLOGY CO. LTD<br />
Whois Server: whois.55hl.com<br />
Referral URL: http://www.55hl.com<br />
Name Server: DNS5.4CUN.COM<br />
Name Server: DNS6.4CUN.COM<br />
Status: ok<br />
Updated Date: 13-aug-2011<br />
Creation Date: 13-aug-2011<br />
Expiration Date: 13-aug-2012</p>
<p><strong>Update:</strong> Another StalkTrak spam domain made the rounds last month: <strong>itiwitter.com</strong>. Surprise! It&#8217;s registered to the very same registrar! Judging by the same subpage structure I strongly suspect it&#8217;s the very same scammer using the very same site (or site structure)&#8230; while the IP address won&#8217;t resolve, it turns out <a href="http://www.priceofweb.com/www.itiwitter.com" target="_blank">this site&#8217;s for sale!</a> And the IP address when last they checked? 220.164.140.252. Isn&#8217;t that special?</p>
<p>Domain Name: ITIWITTER.COM<br />
Registrar: JIANGSU BANGNING SCIENCE &amp; TECHNOLOGY CO. LTD<br />
Whois Server: whois.55hl.com<br />
Referral URL: http://www.55hl.com<br />
Name Server: DNS5.4CUN.COM<br />
Name Server: DNS6.4CUN.COM<br />
Status: clientHold<br />
Status: clientTransferProhibited<br />
Updated Date: 20-jul-2011<br />
Creation Date: 15-jul-2011<br />
Expiration Date: 15-jul-2012</p>
<p><strong>Still more information can be found <a href="http://stopmalvertising.com/spam-scams/do-not-hand-over-your-twitter-credentials-to-stalktrak.html" target="_blank">on this site</a></strong>, which talks about the same scam (back before the scammers changed domain names and came back from the &#8220;dead&#8221;).</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F36%2Fnew-old-twitter-password-stealer-making-the-rounds&amp;title=New%20%28old%3F%29%20Twitter%20password%20stealer%20making%20the%20rounds%E2%80%A6" id="wpa2a_28"><img src="http://www.falatic.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.falatic.com/index.php/36/new-old-twitter-password-stealer-making-the-rounds/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Moved to a new webhost as well as a new VPS host!</title>
		<link>http://www.falatic.com/index.php/31/moved-to-a-new-webhost-as-well-as-a-new-vps-host</link>
		<comments>http://www.falatic.com/index.php/31/moved-to-a-new-webhost-as-well-as-a-new-vps-host#comments</comments>
		<pubDate>Sun, 10 Jul 2011 10:44:15 +0000</pubDate>
		<dc:creator>Martin Falatic</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[HostGator]]></category>
		<category><![CDATA[Hosting Matters]]></category>
		<category><![CDATA[Linode]]></category>
		<category><![CDATA[shared hosting]]></category>
		<category><![CDATA[Slicehost]]></category>
		<category><![CDATA[VPS]]></category>

		<guid isPermaLink="false">http://www.falatic.com/?p=31</guid>
		<description><![CDATA[I have two online hosting systems I routinely use: one is a VPS that I use for things like secure proxy (mostly to secure insecure wireless connections) and otherwise keeping my sysadmin skills fresh. The other is a more typical &#8230; <a class="more-link" href="http://www.falatic.com/index.php/31/moved-to-a-new-webhost-as-well-as-a-new-vps-host">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p><strong>I have two online hosting systems I routinely use:</strong> one is a VPS that I use for things like secure proxy (mostly to secure insecure wireless connections) and otherwise keeping my sysadmin skills fresh. The other is a more typical shared hosting server I use for website and email hosting. This week I migrated them to <strong><a href="http://www.linode.com/" target="_blank">Linode</a></strong> and <strong><a href="http://www.hostgator.com/shared.shtml" target="_blank">HostGator</a></strong> respectively, as described below.</p>
<p><span id="more-31"></span>For web/email hosting, I was with <strong>Concentric</strong> way back when (later bought by <strong>XO.com</strong>). I decided to leave<strong> XO.com</strong> when it was clearly unresponsive to the fact that the shared SMTP address was starting to routinely get blacklisted because spammers were hosted on the same machine my sites were unfortunately on. Instead of dealing with the spammers the situation was left as-is and was untenable.</p>
<p>I looked around and found <strong>Hosting Matters</strong> was recommended by people at the time. You can read about them elsewhere, for better or worse. They tended to be pretty responsive but I got tired of the service interruptions on the hosts I was on. Perhaps I was just unlucky that every server I was on ended up overloaded or DDoSed, but after moving servers two or three times it got old.</p>
<p>I also learned much later that <strong>Hosting Matters</strong> is also well-known for hosting right-wing / highly conservative websites (apparently this is why they were getting attacked frequently and why they were pretty good at fending off such attacks). This wasn&#8217;t a good fit for me either &#8211; I prefer my host to be if anything centrist/neutral, not a lightning rod.</p>
<p>After the latest little outage I decided to bite the bullet and migrate to <strong>HostGator</strong>. It&#8217;s also CPanel-based and has most of the same features I was used to (I&#8217;m happy to be able to custom configure SpamAssassin again, and the resource-hogging mailscanner is absent which may also be good). Otherwise the features are almost all identical or slightly better (apparently <strong>Hosting Matters</strong> had automatic backups I was unaware of, which I&#8217;m not seeing on <strong>HostGator</strong>, but that also might be why my <strong>Hosting Matters</strong> server kept bogging down late at night).</p>
<p>I&#8217;m still getting used to it but already there&#8217;s at least two clear differences: the server seems remarkably faster (both in general bandwidth as well as in low load) and I was able to update WordPress and its plugins directly from the WordPress admin panels (something I was never able to do on the previous host). Considering I simply exported and imported the databases and then created/extracted the tarball of the full sites (including the WordPress installations) I was totally shocked that it <em>just worked</em> (I gave it a shot thinking it&#8217;d fail and I&#8217;d investigate what might be wrong&#8230;) The relevant permissions and groups seem the same though.</p>
<p>Note: I didn&#8217;t use <strong>HostGator&#8217;s </strong>migration service&#8230; instead, I configured and migrated it all by hand (for the experience).</p>
<p><strong>The <a href="http://www.hostgator.com/shared.shtml" target="_blank">HostGator</a> bottom line: pleasantly surprised and satisfied so far!</strong></p>
<p>For VPS, I was with <strong>Slicehost</strong> for over two years with a standard single slice. It was interesting and I liked the interface, but their recent acquisition by <strong>Rackspace</strong> was followed by an <a href="http://thenextweb.com/dd/2011/05/03/rackspace-to-shut-down-slicehost/" target="_blank">announcement that Rackspace will discontinue the Slicehost VPS offering in favor of their Cloud offering</a>. I may go back to them later just to try out the whole cloud computing paradigm, but that isn&#8217;t really suitable for my VPS needs.</p>
<p>Seeing a lot of people migrating to <strong>Linode</strong>, I looked into it. For the same money I get more space and memory as well as the ability to use StackScripts, which should make deploying or rebuilding a server as easy as clicking a button.</p>
<p>I used my tried-and-true cheat sheet (which I previously used with my <strong>Slicehost</strong> slice) to create a new Ubuntu 11.04 x64 linode. I had to make a couple of minor changes (I was previously on Ubuntu 10.10) but otherwise my new Linode worked flawlessly!</p>
<p><strong>The <a href="http://www.linode.com/" target="_blank">Linode</a> bottom line: satisfied with the better value and knowing that it&#8217;s not disappearing anytime soon.</strong></p>
<p>** I&#8217;ve pondered moving all my hosting to that VPS, but it doesn&#8217;t make sense, particularly for the email part. (I&#8217;m not thrilled with the idea of outsourcing my email to a third party either.) It&#8217;s a ton of maintenance and upkeep which shared hosting avoids. Tradeoff is potential partial or full outages, but hopefully those stay rare.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F31%2Fmoved-to-a-new-webhost-as-well-as-a-new-vps-host&amp;title=Moved%20to%20a%20new%20webhost%20as%20well%20as%20a%20new%20VPS%20host%21" id="wpa2a_30"><img src="http://www.falatic.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.falatic.com/index.php/31/moved-to-a-new-webhost-as-well-as-a-new-vps-host/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Problems updating/installing samba4 in Ubuntu 11.04? Read here!</title>
		<link>http://www.falatic.com/index.php/29/problems-with-samba4-when-updating-from-ubuntu-10-10-to-11-04</link>
		<comments>http://www.falatic.com/index.php/29/problems-with-samba4-when-updating-from-ubuntu-10-10-to-11-04#comments</comments>
		<pubDate>Tue, 07 Jun 2011 00:48:09 +0000</pubDate>
		<dc:creator>Martin Falatic</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[11.04]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[ldberror]]></category>
		<category><![CDATA[Natty]]></category>
		<category><![CDATA[problem]]></category>
		<category><![CDATA[purge]]></category>
		<category><![CDATA[rootdse]]></category>
		<category><![CDATA[samba]]></category>
		<category><![CDATA[samba4]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.falatic.com/?p=29</guid>
		<description><![CDATA[I recently upgraded my Ubuntu installation from 10.10 to 11.04 and the samba4 package had big problems being updated or installed. I finally found a way to properly install it, so hopefully this will be helpful to others. First, the &#8230; <a class="more-link" href="http://www.falatic.com/index.php/29/problems-with-samba4-when-updating-from-ubuntu-10-10-to-11-04">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>I recently upgraded my Ubuntu installation from 10.10 to 11.04 and the samba4 package had big problems being updated or installed. I finally found a way to properly install it, so hopefully this will be helpful to others.</p>
<p>First, the tail of the installation output for the samba4 package:</p>
<p style="padding-left: 30px;">&#8230;<em><br />
module samba_dsdb initialization failed : No such object</em><br />
<em>Unable to load modules for /var/lib/samba/private/sam.ldb: dsdb_module_search_dn: did not find base dn @ROOTDSE (0 results)</em><br />
<em>Traceback (most recent call last):</em><br />
<em> File &#8220;/usr/share/samba/setup/upgradeprovision&#8221;, line 1597, in &lt;module&gt;</em><br />
<em> ldbs = get_ldbs(paths, creds, session, lp)</em><br />
<em> File &#8220;/usr/lib/python2.7/dist-packages/samba/upgradehelpers.py&#8221;, line 159, in get_ldbs</em><br />
<em> ldbs.sam = SamDB(paths.samdb, session_info=session, credentials=creds, lp=lp, options=["modules:samba_dsdb"])</em><br />
<em> File &#8220;/usr/lib/python2.7/dist-packages/samba/samdb.py&#8221;, line 53, in __init__</em><br />
<em> options=options)</em><br />
<em> File &#8220;/usr/lib/python2.7/dist-packages/samba/__init__.py&#8221;, line 110, in __init__</em><br />
<em> self.connect(url, flags, options)</em><br />
<em> File &#8220;/usr/lib/python2.7/dist-packages/samba/samdb.py&#8221;, line 66, in connect</em><br />
<em> options=options)</em><br />
<em>_ldb.LdbError: (80, &#8216;dsdb_module_search_dn: did not find base dn @ROOTDSE (0 results)&#8217;)</em><br />
<em>dpkg: error processing samba4 (&#8211;configure):</em><br />
<em> subprocess installed post-installation script returned error exit status 1</em><br />
<em>Errors were encountered while processing:</em><br />
<em> samba4</em><br />
<em>E: Sub-process /usr/bin/dpkg returned an error code (1)</em></p>
<p>I first looked around&#8230; a few people had reported similar issues but the answers weren&#8217;t useful. The most common one in several places was, &#8220;Why are you using samba 4? It&#8217;s experimental!&#8221; I&#8217;ve heard that only samba4 works (well | at all?) with Windows 7 protocols. Not sure about that but it was clear that downgrading to regular samba (v3) wasn&#8217;t an ideal solution. (Note: it&#8217;s been a while since I dealt with interop issues on samba&#8230; I apparently originally installed samba4 in 10.04 or 10.10 as part of trying to talk with Windows 7.)</p>
<p>Finally, having done due diligence, <a title="Samba4 failed install report" href="https://bugs.launchpad.net/ubuntu/+source/samba4/+bug/792189" target="_blank">I posted my problem as a bug report</a>. After a few iterations it was mentioned that I should &#8220;purge&#8221; the samba database. Hmm. I didn&#8217;t see that mentioned anywhere else when I searched before (on my particular install error). So I tried it and lo and behold! The purge worked!</p>
<p><strong>So, to install/upgrade samba4 on Ubuntu 11.04, you can try the following (<span style="color: #ff0000;">Disclaimer: always back up first!</span>):</strong></p>
<pre># Attempt to install samba4:

sudo apt-get install samba4

# Assuming it fails to install correctly
#("_ldb.LdbError: (80, 'dsdb_module_search_dn: did not find
# base dn @ROOTDSE (0 results)')" is the error I was dealing
# with), purge samba4:

sudo apt-get purge samba4

# Finally, attempt to install samba4 again:

sudo apt-get install samba4</pre>
<p>That should do it. If it doesn&#8217;t do it, maybe you are having a different issue.</p>
<p><strong><span style="color: #0000ff;">EDIT:</span> There&#8217;s some useful info on <a href="http://www.liberiangeek.net/2011/04/share-home-folder-ubuntu-11-04-natty-narwhal/" target="_blank">this page</a> about configuring Ubuntu 11.04 Samba so as to play nice with Windows</strong>. Also, your smb.conf is probably in /etc/samba&#8230; <em><strong>installing samba doesn&#8217;t install a default config file</strong></em> even if this one is absent. I&#8217;m not sure why yet but I&#8217;d like to know since my existing one is throwing warnings when you run &#8220;samba&#8221; as a command (several &#8220;unknown parameters&#8221; are getting &#8220;ignored&#8221;&#8230; probably fine but I wish I had a clean smb.conf for this release to compare against.)</p>
<p><strong><span style="color: #0000ff;">EDIT2:</span> There&#8217;s <a href="http://www.liberiangeek.net/2011/04/share-files-folders-ubuntu-11-04-natty-narwhal/" target="_blank">another tutorial here</a> about Ubuntu 11.04, Samba 3 and sharing with Windows.</strong></p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F29%2Fproblems-with-samba4-when-updating-from-ubuntu-10-10-to-11-04&amp;title=Problems%20updating%2Finstalling%20samba4%20in%20Ubuntu%2011.04%3F%20Read%20here%21" id="wpa2a_32"><img src="http://www.falatic.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.falatic.com/index.php/29/problems-with-samba4-when-updating-from-ubuntu-10-10-to-11-04/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Worthwhile reading for current or potential 64-bit developers&#8230;</title>
		<link>http://www.falatic.com/index.php/28/worthwhile-reading-for-64-bit-devs</link>
		<comments>http://www.falatic.com/index.php/28/worthwhile-reading-for-64-bit-devs#comments</comments>
		<pubDate>Tue, 31 May 2011 04:09:35 +0000</pubDate>
		<dc:creator>Martin Falatic</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.falatic.com/?p=28</guid>
		<description><![CDATA[I read this CodeProject article today and found it quite enlightening with regard to the pitfalls of 64-bit programing for those used to 32-bit programming. It&#8217;s well worth a read if you are a developer who wants to write solid &#8230; <a class="more-link" href="http://www.falatic.com/index.php/28/worthwhile-reading-for-64-bit-devs">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>I read <a href="http://www.codeproject.com/KB/cpp/Examples-64-bit-Errors.aspx" target="_blank">this CodeProject article</a> today and found it quite enlightening with regard to the pitfalls of 64-bit programing for those used to 32-bit programming. It&#8217;s well worth a read if you are a developer who wants to write solid 64-bit code!</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F28%2Fworthwhile-reading-for-64-bit-devs&amp;title=Worthwhile%20reading%20for%20current%20or%20potential%2064-bit%20developers%E2%80%A6" id="wpa2a_34"><img src="http://www.falatic.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.falatic.com/index.php/28/worthwhile-reading-for-64-bit-devs/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Process Output Logging in Linux and Windows</title>
		<link>http://www.falatic.com/index.php/25/process-output-logging</link>
		<comments>http://www.falatic.com/index.php/25/process-output-logging#comments</comments>
		<pubDate>Thu, 19 May 2011 15:09:22 +0000</pubDate>
		<dc:creator>Martin Falatic</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[cmd]]></category>
		<category><![CDATA[command]]></category>
		<category><![CDATA[csh]]></category>
		<category><![CDATA[Cygwin]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[logging]]></category>
		<category><![CDATA[stderr]]></category>
		<category><![CDATA[stdout]]></category>
		<category><![CDATA[tcsh]]></category>
		<category><![CDATA[tee]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://www.falatic.com/?p=25</guid>
		<description><![CDATA[As I was updating this Wikia page, I added a section about how to create a simple logfile. I thought it&#8217;d be useful to expand upon the subject here. Sometimes you want a raw log of whatever happens during a &#8230; <a class="more-link" href="http://www.falatic.com/index.php/25/process-output-logging">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>As I was updating <a href="http://cygwin.wikia.com/wiki/How_to_install_a_newer_version_of_GCC" target="_blank">this Wikia page</a>, I added a section about how to create a simple logfile. I thought it&#8217;d be useful to expand upon the subject here.</p>
<p>Sometimes you want a raw log of whatever happens during a process, whether it&#8217;s coming in via STDERR or STDOUT (usually so you can see the warning or error in the context of the rest of the output). A little redirection and judicious use of &#8220;tee&#8221; will accomplish this. You may not know you wanted a log at all until you spent 5 hours running a process and an error occurred 20,000 lines back. Here&#8217;s a quick and easy way to log that output on the off-chance you&#8217;ll need it later!</p>
<p><strong>Simple logging for bash (Linux or Cygwin) <em>or</em> a Windows command prompt </strong>(assumes you have &#8220;tee&#8221; installed somewhere in your path, e.g., via <a href="http://www.cygwin.com/" target="_blank">Cygwin</a>). The &#8220;2&gt;&amp;1&#8243; part redirects STDERR to STDOUT prior to piping STDOUT to &#8220;tee&#8221;:</p>
<pre>MyUtil -arg1 A -arg2 B 2&gt;&amp;1 | tee mylogfile.log</pre>
<p><strong>Simple logging f</strong><strong>or csh/tcsh (Linux or Cygwin)</strong>. The |&amp; forces STDERR to be piped to &#8220;tee&#8221; alone with the usual STDOUT:</p>
<pre>MyUtil -arg1 A -arg2 B      |&amp; tee mylogfile.log</pre>
<p><strong>Note: </strong>non-interactive processes are far more amenable to this&#8230; if manual input is expected  you probably won&#8217;t see the prompt (since tee won&#8217;t flush its buffer  until EOF or a newline, at a minimum (it may buffer MANY lines before  displaying them). If you know when it&#8217;ll occur you CAN enter the data at the appropriate time (or press return or what have you). This is a quick and dirty way to log something you&#8217;d rather not dig into to instrument.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F25%2Fprocess-output-logging&amp;title=Process%20Output%20Logging%20in%20Linux%20and%20Windows" id="wpa2a_36"><img src="http://www.falatic.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.falatic.com/index.php/25/process-output-logging/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Adventures Building GCC 4.6.0 for Cygwin</title>
		<link>http://www.falatic.com/index.php/23/adventures-building-gcc-4-6-0-for-cygwin</link>
		<comments>http://www.falatic.com/index.php/23/adventures-building-gcc-4-6-0-for-cygwin#comments</comments>
		<pubDate>Thu, 19 May 2011 14:48:19 +0000</pubDate>
		<dc:creator>Martin Falatic</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Cygwin]]></category>
		<category><![CDATA[GCC]]></category>
		<category><![CDATA[GCC 4.6.0]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://www.falatic.com/?p=23</guid>
		<description><![CDATA[I decided I wanted to try out GCC using Cygwin rather than my usual Ubuntu virtual machine. In the course of this adventure I learned how to build GCC 4.6.0 for Cygwin, got my feet wet over on StackOverflow, and &#8230; <a class="more-link" href="http://www.falatic.com/index.php/23/adventures-building-gcc-4-6-0-for-cygwin">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>I decided I wanted to try out GCC using Cygwin rather than my usual Ubuntu virtual machine. In the course of this adventure I learned how to build GCC 4.6.0 for Cygwin, <a href="http://stackoverflow.com/questions/5762816/gcc-4-6-0-build-sanity-check-error" target="_blank">got my feet wet over on StackOverflow</a>, and made some substantial updates on <a href="http://cygwin.wikia.com/wiki/How_to_install_a_newer_version_of_GCC" target="_blank">the Cygwin Wikia for this subject</a>.</p>
<p>Are YOU a Cygwin user who is not satisfied with GCC 3.4.4 (the latest one they offer)? Want to build a far more modern release of GCC for Cygwin? <a href="http://cygwin.wikia.com/wiki/How_to_install_a_newer_version_of_GCC" target="_blank">Read more on the Wikia</a> &#8211; it works: I just spent a few hours (im)proving it!</p>
<p><em>(This also inspired <a href="http://www.falatic.com/index.php/25/process-output-logging">my subsequent post about process logging</a>&#8230; nothing makes good logging worthwhile like rebuilding a compiler!)</em></p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F23%2Fadventures-building-gcc-4-6-0-for-cygwin&amp;title=Adventures%20Building%20GCC%204.6.0%20for%20Cygwin" id="wpa2a_38"><img src="http://www.falatic.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.falatic.com/index.php/23/adventures-building-gcc-4-6-0-for-cygwin/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Interesting Software Development Resources</title>
		<link>http://www.falatic.com/index.php/19/interesting-software-development-resources</link>
		<comments>http://www.falatic.com/index.php/19/interesting-software-development-resources#comments</comments>
		<pubDate>Tue, 23 Nov 2010 13:07:55 +0000</pubDate>
		<dc:creator>Martin Falatic</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.falatic.com/?p=19</guid>
		<description><![CDATA[Here are some interesting resources I&#8217;ve found with regard to software development. [Note that embedded best-practices are also applicable to writing multi-threaded code and coding in other resource-limited environments]: Interesting software dev articles from EE Times: &#8220;Top causes of nasty &#8230; <a class="more-link" href="http://www.falatic.com/index.php/19/interesting-software-development-resources">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>Here are some interesting resources I&#8217;ve found with regard to software development. [Note that embedded best-practices are also applicable to writing   multi-threaded code and coding in other resource-limited environments]:</p>
<ul>
<li>Interesting software dev articles from <em>EE Times</em>:
<ul>
<li><em>&#8220;Top causes of nasty embedded software bugs&#8221;</em>: <a title="Part 2" href="http://www.eetimes.com/discussion/other/4210308/Five-more-top-causes-of-nasty-embedded-software-bugs" target="_blank">Part 1</a> <a title="Part 2" href="http://www.eetimes.com/discussion/other/4210308/Five-more-top-causes-of-nasty-embedded-software-bugs" target="_blank">Part 2</a></li>
<li><em>&#8220;Bug-killing standards for firmware coding&#8221;</em>: <a title="Part 2" href="http://www.eetimes.com/discussion/barr-code/4027006/More-bug-killing-standards-for-firmware-coding" target="_blank">Part 1</a> <a title="Part 2" href="http://www.eetimes.com/discussion/barr-code/4027006/More-bug-killing-standards-for-firmware-coding" target="_blank">Part 2</a></li>
</ul>
</li>
</ul>
<ul>
<li><em><a href="http://oreilly.com/catalog/9780596809492" target="_blank">97 Things Every Programmer Should Know</a></em>:<strong><em></em></strong> An interesting little book that covers many aspects of the software development process (I have to add that you shouldn&#8217;t be afraid to break things <em>unless</em> that thing is the build. <em>Don&#8217;t Break The Build!</em>)</li>
</ul>
<ul>
<li><em><a href="http://www.netrino.com/Coding-Standard" target="_blank">Embedded C Coding Standard as envisioned by Netrino</a></em>: A (quite expensive) book (the reviews I&#8217;ve read are a mixed bag as well). I&#8217;m not recommending it so much as pointing out that it exists and is well-regarded in some circles.</li>
</ul>
<p>As an aside, while &#8220;don&#8217;t break the build&#8221; became my mantra early in my SCM roles, I had <em>no idea</em> how many variants there are on that theme on the web&#8230; everything from websites to t-shirts to videos. LOL! <img src='http://www.falatic.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':-D' class='wp-smiley' /> </p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.falatic.com%2Findex.php%2F19%2Finteresting-software-development-resources&amp;title=Interesting%20Software%20Development%20Resources" id="wpa2a_40"><img src="http://www.falatic.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.falatic.com/index.php/19/interesting-software-development-resources/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
