« first day (3265 days earlier)      last day (1905 days later) » 

00:10
@forresthopkinsa I'll try in a bit I'm sure I will, I think that's a sync also
I imagine that the problem probably isn't that your async fn is blocking -- the problem is probably that the beach ball is waiting on something that happens in your then chain
also, nitpick: don't nest promises. return the new promise and .then off it on L31
and L40
@forresthopkinsa wdym?
@forresthopkinsa but still shouldn't it not beach ball cause it's async. Should I thread it?
I also get major beach ball for the async dom creation (I have to push changes and then I'll send link in a bit)
promiseOne.then(foo =>
	getPromiseTwo(foo).then(bar =>
	{
		const promises = [getPromiseThree(bar), getPromiseFour(bar)];
		Promise.all(promises).then(baz =>
			console.log(baz);
		);
	});
);
can be rewritten as
promiseOne
	.then(foo => getPromiseTwo(foo))
	.then(bar => Promise.all([getPromiseThree(bar), getPromiseFour(bar)]))
	.then(baz => console.log(baz));
@JBis I don't know enough about Electron to say
I did not know that. Coolio
it might beach ball until it hits an expected event, e.g. page render
yeah chaining is one of the wonderful things about es6 promises
it's meant to counteract the "pyramid of doom" in callback hell
00:35
@forresthopkinsa ha, as I was writing it I was like, wasn't this supposed to solve the pyramid of doom...?
@forresthopkinsa Ok loadFile is async so that shouldn't be the issue
I have narrowed down the issue to these functions
01:42
morn
 
5 hours later…
06:23
@towc Gold doesn't have to be officially supported. If there are no governments around to support a currency, gold is the golden standard. Certainly not bitcoin.
06:34
anyone here versed with language formalisms here? I am trying to understand what recursive descent parser is. I need some sort of an example...
@deostroll It's where you have a rule which includes itself in the language grammar
like expr := '(' expr ')' would make a language recursive
But when parsing something like (2 * 3) + 5 what if the parser substringed 2*3 computed that and then parsed the remaining...what sort of parsing strategy is that?
the act of putting parentheses around an expression means the inner expression gets evaluated rather than, say, 3 + 5
What makes this possible is expr := '(' expr ')'
but supposing you didn't have this, you could still write the rules in the order in which you would have them be parsed, so expr * expr before expr + expr
you're simply ensuring that you achieve the right parse tree from the results, so that when you evalute the result, it comes out correctly
06:51
hi All
im trying to use forEach inside filter function but the return array is always null
        var getNewArray = arrayOne.filter(function (arrayOneObj) {
            arrayTwo.forEach((arrayTwoObj) => {
                if (arrayTwoObj.ArrayTwoId == arrayOneObj.ArrayOneId) {

                     return {
                         MainId: arrayTwoObj.ArrayTwoId,
                         checkSubs: arrayOneObj.subs
                     };
                }
            });
        });
can anyone suggest, if this is the write approach, or there is something incorrect in this
@SamSam think of forEach like a loop
it is a consumer
is a parse tree synonymous with AST?
@SamSam use find instead here
@deostroll yeah
@Neil i have to return a custom array with multiple properties on condition true
cool. thanks for your time... @Neil
06:57
@SamSam then probably better some
var newArray = [];
		var tempObj = arrayOne.filter(function (arrayOneObj) {
            arrayTwo.forEach((arrayTwoObj) => {
                if (arrayTwoObj.ArrayTwoId == arrayOneObj.ArrayOneId) {

                     newArray.push({
                         MainId: arrayTwoObj.ArrayTwoId,
                         checkSubs: arrayOneObj.subs
                     });
                }
            });
        });
i tried this
@Neil some will return true even if one element matches i think
@SamSam wait, that's confusing. what is your structure here? Is arrayOneObj an object or an array?
you are not using the filter correctly
what are yours initial arrays and the expected array?
you probably mean to use reduce rather than filter
i will share the sample structure
arrayOne = [{ArrayOneId: "1",Desc: "Description1"},{ArrayOneId: "2",Desc: "Description2"}]
		arrayTwo = [{ArrayTwoId: "1",subs: "true"},{ArrayTwoId: "2",subs: "false"}]
now i want to filter / loop / iterate in such a way that i can create a new array with condition of
(ArrayOneId === ArrayTwoId)
if true then the new array would be
newArray = [{MainId: "1",subs: "true"},{MainId: "2",subs: "false"}]
07:08
arrayOne.reduce((acc, val) => {MainId: val.ArrayOneId, arrayOneObj.subs });
why use ArrayTwoId if you only add them if they're equal?
Actually:
arrayOne.reduce((acc, val) => acc.concat([{MainId: val.ArrayOneId, arrayOneObj.subs }], []);
const a1 = [{ArrayOneId: "1",Desc: "Description1"},{ArrayOneId: "2",Desc: "Description2"}];
const a2 = [{ArrayTwoId: "1",subs: "true"},{ArrayTwoId: "2",subs: "false"}];
const endArr = [];

a1.forEach(objA1 => {
  const objA2 = a2.find(obj => obj.ArrayTwoId === objA1.ArrayOneId);
  if (objA2) endArr.push({MainId: objA2.ArrayTwoId, subs: objA2.subs});
});
^ @SamSam
arrayOne.filter((val) => arrayTwo.some(obj => obj.ArrayTwoId == val.ArrayOneId))
    .reduce((acc, val) => acc.concat([{MainId: val.ArrayOneId, arrayOneObj.subs }], []);
@Neil Neil, some will stop looping even if it finds one matching value
@SamSam so you want multiple items in your array with the same id?
It's confusing to me, because I'd assume that id would be a unique value
you can consider it as a primary key and foreign key
07:23
fair enough, but you're ultimately grabbing just the id
you're not getting any info from arrayTwo that would make this worthwhile
neil, you are fired.
good thing I don't work for you
...anymore
if you expect there to be multiple items in arrayTwo with the same id, then reverse arrayOne and arrayTwo in my code and it should work fine
@ARr0w at all
wasn't I supposed to be your boss?
get out of my office, sir
ah! your sane.
im leaving.
07:25
you can't leave, you're kicked out!
almost had you there though.
07:58
hey guys anyone here active with reactjs?
@Neil Neil, actually it was just a sample pseudo array code. my actually array object will have multiple properties and array with array object as well.
if the relationship between the two arrays is many-to-one, then by starting with the "many" array first and matching to the "one" array second, you'll wind up with multiple copies of the same id
08:20
hmm @SamSam so it is possible that you have multiple objects that matches the id in the second array?
that what I give gets the first encountered match
Do people still use atomic design structure for sass files? Or do you with something else more non-abstract?
08:49
@KarelG no, there wont be multiple matches.
I just to help understand said it is like PK, FK.
hey, anyone with some typescript experience here?
but both the arrays will have the respective Id's only once in collection
Sam
Sam
09:07
Hello, do you guys know a good library that "translates" my microphone to a nice sinewave, like what siri does on iphone?
I have looked into siriWave.js, but that doesn't take microphone input
Is it possible to combine pizzicato.js with siriWave.js in any way?
@Sam if you don't mind waves being in blocks, check wavesurfer.js
it has a custom render functionality if you want to overcome that
Anyone please help me out with this post, my concern is to display or view WORD, EXCEL, PPT file into browser or into iframe. Is there any jQuery plugin or javascript library available?

Here is my post https://stackoverflow.com/questions/58074522/how-to-view-or-display-documentsexcel-word-ppt-file-in-iframe-or-browser-win
@ankitkanojia 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.
09:33
Yo boys (especially vue user)
Do you think it is possible to interpret a function inside vuei18n rendering
Something like {{ $t('gallery.creationInfo', {galleryOwner: gallery.owner_name || $('unknow') }) }}
Well matter of fact
It works
And I feel like its amazing !
09:50
guys i have a question
i'm trying to embed google maps but without using api , i just want to render google map page on my site since api costs have spiked really high i cant consider it right now and alternative maps doesn't include as much details as google maps ( locations and shops ...etc )
i remember there was a way to render part of a different website on my own website but i dont know how is it called or what i should look for.
cant be embed as embeding the map wont let anyone choose a location , it has to be fixed
eh you want to use other's api access?
@KarelG nah , i think api access from google map can be very expensive
yeah but your intent is that the other is paying for you.
yeah :P
its too expenisve at the moment so iam looking for alternative solutions because i still want to proceed with my idea
i dont wanna stop
HAMMERTIME!
09:57
use a free alternative if you don't want to use google's service.
i considered that , other free alternatives doesn't have all the shops as google maps do
i've been looking everywhere , they wont work
is that for a website that is being used as a service? Because if you have to pay, then you are over the 200 US$ rate that google uses as a limit to distinguish free/paid membership
yeah i know but it would go out of control after the 200$ limits , it will be snow balling after that.
i dont wanna be stuck in there.
eliminate some services then. Or pay. Or use alternatives.
google has a tool to analyze your billings so that you can make a decision
all info is in here
hi people and bot
10:05
you'd really ultimately need to know how much revenue you're getting with respect to how much you'd get without using the google api
Tried AppleTV
this thing is bonkers
that's tricky to find out, but that's the question you should ask yourself. Does the trend justifying using google map api?
anyone have any idea about any 3rd party plugin to create organisation structure?
pretty vague question
people tree we can say
10:06
@KarelG what is the SKU ?
plugin for what exactly?
browser plugin?
JS pulgin
no such thing as a js plugin
you mean jQuery plugin? or a browser plugin?
Jquery :D
ah ok :P
@diamond abbreviation for Stock Keeping Unit. But there is a definition of that on that page AFAIK
yup, it does
> A SKU is the combination of the Product API + the service or function called (for example, Places API - Place Details).
you could probably just write your own as well
not that difficult via canvas
@Neil bit sleepy day, mind is not working properly :p
winters are coming in India, lazy days
meh, would be a fun thing to try to make work
working with canvas is always fun for me at least
working with JS is a fun, no matter it's canvas or anything else
10:16
@KarelG thanks i get it but , its still too expensive or atleast that is what most of the companies in business says

i'm looking for a way to use google maps as embeded only and use some sort of other coding to get the coordinates from it using js functions then if i need more details like google directions or whatever , i could redirect the user to google maps for routing and directions , but i dont know how i can do that
if you have a database, you can create a periodical request to google to get store locations and store it in ur db
then use some geometrics to get nearby store location
then when displaying map, you render it once. Fill it with Marker API
ect ect
I just use a free alternative (leaflet) and use google's Place API
routes? redirect to google (also part of their API) / open as new map
yay
our app worked
and obviously my pure-CSS checkboxes turned out skewed
in contrary at my end :|
little SQL builder fails to setup the syntax right
@KarelG that sounds amazing !! i will give it time to research thank you so much :)
11:07
Excuse me, Uh if anyone could help me I'd appreciate it
function loadUnicode() {
 var a = 0;
 var b = String.fromCharCode(a);
 var c = document.getElementById("output").innerHTML += b;
 a++;
}
I have 3 variables
var a is a Counter (It increments every execution) and then b is a fromCharCode Function
and I am attaching the value of B to var c which sets the value of an innerHTML as b
But when I execute the script, it places nothing in my <p id="output"></p> Tag
I checked the console too, no errors
var c = document.getElementById("output").innerHTML += b; that disturbs me a lot.
._.
and since a is defined there in the function itself, it is always 0
until that a++
next call is back at 0 again
11:11
oof
Well I set it to Global, and its still doing nothing
and oh come'on with this fugly var c = document.getElementById("output").innerHTML += b;
Ive tried all sorts of different methods of logging fromCharCode
but it doesnt seem to do anything
are you calling that function at a given moment?
that should work, even if it is ugly
11:13
Nevermind, its outputting values now, but they arent chars.. just boxes

yYAyLJNVRYor:34 
yYAyLJNVRYor:32 
yYAyLJNVRYor:34 
yYAyLJNVRYor:32 
yYAyLJNVRYor:34 
yYAyLJNVRYor:32 
yYAyLJNVRYor:34 
aaaandd... fyi, the String is a space
!!> ==${String.fromCharCode(0)}==
On the documentation and all examples of it, Ive seen it use "String"
!!alive
oof
rLemon wake uppp
meh, the output is == ==
11:15
@KarelG That didn't make much sense. Maybe you meant: live, llike
@KarelG "==\u0000=="
...
@TaylorSpark you are aware of function/variable scopes in js?
yes
Ive just never used fromCharCode
so I didnt realize using a non-global variable would always set its value to zero, sometimes I just do things like that
"var a is a Counter (It increments every execution)"
..
11:16
Nevermind, I logged the value enough times
its outputting real characters now
!"#$%&'()*
I guess fromCharCode's (0) through about (20) are just empty characters
or the font doesnt support them
those are special characters, from the old terminal times
it has a meaning. but not for the screen. Or what you want to see.
[. __.]
Yeah nevermind I remember the unicode docs
those are, the formatting chars
I know ive seen them before
now if I just make a for loop and set a max density of 65535
then it should be complete
Yeah... Its working TOO well
Well anyways I got what I needed, I just needed a list of every unicode char possible with fromCharCode in a blank page, and I created that
anyways, gtg
@DavidCetinkaya 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.
11:39
Oof, well after about 7 minutes of loading, I have over 50,000 different unicode chars in my clipboard
I think I actually make more than your allowed to make (65535)
Oh wells
12:16
user image
3
runs away
Im going to try writing my own basic JS syntax editor (Out of boredom) would it be easier to write it in Plain JS, or JQuery
And also, if anyone has any advice for the types of Methods I should use to replace text in the contenteditable div, Id appreciate it.
atm Im going to try using .includes on the text of the textarea, and then split/join/add <p> tags with IDs representing the pieces of the text. Then finally constantly update those <p> tags and search if the contents of it are var for example, so if you were to hit back on it, it would then delete that p tag and place its contents back into the textarea with no highlighting
jquery
definitely
seconded
jQuery is the proper choice here
check out mootools as well
they could help
nah, you want YUI
hello
12:30
@Andrew 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.
is it possible to allow users to add markers on the map using leaflet ?
i kept looking for docs and plugins but there are lots of them and i couldn't find it
add it as a functionality ...
Thanks for the advice, I probably wont work on the Syntax in school, too much work to pay attention to
Ill check it out when I get home
just use leafletjs.com/reference-1.5.0.html#marker and make it draggable until the user has "placed" it
@geisterfurz007 perfect
@rlemon what on
12:45
@BartekBanachewicz toast
hmm should it not be Android Java? Because it has Toast.
Can any one help me out with this post : stackoverflow.com/questions/58074522/…
want to display or view WORD, PPT, EXCEL file either in iframe or in browser directly.
Request you to please suggest jQuery plugin or javascript web API for the same.
> Questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
@rlemon i appriciate you're answer but this query or question may help other in case of there is any possiblity of resolution. that is why i asked to stake profile.
it's still off topic
doesn't matter if you think it's helpful. it's explicitly against the rules.
12:56
okay, thank you for you're input @rlemon
XY problem has a name because it's a thing that happens with some frequency unfortunately
 
2 hours later…
14:43
Hey folks, have a question about loopback 3 relations if anyone can help
@Hanut 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.
@KarelG if i can read corrdinates and add it as a functionality then maybe i can embed google maps and add functionality to it as well :P
15:37
Any time mootools is mentioned, an entire universe dies
user8729657
15:57
When I'm using node version manager, do I uninstall the version I'm not using and install the one I am, or can I have multiple versions installed and my app will just run and grab the deps from the version, that is installed?
16:13
I'm trying to create a HashMap class that can either have a JS map or Array as the constructor parameter.
I'm trying to use TypeScript to set up the typing correctly but am having difficulties
constructor(input: Map<K, T> | Array<T>, key = 'id') {
The Map<K, T> works fine, but I'm unsure how I'm supposed to extract the type from input[key] should the provided input be an Array
@Vap0r Overloading will probably work better for you here.
user8729657
Thanks @ndugger
class HasHMap<K, T> {
  constructor(map: Map<K, T>, key?: string)
  constructor(array: T[], key?: string)
  constructor(input: Map<K, T> | T[], key = 'id') {
    // implementation
  }
}
key: keyof T I'd imagine
@KendallFrey K, more likely
And probably number in the case of arrays, now that I think of it.
16:18
eh? no
not if I understand the goal behind it
If key is the property I use for the hash, then yes, keyof T.
For both cases.
In which case you can't provide a default value though
I basically want the type of input[key] available when input is an array, so I can provide it to `new Map<K, T>
export class HashMap<K, T> {

    private key: string;
    private hashMap = new Map();

    constructor(input: Array<T>, key = 'id') {
        this.key = key;
        this.hashMap = new Map<input[key], T>(input.map(item => [item[key], item]));
Sorry for the no-close parens, but that last line is basically where I'm struggling.
I know you can't do new Map<input[key], T>, but I don't know what the type of the object arrays defined key is going to be before this, and I would like to be able to implement it without having to specify new HashMap<string, object>()... for instance.
That way if I add an indexOf method to my HashMap class, the provided key parameter can be typed according to what the user of this HashMap class defined their key as.
new Map<K, T> is probably what you want
And something to constrain the array
T : { [key]: K } or similar
I'm not sure how inferring K plays into this
basically I want the type of the key because the key can be anything when you're using a JS Map
So I want to make sure that when an outside dev does something like:
const keyToFind = 'abc';
const myArr = [{id:1,text:'foo'},{id:2,text:'bar'}];
const map = new HashMap(myArr);
map.indexOf(keyToFind);
Should it not be K though?
16:33
There should be an error, because keyToFind's type is string myArr's objects id type is number
Yeah
You can do that with new HashMap<number, Something>(...)
I don't know if you can infer K from usage though
That's the crux of what I'm trying to do
I saw some stuff using extends in and keyof in TypeScript but I'm unable to understand it completely
My guess is that using a factory function instead of the constructor might solve it, since you can put a explicit return type on it
That looks like exactly what I'm looking for.
I must be missing something
16:57
I haven't figured out how to port it to a constructor though
@KendallFrey that's awesome thanks
That's how to port it over.
oo that's deceiving though
K is no longer the type of the key
Mine also gets slightly confused if you don't pass it a string literal
Probably inevitable, and I'd say ok
Yours gets the same kind of confused but in a different way
I know this is probably a noob question, but can I pick whatever for my type inference variables?
Like it doesn't have to be K, right?
17:13
wdym?
K isn't a reserved/special name if that's what you mean
Are we talking about generics?
Because generics seemed really confusing to me at first, so I'd get it
Yeah I'm still pretty confused
I'm starting to think you need the key as part of the type if you want to use a constructor
not the type of the key, but the key itself
For whatever reason what I posted above works
Like key typechecking works correctly if I use T[K] as a parameter type in a class method
17:19
Yeah, you'd need to use T[K] everywhere instead of K
Good point. This could end up hurting my backwards compatibility if they specify a type to HashMap
and you wouldn't be able to pass it around as a map with generic key types
i.e. just because T[K] is the same type between instances doesn't mean K is the same type
so you'd need an interface or something to make it truly generic
And I expect there to be many more gotchas
I'm having trouble understanding that.
Say you have { a: string, b: string }
new HashMap(arr, "a") is not interchangeable with new HashMap(arr, "b")
(not assignable to the same variable)
even though they both return strings from their relevant members
Have you considered this approach? typescriptlang.org/play/index.html#code/…

« first day (3265 days earlier)      last day (1905 days later) »