<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"><channel><atom:link rel="hub" href="http://tumblr.superfeedr.com/" xmlns:atom="http://www.w3.org/2005/Atom"/><description></description><title>recursive</title><generator>Tumblr (3.0; @mhawthorne)</generator><link>http://notes.mhawthorne.net/</link><item><title>appengine: counting more than 1000 entities</title><description>&lt;p&gt;The best solution I’ve found for counting more than 1000 entities in appengine is in this thread (with a minor correction):&lt;/p&gt;

&lt;p&gt;&lt;a href="http://stackoverflow.com/questions/264154/google-appengine-how-to-fetch-more-than-1000/1338456#1338456"&gt;http://stackoverflow.com/questions/264154/google-appengine-how-to-fetch-more-than-1000/1338456#1338456&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In my projects I’ve been creating a class called &lt;code&gt;ModelHelper&lt;/code&gt; with this classmethod:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;@classmethod
def count(cls, model_class):
    count = 0

    query = model_class.all(keys_only=True).order('__key__')
    while count % cls.MAX_FETCH == 0:
        current_count = query.count()
        if current_count == 0:
            break
        count += current_count

        if current_count == ModelHelper.MAX_FETCH:
            last_key = query.fetch(1, cls.MAX_FETCH - 1)[0]
            query = query.filter('__key__ &gt; ', last_key)

    return count
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;where &lt;code&gt;MAX_FETCH&lt;/code&gt; is set to 1000, of course.&lt;/p&gt;</description><link>http://notes.mhawthorne.net/post/172608709</link><guid>http://notes.mhawthorne.net/post/172608709</guid><pubDate>Wed, 26 Aug 2009 22:37:26 -0400</pubDate><category>appengine</category></item><item><title>linux networking: when eth0 becomes eth2</title><description>&lt;p&gt;Today I boot my linux box and I have no network connectivity.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;-&gt;matth@juggernaut ~ ? ping google.com
 ping: unknown host google.com

-&gt;matth@juggernaut ~ ? ifconfig
lo    Link encap:Local Loopback
      inet addr:127.0.0.1  Mask:255.0.0.0
      inet6 addr: ::1/128 Scope:Host
      UP LOOPBACK RUNNING  MTU:16436  Metric:1
      RX packets:967 errors:0 dropped:0 overruns:0 frame:0
      TX packets:967 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:0
      RX bytes:155073 (151.4 KiB)  TX bytes:155073 (151.4 KiB)
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Where is eth0?&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;-&gt;matth@juggernaut ~ ? sudo ifup eth0=eth0-static
SIOCSIFADDR: No such device
eth0: ERROR while getting interface flags: No such device
SIOCSIFNETMASK: No such device
SIOCSIFBRDADDR: No such device
eth0: ERROR while getting interface flags: No such device
eth0: ERROR while getting interface flags: No such device
Failed to bring up eth0-static.
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;I have 2 configs for eth0 in /etc/network/interfaces:&lt;/p&gt;

&lt;ul&gt;&lt;li&gt;&lt;code&gt;eth0-dhcp&lt;/code&gt; for dhcp&lt;/li&gt;
&lt;li&gt;&lt;code&gt;eth0-static&lt;/code&gt; using a static ip&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;(I prefer the latter, so my linux server can have a consistent internal IP).&lt;/p&gt;

&lt;p&gt;For some reason, I try this:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;-&gt;matth@juggernaut ~ ? ifconfig -a
eth2      Link encap:Ethernet  HWaddr 00:17:31:53:fa:1e
          BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Interrupt:22 Base address:0x4000

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:980 errors:0 dropped:0 overruns:0 frame:0
          TX packets:980 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:161549 (157.7 KiB)  TX bytes:161549 (157.7 KiB)
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;What the hell is this eth2?&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;-&gt;matth@juggernaut ~ ? sudo ifup eth2=eth0-static
if-up.d/mountnfs[eth2]: waiting for interface eth0=eth0-static before doing NFS mounts (warning).
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;And then, everything worked.  But why did my network device change to eth2?&lt;/p&gt;</description><link>http://notes.mhawthorne.net/post/112765445</link><guid>http://notes.mhawthorne.net/post/112765445</guid><pubDate>Mon, 25 May 2009 10:28:56 -0400</pubDate><category>linux</category><category>networking</category></item><item><title>regionset fixes "Failed to retrieve all CSS keys" errors.</title><description>&lt;p&gt;I attempted to copy a DVD in &lt;a href="http://k3b.plainblack.com/" title="K3b"&gt;K3b&lt;/a&gt;&lt;a&gt; and watched it fail with this message:&lt;/a&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;Failed to retrieve all CSS keys
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;I checked &lt;code&gt;~/.dvdcss&lt;/code&gt; and saw some keys.  I deleted it, retried, another fail.&lt;/p&gt;

&lt;p&gt;I ran the command-line tool &lt;code&gt;dvdbackup&lt;/code&gt; and saw similar errors:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;libdvdread: Error cracking CSS key for /VIDEO_TS/VTS_28_1.VOB (0x002ee531)!!
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;I eventually stumbled upon some posts suggesting it may be a DVD region issue.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;sudo apt-get install regionset
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Then, as root, ran:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;regionset /dev/dvd 1
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Now I can burn &lt;a href="http://en.wikipedia.org/wiki/Half_Nelson_(film)" title="Half Nelson"&gt;Half Nelson&lt;/a&gt;.&lt;/p&gt;</description><link>http://notes.mhawthorne.net/post/92940741</link><guid>http://notes.mhawthorne.net/post/92940741</guid><pubDate>Mon, 11 May 2009 16:05:36 -0400</pubDate><category>linux</category><category>dvd</category></item><item><title>one liner: adding all new files to svn</title><description>&lt;p&gt;I forget and remember this about 20 times a year:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;svn st | sed -n 's/\? *//p' | xargs svn add
&lt;/code&gt;&lt;/pre&gt;</description><link>http://notes.mhawthorne.net/post/95078183</link><guid>http://notes.mhawthorne.net/post/95078183</guid><pubDate>Sat, 11 Apr 2009 01:19:00 -0400</pubDate></item></channel></rss>
