« first day (2896 days earlier)      last day (2057 days later) » 

5:00 PM
I never gave a recommendation
they're all so different
 
have you ever used vue.js?
 
@JacobLett I'll help a bit. Why are you trying to use JSON for HTML templating?
 
@JacobLett no, but I'm familiar enough to know that it doesn't compare with a templating engine or a dom abstraction lib
but if you just want a suggestion, use ejs
that's my blanket suggestion for templating
 
because the data source editors are not technical and using hubspot. developers.hubspot.com/docs/methods/hubdb/hubdb_overview - and the api spits out json
I am creating a linked image carousel of logos... the authors can add logos and links in hubspot and then they are updated on the frontend without a code change
 
back
@forresthopkinsa which electron builder do u use?
 
5:12 PM
@ex080 I know you didn't ask me, but I use electron-forge
 
@DavidKamer nice I use that one too. I think forrest uses builder though.
 
electron-forge was the only one I found that had a setup of less than 10 minutes. I could be wrong though. I think I tried builder but something didn't work right on Ubuntu
 
Nice
Did u finish ur website you showed me last time?
 
This is why I didn't use it: "Yarn is strongly recommended instead of npm."
@ex080 the freelance site or the logo?
 
freelance
yarn is nice
Didn't npm have some security issue some time ago?
 
5:17 PM
Yeah, it's done. It was working last time I checked lol. I think there is still one bug on mobile though. It works but it's a little jumpy when you search when logged in on mobile.
@ex080 probably. But that's one of those things. "IT'S ADVISED YOU DON"T USE COMPUTERS. THEY HAVE BEEN COMPROMISED IN THE PAST"
yarn is next if it hasn't happened yet unless we have some sort of evidence that yarn is run by geniuses that don't have an average rate of security flaws like everyone else. They are just next in line
 
@ex080 You're thinking of someone else I think
I'm not an Electron guy
 
both tools suck. one just sucks more than the other in different places.
 
@rlemon exactly. I don't think the flaws I've seen directly relate to the environment of npm in a way that yarn will by definition do it better
 
oh nvm then
 
npm's security gap from a couple months ago was such a glaring gap though
 
5:22 PM
@forresthopkinsa what was it exactly?
 
both are terribly politically motivated companies
 
npm install post-run script collected credentials and uploaded them to a server
 
@rlemon what do they even have to benefit from it?
 
public image
 
ended up in a great-great-great-grandchild of a big project
 
5:24 PM
@forresthopkinsa whoa, that's bad.
 
yeah. Would've been a lot worse if the person executing it had been serious about it
it looked like it was an experiment
would've gone unnoticed a lot longer if the code didn't have an obvious error in it that was throwing up red flags
 
@forresthopkinsa we could solve most security issues with JavaScript repos by disallowing or marking packages as unsafe when they use ajax. There is no reason for my dependency to make an ajax request...
 
umm, there for sure is
npm install some-fetch-polyfill
 
@rlemon what like axios?
 
bam, package doing xhr for me
 
5:27 PM
yeah and that should be marked as unsafe
 
it wasn't a client-facing vulnerability though. it was an actual script that would run on developers' computers when they ran npm install
 
I disagree
that package is fine
 
since I guess npm install has a hook for running arbitrary scripts
and so when you'd npm install anything that depended on the infected package, it would gather your NPM creds and send them away
 
@rlemon yep, but buyer beware. Anything that can make an ajax request is potentially dangerous
 
so that, theoretically, the person receiving them could upload the infection to all of your public packages too
 
5:28 PM
any package you install can be potentially dangerous
you can't draw a line, because there is no place to reasonably draw it
 
@rlemon I'd argue that it's at fetch/ajax requests.
 
ofc like I mentioned, the attack was very poorly executed, so what could have been NPM armageddon ended up just being incredibly inconvenient
 
fs is a bigger concern to your machine than some network request
 
Maybe some packages could be marked safe after inspection, but anything uploaded with a fetch request is unsafe.
 
child_process
so many node apis
network requests are not an issue
 
5:29 PM
what will it do without a network connection?
 
anything it wants
 
If something gathers all of your data and can't send it anywhere it's useless as malware
 
you installed and ran third party code
@DavidKamer clearly you never got hit with a cryptolocker
there are endless attack vectors
 
@rlemon I know that, but I'm saying that those are low gain compared to information theft when considering the js ecosystem
 
I'm not saying there's nothing we can do, but blacklisting fetch/xhr/websockets/etc isn't going to magically make things better
if anything it will just piss off a bunch of people because it's listing vulns where there are none
just like how npm bitches about client security risks on my dev-deps
that's more annoying than helpful
 
5:31 PM
@rlemon Not blacklisting, but marking them so you know. you'd ask "Wow, why does my console coloring library make fetch requests???"
 
any of you guys arduino enthusiasts?
 
a few of us have experience, just ask
@DavidKamer maybe, and here's a crazy idea, maybe review a package yourself before using it???
its our responsibility, not npms
npm has enough crap to fix that is their responsibility
 
@rlemon I mean what's the point of things like travis-ci? It's because people are imperfect.
 
ok so I'm working with serial, and sending in a command:key1:value1:key2:value2 over serial. I want to create a function that will tokenize and then set key to value
strtok() would be the most low level and mem saving way to do this right?
 
I'm just saying that 90% of the security risk with their platform is that anyone could upload a dependency that uses an ajax request to relay any information to their control server. Let's just hope a starving programmer doesn't have a dependency used in Express or Mongoose
 
5:35 PM
@ex080 looks like it
 
oh and it would stop crypto mining malware, and it would arguably stop cryptolocker malware in that it would be much more predictably noticed if a network command wasn't sent to activate it. It would happen to anyone using the package meaning that it would be much more clear that the package was vulnerable.
 
1 message moved to Trash can
@ex080 Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq.
 
damn it pressed enter instead of shift enter
 
63
A: How do I split an incoming string?

jfpoilpretContrarily to other answers, I'd rather stay away from String for the following reasons: dynamic memory usage (that may quickly lead to heap fragmentation and memory exhaustion) quite slow due to construction/destruction/assignment operators In an embedded environment like Arduino (even for a...

 
@rlemon I love atoi() and itoa()
 
5:43 PM
String tokenizer(string x) {
    char *str = x.c_str();
    char *f = strtok(str,":");
    //grab command
    Serial.println(f);
    while(f != 0){
        //grab key
        f = strtok(NUL,":");
        Serial.println(f);
        //grab value
        f = strtok(NUL,":");
        Serial.println(atoi(f));
    }
}
There she is
:)
 
it's like some kind of chinese xD
 
gonna return an array of tokens
 
An opinion:
I used to use this _normal_ function to see if the current year is inside an array, if is, it's returns the current year:
const d = new Date();
const years = [2017,2018,2019,2020];

const getYear = function getYear (d) {
    let a = this.indexOf(d.getFullYear());
    return this[a];
}

const y = getYear.bind(years, d);
const year = y();
console.log(year);
but, translating to arrow function, this don't works (and I know why):
const getYear = (d) => {
    const a = this.indexOf(d.getFullYear());
    return this[a];
}
My doubt is: the only way in I can have the function getYear working with arrow syntax is:
const getYear = (years, d) => {
    const a = years.indexOf(d.getFullYear());
    return years[a];
}
???
 
@robe007 The second works for me
I think it has to do with hoisting. The second is a better pattern imo anyway
oh wait
you're using this?
 
Arrow syntax creates a lexical bind
this in both examples are different
 
5:52 PM
binding and scope work completely different with arrow functions. It's pretty complex (you can look through MDN if you have quesitons about how it actually works) but basically it behaves similar to how a function would behave with non scope of its own. Like I said, the implementation is a lot more complex, but it behaves like a bind at time of call in the calling scope
 
Yesss, I know that
 
guys
he binds it
well... kinda? your bind is fucky
 
yeah, but then it still wouldn't be this?
 
.bind(thisArg, preseedArgs...);
is how the sig should be
@robe007 show your context
i.e. the surrounding class / function
 
That's all my code
 
5:54 PM
what do you expect this to be?
 
@rlemon years
 
ohhh, I think I get what you have now
your examples need hard lines between them
:P
 
xD
 
so what would you like to do?
what style are you after?
 
just to know if the only way in I can have the function getYear working with arrow syntax without bind is to pass years as the first argument
const getYear = (years, d) => {
    const a = years.indexOf(d.getFullYear());
    return years[a];
}
 
5:57 PM
that moment when ur doing low level c and u cant do a switch on a string, because strings dont exist
 
@ex080 them linked lists have a purpose after all lol
 
Thing is my crazy boss doesn't want to buy equipment so he makes us code and test things by black box models
 
@ex080 What equipment would make it easier?
 
The actual end scientific devices.
 
const d = new Date();
const years = [2017,2018,2019,2020];

const getYear = Array.prototype.find.bind(years);

console.log( getYear( year => year === d.getFullYear() ) );
:D
who needs function keywords or arrows
 
6:01 PM
@rlemon oh god
 
for example in one of my current projects we have to code and target a measurement calibration device hooked up to an underwater drone.
he's having us simulate the comms between these devices using an arduino and PC
to test if his com scheme works
thing is the arduino only has like 2k mem where as the end device has a shit ton
 
Complicating my life, and using this with arrow functions, I ended with this:
 
so i'm having to code a lot of functionality using low level calls and pointers
 
@ex080 That's probably what he wants. If he's older he probably thinks that means that "you own the code so you can resell it" which hasn't been true since the 80's and hasn't been widely believed since 2000's
 
and works :D
function _Year(year) {
    this.year = year;
}

_Year.prototype.yearInArray = function (arr) {
    let a = arr.indexOf(this.year);
    return arr[a];
};

const _year = new _Year(d.getFullYear());
const _y = _year.yearInArray(years);
console.log(_y);
 
6:05 PM
seems like mostly pointless code
if I'm being honest
 
lemon ur right
that is what frustrates me
 
@rlemon I can't tell where that was directed lol.
 
like if u went out and bought the drone, then i could test and develop for the drone. but to expect me to develop for a device but using another device is kinda crazy
 
const d = new Date();
const years = [2017,2018,2019,2020];

function pluckYear(arr,d) {
	return arr.find( item => item === d.getFullYear() );
}

console.log( pluckYear(years, d) );
don't be afraid of passing the array
 
@ex080 just write it in C
 
6:07 PM
the overhead you're doing to not have that happen is just silly.
 
@rlemon yeah, this is a better pattern imo. It makes it reusable if you want to
 
Oh i am writing in c.
well arudino's special c/c++ fun bag of mixed goods
it gives me much appreciation for python and JS now
 
@ex080 you might be able to find a transpiler in python
 
Nah it's not worth it
mem management is too important
 
there are so many js libs that interface with arduino and serial
you can do this all in node if you wanted
the setup is like an hour tops
 
6:11 PM
Yeah but johnny five runs on ur pc
it just communicates to arduino
 
@ex080 No I'm saying compile into c code but code it in python
or javascript if you can
 
no I'm talking libs that output an image to flash to the arduino
can't remember which was that, but iirc more than one did
 
Also if i write in anything but c then i risk using up all mem because im trying to fit functionality of a full on measurement device onto an arduino lol
ill look into it later
im halfway done
using serial, flags, tokenizers, and switch statements to create an event handler like scenario
 
@ex080 yeah, if you can write something in C then you probably should if you believe what Linus Torvalds thinks lol.
 
no idea what he thinks
he made linux right?
 
6:14 PM
yeah, he basically thinks C is the only way lol
 
it is when memory is an issue.
but i do node and python mostly
but im not on god tier level like forrest or lemon
 
Dude. I'm dumb. I'm a terrible programmer
I just am loud
 
@rlemon So true
lol jk
 
if ur dumb, I'm retarded
Also I'm just kinda learning on my own, I'm actually an Electrical Engineering major lol
 
I have experience, that's it
 
6:17 PM
All i know is u have the answer to my problems most of the time lol
 
Once you've made a mistake enough times you feel like you have expertise enough to tell someone else they are making the same mistake you have.
 
honestly you seem very knowledgeable @rlemon but a lot of your code is like what you find in top libraries. I think you're god tier but I'd only know if I could read and understand it lol.
jk btw^^
there's a partial truth there
 
I do suffer from imposter syndrome, but I also know my own gaps. And they are big, and there are many of them.
 
I suffer from imposter syndrome too
Wow didn't expect that lol
 
const funcRe = (re) => re.call(re);
Wat?
 
6:19 PM
I'm not good enough to suffer from impostor syndrome.
 
instant star to kendall
 
I don't even know what imposter syndrome is
 
You feel you are not good enough to hold your current position
 
I suffer from I don't know everything syndrome
 
Oh I'm the best at what I do
 
6:20 PM
@SterlingArcher what do you do?
 
Tinder
 
Isn't that machine learning?
oh nvmind
lol
Tensor
 
I trick companies out of money by showing up everyday and sitting at my computer to type things
 
tensor is a higher dimensional abstraction of a vector
 
@SterlingArcher That is a skill!
 
6:21 PM
0
Q: How to make wave effect jquery?

Alexey10How to make such a line as on the site? https://www.sibirix.ru/ When you hover the wave. Help me please.

 
@KendallFrey Tensorflow is what I was talking about
 
@SterlingArcher Companies hate him!
 
I didn't know lemon worked at tinder
 
real talk, how much time to you spend typing vs reading
 
yeah @rlemon, hook a brother up lol jk
 
6:22 PM
i'm like 95-99% reading
 
reading is like 4x to typing
mostly looking at docs
 
yea programming requires very little actual typing
 
Also i find myself going through lots of iteration
 
that was an eye opener
 
@KendallFrey Depends on the day. I read a lot less than I used to.
 
6:23 PM
like trial and error
i do type a solid 140 wpm
 
@DavidKamer i don't mean books, i mean programming
 
@KendallFrey I'm probably in the 80-90% range
but I also delete more code than I write
much much more code
 
Do u work remote?
 
@KendallFrey probably 30% reading since I started my current project. It's not maintaining any existing code.
 
sounds nice
 
6:25 PM
anybody else like me and a different major than cs?
 
yea
n/a
does that count?
 
no
 
yeah, but I don't think very many people could do it and it's taking a lot of problem solving and special knowledge
 
ur knowledge of docs and exp make up for cs deg
 
I thought if I ever did decide to goto uni, I would take physics.
now I'm thinking maybe botany
I've got another 20 years to decide
 
6:26 PM
I'm EE and i think it's ok
 
@rlemon I've decided that I'm going to be a quant or fintech guy
 
I still don't know between physics or math
 
I think it's my niche
 
oh really david?
I'm doing a fintech project right now
 
for me uni will be for interests sake. I don't have the capability to go until I retire
so it will be for pure enjoyment
 
6:27 PM
yeah. This is my first paid job doing it, but I've made tradebots and stuff before
 
nice
 
It's kind of ironic how little code one can actually type in a day and still be insanely effective
 
@rlemon I would finish my math degree. I only need electives..
 
im working on sentiment algos
 
@DavidKamer yea but you're missing the point. if I go to uni, it's not to be more hireable.
it's because I want to know what they will be teaching
 
6:27 PM
then there is no point
 
'finishing' a degree won't really matter when I'm 55
 
uni is 10 yrs behind industry
 
@ex080 KNAWLAGE
 
lol
 
@ex080 very very heavily depends on the course you take
 
6:28 PM
I gotta go study for my software engineering exam
 
We learned jQuery before JavaScript in college
 
@rlemon oh exactly. For me it's a personal achievement thing. I can learn outside of school easier. It's more a personal goal because I don't value education as a practical thing but as a self actualizing thing.
 
!!afk
 
*education as in organized education
 
yea, clearly I don't hold education for a cert in high regards
I don't have a degree.
but like I said, I know what I can and can't learn on my own at this point
 
6:29 PM
rlemon has every w3schools certification
 
some subjects I know I will benefit from formal education
 
@rlemon I have a few degrees, and I even have far more credits than a bachelor's degree in courses that make me more valuable than the average CS major, but I never finished a bachelor's degree because I wanted to use my knowledge and I dropped out
 
I'd like to take a few math courses
Particularly trig and geometry
 
try brilliant
 
I'd like to know more about particle physics, and more about botany
 
6:31 PM
@SterlingArcher do it with analytical geometry. If you do that makes up for a lack of knowledge in every other math discipline imo.
 
I was actually considering attending one of those free MIT courses
astrophysics would also be cool since i have a space background
 
@SterlingArcher I've used that several times. Their calc 1 course was good as review before calc2
 
I would need to take a "I don't know anything beyond medium algebra/geometry" course first
 
@SterlingArcher Just play with desmos calculator.
I know that sounds idiotic to a math elitist, but it will teach you a lot if you're a coder
 
One thing I've learned is I can not self learn math
 
6:34 PM
I've taken Cal 1, Cal II, Cal III, Diff eq I, Diff eq II... and it was pointless lol (got an A in all of them) The EE textbooks recover important math concepts. It felt like ur using and applying but dont understand why it works.
 
@SterlingArcher try desmos.com/calculator
 
I failed Discrete Math in college
 
Took that too
lol
it was ok
 
@ex080 I got to Diff eq 1 and then diverged into Graph Theory and stuff like that
 
mostly logic, recursion, and big O, theta etc.. notations
 
6:35 PM
Linear algebra is fun
 
I have grade 12 calculus
\o/
 
struct set {
    String command;
    String key;
    int value;
}
or should i make set a class? :P
lol
 
6:51 PM
@rlemon What does git reset actually do? I'm confused because I've read stuff that says it unstages changes or reverts to previous commit?
 
idk, I'm bad at git
 
7:05 PM
hey all. simple question if anyone can help
 
@AlexH 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.
 
@rlemon git is probably the number one cause of imposter syndrome. I think that might even be objective and not just my opinion.
 
I mean, I'm good enough to get my work done
 
ask Alex
 
and when I do need help I can google it
 
7:06 PM
Today I had to ride the bus standing up
 
I can push, pull, commit, undo a commit, etc.
but I know there is so much more about git you can get into
 
my arms go torn from alll the accel/deccel
 
@rlemon yeah me too, but it's just one of those things that can be needlessly overcomplicated
 
I'm trying to make a JSON tree representative of our URL structure that will determine the page's title. I have a two main features I want built into this tree:
1: regex strings as key values for dynamic URLs: e.g.: "/Patient/123/Identification"
2: persist keyword so if a child URL doesn't match, but persist is present, then the title is that of the most recent persist
 
i am applying shadowBlur to an element but it is applied to everything on canvas. How can i isolate it to just my one element (a line being drawn). thanks
context.beginPath()
context.strokeStyle = this.strokeStyle;
context.lineWidth = this.lineWidth;
context.shadowBlur =30;
context.shadowColor = "gold";
context.shadowOffsetX =5;
context.shadowOffsetY =5;
context.lineJoin = this.lineJoin
context.lineCap = this.lineCap
context.moveTo(this.x,this.y)
context.lineTo(this.xx,this.yy)
context.stroke();
 
7:07 PM
const titleMap = {
    "Practice_Management": {
        "Patient": {
            toString: () => "Patient Search",
            persist: "Patients Area",
            "ViewPatientIdentification": "Patient Identification",
            "EditIdentification": "Patient Identification - Edit",
            "ViewPatientDemographics": "Patient Demographics",
            "EditPatientDemographics": "Patient Demographics - Edit",
            "ViewPatientProcedure": "Patient Procedures",
            "ManagePatientAlerts": "Patient Alerts",
That's an example.
 
@AlexH save/restore or just set it back after
 
@AlexH u have to use context.save() and context.restore()
damn it lemon lol u beat me
 
How should my looping logic look?
 
ok, thank you. Will try.
 
I tried writing a reduce but am having trouble.
 
7:10 PM
I'm confused by your request
 
Ok i really have to go study now
later my doods
:)
 
Thanks LemonR
 
user1596138
@KendallFrey my brother has gone through like 6 napkins trying to solve that age question lmao
 
user1596138
Ty
 
7:15 PM
@rlemon I think I might have figured it out, if I do I'll share the code
 
we all play games. some of us make them. What's the principle behind moving on a Canvas with a Right/or left button pressed?
 
Thanks :-)
 
haa
 
7:30 PM
dark theme is worth every penny
 
@rlemon +1
 
@rlemon +1
 
7:55 PM
@rlemon ok I'm still having problems with what I described earlier. I made a codepen
So basically I'm trying to take URLs and translate them to titles
The links are laid out as such: Link Name (Expected Title Text)
 
in the textContent?
don't think about links
you have text in and text out right?
 
Yeah basically
 
const input = "hello world (1234)";
const out = "1234"
basically?
even from your demo I'm confused
 
Ok sorry that was to make it work inside of codepen.
This JS runs when the page loads and the URL comes from const url = new URL(window.location.href);
The JS sets the document title.
 

« first day (2896 days earlier)      last day (2057 days later) »