@XuMuK: BTW, input is a bad choice of variable name, since it shadows the built-in input() function, which can lead to mysterious bugs. It won't actually hurt anything in your code, but it is a bit confusing to anyone reading your code.
Given the similarity of the two "different" fonts this room uses for text and code, I wonder if we could modify the CSS to put a light grey background behind all code? By "we," of course, I refer to someone who knows what they are doing
Python is very good at handling geospatial data, right? I've heard that's one of its strong points comparative to other languages, with scipy and numpy
If you're using postgres, there's geo types in there, but mostly I think it will come down to libraries if you don't want to type the math functions yourself
I think it's more about storing geographical locations and related metadata. A good example is Yelp's map, where it queries in a specific geospatial range for something
@holdenweb Yeah, it's possible. The actual CSS rule is quite simple: code {background: lightgray;}. The more difficult part is injecting it into the page. I have written a greasemonkey script that does this but it uses the proprietary GM_addStyle function which probably doesn't exist in user-scripting engines for other browsers.
It seems very likely to me that every browser that has addons, has an addon that can modify css on a per-page basis. In which case you can download that and paste my rule in.
For example, firefox has Stylish. I haven't tried it myself but I assume it does the needful.
If you're thinking "ok but is it possible to make the light gray background visible to absolutely everyone that views this page?", you'd have to make a feature request on Meta and/or bribe the lead chat dev.
Does this deserve a proper answer, or should it be closed as a typo? I guess it's possible that someone else could encounter the same problem... stackoverflow.com/questions/36152151/…
I can imagine this question being asked by someone else in the future. It's not common, but it isn't unique.
If OP had worded the question better, this could have been one of those trendy "why am I getting this puzzling output from seemingly ordinary code?" questions that gets ten upvotes and hangs around on the hot network questions sidebar all day.
As-is, the actual curious behavior (one line partially overwriting a previous one) is buried three paragraphs in, and only affects three characters of the output.
Better question: "but is it likely that when this gets asked again, we Python regulars will think 'haven't we seen this before...?' and be able to successfully dupe hammer?"
Imagine that one did not realize how virtual environments work in Python and installed a lot of packages using sudo pip install for OS:X. Now they are facing problems managing package versions.
This would never happen if one understands virtual environments, but if one did this prior to being en...
In the distant future, Regular X comes into the room and says "seeking a dupe target for [Help All My Output Is On One Line Python]" and PM will say "Oh yeah, I answered a question like that back in '16, here's a link"
The intent of the "no posting new questions" policy is that it's not very effective as a signal boost, because everyone interested in answering questions already has a tab open to watch for new posts.
It's similar to the "you don't need to ask 'can I ask a question'?" rule. Doing it doesn't make you a bad person, it's just not going to help you achieve your goals.
SO is about programming and development tools. I assume pip qualifies as a dev tool, though perhaps it's not and I'm even further missing the point of pip and virtual environments
ffs, I just wanted to be able to laugh at the question since I clearly made a dumb mistake with doing sudo pip install and figured folks here might enjoy it.
if you guys want to only have "plz halp my typo code" instead that's fine, but in my experience my question is considerably higher quality than most of the python questions
the fact is, it should be trivial to do what I wanted to do, but it seems... not trivial unless I want to wipe out ALL my python dependencies installed with pip ever
which presumably will break all sorts of native applications
anyways I deleted it
I can't delete the link above, or I would also do that
Yeah, I understood that the link was more "haha what an amusing problem" than "everyone come solve this for me", and I was prepared to let it pass without comment.
But everyone else started pointing out that it was technically in violation of the rules (but not spiritually in violation IMO), so I was attempting to soften the stone-throwing by explaining why we're inclined to throw stones in the first place. Not sure if I succeeded though.
I have a list of future dates. I want to basically assign a value to them based off the current week as 0 indexed. So 3/24 would be assigned 0, 3/31 assigned 1, 4/5 assigned 2 etc.. What's the easiest way to approach something like this?
Another reason for the "don't link your own fresh question" policy is that if we start brain-storming your question in here the people on the main SO site may not be aware of what we're discussing in here, so we end up getting duplicate / wasted effort.
@clickhere I think I'd solve it like this. Find the first day of this week. For each date in the list, get the timedelta between that date, and the first day of this week. convert the timedelta into number of days, and divide by seven, discarding the remainder. The result is the 0-indexed week number.
@Kevin Linking to your own fresh question for the purpose of meta-discussion by the chatroom, rather than to get us to actually answer the question, seems fine to me. But I guess people need to make that explicit before / when they post the link.
Lesson learned: in the future, curtail dogpiling by stepping in early and giving the ~RO Seal Of Approval~ to links that are not in spiritual violation
I think coming in sick might be one of those things where each individual acting in their own rational self-interest ends up making things worse for everyone.
Aaargh. My perfectly-accurate methodology sections are being criticized as not useful for the layman. But they're not really meant for the lay reader, they're meant to protect us when someone who knows what we're talking about reads the section. :-/
I frequently stay home when I'm not feeling well, because I figure 1) I'm going to suffer and be not productive anyways, and being miserable all day for ~2 hours of potential value is a horrible tradeoff and 2) getting other people sick sucks
most people are too proud to admit they aren't that effective when sick, though
@AndrasDeak when I have a cold/feel miserable I normally take a day off and rest and get better considerably faster than people who hack and are miserable for weeks
He refuses to let any uncaught exceptions or stack traces in the code. But all that happens when we do that is we're emailed a stack trace. The user doesn't see shit. So now I'm debugging off of a virtually info-less logging message.
@enderland hey, i don't have 10k rep to see your deleted question, but if you did a sudo pip install pkg_a pkg_b, you at least know the path of what files were modified, so you can go back to that version by finding out what it's supposed to be and downgrading with sudo pip install pkg_a==version (you'll have to uninstall if newer first)
I think it comes down to office culture. A manager can choose to give reputation penalties to employees that call in sick frequently. If he's sly, he won't be explicit about it, he'll just put vague things like "not a team player" on their annual performance review.
What the user sees is handled on a case by case basis. At times we just render a blank screen because I guess that's better than an error. I really have a problem with how this guy was taught.
If a manager does not give out reputation penalties, then this incentivizes all employees to use 100% of their sick time over the course of the year, regardless of whether they're actually sick that often. This results in a performance hit for the team, which might make the manager look bad.
If a manager gives out reputation penalties, then people will only take sick time if they're exceptionally sick. This increases butt-in-chair time, but can cause moderate infectious illnesses to spread throughout the office and reduce productivity, which might make the manager look bad.
It's good to have an "occasional work from home" policy, as then people can try doing a bit of work from home if they're worried about being contagious
I'm glossing over a lot of details here, especially things like "workers would be more productive if they had more time off, so taking fake sick time is actually a net gain"
A chaotic evil manager might impose maximum reputation penalties, and blame the productivity loss entirely on his workers. "I maxed out all the measurable metrics [ie butt in chair time -ed] so it's surely not my fault that we missed the deadline. Give me a raise and more workers"
@enderland I admire your guts! That's really having the courage of your convictions
It's pretty easy once you've stripped it down to install virtualenvwrapper and its dependencies - these should be the only things you need to sudo install
well that seems to have worked. though seriously passing xargs to a sudo uninstall was not something fun at all, though I guess at least I could verify the pip freeze first :)
user559633
you could edit sudoers to return "nope, not doing it" if calling sudo pip
It's surprisingly hard to construct a tree structure from a list of elements, each of which has an indentation level that indicates that it is the direct descendant of the closest element higher in the list with an indentation one level lower.
... In O(N) time.
user559633
@holdenweb i have free weights next to my desk and i lift them for 5 minutes when i get like that. not sure if it's helpful, possible in your office situation, but it's helped me not vent frustrations
@tristan ahhh working at home. I was imagining working in an office and getting frustrated, then lifting weights... seems... maybe could be taken the wrong way :)
Hey. I am using Python 3.5. I opened scripts folder to open pip. There are 3(pip.exe , pip3.exe and pip3.5.exe). Whenever I open any of them, console opens, flashes something and closes. I want to download selenium module.
Phew. Finally got addCollapseAndExpandButtonToEachCommentOnEachPageThatContainsCommentsOnHackerNews.user.js working the way it did before I lost the original source code.
There are lots more Python programmers than flask programmers, and there are times when this room is silent for many hours. I'd be surprised if there were enough flask types to maintain a room, but best of luck to them if they're interested.
Interesting to no one but me: I'm reading through the archives of 1950s comic King Aroo and one of the characters is a clear reference to my Alma Mater, Drexel University.
The character is a dragon named Drexel, and the university athletic teams are all named the Drexel Dragons.
is there a way to run 2to3 on a small code segment from within python? I know there is a lib2to3 but it only seems to take files.
I'd like to just be able to do checkcode("cmp(a,b)") or checkcode("execfile(a,b,c)") and see the equivalent code for python 3, is that possible or do I need to just use a file?
@AndrasDeak No, it's not necessary. It's a fairly common mistake by newbies - they don't know how to convert the string returned by input into an integer, so they use eval instead of int()
Possibly they read beforehand that "input() in 2.7 is equivalent to eval(input()) in 3.X" and thought it meant that the latter code is recommended in 3.x
OP read a comment saying "you should use mixedCase" and in the end decided to use only lowercase letters, so it's entirely possible his reading comprehension isn't stellar