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

12:00 AM
I'm already ready to complain
(complainer on standby)
I regret looking up what jint is.......
 
lol
ok so basically I'm using a plugin in unity3D called powerUI which uses this thing called Jint which basically converts javascript into C# objects. So I'm trying to read a JSON that it sent to me (in C#, via the Jint conversion). It read the incoming JSON as a Dictionary<String, Object>, but I want to convert it, in C#, back into a simple JSON string
if that made any sense at all
so far no complains, so I think its good
 
That sounds like you need C# chat. If you are trying to write in C# then ask there.
 
oooh harsh
technically, although it IS related t o javascript somehow
theres only like 1 other person in that chat
why is it so slow
 
TeChNiCaLlY, it's not because it has nothing to do with javascript. JSON != js.
@bluejayke Not everyone here is going to respond to your question. There are many listening but they might not care to respond.
 
so you convert JSON to C# and now you want to convert C# to JSON?
@JBis (JSON != JS) lmao
 
12:07 AM
Its not a like a simple google search's first result would be of any help...
792
A: How do I turn a C# object into a JSON string in .NET?

Darin DimitrovYou could use the JavaScriptSerializer class (add reference to System.Web.Extensions): using System.Web.Script.Serialization; var json = new JavaScriptSerializer().Serialize(obj); A full example: using System; using System.Web.Script.Serialization; public class MyDate { public int ye...

 
I tried some of those but I wasn't sure if it would work in the dicitonary type <String, Object> that is generated by Jint, I thought there would be some kind of built in Jint function, and the aboev link is only regarding an object, but what about a dictionary (of this format)?
 
What does the dictionary represent?
 
and isn't JSON = JavaScriptObjectNotation.includes("JavaScript")?
 
Are those root level keys that represent some other aggregate?
 
The only way to know is to try it
 
12:11 AM
@VaughanHilts the dicitonary represents all of the JSON data'
 
Sure, but in what format/?
JSON can be nested -- so what is the object?
Is it potentially another Dictionary?
We could assume the strings map to root level keys but what of the nested ones?
 
for example for {someval:4, someother:function(){}}, in the diciotnary it would be something like (pseudocode): {"someval":(integar)4, "someval":System.Func(...)}
@VaughanHilts yes
it is potentially another dictioanry, potentially a function, potentially and integar, etc
nesting could be
 
If that's the case, something like that would probably work
Jint is just a runtime. Not sure if it has something to do it o r not
 
I thought that link was only for static dictioanries, but not with nested objects
 
Nah, Newtonsoft's definitely does nested
I've used it a lot
 
12:15 AM
and even if the second parameter is of type System.Object as opposed to int or string?
 
Your best bet is going to be to try
You could write a sample app to test this in 10 mins
Fire upy our IDE, hard code a dictionary with some data and try it
If it tries to casting and type analysis under the hood, it just might work
Any serializer you would use would have to do this anyway since Object is very opaque...
However, as mentioned before, we are getting into C# territory and that chat is probably better suited for it
 
ooh harsh
well now al I have to do is install it
which is the hard part
but gettin there
 
Holy crap, writing documentation is a PIA
 
depends on your method
it certainly can be
 
Not sure that's harsh. Just telling the truth; people don't want to do your work for you
However, giving hints is nice. :)
Nuget for C# will make it very simple to install it and try it out
 
12:20 AM
I should have written it when I first created the functions/methods/classes instead of trying to do it after the fact....
 
Rob
@bluejayke You might be interested in a playground tool like linqpad - testing that shouldn't take more than a minute :)
 
@JBis Right. Same goes for tests
 
Rob
Though.. you did mention wanting to serialize functions to JSON... that's not going to work
 
C# is awful
there I said it
I'd rather program JS than C# and I hate JS
 
idk what we're talking about but erlang serializes functions by default lol
 
12:23 AM
@forresthopkinsa Why you hate JS? JS is great, except when its not.
 
"I hate JS"- always in the JS chatroom
cough cough
 
Which is the main reason why a lot of people use json instead of etf
even though etf is much better everywhere else
 
@StephanS Familiarity breeds contempt
 
WHAT is etf?
 
erlang term format
 
12:23 AM
that's fair
unless it python
 
@Meredith I'm glad we can always count on you to let us know when our problems can be solved with erlang
 
I just pop in and drop an erlang fact once in a while
 
Most languages I get more comfortable with, the more I understand them
JS is the exception
 
lol
 
js is kinda garbage
but project managers love it
 
12:25 AM
guys I have the most typical programing experience ever
 
I appreciate your erlang facts
 
it WORKED kind of
{asdf:123, news:{lol:4}} JSON gives {"asdf":123.0,"news":{"lol":4.0}}
output on the C# side
until
 
I've never had more fun coding then coding in python tbh
 
tbh, what language doesnt suck
 
Kotlin
 
12:26 AM
erlang
 
and erlang apparently
yes
 
that's a lie
erlang is actually awful
 
I can't help but notice that you seem kind of at war with yourself
 
until I do {funcky:function(){}} in which case I get the error JavaScript compile error (At resources://): Newtonsoft.Json.JsonSerializationException: Self referencing loop detected for property 'Engine' with type 'Jint.Engine'. Path................... so seemingly it wont process javascript functions :(
 
accurate
Elixir is a good language though
 
12:27 AM
are functions meant to be part of JSON?
 
@forresthopkinsa Isn't that Java?
 
Rob
No
 
no
 
is that no for me?
 
@JBis no
 
12:27 AM
yes
 
lol
 
if you wanna serialize functions
you gotta rewrite your app in erlang
and use etf
 
@JBis it can be targeted to the JVM
 
what
 
@bluejayke facepalm
 
Rob
12:28 AM
But then you're stuck using erlang
 
can that run on unity
wait so in general like functions arent meant to be in JSONs?
so my whole JavaScripting has been a lie?
 
correct
json cannot represent functions
 
why not
 
because it isn't meant to
 
brutal
is there any way to
 
12:28 AM
why would you want that
i told you how
use etf
 
so I can store function definitions in databases
 
but why would you want to
 
for later use
 
use a different encoding. but yes, I would also question why you want this
 
please dont do that
 
12:29 AM
this is probably.. a bad idea
 
why
what if I Want my app to be modable
 
you will die
 
so I dont have to chang ethe source code every update
 
@forresthopkinsa Isn't it just shorter java :D?
 
just change the database
 
12:29 AM
@bluejayke big oof
 
what lol
 
there are other approaches to writing plugin/mod systems
 
how else should someone make their app moddable
 
Rob
You will need to change the source code, though. You'd be changing the source code of those functions
 
literally any other way
 
12:30 AM
but I wouldnt have to recompile
name one other way
 
Rob
Is this javascript or C#?
 
have a plugin folder
 
c#
 
Whats the difference?
 
@JBis well not really, as it can compile for JS and native
 
12:30 AM
@bluejayke Lets say you could theoretically store functions in JSON. How in the hell would a different programming language read it?
 
thats what Im doign lol
 
its syntax is similar to Java but that's largely because Java looks like other languages
 
got blocked for a sec
 
So this is a huge XY program
 
the plan is to use Jint to conver tthe basic-JavaScript to C#, and to use modern JavaScript like EM10 I just convert that with babelJS to old style javascript, which works with jint
so we get all the advantages of C# and javascript together in one big happy family
 
12:31 AM
X: I want to convert between JavaScript and C#. How do I do that? Y: I can do that with JSON. How do I convert to JSON?
 
I think I just threw up a bit in my mouth
 
@JBis its not with JSON its with bableJS and Jint, JSON is just a side point
 
the heck is EM10?
 
I meant ES10 lol medium.com/@js_tut/…
 
Rob
12:33 AM
@bluejayke Is all of this just to have plugins in a C# application?
 
what?
 
also think twice before you allow plugins in the first place
 
the idea is to use JavaScript to control unity applications
 
@bluejayke That family seems like its gonna be dysfunctional.
 
Rob
Like.. are you using JInt just so that you can support plugins in your application?
 
12:34 AM
I dont know what ur talking about plugins tbh....
 
Rob
4 mins ago, by bluejayke
how else should someone make their app moddable
 
because we're all concerned about you wanting to store functions in a db
basically
 
don't call it ES10, call it ES2019
 
EM2019
 
thanks
 
12:35 AM
This is whats happening: the user writes some Javascript, then clicks the "Unity-ify" button, then on the screen there is a running unity webGL instance that is connected to nodejs via a websocket, and when the user submits the javascript, the nodejs server converts it to old javascript style with babelJS, then sends that to unity, which uses Jint to "compile" it to C#, and create unity objets etc... from javascript
make sense?
 
oh my
this is quite the project
 
is that a good remark or not so
 
that's a thing
 
I just want to program unity with real javascript, as ppl said, C# isnt so good t owork with
do u think its a good idea?
 
I think it's a cool hobby project
 
12:36 AM
no
 
so you think JavaScript is going to be better to work with than c#?
 
ya
@Meredith y not
 
It isn't going to be practically useful
 
why not
 
seems like a lot of work to go from one shitty language to another
3
 
12:37 AM
javasceript is invincible
 
ehh
 
u can literally do anything with it
 
Transpiled code pretty much always ends up worse than just doing one or the other
 
@Meredith that literally what app designer have to do
 
With the exceptions of langs made for transpilation
of which JS is not one
 
12:38 AM
@forresthopkinsa but how can I get a dynamic app, which is easily reprogrammable, with C#? Whenever I make a tiny modification, it has to rebuild for years
@forresthopkinsa doesnt the unity webGL player in the first place get compiled to javascript with emscriptn?
 
it's going to do that either way????
 
@forresthopkinsa do what?
 
your build process is going to take LONGER if you add a transpile step
 
no thers no transpiling
 
babel
babel is a compiler
 
12:39 AM
I just tested it the entire process takes like < 100ms
 
rewrite it in erlang
 
transpiling = compiling
 
no dude babel takes like 20ms
even for very large files its usually not more than 100ms
 
he's talking about transpiling JS to C#
 
no im not
 
12:40 AM
hmmmm
 
im transpiling new JS to very old style JS, which can be read in unity through Jint
the whole process takes <100ms
 
@bluejayke Trust this guy and don't do it
 
okay yes Jint is not a transpiler, it's an interpreter
I am not familiar with it
my mistake there
 
@JBis I think that answer is referring to the old UnityScript which isnt real javascript
which I agreee is completely #!@$%!@$'d as its really nothing, its not full C# and not full javascript
but real, ES2019 javascript could be very useful to use with untiy
@forresthopkinsa so what do u think then
 
I still think it sounds like a cool hobby project
what more do you want to use it for? Prod Unity apps?
 
12:42 AM
yeah
and for building a team of ajvasript developers
but the one problem I was having just conceptually..
is how do you guys think I should compile the finished app?
Like right now, in the unity script, I hard-code an "id" for the unity app, some number, and then in the client side javascript editor I connect to my nodejs server by hard-writing that same ID, and the nodeJS server looks for any available untiy connections that have that ID, and send the code to it
 
Good luck with your project
I'm out
o/
 
lol KK k
 
sooner
 
you got me there
 
12:45 AM
lol
has anything like this been done b4? I cant find any similar unity javascript makers...
but u never know until u know
 
looks like there are some jint forks specifically for unity
 
where
is the question
and what about knves, only forks?
 
is unity the game thing
 
google "jint unity"
 
12:52 AM
Did you mean: google "joint unity"
hmm github.com/djkrose/jint-unity interesting I didn't even kow that much about it
im using the PowerUI plugin which itself just uses jint
 
user8729657
1:05 AM
Is this how you run an image in a background using docker? docker container run -d -p 8282:80 alpine /bin/sh
 
2:04 AM
Is usejsdoc.org down?
 
2:21 AM
is it possible to do permanent damage to a server using DOS? I ran this code bellow to test if my server can handle it (which cannot), and after i rebooted i realized that the server is a bit slow since when i executed this code (yesterday). Althought i'm not sure if this is related, because sometimes i get SSL handshake error, and i made some changes in my config. After i read a article about Buffer Overflow attack i thought that maybe the script did some damage to my server.
setInterval(function(){ $.ajax({url:'http://domain.com'}) }, 1);,
i stoped the execution of this code after 30s
 
@forresthopkinsa :(
Well thank you Google Cache!
 
wayback machine extension is also great
 
@nobody DoSing should not do any permanent damage, other than increased risk of usual data damage and other stuff. But the increased is extremely minimal.
Your server should eventually be like "Welp. I'm fucked." And it will stop working. Everything will freeze, but it should not cause hardware damage.
@forresthopkinsa Yes, but it's slow. And Safari doesn't work on it sometimes. I get weird safari webkit url errors on it, have I mentioned Safari sucks?
I have used Wayback a ton to read previous version of articles
Its cool to see how the news and websites progress
 
definitely slow, yeah. Has a lot more hits than Google cache though
 
Thats true
idk how they have the storage to File > Save As the entire internet many times for many years
 
2:35 AM
one of the great mysteries of the web
they're funded to do some kind of research on it IIRC but what they do and how it's worth it, I don't know
 
> As of September 2018, the Wayback Machine contained more than 25 petabytes of data
> As of December 2014, the Wayback Machine contained 435 billion web pages—almost nine petabytes of data, and was growing at about 20 terabytes a week
Holy crap
 
@nobody You could be throttled if you are using a cloud provider
Some cloud providers have the notion of "CPU Credits" and allow bursting... if you just make a ton of hits and burn through CPU or bandwidth, you may end up being throttled
 
Most "Unlimited" data plans for phones have throttle limits also. The legal text says like "You will be throttled after 25 GB"
 
3:20 AM
Possibly dumb question, how does module.exports know not to override other module.exports? module.exports = {Client};
 
Scoped per module.
 
so why can't I do module.exports = Client;? or can I? (Client is a class)
 
You can
I assume you're talking about CommonJS
 
Regular Node.js, not sure.
 
Then yes, since Node uses CommonJS
 
3:23 AM
Perfect, thanks!
 
No problem!
 
4:17 AM
Hello
 
@StephanS Hello.
 
how are you
 
 
2 hours later…
6:07 AM
Hi. Can we extend from function constructors?
es5 function constructors
in other words can we mix es5 inheritance and es6 inheritance...
 
6:25 AM
@deostroll I think you can but I am not 100% certain
just out of my head:
function MyFx extends Function {
  constructor(arg1) {
     super(/* put function object here*/);
  }
}
like
 
oh, that seems scary
 
const something = () => arg1 + 2;
super(something);
 
why would you need to do that? like for having private members or something?
 
🤔
that super call is not required I think
just return something would satisfy the js rule too I think
 
no, I'd think the constructor would get called when the function is instantiated
it isn't the call itself
but that's my java brain at work
 
6:32 AM
gotcha leave that to the real experts :P
 
(╯°□°)╯︵ ┻━┻
 
 
1 hour later…
7:35 AM
hi all
can someone explain why Js object.property Integer slower then String ? gist.github.com/florin1693/4e6604a73f6d5a8970ad6f1b83ff064b
my thought was it should be inverse
 
@BoteaFlorin because it has to be converted to string
if I'm not mistaken
also when you access it using an integer, it gets converted
 
@Neil also try, same result
so...under the hood, integer is converted to string?
but...why even when I pass integer as string is the same result...
 
@BoteaFlorin If you're converting to a string, then the work is still happening..
it's just not happening under the hood but by you
 
interesting ... so '1001000' mean Integer converted to string...
 
@BoteaFlorin I don't know, man. That was my idea.
You clearly seem to know more than me in this regard, so props to you
good luck
 
7:49 AM
o.o
@BoteaFlorin object keys are always in string.
if you provide a numeric value, it gets converted to string before it gets stored as part of the object
 
It shouldn't matter really, since they get stored as part of a hashmap anyway
 
thanks for answers :D
 
Also your test is flawed
Try figuring that one out :P
 
8:51 AM
Yes sorry for delay. I used the args tricks because I needed to pass an argument. But if you do so, you lose the done() callback. But even with that vuejs didn't know that the callback was passed. The solution was simple as this:
@leave="(el, done)=> { leave(done, myCustomArgument) }"
 
9:45 AM
Hello, Why when I do a log.console of userPermissions here:
      let userPermissions = this.verify.bind(this);
I get this: UserPermissions is: function () { [native code] }
How can I get the value that is returning and not the function itself
 
@QuicoLlinaresLlorens userPermissions()
or you simply call this.verify.apply(this) to call it immediately
 
Hi guys.

A question for React users : is it valid/possible to use two routers in one app. I would lik to have my usual Router for the normal navigation of the site, and have a second one, a HashRouter, for everything that is modals (some have to be directly accessible via shared url but are also visible in different contexts)
 
10:08 AM
@Neil cannot use any of them
 
10:20 AM
I have this data:

const categoriesData = [
{ id: 1, name: 'category-1' },
{ id: 2, name: 'category-2' },
{ id: 3, name: 'category-3' },
{ id: 40, name: 'category-40' },
];

is it possible to convert this data to normalized data using normalizr?

the output should be:

[1]: { id: 1, name: 'category-1'},
[40]: { id: 40, name: 'category-40'}
 
Hi
 
@km8295 yo
 
10:36 AM
@QuicoLlinaresLlorens what is this.verify then?
if it is a function, then Neil's answer should work
 
I have try this but the key of the array are 0,1,2,3 and not 0,1,2,40..
const category = new schema.Entity('categories', {}, { idAttribute: 'id' });
const normalizedData = normalize(categoriesData, category);

console.log({ normalizedData });
any help would be much appreciated
 
@JonSud what does normalize do?
 
This is a npm package called normalize
make the object more normalize
 
!!> Object.keys(['not0', 'not1', 'not2', 'not3']);
 
@KarelG ["0","1","2","3"]
 
10:44 AM
> make the object more normalize
tf does that even mean
 
more human than human
 
normalizr is returning nested entities with their IDs, gathered in dictionaries
I have this data:

const categoriesData = [
{ id: 1, name: 'category-1' },
{ id: 2, name: 'category-2' },
{ id: 3, name: 'category-3' },
{ id: 40, name: 'category-40' },
];

is it possible to convert this data to normalized data using normalizr?

the output should be:

[1]: { id: 1, name: 'category-1'},
[40]: { id: 40, name: 'category-40'}



I have try this but the key of the array are 0,1,2,3 and not 0,1,2,40..
const category = new schema.Entity('categories', {}, { idAttribute: 'id' });
const normalizedData = normalize(categoriesData, category);
import { normalize, schema } from 'normalizr';
 
Just use reduce...
Or RTFM
const categoriesData = [
    { id: 1, name: 'category-1' },
    { id: 2, name: 'category-2' },
    { id: 3, name: 'category-3' },
    { id: 40, name: 'category-40' },
];

const categorySchema = new normalizr.schema.Entity('categories');
const categoryListSchema = [categorySchema];

const normalizedData = normalizr.normalize(categoriesData, categoryListSchema);

console.log(normalizedData.entities);
 
11:03 AM
Can anyone help me work out why I'm receiving 'base.js?1558695432:331 Uncaught (in promise) TypeError: errors.forEach is not a function'? I'm trying to prettify my errors and I can't foreach.
function prettyValidation(errors) {
    let response = '';

    errors.forEach((value) => {
        response += value + '<br>';
    })

    return response;
}
Data being passed to prettyValidation: {"year_group":["The year group field is required."]}
 
@AshSmith apparently your errors property is not an array, which means it doesn't contain the .forEach method
let `errors` be an array by default -
function prettyValidation(errors = []) { ... }
 
Thanks for the tip, although I am passing an array with the data I posted above, no?
 
then check for its length to see if it contains errors. if not, just return as you're doing now
@AshSmith it doesn't seem that way, otherwise .forEach would work
 
I will console.log errors, one second.
{title: Array(1), year_group: Array(1)}
 
see, it's an object :) not an array
 
11:09 AM
So what I need to do, is foreach of each objects value?, somthing like this I guess.
function prettyValidation(errors) {
    let response = '';
    Object.keys(errors).forEach(function (key) {
        errors[key].forEach((value) => {
            response += value + '<br>';
        })
    });

    return response;
}
 
basically yes, but you're better off using for...of rather than forEach
performance-wise :)
 
11:38 AM
Is angular ok to ask here? Can't find a angular room
 
11:52 AM
yes
 
00:00 - 12:0012:00 - 22:00

« first day (3142 days earlier)      last day (1809 days later) »