« first day (2723 days earlier)      last day (2240 days later) » 

12:10 AM
https://stackoverflow.com/questions/7044044/an-efficient-way-of-making-a-large-random-bytearray

Wow this helped me so much actually. My library was only outputting about 9-10 MB/s, so I was wondering if there was any faster way. I tried the AES answer, and now I get 450 MB/s
 
12:44 AM
What problem are you doing where you can install that crypto module but can't install numpy?
 
 
4 hours later…
4:28 AM
Hello?
 
 
2 hours later…
6:24 AM
class A():
def func(self):
return 20

def func2(self):
return self.func()
why self.func() required, and it is not possible to directly call, it gives error func not defined
 
Are you asking why as in “what is the rule?” or why as in “why did Python choose this rule?”
For the first one, it’s pretty easy: simple lookups are always local, enclosing, global, or built in; never attributes. You always have to use self to reference any attribute of self, whether a method or a regular value.
 
i mean in c++ there is not need to do that
so its a rule/python way of doing things
no*
 
For the second one, it’s in the Python FAQ, and Guido’s Python History blog; search for them and they explain it nicely. (Although I don’t think Guido mentions Smalltalk there’s which was an obvious influence.)
C++ is a different language in a lot of ways. It’s a deliberate choice in language design, and there are advantages and disadvantages of both. If every language were exactly like C++, there would be no need for any languages besides C++.
 
yea you are right
i just wanna know if it is a python way of calling or i am just missing
and i am sorry i always rant about c++ :(
 
Ysah, that’s the Python rule. You always need to include self as an argument, and to use it to access attributes.
 
6:40 AM
idk I feel easy to learn as comparing
thank you very much kind sir
 
And really, you should look into the advantages and disadvantages of the two instead of just trusting me. :)
 
 
3 hours later…
9:25 AM
@redfelix hello
@kanishktanwar please read sopython.com/wiki/… and practice in the sandbox
 
 
3 hours later…
12:37 PM
>>> pathlib.PureWindowsPath('C:', 'meshes', 'as')
PureWindowsPath('C:meshes/as')
Is 'C:meshes/as a valid path in Windows? There is no backslash after the colon
 
Hmm, I'm not 100% if a colon is a valid character in Windows paths. If yes, then it's a valid relative path.
 
DSM
Yeah. If you.. aargh, beaten. Relative to current is assumed if you don't have anything after the drive.
 
Oh, ok
That feels weird
Ignore me :D
 
That is weird ._.
Does that make any sense? If so, I don't get it
 
DSM
Oh, wait, maybe I misread AF's comment. C:meshes/as is like (current-working-directory-on-drive-c)/meshes/as.
It's not interpreting the colon as part of the name, it's interpreting the lack of a slash as meaning you want a drive-relative path.
 
12:47 PM
I didn't know such a thing even existed. Brb, trying it out on my Windows PC
 
DSM
> If a file name begins with only a disk designator but not the backslash after the colon, it is interpreted as a relative path to the current directory on the drive with the specified letter. Note that the current directory may or may not be the root directory depending on what it was set to during the most recent "change directory" operation on that disk. Examples of this format are as follows:

"C:tmp.txt" refers to a file named "tmp.txt" in the current directory on drive C.
"C:tempdir\tmp.txt" refers to a file in a subdirectory to the current directory on drive C.
 
I can't make it work, all I get are error messages
What does "the current directory on drive C" even mean? If I'm at D:\foo\bar, is my current directory on drive C C:\foo\bar?
 
@DSM that clears it up, thanks. What I expected to get was C:/meshes/as, but that behaviour makes sense now, I guess
I hope pathlib is consistent with os.path, and os.path.join('C:', 'meshes', 'as') returns the same path on Windows
 
DSM
@Aran-Fey: depends on what you did last on that drive, I think.
 
Oooh, that would make sense. Sort of.
 
DSM
12:56 PM
Just imagine cwd as a dictionary with drive names as keys instead of as a single value, and chdir ops modify that dictionary. If you don't specify a drive, your current one is assumed.
 
Huh, vaultah's slightly changed avatar tripped me up :)
 
DSM
Has anyone taken advantage of QuackOverflow yet?
 
it quacked at me.
 
My experience with QuackOverflow has been thus: "Do you have a microphone?" *clicks "No"* "The duck is listening... could you speak up?"
 
Hm? When you click No, it should say
> With the magic of the internet,
you can just explain your problem anyway!
Speak naturally.
 
1:03 PM
IIRC it did say something along those lines, but afterwards it started listening anyway.
 
"listening"
but yeah
It's just a rubber duck anyway
 
@vaultah tested it, and yes, they generate the same relative path
 
DSM
I guess it's that time of year.
 
Yeah, it's Easter :P
Shower thought: why is there only Easter and no Wester?
 
In Hungarian it's called [Meat take]
 
2:01 PM
cbg folks
 
 
2 hours later…
wim
4:00 PM
@DSM Yes, I learned all about duck typing with QuackOverflow..
 
Cbg all!
Quick question: is requests worth learning even though I know (reasonably well) urllib
 
There isn't much to learn, so I'd say yes
 
@Simon do you like things to be simple? :p
 
Yes in general :)
Does it have features that urllib does not have? Or does it just make a programmers life simpler
 
Well, technically you can do everything in urllib that you can do in requests... you just don't have to write a shed load of boiler plate and do a lot of things manually...
 
4:10 PM
We can use sockets as well :p
 
So... stuff like: requests.get('https://example.com', json={'key': 'value'}).json() automatically sets the content type for you, and json.loads the result...
 
It sounds like it's worth an evening learning.
 
Plus requests.Session is great for repeated requests and maintaining cookies etc...
 
wim
Not sure how you can spend an evening learning requests. Unless you mean to import requests; requests.get(myurl) and then spend the rest of the evening drinking beer.
 
I can do it!
 
wim
4:17 PM
All the heavy lifting is done by urllib3, so if you're actually interested in the transport you should be learning that.
 
Uploading is a bit tougher than downloading though... form data, files, multipart uploads....
 
not massively more difficult though....
 
@Aran-Fey Wow
 
wim
Anyone got a user script to share which make the starboard scrollable?
 
think it only ever displays N many anyway?
 
wim
4:26 PM
Yes but on small screens you see < N
for example on macbook 12" I only see two items (!)
 
Umm... probably just need something simple like setting an overflow-y to it?
 
on my PC It only displays exactly as many starred messages as it can fit on the screen
 
4:44 PM
I wonder how many OPs post unformatted code just because SO won't let them submit the question otherwise...
 
5:01 PM
@vaultah done
 
Thanks
There are still so many non-closed duplicates of that post lying around
 
5:28 PM
hey u all
anyone know best source for learning math ,that can help me progress in machine learning
 
Hmm, it's quite refreshing to be out of close votes. Means less time spent on google for me.
 
I plan on closing this popular question as a duplicate of this less popular question. Any objections?
The latter seems to have better answers
 
5:45 PM
Uh, why not close it as a dupe of the "least astonishment" thingy?
Those two questions are about completely different problems, aren't they
 
Uhh yeah. Hold on, must be a wrong link
 
Anyone tried the Quack Overflow yet?
 
@Simon yeah
bad stuff
 
I told the duck to go away, but it didn't listen
 
wondering where is PM2Ring
 
5:53 PM
well... actually... it did listen, even though I told it not to
 
@Aran-Fey lol, sorry. I read the title, the top answer, and skimmed the rest of the answers
 
Reading the question itself is important, too :p
Surprisingly enough, sometimes there's valuable information to be found in there, though not always...
 
I know... :C
Closing the first question as a duplicate of "least astonishment" sounds good to me
Done
 
6:10 PM
How does one access a column in a DataFrame when passing the DF into another function? e.g. why is var_name not an 'attribute' of the DF in DF[DF.var_name]?
 
Why would it be? Do you have a "var_name" column in that dataframe?
 
DSM
Does it contains spaces or other non-valid-identifier characters?
 
when I create the DF I can access the columns in that way, but if I pass the DF into another function it stops working and returns an attribute error
 
What is var_name? Is it actually a variable you created?
 
6:13 PM
@DSM no
@vaultah it's a column name
 
I feel like we should probably just ask for a MCVE
[mcve] :(
 
Oh easy
one sec
 
DSM
I suspect you're getting confused between an attribute called var_name and an attribute with the name bound to the name var_name, in which case you can just use the bracket syntax instead.
 
6:16 PM
`def read_spss(sav_file):
with SavReader(sav_file) as reader:
column_names = [name.decode('ascii') for name in reader.header]
data = reader.all()
df = DataFrame(data, columns=column_names)
print(df[df.outcome == 1.0]) # WORKS
return df

def choose_selection_var(data_frame, var_name, var_value):
return data_frame[data_frame.var_name == var_value]`
 
DSM
What do I win?
 
well you already have my respect :)
I am confused about how the attribute works in that second func. I understand the error intuitively but don't understand how to do what I'm trying to do.
 
@DSM second prize
 
DSM
@vaultah: I'll take it!
 
If respect is a second prize, I wonder what the first prize is!
 
DSM
6:21 PM
@AutomaticStatic: when you use the dot/attribute notation, like data_frame.var_name, you're asking the frame to give you an attribute with the name v-a-r-underscore-n-a-m-e. And there isn't one. Just use data_frame[var_name] instead, which sends your var_name string to data_frame's __getitem__.
See here for the difference.
 
right but I'm trying to produce a new frame containing only rows with columns of a certain value. Something like df['outcome'] == 1.0 is a boolean operation.
 
DSM
Yeah, I get that.
In [18]: var_name = "A"; df[df[var_name] == 2]
Out[18]:
   A
1  2
 
a ha
thank you sir
 
6:55 PM
> I have searched all other questions and this question has not been answered. So, please do not flag as a duplicate.
I wonder if there's a theorem somewhere
the relationship between saying "there is no duplicate" and the likelihood of there being one
 
wasn't there a userscript that enabled [mcve] in chat?
Looks like a no. I guess it's up to me then...
 
Herro
 
o/ hello
 
7:14 PM
How goes? :)
 
Well, I just learned that I have to implement something in javascript, so... my day is proceeding suboptimally :P
 
That's cool :D
I'm just studying for my networking class.
Fiddling with Python scripts too.
And a C# project. I guess I have a pretty busy day XD
JavaScript can be a bit fun. I prefer jQuery; although, it is a JavaScript framework.
whatcha working on?
 
wanna make a userscript that turns [mcve] into mcve
 
7:33 PM
cbg
 
Hahahaha, someone made a bot in the sandbox that responds to "test" with "You passed!"
 
I really can't stand it when questions get down-voted with no comment :( Trying to learn my way around some stats in Python.
 
Hey, I think I saw your question. Was it the PCA one?
 
Was that your downvote?
 
not yet :P
 
7:37 PM
You want to turn a square bracketed term into a hyperlinked term?
 
@AndrasDeak oh great
 
What's the link to the question?
 
Your question was pretty vague and open-ended, so I could understand a downvote...
@Sometowngeek you can find it in their profile, it's new
 
@Sometowngeek yes. I can only imagine that this is a near-impossible task with javascript.
 
Gotcha.
Ok... one at a time.
 
7:39 PM
@AndrasDeak I genuinely don't see how it's vague.
If people feel like "don't ask about NumPy help if you don't know lin alg" then idk what to say about that.
 
> I am trying to do a PCA in Python [without sklearn.decomposition.PCA for a good reason]

Is it possible to do that without dropping down into NumPy-- if not with sklearn then some other higher level package? If not, how would one do it in NumPy? I've gotten as far as creating a DF containing feature values that have been standardized using sklearn's StandardScaler().fit_transform() method.
 
I'm just trying to find a simple path to what I thought was a common approach in PCA and was surprised it wasn't built into sklearn.
 
@Aran-Fey I think it's possible. I'm trying to remember how... I used jQuery for something like this sometime ago.
 
Well, I can't speak for others, but if I wanted to do PCA I'd try understanding its basics. Which I guess is linear algebra :)
 
I'm trying to script a task I ordinarily do in SPSS
 
7:41 PM
have you searched PCA numpy posts on Stack Overflow (pro-tip: search using an external search engine and append "site:stackoverflow.com")?
or rather, PCA python in general, that should give you relevant results
 
almost the PCA Python stuff uses the sklearn methods that don't suit my task
 
"almost", eh? :P
 
@Aran-Fey is it possible to combine .html(prependOnePart + thisNewFormattedThingamajig + lastlyAppendThis);?
Oops... XD
 
@AndrasDeak I'm stuck between all the data sciency blogs using sklearn and a bunch of numpy lin alg that looks like greek to me.
 
I could only help with the numpy linalg version... my vague impression is that it should be very easy using singular value decomposition, but I don't do PCA
 
7:44 PM
@Sometowngeek I have no idea.
 
frankly, I briefly considered tackling your question but 1. I was on mobile, and 2. I'd even have to come up with test input myself and risk you saying "well, my input isn't exactly like that". Which might also explain a downvote
 
@Aran-Fey Is it somewhere on the webpage in a paragraph, or in an input box?
 
the only thing I see that remotely resembles what I'm looking for is np.linalg.eig but frankly I don't know how to use it here. Maybe I should just hire somebody...
 
@Sometowngeek It's this input box down here vvvvvvvvvvv
 
@Aran-Fey ...... Okay... I'm confused.
@Aran-Fey It's already implemented here. Are you trying to implement this elsewhere?
 
7:48 PM
it's not implemented here
[mcve]
 
@AutomaticStatic OK, that is along what I have in mind. I have to go cook for a bit, but I'll try to take a look later. In the mean time I strongly suggest that you come up with some simple input data for a vague idea of what your data is like...otherwise it's all guesswork. Nothing major, just some pseudorandom stuff with an appropriate shape (noisy correlated things, for instance)
 
[DoThis](www.google.com)
oh...
Lame.
 
@AndrasDeak thanks.
 
7:49 PM
(for the record asking for answers to new questions here is against the rules, but you haven't asked, and I'm volunteering because I found it interesting earlier ;)
 
Yep... it works.
 
@Sometowngeek please use the sandbox for testing
 
Where's the sandbox? O.O
 
Found it
Thank you :)
Ignore the pickles link in there. It's my silly default link for testing something
 
8:08 PM
@AndrasDeak is this a more suitable edited question stackoverflow.com/questions/49591549/…
 
Definitely. I'm in the middle of writing a comment ;)
 
8:21 PM
@Ffisegydd you Anglo-Americans... there's always been a sauna party in PyCon Finland
 
@AndrasDeak not sure if my reply makes sense.
Specifically, I don't know if "doing an extraction based on eigenvalues greater than 1" is the same as "produce a component matrix where components with eigenvalues <=1 are removed"
 
the problem is that I don't speak PCA and you don't speak linear algebra :/
 
wait, I don't want to generate noise for the room, let me start a new one for your question
 
typically, like with sklearn, you ask for a fixed number of components. Alternatively, you can produce a component matrix with any number of components that have eigenvalues greater than 1.
OK.
 
8:42 PM
Does this sound correct?
context: *one failing an exam*
"Surely, it must be the will of the gods, " \
"punishing you for your past sins. "
 
 
1 hour later…
9:45 PM
Hello, how I can create an user defined protocol using Twisted framework over UDP, by manipulating values of the bytes from datagram?
 
10:32 PM
It's finally done
 
mcve?
 
hold on.. I need to disable it for a sec...
 
Behold my userscript that enables [mcve] in chat
7
^ everyone star it
 
hehe
 
10:35 PM
cbg
 
cbg
 
@cᴏʟᴅsᴘᴇᴇᴅ You have to, like, install it
 
PSA: please test the userscript somewhere else
 
oh, and also refresh the page
Is it the tampermonkey incompatibility again?
 
10:36 PM
No, this time it actually saved
The update URL is chat.stackoverflow.com, is that right?
 
update url?
 
Eugh, I can't believe how easy it is to become a help vampire when you don't know how to do something
 
asking doesn't automatically make you a help vampire, nor does being clueless
 
Should add it there ^^
 
So, Tampermonkey has an update URL, I assume that's the URL you'd need to enter if you want the script to work
@AndrasDeak Not sure if that was your intent, but I feel a bit better now, thanks
 
10:39 PM
I guess I should install a browser with tampermonkey
 
@cᴏʟᴅsᴘᴇᴇᴅ just stating a fact :P
 
@vaultah Can I edit that page? It's not in community mode
 
tampermonkey is a dingus dongus
 
@Aran-Fey I thought we've already added you to the editor group
Fixed now
 
Thanks, I edited it in
@cᴏʟᴅsᴘᴇᴇᴅ it works with Tampermonkey in chromium :/
 
10:53 PM
out of the box? No changes at all?
 
yep, straight copy/paste
 
guess it's a Safari thing then
 
googling "install safari on arch linux" gives me a full page of "how to install arch linux" results. Good job, duckduckgo.
 
it detected your OS (other than Arch)
 
technically I'm running Manjaro. Whether or not that counts as Arch is debatable
Guess the debugging will have to wait until tomorrow. I'll boot into Windows then and install Safari there
 
11:02 PM
Wait, does it replace while you're typing, or after you post?
 
when you click "send" or press enter (without holding down shift)
Looking at the other user scripts reveals that I don't have to be ashamed of my JS skills. First one I looked at registers a function to run every second instead of using a MutationObserver
 
11:26 PM
You might get more oohs and aahs in the JS room
 
lol, I doubt that. I asked them for help with the script. They didn't seem particularly impressed.
 
wim
does the share script work for anyone else?
doesn't do anything here
 
"last active 3 years ago", isn't that like 3 epochs in JS time?
 
I think I may have spotted the problem...
    //the share box doesn't exist yet,
    //so we'll sleep for a fraction of a second,
    //so the button's _real_ callback gets a chance to make the box.
    setTimeout(enhance_box, 10);
 
wim
check the easter egg on maps.google.com if you haven't already
 
11:34 PM
it's http vs https
I edited that in my greasemonkey and it works now
cc @Kevin ^
 
wim
yep that was it, thx deak
kinda hokey the way it adds a second text widget instead of just replacing in the old one
 

« first day (2723 days earlier)      last day (2240 days later) »