« first day (2251 days earlier)      last day (2922 days later) » 

13:01
That was probably a major factor in the success of the C64: the fact that you could use a normal TV as a monitor. It wasn't great, but it worked. But I'm glad we had PAL TVs and not NTSC...
PAL ftw
but then they say that pal ruined the gaming experience...
at least 50 Hz
was the frequency different in oz
nope, the same
Yeah, we use 50Hz mains here. But I'd rather have more pixels than a higher refresh rate.
How can PAL ruin the gaming experience when (a) gaming on screens at home was a very new thing and (b) there wasn’t an alternative around (it’s not like people who used PAL had easy access to NTSC for comparison)?!
@poke for nintendo, say...
not for c64
13:09
So, the manufacturer claims it ruined the experiene?
noooo
the gamers say that because the games were made in the states & japan, then exported to europe, the game just would run at a lower clock rate to match the 50 hz.
uhuh
Big Game ruined it!
I wouldn't know anything about it, I have not once seen a NTSC receiver, watched the pic, or played on it.
also, recbg
13:12
@AndrasDeak this?
I just scored rather nicely with a quick Python / C question. stackoverflow.com/questions/41143393/… I guess the behaviour of the OP's code is a bit mysterious if you don't know what's going on, and people like it when mysteries are solved.
So it turns out that md5 cycles have an average length of 2**64, which rather dashes the plan of certain users to optimize certain parts of certain coding challenges...
Breaking news: I didn't optimize anything:)
My part 1 ran in two seconds, and I was very surprised when my part 2 finished in fewer than 2*2016 seconds.
13:25
:)
I guess md5 takes up much less of the total runtime of my program than I thought.
570 ms per loop for part 1!
Isn't there some tool that can analyze how long each section of your code takes to execute...? I feel like I saw someone using it this week.
with printing
hi all, I have a tensorflow python related question.
13:26
@Kevin various profilers, such as runsnakerun and the other one
df_train[LABEL_COLUMN] = (df_train["mutation"].apply(lambda x: "TVH" in x)).astype(int)
results in TypeError: argument of type 'float' is not iterable
Dec 5 at 16:54, by Andras Deak
Sep 27 at 17:57, by wim
@davidism snakeviz ... game changer!!! thx
@Kevin joking aside, that is the reason why the encryption needs to be rekeyed after some time :D
@Tarscher youd df_train["mutation"] might be a scalar float
check its type()
13:27
nevermind
it wouldn't have an apply method if it was a float
@Kevin FWIW, there are some good cycle detection algorithms at en.wikipedia.org/wiki/Cycle_detection I coded Brent's algorithm in Python to detect MD5 cycles a few years ago, but it's not very fast. :)
@AnttiHaapala encryption?
You mean the one Santa uses? Or something IRL? Because I keep hearing that encryption and md5 in a sentence is a no-no
@AndrasDeak Cool, I'll take a look
<class 'pandas.core.series.Series'>
13:29
you can make a stream cipher by xoring a prng with the plaintext.
but you better rekey often :d
type of df_train["mutation"]
@Tarscher yeah, I understood
OH right, silly me
@Tarscher your lambda checks if "asdf" is in the input
My Brent code is ok at finding cycles in a short substring of the MD5 digest, say, up to 12 hex digits, but forget it for anything longer.
your items in df_train["mutation"] are floats, so you can't look for a string in it
@PM2Ring Understandable.
13:30
it has to contain either strings or iterables of strings for that to work
do you know why it are floats?
i read them from a csv
@Tarscher seriously??
I tried a quick-n-dirty tortoise and hare cycle detection and found nothing after like five minutes of waiting
df_train = pd.read_csv(train_file, names=COLUMNS, skipinitialspace=True)
@Tarscher Oh, that makes it clear. I know the problem.
13:31
COLUMNS = ["age", "code", "reason", "flow", "mutation"]
you're not reading strings from the file
@Kevin mine has 0.56s for part 1, 55s for part 2 (with printing enabled in both cases)
100x slower
I don't know precisely how long my part 2 was because I ran it at the beginning of my morning routine and it was finished by the time I returned
Somewhere between 0 and 5 minutes, then
@AndrasDeak It depends how you're usingthe MD5. Eg, it's perfectly safe to use it in a HMAC en.wikipedia.org/wiki/… although the security of the MD5 hash function itself is severely compromised - the currently known " attacks on HMAC-MD5 do not seem to indicate a practical vulnerability when used as a message authentication code."
really difficult to optimize the md5 shit...
needlessly converting to string and back again..
but then, binascii.hexlify didn't help either
13:37
So all of HMAC-MD5's practical vulnerabilities are unknown to the community, so when you do get pwned, you won't even know how it was done, which is even worse! Solution: switch to a hash algorithm with many more known vulnerabilities than unknown ones.
@PM2Ring is that essentially the "instead of comparing your entry to your plaintext password, I'm comparing it to the salted md5 hash of your password"?
@AnttiHaapala You know what's good for getting md5 hash digests as strings? Python 2.7 :-P
ah, probably more general than that
@Kevin burn:D
None of this converting-between-bytes-and-strings nonsense
@AndrasDeak Not quite. HMAC has a hash inside a hash. See the Definition section earlier on that page.
13:39
@Kevin the downside is that I need to convert back and forth; the upside is that I finally had to figure out how bytes and str differ
(I already did that for the first md5 challenge)
@PM2Ring thanks, duh
I assume based on no research or facts, that each element of a bytes object has a value between 0 and 255, whereas strings have a much wider range
my run for 45 sec, but part 2 gives correct answer only for example ;/ have no idea what can be wrong
Unless you're in 2.7 in which case strings also are limited to a byte per char
can anyone of you give me your input and expected result for part 2?
@Kevin You assume correctly
13:41
@marxin are you sure it's correct for the example?
I first misread the part 2, and though that we have to append to number in each iteration
thx @Kevin
I keep forgetting that our runtimes are not directly comparable in these kind of challenges, on account of our inputs being different.
yeah Im sure, gives correct answer
@Kevin ffffffuuuuuuuuuuuuuu
@Kevin though as I said I tried binascii.hexlify but it wasn't really any faster
13:44
I might even venture to guess that a string of length 1 can take up unlimited size by cramming together as many combining characters / zalgo marks as you can
... Unless adding the same combining character twice isn't valid, in which case your upper bound is the number of combining characters that exist.
To counter my earlier burn, I get the feeling that 2.7 hashlib has to do more work turning the hex digest into a string than 3.X hashlib has to do turning the hex digest into a bytes, so my claim that 2.7 is better is spurious
The enterprising "well, actually"er would run benchmarks to determine the faster version, but I can't be bothered myself
@Kevin it finds your key as 65th :>
On the gripping hand, if 2.7 strings and 3.X bytes are implemented in similar ways, then the difference would be negligible. Now we are thoroughly in territory that I know nothing about, and I'm out of hands, so I will let the issue rest.
FWIW, in Python 3
>>> chr.__doc__
'Return a Unicode string of one character with ordinal i; 0 <= i <= 0x10ffff.'
0x10ffff == 1114111
Come to think of it, I'm not sure if a single zalgofied character actually has a length of one according to Python
Exactly. It could use multiple codepoints. But the bottom line is that codepoint numbers are in 0 <= i <= 0x10ffff although some of those codepoints are unassigned.
13:53
In [300]: len('x̴̉̋́͛̍̾̊̈́͠')
Out[300]: 125
:D:D
>>> len('̷̲̳̮̦͎̜̦Z̫͇̠͢A̮̪̲͉̯̭͕L̨̪͉̙͖͈͖G͖̻͚̜͚O̥̩̣̯̪!̵')
43
C:\Users\Kevin\Desktop>py -3
Python 3.5.1 (v3.5.1:37a07cee5969, Dec  6 2015, 01:38:48) [MSC v.1900 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> len("♪")


C:\Users\Kevin\Desktop>
According to my computer, the length of a unicode music note is "crash to desktop with no error message"
4
wat?
WAT :D
>>> len("♪")
1
>>> ord("♪")
9834
13:56
I invoked the magical chcp 65001 command, which is Windows for "make unicode work please", but it seems even that potent charm has its limits.
what you win by using py3 you lose by running it on windows
>>> bytes("♪".encode('utf8'))
b'\xe2\x99\xaa'
This is why I stick with ASCII.
ANSI. Whatever.
:oops: that bytes wrapper is redundant. Doh. I meant to do something like this:
>>> [i for i in "♪".encode('utf8')]
[226, 153, 170]
13:59
I came across this challenge to find the unique number on a list. I couldn't figure out, so I look into the solution. In the solution it show the code, but it doesn't not explain the code. Can anybody of you guys explain this code to me.
@AnttiHaapala Done. Added a bit of explanation stackoverflow.com/questions/40330896/…
So I should've done
>>> list("♪".encode('utf8'))
[226, 153, 170]
afk again, busy day at work. :(
@David edit message, ctrl+k for code formatting
then you'll have whitespace
def singleNumber(A):
    ret = A[0]
    for i in range(1,len(A)):
        ret ^= A[i]

    return ret

A = [1,2,45,4,5,7,8,9,1,2,4,5,7,8,9]
result = singleNumber(A)
print (result)
14:01
which part don't you understand?
The unique number is 45
this part
ret ^= A[i]
ah, does that make use of the fact that the other numbers appear exactly twice?
yes
@David that's equivalent to ret = ret ^ A[i]
@David ^ is the "bitwise xor" operator. Doing an xor with the same number twice is the same as not doing it at all; 23 ^ 7 ^ 7 is equal to 23. So when you xor ret with every value in A, any value that appears an even number of times cancels out with itself, leaving only the numbers that appear an odd number of times.
14:02
@David That only works correctly because each repeated number occurs an even number of times, and there's a single non-repeated number
>>> singleNumber([1,1,1,5])
4
this looks like one of those awful interview questions
Whoops, how did that happen? 4 isn't even in the list.
IOW, 0^x == x and x ^ x == 0 for all x
(answer: 4 = 1 ^ 5)
14:05
What would be the best way to find that solution.
I'd be inclined to do something like singleNumber = lambda seq: next(k for k,v in collections.Counter(seq).iteritems() if v == 1)
Note that the result of singleNumber([1,2]) is undefined
might as well numpy.unique(A)[0] :PPP
Or items in place of iteritems if you're on 3.X
@David there's no best way
BTW, a more Pythonic way to write that function is:
def single_number(a):
    ret = a[0]
    for x in a[1:]:
        ret ^= x
    return ret
Or, using a functional approach:
from functools import reduce
reduce(int.__xor__, a)
In Python 2, the import isn't required, but it's still a good idea, to make it easier to port the code to Python 3
14:09
I'm having connection problems:/
@AndrasDeak that only works if the list is full of integers
@David why?
Oh, you mean the XOR version? Yes.
@AndrasDeak yes
Here's a general way to find non-repeated items in a list:
from itertools import groupby
a = [1, 2, 3, 1, 4, 3, 3]
print([k for k, g in groupby(sorted(a)) if len(list(g))==1])
#output
[2, 4]
from collections import defaultdict
d = defaultdict(lambda: 0)
for k in a:
    d[k] += 1
print([k for k in d if d[k]==1])
14:15
Thanks guys
I've grown fond of defaultdicts
no worries
there are many cases where they're handy
I'm a Network Engineer that do small automation script and I'm interviewing for a Job that require more python scripting.
Good news! You will almost never need to use xor in any real-world Python programs.
13 mins ago, by Andras Deak
this looks like one of those awful interview questions
14:17
@Kevin very yes
I estimate that bit twiddling takes up about 0.00000001% of my job responsibilities
much sherlock
Might be a bit more for Unix users, who have to, I don't know, futz with chmod settings or something
I don't really know what Unix people actually do. write driver code with a magnetized needle, I assume.
Again, connectivity issues:S Main doesn't want to load either
good thing I have work to do
Almost all the Python code I've written that uses XOR is encryption-related. And you know what they say about rolling your own encryption. :)
One cute use of XOR is affectionately known as "Gosper's Hack". Given a starting integer n, it finds the next integer n that has the same number of 1 bits as n. See HAKMEM Item 175 for details.
14:28
good morning everyone
Gosper is revered in the Game of Life community: he found the first Glider gun, as well as many other awesome Life forms.
Ralph William Gosper, Jr. (born April 26, 1943), known as Bill Gosper, is an American mathematician and programmer. Along with Richard Greenblatt, he may be considered to have founded the hacker community, and he holds a place of pride in the Lisp community. == Becoming a hacker == In high school, Gosper was interested in model rockets until one of his friends was injured in a rocketry accident and contracted a fatal brain infection. Gosper enrolled in MIT in 1961, and he received his bachelor's degree in mathematics from MIT in 1965 despite becoming disaffected from the mathematics department...
wow, cool guy
"hacker" should've kept its old meaning
Agreed. On both counts.
wow Wesley Crusher learnt programming from Automate the Boring Stuff with Python.
Morning cbg
14:33
A few years ago I "accidentally" invented an improved memory loop in Life. I say "accidentally" because it seemed pretty obvious to me, and I was surprised that it was new. Someone showed it to Bill Gosper, and he said "yeah, it's ok", or words to that effect. :)
@AnttiHaapala I assume you mean Wheaton:P
@AnttiHaapala the character or the actor (Wil Wheaton)?
Because if you meant the character, then Wow, they use Python in Star Trek?!
:D
@MartijnPieters in 1994? :D
that would've crashed all the time
and one couldn't have gotten anything done
14:35
@AnttiHaapala In the future, you dummy! :-D
"I'm having a lot of fun breaking things and then putting them back together, and just remembering the joy of turning a set of instructions into something useful and fun, like I did when I was a kid."
- Wil Wheaton, WIL WHEATON dot NET
@PM2Ring I'm unironically jealous.
@MartijnPieters python 3.1415927 because they swore they'd never break on another major version change
@Kevin Thanks. :)
@AnttiHaapala set of instructions as a kid: "stand there, read your line"
"look more annoying"
14:38
damn wesley crusher writes his domain in upper case, and manages to use CSS in such a manner that the result looks almost identical to the 90s table layouts. clap clap.
Someday I too hope to be deemed OK by a luminary.
I'm assuming Wil Wheaton did some programming as a kid. Probably in some dialect of BASIC.
but only very basic stuff
It must be getting late... :)
@AndrasDeak Python 3.14159265 - we removed all the sharp edges
14:40
Now to execute my plan to become a Napa Valley sommelier and serve wines of moderate quality to customers that look like tech billionaires.
Holy yam! I've hit repcap on that printf question! Yay!
If I stand in one place long enough, statistically speaking it's a sure bet that Steve Wozniak will eventually pass in front of me.
@AnttiHaapala no, by stardate <...> those are actually integers, next version is python 3.1415928
anw I wasn't too annoyed by wesley crusher when I was young
@PM2Ring hnq?
congrats, anyway:)
14:41
Wesley does not directly annoy me but I enjoy hating him anyway
more like... "in 23rd century I'd get recognition..."
@PM2Ring hnq. :)
@AndrasDeak Maybe. It's not in my HNQ list. But I did rush to get an answer in, and I saw it seconds after it was posted. I added more details after the initial submission, but it had already got 4 or 5 upvotes by then.
I have a simple question. When I want to go through a list I use for example:
list = [1,2,3,4]
for i in list:
    print i
For preview question: I got something like this:
print([k for k, g in groupby(sorted(a)) if len(list(g))==1])
is this the new way to go through a list
@PM2Ring it is, I found it here a few minutes ago
@David if you're not familiar with list comprehensions, you should first read a tutorial
14:52
@AndrasDeak thanks, I was actually looking for the term. Thanks a lot
@David BTW, never use list as a variable name because that masks the built-in list type, which can lead to weird bugs. The same goes for other built-in type names like str, dict, and set. And for built-in function names like max and min
@David first of all, decide whether you are using Python 2 (wrong) or Python 3 (right)
@AndrasDeak Thanks
rhubarb till later:)
Rhubarb time for me too
14:57
cbg
What is it called when an application creates a little icon in the top area of the mac bar? A tray icon?
bye guys
hey @AvinashRaj
cabbage rolls
On today's guess the error:
E TypeError: 'classmethod' object is not callable
@classmethod() ?
15:09
Nope
classmethod = somethingThatIsNotCallabale
raise TypeError("'classmethod' object is not callable")
class Foo:
    @property
    @classmethod
    def bar(cls):
        return None

Foo.bar
I could have sworn that worked. I guess I don't fully understand descriptors yet.
I see you've suppressed the ToyingWithDarkForcesBeyondYourKenWarning...
Would that normally issue a warning?
DSM
DSM
15:21
Morning cabbage.
Yeah but it's not usually noticed because it isn't piped through stdout or stderr, but instead a mysterious blind crone on a streetcorner
ran out of advil. Dealing with horrible headache after last nights hockey game
Clutching your arm with more strength than an old lady should have, but still brittle enough for you to shake her off and mumble "sorry, haven't got any change" in response to the prattling you weren't quite listening to
in a meeting. Can't go to pharmacy
pain....so much pain
Playing hockey, or watching hockey?
15:25
playing
DSM
DSM
@idjaw: hockey pain is bad pain.
Uh, did you take a hard hit? Probably get that checked out
@DSM yeah...and the pain lasts longer these days.... aging......I feels its
@poke 'tis a silly little convenience thing
15:29
@KevinMGranger Oh, it wasn't a hit to the head. The pain was on my right side and in my arm...the pain in my arm kinda propagated to muscular pain in my neck which lead to the hadache
this has happened before....physio, advil, a few days, and back on the ice
#hockey
#hockeyneverchanges
DSM
DSM
@idjaw: I don't mean to discourage you, but it doesn't get any better.. if anything, though, that fact should encourage you to play as much as you can when you can still recover!
@DSM yeah. that's the plan! Until I can't anymore.
Soccer was the worst surprisingly
Oh, that's the key. """the setter didn't work at the time we call "Bar.bar", it because we are calling "TypeOfBar.bar.__set__", which is not "Bar.bar.__set__", """. Now it makes sense.
I was in physio a lot when I was playing soccer
hip, hamstring, foot.
not surprising really :P
I once played video games for too long and my hand started to hurt
15:32
I did that too
My hand cramped up/fell asleep
I got annoyed because I still had another solid three hours of gaming ahead of me
not sure if I like gitlab
ssh_exchange_identification: Connection closed by remote host
fatal: Could not read from remote repository.
this is slow
give it more resources ;)
If I do too many sit-ups, my big toe starts to hurt. because I wedge my feet under the bureau to get leverage and the bureau has fairly sharp corners which prod me even if I wear two pairs of socks.
need additional pylons nodes
Have you considered deferring to plancks? You can do them in no time.
15:35
@AnttiHaapala is gitlab your CI solution at work?
@KevinMGranger Those are fantastic exercises. When I still had time to keep up with a gym routine, I was doing those almost every session.
guys la la land was a super good movie
pro-tip for linkedIn...start supporting multi-language auto-responses
@corvid what's that
it's a movie
@idjaw what's that mean?
15:41
@KevinMGranger This gave me the smallest nonzero measurable amount of amusement.
a musical movie with emma stone and ryan gosling google.ca/…
@corvid when you get messaged on linkedIn, they offer you three canned responses if you are interested or not. I get a lot in French, and sometimes I just want to use them, but they are always in English, so I have to re-write them. Would be great if they started venturing down supporting different languages
DSM
DSM
Mais oui!
@Kevin oh my goodness........I just got it... Well played @KevinMGranger
@idjaw oh sometimes I get messages in chinese and think "why would you ever think I would speak chinese?". I kind of wonder why they think I would
@corvid Well, when dealing with something as ambiguous as a bird, it's hard to tell where exactly you are from. So it's a best effort really.
:P
15:45
yeah I expect my messages to be formatted as "caw caw. Caw? CAW!"
Btw. You should accept that offer if it comes to you. That's a good salary.
yes, that many shinies a year is worth a lot to a bird such as myself
@corvid Well some variant of Chinese is spoken by like a billion people, so it's a more reasonable guess than any other.
yeah
considering probability, chinese is the best choice
I'm trying to figure out the motivation by some people who add me on linkedIn. I recently had a car salesman wanting to connect with me. We have no mutual contacts. I don't get that one.
15:47
Languages by percentage of world speakers. Mandarin: 14.1%. English: 5.52%. Obvious choice right there
DSM
DSM
I don't know if those ratios hold if you restrict to regular email users.
@corvid haha I often need to help my friends respond in Vietnamese :D
Yeah, never mind that nine tenths of them are rice farmers with no Internet access.
@Kevin chinese languages are spoken by well over 1 billion and one single language by ~1.
I wouldnt be surprised if linkedin is blocked in china
DSM
DSM
15:49
Oddly it's not.
@AnttiHaapala I was going to say "like two billion" originally but I rounded down because I figured half of them wouldn't be able to understand the other half so it's not entirely fair to count it as one homogeneous group
it's blocked in Russia though
^^ really?
interesting
is there a legitimate reason why?
@idjaw "is there a legitimate reason", wat?
next question: "is there liquid water that is not wet"?
DSM
DSM
Having lived in China, the development of the idea of a unified "Chinese people" is an impressive accomplishment. It's immediately clear to an outsider that there are countless subpopulations, far more different from each other than we'd use to distinguish a separate people in a European context. [Edited because it was too long a sentence..]
15:52
@AnttiHaapala Hey! I use that too!
even Vietnam has 54 recognized native ethnicities.
I have more in common with you guys, who live all over the world, than I have in common with the guy who runs the farm four blocks from my house. Patriotism is an outdated concept.
@Kevin that is one question in the political compass
DSM
DSM
I have more in common with you guys in some ways than I have with members of my own family, but I don't think family is an outdated concept. In some ways that are very important to me, I also have more in common with some rice farmers in China without internet access than I do with most of you. Networks of connection can be complicated.
15:55
Where "all over the world" means North America or Europe, right? The room is more diverse than others, but it's still western-culture dominated. Unless there's someone I'm not considering, sorry
We have a few scattered outside of Europe/North America
but the majority, yes
Man, I can't make a snappy soundbite out of that. Why is the real world too complicated to encapsulate in simple absolute statements :-(
But if we look back a few generations, it is interesting to see what parts of the world we are connected to
My dad started drawing out our ancestry. It was very interesting.
I always wonder about it when Im in TESCo, buying fruits
world became so small
but I dont think that it means that patriotism is outdated even if we dont fancy fruits from our country ;)
my patriotism comes out for hockey

« first day (2251 days earlier)      last day (2922 days later) »