« first day (3417 days earlier)      last day (1532 days later) » 

12:17 AM
Pretty cool read (imo) on how to think about the AI superintelligence future possibility. link Fairly long though.
 
 
2 hours later…
2:00 AM
ohhh how I hate having to constantly elevate user permissions to use docker :(. Though if I would start pycharm with elevated permissions it screws up even more when I return later without sudo. :/
 
 
2 hours later…
4:12 AM
@AndrasDeak I don't understand your comment. That question was quite simply someone asking for the regex syntax for matching either of two strings. The OP tried "nt"|"nv" instead of "nt|nv" and wondered why it errored with TypeError: unsupported operand type(s) for |: 'str' and 'str'. That's all. It wasn't even pandas-specific.
 
 
3 hours later…
7:00 AM
hello
 
hi
 
how are you doing
 
tired, but otherwise good
 
that's good
 
7:19 AM
update: I visited reddit and my mood is no longer good. Time to wake up and get some work done
 
7:34 AM
heh.. so maybe stay away from reddit in the morning.
 
user10984358
8:19 AM
python subreddit or reddit in general?
 
r/learnpython
 
user10984358
r/learnpython may or mayn't be the best place to learn python, but some posts there are really good for ideas
 
user10984358
I once saw an auto solver for a a block game, the one where you from words by dragging your finger
 
user10984358
they implemented BFS, then Tessreact OCR and someway of touching the mobile all done with python
 
you sure that was r/learnpython and not r/python?
I have a hard time believing anyone on that sub could write anything that works
 
user10984358
8:24 AM
I guess you are right, been searching that post to link here in case anyone with interest would see, so far I haven't stumbled upon it
 
user10984358
yup its r/python
 
If a social media tracker is blocked on a site that is different from the social media site itself, was it due to the cookies on my browser, or was the site itself allowing a tracker to track me?
because dear SO, i won't be very happy with this if it's the latter.
 
8:40 AM
you don't have adblock?
 
I do, i dont think adblock catches all trackers though, this one was caught by firefox itself
I use adblock plus personally
 
Hmm, I can't repro even with adblock disabled. No clue how that could happen
 
yours is adblock plus as well, or some other adblock?
also, fwiw, i don't usually get that notification, first time seeing it really
 
I use uBlock Origin
 
cool, i'll keep that name stored somewhere
 
9:09 AM
be informed that could happen due to other trackers associated with other tabs.

let me explain it :

for example that you open www.site1.com while it's actually analyzing your cookies to detect all other active session with other sites while you open in the other tab www.site2.com ..
hijack way using javascript.
16
Q: Accessing the content of other tabs in browser

vamyipI am using Mozilla Firefox and I am trying to figure out a way to access the content of other tabs in the same window using JavaScript and DOM (I am open to other techniques if exist). E.g. I want to run a JavaScript in tab1 which can find the title of some other tab. Basically I need this so t...

forgot to mention that the hijack will be in legal way nowadays if you accepted the cookies TOS of the site you are streaming, which will automatically run it's own tool to get the other tabs associated within your active session. that's why you get the notification while you streaming SO for example.
 
9:47 AM
hmm
so it's not the browser that just easily gives one tab info on the other.. it's a tracking site or network of tracking sites that know which tab browsed in or out of the network
 
10:14 AM
recbg
 
10:36 AM
@Todd aye, browsers generally have no real incentive to let other parties easily track you, chrome might be the only exception there.
Would still highly recommend firefox though if you're concerned about these kind of things.
 
11:30 AM
@ParitoshSingh SO is known to allow tracking you meta.stackoverflow.com/questions/384864/…
There's another where they allowed a MS ad to fingerprint users, but I can't find it now
 
Oh. Thanks for the link. That's, disappointing i suppose
What im wondering is, why it never cropped up for me till now
 
You never click on the purple shield, perhaps? :P
And graph.fb.com seems non-trivial. But I have all fb.com/net blocked in noscript
 
hah :P that would be one interpretation of cropped up
Ah, i do have a javascript blocker as well, but i only use it when i need to
 
11:47 AM
@smci I'm asking "Are there other questions with good google juice that answer »How to use str.contains() with multiple expressions, in pandas dataframes?«?". Mere typos don't get that many votes over the course of years. The question is "I want to solve <thing>, I tried <almost working solution>", the answer is "Here's your fixed solution". The fact that the missing bit was a typo may be a red herring.
 
Yes
 
good shout with the red herring part, i wouldn't have looked at the original question that way though till you pointed it out
 
Hence
yesterday, by Andras Deak
@smci as much as I hate to consider this option: are there other questions explaining the problem in the question title? If yes, I'll gladly close that one
 
 
3 hours later…
3:03 PM
Am I allowed to ask questions on here?
 
@Govind75 hello. Please read our rules page, you can with the conditions written there :)
 
Bold of you to ask if it's allowed to ask
 
Just realised thats not allowed
But my question is
Tkinter in a while true loop, is it possible
 
Did you just conclude that you should not ask, then ask anyway about your question from yesterday?
 
Thats not my question from yesterday
I concluded that saying "am I allowed to ask..." is not allowed.
 
3:07 PM
I was just kidding :/
 
How far did you get along the page I first linked?
 
Maybe I misinterpreted it
 
> Don't ask for answers to your recent Stack Overflow questions. Those who can answer are already watching the queue on the main site.
your question I linked seem to have the same problem: while loop vs tkinter. The top commenter tells you that those don't play nicely together. And your question's code has non-existent indentation and missing code.
 
Seeing how these "auxiliary loop blocks main loop" problems crop up regularly – are there any async GUI frameworks for Python?
 
3:26 PM
Matplotlib and other plotting libraries can have interactive windows with widgets. Though those might just be using threads
 
cbg All,
I'm looking for some advice. Hope someone can help:
Can sockets be used to transfer files(exe) and execute them remotely?
I cannot use ssh(paramiko) because its restricted in my env
 
3:42 PM
Sockets transfer data. Files are data. So yes.
 
@Aran-Fey not so sure about "execute them" unless the receiving side runs it on its own, right?
 
Well, yeah, of course
 
@Aran-Fey, @AndrasDeak, thanks for the pointers. While I'd like the control of the exe on the client side(thus executing from the client), but to simplify for now, lets assume its run by the server(receiving end)..now I want stdout from exe sent back to client, is that possible..I really think that's possible
 
if you could just connect to an arbitrary port and tell it to please write some data to disk and run it once it's complete, that would be............... slightly problematic
Yes, you can capture the output of the exe and send it back. No problem at all
Just to make sure, but you're writing both the server software and the client software, right?
 
@Aran-Fey, yes, I'm writing both server and client
 
3:53 PM
ok, good. I was getting suspicious because so far none of this is difficult at all
 
sometimes there would be a menu based exe app that would require the client side user to control menu option selection, so not sure how to execute the exe from the client side
that's the hard part I'm trying to figure..everything else I've got figured
 
I don't understand. Executing an exe is easy. If the exe is on the wrong computer, you transfer it first. What's the problem?
 
I mean, the client successfully transferrred the exe to server, now I'm trying to figure how the client also runs the exe on the server side? I can make it run by the socket on the server but I would like it to be run by the client, so the file handle is on the client socket side
 
By the way, you're aware that executing an exe file that someone sent you is risky, right? If you don't take precautions, this is like inviting viruses
I don't get it. First you say you want to run it on the server and then you say you want to run it on the client. Which is it?
 
this is a fully secure enterprise environment with firewalls etc. in place..In fact, its so secure, they've restricted opening ports, ssh etc. The apps(exe) are also developed by our team and fully tested and secure
I want to run it on the server end but through the client, i.e. the file handle is on the client side..it comes back to the original question: remotely execute stuff with sockets
I am working on a sort of a minimal RDP project..I'd like to develop the software with Python
 
4:08 PM
That... doesn't make a whole lot of sense. The server can't access a file handle from the client. You can send the file to the server, but a file handle is something that's local to one PC
 
Hey! I was just reading through the https://docs.python-guide.org/writing/structure/ because happy-sunday, amirite?? and in the end there's some suggestions to mutable and immutable types and how to use them. There's this example,
```
foobar = foo + bar # This is good
foo += 'ooo' # This is bad, instead you should do:
foo = ''.join([foo, 'ooo'])
```
and, while I get that `foo = ''.join([foo, 'ooo'])` is way more explicit than `foo += 'ooo'`... it just looks absolutely insane imo..

So my question is.. should I just accept that "this is nicer!" and "succumb to the olden standards" or.. doe
 
If the server needs a file from the client, just send it to the server before you run the program
 
@Aran-Fey, sorry, I just read my comment above and you are right..the file handle will belong to the server and local to the PC
I think what exactly I'm looking for is to send args from client side to the exe..that is possible..now its clear in my head
 
@DrLime2k10 ''.join([foo, 'ooo']) is in no way better than foo += 'ooo', that's complete BS. What they're probably trying to say is that you shouldn't concatenate multiple strings, i.e. for n in range(999): result += str(n) is a bad idea. But if it's just two strings, it doesn't matter
 
the args can be sent from client socket to server socket, then to the app. The app should accept stdin from server socket
 
4:12 PM
The reason is that adding two strings creates a new string, which means both strings have to be copied. If you concatenate multiple times in a row, you're copying the same text over and over again. So in that case ''.join(all_of_the_strings) is better.
 
@Aran-Fey thanks! .. I understood that much.... and thought.... it looked like complete BS, thanks! :D
 
@amanb yep, that sounds about right
 
thank you very much @Aran-Fey
 
user10984358
5:09 PM
Is there a python library that lets you add a line to a file on a remote server? without sockets and paramiko?
 
user10984358
I was suggested rsync here, I have stopped my progress on that, reading about what was asked earlier brought this issue back to my mind
 
I tried to use paramiko in a python web app, to connect via ssh however, downloading private key with label of desired user. despite this, I get logged in as a different user (am using google cloud os login). I can su easily on the terminal app ssh prompt, but am unable to do this on paramiko. (sudo su is passwordless, with no error on exec_command)
 
user12289803
0
Q: Django Update the record with additional date that the user inputted

Mary Rose Villaganas OrculloI hope the title is enough to understand what my problem is, this views.py is showing the table {% for v in table.0 %} <th id="thupdate">{{ v }}</th> {% endfor %} <th hidden></th> <th data-id='headerss' id='headerave'>Average</th> </tr> <tbody> {% ...

 
wondering is it possible to run sudo on paramiko?
@TheNamesAlc paramiko works, then simply can use cat with >
 
user10984358
1 month and no one even answered? I dont know Django but usually questions with big code snippets dont tend to get much attention, at least from what I have seen
 
user10984358
5:15 PM
@PranavKasetti what if its windows? should I check the os and then do a corresponding command?
 
well windows has an equivalent to cat called type
echo bye > b.txt
or type c.txt
 
user10984358
once I start that work again I will try to do what you suggested, thanks
 
@MaryRoseVillaganasOrcullo i think u cld try to create more minimal example, with more explanation. also, explain what u tried.
 
@amanb What you want to do very, very likely exists already. There is little chance that you will come up with something proper yourself if you're not aware of the capabilities of sockets (as your questions imply).
Are you running on Linux/Unix? If so, take a look at the X Server specification.
You can use it to have a remote application forward the GUI to your machine.
 
@MisterMiyagi Yes. Would also need a special "Enable X11 forwarding" flag to allow graphical windows to be displayed on your screen (depends on your client/operating system).
oops, just realised was a simple fix. can try the gcloud compute ssh instead of ssh.
 
user12289803
5:38 PM
@PranavKasetti please help me
 
@PranavKasetti Can you clarify what you mean by "am unable to do this on paramiko"? Do you get an error?
@TheNamesAlc Not unless there is something on the server giving you access. In that case, it depends on the remote side how you must talk to it.
 
user10984358
@MisterMiyagi I dont have access to my work laptop so I dont want to ask anything without the actual code in my hand, can I bother you with this tomorrow? if you are not busy that is
 
@MisterMiyagi my situation is the same as this question: stackoverflow.com/questions/44358423/…. there is no stderr output on sudo su, but when I cd to the other users home and do ls, the files are hidden. the shell gcloud compute api does work however, as mentioned in link, but not sure if its best practice to use subprocesses.
 
@TheNamesAlc Just ask to the channel directly. If someone can and wants to help, they will.
 
thanks for the help ;)
 
user10984358
5:52 PM
Sure. IIRC it was you who suggested me rsync anyways :)
 
@PranavKasetti Are you sure the environment is the same when logging in manually versus paramiko's exec_command? Usually, login shells differ from other shells.
In specific, not all of .bash_rc, .bash_profile and so on are sourced.
Can you su if you execute it as a non-login ssh command?
Also, do you run su or sudo via exec_command?
Judging by the Paramiko documentation, each exec_command has it's own remote environment. It effectively logs in, runs the command, and terminates.
Doing su in an exec_command does not change the user of future calls to exec_command.
 
@MisterMiyagi you are right, thanks a lot for your help. I will read the documentation.. ;)
was trying to rush.. I think I will try to run a script instead in this case.
 
You may want to consider using get_pty and invoke_shell. This should have the same semantics as manually logging in via ssh for an interactive session.
 
re:login vs interactive shell, I think it is an interactive shell, but will double check this too.
ok will do as you suggested, once I start the work again, thanks.
 
6:49 PM
@MisterMiyagi, I am doing this for only Windows for now
 
pytorch question:
I have tensor-batch (say: shape: (10, 10, 10)) and I want the minimum in each batch of all values that are not 0
selection = tensor[tensor != 0] results in a one dimensional tensor, but I still need them each separated into their individual pieces of the batch
The result needs to be a (10,1) tensor
 
@MisterMiyagi, can you suggest if something exists already?
 
@amanb Ah, in that case I cannot offer much advice beyond "try not to reinvent the wheel", and "it's infinitely easier to do if you don't need GUI support".
I'd probably pick a Remote Desktop system for Windows if you need GUIs, but don't know which is the standard.
 
Well, I've been tasked to roll up our own RDP rather than rely on something already available
 
@salbeira in each batch you might get a different amount of values, that's why it's 1d. Your result should be a 10-length list or a 10-length object array. I don't think you can do that with numpy and no loop. Maybe pytorch...that I'm not familiar with.
 
7:01 PM
@amanb Alright, just to put this into perspective: Can you clarify again whether you need GUI support or not?
 
Yes I do
 
My honest recommendation in that case is to check back with whoever made the decision to develop your own. Get confirmation that using an established, well-maintained third-party solution is ruled out.
 
@MisterMiyagi didn't you hear? It's super secure corporate. Python libraries were written by people! Much safer to have someone cobble together a poor replacement.
 
@amanb when dealing with idiots, one thing you can do is do it your way, then tell them what they want to hear.
When dealing with reasonable people however, you can make a case for why not reinventing the wheel is a good idea
Rather than just putting your head down and letting things be dictated, it's important to do your due diligence, and flag concerns as they come along. Often, people can be reasonable if you can show proof or at least show that you did your research
 
Aug 6 '19 at 9:56, by Paritosh Singh
apparently because "open source == virus"
I suspect the same logic here. Or a misunderstanding.
 
7:14 PM
@AndrasDeak yep, that was...*fun*. ;) But hey, they did let us work with python eventually, all i had to do was "proactively flag potential risks" using sonarqube or some similar tool.
So, in the end, It did end up getting to a working compromise no matter how unreasonable their initial stance was on the subject
 
Did you have to build in backdoors just so you could flag and fix them?
 
Haha. Fortunately no. Essentially, it was two big things going on apparently as i later found out
one of the folks from our own company in a different team had been bashing against python to further their .net agenda
 
@ParitoshSingh, I cannot agree more...there is a business case designed around this project and as @Andras Deak said they'd prefer something in-house as it would save money and will be secure, but it really makes me think if I'm indeed re-inventing the wheel..on the other hand, its a chance to learn something new and I'm happy to try other languages but Python feels at home
 
@AndrasDeak My urge to liberally apply sarcasm in these cases is hindered by the realisation that my own scientific domain has no qualms to re-invent the security wheel either.
And we're getting away with it so far. Again.
 
Surely plaintext passwords are fine for academics
 
7:18 PM
In my research, i found out about a website called cve vulnerabilities. That, with python's comparatively excellent track record, allowed me to reason against a ".net" push. And then i did an argument with a "for python" push, essentially relying on tensorflow and ML magic "needing" python to work. (i know that's not exactly true, since i also found out about tensorflow.js. but let's just say somehow that was strangely never mentioned in my final conclusions)
 
@AndrasDeak Of course not. That would be insecure. <adjusts monocle>
 
a 2 page word document with about 15 links to cve, tools like sonarqube, and blogs about python (and even the SO dev survey) later, we were in the clear!
 
When it comes to analysis, scripting, ML projects at least, everyone embraces Python and there is no competition
 
@ParitoshSingh tensorflow is C++ originally, is it not? With python as a wrapper?
 
No push back from any team in my company
 
7:19 PM
yeah
 
@AndrasDeak shhh!
 
on those sort of projects
 
@ParitoshSingh saynomore, saynomore
 
For what it's worth, i do feel like at least before i switched companies, i left enough of a "pro python" evidence that the team wouldn't have to fight that fight anymore with the higher ups
Frankly, it was all pretty okay in the end, all things considered.
@salbeira perhaps explore masks, I assume pytorch has something equivalent. Don't have the library handy though at the moment.
 
the inner tensor != 0 already creates a mask but because indexing something with a mask results in a 1-dimensional tensor and has not the ability to keep the masked values inside their batches (first dimension of the tensor) I am at a loss
 
7:25 PM
#For Example:
import numpy as np
arr = np.arange(16).reshape(-1, 2, 2)
print(arr)
mask_arr = np.ma.array(arr, mask=(arr==0))
temp = mask_arr.reshape(mask_arr.shape[0], -1)
out = temp.min(-1).reshape(-1, 1)
print(out)
 
@salbeira why is a 10-iteration loop a problem?
 
Primarily because my higher ups say "There is always a way to solve these problems with SIMD instructions and without loops in pytorch"
 
lol
good luck then
 
To be honest, not every code will have a trivial conversion to vectorized format.
sometimes, it won't even be worth it
both memory or performance wise. It really just depends
 
The desired result is not rectangular :|
 
7:29 PM
@salbeira I think that statement is provably false, TBH.
 
you could parse the output of arr.nonzero()...which would be a loop.
 
looks like pytorch has something called masked select. that might do the trick masking wise.
 
bincount the first result, np.split the second...whatever :P
 
8:03 PM
>>> N,M = 1000,1000
... arr = (np.random.rand(10, N, M) * 3).round().astype(int)
...
... def loopy(arr):
...     return [subarr[subarr != 0] for subarr in arr]
...
... def fancy(arr):
...     first,second,third = arr.nonzero()
...     split_inds = np.bincount(first).cumsum()[:-1]
...     splitted = (np.split(index_array, split_inds) for index_array in [first, second, third])
...     return [arr[inds] for inds in zip(*splitted)]
...
... print(all(np.array_equal(arr1, arr2) for arr1, arr2 in zip(loopy(arr), fancy(arr))))
@salbeira if you want to impress bosses who don't know better and waste performance, show them that ^
The fancy one also uses a loop, but it's much more numpy. All the SIMD!
 
@Tomerikoo problem is I'm trying to code golf and %d%% is 4 characters. — Doctor Reality 9 mins ago
 
Ack, could have sworn I'd VTC'd that. Sorry :/ thanks for closing :)
But yeah, the golfing blindsider kept the dialogue exciting. Subverting expectations is all the rage these days
 
8:31 PM
@AndrasDeak Hmm, I see your point about SEO, but I thought in the past you disagreed with me that external findability mattered. The question really was that simple misconception though. Anyway it currently has two close-votes.
 
Does DRF (Django) automatically cast dates in string formats for DateFields
 
@smci It has only one close vote at the moment. I've retracted mine after pondering Andras' point.
A dupe vote would be more appropriate, but I cannot cast one anymore.
 
@smci it depends: when a question might be a main target for people looking for a given problem findability matters; when it's the umpteenth dupe then it doesn't (at least to me).
If it's one in a dozen alternatives then I don't see much point in polishing the sediment. But if we remove a useful source of information that's different.
I guess I don't even think of findability, it's more about availability
@MisterMiyagi if you have one up your sleeve I can hammer it
then the content (signpost) is kept but the question is closed all the same
 
 
1 hour later…
9:58 PM
@AndrasDeak I see your point. But in this previous discussion you were suggesting accurate titling was only worth striving for for canonicals, even though their findability can be very bad, and that's before the recent impact of the SEO campaigns by low-quality answer sites. As to this one, I'll leave my close-vote, but I suppose it'll stay open...
...(Closing it wouldn't reduce its SEO at all, would it?)
 
Not sure, to be honest, I usually don't get closed posts in google. But my main concern is closed posts getting deleted, which is usually normal for non-dupes. Hence my questions.
 

« first day (3417 days earlier)      last day (1532 days later) »