« first day (3449 days earlier)      last day (1506 days later) » 

Paz
12:19 AM
I know you're not supposed to ask to ask,
But does anyone here can help me with a Vue.JS transition problem? with a code I'll upload to JSFiddle in case anyone can help
 
 
2 hours later…
1:54 AM
angular noob here - I wanted to call a function on click, I created an input in my html component like this

    <input type="button" value="Process Text" ng-click="test()">

and in my typescript file I added a function in the class

import { Component } from '@angular/core';
import { HttpClient } from '@angular/common/http';

@Component({
  selector: 'app-home',
  templateUrl: './home.component.html',
})
export class HomeComponent {

  constructor(private http: HttpClient) { }

  test() {
    alert("This is an example of ng-click");
 
@erotavlas Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq. You have 25 seconds to edit and format your message properly before it will be removed. Please separate code blocks from your actual question. Put your question in 1 message and then your code in a 2nd and format it.
For posting large code blocks, use a paste site like like gist.github.com, hastebin.com, pastie.org or a demo site like jsbin.com
 
2:25 AM
@erotavlas
isntead of ng-click, which is the wrong way, use (click)="test()"
 
2:37 AM
What you are using really isn't for JS which associates with 'angularjs', but you're using TS which associates simply with 'angular'
 
whether it's "angular" or "angularjs" is not a question of what language you're using
you can use typescript with angularjs and you can use javascript with angular
the difference is in age -- v1 of the framework is called "angularjs" and v2+ is called "angular"
 
You're right, i am just trying to say that ng-click really isn't used anymore
 
right, that's an angularjs thing and it does look like he's using angular
 
Supposedly google was going to stop supporting angularjs
 
3:39 AM
night yall o/
 
3:56 AM
night o/
 
 
1 hour later…
5:11 AM
AngularJS support info here:
https://docs.angularjs.org/misc/version-support-status
 
@MarioBoss 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.
 
5:28 AM
is there some npm module that can manage the mapping between env variables and a configuration file (json)?
In others words, a node program should read the config json file, IF there are env values corresponding to its properties - update them - then pass it to the program for actual consumption...
 
 
2 hours later…
7:34 AM
Would someone have a look at this and say why it's printing undefined within the chrome console? I'm getting the correct output when I enter it in jsbin.com's javascript section:
var farsiNums = {
      "0":"a",
      "1":"b",
      "2":"c",
      "3":"d",
      "4":"e",
      "5":"f",
      "6":"g",
      "7":"h",
      "8":"i",
      "9":"j",
    };
function testfunc(){
    console.log(farsiNums["3"]);
}
testfunc();
 
 
2 hours later…
9:21 AM
Nothing wrong mate
 
@DavidJapan 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…
11:08 AM
Hi All
 
11:18 AM
im trying to return an error in nodejs with next(error), it goes to the default express error code as well. But then it comes back to my controller code wherein i have my responseHandler defined
Below is my code
accountcontroller.ts

updateAccountStatus = async (req: Request, res: Response, next: any): Promise<any> => {
	let responseFromService = await AccountService.updateAccountStatus(
        parseInt(req.params.accountId),
        next
    );

	// even after the exception it comes here, after visiting the express default error code
	if (responseFromService !== undefined) {

	   responseHandler(res, 200, responseFromService);
	}

accountService.ts

  public updateAccountStatus = async (accountId: number, next: any): Promise<any> => {
 
 
1 hour later…
12:34 PM
Morn y'all
 
Anonymous
Hello. I'd like to know if anyone is good at making symbol solver. I've semantic data model and parser already
 
Anonymous
12:51 PM
For performance, codebase is in JVM now.
 
2:00 PM
from what i hear getters and setters are slow in js, however the typescript docs suggest using them instead of normal getVar and setVar. Why is this? Is performance a necessary consideration here?
 
2:25 PM
@JBis AFAIK TypeScript converts a get into using the Object.defineProperty approach
the regular js get places the function on the prototype chain while using Object.defineProperty to set a "get" method, it creates a function on the instance object itself
the former is slow, compared towards the latter
and an additional bonus: using get name(): string { ... } is more readable
(well IMO, not so knowledgeable with TS)
 
that makes a lot of sense
thanks
 
I need to check different file name to verify that all are starting with a specific language code. But I don´t get my example working, can someone take a look to tell what I´m doing wrong? jsfiddle.net/av35mjc0/3
 
2:53 PM
@elsololobo check what .every means
|| mdn array.prototype.every
 
^ read that
 
okay then the ll.every is incorrect
but datab.every should be fine
what i don´t get, if I have an array of language_codes it can be solved like this:
 
@elsololobo Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq. You have 25 seconds to edit and format your message properly before it will be removed. Please separate code blocks from your actual question. Put your question in 1 message and then your code in a 2nd and format it.
For posting large code blocks, use a paste site like like gist.github.com, hastebin.com, pastie.org or a demo site like jsbin.com
1 message moved to Trash can
 
var l = ['de', 'en_US', 'zh'];

var dataa = [
  {
    name: '1-doc.pdf'
  },
  {
    name: 'en_US-doc.pdf'
  }
];

var validFilesByLanguage = dataa.every(item => l.includes(item.name.split('-')[0]));
but with an object with two keys, where i only need one i don´t get it working
var ll = [
  { id: 1, language_code: 'en_US' },
  { id: 2, language_code: 'de' },
  { id: 3, language_code: 'zh' }
]
 
3:01 PM
seems fine
 
yeah the first one works, but actually i have an object ll. And with that i dont get it working
//How can i make this
var ll = [
  { id: 1, language_code: 'en_US' },
  { id: 2, language_code: 'de' },
  { id: 3, language_code: 'zh' }
]

//to this
var ll = ['de', 'en_US', 'zh'];
then it would work, but neither Object.entries or everthing else i found did help me
 
map
 
Hello
 
@Augustus 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.
 
@elsololobo convert one to the other
 
3:11 PM
I want some help with accessing all elements of an array at once
and use it in if() condition
 
why
 
@Augustus Whats you trying to do?
 
var users = ["name","Augustus"];
If the user's prompt input satisfies any element in that array, it should execute something
 
interesting
 
if not, else to be executed
 
3:13 PM
.includes ?
 
there's code about a page up that does that
 
const users = [{name: "Augustus"}];
wouldn't you rather something like that?
 
I'm new to JS so.. let me try that and be right back
 
@BenFortune var x = ll.map(item => item.language_code); seems to do the job. Thanks
 
@JBis How do I add many elements to name?
 
3:15 PM
I've got three classes that need to access a websocket (socket.io object) to send and listen for message, how would you design it? I could use a shared object and then import it into all the classes. How does that sound?
@Augustus users can have multiple names?
or multiple users with different names?
 
@Augustus Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq. You have 25 seconds to edit and format your message properly before it will be removed. Please separate code blocks from your actual question. Put your question in 1 message and then your code in a 2nd and format it.
1 message moved to Trash can
 
const users = ["Name1","Augustus"];
var name=prompt("Enter your ID");
if(name==users[]){

    alert("Hey"+' '+name)alert("You have been ")
}
else{
    document.documentElement.innerHTML= " ";
}
this is what i've been trying to do
 
in that case then you prob just want an array of strings and then use includes as Karel said.
 
if name=the users(any element in that array) , it should work
 
|| mdn Array incldues
 
read that ^
 
Can someone tell me why kl is optimized away and whereas y is undefined.
 
v8 engine decided you don't need that variable so it garbage collected it
 
Hi anyone used select2 with a initSelection function?
 
probably at some point in the distant past that i can't remember
 
3:27 PM
how do i include all elements?
 
morning fellas
 
this initSelection: function (element, callback) element is null
 
@JBis
 
did you read the article
 
yeah
 
3:32 PM
 
what did you learn?
 
@Jefferson that suggests that the element select2 is attached to is no more
which... is weird
what are you doing
 
@KevinB Trying to call Url.Action("GetPicklistItem")"
 initSelection: function (element, callback) {
                    console.log("GetPicklistItem");
                    console.log("element object");
                    console.log(element);
                    console.log("element object val");
                    console.log(element.val());
                    debugger;
                    getAjax("@Url.Action("GetPicklistItem")" + "?value=" + element.val(), function (result)
                    {
                        console.log("Ajax GetPicklistItem");
 
right
but none of that would cause element to be null
 
var self = this;
            $(this).select2({
                placeholder: "@Model.Settings.Placeholder",
                //allowClear: true,
                ajax: {
                    url: "@Url.Action("GetPicklistItems")",
                    contentType: 'application/json; charset=utf-8',
                    type: 'POST',
                    dataType: 'json',
                    data: function (params) {
                        return JSON.stringify({
                            query: params.term,
 
3:40 PM
nothing wrong there
at least, nothing that would make element null
 
I see the value
but when I do this element.val() is null
<div id="guidelineName" >
                        @{ Html.RenderAction("Index", "GuidelinesPicklist", new { value = Model.GuidelineId, leaveOutAlgorithmItems = true,separateActiveItems = true}); }
                    </div>
should this be set different?
 
oh, so element isn't null?
i don't know what that html you provided is
 
Sorry the val is null
 
teh value being null makes more sense
 
Any idea how to fix that?
 
3:46 PM
When working with plugins, you can't always rely on the element to have the same value the plugin does.
you have to obtain the value the way the plugin expects you to
If no selection has been made on the base select element, the value will be null.
regardless of whether or not a selection has been made in the plugin
 
So would I change the div ?
to have a value?
 
probably not
divs can't have values
only inputs, selects, and textareas have values
 
hmmm
can i do a hidden field?
 
dunno
i would follow the plugin docs
using a select plugin on an element that isn't a select doesn't make sense to me
 
you would change the div to input
 
3:53 PM
var users = ["AA","Augustus"];
var name=prompt("Enter your ID");
var names= [name];
if(names.includes(users[whatToaddHere]))
    {
    alert("Hey"+' '+name)
    alert("You have been granted access!")
}
 
no, an input isn't a select
 
I'm so stuck.. I'm new so do you mind
@JBis
 
@Augustus err
you're asking for one name
 
why are you wrapping it in an array?
what you want is to search if a value is a member of an array of values
array.includes(elementOfArray => elementOfArray === valueToSearch)
try to puzzle that in
 
so, what was wrong in mine? names.includes(users[0,1]))?
 
3:56 PM
`users` is array
`user` is value you search for
so therefore ... ?
 
@KevinB Ok I will try a select
 
users.includes(element => element === user)
drop that var names= [name];
 
if(users.includes(name))
this works..
thanks ;)
 
posted on March 26, 2020 by Josafat

We previously paused upcoming releases for Chrome and Chrome OS. Today we’re sharing an update as we’re now resuming releases with an adjusted schedule: M83 will be released three weeks earlier than previously planned and will include all M82 work as we cancelled the M82 release (all channels).Our Canary, Dev and Beta channels have or will resume this week, with M83 moving to Dev, and M81 conti

 
user12960916
4:14 PM
Does anyone know if you can save a div in local storage as a value?
 
user12960916
I'm trying to save all form data in a div and want to use that div as a value in local storage so I can get it on another page using getItem
 
localstorage can only store strings
if you can make it a string that has the data you want, sure.
note however that the value attribute doesn't always contain the current value.
 
|| mdn form data
 
@KevinB Is there anything else I can try?
 
4:32 PM
dunno
 
user12960916
4:42 PM
i havent learned how to use FormData yet. If I take the data and add it to a div like so:
 
user12960916
document.getElementById("displayInfo").innerHTML = "Title" + title + "Name" + name + "Age" + age etc...
 
user12960916
and then add it like this
 
i mean... why not just store that data in localstorage?
 
user12960916
 localStorage.setItem("All Info", displayInfo);
 
what do you need the div for?
 
user12960916
4:43 PM
im using that div because i want that data to be displayed on another page in that div
 
so create that div in the other page
 
user12960916
but if i want the div that contains the data to already be been when i open the other page wouldnt i need to create it before hand?
 
user12960916
*there
 
no
because... you gotta pull it out of localstorage and put it on the page
you mightaswell put it in a div at that step rather than before
 
user12960916
ok thanks
 
user12960916
4:51 PM
im not sure whats the correct way to add the keys to the div would you do it like this?
 
user12960916
document.getElementById("displayInfo").innerHTML = localStorage.getItem("Title") + localStorage.getItem("Name")?
 
i would use json
 
user12960916
because if you just write the keys like this "Name" + "Title+ isn't that only a string being added not the actual key from local storage
 
it's made for this kind of stuff
 
user12960916
the JSON.stringify?
 
4:52 PM
yup
make an object/array, stringify it on one end, parse it on the other
 
user12960916
alright thanks!
 
@KevinB Can I use the id at all?
 
for what
 
@KevinB to get the value?
 
what value
id on what?
 
5:03 PM
the div
 
divs don't have values
 
so would I be able to use the id
 
...
 
 
1 hour later…
6:04 PM
posted on March 26, 2020 by Srinivas Sista

The Dev channel has been updated to 83.0.4093.3 for Windows, Mac, and Linux platforms. A partial list of changes is available in the log. Interested in switching release channels? Find out how. If you find a new issue, please let us know by filing a bug. The community help forum is also a great place to reach out for help or learn about common issues. Srinivas Sista Google Chrome

 
6:26 PM
i am using anular and trying to call an api this is what I get
TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them
and this is how I'm trying to make the call
getBlogPosts(): Observable<BlogPost[]> {
    return this.http.get<BlogPost[]>(this.myAppUrl + this.myApiUrl)
    .pipe(
      retry(1),
      catchError(this.errorHandler)
    );
  }
 
@Riccardo Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq. You have 25 seconds to edit and format your message properly before it will be removed. Please separate code blocks from your actual question. Put your question in 1 message and then your code in a 2nd and format it.
 
can anyone tell me why I'm failing to make the call to the server?
 
6:52 PM
posted on March 26, 2020 by Prudhvikumar Bommana

The beta channel has been updated to 81.0.4044.83 for Windows, Mac, and, Linux. A full list of changes in this build is available in the log. Interested in switching release channels?  Find out how here. If you find a new issue, please let us know by filing a bug. The community help forum is also a great place to reach out for help or learn about common issues. Prudhvikumar Bommana Go

 
7:40 PM
@Unbreachable ok thank you, it works :), sorry found ng-click on some SO answers so I assumed it was the way to do it. Also the code I'm using is from the template project for Visual Studio ASP.NET web app using Angular (i think its version 8 of angular according to package.json)
 
 
3 hours later…
11:00 PM
posted on March 26, 2020 by Myles Borins

Notable Changes build: macOS package notarization (Rod Vagg) #31459 deps: upgrade npm to 6.14.4 (Ruy Adorno) #32495 update to uvwasi 0.0.6 (Colin Ihrig) #32309 upgrade to libuv 1.35.0 (Colin Ihrig) #32204 lib: add --disable-proto option to cli (Gus Caplan) #32279 node_report: move diagnostic reports to stable (Colin Ihrig) #32242 worker: allow URL in Worker constructor (Antoine du HAME

 
11:29 PM
@Riccardo Is it only happening to that function? Do you have others that also use the 'pipe' method?
 
yes I haven't tested the other but I suppose they will not work too
@Unbreachable
 
Hmm where are you subscribing?
Are you using 'subscribe' at all?
 
i think so let me check it out
this.blogPostService.saveBlogPost(blogPost)
        .subscribe((data) => {
          this.router.navigate(['/crud', data.postId]);
          console.log(data);
        });
I sue it to post requests
use*
@Unbreachable
 
Well, from what I know, I think the reason it throws that error is because you're using pipe instead of subscribing on the get
subscribe is what actually executes it
 
Hello people, some question about complexity, imagine that you have a 2D game and the world map is a square, x and y represents tile position.
Now the game has objects, one tile can contain multiple objects.

The game objects on map structured like this: HashMap<Integer, List<GameObject>>, where the integer key represents the X position of the object, meaning that it will contain a list of all objects with the same X, on different Ys.

What algorithm can be used there to find 10 closest objects to a given position on this data structure without changing it?
 
11:44 PM
@Unbreachable so what am i supposed to do?
 
use subscribe.....
 
instead of pipe
 
What you're doing with 'pipe' is simply chaining operators, but nothing really happens. Try replacing that with 'subscribe'
 
but I'm not sure to know how to use it would you give me an example based on the code I sent you
i'm quite a beginner of Angular
on*
@un
@Unbreachable
 
getBlogPosts(): Observable<BlogPost[]> {
    return this.http.get<BlogPost[]>(this.myAppUrl + this.myApiUrl)
		.subscribe((data) => {}, (errResp) => {
			if (errResp) {
				// handle error
			}
		});
  }
Note: You can only have one subscribe, so you won't be able to have another subscribe when you handle this in the Component
 

« first day (3449 days earlier)      last day (1506 days later) »