« first day (1881 days earlier)      last day (3084 days later) » 

3:00 PM
In my day we ripped our own CDs to MP3 =)
 
Psh, FLAC is the path to victory, that's part of why bandcamp is so great
 
user559633
3:18 PM
I like m4a -- it lets me fit a lot of songs on my phone
 
I like to encode all my songs to JPEG so I can see the music
 
DSM
In my day we held two cassette tape players close together and pushed record on one of them.
 
Seems like I can consistently cleave large L&S sequences into sub-sequences of length 100 or less. But this isn't useful for memoization purposes since there are appx. 3**100 L&S sequences of length 100.
Cleaving really only becomes practical if I can get sub-sequences of size appx 12
Possibly there are more cleave points than the ones I can locate, but I don't know how I would find them exhaustively.
 
DSM
I'm actually pretty impressed you made it up to 500!
I think they should have at least made part (b) that big, so you'd have to do something clever.
 
In theory, my approach should work for 5000... But it crashes without an error message on my machine, and times out on ideone.
 
DSM
3:31 PM
How do I interpret your output for 500?
 
What should it output?
Ah, nvm
 
Can someone double check my math knowledge? The exclusive range 2, 5 is just the numbers 3 and 4, right?
 
Whoops that version is full of crufty debug output. Here is one that prints the result of g("3", 500) % 100.
Oh, it times out. Well, you get the idea.
 
@MorganThrapp Sí.
 
Thanks. I think this code golf has its test cases wrong.
 
3:35 PM
Link?
 
2
Q: Product over exclusive and inclusive ranges

Dane AndersenInspired by this question by @CᴏɴᴏʀO'Bʀɪᴇɴ. Taken from the question: Your task is simple: given two integers a and b, output ∏[a,b]; that is, the product of the range between a and b. You may take a and b in any reasonable format, whether that be arguments to a function, a list input,...

 
DSM
@Kevin: I agree with your 500 output!
 
That's encouraging :-)
 
@MorganThrapp (2,5) => 120 is definitely wrong. They're not all wrong though. For example (-4, 0) => -6 is right.
 
DSM
And I agree with your output for 2999 (my 5000 answer is at home), so I think I'm going to tentatively award you the prize. :-)
 
3:38 PM
@QuestionC Yeah, I realized that after I posted. But, (5, 10) is wrong, it should be 3024.
 
I'll see if I can find more lenient cleave point criteria. I bet that'll help.
 
DSM
@MorganThrapp: I was just about to propose using the < and > string tricks we'd used before. :-)
 
@DSM I love that trick.
 
DSM
If we can get the string order right. :-P
 
asciitable.com is my best friend. :P
What's the close reason for "Sorry, SO is english only"?
 
3:49 PM
@MorganThrapp "No hablo Ingles"
 
So, any web dev friends here? I don't quite get something in enrollment processes
 
@corvid "web" hey? I've heard of that... :p
 
We ain't got no spiders here! This is a snake room.
 
someday I will buy the internet and just make every page an "under construction" gif
 
You don't need to buy the 'net to do that - just time travel back to 1990 ish
 
user559633
4:08 PM
@corvid don't ask to ask :)
 
4:22 PM
Hm, so if you have the token, how do you know if it expired? Just that it's no longer associated with the user record?
 
@MorganThrapp That guy's name is almost Dave Arneson of D&D 'fame'.
 
@QuestionC Huh?
Oh, the asker of that Code Golf. Yeah.
 
I'm gonna stand by that observation because SO and D&D gotta have more overlap than me.
 
Oh I played a ton of D&D growing up.
Both 2ed and 3.5.
 
DSM
#forgottenrealms
 
4:27 PM
So you caught the reference in day 9, then?
 
cbg, all
 
I actually know a girl named Faerun. AFAIK, noone has pointed the coincidence out to her.
 
Jeez, singer/songwriter Peter Noone has no tact.
 
DSM
I missed it, but then I was lost in frustrated astonishment there were so few nodes..
 
Something something, Kevin'd.
 
DSM
4:34 PM
Am I the only one who's confused right now? Hopefully I'm not.
 
This is the joke: whenever someone mistakenly writes "no one" as "noone", I interpret their statement as if they meant "Peter Noone" rather than "no one"
"no one has pointed out..." becomes "Peter Noone has pointed out..."
See also: alot
 
And I was in the middle of making the same joke by linking an image of Peter Noone, but Kevin Kevin'd me, so I just linked the image instead.
Also, man I miss when Hyperbole and a Half updated.
Her stories are some of the only things that have made me cry from laughing too hard.
 
I'm gonna invoke cannot in defense of noone
And alot while I'm up here.
 
DSM
You see it written as no-one in some old books.
 
Welp found the problem, and it seems like a very poorly designed third party library was the cause :|
 
4:43 PM
Welp, my hacky brute force finder has indicated that there aren't any more 4-length cleave point prefixes other than "3113" and "1321", which I already knew about. There are a couple 6-length ones, but since frequency of appearance is proportional to 1/3^prefix_length, they aren't nearly as useful.
This means my code was already about as efficient as it can be given the approach I used, so I guess I'm done.
 
DSM
And it reaches the 5000 point anyhow, so by my lights you've succeeded quite well using a method I wasn't expecting.
 
I claim partial victory. Doesn't work on my machine, but could work on machines with more memory.
 
DSM
Your code works on mine without any problem and takes only seconds.
 
Or whatever resource I lack that is making the damn thing crash.
I'll claim full victory if I can get it to run on my home computer six hours from now.
 
@Kevin that guy created like 6 or 7 different such psychedelic images of everyday objects -- if you are interested.. :)
 
4:49 PM
@PeterVaro, yeah, got a link?
 
one sec.. let me search for it..
 
@DSM 229349714
 
Whoa, that cauliflower is trippy.
 
cbg sprinkles
 
5:07 PM
also, cbg all
 
DSM
@Kevin: BTW, any reason you're not memoizing special_partition? Drops runtime to 1/3rd for me.
 
Cabbage from Disneyland! :-)
 
cabbage everybody
 
DSM
That's "C-A-B, B-A-G, E-from-Disneyland!"
 
@DSM Do our values match for n=5000?
 
DSM
5:16 PM
@davidism: what takes you there, if you don't mind my asking?
@MarcusStuhr: I think so but I'm at work and my code is at home. Your value matches Kevin's, though, and Kevin's value matches mine at other ludicriously large values I can check at the moment. How about (to pick one at random) after 2173 steps?
 
@DSM 876564626
 
DSM
@MarcusStuhr: yep. :-)
Now isn't that more fun than just replacing 40 with 50? They made (b) way too easy today.
 
@DSM I was going to optimize it, but I got distracted.
 
sorry for the delay -- we have a DemoDay at our office -- and I was pretty occuped :P
 
5:22 PM
@DSM For 10^100: 747355218
 
I was wondering if someone can take a look at my question I posted about 24 hours ago? stackoverflow.com/questions/34183627/…
 
@PeterVaro I think the pretzel is my favorite. The pizza is kinda terrifying.
The romanesco is super cool, too.
 
DSM
I'm going to try to work "romanesco broccoli" into conversation later today. It will astonish and impress my friends.
 
It was hard to tell with the cauliflower but now I'm sure he's using the same basic approach I did.
 
DSM
@ryekayo: unfortunately I know nothing about ansible, but I do know a little bit about SO, and your "UPDATE" is unlikely to help your cause.
 
5:29 PM
Was not expecting it to look like that
 
@DSM It's quite delicious.
 
Several of them have a minor "spin" where any individual element's angle W.R.T. the center gradually changes as it moves out. Not sure how that's done, but I like it.
 
@DSM I understand...
 
i need help pastebin.com/M56ZsHh7, i want the 2 functions to be able to modify a filetext at the same time
 
Does postgres have an operator similar to $inc ?
 
5:36 PM
@supertrainee do you have any specific questions?
 
am i doing something wrong ? it doesn't write to the file
 
It's probably worth noting that file.close does nothing if you don't have parentheses at the end of it, and '<2>' in LISTA checks to see if "<2>" is in the filename, not the file.
I don't think fixing either of them will let you perfectly modify a file in two threads with no race condtions, though.
 
Also, you don't need the global LISTA, because you're not modifying it.
 
DSM
And since we're in a with, closing the file isn't necessary anyway.
 
Grrr
 
5:39 PM
Yeah, writing to a file over multiple threads rarely ends well.
 
Perhaps you could use a Queue or some other thread-safe data structure, and only write data to the file once at the end of the program.
 
8
Q: Python multiple threads accessing same file

SchittiI have two threads, one which writes to a file, and another which periodically moves the file to a different location. The writes always calls open before writing a message, and calls close after writing the message. The mover uses shutil.move to do the move. I see that after the first move is d...

 
@DSM a bunch of family is going, they got me a ticket as an early Christmas present.
 
Your code is a little confusing. if '<2>' in LISTA: probably isn't really the test you want to perform.
 
The Indiana Jones ride is great, but he hates snakes. Sorry Python!
 
DSM
5:58 PM
@MorganThrapp: I get why he's squaring things.. he's doing that instead of abs. It's like he's golfing his real code. :-)
 
@DSM Ah. I didn't realize squaring negatives was the same as abs. I hadn't seen that before.
The comparing to the index still has me completely lost, though.
 
DSM
I think he wanted something like x[index_of_max_abs_j][0]**2 on the RHS there, but the ugliness of that is a sign this isn't the best way..
 
@DSM Yeah, that's pretty nasty.
 
6:13 PM
I don't understand how that user is 10k. They just asked in the comments if sorted will return a sorted list. Instead of, you know, trying it.
 
which user @Morgan ?
 
I don't think rep = intelligence/common sense. Otherwise, I'm SoL.
 
I should really fix the typo in the title of this question but on the other hand, libass.
 
DSM
I can't find an elegant one-pass approach.
Oh, wait, max is stable, isn't it?
 
6:27 PM
I believe so.
 
DSM
Then max(enumerate(seq),key=lambda x: abs(x[1][0]))[0] should iterate over the data only once.
 
@DSM Oh wow. Yeah, that should work.
 
6:42 PM
@DSM it's pretty much the answer I gave here but one must be aware this precise answer give the last max element instead of first one
 
6:56 PM
Anyone here to help me with stackoverflow.com/questions/34209535/…
 
How do I use a closure in an event binding? Eg, I want to do pub.subscribe(lambda: self.do_a_thing(arguments), 'an.event'). Will that fire as soon as I define it? Or just when the message comes in?
 
It won't necessarily fire right away, no.
Of course, whichever library defines subscribe is free to do whatever they want with your callable, including firing it right away.
 
Yeah, that's my worry.
 
@Devstorm21 As per the room rules, please don't link newly asked questions.
 
It's not a huge deal if it fire when I first define it, as long as it also fires it when the even comes in.
 
7:00 PM
I see. thx.
 
I think I've seen Tkinter do premature firing sometimes. Something to do with StringVar creation. But it's not typical.
 
Okay, cool. Thanks.
 
Does anyone ever enjoy doing html/css?
 
@Programmer until browser compatibility comes into the mix, sure
 
Really? Most of my experience is in Python but they seem very basic but also frustrating to get your website to look precisely the way you want it.
 
7:09 PM
Is there a recipe suitable for Python - Access hierarchical dict element from list of keys that doesn't require each inner data structure to be a dict? I tried reduce(collections.Mapping.__getitem__, keys, d) but it gives a KeyError.
 
Finally getting around to Day 8.
 
Oh and I don't want to use a lambda, because that's too easy.
 
I wish I had motivation for AoC, but each day the problems stack up.
 
@Programmer a lot of the changes that came with html5 make things much easier IMO. But any site i do for myself has VERY simple needs (like rounded corners and different gray colors) so it doesn't get too bad
 
@Programmer Nope. Sometimes I use javascript completely. Whether or not that's actually good? Don't know
 
7:13 PM
I have a meeting soon with head of marketing so my design goals are about to get specific...
 
@Programmer Most of the problems are pretty quick (Day 7 is probably the hardest one so far)
 
what is AoC ?
 
Advent of Code
 
@Programmer yeah i'm no UX expert, i just know enough to make my stuff look better than unstyled html. I am terrible at the fancy pixel perfect stuff
good luck
 
just checked it out, looks cool .
 
7:19 PM
Guys :| External libraries are irritating
 
Yes, it is known.
 
DSM
The only thing worse is having to maintain hundreds of libraries yourself to get things done.
 
A strange profession, programming. It seems the only winning move is not to play.
How about a nice game of chess instead? _
 
DSM
Were you even alive when that came out?
 
I bet you were.
 
7:26 PM
I was not.
 
Oh wow, I was -11 when that came out.
 
War Games is a very good movie except for the scene where the computer is guessing the digits of the launch code one-by-one, because 1) what kind of security scheme lets you guess the digits of a launch code separately? and 2) they did that annoying "monitor projects a perfect image of the screen onto the faces of all the characters" thing.
What is this, Mastermind? "Is the launch code 00000000?" "No, but you got 3 right"
 
DSM
Fortunately I have AoC to reassure me I haven't lost all my #speedcode mojo to the sands of time.
 
what's different about AoC ?
 
Different from other programming challenge sites? The Xmas theming, mostly.
 
7:29 PM
Compared to what? Oranges? Well, one is a fruit.
 
the challenges seem like challenges from any other online judge
@Ffisegydd compared to other websites like topcoder,codeforces etc
 
Yeah, but I felt more comfortable pinning this one in the sideboard because it has a pretty definite expiration date.
 
They probably are quite similar in nature to other online coding challenges, but do other sites involve you helping Father Christmas? I'd bet my bottom dollar they don't.
 
any specific reason you guys prefer AoC ?
 
I wouldn't pin a SPOJ link, because when would be an appropriate time to take it down? I can pin AoC because "late decemberish" is a good time to unpin.
 
7:31 PM
Festivity
 
DSM
They're quick; they don't require too much Euler-style math; and as Kevin notes they're limited-time.
 
AoC is nice because everyone's doing it at the same time.
As Santa would want.
 
As per the SOPython Charter, we're a totally independent multi-national entity, and as such would not recommend one code challenge site over another, apart from when they come under Appendix AB Paragraph 1.2, to wit, they involve Christmas.
 
Agree with QuestionC. It's easier to foster discussion when there's no chance of "'what did you get for #3?' 'Oh I did that last August, I have no idea how I did it'"
 
7:34 PM
@Kevin Thats seems a valid point
 
Is AoC python-only or can I do it in assembly? :D
 
You can use whatever you want
 
Apart from assembly, the Great Book forbids it.
 
You just can't talk about non-python solutions in here :-P
 
DSM
I think I mentioned I saw a guy doing them in sed, just because he could.
 
7:36 PM
Except to deride them for being inferior to python solutions.
 
Or solutions to other problems.
 
It's not an online judge (SPOJ, HackerRank, etc) where you have to submit code or anything
 
Poke did one of them in SublimeText 2.
 
I saw some crazy German fool doing it in Sublime Text.
Damnit Thrapp.
 
Let's all point and laugh at the languages that don't have a groupby equivalent! Ho ho ho!
 
7:37 PM
It might be fun to force a tool ahead of time
Excel for #11?
 
Eh, maybe I will get into it later
 
I will exquisitely craft a Difference Engine out of a single block of marble for #11.
 
I'll probably use Python.
 
I was planning on using redstone.
 
DSM
Let a thousand flowers bloom.
 
7:39 PM
The difference engine will emulate a minecraft engine containing redstone that simulates Python.
 
DSM
Didn't we talk a long time ago about whether there was enough persistence in Minecraft for Turing purposes?
 
You're all part of the computational model that I wrote up that would generate a fully sentient programming ecosystem that could collectively solve the solutions.
 
I think so. My conclusion was "you don't have infinite tape, so applications are limited"
 
Having said that, there are a couple people who have submitted golf answers in redstone.
 
Even though the world has no boundaries, physics only happen within a distance of 300 blocks or so.
 
7:41 PM
@DSM Kinda prefer it that way actually
 
DSM
I'm now beginning to think "redstone" isn't just a name of a different type of material from marble.
 
So even if you chained pistons together for ten kilometers, you'd only be able to actuate .1 kilometers worth.
 
@DSM It's a material in Minecraft that you can use for very basic state machines.
 
Although since then they've beefed up the minecart system somewhat, so maybe you can shuttle the player around automatically and move the "phsyics window" where you need it...
 
DSM
And the world makes sense again.
 
7:42 PM
What does redstone do?
 
I'm not totally sure, I just know it can be used to simulate logic gates.
 
Conducts energy, using it you can make circuit gates.
 
It's basically an electrically conductive material you can use to simulate AND gates and what have you. Whoops beaten.
 
It has some simple rules (such as a torch can turn off a wire above it) that mean you can program pretty much any logic gate you can imagine.
 
Why couldn't they use real rock names? They're so much cooler! E.g. eclogite, a.k.a. "christmas tree rock"
 
7:44 PM
Kevin I was thinking of that minecart solution as well lol
 
I've seen people build calculators in MC.
 
There is a movie theatre with N rows with each row having M seats .
Four types of people are present :
type L : people who want the LEFT armrest
type R : people who want the RIGHT armrest
type Z : people who want NO armrest
type B : people who want BOTH armrests .
Given N,M,Z,L,R,B : how can we find the maximum number of people that can be seated in the theatre ?
Does this involve any kind of algorithm , because I can't formulate a greedy approach :(
 
The solution is "N*M people and they'll just have to suck it the hell up because they pay for a single seat."
 
I just bring my own armrest from home.
 
7:46 PM
Hmm, I wonder if this is somehow isomorphic to bin packing.
 
I don't sit next to strangers. That way I can elbow for my armrest
 
Well, you know any maximal solution will let as many type Z's in as possible before anyone else.
 
but armrest preference doesn't map perfectly to box width.
 
Sounds like a stars and bars problem
 
Oh wait... do two Z's get angry if they sit next to each other?
 
7:47 PM
I go to the cinema with my girlfriend, so my choice is "whatever arm rest I can get from the person on the other side of me"
 
@QuestionC No they dont
 
DSM
I'd probably treat it as a linear programming problem and break out glpk..
 
Just let in all the Z's, then let in as many L's as you can on each row, then as many R's as you can on each row, then pack in the B's.
The number of B's you can accomodate is limited by the number of Z's, but it's not too crazy sounding in general.
 
DSM
Not sure if that strategy guarantees optimality, though. (Also don't know that it doesn't.)
 
Yeah that strikes me as a "gets pretty close to optimum" approach.
 
7:50 PM
If you put an L in a row, then you've just changed your row of K seats to a row of K-1 seats.
 
You can put Ls on the left edge (and converse for Rs) without loss of generality
 
To properly motivate you to find the true optimum, assume all moviegoers are grumpy dictators who will wage 10 years of bloody war each if they don't get a seat.
 
I strongly suspect this can be solved without a computer tbh.
 
That's funny, I suspect it can't be solved even with a computer.
 
also yay look-and-say sequences
I already had code for the trivial case, now I'm looking into the DSM variant :D
 
7:52 PM
What makes it more difficult is the constraints
N,M<=10^8 and Z,L,R,B<=10^16 :/
 
Can you rephrase the problem in terms of Elves and Santa?
6
 
Ok, in that case it's probably not NP-hard if they actually expect you to submit an answer before the sun explodes.
I retract my previous previous message.
 
12 mins ago, by Ffisegydd
You're all part of the computational model that I wrote up that would generate a fully sentient programming ecosystem that could collectively solve the solutions.
You're all getting distracted! Back to AoC! Don't make me start the simulation again!
 
lol
 
@Ffisegydd And you are running on a rock & sand substrate.
Science fiction teaches us that if it is possible to create simulated universes, you're probably in one right now.
 
7:54 PM
Part of an ongoing contest: codechef.com/DEC15/problems/CHCINEMA
 
Has anyone had to save five people from a runaway trolley recently? We may be background characters in an ethical thought experiment.
 
I aint giving this contest
 
@Kevin That depends. Is there a big dude on a bridge overlooking the tracks?
 
Ok. Pretty simple to see you can start filling in Ls from the left of any row, and similarly Rs from the right side, until / unless they meet in the middle
you can do that on every row, creating "edges"
fill in the zone in the middle with Bs on every other seat
and then fill in the gaps with Zs
that should be maximal
 
7:57 PM
@MarcusStuhr No, but three of the people in danger will become surgeons that save 50 people each, 5 of which are clones of famous dictators.
Who, incidentally, will be going to the movies soon, and have very particular ideas about armrests.
 
@Kevin there was an amusing SMBC on that topic a bit ago
 
No it isnt
try this case :
N=3,M=3,Z=1,L=2,R=0,B=9
You would end up filling 7 seats whereas 8 can be filled .
LLB
BZB
B-B
 

« first day (1881 days earlier)      last day (3084 days later) »