« first day (3421 days earlier)      last day (1510 days later) » 
01:00 - 20:0020:00 - 00:00

1:43 AM
Hey there~! This isn't that hard to do actually, I can help you with this. Want to hop on a quick screenshare call on hopps.io and I can walk you through it? — aamirl 3 mins ago
 
2:42 AM
how can an "sql update" cause and "duplicate key" exception? it has to be the ORM framework misunderstanding the actual error right?

its running: "update name="john" where id =1" where id is a primary key
there is no way this can be a duplicate key (I even selected the records by the id and there is only one as it should)
Isn’t that straight up illogical?
 
2:56 AM
@FelipeOliveira unless name is unique or primary key is an aggregate
 
@JBis on the schema, it is not a aggregate key, but sequelize could be doing something like that under the hood:

message: "Violation of PRIMARY KEY constraint 'PK_MessageR_90C782F1DD47E2A5'. Cannot insert duplicate key in object 'dbo.MessageReactions'. The duplicate key value is (CNAA1, 17334.2, congratulations test, UNVCA1).",
it does sound like an aggregate key problem, but the funny thing is "congratulations test" does not exist in the database, it was something i change right before updating to test it out
 
can you access the db directly and check what PK_MessageR_90C782F1DD47E2A5 is?
 
I cant really, but I will rely on the DBA to do that, I just needed someone to tell me im not crazy or not seeing something obvious
 
out of curiosity what ORM framework are you uisng?
 
that happens sometimes lol thanks a lot!
sequelize
accessing mysql on azure
 
3:05 AM
its def aggregate
@FelipeOliveira try putting a random number or something to make sure
 
that is what I did witht he "congratulations test", but I will try again with something even more random
to see how it goes
 
any chance you are inserting it twice accidentally?
 
very unlikely since im inside a loop and I only have one model.save() in this loop, even if in the next iteration the same record executes, it should just update
also, that is an isolated problem, a lot of other records update just fine
 
maybe add a breakpoint at the line and see how many times you hit it?
 
hmmmm good idea, gonna try it
also, tried putting a random value in one of the fields that are part of the aggregate key, but no good
still trigers the duplicate key exception
 
Rob
3:18 AM
'congratulations test' doesn't look like the key. 'CNAA1' is probably the problem
 
The error message format indicates it is somehow
but i'd agree
 
Rob
Where? It just says there's a duplicate key?
And also... at the start you said it's doing an update, but that error is an insert
 
The duplicate key value is (CNAA1, 17334.2, congratulations test, UNVCA1). is it not suggesting all the values here are the duplicate key
 
Rob
No, I don't think it is. That's probably just the entire row being inserted
 
@Rob exactly what is bugging me, an update cannot throw such an error... I turned the log in console.log and it is indeed running an update after I do the "model.save()"
 
3:21 AM
If you look online at that error's syntax it only includes things that are in the primary key
> Violation of PRIMARY KEY constraint 'PK_AC_Shipping_Addresses'. Cannot insert duplicate key in object 'dbo.AC_Shipping_Addresses'. The duplicate key value is (165863).
> Msg 2627, Level 14, State 1, Line 10
Violation of PRIMARY KEY constraint 'PK__Table_1__3214EC27204DF2A8'. Cannot insert duplicate key in object 'dbo.Table_1'. The duplicate key value is (2).
 
Rob
Curious...
Seems you're right
And if there's nothing in the database with that field, then perhaps it's inserting two records in a transaction, and rolling back on the failure
 
it really could be that
 
Rob
Could have sworn mysql showed the entire row on failure. I might be going crazy after all
 
im trying to check right now how many times the save method is being called
 
i think it does on most failures just not pk ones
 
Rob
3:26 AM
I suppose it does make sense to only show the key
 
tbh, i don't like aggregate PK's anyway. Just a straight auto incremental integer.
 
yeah, I'm not sure how the dba created it, because in the orm it is only set to have to PKs and not an aggregate key with all fields how the exception is pointing
he probably did that in the database side
Im gonna post here the code block, but all in all im gonna ask to check to PK content
 
@FelipeOliveira 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
 
let messageReaction = await MessageReactions.findOne({ where: { source_channel_id: soueceChannnelId, message_ts: slackMessage.ts, user_id: userId }});
if (messageReaction == null) {
    messageReaction = new MessageReactions();
}

messageReaction.source_channel_id = soueceChannnelId;
messageReaction.message_ts = message.ts;
messageReaction.name = reaction.name;

messageReaction.user_id = userId;

await messageReaction.save({ transaction: transaction });
 
1 message moved to Trash can
 
3:31 AM
this code works fine for both insert and update for many other records, it is only one triggering the problem
 
Rob
3:47 AM
What is 'message_ts'? Your searching by slackMessage.ts but updating to message.ts. Is that intended?
 
4:04 AM
@Rob I think it is intended, this is an "edit" message functionality. So I find the message by it's previous timestamp (ts) and then set a new timestamp when I'm editing the message attributes
Im gonna check it just in case! but it makes sense to me giving the context
 
Rob
Hmm, makes sense. Perhaps you're processing two messages sent at the same time by the same user, in the same room?
Is there no concept of a message id in slack?
Oh, actually, there could be two different messages posted at any time, by one user in one channel. If message.ts is the same for the update, they could end up having the same timestamp when you try to save
Bunch of ways it could go wrong, honestly :). Your best bet is to search the set you're processing (not just the database) for the message it's failing on
 
yeah, I was actually just doing frontend for this project so I was not the one who designed the database and backend logic, but it feels so weird to have timestamp as a key... but yes I'm gonna study the schema a little more, try to check that aggregate key and try to come to a conclusion
thanks a lot for the tips and help
really needed someone to to tell me I was not just letting something obvious go unnoticed haha
 
 
3 hours later…
7:04 AM
@JBis @Rob found the problem, the documentation was wrong... and instead it is a aggregate key, but in the sequelize model definition this key is does not contain all fields
so what happen is
besides this only bringing 1 record:

let messageReaction = await MessageReactions.findOne({ where: { source_channel_id: soueceChannnelId, message_ts: slackMessage.ts, user_id: userId }});
when I call mode.save(), since user.id is not in the aggregate key in the sequelize model (but it is in mysql aggregate key) it is trying to update the two records
and they are identical but message_ts, so when I update the timestamp of 1 of them, they become identical and a duplicate (aggregate) key happens
 
7:24 AM
besides == even though*
 
8:06 AM
Good morning guy, somemone use prime ng with angular?
 
 
1 hour later…
9:10 AM
hi good mng
 
@PrakashReddy Potlapadu 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.
 
anyone here to answer my doubt in react
 
9:52 AM
yes @PrakashReddyPotlapadu
 
@AurangzaibRana 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 hours later…
11:59 AM
@FelipeOliveira Glad you solved your problem. Overall, have you found it easier to use an ORM instead of writing queries directly?
 
JBis, I've been using an ORM since 2006 and won't go back. Now for some really complex queries (hundreds of lines of SQL), I'll do a stored proc, but ORM for everything else. (using Entity Framework as the ORM)
 
With node?
 
Ahh, sorry :)
Keep thinking C#/.NET in JS chat
 
Ah
It maybe a bit different but how do you organize your project. Do you have two separate models? One for ORM and then your real modal?
 
Yes, I do MVVM
The viewmodels are for the views and have the extra stuff (data for the select boxes, etc.)
 
12:11 PM
Where does the orm code live?
 
I have an Entities project with the orm classes
Those aren't touched unless the db changes
The vm's change
 
Could you give me an example of a method in the entities orm classes?
 
In the C# entities, there are no methods; only props that represent the columns on the db
The methods go on the VM's
 
Mornin...
 
Oh I see
 
12:15 PM
Happy Cursed Thursday
 
so the structure is stored in entities but the actual calls are in your vm?
 
Fake day here.. its a thursday people hate
 
@JBis Yes, and there's a data layer
The VM's have methods which hit the data layer, which in turn calls the entities
 
Could you give me an example of a method in the data layer?
 
Damn chat...
 
12:30 PM
@JBis WriteTransactionsAsync() writes transactions to our db for payments the user has made
 
Hey, so what if I put a variable like this into localStorage as JSON:
let variableA = {
 a : 0,
 b : 0,
 c : 0
}
And thats in localstorage
I want to add more to it
Say, I want to add the new sub variable "d : 0" to it from localStorage, is that far fetched?
Ive been trying to research how to add new variables to such objects, but I literally cant find anything
All Im seeing from that are random newbie tutorials about variables in JS
 
@Alex ah so you just pass the arguments to data layer. Makes sense. Thanks! I'm still learning about classic structures even if I'm only working in node.
 
const items = {...localStorage};
Wth
Voodoo blackmagic
 
View and VM's should be data store agnostic
 
||> var localStorage = ["a", "b", "c"]; return {...localStorage};
 
12:39 PM
@TaylorS {"0":"a","1":"b","2":"c"} Logged: ``
 
.-.
nice.
Perfect for my project
 
So data layer can later talk to Oracle instead of SQL Server, and later to MySql
 
@TaylorS doesn't window.localStorage.setItem() with the new vvariableA value work?
Or does it duplicate?
 
Im not sure
Its wierd because, well, You cant just use .push() to push a new value into the array
Besides its JSONified, so Id have to Serialize it, and then convert it to array, then push, then convert back to object, and then Stringify
Strenuous Process
 
@Alex however that would require a rewrite of the code in the data layer right?
i mean most ORM have db specific code, but some can interchange dbs without major refractors
 
12:46 PM
oH CRAP
I found something...
Object.fromEntries(array);
// { one: 1, two: 2 }
Hmm that might solve my issue
if I can create objects from arrays
that should fix it
 
I'd try c# but I don't want to be confined to using windows as a server
 
Hi guys
 
@DeathInWhite 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.
 
Rob
@JBis You don't need to be anymore
 
You can run c# on Linux? With decent performance?
 
Rob
12:52 PM
You sure can
.NET core
Haven't run into any performance issues
 
Coolio
 
C# on linux? does this include the RPi OSs?
 
Rob
Erm, not sure
 
sounds cool if it does
 
@TaylorS read the manual about localstorage ...
 
Rob
12:56 PM
But you can deploy dotnet core to raspberry pis if you replace the OS with windows UAP
 
you're using it in a wrong manner
 
Yeah that localStorage lister actually doesnt work.
 
|| mdn LocalStorage
 
^ reading time
 
12:57 PM
Ok Yeah i know all that.
But how do I List items
list EVERYTHING
 
no you don't
> you're using it in a wrong manner
 
Ive read every word of that page many times
Dont really know what else ya expect me to do
 
then you don't comprehend it
check the docs of each methods individually
there are 5 of it
should not take a lot time
 
I Do. Not.. Care... about.... the METHODS.

Im asking if its possible to List the items in the localStorage database
Actually, that lister DOES work
Im not using it correctly.
 
i'm sure it wasn't your intention but "I Do. Not.. Care... about.... the METHODS." comes off as a bit rude, especially when people are trying to help you.
 
1:02 PM
Sorry, grouchy today
Cursed Thursday... sigh
 
@TaylorS those methods are exactly what you are using anyways. So if you don't care about it then yeah, I won't blame you for not attempting to comprehend its intend.
it's like you are holding a screw but you don't know what to do with it
 
But Im holding such screw, not knowing what to do with it, yet still being able to use it.
 
I see it in this way: you're trying to screw a nail.
 
Ok.. as a person whos done structural engineering, and woodwork at home, that makes me sad to even see that sentence
Its working the way I wrote it and wanted it to
so obviously I must be doing SOMETHING, whether I understand the deep meaning or not...
 
@JBis in my first two or three years of programng I was also doing a lot of work with data as I worked in a business intelligence department, so I really like the controll I have with writing my own queries
depends a lot on the ORM though
I remember that when I worked with mongoose, it allowed me to either use premade methods like findOne(), save(), etc. Or use a querying system they have that could do a lot
not the same level as writing queries directly, but good enough I ddin`t miss writing my own queries
I'm not sure how squelize deal with those, I remember that writing your own queries was a pain in Hibernate (Java) and I really didn't like relying on the ORM since you had to create a bund of useless classes just to have the right relationship in your system
javascript oriented orms seem to be much better though!
 
1:11 PM
@FelipeOliveira custom queries and Hibernate does not go together very well
(I even made a decision to ditch it)
that project I have been working on had two db accessing models, hibernate and via a plain jdbc adapter
 
@KarelG yes, I remember I had to spend hours doing all those different configurations, creating classes, using all types of annotations and it would always end in some kind of bug and a very complex code
 
that let to convulated code with double DAO's or even a single DAO that combines both worlds
 
That is a good idea, when you just want to do simple stuff hibernate is alright
but anything with more than two joins... it`s such a pain
 
lol...
savin files in localstorage
Is that a good idea?
or should I just use IndexedDB
Localstorage is easier and more supported.
IndexedDB seems like more of a modern solution
 
@FelipeOliveira interesting. Thanks for the info.
 
1:20 PM
I just realised... this sounds extremely dumb... but what if I based my entire project's variables off sessionStorage..
Variables begone... and use Session Storage to hold and retrieve values
lol
 
@TaylorS consider HTML5's FileSystem API
 
Yes?
Ah Shoot...
Ah oh wells.. that textbook is probably 100 mb or something SMH
 
@JBis Yes, at least some re-write. There are those who argue for pure ANSI SQL so that it can hit any of the RDBMS's and work fine
In my case, I'm not a fanatic. Just change the code in data layer and the rest of the app shouldn't care
 
no problem :) @JBis
 
Entity Framework also works w/ Oracle
 
1:30 PM
@TaylorS read the four bullets shown in the sessionStorage docs
it's same story here: read the damn docs.
 
ive read the damn docs. Forgot the period*
:I
 
1:52 PM
https://codepen.io/SkylerSpark/pen/BaNWPwz There, finished my crappy emulated self-database...

Stores images and files in the localstorage.

For now I just made an example that places images in the body, and then when you refresh, itll stay there
:3
 
2:11 PM
Im bored... im going to go make a code mirror editor that saves everything
Cya
 
2:45 PM
Hey
how should you ask HR about covering relocation costs?
 
@BrianJ you should ask the folks at workplace.stackexchange.com or search your question there. You'd get better advice than in here.
 
Cheers mate
 
3:30 PM
var currentActiveTab = $('#tab-my-enrollment-tasks').attr('class');
if I console.log(currentActiveTab);
i am getting undefined
why is that
 
How can I type npm install and have server/package.json also get installed only if server/node_modules is not present?
 
4:12 PM
104
Q: The best way to run npm install for nested folders?

WHITECOLORWhat is the most correct way to install npm packages in nested sub folders? my-app /my-sub-module package.json package.json What is the best way to have packages in /my-sub-module be installed automatically when npm install run in my-app?

the second of your requirements isn't covered by this question, but, what harm is there in letting it install again anyway
 
@DimitriKopriwa doesn't lerna do this for you
 
i mean, i'm sure there's a plugin for everything
 
I'd suggest using lerna. Its super simple.
setup takes lets than 5 min and it works very well
 
how long does it take to type into the package.json
lol
 
some people are slow typers ;)
 
4:15 PM
copy paste
 
@KevinB hi đźš˝
@JBis fyi, if you have a project with multiple packages that aren't used as dependencies, then something is wrong IMO
it's like you have a project with multiple "solutions"
 
4:46 PM
 
5:00 PM
Hi guys
 
@Md.Tahazzot 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.
 
I need some help
 
o/
 
o/
 
5:04 PM
Guys
help me to find out a solution, stackoverflow.com/questions/60437697/…
 
you better share your code via codesandbox, jsFiddle or codepen
 
in Discussion between Md. Tahazzot and j08691, 10 mins ago, by Md. Tahazzot
I don't even write any js code, Even I have no idea that how can I do that. (Do you understand me?)
we aren't a code writing service, you must try to write some code
 
Morning
 
Night
 
Hey fellas; I'm having a problem with my google-fu; I can't seem to find a list of events from vue-router. What I wanted to know if there's any way I could hook to a "onNavigationEnd" event _from a router-view component (so, hooking to the events of that child route)
 
5:10 PM
@JBis I write code a lot for other actions not for this one. I already search for this from 3 days but find out no solution. Without any idea this is not possible to write something for this action.
 
@JBis Don't get me wrong, but some guys cut&paste their freelancing project details to SO. I found it very disturbing. Without single line of code, they are asking how to do this, how to do that? Just like in Freelancer.com :D
 
but im .. lacking results and keywords apperently
 
@Md.Tahazzot so... presumably you have code that creates this editor and then bolds the text on click, otherwise you wouldn't have this question.
if you don't... i don't quite understand why you're asking in the first place
 
@bravemaster I can understand. (you have no idea)
 
or what kind of answer you want
because you're not gonna get a code solution without first providing some code
 
5:13 PM
It would be incredibly nice if you provided a bit of code @Md.Tahazzot
 
@KevinB just give me a small hint, not a project code or 1000 lines of code. Need a little help
 
ok
|| mdn Selection API
 
@Md.Tahazzot read that
 
@Md.Tahazzot What happens when you click on a button?
event-wise
 
5:16 PM
Guys, I am really sorry about my code. I can understand what wrong I have done. But I have not any idea how to start with. (next time I will never do like this), I like to read and write seriously! (again sorry and Thanks for support, you guys are really best)
 
@Md.Tahazzot hand over the task to those that can write js?
there is no shame in not having knowledge of tech X
you don't have to ask me to write in angularJS (a javascript framework) I have colleagues for that.
 
@Md.Tahazzot have you even tried to look online or search for similar questions on SO first? I believe there are some.
 
@Unbreachable You can think that, But I really read a lot on google, youtube, stackoverflow, FB group etc.
 
@Md.Tahazzot did you read what i sent?
 
@Md.Tahazzot I think you should save start and end index of the selected text. And after B or I button is clicked, you need to select that text again with stored indices.
 
5:20 PM
Reading...
 
Well, there are actually a lot of recourses out there, not sure if you actually do.
 
Because I think it's inevitable to lose focus when other button is clicked.
 
@bravemaster I also thinking about this.
 
that's a solvable problem
 
and if I end up not having a onNavigationEnd on vueRouter, how bad would it be if I just write a plugin that overrides $router with a proxy of mine that "has" these revents?
 
@Md.Tahazzot Trust me, this will be a decent amount of javascript work. I think you need to store text(raw text you input in textarea), html(formatted text by editor), selected_start_index, selected_end_index, etc. and bind various events(selected on textarea, click on B, click on I) and much more.
@Md.Tahazzot At least, you need to give some effort with JS and share what you've done so far. Not many people are kind enough to write all the code for you. :)
 
heh, honestly? I'd have no problem writing that for him if it were in a "play language" (mIRC Scripting comes to mind)
 
@bravemaster I knew that as a helpless person. I am trying to solve this now.
 
That's what doesn't make sense to me
what are you trying to solve, if you don't have code that creates the problem
 
other than that, brave already gave you all they keywords you need to be happy @Md
 
5:32 PM
Who ever is staring, those are public, please stop :)
 
Morning
 
Morning
 
yo
 
đźš˝
 
@MoshMage I don't understand your joke--- :) What is play language? :)
 
5:34 PM
._.
 
languages you program in for fun that have no viable commercial use ?
 
morning frorrest o/
 
How's it going
Seems like there's some weird conversation going on here
 
this about sums it up
27 mins ago, by JBis
in Discussion between Md. Tahazzot and j08691, 10 mins ago, by Md. Tahazzot
I don't even write any js code, Even I have no idea that how can I do that. (Do you understand me?)
 
classic
 
5:35 PM
@MoshMage So why don't you go ahead and write some code for helpless @Md.Tahazzot? It'd be great if you share it with us. I don't have much time for do that, for I'm currently engaged in paid project. Just here for chilling out :)
 
@bravemaster because js is mine, and many, bread and butter aaaan- i just saw what you did there. damn you x)
 
-1
Q: Good project structure for build REST API

BlackjackI wanna start build a RESTAPI project with expressjs, sequelize as ORM and SQL Server as database. I confuse how to set my project structure, I've read many articles and got points like: Use 3 layers (Controller, Service, Data Access Layer), Use ORM like Sequelize, JSDoc for documentation. I ...

 
Oh hello guys, Stop talking about my problem. I don't need any hints or help from you guys. ( I don't think so that you guys are like this ) "Some better person don't try to understand a beginner person and One day they will understand that"
 
@Md.Tahazzot Now you get it. Congrats!
 
@bravemaster You are a good person :)
 
5:45 PM
are you guys real
what is going on
you're talking like robots, or people in a dream
is this one of those five-layers-of-google-translate conversations
 
@forresthopkinsa hey, don't insult google translate like that
 
This has to be a cipher or something
 
@forresthopkinsa This room is not for peoples but for bots :)
 
5:51 PM
[] == ""
[[]] == ""
[] != [[]]
bravemaster_bot: yawning...
 
@bravemaster What project you doing now?
 
because the third condition doesn't coerce the arrays
but that's clever
 
lol
 
I'm a bot and can still speak perfect english, whats your excuse?
 
5:54 PM
@Md.Tahazzot Try to integrate Stripe Subscription to Laravel Backend. I'm just fed up with this project. 5+ developers previously worked on this one. And they all dumped f*cking errors and obfuscated codes to me.
 
@bravemaster Oops! Take a 30m break for coffee. Work is not Life :) (it's a part of our life, we forgot about it after a while)
 
@bravemaster Every problem has a solution === true (So, don't worry)
 
@bravemaster This called Life ;)
 
6:00 PM
the star feature is not meant to be used as a "like" feature. Please respect it.
 
@KarelG useful/ interesting got it?
 
@Md.Tahazzot ROFL
 
@bravemaster Can you give your Facebook id, Brother? (if you want, I am not forcing you)
 
@Md.Tahazzot Sadly I haven't any - look where I'm from.
 
@bravemaster OOk :(
 
6:35 PM
I swear we're witnessing two Russian agents communicate by indecipherable code
 
damn commi's
 
nowhere is safe
 
our star board is being ruined :'(
 
Putin is behind it
 
He said he isn't. We should probably trust him.
 
6:42 PM
oh ok
 
7:14 PM
And you two are FBI agents?
XD
 
@bravemaster if we told you, we would have to kill you
 
user8729657
I'd be very disappointed if you two where agent's :(
 
why
 
@JBis I've never thought I'd be killed in SO javascript chatting room. :D
 
user8729657
I don't want it to look like I'm cooperating @KevinB
 
user8729657
7:26 PM
That's bad for business
 
7:44 PM
@forresthopkinsa Relating to our teachers debate, here's a really good article on what Bloomberg did for NYC. brooklyneagle.com/articles/2019/11/25/…
 
-1
Q: Images not showing up in Javascript

Garrett Lee MorrisonThis is supposed to be a dice game where 2 people click to roll dice and they add what they get until they reach the goal. Their score resets if they roll over 9 though. Images of dice are supposed to pop up and show what they rolled. I know the images are not on here but it still shows that ther...

 
user8729657
Are .ru and .cn domain's blocked for North America?
 
@OvieTrix I do not believe america has any blocked domains
relatively open country
 
nothings blocked for US
 
you can visit stuff from Canada to Russia no probs
etc
sorry if english is bad rn, hand 1 is busy holding inch thick chocolate bar
 
user8729657
7:56 PM
Lol
 
I have a whole pound of chocolate, cheap too, its a chocolate coating made for Home Made Almond Bark, but Im just eating it like hesheys
cant eat through whole piece at once, hurts teeth lol
just ofund this... I think earlier I was trying to copy codepen.. write codepen inside codepen... from scratch
wtf
what was I doin lol
const $ = document.querySelector.bind(document);
const $$ = document.querySelectorAll.bind(document);
nvm lol i remember making this
I was sleepy in class
and thought "lets make codepen in codepen"
 
01:00 - 20:0020:00 - 00:00

« first day (3421 days earlier)      last day (1510 days later) »