Today, I accidentally found a math book for primary school student. Part being curious and devilish at the same time I scribbled and somewhat ‘solve’ some of the problems; if not making it worse. Here’s one:
and another one:
The sad part of it? It took me roughly five full minutes to solve the second one. It was the last problem in the book that I took before putting it down and start cursing my math teachers when I was in school.
WARNING: The solutions presented here is not to be taken as correct. If you see any mistake, well that’s the point of this post :).
This is new for me, sometimes I want to do this:
aList = [1, 2, 3, 5, 7];
if (2, 3) in aList: # I want to check whether 2 and 3 is in aList
that code right there is a logical error, I thought the interpreter will search
aList for items inside the tuple while the truth is that it will look for the existence of a tuple with 2 and 3 in it inside
Thanks to some guy’s code which I happened to stumble upon, now I know that I can use
all( ) function to do that. A leaner solution than the tedious enumeration of all items and checking it one by one. Here’s a demonstration:
# instead of this ..
allFound = True;
for num in (2, 3):
if not (num in aList):
allFound = False;
# now I can use this ...
if all(num in aList for num in (2, 3)):
wow, look at that! It makes perfect sense because most of the gist in that sample is a list comprehension and
all( ) made up the invisible
AND between the list items. Another similar function to
all( ) is the appropriately-named
any( ) which having the effect of
OR instead of
Although I didn’t put any attention to Geocities for the past few years; I never log in TO Geocities for years, maybe, but apparently the service is closing.
I do have an account there (who doesn’t?), and it was from way back 2002. I remember back then when Geocities was a company of its own, before Yahoo! bought them. It IS a great service, provided if you dont mind using HTML-only website, I know one or two guys who do. So here I am, waiting for another hour because my hourly limit just sets off from downloading my files.
I don’t know what’s next, will Google close its GMail service in 2018? I hope I’ll live long enough to see that happening.
Few minutes ago I just found out that I can actually send SSH session into background by suspending it. From now on I can use one terminal for everything I need.
How is it done? That sneaky escape_char is the key. A quick glance at the ssh manual should explain you all about it, but I found it hard to practice; I just can’t understand what “The escape character is only recognized at the beginning of a line” is supposed to mean.
I mean I know that sentence in English, duh, but what the heck is this “at the beginning of a line” is all about? Are we talking about the shell prompt here or what, Vim? I recall that every time I send a command it occupy its own line, is this a trick to confuse newbie? Even though I know that you CAN type multiple-line commands, but that is not what I’m concerned about.
I tried to type ‘~?’ literally, but that didn’t work. As I just found out (by bashing my keyboard like a space chimps) “the beginning of a line” mentioned here is to put empty command before entering ~. So all I have to do in my terminal is this:
$ < press Return / Enter >
$ < just press key combination to '~', which in my case Shift + ` >
It will be easier that way especially because I’m accustomed to reuse commands from history, walking through the command each character/word at a time, or plain-ol’ Ctrl + C.
For practice purpose I recommend you to try the ~? command. It will print the other available commands, lookup the manual to find out more.
All this time… can you imagine that??
Ternyata gw adalah Kung Fu Master. 😀
|I am Kung Fu Master.I like to be in control of myself. I dislike crowds, especially crowds containing people trying to kill me. Even though I always win, I prefer to avoid fights if possible. What Video Game Character Are You?