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

<channel>
	<title>Mischiefblog</title>
	<atom:link href="http://www.mischiefblog.com/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://www.mischiefblog.com</link>
	<description>I WATN 2 MAEK GAEM!</description>
	<pubDate>Thu, 25 Jun 2009 20:05:56 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Awww cute!</title>
		<link>http://www.mischiefblog.com/?p=809</link>
		<comments>http://www.mischiefblog.com/?p=809#comments</comments>
		<pubDate>Thu, 25 Jun 2009 20:05:56 +0000</pubDate>
		<dc:creator>Chris</dc:creator>
		
		<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://www.mischiefblog.com/?p=809</guid>
		<description><![CDATA[Becky got a baby raptor companion pet last night on the WoW 3.2 PTR.  She said it was her fifth run through the instance, which means it&#8217;s about a 1 in 100 drop rate, similar to the Sprite Darter in Feralas.
]]></description>
			<content:encoded><![CDATA[<p>Becky got a baby raptor companion pet last night on the WoW 3.2 PTR.  She said it was her fifth run through the instance, which means it&#8217;s about a 1 in 100 drop rate, similar to the Sprite Darter in Feralas.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mischiefblog.com/?feed=rss2&amp;p=809</wfw:commentRss>
		</item>
		<item>
		<title>Munchkin in the morning</title>
		<link>http://www.mischiefblog.com/?p=808</link>
		<comments>http://www.mischiefblog.com/?p=808#comments</comments>
		<pubDate>Thu, 25 Jun 2009 14:59:16 +0000</pubDate>
		<dc:creator>Chris</dc:creator>
		
		<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://www.mischiefblog.com/?p=808</guid>
		<description><![CDATA[My wife wanted to know if it was worth going Engineering on a Troll hunter and lose the +1% crit bonus to bows to use crafted shot instead.

Think about crit this way:
- For the sake of argument, you hit the mobs for 150 with a shot with
vendor ammo.  You fire a shot every 2.7 [...]]]></description>
			<content:encoded><![CDATA[<p>My wife wanted to know if it was worth going Engineering on a Troll hunter and lose the +1% crit bonus to bows to use crafted shot instead.</p>
<blockquote><p>
Think about crit this way:<br />
- For the sake of argument, you hit the mobs for 150 with a shot with<br />
vendor ammo.  You fire a shot every 2.7 seconds, and your hit is 2.2%,<br />
meaning your miss rate is 3.7%, giving an effective hit of 144.45.  Your<br />
ideal DPS is 55.56, but with your miss, you&#8217;re really down to 53.5 DPS.<br />
- 1% crit means one out of 100 shots will crit for up to double damage.<br />
For the purpose of this discussion, we&#8217;ll assume it always does double<br />
damage.<br />
- In case A, we&#8217;ll say you have +3% crit for this discussion, or 8% crit<br />
actual, which means your damage effective over 300 shots is (144.45 * 300<br />
shots + 150 * 24 crits) or 43335 + 3600 = 46,935 damage, or effective<br />
57.94 DPS<br />
- In case B, we&#8217;ll say you have +2% crit, or 7% crit actual, which means<br />
your damage effective over 300 shots is (21 crits) 43335 + 3150 = 46,485<br />
damage or effective 57.39 DPS.</p>
<p>&#8212;-<br />
So, as was said on Wowwiki:<br />
  What&#8217;s better, +to hit or +crit?</p>
<p>In principle they are equal. Which is better depends on circumstances. An<br />
increase in hit rate will usually yield a constant level of damage,<br />
whereas a high crit chance gives a spiky, more random damage distribution<br />
over time.</p>
<p>(With the additional caveat that crits are sometimes dropped because the<br />
attack table is full against a mob, and crits are rolled separately.)<br />
&#8212;-</p>
<p>You can see when comparing 57.94 DPS versus 57.39 DPS that they&#8217;re almost<br />
equal, and that the difference of .5 DPS from using crafted shot negates<br />
the penalty for not using bows.
</p></blockquote>
<p><i>Totally worth being 30 minutes later for the bus&#8230;</i></p>
]]></content:encoded>
			<wfw:commentRss>http://www.mischiefblog.com/?feed=rss2&amp;p=808</wfw:commentRss>
		</item>
		<item>
		<title>She got King Krush!</title>
		<link>http://www.mischiefblog.com/?p=807</link>
		<comments>http://www.mischiefblog.com/?p=807#comments</comments>
		<pubDate>Mon, 01 Jun 2009 15:56:31 +0000</pubDate>
		<dc:creator>Chris</dc:creator>
		
		<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://www.mischiefblog.com/?p=807</guid>
		<description><![CDATA[Becky tamed King Krush Friday morning in Sholozar Basin on Amau, her Kirin Tor Hunter.  She had to make a set of 24k HP armor, grab the right equipment and enchants, carry around haste potions, stamina scrolls, etc., but she got him!
The first tame attempt killed her as Krush got a series of critical [...]]]></description>
			<content:encoded><![CDATA[<p>Becky tamed King Krush Friday morning in Sholozar Basin on Amau, her Kirin Tor Hunter.  She had to make a set of 24k HP armor, grab the right equipment and enchants, carry around haste potions, stamina scrolls, etc., but she got him!</p>
<p>The first tame attempt killed her as Krush got a series of critical hits on her.  The second attempt was after Krush and a friendly group of Mammoths killed an Undead Mage who tried to get the rare mob, but this one succeeded.</p>
<p>She&#8217;s one of the first hunters on the server with the Dinosaur and she keeps getting looks from Horde and whispers from Alliance Hunters who can&#8217;t believe she managed to get such a difficult and rare tame.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mischiefblog.com/?feed=rss2&amp;p=807</wfw:commentRss>
		</item>
		<item>
		<title>Stackless Python mutex lock</title>
		<link>http://www.mischiefblog.com/?p=802</link>
		<comments>http://www.mischiefblog.com/?p=802#comments</comments>
		<pubDate>Wed, 20 May 2009 22:50:52 +0000</pubDate>
		<dc:creator>Chris</dc:creator>
		
		<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://www.mischiefblog.com/?p=802</guid>
		<description><![CDATA[Would anyone like to point out the problems in the following block of code?  I&#8217;ve tested it and haven&#8217;t found any problems with it as a form of mutex locking between tasks in Stackless Python.

# locks
locks = {}
&#160;
# waiting locks
queue = {}
&#160;
# lock request channel&#160;&#160;&#160;&#160;
lock_manager_channel = stackless.channel()
&#160;
# controls lock manager
stopManager = Signal()
&#160;
def acquire(caller, lck):
&#160;&#160;&#160;&#160;"""Acquire [...]]]></description>
			<content:encoded><![CDATA[<p>Would anyone like to point out the problems in the following block of code?  I&#8217;ve tested it and haven&#8217;t found any problems with it as a form of mutex locking between tasks in Stackless Python.</p>
<p><code><br />
# locks<br />
locks = {}<br />
&nbsp;<br />
# waiting locks<br />
queue = {}<br />
&nbsp;<br />
# lock request channel&nbsp;&nbsp;&nbsp;&nbsp;<br />
lock_manager_channel = stackless.channel()<br />
&nbsp;<br />
# controls lock manager<br />
stopManager = Signal()<br />
&nbsp;<br />
def acquire(caller, lck):<br />
&nbsp;&nbsp;&nbsp;&nbsp;"""Acquire a lock from within a tasklet."""<br />
&nbsp;&nbsp;&nbsp;&nbsp;if not stopManager:<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;lock_wait_channel = stackless.channel()<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;lock_manager_channel.send((lck, lock_wait_channel, caller))<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# block until lock acquired<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;lock_wait_channel.receive()<br />
&nbsp;&nbsp;&nbsp;&nbsp;else:<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;raise LockManagerStoppedException("Lock manager stopped.")<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
def release(caller, lck):<br />
&nbsp;&nbsp;&nbsp;&nbsp;"""Release a lock held by the calling tasklet.<br />
&nbsp;&nbsp;&nbsp;&nbsp;You can't release a lock you don't have.<br />
&nbsp;&nbsp;&nbsp;&nbsp;You can't remove a lock request that is enqueued.<br />
&nbsp;&nbsp;&nbsp;&nbsp;"""<br />
&nbsp;&nbsp;&nbsp;&nbsp;lock_manager_channel.send((lck, None, caller))<br />
&nbsp;<br />
def lock_manager():<br />
&nbsp;&nbsp;&nbsp;&nbsp;"""Manage lock requests via a monitor task."""<br />
&nbsp;&nbsp;&nbsp;&nbsp;while queue or not stopManager:<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(lck, channel, caller) = lock_manager_channel.receive()<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if channel != None:<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# lock request<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if not locks.has_key(lck):<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# no lock held<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;locks[lck] = caller<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# signal the requester<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;channel.send(None)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;elif locks[lck] == caller:<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# reentrant lock<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;channel.send(None)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else:<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# append the request and block until lock released<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if queue.has_key(lck):<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;queue[lck].append((channel, caller))<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else:<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;queue[lck] = [(channel, caller)]<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else:<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# lock release<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if locks.has_key(lck) and locks[lck] == caller:<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# release the lock<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# get the next caller<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if queue.has_key(lck):<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(channel, next_caller) = queue[lck].pop(0)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# remove empty wait queue&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if not len(queue[lck]):<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;del queue[lck]<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# lock on the behalf of the requester<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;locks[lck] = next_caller<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# notify the blocked requester<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;channel.send(None)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else:<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# remove the lock<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;del locks[lck]<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else:<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# no work needed to be done<br />
&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;logger.debug(&#8221;locks.has_key(&#8221; + str(lck) + &#8220;) &#8221; + str(locks.has_key(lck)))<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;stackless.schedule()<br />
</code><br />
<span id="more-802"></span><br />
I could have looked for the caller on the stack to lock/unlock the mutex, but I decided an arbitrary key was a better choice.  In practice, the keys and locks should be strings (or other values that can be hashed into a dictionary), so passing object references isn&#8217;t a great idea.</p>
<p><b>Usage:</b><br />
<code><br />
# within the context of a stackless task . . .<br />
lock.acquire("myMethod", "myLock")<br />
# do some stuff<br />
lock.release("myMethod", "myLock")<br />
</code></p>
<p><i>Edit:</i><br />
Signal is a class which is used to indicate that a signal has been thrown, in this case that the loop should be stopped.</p>
<p><code><br />
class Signal():<br />
&nbsp;&nbsp;&nbsp;&nbsp;def __init__(self):<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;self.flagged = False<br />
&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;def flag(self):<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;self.flagged = True<br />
&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;def isFlagged(self):<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return self.flagged<br />
&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;def __nonzero__(self):<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return self.flagged<br />
&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;def __str__(self):<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return str(self.flagged)<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.mischiefblog.com/?feed=rss2&amp;p=802</wfw:commentRss>
		</item>
		<item>
		<title>Incredibly Lucky</title>
		<link>http://www.mischiefblog.com/?p=799</link>
		<comments>http://www.mischiefblog.com/?p=799#comments</comments>
		<pubDate>Fri, 08 May 2009 18:11:32 +0000</pubDate>
		<dc:creator>Chris</dc:creator>
		
		<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://www.mischiefblog.com/?p=799</guid>
		<description><![CDATA[My wife decided to tame a spirit beast in Warcraft last night.  Of course, at 9pm, even on a relatively dead server, she won&#8217;t find one and didn&#8217;t expect to:  this was mostly a chance to scout out the locations where they spawn.  This morning she was woken up at 4am, logged [...]]]></description>
			<content:encoded><![CDATA[<p>My wife decided to tame a <a href="http://www.wowhead.com/?npc=33776" target="_blank">spirit beast</a> in Warcraft last night.  Of course, at 9pm, even on a relatively dead server, she won&#8217;t find one and didn&#8217;t expect to:  this was mostly a chance to scout out the locations where they spawn.  This morning she was woken up at 4am, logged into Warcraft, and Gondria was waiting for her.</p>
<p>I&#8217;m afraid to roll against her in any dungeon groups.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mischiefblog.com/?feed=rss2&amp;p=799</wfw:commentRss>
		</item>
		<item>
		<title>Mozilla history and SQLite</title>
		<link>http://www.mischiefblog.com/?p=798</link>
		<comments>http://www.mischiefblog.com/?p=798#comments</comments>
		<pubDate>Wed, 04 Mar 2009 07:01:05 +0000</pubDate>
		<dc:creator>Chris</dc:creator>
		
		<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://www.mischiefblog.com/?p=798</guid>
		<description><![CDATA[Recent versions of Mozilla Firefox use SQLite to store the history and bookmarks.  Ever wanted to get at the database instead of using the JSON backup file?


Shut down Firefox.
Copy places.sqlite from your profile.
Start SQLite:
$ sqlite3 places.sqlite
Review the sqlite3 manpage
Execute fun queries like examining your browse history:
select a.url, a.title, b.visit_date from moz_places as a join [...]]]></description>
			<content:encoded><![CDATA[<p>Recent versions of Mozilla Firefox use SQLite to store the history and bookmarks.  Ever wanted to get at the database instead of using the JSON backup file?<br />
<span id="more-798"></span></p>
<ol>
<li>Shut down Firefox.</li>
<li>Copy places.sqlite from your profile.</li>
<li>Start SQLite:<br />
<br /><code>$ sqlite3 places.sqlite</code></li>
<li>Review the sqlite3 manpage</li>
<li>Execute fun queries like examining your browse history:<br />
<br /><code>select a.url, a.title, b.visit_date from moz_places as a join moz_historyvisits b on a.id = b.place_id order by b.visit_date asc</code></li>
<li>Do nifty stuff like dump your query results to a file:<br />
<br />.output myplaces.txt</li>
<li>Use awk to break your output file into a tab delimited format, import into Excel, and go wild with analysis</li>
</ol>
<p><b>Bonus:</b> figure out what your kids, co-workers, or employees have been browsing, assuming they&#8217;re not clueful enough to clean up after themselves.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mischiefblog.com/?feed=rss2&amp;p=798</wfw:commentRss>
		</item>
		<item>
		<title>Got my Kindle</title>
		<link>http://www.mischiefblog.com/?p=789</link>
		<comments>http://www.mischiefblog.com/?p=789#comments</comments>
		<pubDate>Wed, 25 Feb 2009 20:34:08 +0000</pubDate>
		<dc:creator>Chris</dc:creator>
		
		<category><![CDATA[General]]></category>

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

		<guid isPermaLink="false">http://www.mischiefblog.com/?p=789</guid>
		<description><![CDATA[I received my Kindle 2 yesterday.  Becky liked how lightweight it was, but she prefers the button layout of the Kindle 1 &#8212; at the least, she&#8217;d like a previous button on the right side, and she liked having the SD card slot to store more books.  The refresh rate and quality of [...]]]></description>
			<content:encoded><![CDATA[<p>I received my Kindle 2 yesterday.  Becky liked how lightweight it was, but she prefers the button layout of the Kindle 1 &#8212; at the least, she&#8217;d like a previous button on the right side, and she liked having the SD card slot to store more books.  The refresh rate and quality of the screen was higher, but she decided she&#8217;ll stick with her year-old one.</p>
<p>I had trouble finding a lot of <a href="http://en.wikipedia.org/wiki/Long_tail" target="_blank">long tail</a> books.  Feel free to request them for the Kindle:  Amazon pays attention to these requests and will bring them to the publishers.  Here are some of the titles I&#8217;ve requested already:
<ul>
<li><a href="http://www.amazon.com/gp/product/0618640150?ie=UTF8&#038;tag=mischiefblog-20&#038;linkCode=as2&#038;camp=1789&#038;creative=9325&#038;creativeASIN=0618640150">The Lord of the Rings: 50th Anniversary, One Vol. Edition</a><img src="http://www.assoc-amazon.com/e/ir?t=mischiefblog-20&#038;l=as2&#038;o=1&#038;a=0618640150" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" />
</li>
<li><a href="http://www.amazon.com/gp/product/0553269828?ie=UTF8&#038;tag=mischiefblog-20&#038;linkCode=as2&#038;camp=1789&#038;creative=9325&#038;creativeASIN=0553269828">Sundiver (The Uplift Saga, Book 1)</a><img src="http://www.assoc-amazon.com/e/ir?t=mischiefblog-20&#038;l=as2&#038;o=1&#038;a=0553269828" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" />
</li>
<li><a href="http://www.amazon.com/gp/product/156865037X?ie=UTF8&#038;tag=mischiefblog-20&#038;linkCode=as2&#038;camp=1789&#038;creative=9325&#038;creativeASIN=156865037X">Earthclan ~ Startide Rising and The Uplift War</a><img src="http://www.assoc-amazon.com/e/ir?t=mischiefblog-20&#038;l=as2&#038;o=1&#038;a=156865037X" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" />
</li>
<li><a href="http://www.amazon.com/gp/product/0553573306?ie=UTF8&#038;tag=mischiefblog-20&#038;linkCode=as2&#038;camp=1789&#038;creative=9325&#038;creativeASIN=0553573306">Brightness Reef (The Uplift Trilogy, Book 1)</a><img src="http://www.assoc-amazon.com/e/ir?t=mischiefblog-20&#038;l=as2&#038;o=1&#038;a=0553573306" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" />
</li>
<li><a href="http://www.amazon.com/gp/product/0553577778?ie=UTF8&#038;tag=mischiefblog-20&#038;linkCode=as2&#038;camp=1789&#038;creative=9325&#038;creativeASIN=0553577778">Infinity&#8217;s Shore (The Uplift Saga, Book 2)</a><img src="http://www.assoc-amazon.com/e/ir?t=mischiefblog-20&#038;l=as2&#038;o=1&#038;a=0553577778" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" />
</li>
<li><a href="http://www.amazon.com/gp/product/0553574736?ie=UTF8&#038;tag=mischiefblog-20&#038;linkCode=as2&#038;camp=1789&#038;creative=9325&#038;creativeASIN=0553574736">Heaven&#8217;s Reach (The Second Uplift Trilogy #3)</a><img src="http://www.assoc-amazon.com/e/ir?t=mischiefblog-20&#038;l=as2&#038;o=1&#038;a=0553574736" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" />
</li>
<li><a href="http://www.amazon.com/gp/product/0553278746?ie=UTF8&#038;tag=mischiefblog-20&#038;linkCode=as2&#038;camp=1789&#038;creative=9325&#038;creativeASIN=0553278746">The Postman (Bantam Classics)</a><img src="http://www.assoc-amazon.com/e/ir?t=mischiefblog-20&#038;l=as2&#038;o=1&#038;a=0553278746" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" />
</li>
<li><a href="http://www.amazon.com/gp/product/055329024X?ie=UTF8&#038;tag=mischiefblog-20&#038;linkCode=as2&#038;camp=1789&#038;creative=9325&#038;creativeASIN=055329024X">Earth</a><img src="http://www.assoc-amazon.com/e/ir?t=mischiefblog-20&#038;l=as2&#038;o=1&#038;a=055329024X" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" />
</li>
<li><a href="http://www.amazon.com/gp/product/0312878605?ie=UTF8&#038;tag=mischiefblog-20&#038;linkCode=as2&#038;camp=1789&#038;creative=9325&#038;creativeASIN=0312878605">The Collected Stories of Arthur C. Clarke</a><img src="http://www.assoc-amazon.com/e/ir?t=mischiefblog-20&#038;l=as2&#038;o=1&#038;a=0312878605" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" />
</li>
<li><a href="http://www.amazon.com/gp/product/0671741926?ie=UTF8&#038;tag=mischiefblog-20&#038;linkCode=as2&#038;camp=1789&#038;creative=9325&#038;creativeASIN=0671741926">The Mote in God&#8217;s Eye</a><img src="http://www.assoc-amazon.com/e/ir?t=mischiefblog-20&#038;l=as2&#038;o=1&#038;a=0671741926" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" />
</li>
<li><a href="http://www.amazon.com/gp/product/0671795740?ie=UTF8&#038;tag=mischiefblog-20&#038;linkCode=as2&#038;camp=1789&#038;creative=9325&#038;creativeASIN=0671795740">The Gripping Hand</a><img src="http://www.assoc-amazon.com/e/ir?t=mischiefblog-20&#038;l=as2&#038;o=1&#038;a=0671795740" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" />
</li>
<li><a href="http://www.amazon.com/gp/product/0449208133?ie=UTF8&#038;tag=mischiefblog-20&#038;linkCode=as2&#038;camp=1789&#038;creative=9325&#038;creativeASIN=0449208133">Lucifer&#8217;s Hammer</a><img src="http://www.assoc-amazon.com/e/ir?t=mischiefblog-20&#038;l=as2&#038;o=1&#038;a=0449208133" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" />
</li>
<li><a href="http://www.amazon.com/gp/product/055357292X?ie=UTF8&#038;tag=mischiefblog-20&#038;linkCode=as2&#038;camp=1789&#038;creative=9325&#038;creativeASIN=055357292X">Heavy Weather</a><img src="http://www.assoc-amazon.com/e/ir?t=mischiefblog-20&#038;l=as2&#038;o=1&#038;a=055357292X" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" />
</li>
<li><a href="http://www.amazon.com/gp/product/0312536631?ie=UTF8&#038;tag=mischiefblog-20&#038;linkCode=as2&#038;camp=1789&#038;creative=9325&#038;creativeASIN=0312536631">The Forever War</a><img src="http://www.assoc-amazon.com/e/ir?t=mischiefblog-20&#038;l=as2&#038;o=1&#038;a=0312536631" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" />
</li>
<li><a href="http://www.amazon.com/gp/product/0345467175?ie=UTF8&#038;tag=mischiefblog-20&#038;linkCode=as2&#038;camp=1789&#038;creative=9325&#038;creativeASIN=0345467175">The Shockwave Rider</a><img src="http://www.assoc-amazon.com/e/ir?t=mischiefblog-20&#038;l=as2&#038;o=1&#038;a=0345467175" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" />
</li>
<li><a href="http://www.amazon.com/gp/product/0812536363?ie=UTF8&#038;tag=mischiefblog-20&#038;linkCode=as2&#038;camp=1789&#038;creative=9325&#038;creativeASIN=0812536363">Rainbows End</a><img src="http://www.assoc-amazon.com/e/ir?t=mischiefblog-20&#038;l=as2&#038;o=1&#038;a=0812536363" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" />
</li>
<li><a href="http://www.amazon.com/gp/product/0596529325?ie=UTF8&#038;tag=mischiefblog-20&#038;linkCode=as2&#038;camp=1789&#038;creative=9325&#038;creativeASIN=0596529325">Programming Collective Intelligence: Building Smart Web 2.0 Applications</a><img src="http://www.assoc-amazon.com/e/ir?t=mischiefblog-20&#038;l=as2&#038;o=1&#038;a=0596529325" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" />
</li>
</ul>
<p><script type="text/javascript" src="http://www.assoc-amazon.com/s/link-enhancer?tag=mischiefblog-20&#038;o=1">
</script><br />
<noscript><br />
    <img src="http://www.assoc-amazon.com/s/noscript?tag=mischiefblog-20" alt="" /><br />
</noscript></p>
]]></content:encoded>
			<wfw:commentRss>http://www.mischiefblog.com/?feed=rss2&amp;p=789</wfw:commentRss>
		</item>
		<item>
		<title>Someone actually understands Amazon</title>
		<link>http://www.mischiefblog.com/?p=787</link>
		<comments>http://www.mischiefblog.com/?p=787#comments</comments>
		<pubDate>Tue, 24 Feb 2009 23:57:54 +0000</pubDate>
		<dc:creator>Chris</dc:creator>
		
		<category><![CDATA[Work]]></category>

		<guid isPermaLink="false">http://www.mischiefblog.com/?p=787</guid>
		<description><![CDATA[As an Amazon employee, I learned this in orientation, in all-hands-meetings, and through doing my job.  I&#8217;m impressed, however, that Scott Wingo of Seeking Alpha actually gets how Amazon does business.
Now, if only every other investor got it, I&#8217;d make a killing off stock sales.
]]></description>
			<content:encoded><![CDATA[<p>As an Amazon employee, I learned this in orientation, in all-hands-meetings, and through doing my job.  I&#8217;m impressed, however, that Scott Wingo of Seeking Alpha actually <a href="http://seekingalpha.com/article/121955-amazon-s-wheel-of-growth?source=feed" target="_blank"><i>gets</i> how Amazon does business</a>.</p>
<p>Now, if only every other investor got it, I&#8217;d make a killing off stock sales.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mischiefblog.com/?feed=rss2&amp;p=787</wfw:commentRss>
		</item>
		<item>
		<title>Using weak references to improve service performance</title>
		<link>http://www.mischiefblog.com/?p=777</link>
		<comments>http://www.mischiefblog.com/?p=777#comments</comments>
		<pubDate>Fri, 20 Feb 2009 00:30:38 +0000</pubDate>
		<dc:creator>Chris</dc:creator>
		
		<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://www.mischiefblog.com/?p=777</guid>
		<description><![CDATA[Weak references allow object oriented software to maintain a reference to an object without preventing it from being garbage collected.  They&#8217;re most frequently used in caching and mapping implementations and can provide significant savings when there is a high cost or latency involved in retrieving values from the database.


Good for . . .
Bad for [...]]]></description>
			<content:encoded><![CDATA[<p>Weak references allow object oriented software to maintain a reference to an object without preventing it from being garbage collected.  They&#8217;re most frequently used in caching and mapping implementations and can provide significant savings when there is a high cost or latency involved in retrieving values from the database.</p>
<table border="1">
<tr>
<th>Good for . . .</th>
<th>Bad for . . .</th>
</tr>
<tr>
<td>Random access</td>
<td>Sequential or exhaustive access</td>
</tr>
<tr>
<td>Services and long-lived transactions with heavy object reuse or sharing</td>
<td>Stateless requests with short-lived transactions</td>
</tr>
</table>
<p>A weak reference map is an excellent pattern for ensuring a single object copy exists in memory at one time, as long as all requests to get objects go through the map first.  This raises some development considerations:
<ul>
<li>avoid multiple transactions operating on the same object or record &#8212; you don&#8217;t want to block transactions or have the state modified unexpectedly,</li>
<li>you want to work with your weakly referenced objects through a repository layer which wraps get, put, and other persistence operations (ideally, you&#8217;ll work through a business object layer),/li>
</li>
<li>you may want to work with aspects as these can transparently offer transactional locking on object or record modifiers, and</li>
<li>with effective management of a weak reference pool, you can identify leaks (unreleased objects).</li>
</ul>
<p>In cloud applications, you can reduce calls to the backing persistent repository.  In systems like S3, this reduces your traffic between your application and database which can help lower costs.  Again, this provides the most benefit to persistent services rather than applications that use a servlets or short-lived transactions.<br />
<span id="more-777"></span></p>
<p><b>Implementation Notes</b><br />
In Python:
<ul>
<li>One weak reference cache is kept per database or type</li>
<li>Weak references are kept in a dictionary, keyed on the same key as the database, the value being  the weakref instance</li>
<li>Implement a sweeper thread to walk the cache at regular, short intervals (250ms) to clear the cache of dead references</li>
</ul>
<p>The Python weakref type is used this way:<br />
<code><br />
# some object created from the database is called 'value'<br />
# create a weakref<br />
ref = weakref.ref(value)<br />
&nbsp;<br />
# get the value back from a weakref<br />
value = ref.__call__()<br />
&nbsp;<br />
# value will be set to None if there are no strong references to the value object<br />
</code></p>
<p>Using weakrefs with dictionaries:<br />
<code><br />
def stash(self, key, value):<br />
&nbsp;&nbsp;&nbsp;&nbsp;# store the weak reference in the refMap<br />
&nbsp;&nbsp;&nbsp;&nbsp;ref = weakref.ref(value)<br />
&nbsp;&nbsp;&nbsp;&nbsp;refMap[key] = value<br />
&nbsp;<br />
def get(self, key):<br />
&nbsp;&nbsp;&nbsp;&nbsp;# retrieve the weak reference from the refMap<br />
&nbsp;&nbsp;&nbsp;&nbsp;value = None<br />
&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;try:<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ref = self.refMap[key]<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;value = ref.__call__()<br />
&nbsp;&nbsp;&nbsp;&nbsp;except KeyError:<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pass<br />
&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;if value == None:<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;self.lock.acquire()<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;try:<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;value = self.repository.get(key)<br />
&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# cache the value<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;self.stash(key, value)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;except KeyError, e:<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;self.logger.warning(&#8221;Key not found in repository: &#8221; + str(e))<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;raise<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;finally:<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;self.lock.release()<br />
&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;return value<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.mischiefblog.com/?feed=rss2&amp;p=777</wfw:commentRss>
		</item>
		<item>
		<title>Wrath is shipping</title>
		<link>http://www.mischiefblog.com/?p=773</link>
		<comments>http://www.mischiefblog.com/?p=773#comments</comments>
		<pubDate>Thu, 13 Nov 2008 00:26:03 +0000</pubDate>
		<dc:creator>Chris</dc:creator>
		
		<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://www.mischiefblog.com/?p=773</guid>
		<description><![CDATA[Wrath of the Lich King is shipping.  We&#8217;ve got two Collector&#8217;s Editions coming tomorrow (did I really pay $24 more for a frost wyrm pet?) and they were sent via FedEx, so they might arrive before the normal 6:30pm UPS delivery time.
I&#8217;m not taking time off work unlike a co-worker, and I&#8217;m not really [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.amazon.com/gp/product/B000VJTJNE?ie=UTF8&#038;tag=mischiefblog-20&#038;linkCode=as2&#038;camp=1789&#038;creative=9325&#038;creativeASIN=B000VJTJNE">Wrath of the Lich King</a><img src="http://www.assoc-amazon.com/e/ir?t=mischiefblog-20&#038;l=as2&#038;o=1&#038;a=B000VJTJNE" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /> is shipping.  We&#8217;ve got two <a href="http://www.amazon.com/gp/product/B001G4VCII?ie=UTF8&#038;tag=mischiefblog-20&#038;linkCode=as2&#038;camp=1789&#038;creative=9325&#038;creativeASIN=B001G4VCII">Collector&#8217;s Editions</a><img src="http://www.assoc-amazon.com/e/ir?t=mischiefblog-20&#038;l=as2&#038;o=1&#038;a=B001G4VCII" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /> coming tomorrow (did I really pay $24 more for a <a href="http://www.warcraftpets.com/wow.pets/mythical/dragon.whelps/frosty.asp" target="_blank">frost wyrm pet</a>?) and they were sent via FedEx, so they might arrive before the normal 6:30pm UPS delivery time.</p>
<p>I&#8217;m not taking time off work unlike a co-worker, and I&#8217;m not really anticipating being able to play WoW tomorrow at all.  Last night&#8217;s plans of fetching some Dark Iron Ale Mugs for the Darkmoon Faire fell through when the servers were down for emergency maintenance until nearly 10pm.  I don&#8217;t have a lot of faith in the WotLK launch at this time.  I might spend the time looking at art books:  <a href="http://www.amazon.com/gp/product/0811861937?ie=UTF8&#038;tag=mischiefblog-20&#038;linkCode=as2&#038;camp=1789&#038;creative=9325&#038;creativeASIN=0811861937">World of Warcraft: The Art of The Trading Card Game)</a><img src="http://www.assoc-amazon.com/e/ir?t=mischiefblog-20&#038;l=as2&#038;o=1&#038;a=0811861937" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /> is great, while I wasn&#8217;t quite as pleased with <a href="http://www.amazon.com/gp/product/0744007259?ie=UTF8&#038;tag=mischiefblog-20&#038;linkCode=as2&#038;camp=1789&#038;creative=9325&#038;creativeASIN=0744007259">The Art of World of Warcraft</a><img src="http://www.assoc-amazon.com/e/ir?t=mischiefblog-20&#038;l=as2&#038;o=1&#038;a=0744007259" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /> even though it did have concepts and art that are only now making it into the live game (like Northrend) and some that still haven&#8217;t (the Emerald Dream).</p>
<p><script type="text/javascript" src="http://www.assoc-amazon.com/s/link-enhancer?tag=mischiefblog-20&#038;o=1">
</script><br />
<noscript><br />
    <img src="http://www.assoc-amazon.com/s/noscript?tag=mischiefblog-20" alt="" /><br />
</noscript></p>
]]></content:encoded>
			<wfw:commentRss>http://www.mischiefblog.com/?feed=rss2&amp;p=773</wfw:commentRss>
		</item>
	</channel>
</rss>
