« first day (4267 days earlier)      last day (683 days later) » 

12:27 AM
!!choose spellsword enchanter
 
spellsword
 
 
3 hours later…
4b0
3:31 AM
@JamesBot commands
!!help
 
Command documentation and syntax can be found here.
 
4b0
!!echo Namaste šŸ™
 
Namaste
 
4b0
errrr only first word
Permissions admin === RO ?
!!joke
Really confuse about command :)
Any way nice bot
 
 
3 hours later…
6:15 AM
Hi All
I have a requirement of storing profile image from social platform into my DB when the user uses single signOn
in case of a platform, Im getting this profile image property as BASE64
wanted some guidance in, whether storing this base64 in my mongoDB is the optimized way of saving image
we don't want to save this image on disc
 
 
2 hours later…
8:07 AM
@TheJOKER why not?
there's literally no upsides to storing images in a database
 
8:57 AM
@TheJOKER that looks like quite a suboptimal way of serving images - why not store them as a static asset indeed?
there's, as @BenFortune rightfully mentions, literally no upsides to storing/retrieving images from a database
 
9:14 AM
Few years ago, I went to make myself a public transport card. You need to supply a photo for it. I filled in the online form and just took a picture with my phone and attached it. Then had to go get the real card but the photo was missing. So I had to redo the form. Alright, I filled it in again, attached the photo and checked. Turns out it was just base64 encoded and attached directly to the form.
Which produced a huge string because the photo is however many megapixels to begin with and base64 inflates the original size with about 1/3rd on top. The resulting string was so big that the system just cut it short at some point breaking it. The photo is only 3cm by 2cm or around there, so I just resized it. Didn't need that many pixels.
And the greatest thing ever is that nobody even looks at the photo. When the transport control people come in, I've tried giving them the card upside down or just putting my thumb over the picture. I've never been asked to reveal the photo.
 
Using map is alternate approach, also using null propagation just incase total property doesn't exists. :) — Nitin Ramnani 1 min ago
if(value?.total){
I think he misunderstands null propegation
xD
 
what is null propagation in the first place in the ECMA context?
 
Oh wait, that's called Optional chaining
derp
 
9:29 AM
I think they mistook their JS for C# :)
 
No, that's on me :D
 
what's funnier is that they keep responding to you as if it was a thing in JS :)
 
Meh,basically the same thing. With a?.b?.c if a or b is will "propagate" the null as the result of the expression.
 
Yea, same shit different name
 
BTW, yesterday I found out that C# has learned from TS and added a ! as in bar = foo! to tell the compiler foo is not a null. In C# this operator is called the null-forgiving operator
I find that name quite amusing.
 
9:34 AM
@VLAZ well, kind of
 
Yea, C# is getting more conscious about nullability.
 
I just don't like using terms loosely because it often leads to misconceptions about how things work down the line
 
Meh, too late any way :D
 
9:53 AM
heh, true :) It's not that I am that pedantic, I am just surprized the OP continued to use the same term to describe what's going on
 
Probably didn't know what it was called :D
 
I also wouldn't call O(n ** 2) + O(n) "optimized" time complexity-wise for such a task, but they do them :)
"they do they"? How does one adapt "you do you" to third person?
I agree that Map is quite a needless overhead here
 
"thou dost thine"?
is "dost" even valid ye olde english?
 
seems valid, but isn't "dost" second-person?
 
Also, today in "Why you shouldn't bother explaining downvotes" xD
Idunno
Ye olde English is like a 3rd or 4th language for me :D
 
10:02 AM
heh, well, hopefully they won't lock in the belief that Map is helpful here
I love the Map and Set built-ins, but Map is, indeed, wholly unnecessary here
 
Yea, I mean, look how clean and simple my code is compared to most of the other answers
 
I'm not a fan of these "alternative approaches". Yes, you could do it differently but it's not better. It might be worth showing off the alternative approach and explaining why it's bad, for example. But just presenting it makes it seem like it's to be considered with the rest.
It doesn't use shuffling but it's the same underlying solution - generate an array with all options, then try to randomise its elements. It's just slower than a proper shuffle. — VLAZ yesterday
 
@Cerbrus yeah. Btw, do we not have a "sum an array of objects by key" canonical, I wonder? Sounds like we should have one, but oh well, I keep getting surprized in that regards all the time
 
For quick context - somebody needed unique random numbers. Three answers suggested "generate the range, then shuffle the array". And this one answer showed "An answer that does not use shuffling:" That's a direct quote of the entirety of the non-code content of the answer.
 
@OlegValteriswithUkraine We might
 
10:11 AM
@OlegValteriswithUkraine Like group and sum? Or produce a table of sums { a: 4, b: 2 }? We have both.
 
But frankly, I'm caring less and less about duplicates
Especially since there are repwhores out there answering any and every question they can get their grubby hands on...
 
@VLAZ yea, I think we must have them, right?
@Cerbrus that's why I practically only answer TS-related questions about complex types or weird compiler behavior - venturing out in the JS tag is just too depressing
 
Uh, checked the question. We don't have exactly the same scenario. Well, at least from the dupes I can think of. It's not too far of any of the group+sum scenarios (you do the same thing anyway - identify key, identify number, merge number with the running total for the key) but I'm wary of just slapping something that shows off rather different code.
We don't have a good dupe for the operation. Because ideally, the thing in brackets is all you need. And then can figure out how to identify the key and value for yourself.
With maybe a couple of examples of different data structures. Enough to explain the problem in detail and then how to tailor the solution to yourself. Right now we have "I have this dataset, how do I do it" with usually a bunch of answers that don't explain anything. So, you have to work backwards starting with the answers, see how it applies to the question, then figure out how to adapt for your case.
 
frankly, I don't understand why people keep asking those basic questions - ain't the whole point of our craft is to solve problems? Like, it's basically the only worth-while things
 
People just don't search.
 
10:18 AM
I mean, it's not even about searching, they just don't think
 
@OlegValteriswithUkraine Some just want somebody to do the work for them.
 
why even get into IT then?
 
Easy job - you get others to do your work.
 
Oh wrong link
-1
Q: Getting the average of the numbers on each month javascript

Lemuel FajardaAny idea how can I get the average of the numbers on each month. let techScores = [ { "2021-01":[78,86,100], "2021-02":[100,100,92], "2021-03":[86] }, { "2021-01":[68,100,84], "2021-02":[82,92,82], "2021-03":[86,100,100,90,100] ...

Same case
Learn to split your problem up
Then it's trivial to solve
 
@VLAZ I mean.... one can do that with any job? Why choose something that requires you to constantly solve problems if that's what you hate the most?
 
10:21 AM
I admit, it's exasperating seeing a question that I know there is an answer for. Because I myself have searched and found that solution in the past.
 
is using express-session the best option for In memory storage on nodejs server
 
@OlegValteriswithUkraine Kind of hard if you're a brick layer. Or legal assistant. Or a store clerk. I mean, those can still offload the work to somebody else but it's kind of obvious when somebody else shows up. IT is frequently described as sort of advanced googling. I've seen programming described less so but still often times in the same direction. You just need to do something that works and you can copy the code. Or ask and be given the code.
Also, from the outside many seem to believe "computer work" involves a lot of faffing around. You watch YouTube videos all day and maybe put in half an hour's work a day.
 
ain't it the same thing? Once somebody competent shows up, it becomes clear whether you know it or not
 
10:26 AM
@OlegValteriswithUkraine Sorry, my point is that if you hire Gary the Coder, he sits at his computer and produces code. It's not as clear how that code was derived.
 
and, well, I am O.K. with googling stuff - we do that constantly. What I don't understand is getting into IT if you don't get the kicks out of breaking down problems into digestible chunks, then implementing them
 
Well, unless you have a team but there is also plenty of bad teams that just have the Gary the Copy Coder. And other times, ol' Gary is the entire IT.
 
case in point: "how do I get the average of the numbers on each month". What's so hard about it? The argument about being new does not fly with me - one can be knew to programming, but one can't be new to thinking (well, I suppose one can, but then again, why choose IT)
 
@OlegValteriswithUkraine You're right. Googling is not all we do. It's iterative problem solving. Even non-programmers would be doing this - there is some problem, they first need the correct terms to describe it. E.g., Error 1002. Which might reveal more terms. E.g., Hardware fault with USB stick. Which might lead to even more. Until you find the solution, e.g., turn it off and on again.
It's the same core skill for tacking programming. I need to do something with an array. I'd google around and find the terms "grouping" and realise that's what I want. So next search is about "grouping array". And then I realise it's not just grouping, I want some sort of aggregation. Slowly, over multiple searches, as better and better keywords are added, you'd get to a range of solutions.
 
Exactly. Point being, it does not matter how much one has to google (heck, I keep forgetting the syntax for Git commands or CSS shorthand properties on a daily basis, for example), it's just a minor part of our craft. It's just "applied thinking". "ok, I need to do A. To do A, you need to do B,C,D. To do B, you need E,F, etc"
one may not know the correct terms, be not aware of best practices, not know what the standard library provides, etc. But as long as they can think, they can do anything in a reasonable timeframe
 
10:34 AM
Decomposing tasks seems to be exceptionally hard for many. There are a lot of questions like "My if inside a for loop doesn't work". And there are probably at least three things that can go wrong - does the loop execute at all? Is the if condition correct? Is it maybe a problem that the code inside the if executes but doesn't produce the desired effects.
Actually, four problems. Some times nothing in the code works because OP has syntax errors and hasn't even checked the console.
 
Yeah... And the fun fact being is that "decomposing tasks" is just a fancy term for "thinking". It is how thinking works: by dividing complex problems into easy ones
 
And pretty much all jobs require this.
A brick layer doesn't just think of "How do I get from this empty space to having walls?"
 
hence my note above :) I'd go further: pretty much anything in life needs this
"how do I install a kitchen sink" is no different from "how do I create a program that does X"
It's even easier to do the latter, because compared to other crafts, we have an amazing availability of learning resources
 
Well, except kitchen sinks typically aren't upside down and on fire after completion.
 
10:40 AM
Can you imagine SO but for craftsmen? "I want to install this sink" -> "Try hanging it from the ceiling - worked when I tested it"
 
I know it exists. I mean if the answers were the same as on SO.
Admittedly, I've not seen what they look on DIY
 
well, I am sure DIY regulars have a story or two :)
I think scaled to the size of SO, pretty much every site on the network would be a dumpster fire
 
"There are excellent suggestions for using proper tools to install the sink. But here is just an alternative - try nailing it to the wall, then pour epoxy all over it to hold it into place"
"What have you tried about installing the sink? This is not a sink installation site."
 
What does the fact that I don't even find the examples funny as I am sure that's what they would (and possibly do) look like tell about my views on humanity?
 
10:46 AM
@OlegValteriswithUkraine I have a call to some third party, so in my service I have to store some information, until another API is called. This another API is in same flow. So I'm trying to do something like using cookie etc, based on key I will be able to access that information
 
hmm, whatever grinds your gears, I guess. Not sure why you need session cookies here, though - looks like the information can be temporarily stored in-memory in a simple Map. Are you using session cookies for authentication to your service in the first place?
 
11:15 AM
no Im not using session cookies for authentication
 
@TheJOKER then you probably are better off without express-session, it's not really a replacement of in-memory storage. Any reservations about just DIY'ing it with built-in JS features?
@VLAZ heh
 
12:20 PM
Are you familiar with recursion? use recursion concept. — Ganesh MB 31 mins ago
How would you possibly use recursion when the code is
try {
    await foo();
} catch (error) {
    try {
        await bar()
    } catch(error) {
        // handle error
    }
}
And the complaint is that it looks ugly because it's nested
 
@VLAZ dunno, I've only reached second base with it. Does it count as familiar?
 
Check how full the relationship meter is.
 
@VLAZ I think they replied to "then handle eventual bar errors again"
 
Well, in that case, I missed it.
Still, recursion? Not, like, a loop?
What is it about promises that makes people think recursion is the only possible way to handle them?
 
well, I don't like handling retries with loops for once, but that's just a personal preference
 
12:26 PM
I've seen "use recursion" expressed even by more established users. As the only option.
Actually, I think that the "eventual bar errors" is just the one error. Not continually calling bar()
I'd personally use the "forbidden craft" of mixing async/await with promise API, since it massively simplifies the thing.
try {
    await foo()
        .catch(bar);
} catch (error) {
    // handle error
}
 
@VLAZ heh, that's true, I've noticed that before.
 
Chat, the way you show tabs is killing me.
 
Many folks are setting themselves up for a treat when they eventually get recursion wrong and forget to sanity check :)
@VLAZ you monster :)
 
Fun story: I once almost killed our server at an old job because I was slightly careless with recursive copy. I wanted to copy all hidden files from one directory to another, so I did cp -r a/.* b/ well, that copied .config1 and .config2 but didn't stop there. Since I told it to recursively copy everything it found, it went through each directory. Including the .. directory. Which is the parent. Then proceeded with .. again. And so on. It was copying everything.
I was wondering why copying few small files takes more than 10 seconds. Then we started getting alerts for not enough space, as everything on the server was copied to a single directory.
 
@VLAZ lol, yea, pretty much everyone has a story or two like that - I get very nervous every time I do something like that
 
12:36 PM
Mine wasn't THAT bad. Bunch of sites went down for about 10 minutes. Not a big deal.
Same company had one guy who managed to do something similar but with mv and moved everything. Including the top-level directories. Like /bin which is where mv is, so it was no longer available, since the directory wasn't there.
 
@VLAZ were you at FAANG, you'd get death threats for being down for 10 minutes :)
eh... "in FAANG"?
 
Eh, it was mostly websites for for local B&Bs. Not something super used.
I'm pretty sure that Fb and the others just sacrifice a person for each minute they are down.
Or was it two. Each second.
 
that's not too bad, I thought it would take an entire SRE dept
 
Oh, doesn't embed the comic like XKCD does.
Oh, this one is just perfect:
user image
2
 
@VLAZ my favourite version of it is "oh, a library has any as the options parameter type. Let me quickly PR the DT repo ... [many hours later] ... f***"
 
12:56 PM
|| choose pizza or not pizza
 
not
 
:(
 
1:07 PM
|| choose to be or not
 
to
 
god even despite I hate try/catch; I loved that comic
 
||> function toBeOrNot(be) { const notBe = !be; return be || notBe };
console.log(toBeOrNot(true), toBeOrNot(false));
 
@VLAZ undefined Logged: [ 'true', 'true' ] Took: 13ms
 
1:13 PM
So, there is the answer to your question, Hamlet
@KarelG It's super good.
> How to solve this problem by writing a code solution in JavaScript
We found the last JS question, ladies and gentlemen. From now on, everything can be marked as dupe as this one.
 
yeah I started to browse it from its first entry
never heard of this one
I just came through some "adlitteram" things, a little riddle. Not bad
 
@VLAZ unfortunately, it's the first JS question - it's how it all started
 
@KarelG There were some riddles in the beginning. But later on it's just comics. As of recently, there are also short animations (1-2 minutes long). I open up and catch up on the comic occasionally.
 
I don't have a clue with this one lol - monkeyuser.com/2016/ad-litteram-4
 
1:31 PM
There is a "REVEAL" at the bottom. I had to click it. It's hilarious.
 
I am aware of that, did not click it directly
ok I understand it now
 
Hi, can someone tell me about react useEffect. I have some functionality that I want to be run only when foo changes, but in my useEffect I want to compare the foo against the bar, now if I don't include the bar in the dep array I get a eslint warning. Have I misunderstood the dep array?
 
1:51 PM
just encountered this one: monkeyuser.com/2017/tales-of-regex-42
 
xD
I have to go through them again, I had forgotten this existed.
Oh, this one is the first one I was linked to, IIRC.
 
 
2 hours later…
3:54 PM
Hello
/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
 
no
 
How to change this regex to check only number and special characters
 
/.+@.+/
 
because this regex checking uppercase, lowercase also
 
The best regex for email
 
3:55 PM
No, this is for password
 
the best regex for passwords is none
 
/.+/
 
I don't understand Vlaz
 
password validation with regex is wrong. At best check for some characters but that might also be excessive. A better validation would be to check complexity. But still. Allow people to come up with the password they want.
 
Yup validation schema
 
3:58 PM
šŸ¤®
 
Also, that regex you posted most definitely attempts to check for email. It checks for stuff then @ then more stuff then 2+ characters at the end for a TLD
 
Probably
But I want to check only if 1 number exist and special characters
 
do that
 
Can you help me how to do that ?
any regex generator
?
 
no, i won't assist with forcing password formats
(or regex in general, tbh)
 
4:01 PM
@MileMijatović what is the meta sequence for any digit?
 
@VLAZ, sorry, my mistake
/(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[@$!%*#?&^_-]).{6,}/,
previous regex is for email, you are right
 
ok, looks like you have an expression already. That looks... hella overcomplicated for the "if 1 number exist and special characters" task
 
4:22 PM
Unfortunately not, password is valid if I don't enter special character like +,-,!,#,$
with this regex
/^(?=.*[0-9])(?=.*[a-zA-Z])([a-zA-Z0-9]+)$/,
@OlegValteriswithUkraine how to update, do you know ?
 
 
1 hour later…
5:34 PM
posted on June 22, 2022 by Srinivas Sista

The Dev channel has been updated to 104.0.5112.20 for Mac, Linux and Windows. A partial list of changes is available in the log. Interested in switching release channels? Find out how. If you find a new issue, please let us know by filing a bug. The community help forum is also a great place to reach out for help or learn about common issues. Srinivas Sista Google Chrome 

 
5:46 PM
posted on June 22, 2022 by Ben Mason

The Dev channel has been updated to 104.0.5112.20 for Windows, Mac and Linux. A partial list of changes is available in the Git log. Interested in switching release channels? Find out how. If you find a new issue, please let us know by filing a bug. The community help forum is also a great place to reach out for help or learn about common issues. Srinivas Sista Google Chrome

 
 
2 hours later…
7:31 PM
@MileMijatović ofc it is considered valid since it checks for: start of the string, followed by zero or more chars followed by a digit, followed by zero or more chars followed by a case-insensitive English alphabet char, all without "consuming", then consumes one or more English alphabet chars case-insensitively or digits, followed by end of string.
Or, put simply, it requires one English alphabet char (case-insensitive) and one digit
Thus, 0a or a0 are both valid
so... question: why would you consider the above regex to require special chars to match if it does not mention them anywhere?
 
7:47 PM
i read it as, they wanted it changed such that it would
aka "I found this regex that does x, please change it for me so it does y"
 
8:05 PM
well, it doesn't prevent me from explaining what it does, doesn't it? :)
 
8:28 PM
> How to implement conditional logic in html
!! <div> or <span>
 
<span>
 
 
2 hours later…
10:34 PM
 

« first day (4267 days earlier)      last day (683 days later) »