« first day (2805 days earlier)      last day (2144 days later) » 
00:00 - 17:0017:00 - 23:00

5:18 PM
Title idea for a regex themed horror movie There is no escape!
 
Oh good, Curiosity got through the dust storm.
 
Does this room object to the occasional code golf challenge?
 
No
 
<- no opinion
 
Like, why would it
 
5:21 PM
Nice :)
 
^^ could promote bad coding
 
nah, code golf is a very clearly limited subject
 
@vaultah Never really seen it here much before.
 
Now Curiosity just has to trek over to Opportunity and stick a paperclip in its "reboot" pinhole
 
it's like with any other subject that people here would enjoy: anything can be fun until it isn't
 
5:22 PM
What are they, like ten thousand km apart? No sweat
 
@Simon you just taking a survey? Or do you have a golf question... speaking of curiosity and all.
 
Yeah I did think one up.
 
Keep that lewd stuff out of the room Kevin
 
@Kevin that was almost my career path. That is, working on the Mars Rover project.
 
@KevinMGranger I take it you don't want to see my Curiosity-tan fanart, then
 
5:24 PM
@Simon We occasionally talk about interesting golf questions from PCG.
 
Have to know where that is first.
 
@piRSquared Ooh, neat. I would have been all over that.
 
I googled it and it came up with PG&E gas company.
 
... If I had even a remote faculty for physics
 
@Simon google PPCG
 
5:26 PM
@Simon this one
 
DSM
For me it was #2 for "golf questions from PCG".
 
Not physics for me. Would have been modeling the economics
 
@piRSquared that's a good unmapped area on Mars
 
Introducing MarsCoin, the cryptocurrency that can only be mined on extraterrestrial rovers
 
Cool. I might have a go on there @vaultah @MoxieBall
 
5:27 PM
You should post your challenge in their Sandbox first
 
definitely do that
they'll help you turn your problem into a well-defined one
they'll also tell you if it's a dupe
 
I will do that. Can't now, just recieved an answer from some posts earlier.
 
there's never any rush on SE, that was kind of our point
 
@Kevin Already taken, need to rename your coin - marscoin.org
 
@AndrasDeak I know that. I was going to start planning it though.
 
5:32 PM
AresCoin
YouWon'tBelieveIt'sNotMarsCoin
 
@Simon Here's one I did last year. It prints a Batman logo. codegolf.stackexchange.com/a/126448/46655 The annoying thing about PPCG is that many regulars use special golfing languages which enable them to produce ridiculously small programs.
 
@Aran-Fey thanks for always being there to link my dunder methods to their respective doc :p
 
Bitcoin mining is based on the hard problem of calculating SHA-256 hashes. MarsCoin mining is based on the hard problem of accelerating a five pound payload to 2.9 km/sec without ablating it to a fine dust
 
Bitcoin mining is a bunch of computers playing numberwang
 
@OlivierMelançon Are you familiar with this: rszalski.github.io/magicmethods ?
 
5:35 PM
@KevinMGranger Numberwang?
 
Obviously it's hard to earn one whole MarsCoin by yourself, but you can earn fractional MarsCoins, for example by accelerating a payload to 2.9 km/sec for only a few meters. Then other participants on the blockchain can take it the rest of the way.
 
@PM2Ring Does PPCG have a precedent for only allowing a specific language?
 
@MoxieBall I don't think so, that wouldn't really fit the philosophy there
 
@OlivierMelançon no problem - it doesn't take much effort if you have a handy userscript :)
 
5:37 PM
they are usually broadening the spectrum of applicable languages codegolf.meta.stackexchange.com/questions/16528/…
 
@AndrasDeak Fair. I guess I just wish it were possible to be competitive without bothering to learn why E⪪”|↖y{{﹪yc›o”n↗πf>T≔Y¿PN|ωπQβ” ⪫Eιק* μ⌕βλω‖O← prints a batman symbol
 
just because dedicated golfing languages will be shortest, one might still appreciate cool efforts from non-golfing languages
 
cabbage
 
@Aran-Fey Yes, I've heard of your handy-userscript a few times now ;)
 
and of course there's always Mathematica codegolf.stackexchange.com/a/71680/45297
 
5:39 PM
true, I suppose being the absolute shortest is less of the point than just coming up with relatively short results in a variety of ways
 
cabbage all, I return.
 
cbg
 
cbg
 
@PM2Ring wow, ok! I'm not sure if I think its funny yet.
 
@AndrasDeak That reminds me of the time when there was a PPCG challenge to compute the Adler-32 checksum. Mark Adler himself submitted an entry in Mathematica. :)
@piRSquared Yeah, it's more stupid than funny. Definitely not in the same class as Mornington Crescent.
 
5:45 PM
Today's edition of URL typos that could've gone badly at work but didn't
www.youtub.com
 
I'm teaching Python to people who have never programmed before this weekend. At the end of the weekend, I want some tiny demos to show them they can interface with things. I'm already gonna show a meme-maker Python script that takes an input image and two text lines and makes a mem.
Another idea would be to scrape Amazon to track the price of an item.
 
DSM
@KMG: The first few random numbers I got were 24, 60, and 72. All multiples of 12. Suspicious.
 
But what would be a good demo interfacing with Windows?
Some sort of notification setter?
 
linux installer
 
5:47 PM
I'm sure that won't intimidate them at all
/s
 
@Seanny123 If it doesn't have to be a windows system function I would suggest doing some openpyxl stuff
not really just a "Windows" thing but a lot of the times I see people doing things that would be improved by adding python, it's in excel
 
@MoxieBall legit. I'm just not sure what people do with spreadsheets, so I don't know what I would show them to blow their minds.
Open to suggestions!
I guess anything with sorting/filtering would be pretty cool.
Maybe I'll get ideas by talking to the students.
 
world cup statistics
People like that apparently
 
The only statistic you need is how cute the mascot is and the answer is "very"
 
@Seanny123 I guess they wouldn't be interested in telnet. chat.stackoverflow.com/transcript/message/24634446#24634446
Or know about the BOFH
 
5:54 PM
Nah, they're a bunch undergrads with arts backgrounds
 
that is pretty cute :)
 
We do have them doing basic plotting and analysis using Numpy and Matplotlib, so we've got statistics covered.
 
Gimp python-fu?
Not win though
 
do we have a canon dup for someone trying to assign to a function call? eg func() = someotherFunc() I was thinking about this but not sure stackoverflow.com/questions/5964927/…
 
@Seanny123 though I've no idea how to do it: Make a photo mosaic from scraped web images would be cool
 
6:03 PM
Yeah, maybe I'm too concerned about interacting with an OS and should just focus on images.
 
I was right, getting this to render required some pretty nasty code
 
DSM
People come up with the best ideas on the SE network. Accordingly, I'm off to look for some live rabbits to carry with me.
 
what o.o
 
That question is actually a practical concern for me because I'm playing a barbarian in my friend's dnd campaign
"Just punch yourself in the face" is a far more sensible solution, really
 
@jpp I was hoping to encourage the OP to post some code attempt... stackoverflow.com/questions/50975022/…
 
6:09 PM
natural 20 wearing +20 gauntlet of demolishion, you're dead
(no, that's not a thing, unless it is by accident)
 
@MooingRawr That looks like a good one to link. On a related note, it would be nice to give everyone learning python a tool that they could run like whatswrongwith mybadcode.py that would just exec your code, catch the error, and link people to the first google result for "Stack overflow {error}" so that people would stop asking questions like that
 
jpp doesn't believe in code attempts
what a weird question
 
@Kevin what toolkit is that built in? Tkinter? Looks quite old.
 
Tkinter, yeah
 
Stupid me. It's written in the top window :facepalm:
 
6:11 PM
@Kevin Fancy. I just have a Go / Pause button and a Save button. My fern parameters are hard-coded. As is everything else. :) I guess I could add a few widgets... and do the drawing in my ScrolledCanvas.
@AndrasDeak Not that weird, just another XY problem.
 
unclear, oddly specific, probably XY stackoverflow.com/questions/50975022/…
 
@AndrasDeak Assuming the gauntlet simply gives you a +20 to strength, you will do at most 36 damage to yourself. That's assuming you're a level 14 half-orc barbarian with a feat that gives proficiency in unarmed strikes, and you rolled a 4 on all three d4 rolls.
Oh, and you divide it by 2 since raging barbarians have resistance to bludgeoning attacks. A level 2 barbarian could be reasonably expected to survive that much damage
 
looks like a dragon claw :D
 
Slightly faster if I don't color it, so this time I could leave it running long enough to get rid of the black squares from the previous attempt
Color requires O(depth^2) additional runtime, which is significant because ferns recurse at least as many times as they have leaves along the main ridge
 
@AndrasDeak I didn't CV it initially because 1) I was hoping for the OP to respond, and 2) the number of questions that newbies can answer has been pretty low, and I figured that it wouldn't hurt to give them a chance to answer this one. I should've known better...
 
6:26 PM
yup
 
Right now I iteratively replace primitives with smaller versions of themselves in breadth-first order. It might be interesting to use a priority queue instead, and replace primitives in order of the size of the primitive.
 
@Kevin Are you drawing that with Canvas elements?
 
Yeah. lots of tiny create_polygon calls
 
It'd be nice if you could tell Canvas "Hey, I don't need you to maintain this as a separate moveable object, just draw it and forget it, please".
 
In my case, I do need to track them, because I erase the primitives from depth N before drawing the primitives from depth N+1
example. Now with priority queueing!
I'm guessing heapq doesn't have O(1) push and pop, so it's a little slower than the BFS approach, which used a deque
Tangentially related: searching for previous discussions on ferns turned up this:
Jul 7 '17 at 17:45, by Kevin
"Can I get tips on the care and maintenance of my houseplant?"
"Please be specific. Is it a fern or a cactus, or something else? Care and maintenance will vary depending on your answer"
"Allow me to be more specific. My houseplant is three years old. It is sixteen inches tall. I named it 'Carl'. I bought it at Steve's Plants on 33d and Market Ave from a man named Emilio."
"That is not enough detail."
"Do you need Emilio's last name too? I can dig that up if necessary"
 
6:48 PM
@Kevin Yeah, I figured that. I was just making a general remark. But I guess it doesn't really matter. If you want to plot pixels, you can use a PhotoImage, although as we discovered last year it gets slower as it fills up. My 1st Tkinter fern program used a PhotoImage, but when I changed it to plot into a Numpy array which gets copied to a PhotoImage every 500 pixels the speed increased enormously.
@Kevin That is a classic, and I thought I'd already starred it. It's scary to think that post was made almost a year ago.
 
It's a rare thing for a message larger than 150 characters to reach double-digit stars, since ain't nobody got time to click through to the transcript to see what happens after the ellipsis cuts it off
 
Hi
 
I guess a leading sentence involving house plants makes good clickbait. Take note, buzzfeed.
 
I've a python list containing python dictionaries where I want to compare the two adjacent dictionaries.

I/P:

[ { "date" : "2011-06-01","id": 123,"year":"2011"},{"date":""2012-07-13","id": 123,"year":"2012"},

{ "date" : "2010-08-18","id": 456 ,"year":"2010"}]

All I want to compare the date between two adjacent dictionaries in the list. if the "ID" is same with the later date has to printed. And has to use the single for loop to compare.

O/P:

[{"date":""2012-07-13","id": 123,"year":"2012"},{ "date" : "2010-08-18","id": 456 ,"year":"2010"}]
Here is what i've tried
 
@Kevin There's a PriorityQueue but I think it just uses heapq under the hood.
 
6:53 PM
Hi
:)
I have a problem
TypeError: unsupported operand type(s) for +: 'Counter' and 'tuple'
what is this error about
 
Oh, neat. I didn't know one existed so I rolled my own real quick.
@Sahar That usually happens when you try to add a Counter object and a tuple object, which you aren't allowed to do
 
I used a part of code twice in two different parts
one of them works fine
the other one gives me this error
:/
 
Kindly provide an MCVE and I'll be happy to take a look :-)
@Stuxnet78 I wonder if itertools.groupby would be useful here. What should happen if the same id shows up three times in a row? Still print the date just once?
 
:-?
 
@kevin What should happen if the same id shows up three times in a row? Still print the date just once? Yeah print with latest date only
 
6:58 PM
@Stuxnet78 That's a bit too much code to post here. Next time, use an external site like dpaste or gist.
 
import itertools

seq = [
    { "date" : "2011-06-01","id": 123,"year":"2011"},
    { "date" : "2013-07-13","id": 123,"year":"2013"},
    { "date" : "2012-07-13","id": 123,"year":"2012"},
    { "date" : "2010-08-18","id": 456,"year":"2010"}
]

for k, v in itertools.groupby(seq, lambda d: d["id"]):
    biggest = max(v, key=lambda d: d["date"])
    print(biggest["date"], biggest["id"])

#result:
#2013-07-13 123
#2010-08-18 456
@Sahar Related reading: stackoverflow.com/help/mcve
 
@kevin awesome than you
 
look I used counter to count bigrams in a list, I used it again in a loop in my cross validation loop. the second one gives me that error
 
7:03 PM
@Kevin You could use itemgetter instead of those lambdas...
 
actually I cant create minimal example of this, I guess it was the best explain that i could give
 
It's hard to give a specific answer without a specific MCVE. So my general advice is: compare the two pieces of code very closely and determine if there are any differences. That is the most likely place you'll find the problem.
 
yes you're right thanks
 
@PM2Ring itemgetter and I aren't on speaking terms unless it can migrate to the builtins
 
DSM
What, like groupby? ;-)
 
7:09 PM
@Kevin I really should do a timeit test to compare itemgetter vs lambda... But not right now, I'm starting to fall asleep.
 
If I can implement something in fewer characters than the number of characters required to import that thing and use it, then I'm likely to implement it.
Groupby takes more characters than len("import itertools; itertools.groupby(blah)") to implement, so I'm still allowed to import it
 
FWIW, _operator is in sys.builtin_module_names so importing it doesn't even use a disk read, it's already compiled into the interpreter.
 
Dear devs, please implement a parser optimization that converts all instances of lambda x: x[whatever] to operator.itemgetter(whatever)
Regards,
Having his cake and eating it too in New Jersey
 
Slightly tricky since you cant just do a plain find-replace. You don't want lambda x: x[1:10] to become operator.itemgetter(1:10)
You need operator.itemgetter(slice(1,10))
 
DSM
7:20 PM
Kind of feels like 1:10 should just always give the slice object, though, and it should simply be the literal syntax for creating one.
 
I had to double check that f(1:10) wasn't actually legal syntax, so I agree with you :-)
I wonder if this is one of those "not enough people have asked for this" features, or one of those "this is actually a nightmare to implement, if you think about operator precedence for a bit" features
e.g. If you have a:b:c, how does the parser know it means slice(a,b,c) and not slice(a, slice(b,c))
 
DSM
The same way that x[1:2:3] returns x[slice(1,2,3)] at the moment, I'd think.
 
I suspect it's easier to suss that out if slices can only occur in very specific contexts, ex. inside an index. If you can put them anywhere an expression can go, that's not so easy
 
I closed this earlier and OP doesn't agree. I'm soliciting opinions stackoverflow.com/questions/50970859/…
 
DSM
julia> x = 1:2:3
1:2:3

julia> typeof(x)
StepRange{Int64,Int64}

julia> fieldnames(x)
3-element Array{Symbol,1}:
 :start
 :step
 :stop
^ I want something more like this.
 
7:26 PM
Can you do 1:2:3:4:5? I'll accept any interpretation as long as it parses.
Of course this is completely academic because there's virtually no reason anyone would ever embed a slice literal as one argument to another slice literal
 
DSM
No, but that's only an implementation choice. I might even be able to write something to support it, give me a sec.
Actually, I'm too lazy to do that, but you can see how you'd need to do it from the error messages:
julia> x = 1:2:3:4
ERROR: MethodError: no method matching colon(::StepRange{Int64,Int64}, ::Int64)
Closest candidates are:
  colon{T}(::T, ::Any, ::T) at range.jl:118
  colon{T<:AbstractFloat}(::T<:AbstractFloat, ::Real, ::T<:AbstractFloat) at range.jl:195
  colon{T<:Real}(::T<:Real, ::T<:Real) at range.jl:101
  ...

julia> x = 1:2:3:4:5
ERROR: MethodError: no method matching colon(::StepRange{Int64,Int64}, ::Int64, ::Int64)
Closest candidates are:
  colon{T<:Real}(::T<:Real, ::T<:Real, ::T<:Real) at range.jl:115
 
Ok, 90% credit there since it looks like it can parse it into an ast, but then it can't make it into an object
 
DSM
Once you've agreed that we can unambiguously map 1:2:3 to slice(1,2,3) and not slice(1, slice(2,3)), though, I think adding more numbers doesn't change anything conceptually.
 
Yeah I think a well-formed language could parse it unambiguously, I just think a human would have poor chances of guessing its behavior on their first try.
 
whoa what? what is the expectation of what 1:2:3:4 is supposed to be?
 
7:32 PM
(Which, again, is academic)
According to julia's parser, it should be (1:2:3):4
In other words, {start: {start: 1, stop: 2, step: 3}, stop: 4}
 
cbg
 
... Or maybe switch "stop" and "step" there, I don't know how julia orders things
 
so left greedy
filling in start:end:step while you can until you can't at the right hand side
You'd have to place None type entries to fill in the gaps where necessary otherwise ambiguity would be a certainty
 
@piRSquared I would dispute that dupe tbh. The OP is doing like-for-like so why does joining on the index have a special privilege to speed?
 
@roganjosh taking advantage of the hashing of the index which explains the speed up
 
DSM
7:39 PM
Okay, I'll admit it: I love being able to hack a performant language enough to do this:
julia> 1:2:3
(1,2,3)

julia> 1:2:3:4
(5,6,7)
 
So the answer would be that Pandas doesn't attempt to hash column values because it's less likely to be unique than an index?
 
Yes
maybe not for that reason... but it doesn't hash the column
 
But that isn't really covered by the dupe IMO
Saying that unique indexes can be exploited by Pandas to get a speed up doesn't address that this approach is not even considered if you're trying to join on a column
 
That's why I'm asking. I thought it was obvious. However, If opening it back up can add value, then that's the right thing to do.
 
Well, I'm not going to answer :P
 
7:43 PM
But at least someone can.
 
And I'm only giving my opinion as you solicited it in chat :)
 
Do modern parser generators even notice potential ambiguity in languages? I'd kind of expect them to just steamroll over your ambiguous case and give you whatever derivation it feels like
 
And for that I thank you (-:
 
I don't think the connection would be as obvious as you might consider. How expensive would it be for Pandas to try the same check as it does for the index, considering duplicate index values are actually supported?
 
given language add_expr := expr + expr and string "a + b + c", there's ambiguity. But maybe the parser generator just shrugs and hands you the leftmost derivation
 
7:45 PM
That's why I said the reason was likely not because columns are less likely to be unique and more along the lines of it hasn't been done yet.
 
But I think your last comment does start to cover that part
Eh, my question last night arose from doing a test that, to me, was "obviously" the wrong way to do something and it ended up being faster :P
@piRSquared If you're looking for something to occupy your mind, I think this question is deceptively hard. It seems that some simple approach should exist but I can't find an angle of attack. People are just reading it as a dupe.
 
That is a dup
 
answered
 
So I see. Well I occupied your mind for 30 secs, but what is the dupe?
 
DSM
While the OP hasn't been super-clear, I don't agree with your answer, piRS.
 
When the second highest answer on that is test1.assign(key=pd.DataFrame(np.sort(test1.values,axis=1)).sum(1)).merge(test2‌​.assign(key=pd.DataFrame(np.sort(test2[['id_a','id_b']].values,axis=1)).sum(1))).‌​drop('key',1), I'll forgive myself for not knowing that approach :) It's not a criticism of that answer but sometimes it's tough to understand if certain approaches are applicable to your problem in Pandas :/
 
DSM
I think OP wants order independence in source/target, but not involving weight there. Right now your last frozenset mixes all three columns.
IOW I think the duplication key is basically (sorted([source, target]), weight).
 
Fixed
 
DSM
df
 
8:14 PM
yay for finding legacy bugs which was suppose to be squashed a few years ago, but found some new test cases that triggers the same bug :\
 
@MooingRawr I see your legacy bug and raise you a "bug" that I very deliberately introduced into my code and then spent 2 entire days getting rid of. Hundreds of spreadsheets and pages of notes. I've promoted myself to Director of Internal Liabilities.
 
I finally solved an issue that's been hanging around in our tests for at least 6 months.
it wasn't a "bug" per se because the app behaves correctly, but code wasn't entirely correct, either
 
DSM
@piRSquared: I wish I could figure out a better way to sort within a row, but so far the best I've got for long arrays is df2.loc[~df2[["weight"]].join(pd.DataFrame(np.sort(df2.drop("weight", axis=1)))).duplicated()].
 
Huh, I just removed a downvote and the +1 made my rep go higher than it's ever been. It's corrected now but it took a few minutes.
 
8:44 PM
@DSM ...
df[~pd.DataFrame(([sorted(a) + [b] for *a, b in df.values]), df.index).duplicated()]
 
DSM
In [102]: %timeit df2.loc[~df2[["weight"]].join(pd.DataFrame(np.sort(df2.drop("weight", axis=1)))).duplicated()]
3.37 ms ± 159 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)

In [103]: %timeit df2[~pd.DataFrame(([sorted(a) + [b] for *a, b in df2.values]), df2.index).duplicated()]
63 ms ± 1.61 ms per loop (mean ± std. dev. of 7 runs, 10 loops each)
I'm trying to avoid Python-level loops.
 
Hmm... well rbrb meeting wife and kids at beach. I'll revisit for fun later (-:
 
DSM
Rhubarb for piRSq!
 
rbrb enjoy
 
rbrb
 
DSM
8:49 PM
All about shoes
I think I knew about a third of those.
 
The first thing I ask about when I got to buy shoes is how sturdy the metatarsal guard is. Don't you?
 
DSM
Apparently I have strong feelings about uncomfortable foxing.
 
I know what you meant but I couldn't resist :D
 
I find the blucher much more important than the foxing. Controversial.
 
DSM
Cute fluffy animals are always welcome :D
 
8:59 PM
wow
 
@AndrasDeak IKR, DSM doesn't ask about metatarsal guards when shoe shopping
 
is there anything like string.translate for character sequences?
 
example ?
 
DSM
I don't think I want to be in the office any more. So I won't be. Rhubarb for all!
 
rbrb DSM
 
9:03 PM
rbrb DSM
 
rbrb
 
cya guys
 
eh, I know that's not really how string.translate works, but I saw an answer from Martijn earlier: 'foo- -bar'.translate(dict.fromkeys(map(ord, '- '))) for removing dashes and spaces from strings, and I wanted something that does that but for character sequences with similar efficiency
rb
 
9:19 PM
rb folks
 
10:04 PM
two hedgehogs loudly snorting under our balcony <3
 
One of my neighbors' hedgehogs just had a bunch of little hedgehog babies a few weeks ago and they were trying to get rid of them. I was tempted.
 
they're somewhat high-maintenance as pets, they say
 
Hedgehogs snoring at this time?? My dad lives out in Derbyshire and there are 3 hedgehogs that keep coming to his garden (naturally named Snedgy 1, Snedgy 2 and Snedgy 3). I nearly needed a new pair of trousers when one wandered over my foot while I was smoking and lost in thought. They're really cute trying to get into the flowerbed though, takes them a few goes
 
@PM2Ring cabbage?
 
Yes our own special mini language, please see this page
We call it salad language.
Welcome. :)
 
10:20 PM
@Simon i know the salad lingo but @PM2Ring used "waves" :D is that the normal wave? so used to cbg
 
Oh Ok sorry. Depends, what you feel like saying. Cbg is shorter to type
 
@Simon no worries
 
@roganjosh snorting
 
... And this is why I shouldn't take my contact lenses out, even in the security of my own home
 
@Simon tilaprimera is a former regular turned irregular :)
 
10:31 PM
Before me I'm guessing then otherwise I think I would remember them...
 
No, you just missed them........ Of course before you.
You've been in chat altogether for a year; the room is 7.5 years old
 
Ah tilaprimera has been a member for 5years, that explains it.
@AndrasDeak Well aware I'm the newest piece of furniture :p
 
Not necessarily, chris may be newer for instance
 
OneRaynyDay maybe?
 
yeah, he's been in chat for 6 months
@Simon no, he's been around for longer I think, though I also know him from the matlab room
Not that it matters. I was only making the point that if you don't remember a regular who only used to be a regular you should suspect that yes, it was before your time
 
00:00 - 17:0017:00 - 23:00

« first day (2805 days earlier)      last day (2144 days later) »