« first day (3801 days earlier)      last day (1163 days later) » 

12:53 AM
You'll see from the room rules that we normally ask people to wait 48 hours before pursuing unanswered questions here.
 
1:18 AM
What was the name of AFey's user-script for tagging dups?
 
this one? It has a whole bunch of different names depending on where you look :P
 
that's the one! Danke
 
Does it even still work? I haven't been on SO in forever
 
We'll see (-:
nope, doesn't seem to work )-:
 
I can take a look tomorrow, provided I manage to get my PC set up first
...I'm on my 3rd reinstall of Manjaro atm
...downloading 1.1GB worth of updates with 60KB/s
 
1:43 AM
please, don't go out of your way. But let me know what you find (-:
 
 
2 hours later…
4:06 AM
I recommend this should be added to SO canon, sound ok? How to create a DataFrame of random integers with Pandas?
 
 
1 hour later…
NBC
5:24 AM
yuh
 
 
3 hours later…
8:20 AM
@smci seems ok to me
 
 
2 hours later…
10:07 AM
@roganjosh I don't like pandas in the canon
 
 
1 hour later…
11:37 AM
At least such specific problems
 
I did a quick scan and found two jinja questions but otherwise it's all base python so I suspect it might be a sensible guiding principle to what belongs there. That said, there is so much duplication in Pandas, which is almost always on the python tag, that it would be nice to have a section for it. But I don't have any capacity to work on SOPython modifications :(
 
12:07 PM
SOPandas? sounds cute
 
what's SO canon? sounds like a section I haven't noticed
wrt
> I recommend this should be added to SO canon...
(I know what canon/canonical means,)
 
try the unsurprising endpoint sopython.com/canon/
Key is that it's not SO canon, it's sopython canon.
(but smci has only been around for 6 years)
 
@AndrasDeak aaah, ok. thx
while useful, I suspect the common problem is that if it's got a "proper" title/name for what it's solving, those searching won't find it.
for example: "Flattening a nested sequence" vs "convert a list of lists of various sizes into one list" :-/
it'll be fine for us to link to it if someone asks but the asker is unlikely to find it
this problem occurs most obviously and commonly for regex
 
@LoopingDev please stop writing and start reading. You asked the same thing and linked the same question last night. You were told not to ask about fresh questions here and your messages were moved. Please consider what that all means.
@aneroid the canon is not for askers, it's for dupe voters
 
12:22 PM
@AndrasDeak sorry i didnt get that message, i don't think anyone told me not to.
 
@LoopingDev so you asked something, went away, and you never checked what people responded? Curious
going forward please read our rules, LoopingDev
 
no one was online at that time so i left right after
 
@LoopingDev indeed
one would think that you later come back and see if anyone responded to your question, rather than asking anew
This is not IRC. The full transcript is always available.
 
I couldn't find any respond when i did , but any way, wont happen again , sorry.
i'm not doing it on purpose just to be clear.
 
I know, and thanks
 
12:26 PM
no problem
 
@AndrasDeak that makes sense. somehow I inferred that without noticing - "it'll be fine for us to link to it if someone asks"
 
1:21 PM
the tragedy of when a high-rep user tells a low rep answerer to "read the question attentively" and then downvotes a solution which works just fine; and it turns out that the high rep user was the one who didn't read the question "attentively". sheesh. doesn't happen often on but sad that they don't fix their incorrectness
 
1:45 PM
does anyone see an obvious way to speed up that code?
the splicing is not ideal but i cannot see a simpler operation
 
del list_s[i]?
 
yes exactly
thanks
 
I know, I'll use regular expressions.
 
@MisterMiyagi RIP
 
2:07 PM
Is there a vectorized way to get a list of specific rows from a 2D numpy array? The rows I need are non-sequential
 
@duhaime is this not suitable?
l = np.random.randint(1, 100, size=(5, 3))
l[[0, 2, 3]]
# or
rows_i_want = [0, 2, 3]
l[rows_i_want]
 
@duhaime ^ advanced indexing
@aneroid style note: I'd spell out arr[rows_i_want, :] normally
 
@AndrasDeak is that to explicitly say "all columns" ? (like in pandas?)
 
Yes. Same result but makes the semantics more obvious.
 
Y'all are kings
 
2:22 PM
@duhaime well it's basic numpy ;) But thanks.
Might be worth skimming an official numpy tutorial
 
2:47 PM
I got a question, what is the most efficient way to check for updates?
lets say I have a chat room for example.
i could safe the chat offline at the localstorage but again I'm not sure how would app notice if the messages/discussion is already there and instead of updating it would duplicate it.

another point: how do i ask the database if there has been any updates for a certain room/user the most efficent way, without looping throw loads of data?
 
This is so vague and hand-wavy I don't think we can give sensible answers
 
ok ill brb and i will be more precises when i come bk
 
Are you talking about localStorage?
If you set indexes on certain database columns then you won't have to scan *through loads of data
 
@LoopingDev Can you store a hash of some state, then just hash the state later to see if the hashes differ? If so you need to update some things
 
3:04 PM
@roganjosh yes that is what i'm talking about.
i was thinking of comparing the timedate value of the latest update. but I think that is a better method.

like adding column to the database and call it ( pulled ) for example ?

but what if the user logged into a different session/device , that stored data wont appear there
@duhaime that is cool , i think that is the same thing that roganjosh talked about.
but i'm not sure how to make sure that it works on all devices
 
Which is exactly why you wouldn't use localStorage. I didn't suggest that was the correct way, I asked whether that was what you were referring to
 
@roganjosh got it so what is the best way ? pull it every time and replace the current data ?
 
The simplest method (also probably not the best way) would be to have a JS function on the front end that polls your backend to see if there are any new posts that haven't been seen yet (which could be a bool flag in your DB). This would at least get you running with something to improve upon
Then you could move on from that to look into websockets etc.
But there is little use in asking for the "best" way unless you at least have something working already. Otherwise you don't learn anything along the way. And the chances that anyone here is going to give something better than Google, as a company, not a search tool, could develop is... pretty low
 
@roganjosh that is a solid plan, but correct me if i'm wrong, the same device could have multiple websocket on every refresh/tab , so I need to store some of device data or send some data to the system to compare if the device has this data on the localstore or not.
 
Why are we still talking about localStore?
Whether the data has been sent the frontend or not is a bool flag in the database
i.e. that is tracked on the backend
 
3:11 PM
@roganjosh i think it could be useful, localstore could give us an idea on what is exactly On the device instead of the user
 
ok
 
like for example if the user is on pc and opened the chat room , it will be marked seen on the pc
but if he logged into his phone , the database would not send the same messages as its marked seen on the database
 
lest they have a bout of amnesia before switching to a different device?
 
@LoopingDev for chat: send the messages, just don't mark them as unread...
 
lol we all wants our social media messages synced on all devices ,dont we?
 
3:13 PM
then you only keep track of "last seen message"
you would't want the messages of one discussion split between two devices
 
@AndrasDeak have you ever been in a situation where u want to look up an old message on a different device like ur phone ?
 
@LoopingDev so think of all the notifications I've had over the years on SO. Are you going to send me every single notifcation for the last 5 years if I log in on my mobile for the first time?
 
if it's marked seen it will be only available on the first device
@roganjosh only if the user requested , i will pull 5-20 using ajax requests
but not 5 years.
i think localstore could be useful in this regard.
 
In which case, you answered your own question before you asked it
 
not quite, i will still use a combined method between the column and the localstorage , but i was able to go through it with your guys help
@roganjosh thank you.
@AndrasDeak thanks :)
in more details , i might use ajax to send (ids or unique code) of the latest messages and ask the server if those are the latest messages or do we need to update?
if true then it should return , if false then the server should update.
 
3:24 PM
@LoopingDev yes. Was this a trick question?
 
and would probably do the same for every query, would just send the unique identity of the messages and if they are the same then i should not update but in the same time, if the comparing process is just as costly as querying the data then maybe i should just update everytime.
@AndrasDeak lol why did u call it like that , i'm trying to learn form ur experiences and get opinions on my idea.
 
I see. I use slack and discord and SO chat both on my phone and my laptop. It would suck if messages were only present on one. That's what I was trying to say.
 
i agree!, honestly both answers whither we going to update every time or compare before updating means we will have to query the data then loop throw them, which is almost the same as pulling the data and replace the localdate on the client side, except that the second method is much safer and more accurate.

am i right ?
 
I have no idea
 
alright , thanks a lot.
i guess there is no harm in trying both
 
3:33 PM
You're talking cross-purposes
You don't want notifications, you just want an updated history of notifcations
 
My only purpose is not to pressure the server if not necessary to keep the server as smooth as possible.
@roganjosh pretty much but on every device/session
 
That's simple if you put an index on the user_id and the notification_datetime. Then it's just something like "SELECT message_body, seen FROM messages WHERE user_id = %s ORDER BY timestamp DESC LIMIT 10;". Job done
Even Stack Overflow doesn't do what you're suggesting unless you do a page refresh
It doesn't update rep until you refresh, and I think it has a pretty short timeout before it stops checking for new notifications asynchronously. After that point, they only show on a refresh
But it doesn't keep track of the device in which I looked at a notification (ostensibly, anyway) and thank god because I don't want to see red icons on my phone, read them, and get the same ones again when I'm back at my laptop
 
@roganjosh i think when u read the notification it sends a request to server asking it to mark the database for that message as seen and then update all sessions that are related to that user which would update the notifications on every tab and other device and mark them as seen as well.
 
Not asynchronously it doesn't
 
that is actually what i am planning to do, wont that be the best result ?
 
3:43 PM
Didn't the "thank god...." statement I made explain exactly why I think it's not a good idea?
Ok. What you're trying to do is way too complex. Read back through my block of messages a couple of mins ago
 
@roganjosh oh, i thought that in that statement u are not logged at ur phone and pc at the same time, but if u are the red icon is suppose to pop up on every session.
 
Specifically, what SO does
Please stop calling me "u" too. I really dislike trying to have technical discussions with people using txtspk
I will do my best to be explicit in what I'm trying to express, and that often takes many more words from me than I would like to type. I would appreciate that the other party doesn't just take shortcuts in the response because it suggests that the discussion is throw-away
4
 
ok i'll into it a bit more. , and sorry about the txtspk
thanks for your help, it was a pleasure.
I got it, I will keep that on my mind in the future discussions.
 
Perhaps a useful tip to know that people can read into these things more than you might realise :)
 
@roganjosh I'm not sure if I get what you mean, Are we still talking about the txtspk?
 
3:50 PM
In any case, what you are trying to do seems too complicated to me. If you had the page poll the backend for its first 15 min of its life, every 30 secs, then all devices will be in sync. After that point, you can let the page go "stale" and nobody would care
As soon as they refreshed the page after that point, you'd poll your db and correct the notification list
I do this all the time with old SO tabs. If they've been open a while, I'll always do a refresh and expect new notifications to show up. I don't have an expectation that everything is permanently in sync across all my devices
In which case, the specific device is irrelevant; the page is always going to be querying a single database to see whether I've seen a notification anywhere for the first 15 mins, then it goes stale. Doesn't matter what device I'm currently on
In terms of the chat room, it stays in sync much longer, possibly through something analogous to asyncio
 
@roganjosh oh, I got what you mean. i'm using `socketIo` for that.
do we need to write a code for `asyncio` to check if the user has seen the notification on any device ?
 
For the last time; you'd have your page poll the backend every 30 seconds to see the current state of the database
You can build a javascript function into the page that keeps polling your server
 
got it, thanks.
sorry I got lost a bit.

thanks a lot, much love!
 
No worries. Once you've got that bit working, then try make something more elaborate. But I'd start with that. Good luck :)
 
thank you !
 
4:02 PM
@LoopingDev you can do "view page source" for jpilkington.com/manufacturing/homepage and see it in action for the PTV screens I made. It's clunky and websockets would be better, but I just rushed and got it pulling the db every 3 secs. You can open that page on multiple devices and it will show the same figure (-ish, potentially offset by 3 seconds of data)
It's line 820 of the source
 
4:38 PM
@AndrasDeak Ok I'll call it that
 
Thanks
 
user13727121
5:32 PM
Could anyone help me out on this issue, please? Been struggling to figure it out. Here's the link to the code: dpaste.com/GCTNEBPVA, the issue starts on L100 down to the end, but I can't exclude the other codes since they are all linked together. Anyway, I'm trying to get the program to print out a message telling the user the number of times it took them to guess the number.
 
Cbg, Is there a good canonical for this? stackoverflow.com/questions/66616456/…
 
user13727121
I understand that this can all be achieved using a simple while loop, but I chose to break down the codes into pieces rather than fitting them all inside a function or a loop. The issue is that the program either returns a NameError or it just prints out the else statement on L112
 
is this fine? Not sure
 
user13727121
Taking out a piece of code just breaks another, such as the user receiving the same multiple prompts or an endless loop. I understand that I need to increment the count, I tried placing it on L73, put it as the function's parameter too, didn't work...
 
5:52 PM
Why do you call get_guess_number() twice?
You do it once in the function, and once globally
If you want to "deconstruct" the flow like this, you need a stateful object IMO
 
user13727121
L77 and L96, right? Well, it stops the program from giving the user the same prompt twice in a row. I can remove it too and put it after while True in L87
 
But they're different code paths? One is just going to get called on the module level and the other on a function call
To be clear: I think you're half way towards getting a decent solution. I think you're in the limbo stage between two different approaches
Please see our formatting guide and have another go in the sandpit (link at the bottom of that link) if necessary. I'm gonna move this message in the meantime
 
So, it should be clear that your check_guess_number function will have to keep track of how many guesses the player makes. The only question is how you get that number from check_guess_number to number_of_guess_attempts. The easiest option would be to just call number_of_guess_attempts(guess_count) at the end of check_guess_number
 
user13727121
This also works, but I didn't remove the parameters in the first because I might need it for the solution.
 
user13727121
@roganjosh thank you and sorry, I am aware of the rules of this chat room, I'm on my phone right now because my laptop just died on me, had to send it the code before it did lol, again, I apologize
 
6:02 PM
That's fine. You're welcome to re-post when not on a phone (you're not going to be able to implement the feedback anyway from your phone, right?!)
 
user13727121
@roganjosh I'm pretty sure I just don't know where to place the code correctly, at this point, I'm just placing it what I think might work..
 
That's why I said I thought you might be between different approaches. I'm not gonna pull the question back from Ouroborus but I think you're thinking along the right lines and Aran's comments should be enough to keep you going until you're back at a computer?
 
@Aran-Fey please tell me you changed the crop of your profile pic
it's either that or I'm going insane
 
He's just Smurfing with you
 
Ah, OK, the main account has the old avatar. Phew.
 
6:14 PM
@AndrasDeak no worries, you're still sane
Which one's better, old or new?
Or is it option 3: Nobody cares?
 
I don't know about "everybody" but it makes no difference to me as long as it's consistent
the new one looks better as an avatar on main, the old one looks more like a face in the 10px size in chat
 
user13727121
@Aran-Fey I put it as check_guess_number(guess_result, guess_range, number_of_guess_attempts(guess_count))
 
What is "consistent"? :P This discussion sounds like it means "never change" :D
 
@CoreVisional That... makes no sense, as you will probably find out when you try to run it
 
@roganjosh what else would it mean?
 
6:19 PM
Soz Aran, I'm gonna roll back your profile pic :P (Separately, beyond the regulars, I do actually pay a lot of attention to profile pics so it ends up being bigger to me than I hope it would be)
@AndrasDeak you "coped" with my name change to my actual name better than I did, I think?
 
@AndrasDeak That's good to know. I was worried that it was hard to recognize as a face and looked more like an unidentifiable brown blob
 
@roganjosh from experience my mental pattern matcher weighs avatars higher than usernames
@Aran-Fey not sure if it's just a brown blob but it was definitely identifiable to me :P
 
That's interesting. I agree totally, but I didn't expect we would on this tbh
 
user13727121
@Aran-Fey yeah, I got an error for doing that, maybe it isn't the best idea for me to debug the code on my phone
 
I'm just awful with names. I thought I'd fallen back on avatars and that was "my" thing
 
6:22 PM
Alright, I've changed it back. You two can now furiously mash F5 until it updates :P
 
I think we could probably officially sanction your change of profile pic. It's only 37 forms to fill out (but on a serious note, I did actually think it was just me that noticed them so prominently because I can't remember names)
 
@Aran-Fey Well you don't have to. I can get used to the change in a month or two.
 
It's fine, I wasn't sure which one I liked more anyways
 
+1 bureaucracy
 
any minute now
 
6:34 PM
?
 
no update yet
 
How many times have you refreshed?
 
only about 5 because caching is on the server side for up to 30 minutes :P
 
Oh! FWIW, Aran is special-cased in my brain because I know I got explicit permission to use that name and not always Aran-Fey. That was enough for me to overlook the profile pic in this :)
 
you probably shouldn't ever use Aray-Fey
 
6:37 PM
Many people have misspelt my name, but this is the first time someone's called me an array!
 
@AndrasDeak ouch :P
I... shall go back to my corner :P
 
you can come out when his profile will have refreshed
 
@Aran-Fey I mean, they're quick and pretty memory-efficient, right? I basically complimented you and this is how it's received?! <Hopes I can throw the guilt back to sender>
 
True, they have a lot of good qualities. But look around... we're in the python room. What python programmer has ever used an array?! We always use lists for everything! Arrays are probably the least appreciated data structure you can find in this language! Calling me an array is equivalent to calling me irrelevant! We're not friends anymore! *Storms off, slamming the door*
 
we're left in disarray :'(
 
6:56 PM
Well sooooorrryyyy. If it wasn't clear that array meant np.array then I think that's their problem <folds arms staring at the slammed door>
(please don't leave Aray-Fey!) :P
On a serious note, sorry for the typo. I think I got caught up with work and muscle-memory went a bit haywire :)
 
he can't hear you, the doors are soundproof
 
He'll be back
 
Apology accepted, but as punishment you must perform 10 sets of F5-presses
 
... but I'm on 4G? This is a cruel and unusual punishment!
 
Then you must carry your sin... forever!
...or until you find a keyboard
@piRSquared As far as I can tell, there are 2 problems: 1) SO's design changed a lot; things that used to be <li>s are now <div>s, <a>s are now <button>s, etc. And 2) GreaseMonkey implemented a stricter sandbox, so if you're using that, even less of the script will work
GreaseMonkey won't even let you attach a click event handler to html elements anymore, it's bonkers
 
7:15 PM
phew, face restored
 
Brown blob on violet background is back!
 
yisss
 
The verdict is: I can't be arsed to maintain this userscript anymore
 
perhaps if we incentivised you by making it somehow typing-related...
 
Please, no :(
 
 
1 hour later…
8:27 PM
Okay, I lied, I can be arsed to update it. No support for GreaseMonkey, though. @piRSquared Let me know if something doesn't work still, I only did a very small amount of testing
 
I guess the threat of typing worked
 
Kind of? Updating the userscript was less of a hassle compared to updating my typing library...
I'm procrastinating... productively ¯\_(ツ)_/¯
 
Yeah, my best procrastination event in a while was a major PR to an open-source library. Not getting real work done now with reduced guilt \o/
 
I logged in with my main account to test the script, I have like 28 notifications and almost 4k rep gained. Still sub-30k rep though :(
 
the shame
 
8:35 PM
When I was still active, my goal was to bounty away so much rep that I'd never hit 30k. But now? I've been waiting to hit 30k for, like, a century
 
give it a month
 
 
2 hours later…
10:11 PM
@Aran-Fey /thumbsup thx it works.
<- Using tampermonkey
 
 
1 hour later…
11:41 PM
Huh, somehow the script suddenly works in GreaseMonkey as well. I have no clue what I did to make it work, but hey, I'll take it
 

« first day (3801 days earlier)      last day (1163 days later) »