« first day (2623 days earlier)      last day (2332 days later) » 
00:00 - 18:0018:00 - 00:00

12:03 AM
It was a - where I should have put a +. Grumble.
 
bah!
 
humbug?
 
bah ~ argh
 
I thought 'tis the season to bah humbug
 
I guess it could be... I'm not the humbug sort. Not religious, but I like the holidays. I don't think those were ever assumed to be dependent, but w/e (-:
 
12:33 AM
Anywho, code, such as it is, pushed to github.com/mjpieters/adventofcode/blob/master/2017/…
 
Great use of the notebook!
 
@MartijnPieters s/determinant/discriminant ;)
 
I thought I may as well write down the problem breakdown right there. I still managed to transcribe it wrong.
@AndrasDeak I also misspelled acceleration, and there’s a redundant check for inequal velocities in there. Sleep gets priority however.
 
I fully support that, I've been starting AoC in the late beforenoons because I'm not willing to give up sleep for a game :)
 
 
2 hours later…
2:45 AM
Beautiful approach and solution @MartijnPieters, thank you for sharing. Where can I up-vote it?
 
3:12 AM
hi, i am using datetime library, trying to use the date function.
Using "import datetime" doesn't seem to work as it returns date is not defined.
only "from datetime import date" works.

Why is this so?
 
 
2 hours later…
5:04 AM
@james datetime is the module and date is the class inside the module. If you import all of datetime, you can access all the classes in it using dot notation. using the from datetime import date imports just the date class and allows you to use it without the dot notation.
 
thanks @JGrindal I understand it now!
 
5:27 AM
25/21 today... ezgaem :D
 
5:37 AM
wow that was truly nphard
such a headache :F
I mean, headache the whole morning
@MartijnPieters your find closest is still flawed :D
@MartijnPieters think about [a, v, p] = [2, 1, 0] and [2, -2, 0]
ok leaderboard capped
 
implied_vols[i][j] = data[j][i] #we are transposing the data here
i get this name error: name 'j' is not defined
what does this mean
 
...
that you never set a value to that variable.
that's not how Python works.
python is magic but not that magic :D
 
:D
it didn't ask me for i though haha
okay i found the bug
 
it is exactly because it evaluates data[j][i] first
 
i am so new to python, sorry for silly questions
 
5:50 AM
Hi @pythonRcpp ..
What is the best audit log for python django (DB level) ..
Also need to consider nested objects also ..
Any one used audit log libraries ?
 
@AnttiHaapala I think I also got a headache from coding that.
 
I had it when I woke up
even coffee didn't help
@Unihedron where's your solution
and @wim
 
wat, how does each_slice work?
@Unihedron dude you need some indents!
 
it's ruby: [1,2,3,4,5,6].each_slice(2) #=> Enumerable((1,2),(3,4),(5,6))
also see .each_cons, which gives (1,2),(2,3),...
 
5:58 AM
that's some unreadable code.
 
@AnttiHaapala It is very unreadable.
I want to write a programming language that combines functional with readability.
 
6:33 AM
@Unihedron what's your runtime?
 
for the 18 version? was instant for 5
 
ye
this takes 3 seconds for part 2 now
 
strace isn't giving me the right benchmark, what's the command again?
 
time :D
 
real	0m12.693s
user	0m12.459s
sys	0m0.199s
 
6:49 AM
so surprisingly fast
 
fast enough to be on the leaderboards
 
 
1 hour later…
8:06 AM
cbg
 
8:26 AM
cbg all
just to avoid doing needless debugging in today's AoC, the 'or' in "The artist explains that sometimes, one must rotate or flip the input pattern to find a match.", is that an or or an xor?
 
8:38 AM
morning
 
If anyone asks themselves the same question as I, the examples actually explain that it is an or and not an xor.
 
9:18 AM
wow, I got hung up on a nasty subtlety specific to my choice of algorithm view spoiler
 
9:30 AM
Run time on part 2 is 9.45 seconds. Working on improving now.
 
@piRSquared 5.5 secs here
omg todays aoc was awful
I hate tasks like this
 
I had it coded up in about 20 minutes. But I spent two hours finding that bug I mentioned above. I like this sort of thing.
@marxin what's the time on 5 iterations... mine is 6.3 ms
 
real 0m0.019s
user 0m0.012s
sys 0m0.005s
its slower :p
but Im proud and surprised that it was working out of the box, testing it with example input was enough (although it took me longer than 20 mins)
 
There is a bizarre reason I had an easy time coding it up. I have been working on manipulating blocks similar to this for another purpose. However, that didn't get me over the hump I needed to get over. That took an emotional toll
 
9:56 AM
@AnttiHaapala Yeah, I know and don't care.
 
10:16 AM
@piRSquared hmm,
 
@marxin Same here. I have a total of 20 loops/comprehensions, and 9 return statements in 78 lines. That was some convoluted code that worked surprisingly well.
 
hi all
 
cabbage
 
cabbage
 
What's cabbage?
 
melon
 
watermelon (-:
 
asparagus...
 
jjj
Lettuce?
 
It's just a nice vegetable name
makes me hungry ;)
 
jjj
10:28 AM
It is, although I prefer artichoke.
 
carrot artichoke bean
In any case I came here for something more serious (or is it?): I have a list L of indices (e.g. L=[0,0]) and I would like to evaluate an array in these indexes, say A[0,0]. Writing A[L] clearly does not work. But A[L[0],L[1]] is quite long (since in reality my L is a bit more complicated). Any tricks?
 
jjj
@Kore-N :D I dunno, languages without verb phrases.
 
you can call __getitem__ explicitly, which is what [] does implicitly
 
They should add noodle types for verbs
 
jjj
@ArneRecknagel Can you use __getitem__ to pass a list of indices at once?
 
10:36 AM
nope, just one
but its a function, unlike [], so i bet you can do some fancy one liner with it. currently trying it out
 
jjj
oh, ok
 
or simply this
def deep_idx(l, idcs):
    for idx in idces:
        l = l[i]
    return l
deep_idx([[[[[1]]]]], [0, 0, 0, 0, 0])
>> 1
 
The latter also only works for one index and not a couple, correct?
I was thinking of
 
def tryingout(L):
return L[0], L[1]
 
10:50 AM
you implemented tuple()
 
oh, cool :) But it works I think.
In the sense that you can plug the result in a matrix
 
12:00 PM
recbg
 
cbg
 
bah, working test and wrong answer
I have a wrong low and a wrong high value that are 9 apart :|
found it :|
 
jjj
why the long face then?
 
aand part 2 check \o/
@jjj because I've been stuck on the bug for 15 minutes :)
 
jjj
huh, I feel you. At least its over now :)
 
12:15 PM
I'm really happy about my solution for today :)
I'm sure it could be done smarter, but I don't need smart if I've got numpy :P
 
how long for part2?
i mean, how much time it takes?
@AndrasDeak
 
cbg
 
jjj
@AndrasDeak were you able to do it with regular numpy or you had to import it as np? ;) (sorry but I love bad jokes)
 
way too late sleepy rbrb.
 
@marxin sorry, my laptop froze for no apparent reason
In [5]: %timeit day21(inp,part1=False)
6.41 s ± 31.7 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
 
12:30 PM
hmm
@AndrasDeak @wim just learnt: np.block
 
@AnttiHaapala I know about that; didn't need it
 
really?
 
yup
 
hmm
then I want to see your solution
 
I didn't think about any substructure stuff
 
@AndrasDeak strage, I didnt use numpy and it takes 5,5 secs for me
from the other hand, my cpu might be different
 
@AndrasDeak yuck :P
 
;]
 
@AnttiHaapala you say yuck, I say yay 6d arrays :D
@marxin it's not particularly optimized, mostly for convenience
I mean the numpy is mostly for convenience.
this is pure numpy brute force
 
12:34 PM
yeah
 
./runit.sh 21 8.51s user 0.39s system 102% cpu 8.661 total
hmm
how do I transform a slice into binary? :P
 
hmm?
what do you mean?
 
tobytes :P
 
what kind of slice?
 
ok that cut almost 2 seconds
hmm
both numbers are primes
so there is no optimal subdivision stuff...
 
12:58 PM
@poke always remember to @ comments so the OP also gets notified. — user5389726598465 19 mins ago
(OP is saying this)
 
1:08 PM
I find OP's username offensive
they are probably trying to say that commenting on an answer doesn't notify the asker
 
1:30 PM
Done, I'll make it go fast later on.
 
wim
1:49 PM
@AnttiHaapala hmm, I was interested for a moment because it sounded like it was a nicer way to slice up an array into regular "blocks" of subarrays.
 
@wim you can make lists of lists of those matrices and then only make one at the end, should theoretically mean slightly less copying.
 
wim
but it's just about assembling arrays. I don't really see what that offers over hstack and vstack (or np.concatenate)
i also would often like a frozenndarray , maybe andras knows such a thing?
 
@wim actually, .tobytes() was just enough here :P
provided it is type=bool
 
2:04 PM
AoC 9 is done. I still find regex pesky. :/
 
Wanted to come here before posting a question. Looking for a way to store formatted text from file A into a database so that I can pull it out later and write it in the exact same format to file B. No real code yet just looking for my gameplan
 
@ZackTarr yea, that's way too broad.
you need to think about "formatted how"
a text column can store any ... text, including that formatted...
... or a html document... or ... markdown, or whatever...
 
@AnttiHaapala I see. And thats why I didnt post the question yet. Wanted to get farther into it before I did that. So if I have a formatted line of code including tabs and spaces I can just put that into a string var and then INSERT INTO table VALUES (%s)
 
yes
... provided you do values (%s) properly, i.e. cursor.execute('......VALUES (%s)', [formatted_string])
then it is just up to interpreting that correctly upon retrieval
 
@AnttiHaapala I will play with that and see if I can get it to work. Wanted to hop on hear to make sure I wasnt going about it the wrong way from the start. Thank you!
 
2:14 PM
@wim nope
 
i am trying to write to a file in append mode. using
`file = open(“/tmp/detail.csv”,”a”)`
`file.write(str(toprint))`
but getting SyntaxError: Non-ASCII character '\xe2' in file my.pyy on line 19, but no encoding declared;SyntaxError: Non-ASCII character '\xe2' in file /home/infra/wide.py on line 19, but no encoding declared;
 
Alright, I optimized my Day21 solution, it now runs on bools instead of strings. Went from 4.5s to 5.0s, feels good man.
OTL
 
@pythonRcpp file.write(toprint.encode('utf-8'))
 
cbg \o
@toonarmycaptain there's a non regex solution :D
 
@pythonRcpp It looks like you're using "smart quotes" around your string literals. Use regular quotes.
 
2:29 PM
@pythonRcpp the problem is you're using Python 2
with Python 3 you would get -- yet again -- a sensible error.
 
lol :D
 
>>> file = open(“/tmp/detail.csv”,”a”)
  File "<stdin>", line 1
    file = open(“/tmp/detail.csv”,”a”)
                ^
SyntaxError: invalid character in identifier
Q.E.D.
 
@MooingRawr I'm sure. I just thought I'd try with regex, as I'm not great at that. It still feels kinda finicky to me.
 
@pythonRcpp just stop using Python 2. It is dead as a Norwegian blue.
 
Every time I see smart-quote-related syntax error questions, I fear that they're writing their code in Microsoft Word.
 
2:32 PM
E's a stiff! Bereft of life, 'e rests in peace! If you hadn't nailed 'im to the wall 'e'd be pushing up the daisies! 'Is metabolic processes are now 'istory! 'E's off the twig! 'E's kicked the bucket, 'e's shuffled off 'is mortal coil, run down the curtain and joined the bleedin' choir invisibile!!
 
@Kevin I'm hoping to eventually work for Microsoft. Don't their engineers all use Word?
 
I see a fellow man of culture. I find AoC fun to solve if you use other tools than what you would normally use.... However, I got stuck on D3P2 cause I refuse to give up on a math based solution :\
 
Not actually getting to do more than three problems seems like the opposite of fun
 
@AnttiHaapala - you are using examples for which I would agree that the C tag ( or C++ tag) does not belong, and have even marked questions accordingly. But this question, for example, is a rare example of one for which Both C & C++ apply IMO. — ryyker 1 min ago
how hard it is :D
 
ok, but my i cant upgrade to python 3 because of dependency issues
@marxin didnt help
 
2:34 PM
I will start asking all my questions: "how can I do this in Python or Ruby"
 
@pythonRcpp yeah quotes are an issue
 
@pythonRcpp there are 4 smart quotes on that line
.. alone
 
I would be quite interested in more polyglot-related questions on the main site. "Reversing a string in lisp and brainf%^&"
 
@Kevin you skip it and move on :D you just don't get the satisfaction of seeing the lights :\
 
@marxin yes now it works
 
2:36 PM
@MooingRawr I used a math-based solution. It took a bit of reading and playing around.
 
thanks guys , i never realised quoting was an issue
 
ohohoho, so there is a math based solution, good too know :D
 
How did those smart quotes even get in there? Do you have a smart quote key on your keyboard? I'm not being critical, I really want to know.
 
what i've noticed is that when you paste code in slack, not as formatted block, quotes get replaced
quite annoying
 
2:38 PM
@Kevin Step 1: rotate your screen by 180 degrees. Step 2: Now that the problem is solved, use the time you have to reevaluate your life choices
 
@pythonRcpp The fact that the tutorial's first example gives you an error when you copy-paste it, is a strong sign that you should abandon that tutorial immediately
 
@pythonRcpp If you read the comments on that page....disq.us/p/1g7lj0l
 
If they couldn't be bothered to even verify the correctness of their first paragraph of information, how can you trust anything they say?
 
@pythonRcpp Ok I'll add that to my list of banned tutorials
@pythonRcpp look at this for example: pythonforbeginners.com/super/working-python-super-function - indentation error.
 
@MooingRawr I literally googled Manhattan distance, and started in wikipedia. I remembered reading about such math somewhere to do with chess and/or city walking distances and such, probably back in highschool.
 
2:42 PM
I'd rather have nothing at all than a bad tutorial. At least then I don't have to un-learn all their wrong lessons just so I can get back to non-negative knowledge
 
Literally, in the comments: "1) You have smart quotes around the strings in your file opens. This throws errors if people cut & paste. They must be straight (ASCII-34) quotes to work. No biggie there."

--reading what issues others have had, and learning from them, is pretty much the purpose of the site this chatroom belongs to.
 
2:54 PM
You also shouldn't have to read comments to get a tutorial to function
 
cabbage y'all
today's puzzle kicked my butt!
I could not decide whether to represent blocks, or flat strings...
 
I went with flat strings and my solution takes like two minutes to execute
 
and I kept changing my mind!
...which did not help understanding what I was doing!
I am impressed with the speed some of you guys solved it... (winter) hats off
I'll take a look at your solutions tomorrow - off to bed now.
You have a repo with your code @Kevin ?
 
Yeah it's listed in the link on the sidebar --->
 
ok, I'll look tomorrow. debugging my mess consumed the best of my energy. I need to rest.
rbrb
 
3:06 PM
@ReblochonMasque numpy makes it easier, see wim's and mine
 
Yes, I think so too... I am a modest numpy user, I did not feel confident using it, although I kept thinking that numpy slicing and transforms might make my life easier...
 
(and if you want a headache, see @AndrasDeak's)
I am not very comfortable either but this one was a bit too NP-hard to use anything else
 
haha - I already have a headache!
You were super fast @AnttiHaapala O_o
 
@ReblochonMasque unihedron was way faster and
U's code is really horrible :D
 
Unihedron is from another world! :D
 
3:13 PM
Is there a good approach to having one worker that receives work from multiple process?
Should I make a API server that everyone can send request to the worker?
 
rbrb for good this time! ;)
 
3:33 PM
cbg all
does anyone know any good open-source API built with Flask?
There are a few things I'd like to check out, mainly how others handled docstrings for their routes
@AnttiHaapala that was brutal
 
Anyone a Jethro Tull fan?
 
3:59 PM
@cᴏʟᴅsᴘᴇᴇᴅ my mom was/is
cbg (-:
 
They're old school to be sure, but they're pretty amazing
cbg!
 
What's crazy is that my 3 and 4 year old children are singing Beatles songs. And I just bought some Pink Floyd on itunes for them to listen to as well. The 3 yr old belts out Bad Religion and they both sing "Let is Go" /sigh.
 
I wont work until the next year, yuppie
 
I feel like the alternative would be crazier: if they expressed preference for a certain era of music, having never been exposed to any eras of music before
 
rb folks
 
@piRSquared That sounds pretty normal to me! My childhood and my children's enjoyment of music I play may be an outlier, however.
 
DSM
Morning cabbage for all.
 
4:29 PM
recbg
I just got back from a large groceries-and-stuff trip, but before I left I optimized my part2 from 6.5 secs to 3.5 secs. I'll finish the job and see where I end up with
 
DSM
My first run would have taken about five minutes. My current takes 14s and that's good enough for me, because I'm very lazy. ;-)
 
@toonarmycaptain what sort of music do you listen to.
 
@piRSquared Honestly, most genres. But generally more concentrated on 60s/70s/80s.
But my oldest likes Bon Jovi.
I grew up on 60s/70s music though. Beatles, Eagles, Clapton, ABBA etc
 
whoa! How old is oldest?
 
4:40 PM
Nice (-: I'm imagining mine singing Bon Jovi
 
Although he generally likes whatever I'll put on and jam to if it's rocky and we pretend we've got microphones.
My 2yo will dance and jump around to anything with a beat.
 
Of course! Mine are well versed in the inverted air mic grip
 
Whenever the room gets around to collectively writing that guide on debugging, we need a sub-chapter on "why you shouldn't do try: ... except: print("Something bad happened"); exit()"
The number of people who suppress all error messages and then cry about not having enough information to debug their programs, is staggering
 
I've found 17 (maybe more...) questions all asking the same thing, with none of the answers particularly helpful. I could write a canonical answer to one of them, but I think they need to be closed as duplicates first so that it is easy to find. Is this the write place to help with this? Here's an example of one of the questions (can provide the others if needed): stackoverflow.com/questions/31785902/…
 
is this ok?

        else:
            raise ValueError(f'I don\'t like how you did that!')
 
4:45 PM
I'm currently writing a meta post about it, is that correct?
 
DSM
@Kevin: yeah. One point in my notes was "visibility", and that has both positive (adding debug output) and negative (not suppressing debug output) aspects.
I think the boss suggested we create a wiki page on sopython. Maybe I should just do that so we can add reminders like yours there.
 
@tburrows13 If you're asking "Is it OK to solicit close votes in this room?", yes, that's fine.
 
anyone know if there is a version of stack overflow for optimization ideas?
 
Whether making a Meta post would be useful, I'm not sure, as I'm unfamiliar with their customs. I'm leaning towards "couldn't hurt"
Other than the potential pain of downvotes :-P
@corvid Programmers, maybe?
 
DSM
Optimization ideas in general or "optimize this program"?
 
4:53 PM
Perhaps Code Review if you can meet their standards
 
I posted a meta post about it here: meta.stackoverflow.com/questions/360982/…
 
I think the motivation for error suppression is: you don't want your end-users to see the guts of your program, so a polite "whoops, something went wrong" message is preferable. But that's putting the cart a mile before the horse, if you're worrying about presentation before your code works
> Back on Wing Commander 1 we were getting an exception from our EMM386 memory manager when we exited the game. We'd clear the screen and a single line would print out, something like "EMM386 Memory manager error. Blah blah blah." We had to ship ASAP. So I hex edited the error in the memory manager itself to read "Thank you for playing Wing Commander."
One can only hope this happened towards the end of the development process
 
nice
 
DSM
Okay, I added my topic list from the other day to a draft page called Debugging on the wiki.
 
5:03 PM
@DSM So I can definitely do the thing, but it's a little too slow, and I've really pushed this strategy to the end so looking for a new one
 
Having an already functioning implementation makes you much more likely to get a warm reception at Code Review
 
Or there's that game (and old Sonic 3D) that when something went wrong, instead of crashing, it went to a secret level selector!
 
Yeah that's a good one
 
DSM
@corvid: yeah, then maybe CR. I think people tend to get better results when the performance issues are algorithmic and not external, though (e.g. lots of people can help turn N^3 into N^2 log N or something, but not everyone can help you deal with some weird I/O throttling problem.)
 
I think it's running an O(N) comparison, but a significant amount, which is causing a tree invalidation on my view
 
5:07 PM
IIRC Ocarina Of Time has a similar thing where you can see some otherwise inaccessible content by lifting the left half of the cartridge out of the slot
 
@Kevin the question is, what secret content access would you devise? Because we all know you would do something.
 
I'd implement something spooky to facilitate creepypastas and thus boost sales of my game
all the character models turning slowly to look directly at the camera, that sort of thing
 
DSM
O.O
 
I just remembered that another Zelda game added a contest winner's name to their crash handling system: zelda.gamepedia.com/Chris_Houlihan_Room
 
@Kevin I wonder why those 89 didn't like it
 
5:19 PM
disliked for glorifying violence against game cartridges :-P
 
@Kevin I finished Twin Peaks season 3. It's amazing how it managed to end with answers then not answer anything.
What's really crazy is how all the weird timing of a lot of the shots makes scenes from different episodes sync up when played side by side.
 
OK, can't get part 2 below 3.5 seconds
 
Are you just using numpy alone?
 
no cython or numba or numexpr
 
5:32 PM
nope
those wouldn't really be worth it
if any solution runs for less than a minute or two I'd be OK with that
this was mostly on principle, to get the best out of my approach
 
Something for this room to assist with: meta.stackoverflow.com/questions/360982/…
 
42 mins ago, by tburrows13
I posted a meta post about it here: https://meta.stackoverflow.com/questions/360982/17-questions-all-on-the-same-top‌​ic-with-no-good-answers
;)
 
@AndrasDeak I used recursion and memoization to get it done in a fraction of a second. There were only 131 entries in my cache.
 
Mod semi-endorsement never hurts though ;-)
 
5 hours ago, by Andras Deak
I'm sure it could be done smarter, but I don't need smart if I've got numpy :P
;)
 
5:38 PM
@AndrasDeak excellent :-D
 
recursion sounds nice, actually
 
I used PIL. That’s pretty fast too but i was amazed at how fast the memoized version was.
 
that reminds me, I wanted to plot the result
 
@MartijnPieters so you were dropping the 4x4 => 6x6,... into the dictionary?
 
I couldn't figure out a way to do DP on the problem, since the slice size changes with each iteration
Or 66% of iterations I guess
@davidism How very "Dark Side of the Rainbow". Wouldn't surprise me if it was intentional.
 
5:46 PM
so that's why the missus told me not to rush with finishing the season :P
 
I watched one or two episodes a day. Any more would have burnt me out.
The fact that everything seems so deliberate makes me think that the writers actually have a plan, even if they'll never say it, unlike Lost.
 
I was just thinking about LOST, myself
In the context that there's value in leaving mysteries unexplained because then there's no risk of flubbing the dismount
Anyway I think the catharsis of a mystery solved is rarely as satisfying as the suspense of an unsolved one
although, as you say, it's important that the viewer feels that there is a solution, and the writers aren't just throwing random cryptic nonsense on screen
 
One of the themes I felt with s3 is that it doesn't matter if the mysteries we know about are solved, the characters are only a small part. There's plenty of other weird things going on in Twin Peaks.
Every episode that ends at the bar sets up it's own season in a couple minutes, then ignores it.
 
man I hate that bar
 
I like the music in it.
@AndrasDeak how far through s3 are you?
 
5:56 PM
seen all but the double finale
 
Reminds me of an article I read discussing the design philosophy of... I think it was Mario Galaxy. Each stage was supposed to be like a terrarium with windows strategically placed along the walls. You can look in through the windows and see many different views of the same material, and this gives the impression that the space is much larger than what's been revealed to you
So the bar scenes work similarly, showing narrow shafts of plotlines that move into and out of our range of vision
 
needs more resolution
 
00:00 - 18:0018:00 - 00:00

« first day (2623 days earlier)      last day (2332 days later) »