« first day (2575 days earlier)      last day (2598 days later) » 
00:00 - 17:0017:00 - 00:00

17:04
@Kevin They teach Mexican Spanish down in the South, and Japanese, for some reason.
Maybe the offerings have diversified in the [mumble] years since I was in high school.
Cabbage
Does Numpy have a simpler way to do this? a is a 3D array (an array of RGB pixels).
b = np.zeros(a.shape[:-1] + (1,), dtype=np.uint8)
I guess the goal is to convert RGB pixels to RGBA:
a = np.arange(60, dtype=np.uint8).reshape(4, 5, 3)
b = np.zeros(a.shape[:-1] + (1,), dtype=np.uint8)
c = np.concatenate((a, b), axis=-1)
I guess a.shape[:-1] + (1,) is readable, but it seems a bit clunky for what I imagine is a fairly common kind of operation.
I occasionally see people in the PIL tag wanting to convert between formats like this, but I don't recall whether there's any cool numpy tricks that make it easy
Ok. I'll continue making random docs searches. :)
Found it! I can do it with np.insert
@PM2Ring: If a has dtype uint8, maybe np.zeros_like(b[..., None]).
wait never mind
17:20
I know this isn't a programming related topic but if someone has neural network experience and can share I'd be forever grateful.. How does one normalise continous inputs? I've seen z-score and min-max normalisation but I find z-score normalisation returns a distribution outside the standard [0,1] range which is ideal for neural net inputs. Anyone have experience in this domain?
Yam. I should've refreshed the page. It got hammered 22 minutes ago. Oh well. At least I've learned a little more Numpy. :) That question attracted my attention because I needed to do something similar myself less than a day ago with PIL + Numpy.
@Daruchini FWIW, questions like "Anyone have experience in this domain?" are discouraged by our room rules, because people who ask such questions have a tendency to latch onto those who reply. ;) So it's best to just describe your problem and let those who can (and who want to) reply. But anyway... I don't know much about neural networks, but do you have hard limits that the inputs are guaranteed to fall within?
I'm working with medical data so yeh max limits can be revised
I've been comparing z-score with min-max looking at how the distributions are captured compared to the original distribution
@PM2Ring thanks for the heads up though. Noted :)
If you want to mainly concentrate on data within a given range and give less importance to outliers, the hyperbolic tangent can be useful. tanh(x) is fairly linear for -2<x<2, and for x values outside the range it quickly tends to 1 for positive x and -1 for negative x.
17:36
Thanks i'll dig into it :)
wim
wim
import os
from tempfile import NamedTemporaryFile

try:
    f = NamedTemporaryFile()
    print(f.name, os.path.isfile(f.name))
finally:
    os.remove(f.name)
why doesn't that work? (don't say to use the context manager)
What do you mean?
wim
wim
unhandled exception in the cleanup
if you're in interactive interpreter, you'll probably have to del f to trigger it.
huh. NamedTemporaryFile is a function, not a class.
Why do you want to call os.remove on a temporary file?
wim
wim
because you might want to explicitly free it earlier than automatic cleanup will happen
17:50
> If delete is true (the default), the file is deleted as soon as it is closed.
I guess so, but temp files are weird, and should be handled with caution. ;) Also note that the exact behaviour of temporary files is OS-dependent
del f should close the file in your example
wim
wim
my expectation was that it would suppress FileNotFoundError if the scratch was already cleaned up
@vaultah del f only removes one reference.
There's only one reference in your example, right?
wim
wim
yes. MCVE.
17:54
.close is not an option?
wim
wim
.close has the same issue.
.close instead of deleting manually?
wim
wim
I noticed this because TemporaryDirectory, which has an explicit cleanup method, behaves differently (it behaves correctly, imo).
So that one's a class I take it
"because you might want to explicitly free it earlier than automatic cleanup will happen" - but the automatic cleanup happens on close. It seems like a very weird use case to create a named temporary file and then unname it without closing it.
wim
wim
17:58
@AndrasDeak Yes, a class with a _finalizer attr (weakref)
much cleaner code
I'll google that
There's a certain irony to an object called "temporary" being impossible to get rid of until the last possible moment
wim
wim
I guess TemporaryDirectory was just more carefully written than the temp file ... shrugs
@Kevin the alternative would be RadioactiveFile that can decay with rate p
Epitome of EAFP
@AndrasDeak here, but it's a question about Gtk, which you're probably not familiar with
18:02
@wim: If you bypass TemporaryDirectory's own cleanup mechanisms through os.rmdir or something, you get the same problem.
...wait
@Rawing a vote is a vote :P
Well to be honest I'm on the fence about VTC-ing that question. It's true that it lacks an MCVE, but it's (probably) also true that the relevant part of the code is there - the part that's missing may be just the usual stuff of initializing the toolkit, opening a Window, etc
So it can probably be answered, it just takes a lot of effort...
ah, ideone wasn't showing the stderr. Yeah, you get the same problem.
18:18
We prefer to wait a day or two before accepting solicitations on questions. There might be someone writing an answer for your question right now! It's only been half an hour, after all.
please read our chat room rules here mainly don't post recent questions
ahhh kevin'd :(
DSM
DSM
@min2bro: you were asked to provide an MCVE. I don't know what "Optimized the Question" means, but it doesn't seem to have provided one.
Sorry for my bad english, Not my native language, I tried to explain what I'm trying to achieve using flask - I'm trying to display the console output on the html web page
Coming up with new ways to rephrase the question is all fine and good, but I think people are asking for your code
DSM
DSM
@min2bro: I really advise taking the time to read the page on MCVE that davidism linked. It will help you help people help you, and avoid a lot of frustration all around.
18:23
@min2bro Also note that some (many) people might not be able to follow your link due to sites like imgur being blocked at their workplace etc.
ahh I'm not using imugr, it's a raw screenshot..
@min2bro You need to provide an MCVE or your question will be put on-hold until you do. FWIW, davidism is a maintainer of Flask, so if you fix your question he is highly qualified to help you.
ok I'm trying my best to read the article shared by Davidism and will provide MCVE to my question
To me it appears to be a link to https://i.sstatic.net/D09Er.png
And irrespective of the hosting service, it's an image, and people prefer code they can simply cut and paste, not to mention see in the first place, which is not given when you use an image.
18:26
@min2bro Look at the address of that image. It's on imgur. And why do you need to post an image of text anyway?
@toonarmycaptain Well, that's output, not code, but apart from that your points are valid.
Best time to get ready for watching Thor. Rhubarb
i just wanted to show that how the output looks on the jupyter notebook in that image and same thing I'm trying to achieve on the HTML
DSM
DSM
Scandinavian rhubarb for @AndrasDeak!
@min2bro You can easily do that with text, which wastes less bandwidth.
I assume by "I'm not using imgur, it's a raw screenshot" he means "I just used the built-in 'upload image' feature on the post editor, I didn't pick a host myself" in which case I think it's forgivable that he didn't shop around for alternative hosts that were less likely to be blocked or whatever
18:30
@AndrasDeak do remind me to ask you how it turns out on monday \o rbrb
Leaving aside the matter of whether this particular information is best conveyed through an image to begin with
:F
why is it so hard to convince people that the FAT file system is just plain bad bad bad.
@PM2Ring True enough.
@AnttiHaapala Probably because it's one of (I think) two file systems supported by Windoze :/
@ColdFire nice, stay tuned for delv-pls :D
18:33
@Kevin Ah. Having never attempted I never realised this. I assumed imgur was just a commonly used quick host like dpaste etc for text.
Which reminds me... I've been thinking it might be nice to slightly modify our room rules regarding fresh questions. I'm happy for people to ask "meta" questions about their fresh questions, i.e. getting help to make sure their question is good, similar to the recent mentoring experiment. But I guess it might be hard to make them understand that they can only ask about the form of the fresh question, not for an actual answer to the question. What do other ROs think about that proposal?
I guess it'd be better if SO had a "draft" feature, so people could ask for meta help before the question goes live, since the first couple of minutes after posting can be critical.
I've always thought it is ok
but then it's just me
Not a RO, but sounds good to me.
@AnttiHaapala If you want to use a USB flash drive on multiple OSes, FAT makes sense. And it's not a good idea to use a journaling system on a flash drive, due to the extra wear. I know it's fairly easy to disable journaling on ext3, etc, I don't know how hard it is on NTFS, or if it's even possible.
I'd strip out the rule entirely if I knew with certainty that it wouldn't cause a flood of solicitors.
18:40
@PM2Ring journalling file systems decrease wear.
@AnttiHaapala Yeah, it wouldn't really be a change of policy. It'd just be a matter of mentioning it explicitly in the room rules.
what FAT needs to do is always update the file size counter when new stuff is written, and it is always in the same block
It probably wouldn't cause a flood of solicitors, because it's not like there are a horde of question askers just waiting for the rules page to change so they can solicit without breaking their honor code
I just like the rule so that I don't need to tell the guy that "I am just annoyed by/at your bad question, otherwise it would be ok"
18:42
döner
Why the output is different when I run
df1.groupby(['nome', 'triggerid', 'desc'])['time'].sum().reset_index()
print(df1)
print(df1.groupby(['nome', 'triggerid', 'desc'])['tempo'].sum().reset_index())
and
you're printing the return value of reset_index vs the dataframe
@AnttiHaapala True, but AFAIK the hardware of USB drives is (supposed to be) optimized to handle that, so the 1st block has a longer expected lifetime. And that's why it's insane to put more than 1 partition on a thumb drive. Of course, my knowledge may be a little out of date & modern flash drives may not have more resilient 1st blocks.
Wild guess: for the same reason that a = [2,3]; a.sort(); print(a) has different output than b = [2,3]; print(b.sort())
@Kevin no
DataFrame.reset_index(level=None, drop=False, inplace=False, col_level=0, col_fill='')[source]

For DataFrame with multi-level index, return **new DataFrame**
18:44
That's all just noise to me.
@Kevin the thing is the exact opposite
:39879533 The output of first give only the column 'tempo', the other show all the columns
these methods return new objects, they're not mutating
Ok, so, for the same reason that a = [2,3]; sorted(a); print(a) has different output than b = [2,3]; print(sorted(b))
@Kevin so it is analogous to:
18:46
Well, bad example since a is already sorted
ya, or, a = 'Hello'; a.replace('e', '€'); print(a)...
Hi Guys, I have modified my question as per the MCVE and code is also provided, any help much appreciated
@AnttiHaapala Thanks. Simple to explain, easy to understand
@davidism min2bro has just added some code. I don't know Flask, but I suspect it's not exactly a MCVE...
My apologies if it's not matching the MCVE standards, i tried my best..code is also provided.
18:51
@min2bro You were told that you can't ask for answers to your fresh questions here.
@JoaoVitorino tall of tese dataframe metods pretty much return new dataframes...
Understand your point but it's bit important, so pinged here, anyways take your time..
@min2bro How much are you paying us?
I didn't get you, it's a community to help each other..
18:54
so your first is "calculate the sum of x and 5, multiplied by 7 and divided by 3, and then forget that number. Btw, what was the value of x again"
@min2bro we could help you, if only you'd make it easy
you're posting utterly incomprehensible questions without MCVE, then you're posting them here against the room rules, and when people point that out to you, you start whining.
Sorry, My bad
My Apologies
I don't even know what is dedupe
In their defense, I didn't see anything that I'd consider "whining"
dedupe is for deduplication, it's a python library to achieve deduplication in big dataset
so which part of the "consoleLabel": "Train a matcher instance (Dedupe or RecordLink) from the command line" eludes you?
19:00
So the dedupe.consoleLabel(deduper) is printing the question on the console instead of the user html
Ok. For future reference, saying that your question is important or urgent on SO is a bad idea, and likely to annoy or upset people.
OK @PM2Ring, Agreed, Hope u all r nice people and will forgive me for my first mistake in this room
Of course it prints to the terminal, the documentation for consoleLabel is documented as "Command line interface for presenting and labeling training pairs by the user". If you want to do that in Flask instead, you're going to need to look at what it does and recreate that, which is way too broad for a SO question.
Agreed @davidism but how does Jupyter notebook does it, even they are printing the console output in browser
Because Jupyter is a complex project that creates an interactive interface in the browser. They are the terminal. That's not how Flask works at all. Flask is a library that handles HTTP request and response data and routing.
19:03
that stuff required only 100k lines of code.
@min2bro my suggestion is: go to google and search for "dedupe python web"
In conclusion, your question as written is still way too broad, so I don't think it should be reopened.
... or, as those usually are, the answer is too short.. and then the follow-up is too broad :D
@min2bro actually if you read your "question" carefully, there is something important missing... namely at least one interrogative sentence that ends with a question mark.
@AnttiHaapala tried my level best from last 4 days and then landed to SO to get some solution from all you guys..
your google fu is lacking
try less google more
19:08
tried all possible ways using google
No luck
Well, pretty sure we're going in circles at this point, so let's move on.
DSM
DSM
@PM2Ring: very pretty!
@PM2Ring I agree with DSM, that looks amazing!
anyways thanks for all your help guys
Cabbage.
I've got funny eyesight looking at that.
19:12
@PM2Ring I look at that and all the time my thinking is "it would be so much easier if you just 3d-printed all those discs or rings and then put them onto a table..
Thanks guys.
3d printing is one way to keep the circles from overlapping. The physics engine of reality is real stringent about keeping two things from occupying the same space.
@AnttiHaapala Yeah. I want to lift it up & shake it so all the discs pack themselves together better.
I know there are particle systems that can do that sort of thing. But I don't know if I want to code that myself, it sounds like a lot of work. ;) But I've seen some amazing 3D stuff on the POV-Ray site.
@PM2Ring nope nope nope nope too creepy for me :\ but if you generated that nice work.
Found the trypophobe ;-)
19:21
@MooingRawr :) I normally use less intense colours, but I figured that since I was doing rings on a black background the fully saturated colours might look ok. It was literally a 1 minute hack to my circle packing program I've been working on. I've made it much more efficient, but there's still plenty of room for improvement.
Dec 8 '16 at 19:59, by MooingRawr
im also creeped out about many little holes in something
You already knew this and last time it happen I went away till the topic passed :P
Also looking up that message showed me that creepy picture again ;_;
I get a bit of trypophobia with stuff that looks biological, but I'm mostly ok with abstract stuff like the picture I just posted.
@PM2Ring See if it's like those metal platforms at playgruonds, I'm okie with it first, but then my mind starts warping it into bio stuff and then it's no thank you :\
@MooingRawr Fair enough. Here's a tileable one, without holes. Hopefully, it's less creepy: chat.stackoverflow.com/transcript/message/39789354#39789354
wim
wim
19:30
is argparse.ArgumentParser.register documented somewhere? can't seem to find it
@PM2Ring a lot better and nicer :D thanks
Oh, good. :)
Boy, full circle - I'm playing with Python Turtle about 20 years after using Logo in highschool. o.O
@toonarmycaptain Turtle can be fun. But it's certainly not fast. And since it's built on top of Tkinter it inherits Tkinter's quirks. But for simple stuff it's a bit easier than working directly with Tkinter. We don't get a lot of Python Turtle questions, but they're generally pretty easy to answer. And if the OP doesn't provide a MCVE it's usually less work to add the required supporting code than it is with a Tkinter question that's not a MCVE.
It certainly is not fast at all, particularly compared to my memories of Logo, which I recall adding pauses in to see what it was actually doing when debugging.
I'm only playing because it's in Think Python.
19:42
The only hard Turtle questions are the ones where the OP wants to implement a game more complicated than hangman, which Turtle is completely not suitable for
MFW
That's nothing.
Pygame not working
"I want to make something that's kind of a mix of Uncharted and The Witcher and Grand Theft Auto. I just need to figure out how to get this turtle window to be full-screen and I'm probably good to go after that"
@Kevin In 3d?
At least.
@toonarmycaptain You can control the turtle's speed. And it's a lot faster if you make the turtle itself invisible with .hideturtle()
19:53
I just uncovered a repressed memory of the last turtle question I participated in where the OP was like "It's just crashing with no error message!!!" and he posted a screenshot and there were five error messages in bright red in the IDLE window behind his turtle window
@Kevin Making a game with turtle? Your erm Ambitious
Crating a Tkinter canvas that supports 3d is not a bad idea in that case
@Kevin That rings a bell.
@Simon Kevin's just paraphrasing a typical overly-ambitious newbie OP.
I know. Just joking. : b
DSM
DSM
#defiance
20:09
I guess that makes me distinctly no longer a newbie.
Since there's no way I would try to do any sort of GUI/UI with the performance of Turtle that I'm seeing so far, even with hiding the turtle and setting speed to 0.
@davidism Can we send the user input from web to the flask cli?
@toonarmycaptain Just think of all the layers of processing involved. As well as the slowness due to it running on the Python virtual machine, you've got a turtle command processor sitting on top of Tkinter, which has to pass the drawing commands down to the Tcl/Tk interpreter. Frankly, it's amazing that it's not even slower than it is. :)
@min2bro you should probably read a Flask tutorial for that type of question
@davidism is the FlaskLord. Without his permission, you can do nothing.
@davidism Can you guide? which section of the tutorial?
20:21
The one about getting user input from a form.
It sounds like you're not familiar with Flask in general, so maybe just read the whole tutorial and try out some stuff on your own for a while.
If you're still trying to address your earlier question, it's not going to be easy.
oh that's an easy bizy thing, capturing user input, I'm asking how to pass the user input to the command line
I know it's not an easy cake, just exploring some alternatives
There's no command line, it's a web application.
it's a do or die situation for me
Fair enough, please don't hear my observation as a complaint! I'm just working through the text, which is by the looks of things, taking the reader through some functions, basic GUI, then into some OOP.
TIL you can pass arguments to functions in whatever order you like, as long as you name them eg my_function(third_arg=whatever, first=the_first_one, second=what_should_have_been_the_second_one)
@toonarmycaptain No worries. Keyword args are a fairly important feature of Python, I'm surprised you haven't encountered them before. But maybe you have, and just didn't realise that they can be given in any order, as long as they're after any positional args.
DSM
DSM
20:29
These days we even have keyword-only arguments, which I've become fond of.
keyword args FTW
I wonder if they'll ever make the positional-only argument syntax a thing outside of documentation.
I am starting to use keyword arguments for any function calls with more than one arg.
I'm surprised that we didn't have them sooner. Sometimes, there isn't a sensible default value to give an old-style keyword arg.
I was going to say there's no positional only args, but then remembered that a lot of the built-ins have them since they're C functions.
20:34
@PM2Ring: The syntax you're thinking of never had anything to do with keyword arguments anyway; whether a parameter has a default isn't connected to whether you can (or must) pass it by keyword.
It was a trick question at PyCon 2016's trivia dinner.
I thought I knew what y'all were talking about, but now I'm lost. Re named, vs args, kwargs, vs positional, etc
I can't remember which ones off the top of my head, but there are a few where the documented name didn't match the actual name.
Wait, "actual name" as in a built-in accepts a parameter by keyword, but by a different keyword than the name in the docs?
20:38
Yeah
I wish I remembered what the exact question was.
Sounds like the kind of thing that might happen if someone forgot a / when converting old code to Argument Clinic.
@user2357112 Ok. Please enlighten me. How do you create an old-style keyword parameter without giving it a default value?
Of course you can have keyword args that don't appear in the function signature by using a **kwargs arg. But apart from that. :)
@PM2Ring afaik, any param name can be used as a keyword argument regardless if it has a default value
@PM2Ring repl.it/Niu7/0
@Code-Apprentice Ah, of course :oops:
and the apprentice becomes the master
20:45
:) Please excuse my brain fart.
you are excused
=p
The fact that you're still calling yourself an apprentice at 36k rep is quite depressing for some of us lower-rep plebs :p
@Rawing Indeed.
OTOH, with the old-style, (AFAIK) there's no way to force an arg to be a keyword arg without giving it a default. That must be why I was temporarily confused. :)
Although you demonstrated exactly what I'd been doing, without the vocab to express it.
20:49
@Rawing Bear in mind that there are people with 100k+ who ask really dumb questions. But they got those points in the Good Old Days, and all from asking questions.
@PM2Ring I don't understand. Even with a default, you can still pass a value as a positional arg.
Of course, if several args have default values and you only want to specify some of them, then you may be required to use keyword args, depending on the order of the args you want to use default values.
and that wording is much more convoluted than if I just wrote a code example...
@PM2Ring: With the old style, there was no way to force an argument to be a keyword argument at all, unless you count manual **kwargs parsing.
@user2357112 Just ignore me. I clearly need coffee. :)
Now I'm confused, too. I thought old-style referred to when unnamed varargs like def foo(*, bar=3) weren't supported, but back then you could still make keyword-only arguments simply by naming the parameter: def foo(*ignored, bar=3)
@Rawing Hey yeah! I'm not as confused as I thought I was. ;) You have to use a keyword there, since you don't know how many args there are in *ignored.
21:02
There was no Python version where def foo(*ignored, bar=3) was supported and def foo(*, bar=3) wasn't.
Keyword-only arguments and the bare * are from the same PEP, implemented in 3.0.
Huh, I didn't know that. I guess I only learned about the unnamed form later.
Back in 2.x, def foo(*ignored, bar=3) was a syntax error.
@user2357112 You're right. I must be remembering some alternate universe... :goes back to drawing circles:
OK, I have a network programming newbie question: is the methodology of handing client/server connections different from p2p? They're both going to use sockets in (essentially) the same manner, right?
I'm not sure I understand the question, but I think the only difference is that you're going to have multiple open socket connections in a p2p program, whereas in a server/client program you'll likely only have a single connection
21:13
Yeah, that's what I was asking.
I'm trying to learn sockets right now. It's.... not going well.
sockets are pretty difficult to use right. I think most code you find online will have a severe case of "it usually works in the real world, but according to the spec this is broken beyond belief"
nobody ever checks if socket.send actually sent everything, for example
That sounds like a rather large problem.....
Luckily socket.sendall is a thing that exists. Just make sure to exercise some caution when you copy socket code from the web
Some more circles, this time with stereographic projection, using C code I wrote quite a while ago...
Pretty
21:30
Thanks, @JGrindal :looks at source code: Ah, I originally wrote it in ARexx at some unrecorded date, but I converted it to C in 1994. :)
1994 was the year I wrote my first program.
It was in BASIC
I also started in BASIC. I think it was 1971. Or maybe 1970.
I hadn't started doing anything at that point
And I was born about 20 years after that
22:13
@MooingRawr Yamming. Awesome.
23:03
@PM2Ring nice figures! And +1 for tripping MooingRawr's trypophobia (needs more worms though ;)
@AndrasDeak Hey, I don't want to trigger my own trypophobia. :)
23:18
I learnt basic when it was obsolete.
My current version is much more efficient than it was a day ago. I haven't changed the algorithm that finds the location & size for the next circle, but it's a lot faster and uses a lot less RAM. Instead of doing everything in one array, I now have a simple 2D array for detecting empty locations, and do the final rendering of each coloured circle into a separate 3D array.
The previous versions just did everything in one large 3D array, which I scaled down after every circle to display it with PIL + Tkinter.
Do we have any Django experts around? This question looks interesting and possibly Django-related.
On the surface, it looks like Yet Another Dynamic Variable Names Question, but the fact that it's in a class statement changes things, especially if a metaclass is involved.
@Simon The upside of learning obsolete languages is that they don't go changing on you. Unlike, say, Javascript. I've hardly looked at JS in the last 2 or 3 years, so I bet lots of what I used to know is now obsolete. OTOH, I never got into using stuff like jquery or Node.
Good afternoon people.
Can somebody help me with the next doubt please... I'm using Python in windows to get a variable of the environment...
I created the variable "INF_GEST" and assign something like "201302"
@PM2Ring Old JavaScript still works. It's just not recommended that you use it.
23:24
I can update that environment variable from python but when I try to consult that variable Python doesn't update it properly... I get the old data.
I'm consulting with :
os.environ['INF_GEST']
I even close python and open another session and this is still happenin
hapenning*
@VictorMartinez That definitely won't work.
A child process inherits a copy of the parent process's environment. Any changes that the child makes cannot affect the parent's environment.
@PM2Ring Thank you, I get it.
No worries. You could just use a normal file to store that data.
Yeah, I thought about that. But...
I understand your answer... But I don't understand why it works with Visual Basic.
It's strange for me.
Visual Basic is very different from Python.
23:34
All right, I will use a file, is easier.
Thanks!
Lets say I set Pool(200) and there are 200 hundred links that I have to requests.get, I do a pool.spawn(func, arg). Now I change Pool(1000) and re execute. Another case if Pool(100) then which would end up executing faster(100) or (200) or (1000)? From what I have been reading about gevent, 100 would be the slowest and the others would be the same right?
00:00 - 17:0017:00 - 00:00

« first day (2575 days earlier)      last day (2598 days later) »