There was this one problem I just couldn’t tackle until now while coding my KC helper app: packets kept getting messed up. The whole design is based on opening a general-purpose socket with Python, and listening to all traffic to and from the KC game server. I based my code on a sniffer script I found on the net, tweaking it to my needs.
Drivebuntu
The other day I wrote about how much trouble Microsoft has with branding, inspired by their last blunder with SkyOne Drive. But the other day as I was looking around in my system (running Ubuntu), I realized that MS might’ve just made the matters worse by picking the name One Drive.
KanColle Bridge 0.7
KanColle Bridge is a smart little Python app for your Ubuntu that can help you with a bunch of stuff related to your beloved shipdaughters. Work in progress.
That last KanColle update
So apparently a bunch of anons are throwing fits about how they now have to re-VPN into Japan to renew their tokens for KanColle… It’s due to this week’s update that rolled out a system that requires that the JS on the DMM site renews the API token every set number of requests (“ticks”).
Of course the shitstorm (or even hurricane) was imminent when anons realized they can’t use their API keys forever anymore. Especially when some smartass pointed out that this update happened just two weeks after /a/’s favorite target of hate, Commie published their unofficial translation patch for the client. Let me quote: “Even the chinese are blaming commie, this is a international thing now.”[src]
The failure of Microsoft
Just earlier someone linked the news from Verge that MS was forced to rename SkyDrive due to trademark problems with the British Sky media brand. This could only be better if they were also sued by Google over the “drive” word (cf Google Drive).
GTK3 red to green progress bar in Python
I really needed a progress bar that changes from red to green as it progresses. Well, I made one. Though it doesn’t support labels as the built-in GTK ProgressBar, one can easily be added next to the bar, or (if it’s static) in a tooltip. Also, not removing self.bar would result in an actual red-to-green gradient, instead of a color-changing bar. (Though it should still be removed when the bar is reset.)
Reordering elements in a GTK Menu
Recently I’ve had the pleasure to play around with GTK from Python while working on a (by now not so) little app for KanColle. (Since that last update on github I’ve rewritten the whole thing from scratch, but that’s not the point now.) On the way, I encountered a quite annoying problem: the reorder_child method for gtk.Menu just doesn’t work. I use Python 2.7, gtk.gtk_version says that’s 2.24.20, and gtk.pygtk_version is 2.24.0.
#nowplaying button for the Ubuntu sound menu
Every now and then I get this urge to just post a #nowplaying tweet, and at such a time it’s always such a drag to type it in manually. So I thought I’d make a menu item in the Ubuntu sound menu that sends such a tweet automatically. It turned out not to be all so easy at all…
Coffee
Just now I found this nice infographic about the average coffee consumption around the world on facebook, and I just had to check how I’m faring.
Python dict lambda mapping fun
Just now I had to insert a certain dictionary variable into a database, and i wanted to use sqlite’s named placeholder scheme to make things simple.
self.cur.executemany('insert into mytable(id, name, field1, field2) values(:id, :name, :foo, :bar)',data)
Now the problem was that this dict called data didn’t have keys “foo” and “bar”: {'id': 1, 'name': u'name', 'keys': [1, 2]}
.
I’d need to map this into the shape of {'id': 1, 'name': u'name', 'foo':1, 'bar':2}
to use in the database query. Also, i wanted to keep the whole thing in a single command for reasons unknown. In the end, I came up with the following: map(lambda y: y.update({'foo':y['keys'][0], 'bar':y.pop(u'keys')[1]}) or y, data)
This did the trick. What it does: updates y with the ‘foo’ key as needed, then adds the ‘bar’ key as well, while popping off the unnecessary ‘keys’ key. The “or y” needs to be there, because dict.update returns None, not the dict object.
-
Recent Posts
Tags
ale anime art beer blog clojure code coffee deutsch emo english fansub fest filozófia food gaming gastrovale geek hegymász jlc kaja kubernetes kultúra language literature live magyar movie másnap politika rant sport suli szolgálati közlemény travel társadalom ubuntu university weather work zene 日本 日本語 百名山 軽音-
Recent Posts
Tags
ale anime art beer blog clojure code coffee deutsch emo english fansub fest filozófia food gaming gastrovale geek hegymász jlc kaja kubernetes kultúra language literature live magyar movie másnap politika rant sport suli szolgálati közlemény travel társadalom ubuntu university weather work zene 日本 日本語 百名山 軽音七大陸最高峰チャレンジ