« first day (2570 days earlier)      last day (2603 days later) » 

00:02
I love the username 'DarrenNEEDSHELP'
Guys, how can I run javascript code inside a Selenium browser and extract its results? I want to be as if I opened the Firefox browser, typed that command inside the web inspector console log and got the results. I don't want to have to deal with url.request because it doesn't load javascript changes.
Is there some kind of web console API ?
00:36
I haven't used selenium in a long time, but I'd be very surprised if there was no possibility to execute javascript
 
4 hours later…
04:11
@Arrow Selenium is designed to test user interaction with web pages. I don't know of any way to have Selenium run JavaScript. Besides, there are better tools to test your JavaScript directly, such as Jest.
@Arrow It will help if you back up a step. What is the exact use case which you are trying to test?
@cᴏʟᴅsᴘᴇᴇᴅ wow, I didn't realize you have a hammer
04:28
hey guys so i know this is more dployment related but the project i'm trynna run is in python so i figured this might be a good place to ask
I'm trynna get Django/Nginx/Gunicorn working with one another on a digitial ocean droplet
at this IP
What is "trynna"?
First off, I'll refresh the page ... half the time it'll give me the default django get started page or an error page
trying to
why a web app would produce different resutls on different refreshes is beyond me
nevermind
04:55
@Code-Apprentice Yes, I'm ranked #88 of dupe hammer users. See: data.stackexchange.com/stackoverflow/query/481657/…
05:13
@cᴏʟᴅsᴘᴇᴇᴅ and here I thought you were just some noob that uses strange characters to make it difficult to tab complete your handle
@AndrasDeak For you...we have another week here in Murca
Well, you aren't wrong
3
I am getting closer to a bronze python badge....gold is still a ways off
especially since I don't actively answer questions very often any more
gold java badge is getting close, though...
Good luck. It's a rocky road to gold. Especially since most of the questions in these high traffic tags are pretty pedestrian, and there's no real satisfaction in answering most of them.
which is exactly why I don't answer much
these days my SO contributions are primarily cvs and comments
and questions...because I'm a noob, too
My most upvoted question in the past 3 months is in
These days I hang around the data science tags more, since the questions there are generally more challenging. But there's not much of a community there, so votes on Qs/As are far and few.
That's probably also why people on chats have stopped complaining about the things I do, because I'm out of their line of sight :p
05:27
I know nothing about Data Science, so can't be much help there.
It's the , , and tags, since, well, I'm a data science major now.
all of those are on my list of things to learn
right now I'm focusing on Django
I asked a few questions there recently but have not looked at the tag to find ones I can answer.
Ah, I see. I have engineered stuff with Django in the past, but it is not a personal interest. Most of those questions are of the "fix my error" type.
yes
Sometimes I am in the mood to help with those kinds of questions, but usually as a comment, not an answer.
You tend to get more upvotes on a comment than an answer. :P
05:39
Cabbage
And you can't get downvotes on comments. :)
I've answered a few Numpy questions, and I'm about halfway to bronze, but I'm still very much a beginner in Numpy. I really should get around to working my way through a tutorial rather than randomly reading doc pages and SO answers...
cbg
Actually answering questions is more effective.
And reading Divakar's/Psidom's/unutbu's answers.
You see recurring techniques and concepts being applied.
Wow, I just noticed that I lost my gold badge as a result of that -468 User Removed.
How annoying. I don't have any topic gold or silver badges, just a few bronzes, eg tkinter.
 
1 hour later…
07:18
Hey @DSM More Catalan numbers. ;) stackoverflow.com/a/46997765/4014959
Now someone will post a brilliant answer that works bottom-up rather than top-down... I suppose such an algorithm exists, but I couldn't come up with one (although I'm certainly no Dynamic Programming expert), and I've already spent too many hours working on that answer.
67 to go for Silver
cbg
cbg
Would this qualify as a "problem that cannot be reproduced", or an answerable question?
@IljaEverilä I don't know SQLalchemy, but from the comments it sounds like it was a "typo / problem that cannot be reproduced", and it should be closed as such rather than getting a full answer. But if you think this sort of mistake is a common beginner's error, and that other SQLalchemy with a similar problem might be able to find this question with a simple Google search, then you could write a proper answer if you want to.
@cᴏʟᴅsᴘᴇᴇᴅ Possibly, but it's hard to discuss Web site coding problems without sharing a link.
09:16
@cᴏʟᴅsᴘᴇᴇᴅ works for me :P
@cᴏʟᴅsᴘᴇᴇᴅ not obvious enough so no
Ah the js question? Okay.
Guess you're aware that successful spam flags are -100 rep as punishment (or n*30 minutes supension in chat)
So they're not to be taken lightly
Okay, so why is coldspeed's handle differently rendered in the left-side chat username column, versus the star-board?
Fancy unicode
But why 2 different renders of the same chars?
09:24
Different font?
Hmm, that might be it
Hence "fancy unicode"
Nope, same font
@AndrasDeak I didn't raise any flags though.
Maybe Verdana behaves differently at different font sizes
09:26
I know, was just an FYI
@AshishNitinPatil ah, possible.
 
4 hours later…
13:24
Hi Team, Need some help with python
for idx , value in enumerate(abc):
if(idx%2 == 0):
start = value
else:
end = value
tdelta = datetime.strptime(end, FMT) - datetime.strptime(start, FMT)
time_interval.append(tdelta)
It says end not defined
Not sure why ?
for idx , value in enumerate(abc):
           if(idx%2 == 0):
                         start = value
          else:
                         end = value
          tdelta = datetime.strptime(end, FMT) - datetime.strptime(start, FMT)
          time_interval.append(tdelta)
Error output as follows :
Traceback (most recent call last):
File "podTimeINtervalAnalyzer.py", line 38, in <module>
tdelta = datetime.strptime(end, FMT) - datetime.strptime(start, FMT)
NameError: name 'end' is not defined
13:48
@deepak well, clearly when idx is 0, end is not defined, as the error states
Thanks Ashish, In python could not find a way in which we can assess two successive elements of a list [abc in this case] using loop
@deepak You can, if you use just the iterator, like the traditional for(i=0; i<len; i++) c-style
Then you can just do, my_list[i], my_list[i+1]
Wow, If C type is supported its great. WIll try it out :)
Sorry, the syntax is different
Traditional c-style in python would be for i in range(len(my_list)):
14:12
Sure Ashish will try this out? Thanks :)
@deepak There are a couple of ways to get multiple items when iterating. You could use an index, or you could zip two iterables together.
>>> s = 'abcdef'; [u+v for u, v in zip(s, s[1:])]
['ab', 'bc', 'cd', 'de', 'ef']
>>> s = 'abcdef'; it = iter(s); [u+v for u, v in zip(it, it)]
['ab', 'cd', 'ef']
@AshishNitinPatil that message was multiply confusing
Yeah, I dunno why I put the styling explicitly
And using an index is the opposite of what I'd call using the iterator
Hmm, yep, very confusing sentence indeed
And he could do it with existing enumeration too. Strike 3.
14:24
Another LPTHW victim:
@PM2Ring because the author suggests to first learn Python 2 ... you got me confused and frustrated with this one :) — tentkl 12 mins ago
@PM2Ring wow, the accepted answer on that is beyond ...
@AshishNitinPatil It's brief, but accurate. :) But it probably just be a comment.
How is it accurate? And how is it an answer in any way?
Although it pains me to defend Zed, it does make the code more self-documenting to do words = sentence.split(' '); return words rather than return sentence.split(' ')
Ah, nvm I didn't read it completely
Sorry
I should just unplug my brain for today (or it's already done that)
14:27
No worries. :)
@PM2Ring meh
Of course, a seasoned Python coder probably wouldn't bother making it 2 lines in such a simple case, but it's probably a good idea for newbies. We often get people doing stuff like for word in sentence:, doing some processing on the "words" and then getting confused when the output isn't what they expect.
 
1 hour later…
15:35
<.<
>.>
Fizzy! How the hell are ya?
15:56
aaaand he's gone
Hello, I just did my first bit of Python. Can I just dump it (27 lines) here in chat and get some feedback? Or is that a no-no?
27 lines is a bit too much to post directly in chat, it'd be better to use a paste service instead and just drop us a link to it. Also, you may want to check out Code Review
@Rawing Thanks!
@Keepthesemind In case Rawing's advice wasn't totally clear, we're happy to give you feedback, but we prefer that code posted directly into Chat is fairly short, no more than a dozen lines or so.
16:12
hopeless confusion/unclear/no mcve stackoverflow.com/questions/47002310/…
0
Q: A first Python for me. XIRR function. Any comments?

Keep these mindThis is my first attempt at Python. I started with some code from https://github.com/peliot/XIRR-and-XNPV and tried to 'improve' on it. But I would like to know if in these few lines I already made beginner's mistakes. I'm particularly interested to learn whether there is a more elegant way to ha...

16:25
@Keepthesemind We also have a rule about not posting your fresh questions here, although that's mainly aimed at SO questions. But I'll briefly note that you should use named Exceptions, rather than using bare except. And you could do with a blank line between your functions, and after the import section. I can't say much else about that code because I don't know what xnpv is and I don't use scipy
@PM2Ring Oops. Sorry about that. And thanks. (And xnpv is defined in the code, but blank lines would have made that more clear!)
 
1 hour later…
17:48
Hi guys, I have a hard time wrapping my head around something, so I thought I'd ask here:
I'm doing this:
if e in myset:
    if not e.mark: #this is a bool
        e.mark=True
however, that does not work as expected
If I do myset.remove(e)
e.mark=True
myset.add(e)
it seems to work
howeverm that seems like horrible practice to me
Is it though?
Mind you, mark does not influence the hash of the set member
Somethings inclusion in a data structure has no effect on being able to set its attributes.
Also, you can press ctrl+enter to insert newlines in a block of code.
oh, thx :D
you refer to if e in myset?
working around a very odd behavior of your code instead of fixing said odd behavior is indeed terrible practice
should I refrain from using set in this case?
that's impossible to answer without any context :/
17:54
No, you should do some debugging and narrow this down to an MCVE.
There is absolutely no way the set affects the attribute.
ah, but adding the object to a set calls its __hash__ method, so technically there is a way :D
@ravenfrost Well, it's generally not a good idea to put mutable objects into a set. It's possible, as long as the mutation doesn't affect the object's hash, but it's a recipe for chaos & confusion, IMHO.
you mean e.mark=True should be possible without the need of removing and adding?
@PM2Ring I most certainly noticed how set my be a bad choice here!
It's really not. Once again, you need to provide a MCVE.
As davidism says, we need to see a MCVE rather than making us try to guess the nature of your (possibly pathological) object. ;).
18:22
mmkay. I'll get working
18:55
I can't believe this guy! I told him that eval was the cause of his problem, that it's not necessary in his code, and that it can be dangerous. So what does he do? Adds more eval calls! :facepalm: stackoverflow.com/questions/47003093/…
19:09
More eval()!
@PM2Ring we've entered the Twilight zone me thinks :p
Think I've seen ghouls and ghosts and stuff walking about outside so something's definitely going on :p
Well, recently Martijn turned into a ghost, so that's that. :p
I think that's just a new ninja skill he's temporarily practicing... normality (whatever that is) resumes in November or something :p
haha, well put
 
2 hours later…
21:36
I have been practicing logging into websites using requests, and for the most part I have been successful. I am currently trying to log into starbucks.com/account/signin but I can not seem to figure it out. I know that there are additional parameters to send (rememberMe, sso, reputation) and I also set the X-NewRelic-ID in the header. Not sure what else I am missing and what makes this website different from others? Any insight would be much appreciated. Thank you!
22:04
@antfuentes87 Well, I would always try to almost mirror the normal request that is sent to the backend when you manually do the signin via the browser. This is easy enough to log via inspect tools. You can see the complete request with the headers and thus can mirror it and hopefully get expected output
22:50
Hey guys, I managed to create a MCVE of my problem.
class E:
    def __init__(self):
        self.mark=False

    def __hash__(self):
        return id(self)

class E_Container:
    def __init__(self):
        self.myset={E() for _ in range(10)}

    def mark(self, e):
        if e in self.myset:
            if not e.mark:
                e.mark=True


fromContainer = E_Container()
toContainer = E_Container()
for e in fromContainer.myset:
    toContainer.mark(e)
for e in toContainer.myset:
    print(e.mark)
How can I make it so that I get E's from the fromContainer and find the match in toContainer and mark that one instead of the one in fromContainer?
cbg
if i have a matrix that i want to multiply by another in python, and that matrix has e^i phi in it, where phi isn't a number, but a variable dependent on the experiment being performed, how can i get python to not "do" anything with it?
Sorry guys, but there is a fault in my MCVE, the mark method makes no sense with that hash
But maybe you could recommend a data structure that is better suited for the task than a set?
23:13
@heather cbg. How is your data represented? What does "variable dependent on the experiment" mean?
does phi have an additional dimension that you don't want to handle?
quick question. does anyone know how to iterate through a list and exclude certain items based on criteria?
@ThePeskyWabbit using a for loop:P But a list comprehension can often be a shorthand for this
i.e. for item in list (where its name is not john)
don't call it list though
@AndrasDeak what i mean is that phi doesn't have a numerical value in the matrix. It represents something that changes dependent on the situation.
23:17
i know that was just an example
for item in lst:
    if lst == 'john':
        continue
    # stuff comes here
[stuff(item) for item in lst if item == 'john'] # <- list comp version
i want python to not "think" that phi = 2, for example, so phi*phi = 4, i want it to think phi*phi = 2 phi. if that makes sense.
@heather I'm not sure it does
@AndrasDeak You mean if item == 'john':
ah yeah the one liner is whas i was looking for. facepalm simple solution. thanks!
23:18
phi*phi = 2*phi iff phi==2 :P
@Rawing thanks, fixed
like python can't do that?
do you need symbolic math?
...maybe? i'm not 100% sure what that is.
@ThePeskyWabbit note that oneliners are overrated, only do that if your stuff() is simple enough
i want it to treat phi like an unknown quantity that is conveniently represented by a particular symbol.
23:20
>>> import sympy as sym
>>> phi = sym.symbols('phi')
>>> phase = sym.exp(phi*sym.I)
>>> phase
exp(I*phi)
>>> phase**2
exp(2*I*phi)
symbolic math ^
huh...
@ravenfrost What is "the task"?
@heather be warned: it's messy and slow and sometimes buggy
oh, i = sqrt(-1) here, that doesn't need to be symbolic.
but that sounds like what i want.
>>> sym.I
I
>>> sym.I**2
-1
it is I
23:21
oh =P
perfect.
also sym.pi, etc.
there are also symbolic matrices in sympy but blech
think it through whether you can get away with defining a function where phi is an input, and use numpy instead
depends on what you want to do with the result, of course
can you do sym.whatever as an element in numpy?
*a numpy matrix?
ehm, I guess you can with dtype=object, but that's like resurrecting the dead
losing arms and legs, opening portals to weird dimensions, etc.
23:42
so for some reason the if check is not working. I currently have ` if 'ThePeskyWabbit' != data.getName() or 'CredibilityBot' != data.getName():` but it executes even on those two list items
Phew, it took some time, but I've finally recovered from the User Removed -464.
@ThePeskyWabbit whitespace? Case-sensitivity?
print(type(data.gerName()),repr(data.getName())) to be sure they're indeed strings (assuming python 3) and with content you think they have but don't
<class 'str'> 'CredibilityBot'
its a 1:1 match
<class 'str'> 'ThePeskyWabbit'
oooh
you had A!=B or A!=C
if A!=B then A!=C holds and vice versa; you need "and" instead of "or"
ahhhhhh
sigh
success
thanks!
23:53
no problem
and rhubarb

« first day (2570 days earlier)      last day (2603 days later) »