« first day (1815 days earlier)      last day (3133 days later) » 

7:01 PM
I know with complete certainty the cause of the error in Keep getting a value error after altering my code, but I bet if I post it I'll get a series of "one more thing..." comments
Oh well, let's see if I'm right
 
I know it's early to link this question, but there's no way it turns good.
Also, I'm really trying to not be snarky and reply "They're arguments from the command line".
 
Thanks for the help and next time I'll try to structure my questions properly. — Ernxst 1 min ago
Now I feel a little bad.
[dabbing_tears_with_hundred_dollar_bills.gif]
 
Yeah, every once in awhile OP learns something. My first question or two here were really bad.
Also, do we have a dupe for is != ==?
 
Mmmmaybe.
 
I looked around and couldn't find it.
stackoverflow.com/questions/32956100/… That's the question, by the way.
 
7:16 PM
It's tricky to search for those single-word queries
 
Yeah.
 
177
Q: Is there a difference between `==` and `is` in Python?

BernardMy Google-fu has failed me. In Python, are the following two tests for equality equivalent (ha!)? n = 5 # Test one. if n == 5: print 'Yay!' # Test two. if n is 5: print 'Yay!' Does this hold true for objects where you would be comparing instances (a list say)? Okay, so this kind of ...

???
 
Ooh, I'm one vote away from 33,333
 
Yeah, that's the one, thanks!
Downvote Kevin, got it.
 
Nice, I got it.
 
7:18 PM
You know... a lot of mileposts would be interesting like that if you were willing to be liberal about numeric base.
 
I don't think I'd close that Q as a dupe, because is isn't actually a problem for most Python implementations if you're comparing against tiny integers.
Everything below 200 or so is interned, so (a == b) == (a is b) should be True for all of OP's conditions
 
@Kevin you're welcome :P
 
blood_debts += 1
 
Also it won't work because...
>>> 1 == "1"
False
>>>
 
Oh there's a lot of reasons why that code is terrible. I mostly flagged as dupe so that OP would see that question (hopefully).
 
7:21 PM
Yeah, type wackiness is primarily at fault
 
Must be some kind of dirty Javascript developer.
 
DSM
Too many things to fix. Leave for someone else..
 
Bleh. I'll try and tame Selenium tomorrow.
 
How do questions like that get an upvote?
 
It's closer to an MCVE than average
 
7:23 PM
@RobertGrant are you at a new job already?
 
7:39 PM
So, fun question about threads because I can't seem to find anything in the docs. If I have two threads Prepare and DoThings, what's the best way to have DoThings run until it hits the point where it needs Prepare to be done? Should I pass Prepare in to DoThing's constructor and call join?
 
I only have a little experience with threads, but I'd do it like:
create Lock L
create thread Prepare
Prepare acquires L and continues working
create thread DoThings
DoThings runs until it hits the special point, then tries to acquire L
Prepare runs until it is done, then releases L
DoThings succeeds in acquiring L and continues running
 
Okay, cool. I was briefly reading about Locks, but I didn't quite understand them. That explains it though.
So DoThings will block once it hits l.acquire() until that return True (or whatever it does)?
 
Although there might be a rare race condition where DoThings gets to the special point before Prepare even acquires L to begin with... Better make the main thread acquire L instead
 
DoThings has a minute or two worth of work before it even needs the lock, so I should be fine.
 
Yeah if two threads try to get the lock at the same time or a process never releases a lock, you'll have problems
 
7:49 PM
Famous last words.
 
DSM
I just got a "Top Python Streamers" promo email from Livecoding.tv and they didn't mention our davidism! Sure, he might now have streamed anything in the period they're referring too, but still.
 
@Kevin Thanks! Yeah, that's exactly what I need.
 
Is it possible to authenticate to an scp server with username & password, but use a pre-defined key pair?
(I'm working with Bitvise right now)
 
I'm warming up to the "pass Prepare in to DoThing's constructor and call join" plan, if you can do it in fewer lines than my approach.
 
7:53 PM
Nah, I have the lock implemented already.
 
Adding a little extra dependency is only slightly icky, if the functions and threads and what have you are all in the same scope so you don't have to pass the thread reference around too much
 
Eh, I only have to pass it down 2 levels into another module. That shouldn't be too bad.
The real use case is Prepare sets up a database while DoThings reads text files and parses them out and then imports them into the database, but it can't do that until Prepare has finished.
 
17
Q: Possible to use both private key and password authentication for ssh login?

Chris BlakeIt seems that they are mutually exclusive, as disabling one gives me the other, and vice versa. Two-factor auth for my ssh servers sounds really nice, so is there any way to accomplish this?

 
That one would actually be a little harder, because I would have to pass the threads themselves into another module.
 
7:57 PM
Understandable.
And of course, there are surely other approaches beyond my little false dichotomy.
 
Probably, but I have about a million other things that I need to fix in this before it matters. :P I still can't get my GUI to update. I'm thinking of offering another bounty, but it did nothing last time. :/
 
Is it Tkinter? Tkinter likes to throw tantrums when you use threading.
 
Nah, wxPython.
I've linked it in chat before, and Joran tried to help me, but we couldn't get it working.
 
DSM
Huh. Joran's my go-to guy for wx questions. Admittedly I don't use wx and so there aren't many.
 
Maybe a threading.Event would be better than a Lock, but now we're just deciding which functionally equivalent approach best communicates your intent.
 
8:02 PM
It doesn't help that he's on 2.x and I'm on 3.x. His solution worked in 2.x, but I need it in 3.x.
 
Maybe I can solve it, like a man trying to read an Italian newspaper using his high school French lessons
 
7
Q: wxPython threads blocking

Morgan ThrappThis is in the Phoenix fork of wxPython. I'm trying to run a couple threads in the interests of not blocking the GUI. Two of my threads work fine, but the other one never seem to hit its bound result function. I can tell that it's running, it just doesn't seem to properly post the event. Here'...

If you can get it working, I'll give you all of my rep.
Where all = 500 because that's the maximum bounty amount.
 
DSM
Ehh, if it comes to that we could take up a collection instead. No point in you dropping below 2k.
 
Aw, thanks. :)
 
But the rep carries a terrible curse.
But the rep also comes with a free frogurt!
But the frogurt is also cursed.
But you get your choice of toppings!
The toppings contain potassium benzoate.
 
8:06 PM
I've tried two different ways of posting/receiving events, and neither one works.
 
    while not prepare_collection(DATABASE, self._previous_id, self._current_id, self._year, self._col_type):
        for status in range(10):
            post_event('prepare.running')
        return None
Unconditional return in a while loop? Looks a little odd.
 
Basically, it returns None once it finishes posting the event so that the variable the thread got assigned to becomes None. It's a slightly hacky way to stop the thread.
 
@Morgan I will help you bear this burden, as long as it is your to bear for about 7 days.
 
my mtn. dew just exploded
 
The post_event function should send the event data to the handler.
 
8:10 PM
yes, hi I just used a permanent marker on a whiteboard...ok...that is all.
 
@Ffisegydd Thank you!
@idjaw Draw over it with a dry erase. It'll make it so you can wipe it right off.
 
DSM
@JGreenwell: we've all been there.
 
Draw over it with a -- augh beaten
 
DSM
@MorganThrapp: you stole my idea! I had to do that after I used perm
 
The only difference between dry erase and wet erase is alcohol. Convince it to play ring of fire.
 
8:10 PM
brb...will do this science you speak of @MorganThrapp
 
DSM
@Kevin: !!!!!! you beat me to my complaint about being beaten!
 
Apply alcohol to surface. If that fails, apply alcohol to self
6
 
@idjaw you could just write over it with a regular marker if you don't have alcohol available
 
I got 5 extra points on a quiz in college for saving my professor's ass with that tip. :P
 
@DSM :-D
 
8:12 PM
Because alcohol wasn't an option, @tzaman saves the day. TIL today mom: permanent markers are not permanent...and I'm not very smart.
 
Backup plan: Repurpose the ruined board with chalkboard spray
 
backup to the backup plan: Buy a chalkboard
 
You can always flee to Mexico (if you have not yet fleen to Mexico).
 
Also, debugging with threads is my least favorite activity.
 
@Kevin I'm the marker guy at work now. I've been...marked.
 
8:17 PM
Would you say there's a permanent mark on your record now?
 
@MorganThrapp But fixing a race condition is one of those satisfying "I'm a real programmer!" experiences.
 
DSM
(tip of hat)
 
@QuestionC Sure, once you fix it.
 
while trying to fix it you wonder why you are programmer
@tzaman yes, it definitely will leave its mark on me
 
@QuestionC That's like banging your head against a wall because it feels so good when it stops.
 
8:19 PM
When I got to that point, I just threw my self before the minds of more experienced programmers.
 
I tried that, but no one else in my company knows any Python.
 
Complete architectural understanding is useful with this kind of thing =)
Who... wrote the thing?
 
They found it in the wild, and decided to raise it as their own.
 
Left in a basket on the corporate doorstep.
In the absence of more experienced programmers, you could ask us goons.
 
8:22 PM
@QuestionC I have. :P
 
DSM
And we have failed him, time and again, more's the pity.
 
Joran's answer didn't work? Calling form methods from a child thread is one of those old gotos for threads breaking everything.
 
@QuestionC Nah, I couldn't get it to work.
I'm using his pubsub suggestion, but it still doesn't hit the event handler.
I've tried moving the declaration of the publisher to the form and the panel, but it didn't work with either of them.
 
my head hurts
 
well stop banging it against the walls
 
8:28 PM
debuggers work better than concussions
I think....
 
I'm more of a pull hairs from head sort of stressed out person
 
Not an option for me. I'm bald..and not the optional kind
 
I wish I was just debugging though lol
 
ahh...non-exploding caffeine just what I needed
 
8:55 PM
I've never seen a coffee explosion
 
Get one of these and you will.
 
I think he is referring to the carbonated variety
ha!
 
I have - when someone made instant coffee in a glass container and heated in the microwave.
 
I've never not had one of those blow up in my face.
 
I've never heard of that but it sounds gross
(i don't see an image)
 
8:58 PM
It's amazing. It's not very sweet, just a slightly carbonated espresso with a hint of caramel.
 
Is it beer? I don't drink :p
I do like a good cup of coffee with some form of dairy (black coffee is gross)
 
It does not exist in my neck of the woods....looks interesting
 
rbrb :)
 
@idjaw Worth trying if you get a chance. I've only seen it in a few different shops in upstate NY, not sure if it's regional or not.
 
9:18 PM
I am going to Plattsburgh soon... :) Could grab a couple
 
9:32 PM
well, that's all for today...rbrb
 
10:31 PM
@tristan If your interested I found the article I was looking for, yesterday, that talks about the decline of student resistance - includes some insight into why professors are not giving bad grades and other problems.
 
 
1 hour later…
11:41 PM
Can I assign the print function to a variable in python 2.7?
 
yes
why?
>>> from __future__ import print_function
>>> var_x = print
>>> var_x('foo')
foo
No good reason to do that though, just use print
 
Thank you
I was going to try to golf it but you're right
 

« first day (1815 days earlier)      last day (3133 days later) »