The best solution I’ve found for counting more than 1000 entities in appengine is in this thread (with a minor correction):
http://stackoverflow.com/questions/264154/google-appengine-how-to-fetch-more-than-1000/1338456#1338456
In my projects I’ve been creating a class called ModelHelper with this classmethod:
@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__ > ', last_key)
return count
where MAX_FETCH is set to 1000, of course.
Today I boot my linux box and I have no network connectivity.
->matth@juggernaut ~ ? ping google.com
ping: unknown host google.com
->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)
Where is eth0?
->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.
I have 2 configs for eth0 in /etc/network/interfaces:
-
eth0-dhcp for dhcp
-
eth0-static using a static ip
(I prefer the latter, so my linux server can have a consistent internal IP).
For some reason, I try this:
->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)
What the hell is this eth2?
->matth@juggernaut ~ ? sudo ifup eth2=eth0-static
if-up.d/mountnfs[eth2]: waiting for interface eth0=eth0-static before doing NFS mounts (warning).
And then, everything worked. But why did my network device change to eth2?
I attempted to copy a DVD in K3b and watched it fail with this message:
Failed to retrieve all CSS keys
I checked ~/.dvdcss and saw some keys. I deleted it, retried, another fail.
I ran the command-line tool dvdbackup and saw similar errors:
libdvdread: Error cracking CSS key for /VIDEO_TS/VTS_28_1.VOB (0x002ee531)!!
I eventually stumbled upon some posts suggesting it may be a DVD region issue.
sudo apt-get install regionset
Then, as root, ran:
regionset /dev/dvd 1
Now I can burn Half Nelson.
I forget and remember this about 20 times a year:
svn st | sed -n 's/\? *//p' | xargs svn add