« first day (2069 days earlier)      last day (3103 days later) » 

12:00
and also I separate them with two spaces each
like this
# django imports
from django.http.response import JsonResponse
from django.views.decorators.http import require_http_methods


# python modules
import json
import logging
import traceback
from datetime import datetime
I also like to group related imports, but I put 3rd party imports after standard modules. And I only put a single blank between groups of imports.
Yeah, two lines looks weird to me
for imports anyway
Well! I missed that
and I can't believe it
:(
12:26
cabbage
Sometimes error messages can be real deep
> self is not defined
> time is not defined
Man, it's raining like hell. If hell were wet.
Anyone using flask?
@corvid man woman
@SyedZainulAbedin Sure, why not? (note that if you have a question, just ask the question)
How do I set default value to the Model..If the value is not ajax'ED
12:40
cbg all.
Afternoon cabbage
@SyedZainulAbedin what model?
Please bear in mind that we're not mind readers.
We don't know what you to do, or what you've done already.
Database model..That was funny
I'm literally not joking.
What else do you expect us to do?
You haven't shown any code, we know that you're using Flask, that is literally it.
@Ishmael Good stuff. It does everything you need it to?
12:43
Here in class constructor say _init(self,col1,col2,col3):code to initialize variables
We don't know anything else about what you're doing.
What is that supposed to be? It's an incorrect __init__ method, but we don't even know what class you're using.
Model, duh
Also what's really funny is that Flask doesn't have any database models
Exactly.
unless you're using a 3rd party extension
12:45
SQLAlchemy..
Please format your code properly, and if sharing more than a few lines, please use pastebin.
To start with though, please read sopython.com/chatroom
12:59
Morning cabbage.
cbg(morgan)
morgan.__cbg__()
Woooo, came back from vacation to discover that my graphics card seems to be failing. I have massive screen tearing on one monitor.
Oh crap
Just to pinpoint where the problem is, is the tear still there when the monitor is unplugged?
Yeah. Today is going to be fun.
Nope, it looks like someone applied a parallax effect to the one monitor.
13:08
@MorganThrapp Have you tried re-seating the card?
pls no more webdev
Just reinstalled the driver and it works. The day is saved!
Now to get through the 53 emails that came in when I was gone for 3 days.
Anyone know a way to highlight certain text from a PDF file in a screenshot?
I'm envious of you getting only 53 emails in 3 days
13:18
50 is p3n1s enlargement anyway
i.e. Display a snapshot of a page of a PDF file with certain words highlighted.
With gadget on that one. We've won the war on spam, now to win the war on bacn
@Carlos if you have any photo-editing software, add a box, fill it with <highlight color> and reduce opacity
I'm so behind on my emails. Hopefully that'll change tonight
@Carlos programmatically, or manually?
Programmatically
As in I'm using regex on the extracted text from the PDF file to detect the presence of certain words. Ideally I would then like to display these pages to the user with the matching words highlighted
13:21
you'll need to do some OCR on the text, find it's position in the image, and then do a bounding box around it and do what I suggested above
Probably convert it to an XPDF and use some kind of XML parser
For non-OCR text
Just embedded text
Does pdf even handle transparency? Or do you have to draw a rectangle beneath the text?
I wouldn't know
there's something about matplotlib and pdf backends and transparency
13:25
Interesting email I've just gotten:
Dear George,



My name is Reihaneh Bidar and I am a PhD student from the School of Information Systems, Queensland University of Technology. I am engaged in a research project titled: “A social influence theory of participation in service co-creation through social networks”. The main aim of this research is to develop an understanding of how social influences drive people to participate in co-creating services with others in social networks. For the purpose of my study, I am looking for people who are members of “Stack Overflow” to participate in an interview.
been a while since I've come here...
@Kevin is your name actually George? :P
Nope. I hope they get in contact with this George guy, he sounds like he could be of help to them.
I'm glad starring that doesn't make it look as ridiculous as it does in context. one of the few times starring makes something look better :-)
"Dear Kevin, you appear to be the leader of stack overflow, please help with study"
Not being able to read a name might be a huge con.
13:27
I know people in Queensland. Want me to send some heavies out there to check him out?
so KevinGeorge, why do you participate in SO?
The tiny slivers of gratitude I receive sustain me in an otherwise bleak existence
@Carlos Hold on. If you've already extracted the text, and used regex to locate the portions you want highlighted, why is it even relevant that the source document is PDF?
Whoops. Turns out Reihaneh is a girl's name, you big racist Intrepid
you monsters
13:29
Dunno, feel like a PhD student looking at social (stuff) should be able to read a name...
it's a big hinderence otherwise.
So a human can visually see where the extracted was in the original document (e.g. for sanity-checking)
extracted text*
this makes me question all PhD research though, in addition to my graduate work. people think so highly of academia... lol
"Participation involves an audio-recorded interview, and an observation of your interactions in Stack Overflow. The interview will be conducted either face-to-face, via Skype or by phone [...]" Whoops they must have confused me with an ordinary human being that can talk to strangers
meh! what's in a name? That which we call a Kevin by any other name would answer just as many questions...
13:30
The name defines the thing
no, it only points to the thing
this is python
s/Kevin/George/g
WHY WONT IT WORK
Talking of academia. I just got our weekly 'staff roundup' email. Fine, ok, fair enough. Except it's an (HTML...) email, with a list of headlines, and then a 'click here' link at the bottom that takes us to a (what looks like a) SCANNED PRINTOUT of the weekly roundup, hosted on the University servers. GUYZ. What are you doing.
13:32
@Withnail did you take a photo of the monitor to show to your boss?
Oh, my boss is head of social sciences. I'm lucky he answers emails.
of what?
@Withnail this comes to mind
Who are you again?
13:34
Snort. :-D
@Withnail I am so glad I got out of it
6 months.
my advisor was ah, difficult to deal with
but in grad school... it's far too late to escape when you realize that
in the real world you can easily quit jobs. grad school? you're screwed
Currently lining up work for post-escape.
you doing grad work? or undergrad?
13:40
@Carlos Fair enough. This question looks like it has some useful info stackoverflow.com/questions/7605577/…
Me? Postgrad, just finishing up. (I've bored people in here with it before.)
I have a question on academia which will show the nature of my grad work. lol
Any way to shorten this to one line?
import sys

open(sys.argv[2], 'w').write(open(sys.argv[1]).read())
15
Q: How can I help my advisor not lose face when changing from a thesis to non-thesis program?

enderlandI am a comajor masters student who is experiencing difficulties in timely responses from my advisor. It has taken an average of almost 4 months for me to get feedback each time I have received feedback on my thesis since leaving campus. As a result, I am trying to convert from a thesis to a non...

@JossieCalderon Try __import__("sys").argv[1]
Although I guess since you use sys twice, you either need to __import__ it twice or use lambda trickery
13:44
> Why are you worried about helping save face for this person? It sounds like they have been nothing but problematic.
I think the question is about how to convince the advisor to sign the relevant paperwork. — Jim Conant Aug 14 '15 at 20:46
(lambda sys: open(sys.argv[2], 'w').write(open(sys.argv[1]).read()))(__import__("sys"))
Something like that
@enderland I don't think he would care lol
if I thought that I wouldn't have asked the question ;-)
@Kevin thanks it worked, i didn't know about __import__()
13:46
I also can't imagine that he'll care. There's also very little he can do. If you're switching from an MRes to an MSc or whatever. If he resists, and what? Just push it through arbitration/escalation.
It's pretty obscure since there's rarely a good reason to use it
@Withnail well I wanted him to approve the program of study change (which worked in the end)
@enderland Assume he cares. What's the worst case scenario?
Honestly, life is way too short to GAF about hurt feelings.
(Certainly in this context)
@JossieCalderon I take 4 more credits. the only reason I cared about this was getting approval for those credits
also, full disclosure - I did successfully get the change and graduate
13:47
@enderland he's too busy worried about other things.
but I'm 100% sure it pissed my advisor off to no end
@JossieCalderon nah. my advisor was a micromanager in spite of being too busy (among other reasons he was a bad advisor)
@enderland probably not. he wasn't invested in you finishing your thesis.
he had absolutely no problem being the single reason holding projects/students up for months because of his busyness
I had an "out" in doing the capstone (instead of thesis) -- the people who get screwed are the PhD students
13:49
@enderland Just remember: it's either you or him that gets capped.
Hahah.
congratulations on getting out of there.
It's probably a bad idea to hold off on important life changes out of fear that somebody unimportant will disapprove.
(giving advice that I don't myself follow, here)
the problem is the power in academia is 100% in the hands of your advisor though
which is even worse when you have a bad advisor
13:50
It's really not, though.
you can't just quit/change bosses/companies as easily as you can
It might seem like that, but it's not, even in the US.
Certainly the establishment is very invested in creating the illusion that they have complete power over you.
@Kevin I could have quit/left at any point I wanted, however there would be no chance of finishing that thesis without my advisor's approval
@Kevin unfortunately they're so invested in the illusion that they make it happen, and relatively easily
13:56
if you end up with a crappy advisor (for whatever reason) you pretty much have nuclear options if you want to finish your degree as planned
Ok I was telling you sweet lies but I see they weren't very effective. Carry on.
@Kevin only as long as you don't pay attention to the man behind the curtain
@JossieCalderon For the love of Guido, why do you want to do that? Don't you have cp? :)
@JossieCalderon keeping the import line separate is always preferable. But you could do this with the rest:
infilepath, outfilepath = sys.argv[1:]
with open(infilepath) as infile, open(outfilepath, 'w') as outfile: outfile.write(infile.read())
> See how short you can make the script. I could make this one line long.
...challenge accepted....
14:05
Hey @Carlos. I just noticed that my previous link was to a commercial product. Sorry about that. I still can't find a good free Python solution, but here's one in Perl: stackoverflow.com/a/19551997/4014959
@JossieCalderon in case no-one's shown you, it may be worth reading this :)
@RobertGrant yeah, i was questioning myself earlier but i told myself "hey, i'm learning from this tutorial so why not". reading link now...
> unless you’re very careful
that's me! ;-)
famous last words
@JossieCalderon Ok... But bear in mind that LPTHW is notorious here for prompting people to ask weird questions. So far, your track record isn't great. ;)
remembers the shouting at he got for suggesting LPTHW :(
14:15
LPTHW is a piece of utter sh*te.
@PM2Ring yeah the questions can get a little weird! i would have never known to use __import__(), for example.
Teaching a new user how to use __import__() is like teaching your son how to light a cigarette using the stove.
9
does search broken ? according to stackoverflow.com/help/searching stackoverflow.com/search?q=%22%2B%3D%22 should work
I remember that something similar worked
I seached for with the following search: "+=" and it returne nothing
cabbage by the way
(Sigh. Why must all job ads be on the look for talented developers? I'd like someone to embrace my mediocrity and pluck.)
14:22
@JossieCalderon SO Python didn't adopt its anti-LPTHW stance because some of us read it and decided it was bad; that came later. What happened is that we kept getting these odd questions and code examples on SO that implied a weird (mis)understanding of Python, and the thing those questions had in common was LPTHW. It's gotten to the stage now that several of us can often spot a LPTHW "casualty" just from the vibe of the question without the OP needing to explicitly mention LPTHW.
@PM2Ring Such as observing there is no practicality to writing one-line scripts?
Hmmm, os.walk where I want to rename the directories at the same time. Fun!
@JossieCalderon in python maybe, I am writing one line && scripts in bash to make docker images smaller! :-)
@JossieCalderon Oh, writing one-liners is an ancient and venerable tradition long-predating Python, so we can forgive you for that. :)
14:25
@XavierCombelle: Take a look at stackapps.com/questions/2690/…
@JossieCalderon It's not what I want I found the bug was reported but not solve meta.stackexchange.com/questions/249848/…
Woot! I just checked my profile and I saw that I'm part of the sopython community. A complete narcissic pleasure but it feels good to be childish, from time to time! Wooot!
congrats @AndyK!
anybody wanna help me click a lot of download buttons?
Thanks @inspectorG4dget I needed to celebrate something and without anything to celebrate, that's the best thing I could come up with. What do you need to click?
tee hee
oh SONOFABISCUIT! they use cookies, and don't throw all my search params into the URL
never mind. I'll just do this myself... it's going to take longer to make sure I give accurate instructions. Thanks for offering
14:42
a test plan is always welcomed
After Gadget's use of Sonofabiscuit I now imagine that they are, in fact, Kimmy Schmidt.
I tried with the station number 99AA999
but nothing appeared
I was able to find this 06EA010
1986-2014 CHURCHILL RIVER ABOVE WINTEGO RAPIDS SK 06EA011 Flow and Level 55°34'31" N 102°49'47" W 209717.5
never mind. I actually just finished downloading everything. I hate it when people don't give me an API backdoor into their system
download button is not working when trying to dload the results ...
I'm sent back to the front search page
you're on the right track. I needed all the data for all the stations on the atlantic coast. Don't worry about it, though. I just finished downloading everything
14:48
When I saw this question the other day I thought it was too unclear to answer. I'm happy for the OP that they got an answer, but it's a code dump with no explanation, and I don't think the question or answer in their current state will be much good to future readers. Should I hassle the answerer to add explanation to his answer and the question? Or should I just vote to delete? ;)
Hassling is worth a shot.
OK, shall do.
cbg
yo @idjaw
o/
14:53
@PM2Ring you should hassle the questionner too
@AndyK Maybe, but they didn't respond to comments the other day. And I get the feeling that due to their poor English skills any explanation would not be very helpful.
Although your code is well-written & self-documenting, your answer would be even more useful to future readers if you added some explanatory text to your answer. And it would be great if you could also edit the question to explain the OP's problem to future readers... — PM 2Ring 2 mins ago
@PM2Ring the lady who asked the question seems to know enough english especially as she claims to be doing a MsC in IT in India. AFAK, Msc in India are taught in English. For the answerer, Cdlane, s.he knows English stackoverflow.com/questions/37619994/…
I remembered one of my ex colleague, a new zelander, who went to south of France in a hotel. He asked the owner if she knows english and the woman replied in French that the she doesn't
the next day, he got downstairs and the lady was happily speaking English with guests who were celebrities
Pretty standard for France ime.
@Withnail pretty standard for a lot of place ... but in France, they do have this backward mentality that I dread ... they called it national pride ... right
Yeah, pretty much. See also: My wife speaks pretty good French (like, conversationally fluent), and ordered in French in a parisien restaurant, to be responded to with sniffs and haughty English in reply.
15:05
ha ha
and parisians are the worse of worse amid french
(sorry for your lady)
@Withnail Same thing happened to my wife and her sister when they want to Paris. They are perfectly bilingual, but were still met with ridicule for speaking in French.
@AndyK Yeah, I'm familiar with cdlane's work. They don't normally do code-only answers, but maybe they did it this time because they recognised the question as a homework problem, or something.
In contrast, I went to sicily with pretty ropey Italian earlier in the year (sub high-school level!) and was greeted warmly & with patience wherever we went because I'd made the effort. \o/
(hopefully will be the same in the Balkans later in the year!)
Interestingly, it was learning to program in python that got me to overcome my 'I don't do languages' block.
I would like to visit the balkans and Sicily too.
I want to go to Italy and eat/drink my way through the country.
15:12
yes, Morgan. I will marry you.
4
@idjaw I thought you'd never ask.
This is the happiest day of my life.
We're going to eat and drink the world
I'll let GF know that she's been replaced. She's gone for 5 weeks, so this is pretty perfect timing.
@MorganThrapp I know tons of good places in Napoli and Florence. There's one restaurant that's a mix of Japanese and Italian food, it's pretty interesting
Oh it's OK. If the great Ludacris has taught me anything, it's "area codes". We're good.
15:18
@corvid I want all of it.
I could get down with a little extra-national polygamy.
it's just more love to go around
I'll post the gift registry here in the coming months
Let's eat and drink our way in Italy!
Ah, recursively going through directories and renaming some at the same time. How annoying you are.
15:24
@idjaw Do we get to pick a china pattern? I've always wanted to do that.
As long they are dishwasher safe.
I've never owned a dishwasher, is this what married life is like?
Also, this is my wedding registry. Just the whole site.
That's fair. I agree.
@MorganThrapp a few months ago, I was free (or almost). Then I met my GF, her boy and girl
Dishwashers are lifechanging.
15:28
then I moved to some kind of dystopian suburbia
Yeah. Life with kids is having 5 things to do in one day knowing you can only get 3 done. Then you wake up the next day and have 7 things to get done. So, we're getting a dishwasher.
Can I quote that on twitter? :D
@Withnail I would love one. Right now I wash the dishes (hopefully) before the GF yells at me for not doing the one household chore that I actually do.
and now, I know what marry life is ...
@idjaw brilliant
this is married life
Fixed it
I think it's more life with kids
15:30
Also, for our honeymoon, we're making this whole list. imbibemagazine.com/best-milkshake-recipes
I actually think simply being in a relationship with someone and living under the same roof would give you that "busyness"
got to rin
run
my lady is waiting
@RobertGrant I usually do that sort of thing in two passes. On the first pass, build a list of stuff to rename, then go back and do the actual renaming. Optionally, save the rename list as a file that can be checked (and possibly hand-edited) before execution.
I mostly just want a drink now. :(
@Withnail Yeah, me too.
15:31
4:30, hmm. Not realllllly too early.
I have to cycle home first and then do a technical test, so probably shouldn't though...
It's 11:30 here, but I can pretend I mean PM.
11:30 is 'sun above the yard arm' territory iirc
I've randomly selected Barcelona. It is currently 5:35 PM there
@PM2Ring good idea
15:35
Enjoy your beverages gents
Is getting all the dirs, reverse sorting them by name length and renaming in that order a bad idea then? :)
I only rename stuff in-place if I'm supremely confident that I won't accidentally create an infinite loop
ex. going through the files in alphabetical order and prepending each one with "z" or something
Renaming a parent dir before you rename its children is generally not fun. :)
15:41
Working down the rename list from longest to shortest should work, but I'd still be a bit nervous.
I suspect Check shared object from a python subprocess is asking "how do I tell what code my program will execute, without executing it?" which is basically the Halting Problem.
Unless there's some simple way to tell when a script makes reference to a ".so" file? I wouldn't know, I've never heard of them before today.
I assume .so is a shared object file?
I also assume that. I don't know what a shared object file is, though, so that doesn't give me any new avenues of inquiry
Other than the avenue of me looking up shared object files on google and finding out what they are. But... Effort.
Yeah, that's the extent of my knowledge.
@Kevin A .so file is the Linux equivalent of a Windows .dll file. There is a standard command to display all libraries that an executable calls, but I can't remember it offhand. Give me a minute...
15:56
OP claims that it's not as simple as searching textually for ".so" in the python script, which is unfortunate because that's the quickest & dirtiest solution I could come up with.
The pep8 package is being renamed: github.com/PyCQA/pycodestyle/issues/466
GvR didn't like that he kept getting complaints against the PEP about what the package was doing.
"the PEP [...] is merely intended to guide humans, not to require them to follow it every time". Aw man, how can I bludgeon people for their style problems now?
They'll forever hide behind the shield of "well, that's just, like, your opinion, man"
@Kevin Nah, that would work if the script uses ctypes to load the library and call its functions, but I suspect that their script actually uses subprocess or os.system to run an executable, and that exe loads the library. So you need to get the path to the exe and call ldd on it.
TIL about pep8.org
What the horsesh*t is the comment font in code examples on pep8.org doing!?
16:05
Yeah, who thought that a mixed cursive/print font was a good idea?
Firebug says it's Operator Mono B
TLDR - it is desirable to make narrow letters wider so the font looks more monospacey
and it makes it easier to distinguish lowercase L and capital I
I guess Courier New isn't good enough for some people.
How did the new Google Fonts site get released without them noticing that it doesn't render in most Linux browsers?
According to the HN announcement they were surprised it wasn't working.
user559633
@idjaw My friend/mentor actually mentioned at one point that having kids helped him with sorting which things need to get done.
user559633
@davidism Does it render in Chrome/Chromium?
user559633
I'd assume that the people on the Hooli campus largely use Hooli Explorer.
16:18
@tristan it does
user559633
And, IIRC, they use an in-house distro, which probably negatively affects the diversity of their UX-on-Linux testing
1) Become champion mountain climber 2) Raise child. 3) Convince child to become champion mountain climber.
Apparently it wasn't rendering in Chrome even, although I didn't check myself.
It looks fine in Chrome, but Firefox is broken.
Why do today what your descendants can do a generation from now?
Note: do not instill this philosophy in your descendants, or infinite regress will occur.
Is there any reason why a server will be slightly off time? It's 3 minutes ahead of UTC
16:21
@Ffisegydd that's pretty terribad heh
"here, format things like us! except ignore our awful fonts"
user559633
@corvid yeah, it's called clock drift. in case you're not familiar with it, you should be looking at NTP for your local machine and the server.
@tristan Ah that is super helpful, thank you
it's really fun when you have 2-factor auth that gets hit by 1-minute based authentication :P
user559633
@corvid No worries. I have some time now if you need help
user559633
16:28
time.gov i'd say compare your local time to that of the server with this
I am basically just trying to implement a recurring job in a sustainable way, where a user can select which time they want it to run in their preferences
The problem is it's hard to test locally because the server I deploy to runs on UTC time
user559633
Oh, okay, in the past, I've done "run now....run in 5 minutes...run at x o'clock" -- otherwise you'll have a client with a clock slightly out of sync being offered times that they believe to be in the past
@tristan I do have to agree with that. It took my wife and I some time to accept the fact that we just can't do everything, and it's OK. So we were able to prioritize better and just not let it bother us that much that we have to move certain things to further down the week. Sometimes, we have moments where we just want to curl up in to a ball and hope things magically get done.
@corvid Like Wayne said yesterday,
@PM2Ring I have it in UTC on the server now, but I need to present it on the client in local time, no?
(most language's date libraries... kinda suck)
user559633
16:38
@corvid Yes. Do that server side in your view layer or in JS.
Is there any way to import something like http.HTTPStatus from the future?
hey guys, suddenly django orm aint writing to db
Tokens(token='a', user='b').save()
doesnt work
if i do it twice then it inserts two rows
what can be wrong here , any ideas ?
class Tokens(models.Model):
    token = models.CharField(max_length=15)
    user = models.CharField(max_length=15)
this is the model
Sorry @Prakhar - I would help look into this, but I'm about to leave the office.
no p @IntrepidBrit
I presume you've tried connecting to the database from the same python environment that you run django on?
16:47
yes, it works when i run it from python shell
with same config
user559633
does it generate any logs? does it just hang?
nah no hanging or anything, just ignores that line completely
until i write two of them
@Kevin: I suspect that the shared object question is for debugging purpose so it would be a duplicate as I explain in stackoverflow.com/questions/37839526/…
Hmm, I see
I broke the internet with my webapp
user559633
17:00
You're right. I can see it on this end too
Actually just infinite recursion, no big deal
17:23
OP of Remove replace pipe (|) symbol with comma (,) symbol in spark using python asks, "how can I do X so I can do Y?" I answer, "here is how you do X." They reply, "great, thanks... Ok, now how do I use X to do Y?"
Deep down I knew this would happen.
DSM
DSM
Midday cabbage for all.
cbg DSM
17:43
cbg @DSM
@Kevin it was indeed a spark question I suppose that replacing the | by , was badly worded here is my answer stackoverflow.com/a/37842396/128629

« first day (2069 days earlier)      last day (3103 days later) »