« first day (3422 days earlier)      last day (1509 days later) » 

1:31 AM
@JBis interesting article, I agree with a lot of those tactics
 
1:46 AM
hmm where/how to store that you have new "replies" in a contact message/"thread"? I could put it in a cookie, however then any user on the pc can see for any other user which threads he's using?
What do other websites use to calculate if there is a new reply?
 
2:08 AM
Just have a table "new-messages" with a foreign key to messages and user. When a message is sent/replies. Add it there. When it's read, remove it.
@paul23
 
Hmm that would add a small utility function upon opening in browser (message sending to end user doesn't mean he actually opens it, it might be sent for a different reason).
 
2:31 AM
@paul23 well I assume this is like a messaging app in which case once they click on a thread all messages become read
 
It's for a store :P - to handle contact forms between customers and (third party) sellers.
 
Yeah, so once they open in browser (if window becomes focused if it's blurred) you send an Ajax request to update the new message table
@forresthopkinsa Yeah. Teacher union wayyyy too strong on NY.
Really unfortunate because I think it hurts kids the most.
 
 
2 hours later…
5:02 AM
lol sometimes I get some errors that bug my mind, now I am getting an error that says I have a duplicate value in my aggregate key, and right bellow the same log tells me the value is not the same
"Violation of PRIMARY KEY constraint 'PK__MessageR__90C782F1DD47E2A5'. Cannot insert duplicate key in object 'dbo.MessageReactions'. The duplicate key value is (CNEB89Q10, 17334.2, congratulations, UPHTFUFHV)."
'INSERT INTO [MessageReactions] ([source_channel_id],[message_ts],[name],[user_id],[created_at],[modified_at]) OUTPUT INSERTED.* VALUES (@0,@1,@2,@3,@4,@5);',
    parameters: {
      '0': 'CNEB89Q10',
      '1': 1580349899.0085,
      '2': 'congratulations',
      '3': 'UPHTFUFHV',
      '4': '2020-02-28 13:26:40.231 +09:00',
      '5': '2020-02-28 13:26:40.231 +09:00'
    }
the param @1 is 1580349899.0085 but my exception says it is 17334.2 what the ...
and I am 100% sure there is no such value with 1580349899.0085 in my database
 
 
3 hours later…
7:37 AM
table.js:1630 Resource interpreted as Document but transferred with MIME type application/octet-stream:
 
8:03 AM
I am facing a warning like this... what I am supposed to do lot of stackoverflow gives a lot of answers... which one is correct.
 
8:54 AM
your web server is serving it with the wrong header
 
0
Q: connect to 2nd socket if 1st socket got error electron.js

underscoreI'm writing electron application and it's need to be connected to backend layer through a socket connection. The logic is if 1st socket connect, use it but if 1st socket is disconnected try 2nd and so on. I have implemeneted it like bellow but seems it's connect to 1st and 2nd ip both. let Main1...

does anybody knowplease take a look
 
9:59 AM
@BenjaminGruenbaum Hey Benjamin, why are promises forcibly asynchronous? Is it because they are eager?
 
@BenFortune - so no fix is required from my end.
 
@AaditMShah promises are not "eager"
Promises are just "push", a promise is already a value.
You could look at promises as eager with the alternative being "then" invoking the action - but I don't like that mental model since it doesn't look at promises as a value.
Promises are a value, values are just values. A promise already happened.
 
@AaditMShah they're not necessarily asynchronous
 
Also, promises are not forcibly asynchronous. Promises are entirely synchronous. It's reacting to promises that's asynchronous.
Promises can be created and settled entirely synchronously. If you want to react to a promise that's always asynchronous. The reason is to stop race conditions.
// what's the output of this code?
console.log(1);
someFunction((err, data) => console.log(2);
console.log(3);
With promises and someFunction().then(() => console.log(2)) the code would always log 1,3,2
 
10:23 AM
hmm not sure if I agree with that statement
> Promises are a value, values are just values. A promise already happened.
you have pending promises as well.
they don't have a value until it's finished
or if something went wrong, it got rejected. But you can see those reject value (see) as value as well
 
A promise is just a value over time. From the consumer side, you are just waiting for it not invoking it.
You have no control over the actual thing happening.
 
yes. that's correct. I did not have seen it by that way yet
 
I suppose even a value representing an unresolved value is still a value
 
matter of perspective :P
 
even null is a value in a way
just a very stubborn and uncooperative value
 
10:43 AM
I'm now coding without using null in Java
Optional is an useful class for it. But it's a gimmick.
 
would be better if they had done like Kotlin, but I suppose they didn't have the oversight to do so at the time it was made
Optional is a decent alternative
 
10:56 AM
Morning
 
11:36 AM
null is just a dummy object
> Dummy objects are passed around but never actually used. Usually they are just used to fill parameter lists.
dummy objects often just throw exceptions when you use them which should tell the developer that he shouldnt use a dummy object there, or his assumption of his code is wrong
null would throw a NullPointerException or NullReferenceException or whatever they are called
 
@BenjaminGruenbaum Got it. Anyway, if a promise is already resolved then why can't we react to it synchronously? Is it for the sake of consistency?
 
Morning all! o/
 
Hi JBis
 
I think I understood what you're trying to say.

```
console.log("before");
Promise.resolve("resolved").then(console.log);
console.log("after");
```

This should print "before", "after", and then "resolved".
However, what if I want it to print "before", "resolved", and then "after"?
It's not possible to do that.
 
12:14 PM
morning.
Hello everyone... programmers... vampires... watchers. etc
@user229044 Im curious, I saw you before, why havent ya decided to make a username
 
Vampires? raises hand
 
oh i forgot
the copy pastas too
the ones who just copy + paste = skill
;)
 
Copy/paste is a skill too, ya know :p
 
,__,
The only time I copy pasta is useful utility codes, and also Biomedical Technology definitions... Biomed class is a PAIN IN THE ARSEROONIE
ok im bored, going to go find something to do smh lol
 
@AaditMShah you would need to await it in an async function
 (async () => {

     console.log("before");
     await Promise.resolve("resolved").then(console.log);
     console.log("after");
})()
 
12:22 PM
How we detect keypad is open or close in mobile devices.
is any function for that
 
@JBis {} Logged: "before"
 
Google is your friend ;)
it may not seem like it, but google is smart, if you ask a detailed question youd ask to your fellow human, its pretty good at finding results
meanwhile many people like search ex: "How cook Chicken" and its tough finding results with more complex questions
 
should question comments and answers comments be two seperate table or have two columns in the "comments" table and have one be null depending on if its a question or answer?
 
JBis... my bias says Id have em like Stack's style, two seperate tables
one with rows for comments below
 
Nulls should be avoided for normalization
 
12:26 PM
one for the answer above
oh are you asking for like... data storage design?
im not the one for that.
 
Why not have a comment type table and then same table for comments but have the type in the column
 
@TaylorS i have tried many times with lots of code, but fail then i asked the question from here.
thanks
 
1. That requires an extra join
2. You can't do foreign key checks
 
alright raheel
 
Might have come in on the tail of that
Why no FKs? Which system?
 
12:29 PM
comments table would have a foreign key to either an answer or a question but if its in the same column you can't do a foreign key constraint to two tables
 
Ahhh
Yeah, go with two tables
 
alright, darn
 
What's your other tables that use the comments?
 
none
 
Just wanna make sure I'm not leading you astray
 
12:32 PM
@RaheelAslam Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq. You have 25 seconds to edit and format your message properly before it will be removed. Please separate code blocks from your actual question. Put your question in 1 message and then your code in a 2nd and format it.
For posting large code blocks, use a paste site like like gist.github.com, hastebin.com, pastie.org or a demo site like jsbin.com
 
Hmm. You'd have to merge the question/answer tables into one to use one comments table
Not ideal
 
1 message moved to Trash can
 
if(/Android/.test(navigator.appVersion)) {

$(document).ready(function(){
$('input').bind('focus',function() {
$(window).scrollTop(10);
var keyboard_shown = $(window).scrollTop() > 0;
$(window).scrollTop(0);

let check =keyboard_shown ? 'keyboard ':'nokeyboard '
alert(check);
});
});
window.addEventListener("resize", function() {

$("body").removeClass("absolute_header");

if(document.activeElement.tagName=="INPUT" || document.activeElement.tagName=="TEXTAREA") {

document.activeElement.scrollIntoView({ behavior: 'smooth'});
@TaylorS
 
@Alex Yeah I'll just go with two tables and deal with it. Just means an extra query when loading the page.
 
Step 0 of programming: we won't get it right immediately. We'll iterate and improve it
in WPF, May 8 '18 at 18:46, by BradleyDotNET
The 0th step in programming is realizing you aren't going to get it right the first time, so stop trying and write some code
 
12:39 PM
@TaylorS have you seen?
 
no, I didnt
I was working on a side project
gtg
 
@AaditMShah for the sake of having deterministic order.
@AaditMShah that is quite intentional and by design.
The consumer shouldn't have to care
 
back.
:I
Got yelled at for programming
because I missed 2 platos... just 2 stupid platos in 1 class
:L
 
Benji o/
 
Gotta love adults who dont program
they dont understand the kind of happiness it gives me
:P
"Your plato grade doesnt improve, ill have to call home" RIP lol
anyone else get tore up for programming
oh who am I kidding, yall are all experts and adults
'well the most of you I know are
 
12:55 PM
@TaylorS Follow your passion in life
I've been shredded by bosses/teachers/people
But I'm still here
And... I'm no expert and still feel like I'm not an adult
 
I tend to judge peoples experience by their stack rep
A LOT of programmers use it
and experienced individuals need an account here....
not required... but seriously
and you have 25.8k rep, thats quite some experience
I have 375, I've only been here 2 years
and I barely have experience in much
 
I think you know more about programming at your age than many adult programmers
Plus you're enjoying it
 
1:11 PM
I love it
 
Keep going and you'll discover you'll get places most people can only dream of
That's it -- pursue your love in life
 
Alex, I know more about programming at my age than many Vanilla Adults.. As for adult programmers? I dont even write beautiful JS, which is the language I know the most of lol
I write better looking C# than JS, probably because everything is small and simple and VS helps me write it
 
We're our own worst critics
Impostor syndrome affects us all
 
I guess
Im not very confident
but I have tons of self esteem, and I spend it all on programming
idc what the adults say, Ill enjoy it to the end of my days
 
@TaylorS Don't really see the value in having my SO profile linked to my real-world identity anymore
 
1:13 PM
Neither am I but I keep goin' :)
 
@user229044 I guess so, but still, coulda named yourself SimpleModerator or atleast 2 words or something xd
 
It was neat for a while when my coworkers stumbled across my answers in JavaScript or Ruby but anymore I'm generally uncomfortable having any kind of online presence.
 
My name, age, and even location irl has been spread too much online
it doesnt hurt me, and idrc either
 
Privacy? What's that?!
 
I live in a military town with 2 parents as government workers, Im not worried about creepers coming to my house
Privacy? well all thats to the max
no one, not even my parents know most of my login data or usernames
but, as for irl stuff, its useless hiding it
If you ever want to get big in life, whether that be becoming a millionaire
or becoming a big programmer, it requires some kind of presence I guess
otherwise no one will know you
 
1:16 PM
Excellence in all things
 
I dont want to be forgotten when i leave this world, take for example the helicopter crash that killed the celeb, no one cares about the 7 other people who died in there, only the 2 celebs
 
Do what you do to the best of your ability to serve others
That can be the legacy
 
I guess
 
I don't want people to remember me
Who cares?
Consider all the celebs of the past
 
I would rather be remembered by my family then strangers, but still, its depressing to realise that once your family is gone too, youll just be dust in the air
 
1:18 PM
The good that we do stays and never fades
Maybe I'm sentimental :]
 
Think of the big guns out there: Elvis, or just modern celebs like JB, Swift, etc, all well known by basically anyone
 
What good does it do to them to be well known?
Fame, fortune, power
Trappings of our existence
 
@Alex dont worry, I have 2 stuffed animals my mother passed down to me.

I might not care about physical things, but they still have sentimental value
Cant give up the good things
 
:D
 
@Alex well think of it like this, other than the famous people...

Think of those little kids you always see in the stories who strive to become like those people... like elvis or singers or whatnot, they are so passionate to be like them.
Thats how people want to be well known by
that others wish to go down the same path
 
1:21 PM
You're right. In that sense, they can inspire folks
 
You might be dead and gone, but that revolutionary thing still lives on
no matter what
 
Yep, an idea is the most powerful thing
It can't be contained, imprisoned, killed
 
thats why I adore the idea of becoming somewhat well known someday.
 
Nothing wrong with that
 
most kids nowadays dont give one shit about programming or computers
and its sad.
I try to inspire friends I know to get into it, and believe it or not, it works
 
1:23 PM
It is
@TaylorS I do the same
That's very good of you to do
Spark a flame in someone's heart
 
Seriously, I have a history nerd, and some other left-outs that are like good friends to me, and I talk to them about this stuff, and it makes em smile
Thats the thing I enjoy seeing
 
We're all kinda the outsiders, we devs
 
Sadly people are just so darn dang depressing
its hard to get through with some
 
People tear each other down more often than build up
And some have given up too
 
Yup...
 
1:25 PM
But you keep trying even with them
Especially the young. Inspire them to do better
 
heh, when I was younger I used to try to be friends with people who bullied me
I still respect people.

even with mistakes. Ill give them chances upon chances.
Its getting harder though
 
Yes, at some point you leave them be. Let them go down their dark path
 
people hold grudges, and as I get older, more and more of them just disrespect each other, smoke, threaten, and just curse all the time before they get arrested in highschool for smoking dope.
 
Anger, hate, jealousy, all lead to dark places
 
Ah well
its alright
most of the people screw emselves over
and live sad
you do feel bad, but its their choice
 
1:28 PM
^ true
 
I might be just a little ol' 14 year old, but I understand life better than most of the 17-20 year olds around here who act like its alright to ignore their purpose
and just give up
I really do feel so bad for everyone
 
That's maturity, not the age, which is a number
 
Sadly a lot of it is actually their parents
 
You're helping them though. You inspire them as much as you can
If a kid doesn't have someone to look up to, a mentor, they'll give up
 
One of the worser kids in my school has problems, his father has already gotten into large police reports.

we captured him on video teaching his younger brother how to ding dong ditch, before they later broke into our backyard and got reported by police for tresspassing
His little brother was like.. nervous.
Its so sad dude...
 
1:31 PM
They see parents do it so it must be all right
 
its been months since that, im sure his little brother is just as bad now
 
Yeah, another generation lost
 
pretty much
GenZ down the drain
 
We can break the cycle
Work w/ the young to give them hope, an outlet
 
yeah..

Well, hey thanks for the nice convo, I do actually have to work though
 
1:32 PM
As you do already
Me too
 
Is it better to rely on the foreign key constraints in the db to check and fail if it doesn't exist (and catch with try/catch) or to manually check the foreign key exists?
 
probably let the db do it
what you need to keep in mind is transactions and concurrency
if you check if something exists, and then you insert, it might have been deleted
or the other way around, check if something doesnt exist and then insert it, it might have been inserted in between
you need to open a transaction, do the checking inside it and apply the changes you want to make
on failure, it should fail entirely, not half way throughout the process
on top of the transactional checks, you could add more checks to avoid even try if you already know it is going to fail anyway
but those may never replace the transactional checks
and you should never assume those checks to not fail because you checked beforehand
 
1:53 PM
intersting ok thanks
 
2:20 PM
Well I noticed this codepen recreation thing I was working on yesterday and didnt really remember doing it, decided to try actually working on it.

Hows this color scheme look, is the pink on the icons too much? or should it be white https://codepen.io/SkylerSpark/full/GRJmoKq
 
@Ta
@TaylorS I agree with your gut instinct, the icons do not 'pop' enough
 
Yeah
I tried doing colors
too much match match
more brightness needed
 
I also would go white, but okay to start to shade in the red direction...
 
Hello @SterlingArcher, I see that you have open positions, I am interested to have a discussion with you on the same. Can you mail me the details at faiz.mohammed@outlook.com
 
@FaizMohammed Welcome to the JavaScript chat! Please review the room rules. If you have a question, just post it, and if anyone's free and interested they'll help. If you want to report an abusive user or a problem in this room, visit our meta.
 
2:50 PM
> You can reload your css to pick up again the new elements from your style, you can do that removing the CSS and appending it again in the DOM using Javascript
This guy is claiming CSS isn't applied to dynamically added DOM elements.
Ah, he updated the answer :P
 

« first day (3422 days earlier)      last day (1509 days later) »