« first day (3551 days earlier)      last day (1380 days later) » 

12:37 AM
yo guys this is my first js script, and I don't know why it ain't working :(
 
@PedroSpinola 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.
 
tried using onclick, onchange and oninput already
 
@paul23 whats wrong with raw sql?
 
1:03 AM
posted a Question (can't delete here)
 
1:59 AM
@JBis It's terrible. In no way does "raw sql" describe a shape that is perfectly fine being described as objects.
Say I have a "housekeeper" object, which has a certain amount (could be zero) of pets. Each pet has a favourite food.
Now I wish to load this whole graph
I'd do something like:
SELECT *
FROM "housekeeper"
LEFT JOIN animal
ON "animal".master = "housekeeper".pet
LEFT JOIN meal
ON "meal".animal = "animal".id
(I've left out any join tables as they'd be inserted)
the returning data is not an object structure, it's in the form of a table
first_housekeeper_name, first_housekeeper_id, animal_first_id, animal_first_*, meal_first_*
first_housekeeper_name, first_housekeeper_id, animal_first_id, animal_first_*, meal_second_*
first_housekeeper_name, first_housekeeper_id, animal_second_id, animal_second_*, meal_second_*
first_housekeeper_name, first_housekeeper_id, animal_second_id, animal_second_*, meal_second_*
...
And this is with a one-to-many relationship. many-to-many gets even more "complicated". With lots of random references everywhere.
And then you need to try to move that into a neat object, which would just look like:
{
    name: first_housekeeper_name,
    id: first_housekeeper_id,
    animals: [{
        id: animal_first_id,
        meals: [{
            id:
        }, {
            id:
        }]
    }]
}
 
@paul23 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
 
A good orm will optimize the queries so will actually be faster than sending native sql - just like how C++ writes faster assembly than I (or you) can do...
And while this is true in sqlalchemy and entity framework.. I have not found any javascript orm that is any good or feature complete like those orms.
Now I hear you say "make it yourself" -> but that's way way way too much work. I know sqlalchemy was (is?) funded by python consortium to pay for several full time devs. And entity framework as written by microsoft as part of .net framework. javascript seems to lack here, where are the big players like nodejs/chromium?
 
2:20 AM
@paul23 doubtful. And people who know assembly can optimize it more then C++ compiler can.
@paul23 can you just port the c# over to js?
 
@JBis that's not true, I think no one nowadays wishes to take that one for any sizeable program. Optimize small chunks sure: but optimizing a program is hard. Which is the point I try to make. ORM's can take advantage of knowing the whole datastructure and technology, and then optimize queries in such a way they are faster (joins vs subqueries etc).
Porting over isn't really possible when the whole company is javascript based. But that's kind of besides the point, you chose a language not for the libraries (or you shouldn't).
I really really wonder why so many half-baked orms are found on npm, all have neat things indeed: but there's not a real polished result that is just... complete for the lack of a better word.
 
2:38 AM
Partly because there is no such thing as "complete" in the software world? To be honest, development cost. When no one pays you to "complete" a project, you move on to whatever your want to work on.
 
@paul23 Wdym?
just make your own ORM by porting the c#
 
Oh you mean porting entity framework?
Pleas supply me a team of ~10 man and 2-5 years of food. I'll be back then :)
A good orm is one of the most time consuming things to create, which is why it makes sense to look for one.
 
Ok I got it
Make a c# evaluator and just embed c# in your js code
 
You're joking right?
 
2:54 AM
We need such a project. Good luck! I won't blame you if you started it but don't finish it, no worry. Welcome to Open Source!
Actually, I was looking for a JS evaluator on C# not that long ago... eventually gave up and go "C# scripting" by Roslyn, supported by about 10MB of minimal dlls.
 
 
5 hours later…
USM
7:41 AM
In Chrome, Formdata displays the uploaded file content.
We use the blob data to append and hit Rest API
Anything wrong?
 
 
2 hours later…
dhS
9:38 AM
hey
i have DT1506202028 as the number
i need to delete last two digits
and i am passing itin jquery as <td th:text="${hdata[2]}"></td>
can anyone know how to solve this ?///
 
substring
what language is that? java?
 
looks like thymeleaf
 
^
 
10:05 AM
no idea what that is
is that new? (watch it be something as old as python)
 
that html template tool existed for years
usually used in Java env
like C# has Razor engine for rendering html
 
like vue or angular
or cshtml
 
dhS
@Wietlol yes
it is thymeleaf
table data
 
USM
11:11 AM
Guys, Any Idea Why Does Chrome Displays the File Content in Form Data
 
 
2 hours later…
12:45 PM
class Blinker{
    constructor(color,times,opc){
        this.color = color;
        this.times = times;
        this.opc = opc;
    }
    blinkIt(){

            this.opc.switchLight(isOn,this.color);
                   }
}
opc = new OPC();
opc.main();
setTimeout(function(){
    console.log("This is OPC", opc)
    let yellowBlinker = new Blinker("Yellow",10, opc);
    yellowBlinker.blinkIt();
},6000)
>>> this.opc.switchLight(isOn,this.color);
TypeError: Cannot read property 'switchLight' of undefined
but the "this is OPC" opc is not undefined
hmm
 
🤔
is that pseudo code or for real?
@Suisse const opc = new OPC(); is something I would expect
 
1:02 PM
@KarelG it is real.. o_o
just because of the const word??
why is this.opc undefined in the blinker class?
 
you did not use const or let or even var ?
 
I mean shortly before I give opc over to blinker; I console.log it and it is there
 
so that means you're putting it in the global state?
 
yes
its in the main.js, one file
 
and you're ok with that?
 
1:04 PM
at the moment yes
 
other code might influence that
 
I mean that does not solve the problem why opc is undefined in the Blinker class :/
 
on the same file, in other files, in other script tags, ect
 
hm aha
 
if you have cleared the reference somewhere, then it's not defined after that
use const by default lol
 
1:05 PM
ok ok now I am using it hehe
 
 
2 hours later…
3:10 PM
Hi. We have an app that implement oauth2. Its an authorization service. What to do if I want to make an openid connect provider out of it?
 
3:21 PM
@paul23 Yes XD
 
4:19 PM
y'all how do you guys typescript up event handlers?
 
Hye this has me stumped:
0
Q: typescript add local import only for development

paul23Well I have some file that contains some data for easier testing. The file is not included on git and hence only exist in local. -- the program should run fine if the file is missing. Given the whole code to call these imports won't be used on development. function AppDev() { const conn = new F...

 
don't import it
you can't really do what you want i don't think
your trying to dynamically import something on the frontend
thats not gonna work i don't think
 
4:49 PM
hello guys, need a help on TypeORM, what is the way to select a column with alias name, something like select id as userid ?
 
@ShofiqulAlam 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 have already posted the question ,
here is the link.
https://stackoverflow.com/questions/62760579/typeorm-select-alias-of-column-name
 
user8729657
5:22 PM
@JBis, I went to the doctor to request my medical history because I din't feel comfortable about them having it, and I got it from the receptionist and went home and then the doctor called me and said he's calling the police on me because I forcefully took the document.
 
user8729657
I'm going back to Africa, tbh.
 
ok
lol
 
user8729657
:)
 
5:52 PM
🚽
 
@JBis well then how would you do this? I have some "data" that i provide to the application only during development
but that is not included in produciton.
or on the git, so tests (which still run as development) don't have access to that data - so they will fallback
 
6:10 PM
Depending on what you want to do, you can store them in environment variables
Also don't import, I would use fs module
 
 
2 hours later…
8:03 PM
the 2020 moderator election primary has begun
4
 
 
3 hours later…
10:50 PM
 

« first day (3551 days earlier)      last day (1380 days later) »