« first day (3130 days earlier)      last day (1818 days later) » 

1:04 AM
cbg guys
 
1:21 AM
rbrb
 
 
2 hours later…
2:59 AM
>>> (10, 20, 30)[0:]
(10, 20, 30)
>>> (10, 20, 30)[1:]
(20, 30)
>>> (10, 20, 30)[2:]
(30,)
>>> (10, 20, 30)[3:]
()

Isn't that comma in (30,) a bug in the string representation of a singleton tuple?
can't understand how something so simple could slip through the cracks when it comes to core language features
Looks intentional: github.com/python/cpython/blob/… What's up with that ",)" part?
Ok... got it. It's because when a singleton tuple is written as a literal, it must have a trailing comma in order to not be confused with a parenthesized value... :-/ Kind of ugly that the reasoning carries over to the string representation when printed imo.
 
wim
3:16 AM
The unwritten rule is to maintain the invariant eval(repr(obj)) == obj when practical.
 
 
1 hour later…
4:23 AM
@wim "invariant"? Nani?! get your no good functionally-typed-lambda-calculus-Hindley-Milner Type Theory outta hear. This is Python. :P
 
5:05 AM
based on the doc "conda list env" and "conda --info envs" are the same but for me first one shows only the main env, while the second one works as expected and shows all envs
 
 
1 hour later…
6:17 AM
Is it okay to install Anaconda on top of Miniconda? I installed miniconda previously but I feel like installing Anaconda now
 
6:37 AM
Should this be duped to this? The solution is the same, but the mistakes the OPs made are slightly different
 
7:14 AM
Yes they are duplicates, because things are marked duplicate based on the underlying problem (for better or worse).
 
@Aran-Fey voted as dupe (slight different doesn't matter since answer is exactly same, so serves correctly as a sign post for the original Q)
 
*groan* I already cleaned up a Popen question today... I don't wanna have to do another
 
7:54 AM
Hi!
 
8:50 AM
@gtbono unaccepting an answer without even a comment is not very nice. You should help your answerer help you.
 
 
2 hours later…
10:58 AM
@AndrasDeak Uh - not sure what happened there. I swear it was schnitzel when I typed it...
 
"I got a Wiener schnitzel in** Hobart once"
 
Probably!
 
Andras got confused over " schnitzein Hobart " !
 
11:18 AM
Thank you, Captain
 
12:03 PM
hey
on ORM level , is it possible to define a variable and assign it to @app.route ?
example
x= something.com
@app.route('x/test' , methods = ['GET'])
 
12:26 PM
it's just a normal python string so as long as you don't expect changes to the variable update the route then sure, you can do that
@app.route(f'{x}/text')
 
12:45 PM
@ThiefMaster how about every user might have a different value for {x} so it might change per session , is that ok ?
 
Decorators are set during function definition
I suspect this decorator only gets set once
 
well my aim is to get it set differently based on the user in session so lets say i'm logged in and my x = something.com then @app.route(f'{x}/text') should be @app.route(f'something.com/text')
i'm trying to figure it on ORM level
 
1:12 PM
if it's dynamic you need a <placeholder>
routing is fully static, you cannot change the routing table during runtime, and it cannot use dynamic data (like querying the database)
 
1:31 PM
@ThiefMaster what do you mean by <placeholder> ?
could you give me an example ?
 
@ThiefMaster

if x = something.com
and current url = url.com
@app.route('<x>/test') would that redirect to something.com/test or url.com/something.com/test
 
1:54 PM
what you are trying to do doesn't work
please read the quickstart guide first :)
all the placeholders in the url do is passing whatever you have in the url for them to the underlying function
and when building the url with url_for you provide an explicit value for it..
however, if you just want to populate it without explicitly specifying it when calling url_for, maybe flask.pocoo.org/docs/1.0/patterns/urlprocessors helps
 
Sam
2:13 PM
stackoverflow.com/questions/21697645/… has a software tag in the output. does anybody know what that means
it says software - v01.19.5266
get-metadata.com can read that tag to a software name
 
im not sure what you're referring to
 
In the screenshot
 
Sam
if you submit an image on get-metadata.com you can see with what software it was created
 
Sam
i think its the same with the software tag in the screenshot
is there some kind of connection between that number and the name of the software
 
2:15 PM
Try googling the version number
 
how do i track down a builtin for its code, such as len?
for most other modules, you can just use __file__ , but i cant do the same for builtins
 
Sam
i dont know if this has anything to do with it but github.com/drewnoakes/metadata-extractor-images/blob/master/jpg/… has exact the same number
ill try running the code first lmao
 
ok
 
2:32 PM
@ParitoshSingh not exactly what you asked, but here I think
 
ty. how do you narrow it down though, just wondering
 
That was me just knowing there was a specific module for all of them :) I can't test atm, is __len__.__file__ legal?
 
nah, cant write __len__ out in the open
 
It feels like it shouldn't be, but it's the only thing that springs to mind.
 
NameError: name '__len__' is not defined
 
2:37 PM
that's a method on builtin classes (which len delegates to)
 
oh hey Andras
Hows your weekend going?
 
cbg
I'm preparing for tomorrow's tutorial
 
Otherwise fine, thanks. How's yours?
 
pretty relaxing, spending time with family and stuff ^^
cant complain
 
2:39 PM
that's good :)
 
@AndrasDeak: If allowed, I'd like to ask if you are teacher/trainer in python ?
 
you're allowed, and no, I'm not
 
Thanks. Ohh, ok, I thought you were when you said that " Preparing for tomorrow tutorial". Moreover, you have an answer for almost everything in Python...so, I thought may be you are a python teacher/trainer.
 
you're probably mistaking me for someone :P
I am a teacher but I don't teach programming
 
Teacher ! Nice to know that...
 
2:45 PM
well, I'm a researcher, and we have to teach ;)
 
Oh, yes. While researching (in universities) you need to teach others.
One more question, last one - What's your research field?
 
condensed matter physics
 
OMGODD
 
relax, please
 
ok
 
2:54 PM
All I can say is xD
 
For Andras?
 
3:22 PM
@ThiefMaster thank you , it is not quite what i'm looking for but it helps for another problem
 
 
2 hours later…
5:46 PM
@JRick From my understanding of the problem, you're trying to redirect users to other domains. Those are sites running on code that isn't yours; it's not logical to expect that url_for could accommodate that since it's referencing routes in your own site
I don't know the purpose of this redirect, but you may be able to store the redirect URL in a session
 
@roganjosh not really , i might redirect them to subdomain
like providing user with a unique subdomain for example like many website does
 
But you own all the subdomains?
 
yea , like for example if my url is site.com then i can create as many subdomain from cpanel
iam trying to do the same using flask
 
Ok, then I think you didn't specify the problem fully, because my understanding of what you wrote is not that
The domain stays the same, but you want to give custom content based on the user login
 
actully it was a small idea but expanded in my fat head lol
@roganjosh yes
 
5:52 PM
I actually don't know best practice for that tbh, but it might be worth re-stating the problem there
 
hmm
 
You want some kind of "portal" to custom content I guess
 
@app.route('x/test')
where for user 1 x =subdomain1.Something.com
and for user two x = subdomain2.Something.com

that is it
 
Side note, this sounds like some commercial venture, so it's risky to be guessing on the best way to do this
 
@roganjosh well its not but its always important to be sure of what i'm doing reguardless
so i just like to learn new part of python everyday .. i don't care much about front end because tehre so many js libraries out there
 
5:58 PM
Sure; I do too. I'm trying to think how I might handle this setup, but I really did need to caveat it with "this could definitely go wrong"
 
hmm you are talking in terms of security right ?
 
Yes, exactly that
 
well u can always add functions not just to check the database but to confirm the user in session , ip address ...etc
maybe even add auth2 to it
 
What happens if an unauthorised user goes to the sub-domain directly?
You ask people to log in, the view redirects them to their own site. What happens if someone skips the initial login?
 
what keyword that would fit the problem i'm trying to describe ?
flask variable in app.rout?
unauthorized error 401 @roganjosh
 
6:07 PM
So how are you passing the authorisation so that a user doesn't have to log in twice?
 
@roganjosh huh ?
btw it's still idea iam planning i dont have an actual code for it
 
User goes to your hub --> they log in --> you redirect them to their custom site.
 
yup
 
All good. What if they never go to your hub and just discover the URL?
 
what does this means ?
u mean like user x never logged and tried to go to x.site.com ( where x.site.com is the right subdomain for them ? )
 
6:10 PM
can they directly paste the final url
 
yes
 
yeah that
 
not sure but i can do as many backend check as i want and raise 401 if iam not comfortable with this connection
 
Backend check against what, though?
 
well if it's for certain type of users then i will check for user in session , user type , ip address , autho2 ... etc
if not then i will just allow him to view it
 
6:13 PM
Without trying to be rude, I think you need to research this more. You're hand-waving a very real issue
 
i do
i didnt research it
u are right
but i'm pretty sure there is lots of ways to secure such a connection
since lots of cpanels , banks ... etc can do it i'm sure i'll find my way as well if i even got stuck into it ... i will struggle a little and learn something new afterwards
the usual ;)
for now iam trying to learn this part
@app.route('<x>/test')
 
Sure. I'm also not the person that can tell you how it's done, but I can see some very big holes in this plan and you should be aware of them
 
where X can be a subdomain of the same url iam in
could you eliberate more about those holes ?
 
I thought I did?
 
i think i have added some of the solutions around already and i'm sure there would be enough resources supporting it all over the internet
but yea it's a serious issue but fixable
what i've not seen in flask yet is this
@app.route('x/test')
where x is a subdomain
 
6:19 PM
Flask doesn't accommodate for what you're trying to do
 
wow are you sure ?
i thought flask has full ORM system
 
What difference would that make?
Flask doesn't have an ORM system. Flask-SQLalchemy does. But that has no relevance to what you're trying to do
 
@roganjosh yes but maybe there is a way around it or something.
how sure are you ?
 
Very sure. Flask might have add-on libraries to help with this; I've never had reason to check. But flatly redirecting a logged in user to a URL, however random you may think it is, is not secure. It'll get indexed by google and you'll be hacked in, say, ~30 mins
 
wow !
i actully might not allow google to index it
but could u give me an example about being hacked if i already have "check for user in session , user type , ip address , autho2" ?
those are extra 4 steps on server and might limit ip tries to 5
 
6:29 PM
So they'll use a proxy
 
and the level 2 auth2 that would require phone or google auth that would send a different number every 30 sec ?
who knows maybe iam so paranoid i will add both lol
call it level 3 auth lol
 
I just think you need to take some time to find the industry standard approach. You're guessing too much and it's not an arena for guessing
 
i'm not guessing all those secure method are out there already
i'll just add it to the same subdomain and whoever hacks would spend his nights banging his head aganist the wall trying to figure out how to bypass mobile auth and google auth to see my site
i'm pretty sure he will have something better to do instead of wasting his life trying to hack a chairty site lol
 
sounds like a plan
 
@ParitoshSingh yup exactly
not mentioning the ip address check
 
6:37 PM
"whoever hacks would spend his nights banging his head aganist the wall trying to figure out how to bypass mobile auth" !!
 
@ksalf right ;)
 
you think mobile auth is safe?
 
anyway i thnk i will post a question about @app.route('x/test') as i really don't know if anyone ever have required to use do something like that in flask
@ksalf i don;t think anything is 100% safe but yeah i think sure mobile autho is really hard to hack or guess
 
When you are done with your website, ask for some bounty hunters to test its security. You will be surprised to see how secure/insecure it is...based on the money you are ready to shell out
 
I'm curious why you raised this in the chat room and then ignore everyone's opinion. This is a bad idea but you're going to push ahead anyway. I can't say anything more
 
6:43 PM
I agree with roganjosh
 
@roganjosh @ksalf i havent don't anything with it yet and nether did any of us , i'm justin the researching phase as i said , i'm not pushing with it , just researching and this topic , it's risks and possibilities
@ksalf i'm sure everything is unsafe when we put money on it.
 
Do check Flask-Login. It does things better.
 
@roganjosh what i dont understand is that this is unsafe but as much as any page in the flask app not sure why the subdomain is more unsafe than regular url
 
Even then, I'm not sure how it deals with subdomains
 
@ksalf sure i have in my mind
i might do the research and decided not to proceed with it , that is all based on the research
 
7:11 PM
i got a different question too
can sqlalchemy change the Structure of a reflected database ?
like for example change a column from varChart to integer for example
 
7:28 PM
hey i found answer to the first question .. flask does support subdomain routing :)
see researching always works ;)
 
 
3 hours later…
10:02 PM
any academics in here? Do I cite authors multiple times if I write a paper or only the first time?
 
If it makes sense it's fine to cite again.
 
Bla et al introduce x, we do y with it. Some more stuff. Later in the text. Bla et al also found z, which is very interesting. Do I cite it both times?
 
yup, unless it's completely obvious
 
k thanks
 
they could've found that thing in another paper of theirs
 
10:04 PM
There are a few pages inbetween, but it is the same paper
 
if there's a longer comparison between your results and theirs it's not necessary to cite all the time, because it's clear enough that you're comparing to a specific paper (which should be made explicit anyway)
@Hakaishin I know that now, my point is that your readers might not
and the worst that could happen is that some co-author of yours or the editor says not to cite it, but there can't be any harm from a redundant citation
 
ok, i decided to cite again. I guess there is no harm in it
thanks :)
 
no worries
 
Is there a reason to rotate a point using a rotation matrix, that is build from a quaternion, instead of rotating the point directly using the quaternion? Is it computationally maybe more efficient? Or did the person maybe not know how to rotate a point using a quaternion?
 
no idea, I always rotate with real-space matrices (usually Rodrigues' formula)
 
 
2 hours later…
11:49 PM
7//9*****************
 
@roganjosh are you sure? :P
 

« first day (3130 days earlier)      last day (1818 days later) »