« first day (2448 days earlier)      last day (2499 days later) » 

6:00 PM
It might not be perfectly minimal but we keep asking questions answered in their post :/
 
@Kevin well, just assume that the functions do what their supposed to do. I'm not sure why you would need to know what run_scan() does besides the button at the end
 
@Andy_A̷n̷d̷y̷ that's part of the M in MCVE-- minimal. Extra stuff in there confuses and distracts from the issue at hand
 
Diagnosing problems is done most efficiently when I can run code on my own machine and see exactly the same error you are, and when I can change that code to see if potential solutions actually work. That is the primary purpose of an MCVE.
I have a feeling that you actually want to be passing around the app object created in the if __name__ == "__main__": conditional in the main file, which you can't really get access to by importing. Dependency injection might be appropriate here.
 
@idjaw it is supposed to all an instance
 
then you should be doing main.Menu()...no?
 
6:03 PM
Actually, I see you are injecting the app instance into the child frames, via the parent parameter. So it should be quite easy to get access to it.
 
frames is a dict where the key is a class (not an instance) and the value is an instance of that class
 
What if you do lambda:self.controller.show_frame(self.parent)?
 
@idjaw let me try it out. $ it didn't work
@Kevin, what's Dependency injection? Can you provide example please?
@Kevin, I'll try that and let you know
 
I think we're all missing the real issue here. Why is __main__.Menu not hashed the same as gui_main.Menu ?
They appear to be the same class
 
@KevinMGranger That's the issue
 
6:05 PM
The short version is: When class A requires an instance of class B to work, dependency injection is when you define A.__init__ with a signature like def __init__(self, instance_of_b): self.instance_of_b = instance_of_b
Which is what you're already doing. Your frames need a MainWindow to run, and when you do frame = F(container, self), you're passing the MainWindow instance as the second argument.
You're not explicitly storing the parent as an attribute of self but I'm 60% sure that Tkinter does that on your behalf when you invoke the Frame class' init via super()
 
Can you give us the exact KeyError you're getting?
 
Or, uh, at least I assume that's what you're doing, since you didn't share the source of gui_frame
Would have been nice to see the complete source code, then I wouldn't have to guess >_>
 
@KevinMGranger
self.active_frame = self.frames[next_frame]
KeyError: <class 'gui_main.Menu'>
 
wim
dependency injection is a pretty fancy way of saying "passing arguments" :P
 
@Kevin they pointed out in their post the exact error and what lines it happened on. While your TK advice is good, it's not solving the problem at hand unless I am really misunderstanding
4 mins ago, by Kevin M Granger
I think we're all missing the real issue here. Why is __main__.Menu not hashed the same as gui_main.Menu ?
I'm assuming this is some sort of weird import-order rule or something, but that's a bit above my level of knowledge
 
6:09 PM
Honestly I only half-read the question so I may be drilling in entirely the wrong spot
 
this doesn't work:
command = lambda:self.controller.show_frame(self.parent))
AttributeError: 'PerfomScan' object has no attribute 'parent'
 
Just as well, I misunderstood what kind of argument show_frame was expecting anyway
 
Non-explicit typing strikes again!
 
I also don't know what kind of argument 'show_frame()' takes. I didn't write the code for it
but I assume it takes a frame object
 
It's not being passed a frame object, and one can tell from its body that it takes a class that is one of the keys in the frames dict
If you can clean up that question (remove the unnecessary parts) and add in the body of PageFrame, we might be able to help you-- not because it'll solve the KeyError, but because there might be a way to avoid it in the first place
If you can read up more on how importing works, that might help too
 
6:14 PM
I would move the classes out to their own file and import them in both the main file and the gui_scan file. I suspect that would fix the circular import trickiness.
 
@KevinMGranger ok, I'll read up more on importing, any helpful resources you recommend?
@Kevin I'll try that after all options have been exhausted
Thanks for the help everyone
 
Going to second @Kevin's solution too
 
@Andy_A̷n̷d̷y̷ Just some general advice: When you want to build a program using parts that you didn't write, it's a Good Idea to get each of those individual parts and study them separately so you understand what they do and how they work.
For each part, write little programs that lets you test it and perform experiments on it. Then when you feel confident that you know what the parts do start combining them, but continue the tests & experiments to make sure that stuff really does do what you think it does.
@Andy_A̷n̷d̷y̷ And next time, please don't bring your fresh SO question in here, give it at least a day or two, as mentioned in our room rules.
 
@PM2Ring This is really good advise. Thank you for taking the time and writing this. I will use this technique from now on, and just so that you know, I've been stuck on this problem for a day, and that's why I'm asking here. Usually, I give it some time, and think about what's happening, and then ask a question here.
 
6:48 PM
ok...turns out my tox work I did does not work at all
ugh...the further I dive in to trying to get specific with tox, the more I'm realizing that it has some very annoying limitations
 
DSM
That's too bad. You were so happy, too!
 
haha I know!
 
It's toxic to your mood
 
ok mcve time. I gave this a good try. Going to try to see if any of you know a way around this
gonna craft something now
 
(yeah, one of those days for me)
 
DSM
6:50 PM
Time to fork it: xot
 
here we go
My goal is to minimize repetition in my tox file
My tox file will run:
py27, py35, py27-integration, py35-integration
here is a cut down version of my tox file
[tox]
envlist = {py27,py35}, {py27,py35}-integration

[testenv]
basepython=
    py27-integration: python2.7
    py35-integration: python3.5
commands =
    py27: python -m testtools.run discover
    py27-integration: flake8 {posargs}
    py35-integration: flake8 {posargs}
 
bjg
Hi, don't want to interrupt but any chance there is someone here with experience in machine learning?
 
not me, sorry.
 
@bjg Hi, please read the room rules: sopython.com/chatroom unless your only question is if someone knows Machine Learning and there's no follow up question on it... Then no from me too.
 
ultimately, when I run a "tox -e <>" I need it to run just that and I don't want to have to keep creating the same [testenv:foo]
a lot of the manipulating I have been doing has been matching the patterns so it would run everything under that match. I can cheat and do something like p27-integration
but that gets a bit hacky, and the CI is already set up with expected templates that I do not want to go against and introduce an edge-case template
so....there we have it.
I'm thinking of making a question about this. But, still not sure.
 
bjg
6:59 PM
Ok, so I should just ask my question then...I've started my first machine based learning project and I'm trying to perform image segmentation for 1 class of objects (+ background) using a fully convolutional neural network. During training I have training images & validation images. During testing I have validation images only. For some reason I get better image segmentation (higher percentage of correct pixels) on the validation images during training then during testing. Is this expected?
 
I'm in no way an expert, but I would think "yes"
 
Here's my uninformed opinion. Training images and validation images is more data than just validation images. I expect a machine learning algorithm to perform better when it has more data.
 
My uninformed opinion: your neural network is taught using the training set, so I'd expect it to produce the best results with that dataset. The real (testing) dataset is different in places, which can lead to worse performance, especially if your training set is not representative enough
 
bjg
I would have expected the same accuracy because the output of training (trained neural network) is used as the basis for testing. The validation images are identical in both cases.
 
ooooh, worse score for the same validation dataset?
 
bjg
7:03 PM
right, I know that eventually I need a independent set of images for testing...but when using the same validation images the accuracy is less with my testing code
 
we're always caught off guard when we get questions with so much substance that they actually need to be read
 
that ^
 
bjg
as it turns out this is how the code I'm using was setup (overlap between validation images in training and testing)
:-)
 
@bjg what's the difference between training and testing if you're feeding the same validation set to both (assuming training's finished)?
 
bjg
the code was based on the Fully Convolutional Networks for Semantic Segmentation, adapted to Matlab
I don't think there should be any difference, this is why I'm confused. The code simply loads the trained network and proceeds to test the same set of validation images.
 
7:06 PM
btw there are some machine learning regulars in the matlab room (not present right now, but often)
@bjg yeah, that sounds fishy
 
bjg
oh ok, I'll look for that room at some point, I'm guessing the answer will reply to all machine learning but didn't see a machine learning room
ok, glad to know that your sense is similar to mine
answer will apply*
 
yeah, there isn't one as far as I know, perhaps there's something close on chat.stackexchange.com
@bjg not that it matters much, concerning my almost utter lack of ML knowledge ;)
 
bjg
@AndrasDeak I do see a Machine Learning room there but it has been inactive for 52 days
 
Would anyone be interested to proof-read my question before I post it?
 
DSM
I can have a look.
 
7:09 PM
thanks
 
@bjg I guess that's as good as it gets...unless some data science guys are willing to help out
but I don't really see a dedicated chatroom of theirs
 
thanks for taking a look. Really appreciate it.
 
bjg
@AndrasDeak thanks
 
god dam it!!!! windoooooows
please! someone help me? :/
try to install dlib since 9hours
on windows
 
7:18 PM
I thought you were fighting with boost-python
 
yeah thats the next thing.

I try pip install dlib
and than I get the error that I need boost-python
and can not install boost-python
 
sorry there was just way too much going on there
for much longer chunks like that use pastebin and reference that
 
what ever.
 
Don't take your frustrations out on others please.
I get you're annoyed because you can't get your project running. We all have our messes to deal with.
 
please.. I am just asking here a question, and I sent the problem.. I explained the problem
how the f could someone help, when he has no details?
but its ok
 
7:26 PM
As I already said
2 mins ago, by idjaw
for much longer chunks like that use pastebin and reference that
So to be more clear. Explain your problem, but for "large" outputs of code, error messages, etc, please use pastebin.
 
Jun 10 at 16:56, by Andras Deak
 
so that whole trace you posted, should be in a pastebin.
And please stop snapping back rudely
that's your second warning
 
what a warning? am I in the wrong movie? hehe
ok ok, it was to much code at once for the chat, sorry
 
DSM
@idjaw: looking at it now, and trying a few things. :-)
 
7:40 PM
@DSM thanks 😀
I'm holding out on posting as a question until it's really worth it to post it.
it's that pattern matching that is really driving me bonkers.
 
wim
8:02 PM
contextlib.ExitStack is my new favourite toy
dang, this thing is useful !!
 
@idjaw Werkzeug has a test that need to run through uwsgi, but uwsgi doesn't pass on the exit code from pytest. The entire test has been failing for a long time and no one noticed because tox thinks it passed.
So I'm writing a pytest hook that checks the result of each test and if a uwsgi test failed it writes a marker file.
And that tox env has a second command to read the file and exit(1) if it exists.
 
Yeah I just took a look. The nice thing you have is your "normal" definition
I wonder if my CI can accept an optional template argument
because if I can separate unit and integration my problem is solved and my tox would look very close to werkzeug
 
I'm rewriting the entire thing right now, which is how I discovered the issue.
 
I'm curious to see your new tox file
 
You can have multiple tox configurations, and choose which one to pass with a Travis env var, I think.
 
8:06 PM
my pipeline is going through the internal CI
so I have a zuul template that specifies which tox to run
 
cbg
 
The best I could find was this... /questions/34828230/python-how-does-return-work-in-function
-7
Q: Python- How does return work in function

John KaffI am confused with using functions in python. Suppose i have this code def calculate(a): a = int(a) return a # or yield a Then i write as def _convert(a): a = int(a) return a # or yield a+1 def calculate(a): _convert(a) # is this correct or i need (return _convert(a)) ...

 
-7...nice canonical target ;)
 
8:16 PM
I figure the reference for the duplicate should have the upvotes it deserves. ;)
 
yeah
 
8:27 PM
I never thought I would see a question about how to optimize allocating and creating an 8 MB integer in.....
 
you don't pay enough attention to SO ;)
the other day there was a discussion on an answer whether var>=0 or var>-1 was more efficient
 
Not enough, apparently. I asked him what he needed with ~64 million more bits of precision than number of atoms in the universe...
:/ It's Python...
 
oh, 8 MB for a single integer....nice
 
ew
 
Yeah, they wanted to convert > 8 million characters into a single integer....
 
8:35 PM
There's BigInt, and then there's BiiiiiiigInt
 
must have been a mathematician working with π
"what do you mean finite approximation?"
 
:p Nope, just wanted a unique way to represent a string.

I suggested (void*) buffer; Didn't go over well.
 
@AndrasDeak so which was it ?
 
chat discussion deleted now
referenced around here
oh, you mean which one was faster... :|
 
Like, I get it in C, especially for routines (or macros) used a million times, because certain operations can be much faster than others....

Like I've seen this a lot:

#define CH_SLOW(x,y,z) ((x & y) | (~x & z))
#define CH_FAST(x,y,z) ((z) ^ ((x) & ((y) ^ (z))))
Both do the exact same thing, just one is optimized to must faster assembly by the compiler in most cases.... But this is Python: bitwise operations aren't fast. Operations aren't fast. It's idiomatic, it's nice. It doesn't matter...
 
8:50 PM
user didn't like that I closed their new question as a duplicate of the one they asked a few hours ago
 
DSM
@idjaw: I couldn't figure out a way to avoid the behaviour given how the results of .split('-') are treated. But your question seems pretty clear. The only thing which might be a plus is to have a full MCVE (include a dummy setup.py, and I used python -c 'print("py27-integration")' etc. in the commands section.
 
check out that review summary
 
@DSM I really appreciate the time and review that's awesome. Yeah. I'll work on putting together a functional run for those who want to actually try it.
So, you agree in terms of its question-worthiness?
I might put it up tomorrow late morning
more eyes :)
 
I mod flagged them.
 
8:54 PM
@davidism hmm, you seem to have single-handedly rejected it
 
DSM
@davidism: I can't find a "reject" button on that page.
 
oh, it was your post
binding vote
 
DO these chatrooms have APIs?
 
Yeah, that didn't show up at first, it still said there was an edit pending.
@faceless no documented api, but there are various projects that have reverse engineered some of it.
 
id want to write a robot to welcome users that join the room. You know, like how they did it in the renaissance days
 
DSM
8:55 PM
@idjaw: the best practice, even if turns out to be very easy, doesn't seem to be obvious, which makes it seem like a reasonable question.
 
Please don't.
 
Robots in the renaissance days were called "serfs" I think.
 
There's Twitter for that.
 
that got dark
 
8:59 PM
Stop pinging the same person over and over again
 
nice try frog! But you can't pass as a cat
 
This is still the best trend.
 
DSM
Cats wearing frog hats?
 
9:01 PM
rofl
 
and now for a jeopardy break
Google Cloud Storage was an "answer" on Jeopardy last night. @googlecloud @milesward https://t.co/McO3rMS3NA
 
DSM
 
IT'S A FOX-CAT
 
Whoa, those are some colorful... foxes?
 
fox-cat on google returned that image as the first result. Therefore, I am right.
 
9:04 PM
Baby lynxes?
 
DSM
Caracals, I think.
(Will anyone believe I knew that before a few minutes ago? Probably not, but they won't be able to prove it, so I'll just pretend.)
 
yup...DSM is correct
The caracal (Caracal caracal) is a medium-sized wild cat native to Africa, the Middle East, Central Asia and India. It is listed as Least Concern on the IUCN Red List. The caracal is threatened by habitat loss due to expansion of farms and human settlements as well as advancing deserts, and is often killed by humans in conflicts over livestock. Its natural habitat includes semi-deserts, open savannas, shrublands, moist woodlands and montane forests. The caracal is characterised by a robust build, long legs, a short face, long tufted ears and long canine teeth. Its coat is uniformly reddish tan...
 
Smug little furry things they are
 
wim
How do you change the prompt on an existing virtualenv ?
 
more like catacat
 
wim
9:08 PM
I know how to customize the prompt on a new venv
 
what do you mean by change/customize?
sorry. Not quite understanding
 
sorry, I have one question. For this tutorial: github.com/datitran/Object-Detector-App/blob/master/…
Is it normal for the inference_graph to take minutes to load?
 
@wim you might have to redefine PS1 yourself
that's partly what sourcing bin/activate does
 
Could Machine Learning algos be placed at street intersections, collect enough data of cars that cross the intersections to then, depending on the amount of cars at each junction, time the lights perfectly, so cars dont have to wait very long at each light?
 
if [ -z "${VIRTUAL_ENV_DISABLE_PROMPT-}" ] ; then
    _OLD_VIRTUAL_PS1="$PS1"
    if [ "x" != x ] ; then
        PS1="$PS1"
    else
        PS1="(`basename \"$VIRTUAL_ENV\"`) $PS1"
    fi
    export PS1
fi
but you probably need to make sure that deactivate() will work if you mess with it
unless venv has some features to change that, as you know I'm very nooby with them
 
9:13 PM
@faceless Maybe train a neuralnet to predict if a streelight should be on or off, and then penalize it predicts "green light" when there is no car
if it*
in an unsupervised way
 
@WenqinYe green light when there's no car is fine; red light when there is a car is a problem
 
or yea, that too ^
 
most large cities will likely have a lot of critical junctions where no amount of machine learning will alleviate jams
@wim you'll likely need _OLD_VIRTUAL_PS1 which is defined inside the venv
 
@Andras are you familiar with tensorflow?
 
confirmed: redefining PS1 automatically updates the prompt, no need to re-export even
 
9:17 PM
I mean, if you calculate each junction individually and calculate how many cars per day cross a junction within a certain standard deviation, couldnt the algos learn to time the lights?
 
@WenqinYe nope
 
@AndrasDeak wat this
 
@AnttiHaapala bin/activate
 
yucky old shell tshi
I've got nice zsh scripts for virtualenv
 
well aren't you just perfect and all oh la la
<3
 
9:19 PM
relatively speaking, aren't the same amount of cars going to cross a junction per day at certain times during that day??
 
@idjaw of course I am
 
\o/
 
@faceless imagine a crossing where two avenues meet. During rush hour, there's a constant stream of cars in both directions. No amount of counting and ML will give you an "ideal" solution in the usual human sense of "ideal".
In a lot of cases this could work, I guess. But definitely not worth the infrastructure of either posting cameras or induction loops into every lane of every direction of every crossing.
 
unless its already been tested, id imagine most lights right now are less than ideal.
when would it not work you think?
 
There's also other factors: coordination across multiple intersections, identifying bottlenecks due to number of lanes / merging versus timing issues, making users happy.
 
9:22 PM
they are set by engineers, so they have different standards
"it works, close enough"
 
time of the day too
 
if it's not close enough, they try something else
much cheaper
 
Traffic analysis and civil engineering are huge things. People are already testing and thinking about this.
 
to-work rush-hour, to-home rush-hour
sporting events congestion
foo event blocking random intersection causing traffic
 
Weekly this-street-is-closed-for-maintenance? Do you have stuff like that?
 
9:23 PM
construction
 
emergency vehicles
 
we just decided to take apart an entire section of the highway because we are the city and we can do what we want traffic
grumble montreal grumble
 
The highway caught fire and melted. That happened a few months ago somewhere on the East coast.
 
I remember that
because a bonfire right under the highway sounds fun
 
a truck caught fire and the highway was closed for two days
 
9:24 PM
so youre saying there is a chance for this to work, but the neural net will have to learn?
 
Which neural net doesn't have to learn?
isn't that the point of a neural net?
 
If only there was a neural net, all problems would be solved.
 
:37892988
You said no amount of machine learning could alleviate jams
 
yes?
 
And you responded with 'which neural net doesn't have to learn' so wouldnt that mean this problem could be alleviated through ML?
 
9:27 PM
we might be taking part in two separate discussions
 
1 min ago, by davidism
If only there was a neural net, all problems would be solved.
that was sarcasm
 
your expression was a dead giveaway
 
My CPU is a neural net processor. A learning computer.
 
No amount of machine learning can alleviate yams
 
on the contrary, I expect machine learning to involve (and invoke) a lot of yams
 
wim
9:31 PM
@AndrasDeak no
 
@wim OK
 
wim
then I deactivate and reactivate, I have the same prompt back again not the new prompt
 
well, you didn't say "permanently"
you need to edit bin/activate if you're sourcing it each time when you start the venv
am I missing something obvious?
 
I still don't get what wim is trying to do
 
wim
editing manually the value in venv/bin/activate works
I just wondered if there was a command to do that
 
DSM
9:32 PM
Bah, time to flee. Rhubarb or all!
 
rbrb @DSM
 
~/dir$ source ./bin/activate
(numpy-devenv) ~/dir$ PS1 = "~fancy new stuff~ $_OLD_VIRTUAL_PS1"
~fancy new stuff~ ~/dir$ deactivate
~/dir$
in a venv called numpy-devenv because I was lazy to change that too
 
wim
@AndrasDeak that has nothing to do with venv, that's just setting the prompt
 
rbrb DSM
 
what does rbrb mean @idjaw
 
9:34 PM
@wim what do you mean?
 
lol cool
 
wim
@AndrasDeak I mean now if you source ./bin/activate again , you will have (numpy-devenv) ~/dir$ back
 
yes, we covered that already
 
wim
you don't get ~fancy new stuff~ ~/dir$ back
 
9:36 PM
I was trying to tell idjaw what you're after
should've pinged him, I guess
 
Yeah I have no idea what's going on or who's trying to do what and what's happening right now.
I'm officially confused about whatever it is you guys are talking about and trying to figure out
 
wim
nm
editing the activate script is fine. I don't think there is a venv command to do it for you.
 
@wim are you sure calling venv again with a new prompt messes with the environment? In a dummy setup it left my installed package unharmed but changed the prompt
 
wim
right, that worked actually
python -m venv venv --prompt "new prompt"
but you have to re-activate it
 
sounds reasonable
 
9:51 PM
anyone here use sublime text?
 
there are a few probably.
I use it now as a quick editor when I'm not using my normal IDE....or vim
I used to use it heavily
 
why dont you use it as much?
and you use pythons IDE?
 
I use IntelliJ and PyCharm mostly
 
Is it fair to mention the idea of a set to this user?
https://stackoverflow.com/questions/44835563/would-like-to-prevent-dupes-in-a-python-list-of-lists
 
@AlexanderHuszagh Yeah. I was thinking the same thing. However, would love to see their approach too on what path they were taking.
 
9:57 PM
Seems like someone else is already answering. I might as well suggest that frozensets and sets exist.
 
job done!
hehe
 
@idjaw what did you use for user input in sublime text?
I'm using sublimeREPL currently
 
:p Oh I really hope item multiplicity isn't an issue. Although Python has a multiset implementation, right?
 
@faceless I have never written any production code that used input
 
@AlexanderHuszagh they are explicitly asking to remove duplicates...
I don't even get that comment asking otherwise
 
10:00 PM
oh :O
 
oh, dupes between lists, perhaps?
I see the confusion
 
I mean, {a, a, b} is a different item than {a, b} in a multiset, so a set of sets like {{a, b}, {a, a, b}} can exist.
Yeah.
 
@faceless I barely have any use-case for me to write code that uses input. I've never had to write applications that ran that way
 
I understood the dupe thing as map(set,lst)
 
any code that a user would interact with, would be written by passing arguments to the application, or communicating via API
 
10:01 PM
Yeah, ideally. Python has a lot of ports of C++-like containers though, and people don't use them enough IMO.

https://pypi.python.org/pypi/multiset
 
That's pretty cool
 
those guys will hit their heads when they all jump on the question once all relevant information is provided
 
I'm maxed out so...
 
OP has not given the necessary clarifications and everyone is discussing what it might be
I love SO
 
Me too....
Still my favorite part:
So the OP cannot update the post to include the relevant information, but can edit the suggested answer to remove two ";' from a print statement?
 
10:29 PM
The edit was not from the OP.
 
OP's username always has a greyish background
 
Wait it wasn't? I thought it was.
Also, there is so much wrong here... stackoverflow.com/questions/44835945/…
 
frigging comment formatting won't let me post a string literal with consecutive spaces
 
not even in code format?
that usually preserves whitespace
 
Even code-formatted.
 
10:46 PM
bleh :/
bug report/feature request?
 
Are there two types of people in this world?
x > 0 and x < 10
x < 10 and x > 0
 
0 < x < 10
 
so there are three!
 
in a language with no operator chaining I'd be inclined to use 0<x && x<10 in this context
 
^ that
print("There are 10 types of people in the world.\nThose who understand binary,\nand those who don't,\n")
for i in itertools.count(2):
    print(f"and those who weren't expecting {ary(i)}\n")
 
10:58 PM
what is the 'f' in your last print statement?
 
wim
more importantly what is ary
 
you're a lizard 'ary
 
Implementation of ary is left as an exercise to the reader.
 
wim
I don't get it
 

« first day (2448 days earlier)      last day (2499 days later) »