« first day (1683 days earlier)      last day (3266 days later) » 
01:00 - 18:0018:00 - 00:00

6:00 PM
for i in range(0,255):
    if pyping.ping("192.168.0.%d"%i).ret_code == 0:
       print "192.168.0.%d"%i
might be kind of slow ... you can probably specify a shorter timeout
you must run as sudo (on linux)
admin on windows
 
Ok gonna try it
 
This is a silly question, but pyping's readme says sending ICMP packets requires root, why doesn't ping require root?
12
Q: python non-privileged ICMP

MarkusWhile trying to figure out the best method to ping (ICMP) something from python, I came across these questions: How can I perform a ping or traceroute in python, accessing the output as it is produced? ping a site in python How can I perform a ping or traceroute using native python? The answe...

Stack Overflow to the rescue
 
lol
it looks like you could do pyping.ping(host,timeout=100) and that would probably speed it up ... but you might get some false negatives
 
ZeroDivisionError                         Traceback (most recent call last)
<ipython-input-3-27a3bbb50ddc> in <module>()
      1 for i in range(0,255):
----> 2     if pyping.ping("192.168.0.%d"%i).ret_code == 0:
      3         print "192.168.0.%d"%i
      4
I'm getting this error
 
hmmm that doesnt make any sense
 
6:06 PM
What does i equal when you get that error?
 
I would guess its zero ... try starting at 1 instead
maybe
although even using zero I dont get that error
what python version are you using?
 
2.7
 
you could try r = pyping.ping(host) (where host is the string ip) ...
then on the nextline check if r.ret_code == 0
 
Interesting, I'd expect ZeroDivisionError when you do thing % 0, but only when thing is a number
 
and figure out which statement is actually problematic
yeah i feel like something has been overwritten .... I dont understand how you get the zerodivision error
 
6:10 PM
Wild guess: the code you're showing us is slightly different than the code you're running. Your actual code is something like if pyping.ping(secret_ip_format_string%i).ret_code == 0:. At some point you're accidentally overwriting secret_ip_format_string with a number.
This is why .format is better.
 
I'm starting the range at 1 and now I don't get the error. But the scan is taking forever
 
but thats extra typing :P
 
Time to cut some [corners]. — Brian 14 mins ago
 
thats why I said try passing in a smaller timeout
 
6:12 PM
heh
 
That deserves a slow clap.
 
the "burnination requests should have silly titles" is somewhat annoying, but often makes me laugh
 
anyway you can look at the ping signature here and see if changing some of the default parameters has an effect on speed ... really I dont know what the problem with nmap is
 
( •_•)
Looks like it's time...
( •_•)>⌐□-□
To cut some corners.
(⌐□_□)
YEAAAAAHHHH
 
lol
 
6:15 PM
One of these days I'm going to invent the electric razor that doesn't miss that one annoying spot just towards the bottom-left of my face (other men may have a different hell-spot) and then become a billionaire.
 
I solved that problem by finding a girlfriend who doesn't like it when I shave. :P
Still waiting to become a billionaire, though. :/
 
I have a hard time getting the spot below my left ear because it's the only spot that my right eye can't see in the mirror, and my left eye has poorer near-vision.
 
My GF doesn't care (in a good way). I just prefer to be shaved, mostly because I can't grow a proper beard ;_;
 
Ffisegydd please invent a special electric razor with a fiber optic camera so I can get a razor's eye view while shaving
 
I shave in the shower though so I have no mirror, I shave blind like a mad man.
 
6:18 PM
Maybe with Oculus Rift integration so I can livestream my shave to my fans
5
 
I also get horrendous razor burn unless I am really slow and properly moisturise etc.
 
DSM
I miss the bearded/not bearded wiki. It helped me understand people.
 
I used to be bearded but now that I am entering The Real World and "finally doing some work in a job" I thought I should try to look less like a hobo.
It doesn't help that my hair is so curly that even my beard curls.
 
I let it grow unchecked to about an inch and then shave it all off.
 
@MorganThrapp you need to do this a repeatable process
possibly a dating website for guys having problems with shaving
 
6:22 PM
Current status: ~1 mm. I had to be presentable for the family memorial day barbecue.
 
@AnttiHaapala beard.ly? Someone has that domain already. :/
 
The only time I can express my 1/16th Irish heritage is when I grow my beard enough that the copper tinge is visible.
 
the bad thing about coppery beard is that if you do not dry it carefully after soaking it in Guinness, it might turn green...
 
DSM
If I shave my beard too closely I look like someone who's trying to look ruggedly unshaven but isn't really pulling it off. Better to make peace with the scruff.
 
@Kevin Yeah, mine does the same thing. I've got black hair, but the beard comes in all gingery.
 
6:26 PM
It also doesn't help that I'm blonde.
 
6:42 PM
So does this look like a good resource for learning C? hyperpolyglot.org/c
 
Could someone help me with a 'etiquette' question --- how long a code set should you limit yourself to questions you post about? I am working on a PyQt app and I am trying to reduce it to a minimal set of lines to ask my question. How far do I go in this effort?
currently at 271 lines
 
I personally don't read questions with more than 50 lines of code
 
figured
 
I definitely would not read 271 LOC.
50 sounds about right.
 
if I extract my routine that does the work then I am looking at 70 lines --- still long --- I I compress blank lines and comments maybe 50
 
6:48 PM
or maybe 80 loc, depends on how well it's formatted
formatting matters
 
70-80 is reasonable (assuming that includes blank lines and such for formatting)
 
I stop reading LOC at 10.
 
It's better to leave the formatting in and be long than compress it and be short :P
 
@Aaron yes but that's because you get confused past 10 LOC.
 
6:49 PM
Hubris if you say you don't. :P
 
lolz
 
Half the time when I do that, I intuit exactly what the questioner is looking for, while everyone else is still trying to read the (unreadable) code.
 
I'm willing to execute hundreds of LOC if 1) it perfectly exhibits the problem with zero modification from me and 2) I have a good suspicion about where the issue is
 
Well the question - code - is using MVC in PyQt for a Treeview -- examples are not plentiful and I have done my best - but I feel I need some real assistance.
 
There was a question last week that was ~500 lines but I knew right away that the problem was in the first twenty
 
6:53 PM
Code runs --- just not the resutls I am expecting
 
7:05 PM
I'm same, hapoy to run a lot of lines. Specially with GUI stuff, I'd rather have something I can paste and run than have to make a load of assumptions
Reasonable compromise IMHO is to make a minimal example that runs for question, but post the full version elsewhere and link to it with "this is my code within the normal code where I run it.
 
Anyone know any good sources to prepare for a python interview?
 
well - I could remove the file open stuff and assign a file name and such - but that would likely still be in the 100 lines --- so I was worried
 
@ApathyBear I suppose you could browse Hidden features of Python [closed] if you think the interviewers will try to trip you up with obscure knowledge
 
Hmm, this is interesting regardless. Thanks @Kevin
 
7:22 PM
this guy has been doing the "slowly get SO to write my program" thing for the last day or two.
I feel bad for him because not noticing that check_call(["ffmpeg" ,"-i", filename, body Fileextension]) is invalid syntax, indicates to me that he's in way over his head
 
@Kevin I'm also confused by the import in the middle of the function.
I know you CAN do that, but why?
 
There's especially no need to do it here because he uses check_call in every branch.
Although I notice that he doesn't import in the elif branch. I expect that will be tomorrow's question.
 
Okay here's a weird question... I was wondering, is it possible to detect if a directory is a git directory, then detect what "type" of project it is within reasonable amounts of time?
 
@corvid You could check if there's a .git folder in the directory.
Short of that, I have no idea.
 
7:27 PM
@MorganThrapp But what about /Users/corvid/git-directory/more/directories?
the top parent doesn't have a .git, guess just scan everything along the path for a git? Seems slow
 
Maybe get a histogram of file extensions in the directory, and look at the most common one excepting .txt and other non-source extensions. if .py is most common, it is a Python project. if .class is most common, it is a java project. Etc.
 
@Kevin quite a long way over, it would seem
 
"No, by 'type' I mean what sort of problem/need the project solves/fulfills", you hypothetically say? In that case, we're getting into xkcd.com/1425 territory
 
@corvid Maybe do something with check_call and git list?
@corvid Than check if any of your parent directories are in the list of git repos?
 
DSM
7:41 PM
Part of me hopes this question was deceptive, and it's really something interesting.
 
The three answerers there should receive zero points for lunging for that low hanging fruit ;-)
Odd... Padraic's timestamp just said "two minutes ago" and mine said "one minute ago" even though I answered three seconds earlier than him.
 
DSM
To meta!
 
... Aaaand in that window of time where our informal timestamps were different, he just got an upvote. The injustice of it all!!!
Now the difference will only accumulate. He'll get 50 upvotes and I'll be selling match-sticks in a filthy back alley.
 
DSM
Ah, you'd be down in the gutters! Or you would be, if you used the right words for things. ;-)
 
There are worse things you could sell in a filthy back alley ...
 
7:47 PM
Yeah but the profit margins for those worse things are usually better
@DSM Oh, I got that reference. Took me a bit.
I'd be down in the dumps, you mean. But then I could live off of seagull meat.
 
@MorganThrapp hmm that would work... do you happen to know, also, if you can change environment variables in python if that is true?
 
@corvid I don't have any idea. I mean, you could do something with subprocess.call, but I don't know if you can do it in Python.
@corvid stackoverflow.com/questions/5971312/… Looks like os.environ.
 
8:13 PM
@ApathyBear explain decorators
 
Can anyone recommend a good TKinter tutorial? I just need a form with a button, a drop down, and two edit boxes. :P
 
I hate tkinter so much ... you should use wx
 
I'm willing to learn whatever is easiest.
I just need a quick and dirty GUI wrapper around an existing script.
 
DSM
"You can see there is a vertical asymptote at Z = -1/LS, and X -> 0 as Z -> -infinity." This was in a personal email from a friend. My friends may be too much like me..
 
It's just going to do subprocess.call('my_script.py', **options)
@JoranBeasley Can you recommend a good WX tutorial?
 
8:25 PM
@DSM good friends...
 
Survey: favorite Python interview questions (I'll contribute too) Go!
 
ssss, ssss, ssss?
 
Explain decorators
 
DSM
@davidism: I'm embarrassed to admit how long that took me to get.
 
ssssorry @DSM, you didn't get the job
 
8:30 PM
I actually asked this in an interview: "Your resume says you know Python, if you had to start over with no knowledge of Python, how would you go about learning Python?"
 
DSM
Figures. These days, if your name isn't an unpronounceable collection of random letters like @Ffisegydd, your career won't go anywhere.. :-(
 
Just thought of this one: "Explain the Unittest module."
 
I intentionally make my name hard to spell so people won't ask me questions, they'll just ask someone with a simpler name like "Kevin".
 
"Explain logging."
 
Which is better? "Hey Kevin, can you do this for me?" or "Hey Fuh...Fih...Fis..., forget it! Hey Kevin, can you do this for me?"
@AaronHall "Explain generators" is a good one.
 
8:33 PM
Explain decorators.
Explain list comprehensions.
 
explain why decorators ...
 
Explain what would happen if you generated a decorated list comp.
 
what's wrong with mutable default parameters? :D
 
"Explain when mutable default parameters are a good idea."
 
DSM
How does with X: work? How would you write your own context manager?
 
8:35 PM
Good idea, ^^
 
What's the difference between x = x + 1 and x += 1 and how do you take them both into account in classes?
 
meh
 
user559633
Oh interesting. Context manager is a fun one because it's threadsafe, right?
 
Meh yourself! storms off to cry to get angry
 
user559633
Fizzy nooooo
 
user559633
8:36 PM
@AaronHall oh great, now fizzy has gone and locked himself in his bedroom again.
 
Good answers get voted up.
 
If you're looking at someone from a Java background then asking about @property would be a good one. See if they know how to not use get_blah, set_blah, etc methods.
 
user559633
s/good/answers to popular questions/
 
that's a good idea, Fizzy
 
These are great so far
 
user559633
8:38 PM
If the person is from a Java background, ask about the visitor pattern
 
DSM
I remember suggesting during a previous discussion that it's good to ask about what non-stdlib modules the subject uses. Don't even care what it is: numpy, nltk, whatever.
 
I contributed 。◕‿◕。
 
oh, no, Fizzy's gonna get a big head...
 
Depending on what they're doing you could ask them to explain the GIL etc, especially how it affects threading/multiprocessing/whatever.
 
8:39 PM
@MorganThrapp blog.pythonlibrary.org is very good for wx stuff (its MikeDriscoll's blog and he is pretty much the expert on all things wxPython if you ask me)
 
wow... that was odd...
 
Also ask them what versions of Python they have experience with. Both 2 vs 3 and CPython vs Jython, IronPython, RPython, PyPy, etc.
 
was 11am and now it's nearly 10pm
never just fallen asleep quite like that before
 
Ask them "On a scale of 1 to 10, how do you feel about type hinting in Python? 1 being mild disgust, 10 being the belief that it will cause Ragnarok and doom us all."
 
@JoranBeasley Oh wow. That is really easy. Alright, I'll give that a shot, thanks.
Oh, it's 2.X only. :/
 
8:46 PM
Ask them if they know how to setup a package for distribution/pypi/etc. That way you know they can do more than just some script programming.
 
@MorganThrapp i think wx3.0 has python 3 support
 
DSM
@Ffisegydd: ummm.. erm.. well.. let's not make that a requirement, maybe..
 
a new post by this user reminded me:
 
user559633
I like asking about late binding. If the person misses it, I explain why it happens and ask them to write a workaround.
 
8:48 PM
@JoranBeasley Is it on a site other than wxpython.org?
 
anyway - cbg all :)
 
user559633
cbg jon
 
DSM
Cabbage for you, Jon.
 
its called wxPhoenix (thats their codename for 3.0 I guess :P)
 
8:48 PM
@JoranBeasley Sweet, thanks.
Also, because I am a noob, what is a .whl?
 
I was really disappointed in most answers I got to "How would you learn Python all over again."
 
user559633
 
@tristan Danka.
 
One answered that he'd use, "The pdf."
 
user559633
@AaronHall would the answer of "read through some of lutz's learning python and then write some code" disappoint?
 
8:51 PM
No, that would have been refreshing.
 
DSM
@davidism: oh, that reminds me. I may have some flasky questions for you later -- I'm so frustrated dealing with some Java web code that I'm working with that I've started to see if I can toss the whole thing and replace it by a flask backend + aurelia front-end.
 
The best answer said he'd read the docs.
one guy
 
a .whl is a precompiled binary that can be installed with pip
 
What's the syntax on that? pip wheel "path/to/file.whl"?
 
I'd consider "reading the docs and the source" to be the absolutely best answer to that question.
although if you'd just mention a couple of books that would be ok in my mind.
 
user559633
8:54 PM
what about "i'd go between help(), docstrings, and the Cpython source?"
 
and another nose bleed - great
 
pip install /path/to.whl
... I think its been a while
 
To me that says you're mostly feeling your way around. I think you need a fairly comprehensive walkthrough. The help() isn't bad, but it doesn't give you the big picture at all. Ignoring the documentation is done at your own peril.
 
wheel install looked like it did something, but the pyrt isn't picking it up.
 
Why are my UX questions suddently getting attention?
maybe SE optimized the SEO...
 
9:04 PM
Dear Python room:
0
Q: Abuse of duplicate marking?

Zizouz212I came across this question here: How can I make a for-loop pyramid more concise in Python? The question was marked two days ago as a duplicate of this: Python nested looping Idiom I looked at the "better" question and came to a conclusion that it should not have been marked as a duplicate. The...

About a Python dupe vote :-)
 
@MartijnPieters Thanks! :)
 
I'm (not) surprised that we had a dupe listed and pointing at another question.
 
@davidism Ned's predates Bakuriu's answer by a few months.
So you could call that one the senior post.
What's left then is a judgement on what post is the better one (question and / or answer).
 
DSM
I have to admit to having been a little miffed that the umpteenth itertools.product question got him so much rep, but I've been the recipient of exactly the same circumstance, so it's a little hypocritical of me..
Anyway, time to go practice my Japanese. ルバーブ for all!
 
9:16 PM
Is there some term that differentiates numbers and strings from tuples and user classes? The primary difference being that the former are either non-iterable or only iterate into elements of the same type.
 
I mean, among hashables.
How did I miss that?? =_=; Thanks!
 
you can also look at the source to see what built in types are registered with which abcs: hg.python.org/cpython/file/3.4/Lib/_collections_abc.py
 
cbg all
 
Fun problem here. It's listed C++ but really is language neutral.
 
9:21 PM
Basically, I was hoping for a bit of nomenclature that described numbers, strings, booleans, and None, but somehow tuples always managed to creep into it.
 
9
Q: Fair division of a kingdom

DoctorMoishaRecently, I've attended programming competition. It is already over, and I'm not cheating I swear. Programming language does not matter, but I've wrote it in C++. There was this task: As you already know, Flatland is located on the plane. There are n cities in Flatland, i-th of these cities is l...

 
@DSM so how come we all missed that post for such a long time? :-P
 
9:56 PM
Hey does anyone know how to use google fusion tables in Python without creating an API project? I found an online tutorial that uses an authorization package but I have no idea how to download it. code.google.com/p/fusion-tables-client-python/source/browse/…
 
this is probably a dumb question ... but is there any modular localization(language) frameworks?

something like this ? http://dpaste.com/24TM0YE ... if that makes sense
so that anywhere you do import words you get access to all variables ...?
this feels like sort of the wrong approach
 
10:38 PM
Cabbage
 
10:48 PM
I thought the approach in Python was typically to use global imports but to guide imports, not force them all at once.
So you only import words if you need words for a file.
 
cabbage all
 
Cabbage
 
01:00 - 18:0018:00 - 00:00

« first day (1683 days earlier)      last day (3266 days later) »