« first day (3253 days earlier)      last day (1693 days later) » 
00:00 - 12:0012:00 - 22:00

12:03 PM
ben, thanks for the codepen example, perfect for what I need
 
@TaylorSpark log something multiple times. Then click on back. Then log something again
the new line entry got removed
 
12:18 PM
@Sheepy ok
 
@BenjaminGruenbaum That's good to hear. So, what's the next thing in life?
@BenjaminGruenbaum Didn't complete my PhD. It was taking too long and I missed home. Hence, I'm back in Bombay now. Got a job at an OTT company, Hotstar.
 
How do I call a function named as a json value? I cant do this data["printTab"]()
 
named_as_a_json_value();
kidding
@SilverSurfer json doesn't have functions, only values. what are you trying to do?
 
12:35 PM
Ok, I have a json stored with the name of the function that should be called. For example, if data["printTab"] has the value printImages, I would like to call a function named "printImages"
Is that possible?
 
yes
and depending on the scope of the function, it's done easier
 
@SilverSurfer Cross-platform way: (new Function('return ' + data["printTab"] + '();'))()
 
^ avoid doing this if possible.
 
Yeah. Get the proper global object would be better. Who want to explaining that?
 
@SilverSurfer That is, in almost every possible case, a terrible idea.
 
12:40 PM
if you can put all the functions on an object (or global object) then you can just call it from there.
function foo() { console.log(1) }
window['foo']()
or another wrapping object if you don't want window
safeFunctionList['printImages']()
 
@rlemon {"fnName":"__proto__"}
Safe is relative :D
 
he never said he didn't control the data.
 
Do any of us ever control the data?
 
yes
 
const Printer = {
    printImages() {},
    printMoreThings() {}
}

Printer[theJsonValue]
Is this a valid approach?
 
12:47 PM
it'll work, yes
not knowing what your application is doing, can't tell you how 'valid' it is (assuming you mean smart)
 
Ok thanks
 
Don't forget (), e.g. Printer[ data.printTab ]()
 
True :p
 
just provide your functions as module to the client
*shakes fist to those unsafe options here 😀*
 
 
2 hours later…
2:29 PM
@BenFortune Update, I did a bit more research, and this is what I was looking for:
window[variableName]

Basically I wanted to be able to type a variables name in an html input, and click a button, and it post the value of that var to my console.

window[var] was what i needed because it can convert a string into a variable.
so its a much easier method.

Now my console can output strings, and variables. https://codepen.io/SkylerSpark/pen/rNBdJBx
now I just need to figure out how to simplify it into 1 button.

Sadly I dont think I can do that with an if statement. Might be able to
 
you do you
FYI mine did that, but didn't pollute the global scope, and only used one button
 
@geisterfurz007 Baked an optimised snippet while baby sheep is watching tv. Vote if you want to thanks me ;-)
 
you could make that code less confusing
   let { val, out } = base64ToHex, v1, v2, v3, v4, result = [];
is just super ugly and confusing
not having proper blocks for conditionals too
 
2:46 PM
@Sheepy What does yours do that the others don't?
natively too
 
@rlemon Surprised you didn't pick the const line. Yeah I aimed more for short code than easy code.
@BenFortune Hmm, binary safety and lack of dependency on Buffer?
 
ohh it's also bothersome
but I figured one example was good enough
 
react native has buffer
 
there is no need to minify code yourself.
let a compiler do that
write readable maintainable verbose code
 
Ok. Let me rewrite that...
Done. Much better?
 
2:59 PM
   if ( ! base64ToHex.values ) {
like. I guess I just don't understand why you're attaching properties to the function like that
well, I mean, I know why
I just don't understand why
 
Hmm. Why not? Make the function self-contained.
 
I'd rather just return a function with some scoped vars
never seen someone do it the way you are
 
Can I have an example of the 'scoped vars'? I've been doing this so long that I forgot where I learned this kind of semi-static vars...
 
function foo() {
  const a = 1;
  return function() {
    console.log(a) // 1
  }
}
make foo() an iife if you don't wanna generate it later
const foo = (function(a,b) {
  return function(c,d) {}
}(a,b));
not that your way is inherently worse. I'm just not used to seeing it
 
Thanks. Experimenting with it.
 
3:07 PM
nevermind what I said earlier, apparently my console stopped working lol
anyone ever heard of this error: yYMyLJyoVXqk:94 Uncaught SyntaxError: Unexpected end of input?
It references a </script>
not an input
Nevermind :3
I was missing a {} in one of my functions... thank god for codepen's JS Analyzer
 
@rlemon Ok... I rewrote it again with iife. Code is so long and thin now lol.
 
as it should be
although, I'd assume it will be called if it is included and skip the check
 
3:23 PM
How to do lazy initialisation without a check?
 
inside of the iife
 
Sorry I guess I can use another example. It's time to light off, so I have to check it tomorrow. :(
 
by no means do you have to listen to me
I'm just talking
 
I need new perspective as an experienced living minifier XD Have a nice day!
 
4:03 PM
Does anyone know why I cant use variables in the window[functionName](arguments) built in? I tried setting the F variable in my function the to the FunctionName, and added a R in the arguments variable, and tried sending 2 values into the function.
It returned undefined
but if I just run the same process without the variable R and without the arguments variable, it works fine, except it doesnt RUN the function, just exports the function's code and posts it in my console
Full code for reference: codepen.io/SkylerSpark/pen/rNBdJBx
 
4:22 PM
@Cerbrus your the only other one on, Do you know anything about window functions?
ok nevermind, Im going to head out and work on some other project, cya anyone who sees this later
 
4:36 PM
Right. @TaylorSpark, don't ping random people. If someone sees your question and wants to help, they will.
4
 
5:32 PM
posted on September 12, 2019 by Sam Roberts

Summary The OpenSSL Security releases of September 10th, 2019 do not affect Node.js. Analysis Our assessment of the security advisory is: ECDSA remote timing attack (CVE-2019-1547) Not affected. Node supports only named curves for ECDSA signing. Fork Protection (CVE-2019-1549) Not affected. Node.js always call exec() after fork() so will not duplicate the PRNG state in the forked process.

 
user11867329
What's the simplest way to push notification (out of experience, if anyone dev'd an app that sent push notifications)?

Ideally sent through API from external server.
 
firebase I would say. It's very easy to use.

https://firebase.google.com/docs/cloud-messaging/
 
 
1 hour later…
6:54 PM
What it means type is not constructible in js and how to avoid using proxy when you need to expand functionality of said object
 
you need to expand functionality of an object?
 
Yup
Indeed
 
are you the one making the object? can you just add the new functionality to the definition?
 
No - the object is using already defined type
 
how about you get a bit more specific.
because "expand functionality" is very vague
 
6:57 PM
Are you trying to do something along the lines of an extension function as you'll find in other languages?
JS doesn't have that. Just make a function that receives the object.
 
I want to type .createreaderat after the object which will invoke some functions on the objects and construct a reader
currently I have to type: new Windows.Storage.Streams.DataReader(object.getInputStreamAt(number))
 
so you want that to happen each time you create a new object?
 
I want to type: object.createreaderat(number)
 
what is object?
 
object is the target object we're discussing that I want to expand functionality upon
 
6:59 PM
yes but what is it
 
function createReaderAt(obj, num) {
  return Windows.Storage.Streams.DataReader(obj.getInputStreamAt(num));
}

createReaderAt(myObject, myNumber);
 
it has to be created somehow
if you don't control that, ^^ is the solution
if you control that or know what that is, we can get fancier
 
right I'm working under the assumption that you're receiving this object from a library or something
 
I can use a proxy
 
sigh
 
7:00 PM
but it doesn't automatically deduce the type of the object in VS
 
why, does a utility function not solve it?
also you never explained what object is
 
it looks ugly
 
JS is not a strongly typed language
if you approach it like Java you're going to get stumped very quickly
 
also it is not ugly.
it is an accepted and correct approach in many cases
 
the approach I wrote above is going to be a lot prettier than writing a 'proxy' object for this
 
7:01 PM
maybe\
 
but, if we had more information about how object is created, there is probably a cleaner solution to both
 
I'm using UWP
`window.onload = async () => {
let picker = new Windows.Storage.Pickers.FolderPicker()
picker.fileTypeFilter.append("*")
let files = await (await picker.pickSingleFolderAsync()).getFilesAsync(), file = files.filter(value => value.fileType == ".RMX").pop(),

zonefiles = files.filter(value => value.fileType.startsWith(".Z"))

console.log(file.name)

console.log(zonefiles)

class openedfileaddedmethods {
createreaderat(at) {
const reader = new Windows.Storage.Streams.DataReader(this.getInputStreamAt(at))
 
I thought those were written in .net
> Programmable in C#, C++, Visual Basic, and Javascript. For UI, use XAML, HTML, or DirectX.
 
Not in 2018
 
I stand corrected
But I will say that it sounds like you're approaching JS like it's C#... maybe you should just use C#
if that's more your speed
 
7:03 PM
Have you ever used C# - it sucks
it's nothing like JS
 
Yes. It does suck. We're agreed there. But it's a paradigm that many people are more comfortable with.
 
I mean.. if you think C# sucks and JS is better..
boy o boy
 
In any case I posted the self contained example from where everything steeems from
 
@AnArrayOfFunctions ctrl-k
!!welcome AnArrayOfFunctions
 
@AnArrayOfFunctions 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.
 
7:04 PM
Blah blah
 
shoot wrong one
 
It never works
 
single backticks don't work in multi-line
 
rlemon which one is code formatting
 
and not "blah blah"
 
7:05 PM
window.onload = async () => {
    let picker = new Windows.Storage.Pickers.FolderPicker()
    picker.fileTypeFilter.append("*")
    let files = await (await picker.pickSingleFolderAsync()).getFilesAsync(), file = files.filter(value => value.fileType == ".RMX").pop(),

        zonefiles = files.filter(value => value.fileType.startsWith(".Z"))

    console.log(file.name)

    console.log(zonefiles)

    class openedfileaddedmethods {
        createreaderat(at) {
            const reader = new Windows.Storage.Streams.DataReader(this.getInputStreamAt(at))
 
ctrl + k
 
Wow
it works
ahaha
 
I'm very bothered by your double awaits
 
Cap has a message explaining code formatting, can it be triggered manually?
 
!!format
 
7:05 PM
Format your code - hit Ctrl+K before sending and see the faq
 
ahhh thanks
@AnArrayOfFunctions have you considered using a formatter (prettier) or linter (eslint), or both
 
Nah
They are for plebs
 
ah shoot no one told me
 
man, you really want help don't you
 
@AnArrayOfFunctions I can't read this
 
7:08 PM
No for real - they shoot you in the foot - if you don't know the language probably you should stop using it
@forresthopkinsa
 
"Please format your code" -> "blah blah"
"have you tried a prettier" -> "only plebs use those. you don't know the language"
good luck with your future endeavours
 
I'm for formatting my code but it never works
Now for some miracle it did
And I'm good thanks
I've wrote an UWP VPN app in pure C so
Perfectly fine doing
 
Hey guy, have you ever heard of the Dunning-Kruger effect
It's something I observe in this room pretty frequently
 
What exactly am I incompetent about
 
I think your level of experience in JS doesn't match your level of confidence in it
Writing a windows app in C is going to give you roughly as much advantage in JS as knowing Latin would give someone learning English
 
7:13 PM
Yeah but it's considered for crazy
So I'm doing fine was my point
Anyway for JS why can't I construct some objects
 
And since I can't construct them I can't create a class that inherits their type and expands upon it
 
Don't approach JS like an OO language
your understanding of other languages seems to be exactly what's tripping you up here
read a book about JS
 
It's saying type is not constructible - I can't seem to find this message in Google
books are so 1990
 
7:15 PM
Point is I think this is some complication of the UWP/Edge JS engine
 
probably because you're not passing it a valid constructor
rather a random object
but that's why I asked how it was constructed.
 
I showed you - didn't I?
 
!!> class Foo extends ({ some: { random: 'object' } }) {};
 
@rlemon "TypeError: ({some:{random:\"object\"}}) is not a constructor"
 
ESLint would have told you not to use nested ternaries
 
7:16 PM
stupid FF errors
 
no chrome errors?
 
Cap runs on FF
FF has the worst error message 😛
 
xD
 
> Uncaught TypeError: Class extends value #<Object> is not a constructor or null
 
new class extends Windows.Storage.Streams.RandomAccessStream {}()
Windows.Storage.Streams.RandomAccessStream: type is not constructible
 
7:18 PM
is there an online code sandbox for uwp
 
okay. yes. because RandomAccessStream is not a constructor
if it's just a plain object you can use Object.assign
const foo = Object.assign(bar, { someNewFunction } )
 
That didn't work for some reason
And also I'm trying to leave some type information to VS
that's my main goal right now
Oh wait actually that may work - I used 3 objects before IRC
Yeah but aren't there default constructors
I don't think there is an UWP sandbox but if you have Windows 10 you can create it yourself
no need of VS
Though you would need VS if you want to debug it
And you would need VS 2017 not 2019
since MS is dropping it's internal web engine
for chromium
 
7:49 PM
OK - I solved the problem by continuing to use a proxy but just added a JSDOC union annotation to the identifier
Now my VS properly detects both the bultin methods and my additional ones
 
 
2 hours later…
9:55 PM
@AaditMShah cool :] Are you happy there?
 
00:00 - 12:0012:00 - 22:00

« first day (3253 days earlier)      last day (1693 days later) »