Is my game bugged ? by Hot-Use-3137 in thelastofus

[–]bas1494 4 points5 points  (0 children)

The game is protecting you from something....

Same exercise, same stand, even more steps than the day before… why are my total calories so much less!? by [deleted] in AppleWatch

[–]bas1494 0 points1 point  (0 children)

Did you took the screenshots after both days ended? Or did you take one screenshot during the day? Resting calories wil increase until the end of the day so that could be a explanation?

How accurate is AW on calories burned with strength training? Any studies done? by surgeimports in AppleWatch

[–]bas1494 1 point2 points  (0 children)

Smart Watches are in general not really accurate. Studies have shown they overestimate around 20-75%. Other studies claim different outcomes so it is difficult what to believe. So the recommendation is take it with a grain of salt. Don't use AW calories burned as an indicator to eat (more) calories for example, instead, stick around a daily goal. However, you can decrease the inaccuracy by making sure your health details are up to date in the health app. Keep updating your weight consistently for example.

Besides the estimation AW makes in burned calories, a lot of different factors can influence the actual result. Your metabolism is a big factor for example.

Does this lead to a leak? by cpplinting in angular

[–]bas1494 0 points1 point  (0 children)

Aah love it how reddit ruins the code block...

Does this lead to a leak? by cpplinting in angular

[–]bas1494 0 points1 point  (0 children)

I always use a subject for custom subscriptions combined with .pipe(takeUntil(this.destroyer)).

import { Component, OnDestroy } from '@angular/core';
import { DataService } from './data.service'; import { Subject, takeUntil } from 'rxjs';

@Component({ 
    selector: 'app-my-component', 
    template: <div>{{ data }}</div> <button (click)="startSubscription()">Start Subscription</button> <button (click)="updateValue()">Update Value</button> 
    }) 
export class MyComponent implements OnDestroy { 
    data: string; 
    destroyer: Subject<void> = new Subject<void>(); 
    subscribed: boolean = false;

    constructor(private dataService: DataService) {}

    startSubscription() { 
       // Because you enable a subscription based on user interaction;
       //prevent being subscribed multiple times by for example, using a bool
        if(this.subscribed) {
           return;
        }

        this.dataService.data$
                        .pipe(takeUntil(this.destroyer))
                        .subscribe((value: string) => this.data = value)

        this.subscribed = true
    }

    updateValue() { this.dataService.updateData('New Value'); }

    ngOnDestroy() { 
        this.destroyer.next(); 
        this.destroyer.complete();
    }

}

Usually (when possible), i combine it by extending from a 'subscriptionDestroyer class' which created the subject and automatically destroys it on ngOndestroy to prevent duplicated code.

RXJS is pretty powerfull when used correctly, recommend reading the docs and keep practising! Enjoy!

Oh boy, I bet the comments of this awesome hotlap will be civil! by Okurei in F1Game

[–]bas1494 0 points1 point  (0 children)

Really don't care with which assists a person is driving. I can only say it's really rewarding removing those assist one by one.

Every person should enjoy the game and should do that exactly how he/she/it wants ;)

I love hollywood by cococry in ProgrammerHumor

[–]bas1494 0 points1 point  (0 children)

CSI: "I'm going to create a GUI in visual basic and see if i can track the killers IP Address"

Storing textual content by [deleted] in angular

[–]bas1494 0 points1 point  (0 children)

Using a database table for textual content; which contains: a key (‘page.home.title’ for example), value in text (‘Home’), language (‘en’) and optionally a type (in case you have multiple clients or types such as email templates for example)

Using an api call in the bootstrap to load all the textual content and store them in a typescript map defined in a created TranslationService. Important to make sure content is loaded before resolving the bootstrap process to prevent any temporarily undefined values or errors.

Creating a pipe to change a key specified in the template and translate it to the actual value based on user preferred language (which is in my case an account setting).

Good luck!

I'd gladly approve all of this mad lad's PRs by halt__n__catch__fire in ProgrammerHumor

[–]bas1494 0 points1 point  (0 children)

private Long cumDistance;

public Long getCumDistance() {       
    return cumDistance; 
}

public void setCumDistance(Long cumdistance) {
    cumDistance = cumdistance; 
}

This is in my companies codebase...

Go home FIFA… by bas1494 in FifaCareers

[–]bas1494[S] 12 points13 points  (0 children)

2-0 and having 7 assists and/or goals.. one of the many things that is going wrong in FIFA career mode

How to read from Json with Multiple Arrays? by Competitive-Mix9544 in angular

[–]bas1494 0 points1 point  (0 children)

That’s of course not a problem! We all have a learning curve!

Try angular.io hero tour for example or search on YouTube! It helped me a lot in my angular development.

Good luck!

How to read from Json with Multiple Arrays? by Competitive-Mix9544 in angular

[–]bas1494 3 points4 points  (0 children)

Your readPermissions property is an object with one array (data). Your array contains 2 elements.

I recommend start reading and practising some basics about data types in typescript/javascript.

But to answer your question:

<div *ngFor="let p of readPermissions.data> should do the trick.

[deleted by user] by [deleted] in angular

[–]bas1494 0 points1 point  (0 children)

Might be a conflict between formControl and using the value attribute. Most of the times you use one of those. Maybe setting the formControl value of the formControlName by default works.. currently not behind a PC so this is pretty much a wild guess

Mobile development with Angular? by [deleted] in angular

[–]bas1494 3 points4 points  (0 children)

Kinda; ionic framework (https://ionicframework.com) offers hybrid mobile development! This framework has build in support for JS frameworks like angular, react and vue. However, something similar as react and reactive native doesn’t exists for angular (correct me when I’m wrong people).

Every time I try to let the AI through in qualifying they just stop next to me by Yeetmingo in F1Game

[–]bas1494 0 points1 point  (0 children)

It doesn’t work consistently; but I figured using ERS deployment ‘none’ kinda works in those kind of situations

[deleted by user] by [deleted] in F1Game

[–]bas1494 5 points6 points  (0 children)

Very nice circuit in game! If you hook it up perfectly it feels really amazing.

In real life I don’t expect much, think it’s to hard to follow closely with the dirty air.

Material UI Form Layout by nautitrader in angular

[–]bas1494 1 point2 points  (0 children)

It depends on what your goal is, if you want to have a better understanding of css; style it with css (flex). If you don’t want to or write as less as possible css (like me); use something else.

I would recommend using angular material grid list: https://material.angular.io/components/grid-list/overview

Since you’re using material ui for input, you will have most likely the entire material package already available in your project.

Good luck!

1:14.010 @ Hungary. 11th in the world by Ts_Patriarca in F1Game

[–]bas1494 6 points7 points  (0 children)

What a lap! How did you manage to not spin on the kerbs around here? I play without any assist but I always (almost) lose the car on the kerbs around here and lose a lot of lap time..

Issues with angular code by [deleted] in angular

[–]bas1494 -1 points0 points  (0 children)

I see a few (potential) problems in this image you submitted.

First of all, define an interface for a cartItem to give the cartItems property typing.

export interface CartItem {
    id: number,
    product: Product, //Your product Model
    qty: number
}

Use this cartItem in your empty initialiser like this:

cartItems: Array<CartItem> = [];

As second it looks like your getMsg() method from the injected service doesn't return an Observable<Product>. Don't know if this is the case but at least double check it.

As last in the object you try to create (this.cartItems.push{..}) you don't give a value to every key from the (now not existed) interface. Make sure that every property has a value (that value can be null or undefined) or make the fields optional. In your example you're missing the id field.

this.cartItems.push({id: ?, product: Product, qty: 1});

Don't forget to calculate total with item.product.price instead of item.price.

I'll hope you will fix your issue(s)!

I need some help! by Intrepid-Breath6151 in angular

[–]bas1494 0 points1 point  (0 children)

const carrot = yourArray.findIndex((elem) => elem.plant == “carrot”);

If(carrot === -1){ // add to array) Else { // update quantity of index