« first day (3931 days earlier)      last day (1000 days later) » 

2:08 AM
hi
 
2:30 AM
cbg
 
 
2 hours later…
4:20 AM
Hi all, I am trying to gain a good grasp in python OOP. Could you please suggest some good resources for this?
Thanks!!
 
 
2 hours later…
6:21 AM
cbg
 
6:55 AM
rbrb
 
7:06 AM
cbge
 
7:20 AM
What are you people up to today ?
 
 
2 hours later…
9:00 AM
@MisterMiyagi confirmed. Part of me thinks "I wish I'd put more faith in Homebrew" but, yeah. Thanks so much :)
 
9:39 AM
@roganjosh Splendid! And don't forget to wear your turtleneck sweater!
 
9:52 AM
@blessed did you write that?
 
I have a function that should either run a given amount of time or until a condition is met, should I use a flag to determine if the code is ran in a for or in a while? I mean it sounds kind of messy to do..
 
for for sure
you can use an if with a break to kill the loop early as needed
so no flags needed
just use a for loop with an if condition
 
My bad I phrased that very poorly, the function call could either be foo(number_of_run=1000) or foo(threshold=200). In the latter case the function should stop if a value is under the threshold, for with if is still possible in that case ?
 
Are you asking if you can break out of a for loop?
Because that's something you can check in practice faster than asking here.
 
10:30 AM
Looks like you actually have two functions, which just share their core functionality. Does this core actually have to know the break condition?
 
10:42 AM
I'd probably do something like
if num_iterations is not None:
    abort_condition = lambda: iteration >= num_iterations
else:
    abort_condition = lambda: value >= threshold

for iteration in itertools.count():
    if abort_condition():
        break
 
10:54 AM
"That's right, I assigned not one, but two lambdas to a variable. What are you gonna do about it, ban me?" - guy who was banned
 
At least it's not a case statement.
 
11:20 AM
Thanks, I'll take a look at this lambda solution. I'll also try to improve my explanation skills.
@MisterMiyagi The core does not have to know the break condition. Basically I'm just trying to have those two functions merged into one to avoid repeating the core but I guess sometimes it's not worth complicating the code.
 
I think you should extract the core logic into one function, then have two outer functions to drive it.
Or one outer function with two separate loops inside.
 
That's exactly what I had in mind but didn't manage to ask properly.
 
11:52 AM
Hi All,

Does anyone know any selenium?
 
 
2 hours later…
1:43 PM
Yes lots of us know selenium, can you be more specific @ans2human? What are you up to?
What does the -f flag do in a pip install command? e.g. the first cell here: colab.research.google.com/drive/…
 
"-f, --find-links : If a url or path to an html file, then parse for links to archives. If a local path or file:// url that's a directory, then look for archives in the directory listing."
See also the pip docs.
 
2:01 PM
i want to have a list of date range between 2020-06-20 to 2021-07-21 in same format. it's achievable by calendar module ?
 
Could you use datetime and timedelta?
 
2:34 PM
since am using pandas within my project. i managed to handle it with pd.date_range.
 
2:51 PM
cbg, is there an alternative to requests.get(url, headers={'Authorization': 'some_value'})? similar to a basic auth, requests.get(url, auth=('user', 'password')) where I don't have to construct the header?
 
3:20 PM
I'm not clear on why you'd need that?
 
I just wanted to know if I can use the auth parameter to do that instead of creating a header, as I mentioned requests.get(url, auth=('user', 'password')) is the equivalent of requests.get(url, headers={'Authorization': 'Basic base_64_of_password'}) (correct me if I am wrong), so I wanted to know if auth does what I asked
 
I don't trust myself to give a technically-sound answer to that, sorry. I was curious why you'd need an alternative method to something that seems trivial to implement in code
 
no problem :), I was just wondering why, the header way does what I want
 
It works without a username?
 
the one with header? yeah, I just pass an api token instead of some_value
 
3:30 PM
So it's not actually "base 64 of password" in ("user", "password").
In that case I don't understand the premise. Isn't it either-or? I imagined that when you get an API access token, that's all you have. You don't get to use that or a user-password pair.
the token itself identifies and authorises the user
 
sorry for not being clear, the second one was just an example, in case where you have to authenticate using username and password that is the way to follow stackoverflow.com/questions/19069701/…
I just wanted to use that way for my case where I authenticate using only a token, is that clear?
 
It's sort of clear except the question sounds "not even wrong" to me. As phrased: "I want to [authenticate with a username and password] for my case where I authenticate using only a token".
I might just be missing something basic, because I still don't do web stuff.
 
I might be missing something too, I just know basic auth since the past 5 minutes :D, but my question / clarification is basically "can I use the auth parameter only to send a request where I only have a token"
 
OK, so your ('user', 'password') is a big red herring.
 
on second thoughts yeah, I just expect the library to have a syntactic sugar for my use case
 
3:37 PM
Have you looked at the docs of requests.get yet to see what it says about the auth kwarg?
 
I am checking the docs as well, It talks about three different auth methods I need to understand them more before I dive in
 
hello guys
 
hello Li Xiu Ying
 
@python_user sounds like that's what you should have started with
 
yeah, apologies roganjosh and to you
 
3:40 PM
I mean you're wasting your own time first and foremost by asking the wrong questions :P
 
bitter truth right here ^
from a work related perspective I at least have something that works, so there is that :D
 
What is your best SMPT email in django you used mostly for free?
:)
 
I have not used both of those, so I cant comment on that
 
i heard gmail, mailgun as free, but as your guys exprience , which would be good
for free
:)
 
not what you want to hear, if it is free, why not just try and check ?
 
3:55 PM
:) yes, i'm using gmail
 
@LiXiuYing a free smtp service (that isn't part of a normal email service for humans)? that's gonna be on tons of spam blacklists
if your application needs to send emails, either run your own mail server (but that may be a problem if you send many mails since your server's ip won't be known as a trusted sender not sending spam) or pay a company (sendgrid, mailgun, aws, ...) for giving you access to an SMTP server that's meant to be used by applications
 
4:23 PM
hello, Thank you for your information,
currently i'm making project as a hobby so i was using gmail, later who knows , if project became as big as you know, i would follow your advice. :)
 
 
3 hours later…
7:19 PM
@IsaacNg please see our formatting guide for chat. I don't know why you've chosen to post a load of hashed-out code lines. Please re-post with correct formatting
I assume you were demonstrating the two approaches you've tried, but then there's double-hashed lines. It's not useful for us to have to guess what the format is
 
7:41 PM
I'm trying to work up some motivation to start this task, so... would anyone be interested in a userscript that automatically adjusts the video volume depending on which youtube channel you're watching?
 
depends, if i say yes, will that be motivation for ya? :)
 
yes
 
then yes, why not!
 
to be honest, that's seems not logical for me. in case if am watching YouTube while I'm in front of laptop/computer, it's not a big deal to control volume up/down especially almost of keyboards have multimedia keys.
 
Answer rating:
*) yes -> +1 motivation
*) no -> +-0 motivation
*) omg, are you seriously thinking of automating that? -> -5 motivation
 
7:47 PM
it might be a bit useful if it's a user script within Smart TV which is also easily to adjust volume using voice CMDs nowadays :)
 
@αԋɱҽԃαмєяιcαη You underestimate my laziness... and how often I re-adjust the volume because it's a tiny bit different from my preferred volume
 
also, xkcd automation applies. we must automate everything to a fault!
 
hey, programming is more fun than dragging around a volume slider
 
@Aran-Fey each lazy person think that no one can compete him in laziness :D
 
hear hear
 
7:54 PM
Quite a number of nights, I leave some YouTube channel running and it'll help me sleep... only for some segment to come on where everyone is screaming and horns go off etc. Is it possible to put a max-vol in on something like this?
 
Surprisingly enough, it actually might
 
that might be insanely useful
 
I'll report back once I've read and understood this page :(
 
There's your motivation, then :)
If you figure that out, you might even be able to commercialise it in some way. I don't think I can be alone with this issue...
 
I know lots of people have that problem with ads, but loud sound inside the video itself seems less common (at least for videos that you can sleep to)
 
8:01 PM
i think roganjosh just sleeps to jumpscare videos.
he knew this day would come, where he could enlist your help, and he's been preparing for it since.
it makes sense in my head.
 
someone would find a way to kick up a stink if you volume-limit their adds, I suppose. So maybe there's no way forward with that as some kind of side-earner :/ In any case, I don't think anyone would be issuing a cease and desist if you made a userscript for it
 
@Aran-Fey adjusting volumes all the time is a pain, and youtube's per-video audio slider is useless crap.
go for it :P
 
@ParitoshSingh I know how to play the long game. My patience is legendary, as you well know
 
that's where the big payoffs are, after all
 
I wish this were all true. Back in the day I put some money on the FOREX and the whole time the bid was live, it was "Oh yam, oh yam, oh yam". Suffice to say that it didn't work out :P
 
8:15 PM
haha okay. the big payoffs are in the long game, except for when actual money is involved. there!
 
Even on the FOREX, you're supposed to hold out and let the trend ride
Unless it's a crypto-currency, there should be enough of a long-term trend. I just start pooping myself when the next ticker shows I'm losing :P
I guess I don't belong in the typical Wall Street scene from movies because I'm in a corner having some breakdown the whole time
 

« first day (3931 days earlier)      last day (1000 days later) »