« first day (2332 days earlier)      last day (2841 days later) » 
00:00 - 22:0022:00 - 00:00

DSM
DSM
00:52
@BhargavRao: would you mind if I modified your comment here for the Useful Comments page?
Smells like a homework cheat.
Any thoughts, @DSM?
13 hours ago, by PM 2Ring
Hey @AndrasDeak I made a comment the other day on a Big Bang answer over on physics.SE. The OP raises an interesting point: how do we define a reference frame during those ultra-early epochs when the energy density is insanely high and the particles have so much KE. http://physics.stackexchange.com/questions/314885/what-does-one-second-after-big‌​-bang-mean
Is the issue I mentioned valid, or am I just confused too? :)
DSM
DSM
01:16
I'd need to think about it in ways this wine is hard to square with. :-) Regardless of the particle KE, relativistic or not, you can always subtract off everything (velocity-wise, i mean), so I don't think it's the scale that matters so much. It is kind of a dodge (even though it's a standard one) to bring up the CMB though because that doesn't even show up until awfully late in the game..
01:32
@Tokencodingnewbie Write it without using the lambda first. Then the lambda and why they are useful will make sense.
@Brandin Good idea. Sorry it took so long. No I'm not familiar with Lambda they introduce it to you for a second then they go into detail in it 2 chapters later, that irks me D:
:) Yeah, it seems like cheating to use the CMB at that early epoch. I guess if we wait a few minutes there's the neutrino background. But I like to use logarithmic time when talking about the BB and on that scale the era of cosmological nucleosynthesis is in the distant future of T=1 microsecond. And I do like my physics to be based on stuff that's potentially observable, even when it's not exactly practical to make measurements. ;)
@Tokencodingnewbie lambda is pretty basic. It's just a light-weight function that can just return the value of an expression. It can't do assignments, but it can return a tuple, list, etc.
The concept is not hard but if you're still learning the language I think it doesn't make sense. You don't need it.
So f=lambda x,y: x+y is equivalent to
def f(x,y): return x + y
01:52
Just use def. It's easier to explain.
There are some minor differences, but you don't need to worry about them at this stage. We don't usually assign a lambda to a name like I did in that example. A lambda is supposed to be an anonymous function, and we mostly use it to pass a function as an argument to another function.
02:04
@PM2Ring I still haven't gotten to the chapter on data structures so I don't know much about tuples.
I'm slowly reading my way there, I try and punch in things I dont get and debug them
Yep, that's the only way to read programming books and tutorials: test and experiment with everything.
02:45
yeah I used to just try reading them. I did that with C, I didnt get very far.
Right now I've been just messing with XML files in game, it teaches me nothing, but it's like coding...?
03:26
@DSM no issues, I'll also have a place from where I can copy the comment. :)
 
2 hours later…
04:58
Is it possible to open putty and send some address to the serial port that are in the text file.
I am using ubuntu 16.01 I open putty sudo putty
05:27
... wat :D
 
2 hours later…
07:07
\0 Cabbage!
Seems like Kevin is trending
> 6 I've broken free of the notebook paradigm entirely by just writing on whatever flat surface is closest to me. - 1d ago by Kevin
> 5 I'd prefer a meeting where my entering the room causes the median autism level to drop or stay constant - 1d ago by Kevin
> 4 "Hey Gandalf, I haven't seen you in a while. How did that legacy PHP project go?" "Darkness took me, and I strayed out of thought and time, and I w... - 1d ago by Kevin
> 3 stackoverflow.com/questions/42587590/… - 1d ago by Kevin ▼
Is there any problem in django when we use the CDN?
@Ananthu You may want to rephrase your question to be specific.
07:45
Hello
08:00
Here is my script http://pastebin.com/f9whcy66 which is using pafy library to download youtube videos but when i download video file there is no audio in it only silent video.
can someone tell me why is this so ?
solved
 
2 hours later…
09:53
Hi! I'm just programming a selenium python webbot, I run a big loop through a website.. But after some time, the searched element is not getting found anymore and the program stops. How can I solve it and continue running the program?
@linuscl Describe in pseudocode what you are doing and what you want to do. This is how I imagine what you are saying:
for elem in webpage:
   if elem is what I'm looking for:
      say "I found it."
      stop
say "I didn't find it."
stop
Just simply:
for lines in file:
    driver.get(PAGE)
    driver.findandclicksomething()
and after like 30 reloads, the element won't be found
Is file a list of URLs
No, it's input for the page.
What is each line? Is it one line of HTML
10:06
-> driver.find, sendkeys, and click()
It just sends one line of the file, then clicks a button and reloads ...
What does a line look like? If it is HTML, there may or may not be something clickable there.
 
2 hours later…
12:25
cbg
Aug 19 '16 at 16:41, by user559633
Kevin a.k.a. Starboard Monster
13:18
cbg! I've a list of dictionaries, and I want to access keys of all dictionaries at a given index. For ex:
`
dictlist = [dict() for x in range(5)]

dictlist[4].update({2:400})
dictlist[4].update({5:500})

print(dictlist[4])`

I want to get output of 2,5.
DSM
DSM
There's nothing special about dicts in a list. You can call .keys() to get a dict_keys object or list to get a list of keys.
13:40
@Grimlock Perhaps you want
print(','.join([str(s) for s in dictlist[4].keys()]))
@Brandin Thanks, that's perfect! :)
It can be simplified to this because dictlist[4] in list context already gives you the list of keys:
print(','.join([str(s) for s in dictlist[4]]))
cbg
Cabbage. Some people just don't get the concept of a MCVE stackoverflow.com/questions/42522873/…
really bugs me when new users come in with meeting the requirements of an MCVE and they get downvoted
That's the kind of stuff that irks me on SO.
13:51
an MCVE is a necessary but insufficient condition of a non-downvotable question
@PM2Ring at least it's an MVE ;D
@AndrasDeak True, but if I see a MCVE I'm much more likely to help the OP improve the question, and if it's a good MCVE it's often possible to make major edits to a poorly written question that won't conflict with the OP's intentions.
Every question can be down-voted. I can downvote something for an arbitrary reason just because I don't like it. The vote is just a summary of the community opinion.
@Brandin well we're talking about reasonable downvotes
@PM2Ring of course, I was mostly responding to idjaw's irk with that message:)
@AndrasDeak Fair enough.
nvm...they fixed it
14:12
Interesting meta question about downvoting answers because of bad comments. meta.stackoverflow.com/questions/344761/…
It looks like Alex has created a new account to re-ask his question stackoverflow.com/questions/42609393/…
But in the end you can downvote or upvote for any reason. For example if you look at the C questions the most upvoted questions and answers are not really useful, but simply obscure or interesting in some way. Another variation is age. Older => more upvotes. In the end the votes are not really meaningful, they are just part of the gamification.
Checkin, Thanks!
14:28
lol @vaultah's comment on the deleted answer:D
wow, username changed in the last 2 minutes
deleted
I almost want to undelete their original so that I can downvote;D
note to self: don't have too high expectations towards someone whose avatar has a miley cyrus emoticon on its t-shirt
@BhargavRao Nice work, as usual. ;)
Thanks :)
@AndrasDeak Our man Bhargav doesn't mess around when he catches rascals red-handed.
When BR is around, sleazy OPs don't just... BRB
(•_•)
( •_•)>⌐■-■
(⌐■_■)
@Brandin selenium.common.exceptions.NoSuchElementException: Message: Unable to locate element:
That's the error, and I've tried to wait with wait = ui.WebDriverWait(driver,20)
14:44
@AndrasDeak lol, that's nice. :D
@linuscl Maybe there is no such element.
It found it and didn't wait, but then when it's in the next step, it failed.
        wait.until(lambda *driver*: *driver*.find_element_by_xpath("*element*"))
Try to set up a repeatable scenario to debug it.
Waiting for 20 seconds sounds pretty brittle. Maybe it works sometimes, maybe it fails others.
E.g. if the page or resrouces are in the browser cache already, if the connection is better/worse, etc.
Yeah, that might the problem, for example right now (I've testing it again), it seems to work pretty good. (I haven't changed anything). That's the problem of web bot coding.
Could I hide unimport parts of the website?
Maybe install an ad-blocker and hide parts of it?
Done
thanks, good sir.
@Brandin Selenium loads the browser without any plugins or addons
Maybe I could load a session .ini file..
15:21
I think this might be a dupe of the canon I wrote
But I don't know how to load a session from an old ini file
2
Q: Unable to load firefox Add ons in python selenium

pritsingh1701I want to Load Zenmate Firefox Addons when selenium webdriver runs it runs fine when i run without loading any addons ( extensions ) but having problem while adding any addons . Here is my Code : def __init__(self): self.main_catag_driver = [] self.declare_xpaths() se...

Maybe that one...
I don't know how to create the block-list in adblock (with selenium), seems to be very difficult, and it seems also impossible to load a preconfigured firefox session.
15:38
Well there are other ways to block ads, like modifying the /etc/hosts file.
Or you could simplify your approach. Write pseudocode for your solution (state your problem first) and in your solution do not refer to "selenium" or "webdriver" or anything like that. Just say what you want to do first.
I just want to show the important part of the website.
How do you do that? That is where you need to write some pseudocode of how you decide what is important.
Good morning/afternoon/evening everyone
I hope I get some time to keep reading today
Do you know if there's a possibility to block special elements, so that they don't get downloaded?
My solution would be a webserver which downloads the site, filters and presents me what I want to see (that is what I would think of) -> But that would be to much effort I think
cbg
@Tokencodingnewbie good luck with that;)
15:49
Time to fix Flask-SQLAlchemy github.com/mitsuhiko/flask-sqlalchemy/…
Thanks, I have to do what someone suggests and take the lambda code out and then put it back in.
You can block things from being downloaded by modifying /etc/hosts. It can be used as a a low-tech adblock.
Goal is to get 2.2.1 out by the end of today.
Is lambda commonly used or just one of those things it' good to know if needed to be used?
Because there's no way I'm getting anything done when Breath of the Wild arrives Monday and Nier Automata arrives Tuesday.
15:50
@davidism wow, check mark in a URL, that's awful
Yeah, I don't remember why GitHub does that.
must be hip
@Brandin So you don't know any way to block only elements like <footer></footer>?
Most of these bugs are the same bug, just different side effects.
@Tokencodingnewbie depends on the user
if used right, they're usually used inside function calls when one of the input parameters is a function
just like the sorted example you saw before
15:54
@Brandin I give up.. It doesn't make sense.. :(
if you understand how functions work, it's trivial to use lambdas. You just have to remember that a lambda is a simple anonymous function
and fully defed functions are more general, so whatever you can do with a lambda you can do with a proper function
@linuscl Why do you need Selenium (browser automation). Just parse the page and remove footer if you don't want that element.
@Brandin I try to reduce the page load and internet traffic usage
cbg! I've a list like this: `my_values = [(1,2,3), (4,5,6), (3,2,1), (4,2,99), (45,67,123), (44,55,78), (2,4,466), (5,4,66)]`
What is the pythonic way of deleting all the tuples whose 3rd value is less than 99?
I'd filter them with a list comprehension
that doesn't delete them per se, but creates a new smaller list instead
filtered_values = [tup for tup in my_values if tup[2]>=99]
16:02
Oh okay, thanks! :)
and multiline messages can only have all code/all quote/flat formatting, that's why your message got broken
and thanks, but I don't think that's worth a star:P
Well from your level you'd think that hehe.
yes:)
you'll get there with due practice
On it :D
pairs = [(1, 'one'), (2, 'two'), (3, 'three'), (4, 'four')]
pairs.sort(key=lambda pair: pairs[1])
pairs
Was the point of me doing it without the lambda to show that I can't do it without it?
16:08
You can use any callable as the key, not just a lambda, so not sure what you mean.
The more I read and learn the more I feel like I'm digging into this hole, one that strayed far away from the original exercise. It's very challenging.
@davidism Honestly I don't either, I'm just messing with code snippets from the pyhton docs from their like 2 setence introduction to lambdas
@Tokencodingnewbie Maybe find another tutorial. The Python docs are good for reference, but I don't feel like it's a good learning sequence.
Heres 2 sentences, heres 2 code examples, ok but to actually learn more wait two chapters! Why introduce it to me now! It's so hard to move on if I don't understand something
you can always take a sneak peek at chapter +2 and see if it helps
Could you link to where you're confused in the docs?
16:18
I do actually get the code now at least.
Instead of using the numeric value to sort it uses the alphabetical with the lambda, but why do you need a lambda for that? Or maybe I'm missing the point.
You don't need a lambda. Start with a plain function, it's much easier.
we're well beyond that advice:P
Lambda is just easier to write/read after you get used to it. But for starting, learn the standard way first.
@Tokencodingnewbie why did you create a pastbin containing the tutorial? Just link to the tutorial.
Because thats the part i was having issues with
16:22
:|
the rest of the tutorial I wasn't
Thought instead of making it harder to find id condense it
@Tokencodingnewbie ok, I'm going to word it differently: link to the tutorial when we ask for a link.
You can click headers in most docs to get links.
Didn't know sorry
How did you think the table of contents and sidebar links in the tutorial worked?
shia_magic_gif
16:43
Collaboration to try and take a shot of a black hole, why haven't I heard this before? Go astroguys, go!
very long baseline interferometry is magic
That's really interesting!
it's in our local news, but the linked website doesn't make it seem all that active:S
wait what?
> The black hole at the center of the Milky Way - Sgr A* - Located 25,000 light years from us in the center of our Galaxy, Sagittarius A* is our nearest massive black hole with four million times the mass of the Sun. Its proximity makes it the largest apparent black hole as viewed from the Earth.
I thought it hasn't been proven yet that galaxies actually have supermassive black holes in their center
@davidism I said I was sorry man, you don't need to keep driving it in.
16:59
@AndrasDeak FWIW
thanks
so it is still open for debate, which is another good reason for wanting to take a screenshot
"Ultimately, what is seen is not the black hole itself, but observations that are consistent only if there is a black hole present near Sgr A*. In the case of such a black hole, the observed radio and infrared energy emanates from gas and dust heated to millions of degrees while falling into the black hole ...
... Although other possibilities exist for how these gases emanate energy, such as radiation pressure and interaction with other gas streams, interaction with a massive source of gravity is the simplest explanation."
If I have list of lists, I do this: mylist = [l[:k] for l in mylist] to slice all inner lists. How do I do the same with a Dictionary of lists, initialized as defaultdict(list).
dict comprehension is a similar thing
{key:value for key,value in ... if ...}
defaultdictness doesn't matter
so it would be like, mydict = [key,value[:k] for key,value in mydict] ?
17:03
i.e. filtered_list = {k:l[:5] for k,l in mydict.items()} or something
note the brackets......
and note how you iterate over the key+value pairs of a dict
oh okay, I 'll try.
(edited)
So good! Perfect :)
 
1 hour later…
18:18
*filtered_dict etc.
Ah Chapter 5 data structures, the whole reason i was given this documentation.
cbg
Django Doubt:How to get the all objects with name=request.username? sqllite query pls
18:43
re-cbg
re-cbg
Anyone know this?
Django Doubt:How to get the all objects with name=request.username? sqllite query pls
@Ananthu what makes you think that anybody who didn't answer your question literally 6 messages above will answer the second identical version?
??
I have no idea what it is you are asking
convincing response pls
I was in a hurry to get the answer thats all
18:48
big mistake
why?
fastest way to not get an answer, because we can't read your mind.
Respectfully, what you wrote makes no sense
This goes for stackexchange in general, not just chat: don't rush people who might help you in their free time, for free
It was python framework(django) which is using the sqlite query,
Yes, we understand you are asking something about Django. But your question makes no sense
You are asking to get all objects with name=request.username. sqllite query
what does that even mean?
Please think about how you want to ask your question before asking it. Understandably, english is not everyone's first language. But you should be able to formulate a minimal, complete, verifiable example by putting together a bit more detail to your question.
18:54
(definitely not a language barrier here)
*puts away magic crystal 8-ball*
19:23
rb folks. going to grab food and helping kids with homework! :)
20:18
How can I add colored text to my python code, I have been checking some different methods but none have works so far. Like these: http://stackoverflow.com/questions/287871/print-in-terminal-with-colors-using-python

I am using python 3.x by the way.
worked*
are you on windows?
yeah
I am on windows -- cmd
try searching for windows too
windows command prompt is often a pain in the butt, I'm told
I can't find anything useful :/
did you find and try colorama?
As the author of Colorama, thanks for the mention @nbv4. I'll try and clarify a bit: Colorama aims to let Python programs print colored terminal text on all platforms, using the same ANSI codes as described in many other answers on this page. On Windows, Colorama strips these ANSI characters from stdout and converts them into equivalent win32 calls for colored text. On other platforms, Colorama does nothing. Hence you can use ANSI codes, or modules like Termcolor, and with Colorama, they 'just work' on all platforms. Is that idea, anyhow. — Jonathan Hartley Sep 13 '10 at 13:22
you should be aware by now that "I tried stuff but they don't work" is never an adequate starting point for asking anywhere about anything
note that I've never used libraries like this, and I haven't used windows for at least a decade, but otherwise I'd find your inquiry ill-posed
20:32
It doesn't work :/
Instead of printing the actual colors, it prints something like this: \033[31m
we're making progress
can you guess what I'll ask you to do next?
Feb 6 at 19:46, by davidism
@SebastianNielsen this is not the first time you've had difficulty expressing your issues to the room or interpreting the help you're getting. Before continuing, please read and understand Minimal, Complete, and Verifiable Example and http://www.skidmore.edu/~pdwyer/e/eoc/help_vampire.htm. This is your last warning.
Uh wait
I figured it out.
there you go, good job
20:39
I didn't "init()"
thanks man
cbg
need some help
suppose i have a dic
i want to get the values of a specific key but its name changes
sometimes its "Sales (mil)" and sometimes its "2016 Sales (mil)"
@Sohaib please be more specific, preferably using an example. You've also had difficulties in the past expressing your problems clearly enough.
"Sales" is always present in the key
If you don't know the exact name of the key, you won't be able to get the value.
if there are a few options, you can test their membership in the dict keys
or you can look at all the keys and try to figure out which one you need
@SohaibAsif Please put together a concise example of what it is you have tried already, and explain the difficulties you are having
What is going on in your attempt
what difficulties are you facing
We should not have to keep reminding you of this
FYI. I have a solution worked out for this. But I'm going to be stubborn about this, and expect you to get in to the habit of meeting the minimal expectation by you, the asker, to put together a coherent MCVE of your issue.
20:56
i will make a loop and match the sales word and get the value
i guess
Then do it
do the code, try it out and see what happens
when you have something worked out
and you troubleshooted what you are working on and can coherently explain the code you wrote to a minimum problem, come back.
Until then, sorry, but I'm not going to give you an answer. You're just going to keep up with your bad habit and expect the same result
already did the code i ll show you
almost solution
OK......explain what it is doing that it shouldn't do. Explain based on the code you are showing, what is d in this case. Because the data you showed is a snippet. So I don't know what you have already been working with...duuuuuude. You're killing me here.
I'm going back to playing with my son outside
That was my window
good luck
have fun:)
21:11
its alot of code
thats why i did not post the whole Json and code
let me re-phrase in case someone else wants to help
based on the data you showed
and the code you showed
explain what is not working
what is happening now that shou;ldn't
and what should happen
For goodness sake....read how to put together an MCVE
I'm willing to bet you never read that page
shoo, go play, frolick in the sun:P
em sorry
A quote for you too:
Feb 23 at 16:01, by davidism
@SohaibAsif unfortunately, you're not describing your problem well. This is not the first time you've had issues with this. Please review http://stackoverflow.com/help/how-to-ask, http://stackoverflow.com/help/mcve, and http://www.skidmore.edu/~pdwyer/e/eoc/help_vampire.htm before continuing.
How can I define for the whole program what to do if it stops caused by an exception?
21:22
what you (probably?) need is "exception handling"
correct, but for the whole file
"exception handling" for the whole file
yes, do I have to set the whole file in a try: except: block (-> looks unclear, confusing..)
??
It probably would look unclear and confusing. Which usually means in python that what you're doing is wrong.
go go gadget I'm back
21:25
shoo
My son kicked us both out of the back yard
you'll kind and considerate it all up:P
and has face planted on the floor
awww:(
It's time to get Canadian up in this place
21:26
poor thing, is he all right?
haha yeah...I exhausted him outside
I made up a game: "Help daddy break the ice on the deck"
oh, I thought he tripped:D
nono...he had too much energy...so I took him outside so I can tire him out and I put him to work
awesome
perfect timing. His sister woke up from her nap and my wife is on her way home from work.
21:28
@AndrasDeak what's your solution? Can you help me?
I only have a strong suspicion that you're trying to do something wrong, in other words you have a severe XY problem
Yep
I was going to mention that.
I smell something horrible and definitely XY
Is cbg cabbage? Why cabbage?
I mean I just want to catch an exception in a for-loop, and if this happens the loop should start from the beginning
Pseudo Code would be:
21:33
Lemons.
for i in file: run, try, print (TEST), except print "Oh, no wasn't able to print" continue endfor
OK. did you try doing that?
well the pseudocode doesn't account for restarting the loop
is it supposed to restart, or just continue
It should just continue
It works, but doesn't look good
for something: try: Huge code block except: ...
21:39
ah, I misunderstood the confusing specification
you should put exception handling around whatever is expected to go wrong, together with what should not be executed if something goes wrong
@linuscl Put huge code block in a function if it looks better.
@Brandin I also thought about that
for i in file:
	try:
		do_a_bunch_of_stuff()
	except:
		print "Oh no! Some stuff messed up. Let's try the next i in file."
There is no i in file....oh wait.
That is pseudocode. Probably i will be passed to the function. You process each line for example or each token, record, etc.
21:42
You're right :)
Can I do a function inside a function?
def something: def something: etc
try and see; but it's usually not considered idiomatic
>>> a = [1,2,3,4,5,6]
>>> c = 3
>>> for i in a:
...  try:
...   i/c
...   c -= 1
...  except ZeroDivisionError as e:
...   print(e)
...   continue
...
0.3333333333333333
1.0
3.0
division by zero
division by zero
division by zero
Here is something really simple, silly and gets the point across
I probably could have put more thought in to making something passable after the first exception, but you get the idea
it continues the loop
-1 for non-PEP8 indentation
that's the important part
Yes.
def main(file):
   def do_stuff_with(i):
      # ...

   for i in file:
      do_stuff_with(i)
   except:
      print "Some stuff failed with i: ",i
21:45
Understandably that's a sample of your code, make sure you don't have that as just except
make sure you catch what you expect to raise
nevermind, I don't quickly see anything in the transcript against nested functions
Aug 17 '16 at 15:18, by PM 2Ring
@AndyK You can do that, but you shouldn't: "Flat is better than nested."
now that's something ^
OK,thanks, the last thing I have to do is add something to the except:
so do it
Can I wildcard exceptions? selenium-python.readthedocs.io/…
No, I cannot :(
what are you trying to do exactly?
21:51
I'm trying to except all selenium exceptions.^
catch the base classes?
from selenium.webdriver.support import expected_conditions
expected_conditions?
No, oops from class I think
from selenium.common.exceptions import *
import antigravity
21:53
navigating to Seleniums code on GH...going to the Python section....going to exceptions
hey look at that
Remember that the exceptions will derive from a base class
that will be the base class
for selenium exceptions
However, having such an open exception is also a bad practice. You should really know more about what it is your code is doing so you know what it is you should be catching in that code
if you don't know, then your code could be doing too much
and you might need to break it down and think over your approach
ok. like except WebdriverException(Timeout): ??
after importing them?
try it out dude
weird weather we're having
end of the world?
I updated my work laptop to Sierra....let's see how many tools died
except WebDriverException(TimeoutException):
TypeError: catching classes that do not inherit from BaseException is not allowed
21:59
neat
00:00 - 22:0022:00 - 00:00

« first day (2332 days earlier)      last day (2841 days later) »