« first day (2238 days earlier)      last day (2710 days later) » 

wim
8:00 PM
Why is the encoded url 1588 characters when the input is only 1150 characters
 
Blame base64.
 
single-line messages have a lower limit
multiline messages can be huge
 
It requires 4 bytes per character, UTF-8 only requires up to 4 bytes.
I didn't really design the spoiler page for code dumps.
 
shame on you
 
I may have got those numbers wrong, but the idea's the same.
 
wim
8:01 PM
hmm, ridiculously low limit
can you give me commit priveleges to fix it
 
nice try
 
It's not related to our Flask code. It's either uWSGI or Nginx, the later of which I don't control.
 
Davidism only wrote the spoiler page to satisfy the requirements given, which were "make Kevin stop asking if we can have a spoiler page"
 
Don't URLs in general have a limit?
 
8:03 PM
3205
Q: What is the maximum length of a URL in different browsers?

Sander VersluysWhat is the maximum length of a URL in different browsers? Does it differ among browsers? Does the HTTP protocol dictate it?

 
You're free to make pull requests if you want to fix stuff. :-)
Oh yeah, the browser can have a limit too, but I don't think it's that in this case.
 
wim
> If you keep URLs under 2000 characters, they'll work in virtually any combination of client and server software
This was under 2000
 
Yes, we'd established that.
 
Indeed, but then there's no point worrying about extending it much more than 1500 as you'll hit a limit elsewhere eventually.
As said, it wasn't really designed for code dumps.
 
We're all cool with throwing IE users under the bus on this one, right?
 
wim
8:05 PM
Code dumps for stuff like AoC seems like a good use-case to me
 
Throwing people that look like they use IE under buses is one of my favourite hobbies.
 
wim
Who did the complex number solution? I want to see that one
neat idea
 
DSM
One of our intranet services rejects connections unless you pretend to be IE. :-/
 
@wim I was thinking about a paste service, but just never got around to it.
 
@wim I put it in a pastebin somewhere, I'll look for it in one second
 
8:06 PM
We can create a wiki page to link to people's solutions for now.
 
5 hours ago, by Kevin
Here is my approach. I originally only had one for loop, and did something like pos += heading * distance, but then I could only get doubly-visited points if you happened to stop and change direction at those points
 
My coworker came up with an interesting matrix multiplication solution.
 
wim
Can you guys see this ok? hastebin.com/awuzihalax.py
 
DSM
I think that's the first use of @ I've seen for matmul in real code!!
 
wim
usually paste bin type sites are blocked at WimCorp
but hastebin seems to work ... (!)
Fun fact: @= operator doesn't work (yet)
 
8:09 PM
They block gist and bitbucket.org/snippets?
Although we did find out that gists onebox now, which is annoying.
 
wim
yes, both
 
Hmm, maybe I'll make that paste service after all.
 
Real heroes don't wear capes
 
wim
we have github enterprise
so we have internal one
and the external one is blocked to prevent accidental code leakage
I didn't hear about AoC before
was 2015 the first one?
I like their web design!
 
Yeah, it was just one guy last year, looks like he's got some more support now.
 
DSM
8:13 PM
Yeah. We wound up enjoying it last year.
 
wim
Hopefully it gets harder as it goes along
because that was a piece of piss
@DSM when you wrote you were going to ask an AoC question in interview , I thought you meant Axiom of Choice !
 
It does, in fact it's already started off harder than the first one last year.
 
wim
I was like, damn, what sort of high tech shit is DSM working on ...
some kind of sock-picking automation or something
 
DSM
Sometimes last year they didn't make part 2 as challenging as they could have, so certain brute force methods sufficed.
 
I tried to catch up and actually finish 2015 a couple weeks ago but burnt out. I think I'm halfway through.
 
8:17 PM
I had just barely enough gumption to finish each challenge last year, so I'm somewhat concerned about the higher starting difficulty this year.
If they just made every question N arbitrary difficulty units harder across the board, I'll peter out in week three
I'll be okay if they just raised the minimum difficulty without raising the maximum difficulty though
 
wim
any of you guys do project euler ?
 
Have done in the past
 
DSM
I'm proud enough not to let that happen, giving up I mean. Last year I came in second twice, so I'd like to gun as quickly (maybe top five) at least once, to prove age hasn't entirely rotted my brain yet.
 
a long time ago...didn't get very far
 
I tried a few PE problems, but I'm not really experienced with math like that.
 
wim
8:19 PM
add me, here's my friend key - 396962_bf52b49f0739b9291b4c1b4c8df0b0cb
 
@wim I'm an admin / problem dev there
 
@wim I'm in the constant state of starting sooner or later, so this is a good opportunity to actualy get involved in a challenge system like this one
 
I got to the 100+ tier in PE, decided I'd never get to the next milestone, and retired.
 
I like AoC because you can tell it could take a long time to run, but you'll never get an input that takes more than a minute or so.
 
wim
@MarcusS cool!! which problems did you make?
I love their problems, very interesting and fun
@Kevin does that mean you solved > 100 problems?
 
8:21 PM
Yeah
 
wim
Props
That's no small feat
 
Every Christmas I think about going back to PE to avoid conversation with my parents.
 
physical education?
 
Towards the end I felt like I was playing a game of "try to find the obscure math fact that you can use to have an O(N^2) solution instead of an O(N!) one"
Like, there was one that you could solve in constant time if and only if you already knew what Langton's Ant was
 
Yeah indeed.
 
8:23 PM
... But YMMV
 
@wim Problems are collaborative for the most part, although individually we come up with the proposals and our initial attempts. Would be somewhat long to list them all here, but the ones I am most proud of are Drunken Tower of Hanoi, Counting Castles, and Roundtable Lottery
 
We should make sopython problems
 
I bet it's hard.
 
@Kevin It's not for everyone -- but that's built in (to some extent) to the intended process. The intention is that you come up against a wall, do some research, possibly learn something cool / new, and use it to help solve the problem more efficiently.
 
@MarcusS I get where you're coming from. I hope I'm not coming across as too critical here. I wouldn't have stuck with it for as long as I did if I didn't really enjoy it.
 
8:26 PM
I bet it's easy to make problems. I bet it's hard to make problems that are solvable.
 
@MarcusS edutainment, yuck :P
 
Surprisingly enough, the hardest problems to make are the easy ones
 
"Find the sum of the first 10**100 triangle numbers". Shouldn't be too hard.
 
"Find the colour of my socks."
Easy.
 
plot twist: it's a pyramid number (I made that up, but who knows)
 
8:27 PM
"Find the first four bouncy cling shrimp numbers, whose definition only exist in a safe in my basement"
 
It has to be easy enough, but not so easy you can brute force it -- but it also has to be interesting, and not a sequence you can just look up in OEIS
 
OEIS is responsible for a good five percent of my project euler points ;-)
 
brb making bouncy cling shrimp number problem
 
Rhubarb all, Kinda busy today :(
 
My, I solved 158 PE problems?
 
8:34 PM
Need python logging + fabric help
 
That's way more than I remember doing ;-)
 
what is PE ?
 
Project Euler
 
ah!
I don't think I ever got past the first 10 :D
anyone up for talking about logging related issue?
 
I know shockingly little about logging.
Most programs I write start and end under my direct supervision in the space of a few minutes at most, so any errors that occur, I can just read the stack trace straight off the screen
 
8:39 PM
hehe fair enough
 
@sul4bh Please read sopython.com/chatroom. In short, if you have a question then please just ask it.
You don't need to ask if anyone knows X.
 
But who logs the logger?
 
@Ffisegydd I posted my question few days before but did not get an answer. So I thought I should check if anyone here want to talk about logging.
 
Again, if you have a specific question or problem then just state it.
 
Yes sir
 
8:43 PM
I know lots about logging, but I might not want to get involved until I know your actual problem. Others may feel the same and might not want to speak up until they know what it entails, lest they be dragged in.
 
That makes sense :-)
 
We have people latch onto the first people that replies to them, so we always just ask that people state their problem and allow people to help if they want to.
 
I don't know anything about logging but if your question is something like "how come I keep getting a syntax error on this line: logger.log("an error occurred"))" I might be able to answer it anyway
So there's value in asking even in the absence of self-proclaimed logging experts
... OTOH most questions are not about unbalanced parentheses, so temper your expectations
 
So, I have a logger with name xyz. It has a handler, StreamHandler, with a custom formatter (that formats different levels in different color).
When I call logger.exception() in an exception context, I get 2 log messages with same content
One is formatted properly using the custom formatter but the other looks like a generic log message
I was wondering how I got 2 messages
I call logger.exception() from a fabric 'with' content, my suspicion is the other extra message has something to do with fabric
 
@sul4bh might also be to do with stdout and stderr, at a wild guess
 
8:50 PM
Are you referring to the behavior as described here: https://docs.python.org/2.6/library/logging.html

Logger.exception() creates a log message similar to Logger.error(). The difference is that Logger.exception() dumps a stack trace along with it. Call this method only from an exception handler.
 
@Ffisegydd could be! I will check
@MarcusS I see 2 messages, both with a stacktrace
 
@Kevin Fun problem: Find a closed-form to count the number of ways to have balanced parentheses given n characters
 
I have a faint glimmer of recognition that I've heard that one before
 
@Ffisegydd looks like not. Anything before the 'with' context shows up only once. Anything after it shows up twice.
 
I would love to see SO's questions... and i would be terrified at the same time... >< PE on the other hand is do able... if I remember my math T.T
 
8:55 PM
@sul4bh does it show up twice even after you're "out" of the with block?
 
FWIW, you can do this...
 
@Ffisegydd yes
 
Strange
 
"out" after the with
but not "out" before the with
 
try:
    raise Exception("whatever")
except Exception:
    import pdb; pdb.set_trace()
    logger.exception("Let's find out what's really going on here")
 
8:56 PM
Maybe the with block is doing something strange like adding a new handler and not deleting it
 
@Ffisegydd my guess is the same. I think its Fabric's doing.
 
Just put that import pdb; pdb.set_trace() line before your log message, @sul4bh, and then step and follow the logging through
If that doesn't actually help you figure out where the problem is, you can get a full refund ;)
 
wim
@MartijnPieters have you done some project euler ?
@MarcusS The problems are great, the site design is lacking - do you have any input on that?
 
can someone help me understand what "async_method" is within this docstring for tornado? is this a python keyword function? I can't find any documentation on it and it's the only example I can find for tornado doing what I want to do - github.com/tornadoweb/tornado/blob/…
also long time no see, hello folks
 
wim
@MarcusS for example the way they do auth is balls
I would also like a feature to store my code for each problem on the site, instead of on github
 
9:00 PM
@WayneWerner anything specific I should look for?
 
@wim I do not have any control over that, no -- but I know that Euler (the person who runs the site) is always open to suggestions in the forum: projecteuler.chat/viewforum.php?f=5
 
The debugger is going deep down into the python logging code
 
@sul4bh you should see the log message getting handled twice
 
wim
Didn't he die back in 1783 ?
 
in logging.py I believe
 
9:01 PM
Code storage though is not something likely to be approved
 
@enderland this is only a guess, but I think a decorated async function within tornado allows yoto specify the ioloop and callback-- so that sets it up to run that single function and immediately exit the loop. But it's been a while since I've done tornado
 
I will keep looking
Stepping out for a while
Thanks peeps !
 
what do you guys do when you have a brain fart and can't think of a solution to a simple problem ? do you come back to it another time ?
 
@enderland I'm pretty sure @KevinMGranger is right there. It's just any tornado asynchronous method
 
Yes, absolutely. Sleep on it, even.
 
9:02 PM
oh, hmm
 
wim
Props to the first person to solve AoC #1 using turtle
 
@MooingRawr Often I talk to the duck
 
@WayneWerner lol..... for some reason atm i can't think of a better solution than using a forloop to exhaust a generator, to sum the numbers that the generator returns... i think i need a nap
 
What are you trying to do?
 
@MooingRawr You mean like sum(range(10))?
 
9:04 PM
@MooingRawr I normally write up a really complicated SO problem with a really detailed MVCE and then find the solution to my problem about 3 seconds before hitting submit
 
cause... that works
 
@WayneWerner okie that's embarassing... i wrote a generator using range and all that jazz...
okie i really need a nap afk... for a bit
 
+1 for naps
 
That's too obvious. reduce(operator.add) is where it's at.
 
9:05 PM
:D
 
wim
@enderland that is the same as rubber ducking!!
 
@wim nah it's more frustrating when you painstakingly put effort into writing up the perfect question with MVCE and everything, only to realize you are an idiot
 
It's just SO-bber ducking
 
wim
ducker sobbing
 
that, too
 
9:09 PM
recbg
 
wim
I have a question for y'all
if you have a function like
def foo(a, b=2, *args, **kwargs):
    print(len(locals()))   # this is on line 1
    ... # other stuff here
is it possible for it to print anything other than 4 ? how?
 
DSM
Would it be cheating to rebind print, len, or locals? ;-)
 
wim
yeah, that's cheating
the question is, can anything inject stuff into locals somehow
or is the scope completely determined by the argspec
 
@wim How about this?
import turtle

SCALE=1

directions = 'L1, R3'.split(', ')
t = turtle.Turtle()
t.left(90)
for d in directions:
    if d[0] == 'L':
        t.left(90)
    elif d[0] == 'R':
        t.right(90)
    dist = int(d[1:])*SCALE
    t.forward(dist)
print(sum(int(round(abs(x))) for x in t.pos()))
turtle.done()
(change your directions, though. And scale isn't actually necessary)
That's actually less LOC than my non-turtle-y solution
 
man I hate tornado
 
DSM
9:19 PM
@wim: well, I just bounced trying, FWIW. And if my understanding of why you can't modify locals() is right, I'm not sure you can pull it off.
 
@wim yes, 158 solutions.
 
DSM
2+ year callback:
Oct 31 '14 at 17:51, by DSM
.. is it weird to admit I think a Martijn-avatar-shaped-plushie would be kind of cool? It could sit on my desk and watch over my coding. Instead of talking to a duck I could talk to a ninja!
(This came up obliquely in conversation earlier, Martijn, which is why I was thinking of it. :-)
 
@DSM SO swag!
 
wim
@WayneWerner well done golf clap
@MartijnPieters Impressive. Mind if I add you? what's your key?
 
do you get to look at your "friends" solutions in PE if you add them or why add them ?
 
9:24 PM
hypersocial fit
 
wim
Yeah you get to see their progress
not their code, though
 
You can see which problems / awards the other person has completed, and which forums they've posted in and how much Kudos they've earned
PE doesn't store code
 
wim
any stack overflowers on here? adventofcode.com/2016/leaderboard
 
But you can post your solution in the forum for the appropriate problem
 
@wim sure, 238811_IOmFOKJB2TyLWe3KNiopKgSBDM0KypNW
 
wim
9:25 PM
the scoring is weird -
advantages people awake in whatever part of the world is awake when the question is released
 
I forgot about AoC until someone reminded me -- unfortunately well after the leaderboards filled up
 
wim
@MartijnPieters added . for some reason you have the english flag, instead of the dutch flag
 
The leaderboards are biased towards people who are awake at 12am EST. Not sure what they could do about that.
 
38568_d7ca872e3a332f7fd30fe612b25ce161 is mine
Seems like getting high up on the final leaderboard, though, is more a function of just being awake at midnight
 
I don't really like coding at 9pm, that's my bedtime.
 
wim
9:30 PM
wow, you're a good boy scout
 
DSM
You can always just time yourself and see how well you did. I did that a few times last year, and was pleased if I scored in the top fifteen or so.
 
Yeah
 
@wim I need my 8 hours of sleep. :-)
 
DSM
hey, wait. Can you? I don't see time information on the leaderboard anymore, am I missing it?
 
Last year you could
 
wim
9:31 PM
Marcus Stuhr solved 555 ??? for real???
 
DSM
Oh, it's on the per-day page, that makes sense.
 
t = turtle.Turtle()
t.speed(50)
t.left(90)
places_ive_been = set()

def go_to_crossover(directions):
    for d in directions:
        if d[0] == 'L':
            t.left(90)
        elif d[0] == 'R':
            t.right(90)
        dist = int(d[1:])*SCALE
        for _ in range(dist):
            t.forward(1)
            pos = tuple(round(point) for point in t.pos())
            if pos in places_ive_been:
                return pos
            places_ive_been.add(pos)


print(sum(abs(x) for x in go_to_crossover(directions)))
 
@wim He did write them, so it's kinda cheating.
 
There's AoC #2 via turtle :D
 
@wim Well we do have to be able to solve the problems we make, after all
 
9:32 PM
:P
 
DSM
@WayneWerner: I should offer my praise as well, your turtle solution is very clever.
 
wim
you mean #1 part b ?
 
I actually was really curious what the path looked like. I was going to try drawing an ASCII maze, but then I'd have to start shifting the origin and that sounded terrible
 
For a simple approach you could do two passes over the data -- one to determine the bounds, one to do the drawing
 
Then I remembered that turtle was a thing. If I had thought about one thing, I would've been able to get #2 with no helps
 
DSM
9:34 PM
Last year I tried to guess at what day 25 would be, and I thought it might have something to do with the main page picture, so I wrote some utilities to parse it. Was fun, but turned out not to be useful. :-/
 
I just looked at the crossover point and said, "eh, that looks like the point that I got, grumble grumble"
 
I thought it was going to be a Pachinko problem
 
wim
my input was weird, had mostly little steps and 2 or 3 huge steps
 
@MarcusS Yeah. entertained that thought as well.
 
or some kind of "Find the shortest path through all ornaments of such and such form"
Looks like the image is different this year
 
9:36 PM
I had actually wrote something in my algorithms class that created a beautiful ASCII tree
Unfortunately for a sparse tree, there was tons of wasted space, because I didn't have a sane way ahead of time to figure how much would be blank
I tried to write something that would iterate over all the rows of text looking for ' ' or '_' and just removing those columns... but that didn't actually work.
 
wim
 
@wim Interesting. Looks like your points are mine rotated 90 clockwise
 
Hey there guys I was looking for a recommendation on how to use python to plot a line of best fit that is a 3rd order polynomial and then becomes linear at a certain point attached is an image of the data that I am trying to fit tinypic.com/r/2076kwk/9
 
@HenryQuekett numpy.polyfit perhaps
 
Ive been playing with polyfit and thats what generates the black line on the graph however I can't fix points that it must go for e.g. define a point that it ends so that from there on I can just use a linear region
 
9:43 PM
Why not use two separate fits? One for cubic approximation, one for the linear section
 
Thats what I want to do however with poly fit I have no way of defining where the line ends, I can obviously tell it don't consider points after a certain value which is what I have done however the tail of the polynomial is still below the start of the linear region and so I can't just continue with a linear line from there
 
@wim I am in the UK, not in the Netherlands.
 
I did try a couple of methods that I found on stack for fixing data points that a polynomial must pass through such as Lagrange Multipliers but haven't succeeded getting them working for my data only in trail cases
 
9:59 PM
when music suddenly becomes 90s ska for no reason
 
wim
ska must have been the most short-lived fad in music
it appeared and disappeared in less than a decade
 
every type of music that played in the 90s was a short lived fad
extend that: the 90s was a short lived fad
 
ska is delightful
 
Do we have a Q&A that describes why {} = [] isn't allowed but [] = {} is?
 
wim
huh
never noticed that
weird!
why should [] = {} be allowed but () = {} disallowed?
 
10:11 PM
Pretty sure it gets caught as a violation during the creation of the AST; best guess is because [] is allowed for grouping in assignment statements, but I'm lost for ().
 
FWIW:
In [54]: dis.dis('[] = {}')
  1           0 BUILD_MAP                0
              3 UNPACK_SEQUENCE          0
              6 LOAD_CONST               0 (None)
              9 RETURN_VALUE
 
Can't find it as a test case in test_syntax.py :-(
All ok Issue 23275 :-)
 
everyone stop what you are doing now
right now
ready?
GO!!!
 
@JimFasarakis-Hilliard I'm pretty sure I have one.
116
A: Why does assigning to an empty list (e.g. [] = "") raise no error?

Martijn PietersYou are not comparing for equality. You are assigning. Python allows you to assign to multiple targets: foo, bar = 1, 2 assigns the two values to foo and bar, respectively. All you need is a sequence or iterable on the right-hand side, and a list or tuple of names on the left. When you do: ...

 
10:28 PM
and dict doesn't unpack, so no {}=[]?
and () is not a tuple?
 
I knew it would be around here someplace. I'm guessing {} in the RHS is forbidden by the grammar which only allows [] and () there, right?
 
() is not a tuple, and there is no support for assigning to a set (what order would you apply the elements in?)
 
@MartijnPieters {} is not a set anyway, right?
 
no, it's a dict, indeed.
And that is also unordered.
 
wim
according to bugs.python.org/issue23275 it's a bug and fixed ?
fixed in what version? I still see it in 3.5
 
10:31 PM
yup, it executes fine in 3.7.0a0
guessing >= 3.6
 
python 2.7++
 
wim
still buggy in 2.7.12
 
Only securites fixes get pushed to the 2.7 branch from what I know. Py2 is ded.
 
wim
 
Nothing can kill a snake. Not even Python 2.
 
wim
10:46 PM
badgers can ...
 
dammit, Badger....
 
Mongeese can
 
screw you and your facts....fact people
 
wim
 
 
wim
10:47 PM
huh ... never considered the plural of mongoose before
. o O { is the feminine magoose...? }
 
The plural of mongoose is mongeese just like the plural of moose is meese
 
@wim I GOT THAT
:D
 
wim
top-la, mec
 
wim
11:08 PM
huh
>>> sys.version
'3.6.0b4 (default, Dec  1 2016, 16:51:45) \n[GCC 4.8.5 20150623 (Red Hat 4.8.5-4)]'
>>> [] = {}
>>> [] = ()
>>> () = []
>>> () = {}
>>> {} = []
  File "<stdin>", line 1
SyntaxError: can't assign to literal
Actually, I prefer the permissive fix to the restrictive fix.
 
the assign to dict literal is probs the grammar on assignment saying no-no.
 
11:31 PM
is this as weird as I think it is?
 
They're trying to recreate "tail". They want to read line by line as it's written
I think their indentation is messed up.
 
But...is it not weird to have an Application class that is sort of your program? With an infinite loop, sort of? But then you keep calling a function in that class?
 
For an infinite loop, sure, that's weird. An application class on its own? Nah.
I think their mental model is a bit closer to CSP / goroutines in how they want to do this. As in, it represents a "stream" constantly spitting out values. Maybe they could be pushed towards coroutines
 
I can imagine an application class, for anything GUI-ish. But this...
anyway, all that answers my question, thanks:)
 

« first day (2238 days earlier)      last day (2710 days later) »