« first day (3170 days earlier)      last day (1777 days later) » 

1:38 AM
morn!
 
2:17 AM
o/
 
lol
0
A: connecting to mysql database failing

hisenyuan Class.forName("com.mysql.jdbc.Driver"); Connection conn = DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306/student", "root", "root"); just try it

that response comment
 
2:40 AM
Trying to run a function within a function to see if the array has any duplicates:
function alternatingSort(a) {

  let b = [];
  while (a.length > 0) {
   let first = a.shift();
   let last = a.pop();
   b.push(first,last);
  }

  let string1 = String(b);

  let c = b.sort((a, b) => {
    if (a > b) {
      return 1;
    }
    if (a < b) {
      return -1;
    }
    return 0;
  });

  let string2 = String(c);

  /* function hasDuplicates(b) {
    let valuesSoFar = Object.create(null);
    for (let i = 0; i < b.length; ++i) {
        let value = b[i];
        if (value in valuesSoFar) {
I've commented out the inner function hasDuplicates, but why am I not able to use that there?
 
 
3 hours later…
5:55 AM
https://codepen.io/AkifAziz/pen/mZRYLb

@KarelG am i moving forward good? thanks for your help earlier, this is how far i have gotten. Let me know what do you think of it until now and let me know if i should make some changes in code to make it more enhanced for better performance.
 
6:23 AM
@ARr0w nested ternaries 😢
in your verifyObj function, you check if obj is an object, but not if it has a data key
aside from some readability issues (and minor lack of consistency), it is good. +1
but I wouldn't merge it 😛
 
having issues rendering my list of data from firebase firestore
can someone help?
using react
 
@KarelG i'll replace ternaries then.


"in your verifyObj function, you check if obj is an object, but not if it has a data key"
okay i'll replace that check with a loop to check if its an actual object this way `hasOwnProperty`

can you show me examples like how can i make it readable? like what sort of format should i follow?
 
keep that check. Just add an additional condition to see for data
or just do if ( !(obj && obj.data)) { ...whoops...
 
6:41 AM
@KarelG okay
 
it is just your variable names like Fnc(e,s), had to check what you mean with e or s. Or further: g. Feel free to use a single character name (I use it sometimes in small arrow functions), but don't try to take over a minifier's job.
 
6:52 AM
replaced ternary.

switch (properties[i]) {
                case 0:
                    defaultValue = "600";
                    break;
                case 1:
                    defaultValue = "400";
                    break;
                default:
                    defaultValue = "";
                    break;
            }
@KarelG e= element , s = selector
ohkay
 
d3 (obviously the library itself) is clear to me :P But s ? I had to check the code body to see what s is meant for.
@Cerbrus wolves are an interesting species.
 
@ARr0w bleh
 
@ARr0w what is wrong with if/else or using an object trick ?
 
well i have read switch case is fast and better than if else
you people suggest?
 
["600", "400", ""][Math.min(2, properties[i])]
 
6:57 AM
const converter = {
  0: '600',
  1: '400'
};

converter[properties[i]] || ''
 
though you really should give it a more significant name at that point
const converter = {
  high: '600',
  low: '400'
};
 
forgot its purpose :P
 
0 and 1 and other is confusing
 
@ARr0w are you going to use a bundler/minifier?
if so, lookup for arrow syntax. It is a handy syntax nowadays
eg
// current
.attr('y', function (d) { return yScale(d.value) - 10; })
// with arrow
.attr('y', d => yScale(d.value) - 10)
or
// current
.attr('y', function (d) { return yScale(d.value) })
// with arrow
.attr('y', d => yScale(d.value))
spares you some shizzle typing :P
 
I have not thought about minifying yet though. But for knowledge i'll look up to the arrow syntax.
and implement it for learning.
i should know these things since its in trend
 
7:07 AM
a lazy programmer is a smart programmer, or so they say. I wouldn't know. I don't want to look up who said it
 
@Neil you have to look up to lazy stuff too now a days :D haha
@KarelG i made changes and saved in pen.
by the way
converter[properties[i]] || '' <- isn't this ternary? just asking
 
7:36 AM
ternary operator is using the cond ? actionOnTrue : actionOnFalse syntax
that is a "short circuit"
converter[properties[i]] || '' means converter[properties[i]] or empty string. If converter[properties[i]] gives a truthy value, it does not execute the right operand (as if true || doSomething, where doSomething is not executed). If that gives a falsy, then the right operand is executed ( false || doSomething -> execute doSomething and return its value)
 
my core is c# but Javascript seems like last level boss
damn that's so neat.
 
8:13 AM
@ARr0w where it really gets interesting is with scoping :)
definitely deviates from C# there
 
8:40 AM
Hello to all language gurus...does javascript support unicode with more than 4 hex digits?
 
@deostroll uh no.. because to my knowledge UTF32 is as high as it gets
 
so that is at max 4 hex digits?
 
4 hex = 4 bits?
or 4 x hex = 16 bits?
both are supported
oh missed the "unicode" ...
D:
I believe that it got described in es6
ah max is 0x10FFFF
 
is this applicable for unicode escapes within strings?
 
8:57 AM
hellow all
 
@deostroll yes
I am in doubt if caprica supports it :|
gotcha try it
!!> String.fromCodePoint(0x1F3FC)
 
@KarelG "🏼"
 
naaah
try that in console then
(or pick another emoji with >4 digits)
 
it's an emoji modifier
 
I don't know characters with 6 hex digits :3
 
9:09 AM
what should that character display?
 
a box? really?
 
^
(used for skin colors)
they could have kept it simple with yellows only <.<
 
!!> String.fromCodePoint(0x1F44C) + String.fromCodePoint(0x1F3FE)
 
9:15 AM
@BenFortune "👌🏾"
 
!!> 'hello \uefffff world'
 
@deostroll "hello ff world"
 
!!> 'hello \ufffff world'
 
@deostroll "hello ￿ world"
@deostroll "hello ￿f world"
 
@deostroll you broke it
 
9:18 AM
doesn't that means it can't go more than \uFFFF?
 
It can, but that's obviously not a valid unicode sequence
 
I can't imagine what UTF-32 would look like on a page
the html text would be unreadable to anyone
 
hello all, how i use js for submition the fields ? using on click?
 
@ARr0w shouldn't I have gone beyond 0x10fff to actually break it?
!!> "hello \u{10ffff} world"
 
@deostroll "hello 􏿿 world"
 
9:23 AM
that is how es6 allows it ^
!!> "hello \u{110000} world"
 
@deostroll "SyntaxError: Unicode codepoint must not be greater than 0x10FFFF in escape sequence"
 
10:00 AM
!!> /[\u{10000}-\u{effff}]/.test('A')
 
@deostroll "SyntaxError: invalid range in character class"
 
are \x{} valid in regex literals?
!!> /[\x{10000}-\x{effff}]/.test('A')
 
@deostroll "SyntaxError: invalid range in character class"
 
!!> /[\x{10000}-\x{effff}]/.test('A')
 
@deostroll "SyntaxError: invalid range in character class"
 
10:03 AM
help!
 
read the ecma part in the link I sent to you
 
10:28 AM
That talks about using String.fromCodePoint() right...I want help with the regex that has to match unicode with more than 4 hex digits...
 
hey guys
 
@deostroll erhm...
 
is it bad practice to do call an asynchronous function in a promise resolution of another asynchronous function?
 
you can capture it with \d flag and evaluate its value
not how you want to do. range checks are limited in regex
@pida depends of what you mean with "promise resolution"
 
something like this:
function().then(()=>{function().then(()=> {//foo})))
inside a then block i call a function with another .then
 
10:36 AM
You'd only use {} for something like \u{N}, otherwise you'd do something like [\u0000-\uFFFF]
@pida You can return a promise from a function to chain them
 
i'm learning js (nodejs actually now) and i want to have good practise from the start so maybe my question has no sense or is a bit dumb
@BenFortune yes but i'm not chaining them in my case, i'm nesting one in another one
 
Have a look at async/await
 
I would capture those values and see if it is in an acceptable range
 
here is the code because in case i'm not being clear about the problem
is it fine or can errors happen by nesting .then block in a .then block like this?
 
It shouldn't produce an error but it's code smell and errors won't propagate up your chain
 
10:44 AM
ok so if the content is basic like this there shouldn't be a problem but i shouldn't do that if there is more complex stuff going on because i won't be able to track the error properly (is it what you meant?)
 
1 message moved to Trash can
@ARr0w Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq. For posting large code blocks, use a paste site like gist.github.com, hastebin.com, pastie.org or a demo site like jsbin.com
 
var dataset = d3.layout.stack()(["redDelicious", "mcintosh", "oranges", "pears"].map(function(fruit) {
return data.map(function(d) {
return {x: d.year, y: +d[fruit]};
});
}));

return {x: d.year, y: +d[fruit]};

as can be seen above "y:+d[fruit]"
What's the purpose of + here ?
 
to cast it to an int
 
that is a quick alternative for Number(...)
 
!!>typeof +"50"
 
10:48 AM
@BenFortune "number"
 
+'50' === Number(50)
(see for unary plus operator)
 
var data = [
{ year: "2006", redDelicious: "10", mcintosh: "15", oranges: "9", pears: "6" }
]

var dataset = d3.layout.stack()(["redDelicious", "mcintosh", "oranges", "pears"].map(function(fruit) {
return data.map(function(d) {
return {x: d.year, y: +d[fruit]};
});
}));
that's the proper data and then its mapped dataset
in dataset it generates another property calling it y0
@KarelG okay, so i read : + - attempts to convert the expression to number
how does it success in doing so? its all non numeric characters
 
the value yes.
check Number(...)
 
awh, the default return value of this function is 0
damn im so clueless about things here
 
guys my form submit when i click to add rows to ta table, shoud e mate a funcion to post the values from table?
 
10:58 AM
 
@NoobDEV-GBL depends.. do you need the values from the table?
 
yes i need the values from the table by row, the number of rows can be 1 or more
 
I wouldn't recommend that you identify values in your table by their position
position can change
and you're assuming the backend remains consistent with the frontend version
you should use an identifier
if you don't have one, make one which can be shared both backend and frontend
 
@Neil you are right, but see this exemple pls
 
@NoobDEV-GBL ah I see what you mean
well you shouldn't need to submit everything, only the information pertaining to the new row
your backend should respond with an indicator that insertion was done successfully followed by all existing rows
 
11:03 AM
that table is for stock entry
 
or in the case of failure, an indicator that insertion wasn't done followed by all existing rows
in either case, you want to see the table with its data
might be better to use ajax though here
 
hmm
and why wen i put this table in a form, the form gets submited if the button is type button and have a funcion onclick
can you explain pls?
that buton is supost to worck only for addrow to the table right?
 
button needs an attribute type
I think if it isn't specified, default type is "submit" meaning it activates the form it's in
if you don't want it to activate the form, it needs to be type="button"
 
ya that what i have here
well i dont have a button..i have one icon where gets the event click
i have this ;
<center><i class="icon-plus"  onclick="addRow();" style="color:green" title="Nova linha"></i></center>
and athe the end i have a submit button,
<button type="submit" class="btn btn-success btn-icon left-icon mr-10 pull-right">
<i class="fa fa-check"></i> <span>Save</span> </button>
have i mess it up?
 
11:21 AM
is there a chat room for HTML?
 
user8729657
Maybe
 
maybe have, if you whant to go there and chat, sense the room is empty
;D
 
user8729657
lol
 
alright so, this + sign generated "y0" with added value with previous result - along with original property "Y" with original value

@KarelG if i am getting it right above, what's its back story? it seems i know what's happening but can't understand how is it doing it.
 
11:53 AM
@KarelG why it didn't work here ?
https://jsfiddle.net/upzkro1g/
 
a minute
@ARr0w what do you want to achieve?
 
i want to understand the "+" thing
like the concept of it
 
it is just "convert the value after + to a number"
 
oh. okay. Thanks.
d3.layout.stack() part

creates the y0 property. Got it.
+ is just converting it into the number, if number is passed as string
kind of parsing just to render accurate data
 
That's what happens when you blindly copy and paste everybody else's code without learning to understand the fundamentals first.
 
12:02 PM
@BenFortune they didn't teach about this in one of the tutorials i went through
it was basic.
@BenFortune plus i am not copy pasting.
 
1 message moved to friendly bin
that was a bit ...
 
isn't his a bit ... ?
 
12:22 PM
... passive aggressive ?
 
@MadaraUchiha, are you there?
 
@Seblor so was mine.
anyway, it can be read either here or there lol
 
12:52 PM
good day @KarelG ^^

i'm off from work.
 
bb and have a nice weekend
 
 
1 hour later…
2:19 PM
 
2:33 PM
Has anyone used IPN API from PayPal? If so, how do you make sure that the request is actually coming from paypal and not some third party who found your url and wants to fake payments?
 
tokens
EG: verify_sign=AtkOfCXbDm2hu0ZELryHFjY-Vb7PAUvS6nMXgysbElEn9v-1XcmSoGtf
 
2:50 PM
@BenFortune Where is that located? PHP ppl said that you make a request to paypal confirming.
Ah I see
thanks
 
Plus you need to confirm the notification by sending it back to paypal with some extra parameters. If you send them a forged request someone tried to send you then it will obviously fail.
 
> Before you can trust the contents of the message, you must first verify that the message came from PayPal. To verify the message, you must send back the contents in the exact order they were received and precede it with the command _notify-validate, as follows:
^ yep
I have a client that wants to be able to send HTML blast emails. I have the sending the emails part setup, but I need a way for them to create the email. I think an existing program is probably better than me reinventing the wheel. Does anyone have suggests for a program that is easy for non devs to create html emails?
Maybe markdown to html?
 
What tech are you using ? web ?
 
@JBis We created our own drag+drop editor, which converted to mjml which gets parsed into html
There are a million email builders online though
 
If your app is a web app, you can use tinyMCE, which can export the text directly as HTML
 
3:00 PM
I wouldn't use that for a mailer.
There are a ridiculous amount of hacks you need to do to get a well-formatted email working in all clients
Which is why MJML is great
 
Ah, that's right. mail clients are terrible...
 
@Seblor is it responsive? Also concerned about what ben said.
 
Well, not terrible, but highly restricting
 
@BenFortune How long did that take/was it difficult to work with?
 
@JBis Couple weeks
 
3:02 PM
IIRC TinyMCE is responsive, but Ben is right too.
 
The emails are not going to be very complicated. I feel like markdown would work (if a converted could convert it properly). I am not sure how bad email clients are at rendering simple html email's.
 
You'd be surprised lmao
 
Apparently TinyMCe has a legacy output plugin that may work for mails : stackoverflow.com/questions/16943781/…
 
Especially older versions of outlook
Check the HTML output of that
 
I figure an image or two at the top with some colored text at the bottom.
@BenFortune Probably cause they use the IE engine....
 
3:04 PM
That's exactly why
<!--[if mso | IE]> everywhere
 
would normalize work?
 
No, most of it needs to be inline styles
 
Damn it Microsoft.
I would say fuck it, but I know for a fact most of the people receiving these emails are probably gonna have an old browser or old email client :(
Ok thanks for your suggestions!
will look in to mjml
 
3:21 PM
-1
Q: Why is .then() never executed in this Node JS example, even though Promise is resolved?

titusnI am new to node and following Ryan Lewis' excellent course on advanced use of the AWS Javascript SDK. The code I wrote is according to the instructions and runs fine, it even connects to AWS and creates a security group as expected. After that it is expected to resolve the returned promise and c...

such a well written question, for such a simple mistake
code needs more semicolons tho
 
Here I am still looking for the simple mistake
ohhhhhhh
 
;)
there might be more wrong with it, dunno, the lack of semi colons bugs me too much to dig much deeper
 
3:54 PM
@KevinB Why more semicolons ?
 
readability primarily
If you know that every full line ends in a semi-colon, you can assume that where there isn't a semi-colon, it's just a continuation of the previous line
without that, you have to look more closely at every line
 
StandardJS allows no semicolons, for example. And I agree with them it really is not necessary.
Well unless your previous line ends with an operator or your next line starts with a dot, you can assume it's a full line
I understand if people use semicolons (they are forced with my work's eslint settings), but I find that it bloats the code a bit.
 
> Semicolons bloat my code
 
Yes, if you're consistant in putting the dot on the previous line, sure, but that's not a constant
 
"bloat" may not be the right word, though. I am not a native english speaker
 
4:02 PM
people put it it there, or on the following line. there's no consistency
 
Isn't there a rule for that in eslint ?
 
there's a lot of rules for eslint, you can even make your own
 
If you're using a linter (which you should), formatting consistency should not be an issue.
 
If you're using a linter, you shoudl have it tell you to use semicolons
 
Can you all confirm something? - I noticed that when we get the last character in a string, we need to do string[string.length - 1]

And I get that if the string is "happy", then string.length = 5, and 5 - 1 = 4, and "y" is the character at the 4th index.

So, am I correct in saying that string[-1] does not exist? Only "positive-integer-elements" exist in an array?
Because string[string.length -1] will work to get the last char but string[-1] will not.
 
4:16 PM
that sounds like something that can be avoided
like, in what situation would your loop not stop when it's done rather than say "Hey, we're at 0, that means we're done"
 
 
2 hours later…
6:45 PM
I have a question about GET requests on an API? Anybody available?
 
@learnerforlife 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…
8:20 PM
o/
I'm getting this error: Uncaught ReferenceError: angular is not defined at angular-jwt.js:9. Any idea?
 
are the scripts included in the correct order
 
I was installing the wrong angular-jwt :(
 
@lealceldeiro Am now, sup?
 
8:47 PM
@MadaraUchiha Oh, thanks for replying. I read this meta.stackoverflow.com/questions/254137/… and I think there is an answer of mine that can be taken as a canonical one. I've tried to find if that have been asked before but didn't find any similar post. Can you take a look whenever you have a chance and let me know what do you think about it? This is the one:
6
Q: “===“ equivalent in Java

JavaCakesWhile comparing two values in Java, how do you test if both, the type and the value, are equivalent? I know in JavaScript === can be used to accomplish this, so I tried that in Java, but it didn’t work. I know this is a simple question, but I tried looking it up and I couldn’t find out what it ...

 
@lealceldeiro LGTM, I can't put up a bounty until tomorrow (as even mods are subject to the two days since asked limitation), but do ping me again when 48 hours since the question was asked has elapsed?
 
@MadaraUchiha Sure, I will. Thanks!
 
9:10 PM
ugh, npm install on an usb key from ubuntu inside virtualbox is comparably fast as installing all of npm on windows
 
linux is slow
 
I generally experience ok installation time, compared to windows?
 
i mean, i never compared it to windows
 
:)
 
9:12 PM
:)
oh I kinda remember I ought to give more than one core to that vm anyway.
I might repeat myself, but anyone tried svelte and/or sapper? impressions so far?
 
i've heard of svelt, but can't remember what it is
 
tldr compile all js code at build time into functions that directly update the dom.
 
9:32 PM
eh
 
Are y'all fans of typescript?
 
yup
 
👍
Maybe I'll start using it. Looks nice.
 
IlikEiT
time to install node on my new machine... should i use nvm this time
 
9:57 PM
@MadaraUchiha or other mods, as mods you guys can create a private rooms with users, that others can't view. Is there any kind of text description from SO for this type of room? For example the public and gallery have the following:
 
@JBis Private.
 
 
Awesome! Thanks. Can you send the icon for that if possible?
 
10:14 PM
 
perfect
 
 
2 hours later…
11:54 PM
@KevinB I kinda like it. then I remember that, I mostly always want to use latest, and stop caring..
I'm rarely in a position where I need to support legacy node systems
and I'd most certainly use docker if I had to do so
so... I think I answered an ongoing self-questioning I have about wether or not I should continue to use nvm, or simply always be on latest
 

« first day (3170 days earlier)      last day (1777 days later) »