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.
Python dict lambda mapping fun
The Theory of Everything
I really loved Ayreon’s 01011001. It was such an overwhelming experience with great musical execution of deep topics. After songs like Connect the Dots, i guess it’s understandable that I had high expectations for The Theory of Everything.
While there are 42 songs in total on the two discs (what a smart answer that is to life, the universe and everything), the almost-two hours of progressive metal left me without any real impressions. It was there – it was playing – then it was over. Lucassen himself said that it was meant to be “less heavy and more instrumental than 01011001” and sure it is much more instrumental. My problem is that if you want to thin out the overwhelming lyrical depth that characterized Y (01011001 is the code for Y) and make it “more instrumental” then there would be a need to replace that attractive force with something on the instrumental side. That is something that the Theory of Everything fails to do.
It’s still a good prog metal album, but it is nothing compared to Y.
Starbucks Christmas
Today i went to grab my dose of coffee for the coming ~10 days at the local Starbucks, and the whole place’s already in full Christmas mood. I got a sample of their Christmas blend and some “cranberry bliss bar” cookie, with encouraging introduction from the barista girl saying they match really well because of their cinnamon spiciness.
I was a bit confused at first about the “spicy” part when i actually put the samples to the test, since the coffee had a really nice, sweet berry-like aroma, supplemented by a warm and smooth (and indeed with a tint of cinnamon) taste. However, the real wonder came when i munched down the cookie bit too: the two together turned into the all-so-familiar (and all-so-missed) taste of mince pie.
I even considered actually buying a bigger dose of the duo then and there, but alas, i’m not well-off enough to pay 300 yen for a single slice of cookie (and i was buying the beans anyway, though of the espresso Christmas roast).
Guess what
Welcome to our regular post-Ubuntu update rant. I’m a bit disappointed that i have to write one like this again, especially since i haven’t logged on to Ubuntu for quite a while after the update came out (i stayed on Windows to play League). And even with the extra time, there were problems present.
Driving licence
So, on the third try, i (miraculously) got it. I really have no idea how could i pass now and got failed the last time, considering i honestly did horrible this time (messed up one of the sharp turns and put out the turn signal too late once).
My conclusion is that it depends totally on the examiner. It doesn’t matter if you do perfectly (or as close as one can get to perfect), if they want to fail you, they will. On the other hand, if you get a nice guy (or just one who isn’t dead set on failing you) then you can make mistakes and still pass.
My case as a prime example.
Surprise
Remember that article about how Japanese don’t have sex anymore? And that other (raging weeaboo) in response to it claiming they do?
Well. As you may well know if you know anything about me, i’m in the light music club of my university (yes, that light music club). We had our usual autumn festival last weekend, and the family of one of the third-years dropped by too. The guy’s a twitter addict, i mean it. I’d even go as far as to say he’s a typical nerd: video games, anime and playing his instrument is pretty much all there is (and also tweeting about all these activities). Thing is, he has a little sister and since the gig, he’s been going on about that a lot. How we mustn’t even dream of hitting on her. How perfect she is.
Then there was this interesting thing: his sister and mother asked him if he has a girlfriend – and he answered it’s too much time and effort (a sadly very common answer from japanese guys). “You’ll never get one then,” was the natural reaction.
Thing is, he’s still occasionally saying “dang i want a girlfriend so much,” and that confuses me. Want a girl but don’t want to make any efforts? Is that it? Considering how he’s quite average, i guess there you have one example from the inside of the problem cited in the articles i mentioned before.
Elo hell doesn’t exist?
Hell it does. I’ll define it in a way that denying its existence would mean that you’re totally clueless about playing League.
Birthday rant
I really don’t care if I lose. Well, maybe I do. Definitely not so much if it’s a good game. Define good game? Well matched, 5v5. Both teams have roughly the same kills and the difference in gold earned isn’t over 3 thousand.
The League system hates me
The people in #troll-base are probably getting bored of my constant complains about bronze by now. “If you can’t carry yourself out, then you don’t deserve to get out,” is my personal philosophy regarding the bottommost of tiers (and probably all the others as well). That’s a pure question of skill, however.
Licence
I called the driving licence center.
“Hello, I’d like to get a Japanese licence based on my Hungarian one. I have all the paperwork and translations. What are the fees?”
“2200 yen for the exam, and 1500 (or something along those lines) for car use.” (I don’t have a car, by the way.)
“I’ve been told that I don’t have to take an exam. Hungary is in the Geneva convention.”
“What country are you from?”
“Hungary.” (Duh I just said it like 2 times already.)
“Right, then you don’t have to take the exam.”
“So how much will it cost?”
“2200 yen for the exam, 1500 for car use and further 2200 if you passed the exam.” (You what mate?)
-
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 日本 日本語 百名山 軽音
七大陸最高峰チャレンジ