« first day (1788 days earlier)      last day (3387 days later) » 

15:00
There's a concept in graph theory where you have a directed acyclic graph, and create a list of nodes such that every node always precedes the nodes it points to. I forget the name.
@kevin you can think your triangle ABC as a cutting plane of a cube with P as a vertex of this cube
You could do that kind of ordering, but there's going to be more than one possible "right" answer
@Kevin the name is topological sort I believe
@XavierCombelle yeah, that's it. So construct a graph where each set is a node, and node A points to node B iff A is a proper subset of B
@XavierCombelle Ooh, that's an interesting idea.
although if A B and C are vertices of the cube, then it would have to be a rectangular prism, since the side lengths aren't necessarily all equal
I don't actually know anything about cutting plane techniques so I don't know if that's a big deal
@Kevin A B C are on the edge of the cube not necessarely vertex
15:14
Got it.
Do people get notifications when you edit comments on github?
I don't think so @corvid
Huh. You can't use csv.writer() in a with statement.
cabbage all
@MorganThrapp yes you can
@davidism Really? I just tried and got AttributeError: __exit__
15:21
Yesterday I was annoyed to find that you can't do with urllib.urlopen(url) as f: but in retrospect I'm not sure if it even makes sense to close a file-like object that doesn't actually reside on your computer
it makes sense to close a socket @Kevin
"We must close the internet, the __exit__ has decreed it."
@MorganThrapp oh, you mean with csv.writer()
@Kevin in wikipedia article about topological sort, there is exactly what you spoke about en.wikipedia.org/wiki/…
Now I'm wondering if urlopen reads all the data right as you call it, or if it waits for the first read call on the subsequent file-like object
Probably the first one. Otherwise the timeout argument would behave kind of strangely
15:28
@davidism Sort of, yeah. I have a function that's returning csv.writer() objects, and I was trying to use those returns as the main part of the with.
15:39
i wrote a program that relies heavily on graphviz to draw graphs and i converted it to an exe using cxfreeze but it seems the executable can't find graphviz, also does cxfreeze somehow include graphviz into the exe build it generates?
DSM
DSM
I would be surprised if it did, to be honest.
If graphviz is an executable that you run using os.system or subprocess, It seems very unlikely to me that it will get bundled
so are there any suggestions on how to bundle graphviz with my software, the work around i could think off was to add the graphviz installer to my software and then run it after my software installs
That's probably the best approach, unless you can find a Python library that draws graphs
15:43
For everything except Windows, you wouldn't, you would let the package manager take care of pulling in dependencies. For Windows, I would suggest switching to Linux.
(But even then, I perceive cx_freeze as quite flaky when it comes to third party libs)
GraphViz is a wonderful thing, but somewhat messy. I'd just tell users to install it separately before they install your program.
That's the approach that the Python graphviz module takes: pypi.python.org/pypi/graphviz
another problem with graphviz is setting the system PATH variables, you have to manually add the path to graphviz in your PATH variable which could be complex for some computer users
@Kevin looks like sorting the set by size create a topological sort of the set according to inclusion as partial order
That makes sense.
15:48
I actually developed the program using ubuntu but the target os was windows
DSM
DSM
davidism's objections to Windows are infamous, and infamously impractical. :-)
It would solve the problem. ;-)
you could bundle an ubuntu installer...
sorry - unhelpful
I just noticed that the GraphViz site says this: "Due to organizational changes, the Graphviz web site will see some modifications in the near future. In particular, it will probably no longer provide binary packages for Windows and Macs. "
no....that will be too bad
15:52
You will be able to write a windows install script to prepend to the Path environment variable, if you can get as far as bundling another installer with yours, I think. I had to do this in the dim and distant past of the 2000s
DSM
DSM
@JRichardSnape: for Sage, which combines lots of packages, that's still the recommended Windows install route. (The VM approach, I mean.)
@DSM :D
Oh, VM - I thought you meant they literally said - "1. replace your OS with Linux"
that would be stylish
i have to start unearthing batch scripting again.....is there a command in the os module to set Path variables?
DSM
DSM
But again, entirely impractical, and we're occasionally obligated to pay attention to the situation people actually find themselves in..
I appear to have hung latex again :(
@DSM I know - I work in Windows 95% of the time
user559633
15:55
@JRichardSnape Oof. Why? How?
Vbox running quite often and code often on remote linux servers, but most day to day stuff on Windows.
@JRichardSnape Wow... I read that as "Windows 95" and was horrified... then I saw the "%" so then felt really sorry for you instead...
user559633
@danidee why not just stay in Python?
DSM
DSM
I work in 'nix 95% of the time. Sometimes I vpn into a windows box when I need to do some Office stuff.
Why: The people supplying my computers install it. How: I achieve a Zen-like state of self-control prior to commencing work ;)
user559633
15:56
I spend 80% on Linux, 20% on OS X.
Also - it keeps me in touch with how most people interact with a computer
@danidee - It depends on how you're launching things, but typically you'd modify os.environ['PATH']
@tristan i don't get it...what do you mean by staying in python, my program is a gui app with pyside
user559633
@JRichardSnape Oh, I guess VBox works, but I'd probably just full screen it 100% of the time or re-format and re-install
user559633
@danidee Ah, I thought it was batch scripting -- I didn't see where you referenced a gui app
DSM
DSM
15:58
@JRichardSnape: whenever I think of people interacting with a computer, I imagine Scotty saying "Hello, Computer" to the mouse in ST IV.
user559633
Also, I haven't embedded graphviz with cx_freeze before, but I've embedded a lot of other odds and ends. In general, it's a matter of knowing where the libraries you need are located and explicitly including them. That's easier said than done sometimes, though
@tristan GraphViz is a powerful connected graph manipulation system. You describe graphs for it using the DOT language, and it works out how to render the thing neatly for you. It can create the output as a new DOT file containing explicit position & curve drawing info, or as a PostScript, SVG , or in several bitmap formats.
@JoeKington that would mean messing with some dll's right?
@DSM - And then proceeds to intimately know whatever bit of domain-specific software they're using so he can design transparent aluminum... Because, naturally, that would be identical 200 years from now :)
15:59
@danidee summat like set Path=your_new_path'%Path% iirc. I fully expect to get kicked for knowing that
@danidee - Yep.
user559633
@PM2Ring Ah cheers. I also missed the line wherein he stated Graphviz
@danidee you can either set you os.environ dictionary or pass environ to env to subprocess module function
@JonClements horror followed by sympathy is a reaction I have attracted in the past ;)
user559633
saddenfreude (okay this doesn't really make sense)
@danidee - As far as actually including the libraries and data (.dll's/.so's/etc), you'll need to add the individual files to include_files in your setup.py's build_exe options (for cx_freeze, specifically). Not to plug one of my own answers too much, but there's a walkthrough here: stackoverflow.com/questions/22021297/… It was focused on including data files, but the mechanism is identical for including libraries/binaries
Nice answer....i should be posting a success message soon.Thanks
@JoeKington nice answer. And I'm going to investigate the mpld3 library you link there for sure - thanks for the link!
Happy to help!
CBG
    r = range
    print [ i+j for i in r(n) for j in r(i+1,n) ]

Is their any way to make two for loops into one or any way to shorten this even more...? #codegolf_ideas
16:16
cbg
@VineetKumarDoshi what's the output?
The code is just a dummy code ... i+j is just some random stuff .... basically I am interested in finding all pairs of array of size n
itertools.combinations?
So you want a way to make some code shorter, but not that code, but in Python?
Have you considered writing readable code?
16:21
I smell an XY problem around this question
@VineetKumarDoshi since that code didn't do all pairs
Yes .. @jonrsharpe I tried and submitted the correct long readable version of it .. got accepted.
@Kevin arrrgh, screenshots - can't cut and paste from windows terminal, I bet. This is an indicator that corroborates your suspicion.
There's a moderate chance that the question really is, "does the json module have some kind of load(fillename) function?", but that's trivial to find out without making a post here
Incidentally, you can copy from the windows command prompt, but the shortcut is not intuitive: you highlight a region and press Enter.
@AnttiHaapala
by pair i mean like
(a[0], a[1]), (a[0],a[2]) ... (a[1],a[2]),(a[1],a[3]),...(a[n-1],a[n]) ...
@Kevin Oh, I know that. But they (I suspect) don't.
@AnttiHaapala that seems likely, yes
@VineetKumarDoshi your code didn't produce pairs...
Argh I bit my lip and now it burns when I sip this energy drink.
>>> import itertools
>>> list(itertools.combinations(range(5), 2))
[(0, 1), (0, 2), (0, 3), (0, 4), (1, 2), (1, 3), (1, 4), (2, 3), (2, 4), (3, 4)]
list(__import__('itertools').combinations(range(5), 2))
16:32
    n = 5
    r = range
    print [ (i,j) for i in r(n) for j in r(i+1,n) ]
Sorry for incorrect code .. change i+j to (i,j)
I can use itertools.. infact they are awesome...
But, here my goal is to shorten my code as much as possible.
using itertools will cost me more keystrikes.
Someone on SO just figured out my email (not difficult) and emailed me their question "because SO is public", but none of the code they emailed me is sensitive in any way. Laurel
DSM
DSM
Did they also email some bitcoins, to pay you for your time?
Send back an invoice :D
@VineetKumarDoshi If you want to save keystrokes get rid of some of those spaces. :)
>>> r=range(5);print[(i,j)for i in r for j in r[i+1:]]
[(0, 1), (0, 2), (0, 3), (0, 4), (1, 2), (1, 3), (1, 4), (2, 3), (2, 4), (3, 4)]
unfortunately .. the code checker .. doesn't consider the spaces as keystrokes
DSM
DSM
16:38
You could use the arithmetic version and loop up to range(N*(N-1)//2) but you'd probably add as many characters as you'd save.
@DSM I can give it a try .. then i = k/n and j = k%n ???
http://codegolf.stackexchange.com/a/41217

found one similar solution here ... was wondering, how to change it to my case of 2 for loops
@PeeHaa are you still maintaining the cv-pls extension? The install links on the github page don't work.
DSM
DSM
Huh! According to jonr, "[mcve]" automagically expands to a link to the SO mcve page. Didn't know that!
except does it also expand the text to 'minimal, complete, and verifiable example'?
@davidism Yes
16:45
\o/ My hours of endless typing are over.
@jonrsharpe I am as disappointed as you ;_;
DSM
DSM
I feel bad for sscce, though.. (pre-mcve, that was my go-to.)
@DSM there're more magic links meta.stackexchange.com/a/94000
DSM
DSM
This day just keeps getting more magical.
I guess [mcve] doesn't work on Meta Stack Exchange, which is a drag because that's where the posting sandbox is
DSM
DSM
16:48
And my new sneakers don't go squish-squish-squish when I walk. O brave new world!
"there're more magic links" looks/reads ugly, is it wrong?
ugh another ugly sentence :[
"there're" is quite uncommon but I don't consider it wrong
It sort of implies a "country boy" dialect to me, but that's subjective
24
Q: Is "there're" (similar to "there's") a correct contraction?

Michael Moussa Q: "Do you have any juice?" A: "Yes, there's some in the fridge." Sounds perfectly fine to me, but: Q: "Do you have any towels?" A: "Yes, there's some in the closet." Does not. I asked for towels - plural - so wouldn't "Yes, there're some in the closet," in which there are is turn...

Ah sorry, I didn't even try to google it :d Thank you @Kevin
DSM
DSM
I say "there're". But then I'm kind of a country boy. (I do also say "y'all" when I'm not paying attention, for that matter.)
I say there're. I'm not a country boy :P.
16:55
cbg
DSM
DSM
Really, if you just undervoice the "a" a little bit it sounds like that in practice anyhow. To my ears, at least.
Or maybe it's just saying "er" instead of "are". Sounds the same.
What DSM said :).
I say something incomprehensible. That is because I am from Finland.
I've always imagined Canada as a narrow horizontal stripe of medium-to-large cities, plus a whole lot of permafrost. By this model, there would only be city boys and survivalist nomad tribes.
"we are" is contracted to "we're", "there are" should be contracted to "the're"
16:58
@Kevin - You've clearly never driven through AB :)
DSM
DSM
That's.. surprisingly accurate. And explains why I feel obligated to put on this facepaint in the morning.
For the first twenty years of my life, I thought "Manitoba" was a fictional placename, like Kerbleckistan or Elbonia.
Surprisingly in Finland there is almost no permafrost.
DSM
DSM
AB is the Canadian TX. Even the cities map: we have Calgary as Houston and Edmonton as Austin.
17:00
"you know nothing, Kevin Kevinson", think the inhabitants of the north.
most of Finland is North of Anchorage.
Hey, @Cyphase. Remember this Rock, Paper, Scissors question? I reckon both of those answers deserve an upvote... :)
This is precisely why, if a tremendous wall is constructed between the US and Canada, I must refuse to be appointed Captain of the Watch.
@PM2Ring, done :).
AB is a far better Texas... It has mountains as well as a lot of flat land, cattle, and pumpjacks.
17:02
:)
Then again, I say this mostly because I live in TX and don't have to deal with the winter
winter one does not deal with...
it is the heat that needs to be dealt with
Heh! True.
Hey up all again
if it gets colder, you wear better clothes.
17:05
In some cold countries that I forget which ones they are, it's common to leave your kid outside in their stroller while you go into the shop.
If it gets hotter, well you'd rip your skin off?
Sweden IIRC.
And thankyou to the anonymous benefactor.
DSM
DSM
@JoeKington: as someone from Wild Rose Country I am happy to accept your praise on behalf of my people. I do like the Rockies, although I've heard Guadalupe is nice.
... or Finland
17:05
I moved to Wisconsin after years of living in the south... We got >3 meters of snow my first winter, and when it wasn't snowing it was hellishly cold. My utility bill was more than my rent in Janurary...
I suspects this explains much about their ability to tolerate their own climate. Early inoculation.
Maybe it was Finland, I remember a BBC article about it.
@Kevin @Ffisegydd that's why I'm like this...
I love the cold, I hate the heat.
This explains everything! </tired_sitcom_joke>
17:08
the trick is that the baby is wrapped tightly, so they'd feel safe and warm...
would you do it inside they'd boil alive :D
(or in Texas)
@DSM - Canada is quite a fantastic place! I'll happily sing its praises, as long as we're not talking about hockey :)
Also, the Guads are quite nice, they're just a long ways from anything
WHich is part of why they're nice... Fewer Texans! :)
hmm xkcd survey's closed :P
Science can't last forever...
may I unpin it
go for it
17:10
hope they publish results soon
munroe should just ask the correlated.org guys for their data
This isn't the first survey that xkcd has performed. I wonder how long the last analysis took.
DSM
DSM
Yeah, I kind of want to see if I can spot myself in the output somehow. My peculiarity confounds your anonymization process!
@DSM you're a special, peculiar snowflake - just like everybody else.
DSM
DSM
If everybody's special, no one is. #favouritemovie
17:12
But we're all special in our own way.
@DSM Here's hoping the sequel is good
DSM
DSM
TS2 > TS1, so it's not impossible.
user559633
TS?
Toy Story!
Never seen them.
17:17
:O :O :O
DSM
DSM
"He's Welsh," he said, explaining everything.
user559633
They're not very good. You're not missing much. If you saw them as kids, they're great nostalgia, otherwise, just another above average movie for children.
DSM
DSM
They're quite good, and get better as the series goes along, which is unusual.
Eh, I would mostly agree. I would say it goes 3>1>2.
@jonrsharpe acushner has fixed his code stackoverflow.com/a/32462734/4014959
17:18
We didn't get very good TV reception in the mine I grew up in.
@PM2Ring ta
RottenTomatoes reckons 3 is the weakest (on a paltry 99%, the other two are tied on 100%)
DSM
DSM
@Fizzy: Let me guess: to pass the time you sang ballads of Old Cymru you learned from the village bard?
17:35
I got an English grammar book which I'll start reading (after numerous promises)
\o/
@davidism What does it point to? My personal domain?
I should probably just put it on the store instead
Kill it with fire
Oh
that's a bad one
I dunno, what's the point of becoming a programmer with this attitude.
17:49
That question should be added to the wiki as a canonical "This is exactly the wrong way to ask a question. If you do any of this, your question is bad"
For the fame and money!
And the chicks.
Right, every girl dreams about a coder i.redditmedia.com/…
Cabbage :D
Cabbage :)
18:04
It's way past my bedtime. Rhubarb.
Haha, it's 2pm here.
Rhburb PM, and it's early morning here.
@JacqueGoupil East coast is the best coast
@Morgan East coast of Canada, yes :P
@JacqueGoupil Eh, still counts.
18:11
hey thereeee
@Morgan I guess, eh.
general python question, I guess you could call is a version control ish question
i have this app set up with django
and it uses some other python packages as well
should all of the packages it uses just be committed with the app
or is there a better approach for this sort of thing in python?
Don't commit with the app.
Well, you could specify a rule in your version control program to ignore the files.
Have a requirements.txt that you can pip install with.
18:15
yeah, theyre currently being ignored, I assumed because there was a better way to handle it
hence my question :)
i suppose I'll go run a find for requirements.txt
thanks :)
Are you using a virtualenv?
na, well, its an AWS machine
wish I could just use something like vagrant
well maybe I could
You should still be able to AFAIK.
Nevertheless, whatever you do, don't commit the packages :P
ha ya, thanks
idk, short on time or I would dive into using vagrant for this
working under 2 weeks timetable
so just trying to get shit done for current employer, not be all learny
I also have a question. I have a shape object with width, height, position, small_margin and big_margin properties. I need a few methods which take a 2D point and return a boolean, but I don't know how to name them:
- one which checks if the point collides with the shape
- one which checks if the point is within the shape's small margins
- one which checks if the point is within the shape's big margins
18:23
lies_within, lies_within_small_margin, lies_within_big_margin?
I'd say contains, since it's a method on the shape, not the point
I guess the "canonical" name for the first one would be point in polygon
... Assuming the shape is a polygon.
But then it's a little weird to have a Polygon class with a method called point_in_polygon
@PeeHaa yeah, the link points at the xpi file, but everything redirects to an email regex tester. I use Firefox, not Chrome.
@JacqueGoupil - If you're looking for python libraries specifically, have a look at shapely. More generally, though these are computational geometry tasks. point_in_polygon is contains or within, for the others, you apply a buffer and then check contains.
18:29
@JacqueGoupil now that is hard, hope your next question is not about cache invalidation ;)
@JoeKington It's actually in C#, but I thought pythonistas would understand how important naming is better than MS fanboys so I asked here :)
Fair enough! For naming ideas/conventions, have a look at the various GIS focused libraries and GEOS
There's also
John R. Herring, Ed., “OpenGIS Implementation Specification for Geographic information - Simple feature access - Part 1: Common architecture,” Oct. 2006.
But unless you really like docs, I'd just find a geospatial library (e.g. GEOS or Shapely) and browse their naming conventions :)
Radical idea: don't have an actual method name, just override __contains__ so you can literally write if my_point in my_shape:
@Kevin - Yep, that's what shapely does. However, there's a big advantage to contains vs within for 2D geometries
WHat happens when the point is on the boundary? Or if a line is part of the boundary of the polygon?
@JoeKington Wow, that's quite the reference, nice.
18:34
@Kevin C# ;)
then return random.choice([True, False])
@JacqueGoupil use IronPython ;)
@Kevin - Heh!
void HateTheMicrosoftNamingConventions()
More seriously, though, that's why there are multiple methods. There's a really nifty matrix that's defined for intersection behavior of geometries in 2D... I can't remember the name offhand...
DSM
DSM
18:36
DE9IM?
I actually made this problem more abstract then it is in real life. Think of my shapes as obstacles for a robotic vacuum cleaner.

Right now I have shape.contains(point), shape.forbids(point) and shape.allows(point)
That's because the small margin is the closest you are allowed to get to the shape while the big margin is the largest margin you can allow (you don't want to cut corners too much while cleaning)
That's it! Thanks!
Dimensionally Extended Nine-Intersection Model (DE-9IM)
But it's a poor choice of words because shape.forbids isn't the opposite of shape.allows
Might be better to be a bit wordier... Maybe shape.within_cushion?
But that would imply just within the cushion... Nevermind
18:43
Knowing nothing else about the problem domain, I'd probably just have three separate shape objects, each representing one of [actual obstacle, forbidden zone, slightly less forbidden zone], and each having only one contains method
Mmm, well within_range might be good. Although I'm not sure I like the idea of a non-verb method. Would has_within_range or range_contains be better?
Possibly having a container object with a reference to each one, for organizational ease
within_range sounds much more natural to me than either of the others... Though I do agree with Kevin that separate zones would also make sense.
has_within_range doesn't sound grammatical to my ears
So, in today's Lessons in debugging. We learn that if you call a function with the wrong arguments, it will return the wrong result. This does not (as you may have thought for the past hour) mean that the function is wrong, just that your BCC (Blood Caffeine Content) is too low.
18:47
If you go that route, is_within_range would be better... Especially as "is" is a semi-standard prefix for methods that return a boolean. (or camel case away and make it isWithinRange... )
(Just don't do that in Python or all or our eyes will bleed)
@MorganThrapp - And when my BCC is too high, I wind up here instead of getting actual work done... It's a fine line to maintain... We all need coffee IV's...
@JoeKington I'm sorry to tell you, but the C# standard uses Pascal casing...
So it's not `shape.is_within_range(point)` but `shape.IsWithinRange(point)`
@MorganThrapp Reminds me of this joke, circuitously
QA Engineer walks into a bar. Orders a beer. Orders 0 beers. Orders 999999999 beers. Orders a lizard. Orders -1 beers. Orders a sfdeljknesv.
@Kevin Haha, I love it
Actually, turns out both me and the function are wrong. I would feel better, but I wrote this function.
How many times have we posted/starred that joke now?
18:53
NaN times.
Not a 'nough times?
Yes, never a 'nuff.
There needs to be an esoteric language with Nen as a keyword :D
user559633
Senior QA Engineer walks into a bar, starts to order, but doesn't finish his sentence.
Haha, event better...
QA Engineer walks into a bar, orders a foo.
18:57
Kevin enters the chat room. TooManyStarsError
5
user559633
Senior QA Engineer walks into a bar, then back out, then orders a door.
:-D
If you walk into the Mended Drum and order -1 beers, they hand you a Klatchian Coffee.
user559633
NEEEERD
user559633
nerds, revenge of
A Microsoft engineer walks in a bar and offers the owner a free renovation with paint and comfy chairs with a secret door in the back...
Hey, I think I might rename shape.forbids into shape.out_of_range :D
I cannot wait for Portlandia to come back. I love that show.
19:06
I was going to complain about gatekeeping but that was weirdly sincere
I have a t-shirt or two with knerd on it. (I've been to a lot of meetups at Knewton.)
19:27
Hey! In a rather desperate attempt again. Can someone please link me to good article extraction module for webpages.(Tried goose,boilerpipe,readability)
19:48
Anyone around with a hammer? I want to change the dupe target of something I hammered.
Kind of if no one else is...
I copied the wrong link. Technically they both answer the question though.
Yes, that's a digital picture of a physical hammer, but what I need is a physical wielder of a digital hammer.
First you must sing the song of close-vote-related penitence. If you don't, we'll have five years of winter.
19:50
Sorry, that wasn't even funny. I guess I'm tired.
I assume you're singing it now. You don't have to type it out. Louder! The sun can't hear you.
I'm signing it right now, I just wave my hands around my head in air &quot;s, right?
Yes, that should probably do it. Although we can't be sure until march.
@JonClements well thanks, but then Padraic reopened it :(
you know what, just leave it, he seems willing to deal with it
Speaking of powers beyond mortal reckoning, how 'bout that new 25k privilege?
DSM
DSM
19:54
Walking away to leave problems for those who want to deal with them is the only way I've survived on SO.
3
I hear there's not even a link, you have to type the url manually.
Maybe they're trying to limit its usage by making it hard to find.
25k seems kind of arbitrary for just "look at these stats", but I guess it's another goal.
I still need to get to 30k just in case.
Man, how much time do you guys spend on SO to get that much rep? I got about 1000 in a year....
How the cabbage do these awful Flask questions keep getting multiple upvotes. It's just started in the last few weeks, and it's driving me insane.
19:58
Sunday is more popular than Saturday for page views, but they're about equal for making new questions. I'm sure this correlates to some deep Universal truth.

« first day (1788 days earlier)      last day (3387 days later) »