« first day (2257 days earlier)      last day (2916 days later) » 

00:14
(if you only have 3 mins start from 4:10, though I recommend to watch the whole)
wim
wim
01:04
@davidism I put mine up now
I think we have the same basic idea for part 2, but I don't really understand your part 1
did you also (spoiler) and then notice that (spoiler)?
I have this question for an interview, but I don't really understand what they are asking. Can somebody help me figure out.
Given that: '1' mapped to--> 'a', '2' -->'b' , '3'--> 'c'...like wise... '26'-->'z'.

Output should be in the following pattern :
Ex.1) if we input f="111", the output should be: aaa, ak, ka
//(111)->aaa, (1, 11)->ak, (11,1)->ka

Ex. 2) f="131" output: aca, ma
//(131)->aca, (13,1)->ma

Ex. 3) f="101", output: ja
//(10,1)->ja
this sounds like a job for davidism :>
Hello, what is the most pythonic way of doing this in python? paste.ofcode.org/mw37nimDByMCRwRZGr47G7 So far, this is what I got. paste.ofcode.org/aQr6SeFm4HeNriiJaJDE3n
@David it wants to take the ord->chr transformation of the input string with every valid interpretation
@LuisAverhoff what is arr/array in the python version?
@AndrasDeak I see thanks
01:18
if it's a list, array[1:] = array[:-1], probably
@AndrasDeak you can think of arr as a list
@LuisAverhoff I can't; either it's a list or it's not
if it's a dict, it can't be indexed with a range; if it's a tuple, it can't be mutated
fine, yes it is a list.
Out of habit, I always just write arr when Im making an example.
that's fine, but you can still answer "yes, it's a list":P
DSM
DSM
02:09
@AnttiHaapala: so far so good.. your lot may not find it as easy this time!
02:19
good night
03:03
hello :)
03:48
cbg
 
1 hour later…
back on the leaderboard, for now
wooohoo
Can't drop off the board today...
though, I got lucky :P
Hmm, I have a bug somewhere in part2, can't find it for the life of me
05:22
it could be off by one... or free after last range
Feel like I took those things into account
hmm then it is strange :D
wim
wim
0 is a valid ip
of course it is
it is not a valid source / target ip tho
wim
wim
I'm saying, I originally had an off-by-one error for part b due to forgetting that
05:34
I don't understand how it matters though :P
unless your part 1 answer was 0
wim
wim
because the number of ips is actually 4294967295 + 1 , not 4294967295
if you didn't read that it said inclusive of 0
ranges inclusive of both endpoints is weird like that
I still don't see why it matters
wim
wim
forget it
my algo doesn't use the total number of ips.
wim
wim
maybe we had different algo
wait, i'll push my code ..
wim
wim
I originally just used n_max , which cause off-by-one error
wim
wim
these are getting easier and easier huh
it was supposed to be going uphill
day 11 has more solvers than day 17... barely...
wim
wim
not a good measure of difficulty
too many other factors come into it
05:49
what it means is that day 17 was easier...
many people haven't tackled it yet
wim
wim
yeah, 17 was easier
the hard one for me was still 9, not 11 ...
davidism has solved 17 but not 11
wim
wim
wtf, weird
I just used my code for 11 with a few minor tweaks
for day 9 i STILL don't have a valid solution
you and your valid solutions :d
wim
wim
but I couldn't be bothered to find one, really, because my broken solution works good enough for the stars
05:52
it is enough that it works for that input
wim
wim
that's not enough
the input was canned and pre-massaged
LOL marcus got part 1 in under 5 minutes
then took more than 20 minutes extra for part B :)
weird, my part b just fell out almost immediately after part a (had to wait 1 penalty minute for the off-by-one)
I had a crazy bug in part 2, lol
wim
wim
what was the bug ?
silly off-by-one
wim
wim
haha, same one as mine?
can't be, for 20 minutes plus!!
05:59
not for 20 minutes in a row, no (I'm not competing / went to get food), but that was indeed the bug
max_ip off-by-one range bounding :(
agh
wim
wim
oh man, you would have been in top 10 if you didn't go to get food
if you're not competing why are you here as soon as the puzzle is released, and kicking our butts ?? :P I don't buy it ...
I'm always up late, so why not? / I'm not kicking your butts, wat
wim
wim
false modesty .. pffff :P
If I were competing I would just aggregate all my algo files from PE / HackerRank / etc and just throw the book at it all
I have an interval merging implementation somewhere (for instance)
06:02
grr
anyway, this is good for my sleeping rhythm, I wake up naturally now at around 6:30
wim
wim
"here's one I prepared earlier..." :)
instead of 8+ as it turned out to be...
wim
wim
@AnttiHaapala what is all this crud --> github.com/ztane/adventofcode/blob/…
Our day 19's look similar-ish
@wim :D I wanted to see how much method lookups have overhead
wim
wim
06:04
why do you have so much code for part b
two deques to synthesize a single deque with middle-removal in O(1) time? link
beacuse I somehow thought I need 2 deques...
when I don't :P
wim
wim
no, I only ever had 1 deque
what's wrong with two deques?
@MarcusS bceause you don't need 2 deques
wim
wim
06:06
but I had 2 rotates in the loop, then I realised I could merge the two rotates
1 deque is faster
I'll have to try again -- when I had one deque it was a bit slower than my two solution
wim
wim
nice, huh?
so I would rotate to the busted elf, pop him off, then rotate back again
but actually, since one rotate is at the start of the loop, and the other at the end of the loop, you can just squash them together
rotating is o(k) , and popping from the middle of a deque sucks
so you kill 2 birds with 1 stone there
wim
wim
06:21
@MarcusS this is not a reliable way to generate timings in python -> github.com/MarcusStuhr/Advent-Of-Code-2016/blob/…
you should look at timeit module to do it properly
Yeah, aware of timeit -- was being lazy :[
wim
wim
I would be interested to see timing comparisons of the 2 deque vs 1 deque
My expectation is that 1 deque should be about twice as fast
06:38
I'd guess so too
as I popped the stealing elf from one d and pushed it to another - needlessly -
in addition to balancing these 2 after that
07:02
cbg
Christmas avatars?
lemme cahnge
why is firefox so shit
Is it because they spend their resources on SJW stuff?
07:23
Trying to follow this importing tutorial (https://www.codementor.io/sheena/tutorials/python-path-virtualenv-import-for-beginners-du107r3o1), but I'm getting an AttributeError on the line

print my_pkg.my_funcs

Can someone explain what that error is and why I'm unable to reach into the package? The my_funcs.py file exists inside a folder called my_pkg, and I have an __init__.py file in there too.
I'm able to import my_pkg.my_funcs, and then it works. But wouldn't import my_pkg also include my_funcs? Or is the tutorial I'm following missing a line?
no, you have to import modules
@khajvah just to confirm, so the tutorial is missing an "import my_pkg.my_funcs" line?
@Vexir that tutorial is using Python2, you should use some other tutorial
oh yikes
thanks!
07:36
I haven't read the tutorial and I don't think the import system is different in python 2
that was just a side note
the one deque-soluition was about 25% faster
@khajvah the tutorial was updated in november and the author's bio says she's a 2.7 developer
but i believe you!
now onto figuring out how to import Asana's python client library...
@Vexir don't read python 2 tutorials
@Vexir that tutorial is shit.
@Vexir import package doesn't automagically import package.submodule
import my_pkg before there should be import my_pkg.my_funcs or __init__.py should contain from . import my_funcs
I am switching to chromium
commented.
@khajvah wtf?
chromium is shit. firefox is teh shit.
07:45
no, firefox is crap and buggy
and slow
it is getting worse by every release
it's like they have bunch of khajvahs working on it
well... you said it is because of the SJW :D
surely then it cannot be that they have khajvahs working on it :D
question: how can I control the amount of memory cached on the application level?
the data is stored in a dictionary
I want some control so I don't cache everything
night all
use a thing like lru_cache decorator?
there are countless cache modules around
however it is really hard to know exactly how much bytes a python reference consumes!
let me google that
I don't need exact amount. Just a rough estimate is enuough
I guess
07:52
no...
I can also give rough estimate on the amount my objects can take
a rough estimate is impossible
if you know they're strings or things like that then ofc it is much easier
and then multiply that by the amount of objects
but a good cache solution could also count how much time their reccreation would make
well in that case, a lru_cache with set maxsize is all you need
nevermind
07:58
why does this file (github.com/Asana/python-asana/blob/master/examples/…) have the line "from six import print_"? i'm reading the six library's documentation but other than it being a wrapper ensuring python 2 & 3 compatibility, I don't understand the context specifically for "print_"
@Vexir splease stop reading six documentation too :D
@Vexir print_ is needed for compatibility with Python 2.5. Since no one is using 2.5, you don't need print_
except if you need the flush functionality
instead you should use from __future__ import print_function.
i believe that i don't need print_, but i'm wondering why Asana felt that their example file needed it
@Vexir this is my stance on six
becaues some idiots are still running python 2.5 somewhere.
ah cool. that's all i needed to know. fukdat!
the thing is... it is ok to run python 2.5 somewhere... but if you're developing new code then you should consider using new tools too
08:01
I'm subclassing factory.DjangoModelFactory to make my Django model factories. Django version 1.8.11, factory boy version 2.6.0. My problem is that even when I'm trying to build or stub factory boy still tries to save it to the db for me. The evidence of this is - gist.github.com/madhukar93/1dc68bfd51f657bfc6f5e2391ae7ffad
yeah im building an internal tool for just myself to access some Asana projects and run really simple calculations on fields in those projects. so no need for anything robust
so, ditch python 2, ditch six.py, fsck dat all
you need no compat
agreed, just needed to know what it was for so i could safely toss it and know that if i fuck up something later, its not because of that
if you do need, it is easier to backport python 3 project to python 2 than the opposite :d
thank you for teh clarify
i haven't written any non-game development code in so long, this is going to be fun
How do I remove a value from lru_cache?
i have no idea what im doing :D
it it's changed in DB, let's say
@Vexir see also:
though, hmm you have api already written for you :D so forget that :D
08:07
I gonna implement my own cache then. whatcanevengowrong
@khajvah ....
how do you think you're going to invalidate that?!
by listening to Redis changes
hahaha
i am coming from packaged mobile development C# land, classes will be hard to get out of my system that quickly
@khajvah so why don't you cache in redis
@Vexir ah then that's good for you :D
@AnttiHaapala I do, I need application level cache for one fucntionality
08:09
you don't
I do, I have a graph
and I am doing real time traversal
huge one
of course I can do this inside redis/postgres but I don't know how to
cbg
08:24
how do i get pylint to recognize members inside of Asana classes?
also pylint is draconic lol
@Vexir what editor are you using?
VSCode (don't judge me)
I don't think pylint is responsible for that
oh, is this their intellisense being stupid?
no it is pylint
"[pylint] E1101:Instance of 'Client' has no 'users' member"
oh ok, I thought you wanted autocomplete
08:26
i mean that would be nice, but i'll settle for just correct symbol recognition for now
code runs fine, its just pylint not recognizing the declarations
interestingly, it doesn't complain about "Client", but it does complain about members inside Client
@Vexir do you define that member outside __init__?
i have no idea, Client is Asana's class
not mine
re: Jedi, i have the python extension for vscode already installed, let me see if i can turn on jedi as the linter
ah doesnt come with it, will download.
ah shit. i shouldn't be installing packages outside a virtualenv should i? fuck.
@Vexir depends
for global stuff like jedi and pylint, I wouldn't worry
08:34
yeah but Asana
anyway VSCode wants a directory for jedi but i have no idea where pip installed it
there is no ~/Library/Python, so this website im reading is full of shit throws laptop
@Vexir sounds like it
@Vexir pylint is funny
@Vexir /usr/lib/python3
@Vexir well, a client doesn't have users member
the whole file doesn't contain the word users
uh, so how come this code works just fine?

me = client.users.me()
print "Hello " + me['name']
taken from their readme
08:50
@AnttiHaapala can you critic this design?
Please :)
your mixin doesn't do anything
industry repository depends on ObjectDb implicitly
defines an Interface
@AnttiHaapala yeah I can't think of a way of passing ObjectDb to ObjectCache
stop writing classes :D
e.g. you don't need to write a class upfront.
so plug everthing in ObjectRepo?
just write one def get_something_by_id first.
then see if it even has any reusable stuff.
09:05
hm
I see what you mena
thanks
somehow the talk you linked is very relevant
@AnttiHaapala So any idea why that code works if there is no users member in Client?
and more relevant-ly (lol), why pylint doesn't understand that reason?
@vexir remember that pylint is highly configurable - if it isn't doing what you want you can usually make it do "the right thing"
@holdenweb makes sense. i guess im trying to figure out what to even make it do. given anttihaapala's comment that client doesn't have a users member, i'm not sure how the code I cited works. and without that, i can't figure out what to make pylint do that it's not currently doing.
@Vexir question is: what is client
i believe it's the agent through which the entire API access is performed
09:18
@khajvah refactor only into class when you need layerability and reusability.
well, rather, client represents an organization in Asana. a client can have users, workspaces, and projects within those workspaces
@AnttiHaapala identifying that I need layerability and reusability is the hard part
if I ever need
according to the Asana-Python readme, a client definitely has users as a resource. so maybe it's not directly a member, but some way of linking things together in python that i don't know about?
@khajvah if you are like "oh I just copy-paste this function"
if you copy paste, it should be a signal that you're doing something wrong.
if you're happy writing everything from scratch, you're doing it right, or being stupid.
09:52
Cabbage :-)
@AnttiHaapala I removed a few hundred lines of code
following your suggestion
Guys I need some help. It's explained in: dpaste.de/4kiW
10:09
cbg
"python read file" yields LPTHW as third google hit:////
I think this is the first day of AoC where I Did It The Smart Way from the beginning, rather than being forced to do so by an inefficient first implementation
@Emre the simplest way is to have a last_text variable. You logic post-try/except would then be:
3 ms/loop for part1+2 \o/
if text != last_text:
    print("Text changed")  # Smart programmers use Python 3
    last_text = text
You have to remember to give last_text an initial value, otherwise you will get a NameError exception from the if. None should do nicely.
But @holdenweb
Are you sure this would work? Because the text wouldn't be stored would it?
The next time the function gets called the last_text would be None again
@AnttiHaapala nice, thanks!
"Orvon silmä kyyneliä täynnä.", talk about a strong dialect:D
10:22
If this is inside a function then you have to externalise it, which is something of a pain. If you are calling the function repeatedly inside a loop you might think about substituting a generator instead. But the code related to your question contained no def statement. Are we supposed to be psychic? That's the most important part of the problem!
Usually, if the code structure you are trying to create gives you logistical difficulties of this nature then it's time to start wondering if there might not be a better way to achieve the desired end
You may be struck by the thought "I could use a global variable for that." You could, but please don't
The reasons being a) it makes your function non-reentrant (which may or may not be a pain); b) I will chastise you if you do
Happy Festivus, everybody
10:53
@holdenweb Glad tidings of the season to you and yours.
MOrning everyone.
Very brief drop in this morning.
morning
user6820627
cbg did you earn any hats?
11:10
nooo:P
bleh keyboard layout
Cabbage
user6820627
@AndrasDeak i am going to tell you a secret hat. Its name is TheyLive
I am not able rightly to apprehend the kind of confusion of ideas that could provoke someone to want to do this: stackoverflow.com/questions/41240680/…
@LearnHowToBeTransparent do I care?
11:23
@AndrasDeak hmm :? :D
is the "Árva szeme könnyel tele." natural? word ordering in Finnish is rather poetic
no, same here
it's missing an article and the word order is poetic
"Az árva szeme tele van könnyel" would be colloquial
oh, unless the "orphan" relates to the eye, not the owner:D
@AndrasDeak ahha :P you got articles in Hungarian
hmm egy is very close to both yksi = one, eräs = a... though they're not needed at all...
And do you use yksi for the indefinite article?
no, we don't need indefinite article.
ah, OK
11:29
word ordering takes care of the definiteness
pöydällä on omena = there's an apple on the table...
ah but we have a very flexible sentence structure;)
omena on pöydällä = the apple is on the table.
btw grammatically, "egy" as an article vs "egy" as a cardinal are like "in" in "for k in lst" vs "if k in lst" :P
@AnttiHaapala so you stole that from Russian too
no, similar structures are everywhere in Fenno-Ugric languages
the topic comes first in the sentence unless like yoda you speak want to
@AndrasDeak they say that and is a loan word in Finnish
haha:D
you guys are crazy
11:46
original finno-ugric languages used repetition instead...
so if you'd want to say this and that do X, you'd say This X. That X.
so much redundancy:P
they were nomads, why talk about complicated things
yeah, kill man, take woman, good horse, where water
talk about reindeer, snow, fish, trees, huts, magic mushrooms, weather
what horse?!
at one point we switched to horses, I'm culturally obliged to ignore reindeer as a method of transportation
11:51
pfft
so damn cold
-10
@khajvah I wish we had that here
how cold is it in your area?
+ :(
and really slippery
3.1 now
12:00
the good news is, this is the coldest day this year accodring to accuweather
I like cold
although yesterday accuweather threatened me with a freezing drizzle; that I don't miss
0C is cold too
but it's cool cold
@holdenweb This is inside a function
12:16
cbg o/
reading :P
let's see how much I get without google translate :D
ah nice RAY is with it...
so it means that it's not grey biz here...
cbg everyone
12:22
does ray has the exclusive right on gamblin?
yea
and no
there are currently 3 actors: Fintoto for horse racing, Veikkaus for lottery and sport result betting, RAY for one-armed bandits and online playing, casinos.
ah ok ;)
though there have been talks about merging the 3
@manuzi1 I guess I got most of it, my German (or Austrian especially) is rather rusty.
cbg, @heather
@AnttiHaapala Nice, hehe. What should I say about my finnish, except kivennäisvesi :D
12:31
well, that's a good start
well there is a story ^^
We were in Helsinki and had a flight up to Rovaniemi. Unfortunately I was drunk the day before and in the plane I need many kivennäisvesi :D
:P
been to Austria only twice, stopovers in Wien when travelling to Johannesburg w/ Austrian airlines and back again
I'm going to Vienna in February
conference?
sort of (winter school)
12:45
oha, where? ;)
Wien:P
haha, more details :D
in Austria
:D:D:D
@manuzi1 so what were you doin in rovaniemi then
12:53
Friend was on erasmus ;)
And so we visited him. We wanted to travel around, but the weather was rly rly bad. So we end up day for day at the Lordi-place. :D

« first day (2257 days earlier)      last day (2916 days later) »