« first day (2228 days earlier)      last day (2735 days later) » 

12:59 AM
rhubarb
 
 
6 hours later…
6:34 AM
@DSM Thank you :-)
@DSM Ya, sadly that has become so common in Indian movies these days...
BTW, which movies did you watch? :-)
 
TRying to execute shell script from python
subprocess.call(['cmd_dtapi.sh'])
gives No such file or directory
subprocess.call(['./cmd_dtapi.sh'])
gives - OSError: [Errno 8] Exec format error
what is correct way. Also tried with aboslute path, no luck
 
6:49 AM
@user123 Does this help?
Generally, if you get an error message, its better to search in internet about it first.
 
@thefourtheye Yeah I checked SO for this. I generated this executable on the same machine where I am testing
 
Is that an executable file named as .sh?
 
".sh" is shell script, but I run cpp executable inside that shell script
 
7:07 AM
cgb
 
cbg
 
8:10 AM
Cabbage
 
Ha! I was just about to post that one. ;)
 
:D
It was detected by the typo detector
 
morning
 
cabbage
 
8:42 AM
cbg
@user123 the problem is that Python is buggy. Python doesn't run shell-scripts in shell, unless they start with #!/bin/bash or similar
this is unlike your shell. It has been reported as a bug in the Python bug tracker
just add the #! aka shebang line as the first line in your shell script and it should work
 
@AnttiHaapala why is that a bug?
Would the shell execute such a script?
 
Would it be executed if given straight to the OS?
 
it is in posix spec
 
Running things in a shell is different from running the process directly.
 
8:49 AM
execvp executes shell if all else fails
@MartijnPieters argue with the posix spec
 
but subprocess is not execvp.
It may be built on those commands but that's an implementation detail.
and the os calls are pretty much straight C calls, with only the Python types unboxed.
So I'm a little sceptical about the claim made here: A shell script has a typo in the shebang ("#/!bin/bash") but the execute bit set. It still runs via the C library's execvp() and also via bash (which uses execve() but reimplements the behavior) but not with Python's os.execvp().
Because the Python os.execvp() call is the same C call.
 
cbg
what's devops' responsibility?
fancy word for sys admin?
 
@MartijnPieters ok, I will not discuss this with you further since you know it better.
 
How to argue with Martijn about Python: Don't
 
@AnttiHaapala there is no need to be huffy about it, Antti.
 
9:02 AM
@MartijnPieters so while at it would you please read the bug because it very much describes how python execvp is not POSIX execvp
and subprocess is documented to use os.execvp when shell=False
 
@AnttiHaapala: and I just found that execvp is not using the C library implementation, so I am wrong here.
 
the last paragraph is not implemented by python execvp
 
It's a pure-python implementation built on execv/execve.
 
of course there is no claim in the documentation that these would match the POSIX, or call them
but the fact that they're modelled after the C calls...
@MartijnPieters execve is an actual syscall, and its manpage starts with
execve() executes the program pointed to by filename. filename must be either a binary executable, or a script starting with a line of the form:

#! interpreter [optional-arg]
but execvp should work like the shell in finding the executable, and that's what people would want to use for scripts that are to be searched in path.
 
9:18 AM
@AnttiHaapala Please, use dpaste next time. Thank you
 
@khajvah :P
@khajvah badly formatted too
 
clearly missed the rules
 
@MartijnPieters there is another bug too.
 
I'm sure there are.
There always are more bugs. More bugs everywhere!
You can have a bug, and you can have a bug, BUGS FOR EVERYONE!
 
namely, if PATH is not set at all, then there's a default PATH.
but it can be an exploitable bug
The file is sought in the colon-separated list of directory pathnames specified in the PATH environment variable. If this variable isn't defined, the path list defaults to the current directory followed by the list of directories returned by confstr(_CS_PATH). (This confstr(3) call typically returns the value "/bin:/usr/bin".)
 
wicked fast?
the page took forever to load :P
 
yeah for me too
but it acts as middleman and compresses everything between you and the actual server
I wouldn't forward all my traffic to them but good idea, anyways.
 
9:40 AM
cbg all
 
Hi all, wanted to know, is it possible to scrap data for linkedin private companies?
 
@Alexxio doesn't linkedin have an API?
 
@khajvah Yes it does, from my understanding, it gives public profile data
 
@Alexxio if you have access to private companies through the web interface, you should be able to get the data through the API
unless micro$oft are doing some weird shit
 
It's a task I am proposing and wanted to know if it will be possible to get done so that I won't mess.
 
9:53 AM
@Alexxio do you have access to that page through web interface?
 
@khajvah no I don't
 
@Alexxio then you can't scrap what you don't have
 
10:10 AM
cbg
voted
 
@AndyK gives a sticker
 
@khajvah ok thanks!
 
@khajvah no
 
For those who did not yet
(aka feline's mordor eyes
 
10:25 AM
 
Good morning
 
\o
 
@AndyK doesn't load
@khajvah because.. .django
 
I am gonna write my own websocket server
 
10:35 AM
Morning
 
Which picture, @AnttiHaapala?
 
@AndyK mordor eyes
congrats UK, you've summoned Cthulhu
 
@AndyK the voting data is public
the constituent badges
 
10:57 AM
@AnttiHaapala We did?
Explains the heavy post-apocalyptic haar
 
11:17 AM
I just wrote a horrible list comp to serve as an example of why it's not a good idea to try to turn every for loop into a comprehension. It's got more side-effects than bad acid. stackoverflow.com/a/40718641/4014959
 
11:38 AM
@khajvah gotta love charts that don't have a bottom
cabbage
@manuzi1 that's... interesting:D
@PM2Ring congrats on 20k! \o/
5
now go downvote something to get a round 20k
then vote to delete it
 
Yay! Thanks, Andras!
In one of the questions I answered today, the OP was complaining about how slow Python was at iterating over his data. But his problem was that he was iterating over stuff in virtually the worst way possible. :) stackoverflow.com/questions/40715685/…
 
wow.............
 
I shudder to think what inefficiencies there are in the rest of his code.
 
11:54 AM
such as a+b+c+d+.... :D
OK, that's mostly elbow grease
 
Well, that's just a dummy function example, so that's kinda forgivable.
 
a good dummy function goes from a to z :D
 
12:10 PM
@PM2Ring also, dowvoted stackoverflow.com/a/40715717/918959
(^downvote to oblivion)
@AndrasDeak I LIKE THE LATTER ONE
 
Why does it warrant a downvote? Because it's more of a Code Review question? IMHO, questions like that one are ok on SO: the OP has shown their current attempt, with a MCVE, and needs help to make the code work properly. Technically, the code does work, but it's so inefficient it's practically useless.
OTOH, I guess it's not as bad as that Fibonacci search code from the other day. :)
 
12:33 PM
@AnttiHaapala way ahead of you
@PM2Ring Antti means the other "answer"
 
@AndrasDeak Ah. That makes sense.
 
Cbg
(Back in the UK)
 
Cbg guv'nor
 
Good to see you again, Bobby G!
Newbie just doesn't get how to create a proper self-answered question: stackoverflow.com/questions/40718656/…
 
they'll learn soon enough *sinister smile*
got spam an email from SO about developer survey, woo.
 
12:55 PM
(-:
 
BAH *developer story
 
Guten morgen cabbage
 
Guten Morgan Thrapp
@PM2Ring CONGRATS!!!
20k
 
Thanks, Bhargav!
 
1:19 PM
Nice
I'm almost there
501 left... need to answer me a bunch of questions, heh ;)
 
hey guys
how r u
 
@PM2Ring woo hooo - 20k... the answers of the site tremble in fear! :p
 
afternooncbg
 
please define a word for afternoon, when using it with cbg. ty.
*word
:D
 
People usually just append the time of day to it. I've seen evening-cbg before.
 
1:30 PM
@JonClements :) :rubs hands in anticipation:
 
^^ that.
 
To paraphrase Oppenheimer's paraphrase: "Now I am become 20K, the destroyer of answers" - PM2Ring
 
@JonClements nominated for this year's moderator election?
 
@Aamirkhan huh?
 
user6568562
1:36 PM
@PM2Ring Eyyy, congratulations [ :
 
I've voted in it if that's what you mean?
 
Thanks, random!
If you want a lesson in how not to list comp, please see
2 hours ago, by PM 2Ring
I just wrote a horrible list comp to serve as an example of why it's not a good idea to try to turn every for loop into a comprehension. It's got more side-effects than bad acid. http://stackoverflow.com/a/40718641/4014959
 
@JonClements you should be on that list
 
@Aamirkhan already a mod - don't need to run for re-election...
 
:)
 
1:40 PM
What's the term length for mods anyway? In perpetuity?
 
@Kevin basically... until you can't take it any more - or you're not active or you make a really big f* up...
 
"Until the screaming madness takes you" seems like a reasonable limit.
 
Until you are corrupt
 
@Kevin To be fair... the screaming madness had already taken me before hand... so err... not sure what boundaries to set on that one
 
Ok, so screaming madness is necessary but not sufficient to end a term.
 
1:47 PM
@Kevin a typically good semi-related answer by Brad and Ben's answer is great as well
 
Seems reasonable.
Hmm, there's a document hosted online that I'm interested in seeing previous revisions of. There's no links to older revisions, but from the url, example.com/2016/docs/document_20161111.txt, I suspect I could just iterate backwards through each date...
 
People like Brad, Tim, etc, make a lot of sense, They should have been the presidential candidates.
 
all are corrupt :)
 
Regarding scraping etiquette, How rude is it to make 365.25*15 GET requests, most of which to possibly nonexistent pages?
 
How large is the site? As in, how much load do they usually see / expect?
 
1:56 PM
I'm so proud of myself for using sinister like this
@JanusBahsJacquet For several reasons. One is how the handle is typically molded, but the real issue is that scissors are meant to have the blades pushing against each other. Typical scissors naturally do this with right-handed operation, but sinister forces actually tend to force the blades apart. — Wayne Werner 42 secs ago
 
Puns on the less-known meaning of "sinister" are never not funny.
 
Well Most dextrously played, sir!
 
+1 ;)
 
cabbage all
 
cabbage davidism
 
2:01 PM
item_report.name = user.name + '_' + user.company.name + '_' + str(item_report.created.strftime('%d_%m_%Y'))
how can I do this more cleary?
cbg ;)
 
morning everyone
 
item_report.name = '{0.name}_{0.company.name}_{1:%d_%m_%Y}'.format(user, item_report.created)
 
@JanKowalski I recommend using format
 
It's pretty clear what it does, but format would be cleaner.
 
@WayneWerner exactly what I was just going to do... bloomin' ninja'ing me grumble grumble
 
2:02 PM
@WayneWerner @corvid thanks, looks good
 
I think that's the first time I've ninja'd anyone, at least that I'm aware of ;)
 
Does double . lookup work though? Can't say I've tried...
 
Me either. I assume so
 
class t1:
    class t2:
        blah = 'test'

print('{0.t2.blah}'.format(t1))
Yup :)
 
TIL :)
 
2:08 PM
I recommend using named format arguments.
:P
 
That would be the other option
item_report_name = '{user_name}_{company_name}_{create_date:%d_%m_%Y}'.format(
    user_name=user.name,
    company_name=user.company.name,
    create_date=item_report.created,
)
 
I much prefer that
and TIL about the date formatting
 
either option is an improvement. I'd say that I typically use this approach for anything longer than about 5 characters in the format string
 
@FlorianMargaine yup - datetime objects support their own .format similar to strftime
 
@FlorianMargaine check out pyformat.info :)
You will learn all the things ;)
and there are lots of good things to learn
 
2:12 PM
I've already been hit by %s on 2.7
 
one of my faves: %r or {!r}
Specifically:
> If at all possible, this should look like a valid Python expression that could be used to recreate an object with the same value (given an appropriate environment).
 
@JonClements I'd totally forgotten about that! Pity that struct_time doesn't implement that too. These days, I often refer to the online docs, but I've got the old Python 2.5 docs on my HD. They were mostly ok for 2.6 stuff...
 
Are... are you a documentation-hoarder?
 
What that __repr__ stuff gets you...
 
I only migrated from 2.6 to 3.6 a few months ago. The 2.5 docs are in the old format, and when the new format first appeared I hated it, but I've gotten used to it now.
 
2:21 PM
import datetime
from collections import namedtuple

Stuff = namedtuple('Stuff', 'this,that')

class AwesomeRepr:
    def __init__(self, name, serial_num, created, data):
        self.name = name
        self.serial_num = serial_num
        self.created = created
        self.data = data

    def __repr__(self):
        return ('AwesomeRepr('
                'name={0.name!r}, '
                'serial_num={0.serial_num!r}, '
                'created={0.created!r}, '
                'data={0.data!r})').format(self)
Then you can typically just copy/paste the output of that into a prompt, or into your code to recreate that object
 
@PM2Ring from old to... not even out yet?
Are you going to wait until 4.6 to upgrade again? That might take a while
 
Yeah. You can "blame" Antti. :)
 
I wonder what America's elections would look like if they followed Stack Overflow's process
 
@thefourtheye just noticed about the CTC - CONGRATS PUPS! WOO HOOOO!
 
+1 to the pups
 
2:25 PM
hm.
I wonder, is it possible to have a python process spawn a remote ipython process? As in, it becomes an ipython server, and clients can connect directly to it. This way, you get an REPL with access to variables directly in the process
(yes, I'm a Lisper.)
 
\o good morning, it's monday = not so good, but it snowed so it's all good
 
Morning Mooing
 
good luck bhargav
i have a request, 'bhargav' is kinda hard to type out can i call you something else ?
 
BR?
Thanks :)
 
k br.... making you should like your Brazilian but it's all good
 
2:35 PM
The advantage with BR is that, I can sign off my letters as "BR BR", Which stands for Best Regards, Bhargav Rao
 
@PM2Ring that list comp's just blow a guy in my office's mind.
Had to come back and remind him that was in the 'do not try at home' pile :D
 
@Withnail Excellent. :)
 
Reminds me of a corporate email I got the other day. The writer's initials were M.E., and he signed the email, "warm regards, me"
 
how do you guys handle near impossible deadlines?
 
We defer it to a possible deadline
 
2:38 PM
I have a moderate mental breakdown and let the deadline pass without finishing the thing.
 
^^ What Kevin said.
 
I readjust everyone's expectations so that whatever I did finish was what was supposed to be finished for the deadline.
 
On a mildly less facetious note: I'm very strong on pushing back.
 
I summon my spirit animal, Douglas Adams:
> I love deadlines. I love the whooshing noise they make as they go by.
 
"ABC is not achievable by deadline to the standard rqeuired; XYZ is. Would you like me to XYZ well, or attempt more of it poorly?"
slightly more or less diplomatically depending on who it is i'm speaking to.
 
2:42 PM
I see.... I'll keep those in mind, on a side note, is it shameful that I had to google who Douglas Adams is ?
 
Nah.
 
@MooingRawr what @Kevin said. Now you should go out and enjoy Hitchhikker's Guide :)
 
Alternatively, if you knew about Hitchhiker's Guide but didn't know the author's name, that too is fine
 
I knew the book from the movie...... xD
 
Though if you read the entire trilogy, all 5 books, and you still didn't know the authors name...
 
2:47 PM
To be fair, if you get the anthology book and only open it once to read all 5, you only see his name on the cover once.
 
Yeah that's like 0.00001% of the information in the book.
 
I was taught not to judge a book by it's cover, hence I don't read anything on the cover xD
 
True... though I don't have the anthology, I know some books have the title/author on the page heading.
 
There's a dupe proposed here, However I clearly remember that there was a "use subprocess" some where, which suits better. Does anyone have a link? stackoverflow.com/questions/40722150/…
 
I can't remember my credit card number or social security number or phone number or anyone's birthday except my own, so I have great empathy for people with bad memory.
 
2:50 PM
You have your credit card number memorized?
 
Numbers, Kevin, what do they mean?
 
he probably meant pin code
 
No, I assumed that neurotypicals memorized their whole credit card number. Is that not a thing?
 
I wrote the card pin on a sheet so that I can remember it. But I forgot as to where I kept the sheet
 
@Kevin not really
 
2:55 PM
Scribbles revision notes in my first draft of my book, "Normies in the Mist"
 
@MooingRawr Techmology, what is that all about? Will computers ever be able to tell us what 9999999999 times 99999999...
 
I hate the skype mac app
it just sucks.
btw, cbg folks :D
 
@Kevin It's only 16 digits (or a few more), in groups of 4. I'm surprised more people don't
 
@WayneWerner 99999999980000000001 is what Python tells me....
 
I actually memorized my library card, mostly because we used it to login via telnet to our library account
 
2:58 PM
I blame my misperception on {relative}, who really did memorize their complete credit card number and pin. Well, not their own, their dad's actually. Splitting hairs.
 
mine was 376500395, at the time
Your dad's CC number seems like a far more valuable number to memorize than you're own. Just sayin'
 
:-P
 
I only remember my student number id cards. I don't know why since we never need to remember them. My guess is because that was the only thing I had to read while on the poopers.
 
Didn't you have to write your ID numbers on exam papers?
I can remember every number right back to my 16yo exams.
 
Nope? TA did that when they looked at our card
 
3:03 PM
Our student IDs were easy to memorize because they were pseudo-7 digits, like a phone number. Pseudo because #s 4 and 5 were always 0. And then you realize they have that format because SSNs used to be used instead, and they kept the format to not change existing systems. shudders
 
I remember my ids because all the results after exams were published with ids only
 
I do still remember my student id. Possibly because in junior year I went to the main office to fill out some paperwork and I needed the number but I couldn't remember it and didn't have my card on me at the time so I had to humiliatingly travel back to my room to retrieve it. Shameful moments have a tendency to engrave themselves in your memory.
 
But funny thing is, no one else remembers the shameful things you did, only you remember them.
 
During uni time I knew my and also few other friends, so I were checking their results as well to compare :D
 
we have 6-digit alphanumeric codes, always reminded me of a prison code
 
3:05 PM
My student numbers were 9 randomly generated digits.... or they seemed random enough
 
@MooingRawr My high school classmates still remember a few. I'm training them not to bring them up anymore by spritzing them with a spray bottle every time they say "hey, remember when..." with a particular devilish gleam in their eyes
 
but after some time most shameful things are just funny
 
especially if they didn't happen to you
 
these ones were always funny :)
 
I wonder if my friends remember my shameful acts, but won't bring it up.
 
3:08 PM
true friends bring it up
 
True friends know exactly how cruel they can be to you without inflicting lasting emotional trauma. If an embarrassing trip down memory lane is on the merciful side of that line, they'll take it.
 
The obvious solution is to not have any friends.
 
cbg back
 
\o how goes it andy
 
kind of hoping between pc's and dealing with software that ... how can I say it a politically correct manner? ... software that have room for improvement
much improvement
how about you?
 
3:20 PM
Wishing I could play in the snow :( but instead I have to test software for bugs ;(
Growing up sucks.
 
argh matey
welcome to bright world of das kapital
rb
 
Not doing the things you want to do, so you can make money, so you can do things you want to do. Adulthood.
 
I can't we deploy robots to take over 99% of the jobs so we don't have to work and we can just reap the rewards, or that world would enslave humans and mankind would perish but who knows
 
the way current system works is that small group of people would reap the rewards, other would have nothing to do
 
I'm personally in favor of letting robots do all the work and letting everyone live in a blissful perpetual welfare state, but it's quite tricky to get there from here. It's a small target to hit, and if you miss, you get a world where everyone is in infinite debt to the guy that owns the patent on robots
 
3:25 PM
Which is why I hope we change the system so everyone would reap the rewards, but humans too greedy for that to happen i guess...
 
@Kevin So be the guy with the patent on the robots and you win both ways? :p
 
@Kevin I agree. Think of all the innovation a perpetual welfare state would drive
 
@JonClements That's why we're all in this industry, I'm sure :-)
No need to deny it. I understand that you're more likely to get into the dominant position if you don't publicly admit you're vying for it.
 
heh, its a biggest weakness of our system now, that all goods one day will be owned by one person
 
@marxin nah... I'll have dibs on dog food
 
3:31 PM
war as a reset is not a solution anymore, we will see ;)
 
@marxin well thats quite a pessimistic, scary point of view :|
 
@Kevin It's only tricky when you have stupid laws that say that corporations are people. Soylent green is people, not corporations.
I can't eat a corporation when the 💩 hit the fan
If you did have robots doing all of the work and left us free to do whatever we want (more or less), that may or may not be a good thing. There have certainly been plenty of thought experiments put into it.
But think about it - imagine if the only reason that people had to move the atoms that make up themselves is because they wanted to physically be at point B rather than point A, instead of the fact that their job demands it.
Robots putting things together, robots moving atoms that make up our food & medicine, robots planting and growing and harvesting our food. Except of course for the people that care to do it themselves - then it's totally cool for them to also do it, if that's what tickles their fancy.
 
This guy is making an effort to fix his horrible attempt at a self-answered question, but he's still struggling. I'm happy enough to vote to re-open, etc, once he's fixed it, but until then he can struggle on without my assistance. Surely he can understand that the code in his question isn't a MCVE...
 
@PM2Ring one of their mistakes was not doing anything in the first 3 hours after posting...
 
True, but maybe they'd been working on their "masterpiece" for hours and felt they deserved a break. Or it was dinnertime. :)
Oh, @WayneWerner I made a little enhancement for your AwesomeRepr class. It's a little helper function to create the __repr__'s format string:
def make_repr_format(clsname, keystring):
    a = ['{0}={{0.{0}!r}}'.format(k)
        for k in map(str.strip, keystring.split(','))
    ]
    return '{}({})'.format(clsname, ', '.join(a))
You'd call it like this, saving it as a class attribute:
 
3:43 PM
Nice :)
 
_repr_fmt = make_repr_format(
    'AwesomeRepr', 'name, serial_num, created, data'
)
And here's an f-string version:
def make_repr_format(clsname, keystring):
    a = [f'{k}={{0.{k}!r}}' for k in map(str.strip, keystring.split(','))]
    return f'{clsname}({", ".join(a)})'
 
That's a compelling explanation for why people write incomplete posts and then ignore them for hours. They must have been interrupted part way through by something more important, and they decided they might as well submit what they had before going off and being busy elsewhere.
People that don't get interrupted partway through their post tend to write better posts, leading to a strong correlation between "bad post" and "too busy to reply"
 
DSM
Morning cabbage for all.
 
idk, when I ask a question I sit here until I figure it out on my own or with the help of someone from SO
 
That makes you one of the good ones.
 
3:47 PM
I was just going to say that sounds a lot like me
 
@PM2Ring I'm starting to think that f-strings are your new favourite thing :)
 
@WayneWerner I think the true nice world would to let humans do what ever they want to with out disrupting other humans for what they want to do (don't kill, beat up,... etc). I on't think there will be a point of stealing since everyone has access to everything.
I don't think corruption will be a problem since everyone has everything. I think the only issue is humans getting bored, or humans hating being on the same level as other. I think it's feasible for robots to generate everything we want, and let humans who 'want' to maintain or create things as a hobby like thing. Will this world ever come to existence?
I doubt it though but one can dream
 
but then again, I suspect that's why we're here in room 6, rather than reading MSNBC.com or updating our fantasy sportsball league
@MooingRawr I'm pretty sure that will roughly coincide with the heat death of the universe ;) :(
 
"since everyone has access to everything" is a bit optimistic. In a post-scarcity society, I still can't have a personal concert by Bruce Springsteen in my living room every night.
 
^ those who create would advance past those who do not
 
3:51 PM
@Kevin Everything being like python, objects not services.
 
I try to guide OPs that post incompletely specified questions, but I'm really losing my patience with those that post & disappear, never responding to clarification comments. I guess sometimes those comments can help them figure out the solution themselves, but it'd be nice to get some feedback.
 
but really, even today - those who create advance past those who do not
 
@MooingRawr The Machine Stops is an interesting thought experiment story that envisions such a world, and the end of it.
 
@WayneWerner going to try and find an e book of that xD
 
@JonClements They're pretty cool, but I don't use them very much, since there's not much point putting them into an SO answer. Unless the OP specifies they're using 3.6+. :)
 
3:52 PM
@PM2Ring as long as you're ready to pounce when they do!
 
@JonClements One annoying thing about f-strings is that you can't build them dynamically. Or at least, I don't think you can. You can concatenate them with normal strings, but you can't magically turn a normal string into an f-string.
 
user559633
@WayneWerner Well, that's silly, because Fantasy Sports Ball season starts in April
 

« first day (2228 days earlier)      last day (2735 days later) »