Angular Flashcards

1
Q

is a container for a group of related components. Every Angular app has at least one of these called App module

A

Module

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

are the main building block for Angular applications. Each one of these consists of: An HTML template that declares what renders on the page. A Typescript class that defines behavior. A CSS selector that defines how the (blank) is used in a template.

A

Components

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

A blank is one of the properties of the object that we use along with the component configuration. A blank is used to identify each component uniquely into the component tree, and it also defines how the current component is represented in the HTML DOM

A

Selector

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

A blank is a blueprint for creating an object, we call that created object an instance of a class, or a class instance or just instance for short. We instantiate a blank by using the new keyword and when that happens JavaScript calls the constructor function.

A

Class

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Blank in Angular is put into use to inject dependencies into the component class. It creates a new instance of the class when the compiler calls ‘new MyClass ()’. While calling ‘new MyClass()’, it is vital that the exact match of the parameter passes the Angular component blank of the class.

A

Constructor

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

To use ngOnInit in Angular, it is required to import into the component class in this way – import {Component, OnInit} from ‘@angular/core’. Though implementing ngOnInit for every component is not essential, it is a good practice that further heads towards the smooth functioning of the platform. Angular ngOnInit is created by Angular itself. Angular also renders and checks the changes in its data bounded properties. It is interesting to note that Angular destroys the component before removing it from DOM. ngOnInit in Angular can be hooked to components and directives. Defining the ngOnInit Angular in the class helps Angular runtime to know that is the right time to call the method. The major benefit of this approach is that it adds specific initialization logic near the class lifecycle.

A

ngOnInit

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

In Angular, a blank is a chunk of HTML. Use special syntax within a template to build on many of Angular’s features.

A

Template

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Dependencies are services or objects that a class needs to perform its function. Dependency injection, or DI, is a design pattern in which a class requests dependencies from external sources rather than creating them.

Angular’s DI framework provides dependencies to a class upon instantiation. You can use Angular DI to increase flexibility and modularity in your applications.

A

Dependency injection in Angular

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

They are instructions in the DOM. They are classes that add additional behavior to elements in your Angular applications. With Angular’s built-in directives, you can manage forms, lists, styles, and what users see.

A

Directives

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Components—directives with a template. This type of directive is the most common directive type.
Attribute directives—directives that change the appearance or behavior of an element, component, or another directive.
Structural directives—directives that change the DOM layout by adding and removing DOM elements.

A

The different types of Angular directives are as follows:

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Decorators are functions that are invoked with a prefixed @ symbol, and immediately followed by a class , parameter, method or property. The decorator function is supplied information about the class , parameter or method, and the decorator function returns something in its place, or manipulates its target in some way.

A

Decorators

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Class decorators, e.g. @Component and @NgModule.
Property decorators for properties inside classes, e.g. @Input and @Output.
Method decorators for methods inside classes, e.g. @HostListener.
Parameter decorators for parameters inside class constructors, e.g. @Inject.

A

What are types of decorators in Angular?
There are four main types:

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Property binding in Angular helps you set values for properties of HTML elements or directives. Use property binding to do things such as toggle button functionality, set paths programmatically, and share values between components.

A

Property binding

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Event binding lets you listen for and respond to user actions such as keystrokes, mouse movements, clicks, and touches.

A

Event binding

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Is like a reserved variable name that you can use in the template when using event binding. It is the data emitted with said event. It gives us access to event data it allows you to fetch event data. Allows you to grab any data an event passes to us

A

($event)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

It will trigger on the input event and update the value of the server name in our component automatically.
It will also update the value of the input element if we change the value of server name somewhere else

A

[(@ngModel)]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

What are the four form of data binding

A

Event Binding, String Interpolation, Property Binding, and Two Way Binding.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

When building your applications and creating logic, there are times when you want to make comparisons between two or more things. They can be abstract things; they can be items in a list or array or even an object. Angular provides directives to handle these situations called conditionals. So, there is ngIf for times when you want to check for a true or false value, and there is ngFor mostly for a list of items either in an object or an array.

A

Conditionals

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

is an Angular directive from the router library that is used to insert the component matched by routes to be displayed on the screen.

A

Router-Outlet

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

is a directive which binds input, select and textarea, and stores the required user value in a variable and we can use that variable whenever we require that value. It also is used during validations in a form. We can use blank with: input. text.

A

ngModel

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

We’ll be learning about the @Input() decorator. … Using the @Input() decorator we can instruct the Angular framework that a property in our directive’s class is an input property, and as such, the value of that property can be set via an input binding on the host element.

A

What is input directive in Angular?
Input data into a Directive

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

The child component uses the @Output() property to raise an event to notify the parent of the change. To raise an event, an @Output() must have the type of blank , which is a class in @angular/core that you use to emit custom events.

A

What is the use of EventEmitter in angular?

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

Getting the input at the point and time that I click the button. You use blank
A blank can be placed on any html element. You can only use a local reference in your template/ or html page

A

Local Reference

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

Getting access to local reference or any element directly from our typescript code. This works before you call a method.

A

@Viewchild

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Q

Use blank to quickly execute reusable code in multiple places without having to set up.

A

ng-content

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
26
Q

All the basic types e.g. int, boolean, char, short, float, long and double are known as primitive types. … The main difference between primitive and reference type is that primitive type always has a value, it can never be null but reference type can be null, which denotes the absence of value.

A

What is the difference between primitive and reference type?

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
27
Q

An blank is a pattern that listens to a named event, fires a callback, then emits that event with a value. Sometimes this is referred to as a “pub/sub” model, or listener. It’s referring to the same thing

A

Event Emitter

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
28
Q

Input is used to receive data in whereas Output is used to send data out. Output sends data out by exposing event producers, usually EventEmitter objects. by the way, I will produce and send data out via the onChange property.
A common pattern in Angular is sharing data between a parent component and one or more child components. … @Input() lets a parent component update data in the child component. Conversely, @Output() lets the child send data to a parent component.

A

The difference between @input and @output angular

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
29
Q

The square brackets that are used with ngClass or some directive signify that we are binding to some property on said directive or ngClass

A

Little reminder about how square brackets indicate property binding when used with directives

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
30
Q

There are three kinds of directives in Angular: Components—directives with a template. Structural directives—change the DOM layout by adding and removing DOM elements. Attribute directives—change the appearance or behavior of an element, component, or another directive

A

What is attribute directive What are the types?

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
31
Q

Directives go in our templates so we can attach them to our elements

A

Yup

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
32
Q

blank is a life cycle hook called by Angular to indicate that Angular is done creating the component. Implement this interface to execute custom initialization logic after your directive’s data-bound properties have been initialized.

A

NgOnInit

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
33
Q

The constructor() should only be used to initialize class members but shouldn’t do actual “work”. So we should use constructor() to set up Dependency Injection, Initialization of class fields, etc. ngOnInit() is a better place to write “actual work code” that we need to execute as soon as the class is instantiated.

A

Why we use ngOnInit instead of constructor?

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
34
Q

The new operator instantiates a class by allocating memory for a new object. Note: The phrase “instantiating a class” means the same thing as “creating an object”; you can think of the two as being synonymous. When you create an object, you are creating an instance of a class, therefore “instantiating” a class.

A

What does it mean to instantiate an object?

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
35
Q

Observables provide support for passing messages between parts of your application. They are used frequently in Angular and are a technique for event handling, asynchronous programming, and handling multiple values.

A

Observables

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
36
Q

The observer pattern is a software design pattern in which an object, called the subject, maintains a list of its dependents, called observers, and notifies them automatically of state changes. This pattern is similar (but not identical) to the publish/subscribe design pattern.

A

Observables Part 2

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
37
Q

Means the execution of a program or function.

A

Invocation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
38
Q

1) In object-oriented programming, the state of an object is the combination of the original values in the object plus any modifications made to them. (2) The current or last-known status, or condition, of a process, transaction or setting. “Maintaining state” or “managing state” means keeping track of the process.

A

State of an object

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
39
Q

The addNewItem() function uses the @Output(), newItemEvent, to raise an event with the value the user types into the .

A

export class ItemOutputComponent {

@Output() newItemEvent = new EventEmitter();

addNewItem(value: string) {
this.newItemEvent.emit(value);
}
}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
40
Q

In synchronous operations tasks are performed one at a time and only when one is completed, the following is unblocked. In other words, you need to wait for a task to finish to move to the next one. In asynchronous operations, on the other hand, you can move to another task before the previous one finishes.

A

Synchronous & Asynchronous

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
41
Q

Reactive programming is an asynchronous programming paradigm concerned with data streams and the propagation of change (Wikipedia). RxJS (Reactive Extensions for JavaScript) is a library for reactive programming using observables that makes it easier to compose asynchronous or callback-based code.

A

What is the use of RxJS in Angular?

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
42
Q

In this case, @Input() decorates the property item, which has a type of string, however, @Input() properties can have any type, such as number, string, boolean, or object. The value for item comes from the parent component.

A

import { Component, Input } from ‘@angular/core’; // First, import Input
export class ItemDetailComponent {
@Input() item = ‘’; // decorate the property with @Input()
}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
43
Q

test() are methods on a regular expression object. . match() is a method on a string and takes a regex object as an argument. . test() returns a boolean if there’s a match or not

A

test() and match in Regex

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
44
Q

Reactive forms provide direct, explicit access to the underlying forms object model. Compared to template-driven forms, they are more robust: they’re more scalable, reusable, and testable. If forms are a key part of your application, or you’re already using reactive patterns for building your application, use reactive forms.

A

Reactive forms

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
45
Q

Template-driven forms rely on directives in the template to create and manipulate the underlying object model. They are useful for adding a simple form to an app, such as an email list signup form. They’re straightforward to add to an app, but they don’t scale as well as reactive forms. If you have very basic form requirements and logic that can be managed solely in the template, template-driven forms could be a good fit.

A

Template-driven

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
46
Q

Common form foundation classes
Both reactive and template-driven forms are built on the following base classes.

FormControl tracks the value and validation status of an individual form control.

FormGroup tracks the same values and status for a collection of form controls.

FormArray tracks the same values and status for an array of form controls.

ControlValueAccessor creates a bridge between Angular FormControl instances and built-in DOM elements.

A

Common form foundation classes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
47
Q

In Angular, form controls are classes that can hold both the data values and the validation information of any form element. Every form input you have in a reactive form should be bound by a form control. These are the basic units that make up reactive forms

A

Form Control

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
48
Q

FormControl is a class in angular that allow us to manipulate every input field in a form so you can create an instance of the control class. with the control class you can check the value, touched, untouched, dirty, pristine, valid, and errors. These are property’s of form control

A

More On FormControl

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
49
Q

FormGroup is a class that represents a group of controls in a form. Each form is essentially a control group because it contains a least on control. You can use the from control built in properties with FormGroup

A

FormGroup

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
50
Q

pristine: Data entry has not been touched.
dirty: (Input field has been interacted with).
touched: (Input field has received focus).
valid: (Data entry has passed validation)
invalid: (Data entry has not passed validation)
errors: Where data entry have not satisfied the rule

A

Properties of FormControl and these can be used with FormGroup

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
51
Q

Place this code in the html file and where you want to test it —> #emailTest=”ngModel” (change)=”log(emailTest)”

The second part goes in the ts file under export class.
Place this code log(x) { console.log(x); } and that is it!

A

Testing validation in ionic/Angular

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
52
Q

Angular router can interpret a browser URL as an instruction to navigate to a client-generated view. It can pass optional parameters along to the supporting view component that help it decide what specific content to present.

A

What is the use of router in Angular?

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
53
Q

It’s a method that comes from rxjs library which Angular is using internally.

If you can imagine yourself subscribing to a newsletter, every time there is a new newsletter, they will send it to your home (the method inside subscribe gets called).

That’s what happens when you subscribing to a source of magazines ( which is called an Observable in rxjs library)

All the AJAX calls in Angular are using rxjs internally and in order to use any of them, you’ve got to use the method name, e.g get, and then call subscribe on it, because get returns and Observable.

Also, when writing this code , Angular is using Observables internally and subscribes you to that source of event, which in this case is a click event.

Back to our analogy of Observables and newsletter stores, after you’ve subscribed, as soon as and as long as there is a new magazine, they’ll send it to you unless you go and unsubscribe from them for which you have to remember the subscription number or id, which in rxjs case it would be like :

let subscription = magazineStore.getMagazines().subscribe(
(newMagazine)=>{

     console.log('newMagazine',newMagazine);

});  And when you don't want to get the magazines anymore:

subscription.unsubscribe();
Also, the same goes for

this.route.paramMap
which is returning an Observable and then you’re subscribing to it.

A

What is .subscribe in Angular?

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
54
Q

AJAX calls are one method to load personalized content separately from the rest of the HTML document, which allows for the full HTML document to be cached, improving back end load time

A

What is an ajax call?

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
55
Q

is a string that refers to a resource.

The most common are URLs, which identify the resource by giving its location on the Web. URNs, by contrast, refer to a resource by a name, in a given namespace, such as the ISBN of a book.

A

A URI (Uniform Resource Identifier)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
56
Q

What are escape sequences?
Character combinations consisting of a backslash () followed by a letter or by a combination of digits are called “escape sequences.” To represent a newline character, single quotation mark, or certain other characters in a character constant, you must use escape sequences.

A

What are escape sequences?

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
57
Q

encodeURIComponent()
The encodeURIComponent() function encodes a URI by replacing each instance of certain characters by one, two, three, or four escape sequences representing the UTF-8 encoding of the character (will only be four escape sequences for characters composed of two “surrogate” characters).

A

encodeURIComponent()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
58
Q

(keyup) is an Angular event binding to respond to any DOM event. It is a synchronous event that is triggered as the user is interacting with the text-based input controls. When a user presses and releases a key, the (keyup) event occurs.

A

(keyup)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
59
Q

GET is used for viewing something, without changing it, while POST is used for changing something. For example, a search page should use GET to get data while a form that changes your password should use POST . Essentially GET is used to retrieve remote data, and POST is used to insert/update remote data

A

GET and POST

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
60
Q

A RESTful API is an architectural style for an application program interface (API) that uses HTTP requests to access and use data. That data can be used to GET, PUT, POST and DELETE data types, which refers to the reading, updating, creating and deleting of operations concerning resources.

A

What is REST API and why it is used?

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
61
Q

For example, a REST API would use a GET request to retrieve a record, a POST request to create one, a PUT request to update a record, and a DELETE request to delete one. All HTTP methods can be used in API calls. A well-designed REST API is similar to a website running in a web browser with built-in HTTP functionality.

A

What is REST API example?

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
62
Q

Headers in a HTTP request or response is the additional information that is transferred to the user or the server. In postman, the headers can be seen in the Headers tab

A

Headers

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
63
Q

What is header and body in Postman?
Image result for what are headers in postman
The Body tab in Postman allows you to specify the data you need to send with a request. … If you use raw mode for your body data, Postman will set a header based on the type you select (e.g. text, json).

A

What is header and body in Postman?

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
64
Q

Are parameters variables in JavaScript?
Functions are obviously very important in Javascript. When talking about functions, the terms parameters and arguments are often interchangeably used as if it were one and the same thing but there is a very subtle difference. Parameters are variables listed as a part of the function definition

A

Are parameters variables in JavaScript?

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
65
Q

Hot Reload
Hot reload just displays the code changes according to new code changes without restarting the app from the start and its effects only on the changed code or change will only apply to a specific component.

A

Hot Reload

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
66
Q

A change listener is similar to a property change listener. A change listener is registered on an object — typically a component, but it could be another object, like a model — and the listener is notified when the object has changed.

A

Change listener

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
67
Q

NgModel
DIRECTIVE
Creates a FormControl instance from a domain model and binds it to a form control element.

A

NgModel
DIRECTIVE

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
68
Q

Element: blur event
The blur event fires when an element has lost focus. The main difference between this event and focusout is that focusout bubbles while blur does not.

The opposite of blur is focus.

A

Element: blur event

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
69
Q

The (change)=”changeFn($)” will fire after the value bound to [(ngModel)] has changed
The (ngModelChange)=”modelChangeFn($event)” will fire before the value bound to [(ngModel)] has changed.

A

What about when the event fires and the model value is set?

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
70
Q

npm install br-mask –save -E

A

Auto format Phone numbers

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
71
Q

IsLoadingService is a simple angular service for tracking whether your app, or parts of it, are loading. By subscribing to its isLoading$() method, you can easily know when to display loading indicators.

A

What is isLoading in angular?

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
72
Q

Definition and Usage. The ng-submit directive specifies a function to run when the form is submitted. If the form does not have an action ng-submit will prevent the form from being submitted.

A

ng-submit directive

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
73
Q

The name attribute specifies a name for an HTML element.

This name attribute can be used to reference the element in a JavaScript.

For a element, the name attribute is used as a reference when the data is submitted.

For an element, the name attribute can be used to target a form submission.

For a element, the name attribute is associated with the <img></img>’s usemap attribute and creates a relationship between the image and the map.

For a element, the name attribute specifies a name for the information/value of the content attribute.

For a element, the name attribute is used together with the value attribute to specify parameters for the plugin specified with the tag.

A

HTML name Attribute

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
74
Q

The constructor() should only be used to initialize class members but shouldn’t do actual “work”. So we should use constructor() to setup Dependency Injection, Initialization of class fields etc. ngOnInit() is a better place to write “actual work code” that we need to execute as soon as the class is instantiated.

A

Why we use ngOnInit instead of constructor?

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
75
Q

To instantiate is to create an object from a class using the new keyword. … A class contains the name, variables and the methods used. The variables and methods belonging to a class are called member variables and member methods. To reference the desired member variable or method of the instance use the dot operator.

A

To instantiate is to create…….

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
76
Q

Since git rebase command essentially re-writes git history, it should never be used on a branch which is shared with another developer (Unless both developers are kind of git experts). Or as its also said, never use the rebasing for public branches.

A

The Golden Rule of Git Rebase

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
77
Q
  1. Public: All the properties and methods could be accessed everywhere if they are declared as public. 2. Private: The private declared properties and methods can be accessed only within the class definition itself.
A

What is public and private in angular?

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
78
Q

I have tried (ionInput) but did not fired any event in it . then I tried (input) then it worked for me. So make sure you are correct at it or may be i am missing at some point.

Now difference between (input) & (ionChange)

(input) : This event fires when user tries to enter value in input field, it will fire even when user copy same value and paste it in field. because it does not mater which value is get entered in it.
(ionChange): This event fires only when user change value of input field. if user copy and paste same value it will not get fired.but if user enters different value then it will fire. because it matters values of input field.

A

The difference between (input) & (ionChange)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
79
Q

I guess you misunderstood what a type assertion does. It’s not something that compiler ensures, it’s a kind of “waiver” you give the compiler saying “I hereby renounce the right to have this type checked, I guarantee that it will be X at run-time and I’m responsible for consequences if it is not”.

By using the ! assertion you’re basically telling the compiler “shut up, I know better, this never gonna be null”. The compiler has no option but to agree with you, but if you don’t keep your promise (which you don’t), a run time fault is imminent.

Obviously, a type assertion is almost never a good idea. Finally, the whole point of Typescript is to have your types statically checked. Think twice before putting ! or as here and there.

A

The non-null assertion operator

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
80
Q

The non-null assertion operator is a concise way of avoiding unnecessary null and undefined checks in our code. We should only use this when we definitely know the variable or expression can’t be null or undefined

A

The non-null assertion operator part two

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
81
Q

To use a service you have to pass it into the constructor as a provider

A

Yup

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
82
Q

A provider is an object declared to Angular so that it can be injected in the constructor of your components, directives and other classes instantiated by Angular. … A service is a particular type of provider that is declared with its class name, as you can see in the Angular tutorial.
Providers are classes that create and manage service objects the first time that Angular needs to resolve a dependency. Providers is used to register the classes to an angular module as a service. And then, this service classes can be used by other components during the itself creation phase in the module.

A

A provider

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
83
Q

The HTTP client in Angular returns an observable

A

Correct

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
84
Q

That means it will subscribe itself to the observable of interest (which is getTasks() in your case) and wait until it is successful and then execute the first passed callback function which in your case is: tasks => { console. log(tasks); }

A

Subscribe

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
85
Q

The .subscribe() function is similar to the Promise.then(), .catch() and .finally() methods in jQuery, but instead of dealing with promises it deals with Observables.

A

Subscribe part 2

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
86
Q

A collection of matrix and query URL parameters.

A

Correct

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
87
Q

Declarations are for components and imports are for Modules

A

Also Correct

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
88
Q

In the context of web and network programming:

When we call a function the function may return a value. When we call a function and the function is supposed to send those results to another function we will not user return anymore. Instead we use emit. We expect the function to emit the results to another function by our call.

A function can return results and emit events.

A

Emit

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
89
Q

export interface Task {
}

A

You use the export, so that you can bring the data into other files in the app

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
90
Q

export class TasksComponent implements OnInit {
tasks: Task[] = TASKS;
Task[] is your interface and TASKS is the actual data

A

You can use this in your task component to loop over the mock data array and output whatever we want for each particular set of data

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
91
Q

let task of tasks is for looping over the mock data file

A

you use the *ngFor directive

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
92
Q

Territory mapping
Sales territory mapping is the process of defining the area, sales, and revenue that your reps are responsible for targeting. If done properly, it can help you reach the right customers, hit revenue goals, and promote growth. Traditionally, sales territory mapping is based on a single, simple factor: geography.

A

Territory mapping

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
93
Q

A source layer is an individual layer of data within a vector source. A vector source can have multiple source layers. A source layer differs from a style layer, which is used to add styling rules to a specific subset of data in a map style.

A

What is source layer in Mapbox?

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
94
Q

This is a custom mode for @mapbox/mapbox-gl-draw that displays data stored in Draw but does not let the user interact with it. This mode used to be one of the core modes prior to the v1. 0.0 release of Mapbox Draw.

A

Mapbox Draw Static Mode

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
95
Q

Simple loading modal to block users from preforming actions on a page while gracefully indicating the state of a background process.

A

Loading Modal

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
96
Q

Toast are the message box or you can say notification box which you can use to show messages/notification on top of the view. Toast displays a message below in the header at the top of the view. In this blog, we are going to learn about how to show toast in salesforce Lightning record page by using “force:showToast”

A

ShowToast

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
97
Q

With Feature State, you can update the “state” of a feature at run-time, allowing control over the style of the individual feature without the map rendering engine (Mapbox GL) having to re-parse the underlying geometry and data

A

Feature State

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
98
Q

showArea

A

It shows exactly where you are at on the map

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
99
Q

A handler is a routine/function/method which is specialized in a certain type of data or focused on certain special tasks. Examples: Event handler - Receives and digests events and signals from the surrounding system (e.g. OS or GUI). Memory handler - Performs certain special tasks on memory

A

What is a handler function?

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
100
Q

TypeScript infers the type of the e parameter in handleChange to be any . So, no type checking will occur when e is referenced in the handler implementation. … So, the type is ChangeEvent .

A

What is type of e in TypeScript?

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
101
Q

The preventDefault() method of the Event interface tells the user agent that if the event does not get explicitly handled, its default action should not be taken as it normally would be.

The event continues to propagate as usual, unless one of its event listeners calls stopPropagation() or stopImmediatePropagation(), either of which terminates propagation at once.

As noted below, calling preventDefault() for a non-cancelable event, such as one dispatched via EventTarget.dispatchEvent(), without specifying cancelable: true has no effect.

A

Event.preventDefault()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
102
Q

Ruby on Rails

A

Ruby on Rails

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
103
Q

To get Rails saying “Hello”, you need to create at minimum a route, a controller with an action, and a view. A route maps a request to a controller action. A controller action performs the necessary work to handle the request, and prepares any data for the view. A view displays data in a desired format.

A

What do you need to say hello in ruby?

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
104
Q

In terms of implementation: Routes are rules written in a Ruby DSL (Domain-Specific Language). Controllers are Ruby classes, and their public methods are actions. And views are templates, usually written in a mixture of HTML and Ruby.

A

What are the terms of implementation in ruby?

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
105
Q

A model is a Ruby class that is used to represent data. Additionally, models can interact with the application’s database through a feature of Rails called Active Record.

To define a model, we will use the model generator:

A

Generating a Model

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
106
Q

Migrations are used to alter the structure of an application’s database. In Rails applications, migrations are written in Ruby so that they can be database-agnostic.

Let’s take a look at the contents of our new migration file:

A

5.2 Database Migrations

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
107
Q

To play with our model a bit, we’re going to use a feature of Rails called the console. The console is an interactive coding environment just like irb, but it also automatically loads Rails and our application code.

A

5.3 Using a Model to Interact with the Database

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
108
Q

A Ruby module is an important part of the Ruby programming language. It’s a major object-oriented feature of the language and supports multiple inheritance indirectly. A module is a container for classes, methods, constants, or even other modules.

A

Is Ruby Object oriented

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
109
Q

The new route is another get route, but it has something extra in its path: :id. This designates a route parameter. A route parameter captures a segment of the request’s path, and puts that value into the params Hash, which is accessible by the controller action. For example, when handling a request like GET http://localhost:3000/articles/1, 1 would be captured as the value for :id, which would then be accessible as params[:id] in the show action of ArticlesController.

A

A route parameter

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
110
Q

So far, we’ve covered the “R” (Read) of CRUD. We will eventually cover the “C” (Create), “U” (Update), and “D” (Delete). As you might have guessed, we will do so by adding new routes, controller actions, and views. Whenever we have such a combination of routes, controller actions, and views that work together to perform CRUD operations on an entity, we call that entity a resource. For example, in our application, we would say an article is a resource.

Rails provides a routes method named resources that maps all of the conventional routes for a collection of resources, such as articles. So before we proceed to the “C”, “U”, and “D” sections, let’s replace the two get routes in config/routes.rb with resources:

A

6.2 Resourceful Routing

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
111
Q

The resources method also sets up URL and path helper methods that we can use to keep our code from depending on a specific route configuration. The values in the “Prefix” column above plus a suffix of _url or _path form the names of these helpers. For example, the article_path helper returns “/articles/#{article.id}” when given an article. We can use it to tidy up our links in app/views/articles/index.html.erb:

A

How does the resources method set up URL and path helper methods

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
112
Q

However, we will take this one step further by using the link_to helper. The link_to helper renders a link with its first argument as the link’s text and its second argument as the link’s destination. If we pass a model object as the second argument, link_to will call the appropriate path helper to convert the object to a path. For example, if we pass an article, link_to will call article_path. So app/views/articles/index.html.erb becomes:

A

What does line_to do?

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
113
Q

Any object that you want users to be able to access via URI and perform CRUD (or some subset thereof) operations on can be thought of as a resource. In the Rails sense, it is generally a database table which is represented by a model, and acted on through a controller

A

What is resources in Ruby on Rails?

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
114
Q

Every web-page needs a controller and a route in Ruby

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
115
Q

erb is imbedded ruby which is allowed on all html pages

A

True or

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
116
Q

link_to example: home_about_path. Home = controller,
about = web page, and path = path
Also as a side note you can type in rails routes and looks under the prefix verb and see what your links would be named like home_about GET
root GET

A

What is a link_to composed of?

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
117
Q

When you create a migration you need to push that migration, rails generate devise user will create the migration and the rails db: migrate will push the migration.

A

How do you create and push a migration in ruby using the devise Gem

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
118
Q

or if you want to output it

A

Imbedded Ruby

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
119
Q

Params in Ruby are form fields

A

What are Params in Ruby

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
120
Q

Rails Associations

A

N/A

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
121
Q

MVC = Model is the Database, the View is the webpages and the Controller is the brains

A

MVC overview

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
122
Q

Instance variable in Ruby

A

What’s an instance variable? In the Ruby programming language, an instance variable is a type of variable which starts with an @ symbol. Example: @fruit. An instance variable is used as part of Object-Oriented Programming (OOP) to give objects their own private space to store data.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
123
Q

In a database, a record (sometimes called a row) is a group of fields within a table that are relevant to a specific entity. For example, in a table called customer contact information, a row would likely contain fields such as: ID number, name, street address, city, telephone number and so on.

A

What is a record in databasing??

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
124
Q

Interactive Ruby Shell is a REPL for programming in the object-oriented scripting language Ruby. The abbreviation irb is a portmanteau of the word “interactive” and the filename extension for Ruby files, “.rb”

A

What is IRB in Ruby??

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
125
Q

A block is the same thing as a method, but it does not belong to an object. Blocks are called closures in other programming languages. There are some important points about Blocks in Ruby: Block can accept arguments and returns a value. … A block is always invoked with a function or can say passed to a method call

A

A block in Ruby

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
126
Q

Every Test Ever 1. Sets stuff up, 2. Invokes a thing, 3. Verifies behavior
Tests also
Arrange, Act , and Assert
or
Given, When, Then

A

Every Test Ever

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
127
Q

It’s not a Ruby keyword, it’s part of the Rspec framework.

it contains the code examples that illustrate the facet of behavior being defined. It is comprised of two main parts: the description string and the code example, in the do/end block
After the it:
write a description or a name for the test
and after that within the expect you will put:
what you expect and what the actual value is
For example:

A

What is it in Rspec

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
128
Q

A test error is at the ruby error level: So like ruby is telling you that you have a syntax error or that you are missing something in you code like a method, class or arguments
A failure error is when the test cant not meet the expectations that you have set up

A

What is test error vs a failure error in Ruby

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
129
Q

nil is the default value that a empty method returns

A

What is nil in ruby?

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
130
Q

Sweep gives you options to automatically delete all incoming email from a particular sender, to keep only the latest email, or to delete email older than 10 days. Select an email message from the sender whose messages you want to delete.

A

What is the sweep function

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
131
Q

Ruby also has the redo statement, which causes the current loop iteration to repeat.
The retry statement causes the whole loop to start again from the beginning.

A

Retry and Redo in Ruby

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
132
Q

Ruby blocks are anonymous functions that can be passed into methods. Blocks are enclosed in a do-end statement or curly braces {}. do-end is usually used for blocks that span through multiple lines while {} is used for single line blocks. Blocks can have arguments which should be defined between two pipe | characters.

A

Ruby blocks

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
133
Q

Another looping statement in Ruby is the loop do statement.
It allows code to execute until a break condition is achieved.

A

loop do

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
134
Q

Rails session is only available in controller or view and can use different storage mechanisms. It is a place to store data from first request that can be read from later requests.

A

A session in Ruby

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
135
Q

A namespace is a container for multiple items which includes classes, constants, other modules, and more. … The namespace in Ruby is defined by prefixing the keyword module in front of the namespace name. The name of namespaces and classes always start from a capital letter.

A

What are namespaces in Ruby?

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
136
Q

Cross-Origin Resource Sharing (CORS) is an HTTP-header based mechanism that allows a server to indicate any origins (domain, scheme, or port) other than its own from which a browser should permit loading resources. … The CORS mechanism supports secure cross-origin requests and data transfers between browsers and servers.

A

What is cross domain HTTP request?

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
137
Q

A middleware component sits between the client and the server, processing inbound requests and outbound responses, but it’s more than interface that can be used to talk to web server. It’s used to group and order modules, which are usually Ruby classes, and specify dependency between them.

A

middleware

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
138
Q

The HTTP HEAD request is used to check the availability, size, and last modification date of a resource without downloading it (as indicated by the Content-Length and Last-Modified headers). For example, we can send a GET request to check if a PDF file is available for download.

A

What is the purpose of using HEAD requests?

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
139
Q

Any object that you want users to be able to access via URI and perform CRUD (or some subset thereof) operations on can be thought of as a resource. In the Rails sense, it is generally a database table which is represented by a model, and acted on through a controller.

A

A resource in ruby on rails

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
140
Q

Active Model Serializers

A

A third part Gem thats allows you to contort the Json that comes back

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
141
Q

According to Microsoft documentation: Serialization is the process of converting an object into a stream of bytes to store the object or transmit it to memory, a database or file. Its main purpose is to save the state of an object in order to be able to recreate it when needed.

A

What does a Serializer do?

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
142
Q

ActiveModel::Serializer, or AMS, provides a convention-based approach to serializing resources in a Rails-y way. … At a basic level, it means that if we have a Post model, then we can also have a PostSerializer serializer, and by default, Rails will use our serializer if we simply call render json: @post in a controller.

For Python….
Serializers allow complex data such as querysets and model instances to be converted to native Python datatypes that can then be easily rendered into JSON , XML or other content types.

A

What is Active model Serializer?

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
143
Q

The pipe bars essentially make a new variable to hold the value generated from the method call prior

A

What do pipes mean in Ruby?

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
144
Q

In Rails, an association is a connection between two Active Record models. Why do we need associations between models? Because they make common operations simpler and easier in your code. For example, consider a simple Rails application that includes a model for authors and a model for books.

A

In Rails, an association is?

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
145
Q

What is Has_many in Ruby?
Ruby on Rails ActiveRecord Associations has_many

A has_many association indicates a one-to-many connection with another model. This association generally is located on the other side of a belongs_to association. This association indicates that each instance of the model has zero or more instances of another model.

A

What is Has_many in Ruby?
Ruby on Rails ActiveRecord Associations has_many

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
146
Q

An HTTP request is made by a client, to a named host, which is located on a server. The aim of the request is to access a resource on the server. To make the request, the client uses components of a URL (Uniform Resource Locator), which includes the information needed to access the resource.

What is HTTP request example?
HTTP works as a request-response protocol between a client and server. Example: A client (browser) sends an HTTP request to the server; then the server returns a response to the client. The response contains status information about the request and may also contain the requested content.

A

An HTTP request and an example

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
147
Q

Why API versioning is required?
Versioning helps us to iterate faster when the needed changes are identified in the APIs. Change in an API is inevitable as our knowledge and experience of a system improve. Managing the impact of this change can be quite a challenge when it threatens to break existing client integration
API versioning helps alter an API’s behavior for different clients. An API version is determined by an incoming client request and may either be based on the request URL or on the request headers. There are a number of valid approaches to versioning.

A

Why API versioning

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
148
Q

In short, CORS is an HTTP-header based security mechanism that defines who’s allowed to interact with your API. CORS is built into all modern web browsers, so in this case the “client” is a front-end of the application. In the most simple scenario, CORS will block all requests from a different origin than your API.

A

CORS

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
149
Q

API headers are like an extra source of information for each API call you make. Their job is to represent the meta-data associated with an API request and response. If you ever encounter issues with an API, the first place you should look is the headers, since they can help you track down any potential issues.

A

API headers

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
150
Q

So, here comes the idea of Object Relational Mapping(ORM). And it is a programming technique for converting data between incompatible type systems using object-oriented programming languages.
It means you can write database queries using the object oriented paradigm of your preferred language and there are many free and commercial packages available that perform object relational mapping.

ORM sets the mapping between the set of objects which are written in the preferred programming language like JavaScript and relational database like SQL. It hides and encapsulates the SQL queries into objects and instead of SQL queries we can use directly the objects to implement the SQL query.

A

ORMs explained

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
151
Q

Data curation is the organization and integration of data collected from various sources. It involves annotation, publication and presentation of the data such that the value of the data is maintained over time, and the data remains available for reuse and preservation.

A

What is curation in big data?

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
152
Q

A temporary way of dealing with a problem or satisfying a need.

A

Stop-gap

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
153
Q

frozen_string_literal: true

class Users::RegistrationsController < Devise::RegistrationsController
def create
resource = ::Users::Signup.call params

if resource.persisted?
  if resource.active_for_authentication?
    set_flash_message! :notice, :signed_up
    sign_up(resource_name, resource)
    respond_with resource, location: after_sign_up_path_for(resource)
  else
    set_flash_message! :notice, :"signed_up_but_#{resource.inactive_message}"
    expire_data_after_sign_in!
    respond_with resource, location: after_inactive_sign_up_path_for(resource)
  end
else
  clean_up_passwords resource
  set_minimum_password_length
  respond_with resource
end   end end
A

starting point in the new controller

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
154
Q

The keyword self in Ruby enables you to access to the current object — the object that is receiving the current message. … Using self inside an instance or class method refers to the same object the method is being called on, i.e., and instance and class respectively. In an instance method such as #say_hi, using self

A

What is self in Ruby

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
155
Q

In short, JWTs are used as a secure way to authenticate users and share information. Typically, a private key, or secret, is used by the issuer to sign the JWT. The receiver of the JWT will verify the signature to ensure that the token hasn’t been altered after it was signed by the issuer.

A

What are JWTs?

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
156
Q

What are cookies in a website?
Cookies are files created by websites you visit. They make your online experience easier by saving browsing information. With cookies, sites can keep you signed in, remember your site preferences, and give you locally relevant content. … First-party cookies are created by the site you visit.

A

What are cookies in a website?

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
157
Q

Self in ruby defines the method. The method will be a class method

A

more on self

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
158
Q

In fact, we interact with API’s every time we make a browser request (type a site into our browser and press enter).

A

API’s Basics

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
159
Q

One common use of form objects is to reduce complexity in the controller, and the model, which isn’t incorrect, but does not do justice to the important role that they play.

A

Form objects part One

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
160
Q

As much as possible, you don’t want your models to know about each other beyond the associations, which we can consider to be persistence logic. Business logic that spans across multiple models are best kept outside of the ActiveRecord models (form objects are models too, so let’s make the distinction clear). More on this later, if you aren’t convinced.

A

Form objects part Two

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
161
Q

A session is just a place to store data during one request that you can read during later requests.

A

A session is

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
162
Q

Indicates that the user represented by the sealed client-principal object (in the LOGIN state) has logged out of their current user login session. This is a general purpose method an application can use to invalidate, or terminate access to, a sealed client-principal object.

A

What method is logout?

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
163
Q

frozen_string_literal: true

require “rails_helper”

RSpec.describe “[DELETE] /api/v1/logout”, type: :request do

Given(:path) { “/api/v1/logout” }
Given(:user) { FactoryBot.create :user }

context “with vaild params” do
before do
sign_in user
end

When { 
  delete path 
}

# Then { expect(response).to be_successful }
Then { 
  binding.pry
  expect(response).to be_successful }

end
end

A

web side delete test

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
164
Q

Headers in a HTTP request or response is the additional information that is transferred to the user or the server. In postman, the headers can be seen in the Headers tab.

A

Headers in a HTTP request or response

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
165
Q

2xx successful – the request was successfully received, understood, and accepted. 3xx redirection – further action needs to be taken in order to complete the request. 4xx client error – the request contains bad syntax or cannot be fulfilled.

A

2xx, 3xx, 4xx

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
166
Q

What are resources in Ruby on Rails?
Any object that you want users to be able to access via URI and perform CRUD (or some subset thereof) operations on can be thought of as a resource. In the Rails sense, it is generally a database table which is represented by a model, and acted on through a controller

A

What are resources in Ruby on Rails?

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
167
Q

This is how we can modify the reset_password_token using devise with the least possible code changes. It involves understanding the flow of logic throughout the different components in devise, as well as the role each component play, so that you know what can and should be modified. The same can be applied to the confirmation flow as well.

A

understanding the flow of logic

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
168
Q

A flash message is a way to communicate information with the users of your Rails application so they can know what happens as a result of their actions. Example messages: “Password changed correctly” (confirmation) “User not found” (error)

A

A flash message

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
169
Q

What is logic flow in programming?
Flow control is a high-level way of programming a computer to make decisions. These decisions can be simple or complicated, executed once or multiple times. Logic presents rules that allow you to build up and represent more complex ideas. …

A

What is logic flow in programming?

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
170
Q

The show method displays only further details on a single book. This functionality will be achieved by the following lines of code. The show method’s @book = Book. find(params[:id]) line tells Rails to find only the book that has the id defined in params[:id].

A

What is a show method in ruby?

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
171
Q

Rails framework allows complex objects to be stored in a database column via the ActiveRecord::Serialization module. But understanding when to store serialized data in a column is more crucial than knowing how to do it. Through this article, we will first learn “when” to store serialized data and then the “how” part.

A

Serialization in Rails for Storage

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
172
Q

Normalization is a database design technique that reduces data redundancy and eliminates undesirable characteristics like Insertion, Update and Deletion Anomalies. Normalization rules divides larger tables into smaller tables and links them using relationships. The purpose of Normalisation in SQL is to eliminate redundant (repetitive) data and ensure data is stored logically.

A

What is Normalization?

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
173
Q

Storing serialized data in the database could open up a can of worms if we are not mindful. Following are some of the conditions when you may avoid serializing the data:

1) You need to query the serialized data across the records quite often.

A

When should you not store serialized data?

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
174
Q

Storing serialized data in the database could open up a can of worms if we are not mindful. Following are some of the conditions when you may avoid serializing the data:

1) You need to query the serialized data across the records quite often.
2) The state of the serialized data would change frequently. This would need frequent updates to the serialized column which can be a heavy operation.

3) There is a possibility that the field/property name of an object would change in future. (Note: This is not a pressing issue as we do have ways to fix this as explained in the Custom Serializer section below.)

Once you are convinced that all the above criteria do not apply to your use-case, you may go ahead and implement serialization for storing the data.

A

When should you not store serialized data?

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
175
Q

The term DSL is also used to describe some of the concepts in ActiveRecord, which is part of Ruby on Rails. The concept of a DSL is actually unrelated to Ruby, and has been around for a long time. It’s generally used to describe a language that has constructs suited for expressing concepts of a particular domain.

A

What is a DSL and how does it pertain to Ruby?

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
176
Q

2 Answers. Generally asset is anything that browser loads after it gets the HTML page. Meaning javascript, css and any images

A

What is assets in Ruby on Rails?

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
177
Q

Sprockets is a Ruby library for compiling and serving web assets. Sprockets allows to organize an application’s JavaScript files into smaller more manageable chunks that can be distributed over a number of directories and files. It provides structure and practices on how to include assets in our projects.

A

What are sprockets in rails?

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
178
Q

An index is a numerical representation of an item’s position in a sequence. This sequence can refer to many things: a list, a string of characters, or any arbitrary sequence of values. In some programming languages, an array can be defined by key-value pairs, where a specific key points to a value.

A

What is an Index in Coding?

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
179
Q

1 Answer. The purpose of the . call method is to invoke/execute a Proc/Method instance.

A

What does .call do in Ruby?

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
180
Q

Image result for what does .map do in ruby
Map is a Ruby method that you can use with Arrays, Hashes & Ranges. The main use for map is to TRANSFORM data. For example: Given an array of strings, you could go over every string & make every character UPPERCASE.

A

What does .MAP do Ruby?

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
181
Q

rails g pipeline Api::V1::CompanyLead show create index update destroy

A

An example for when you need to generate the structure for our api endpoints.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
182
Q

create app/controllers/api/v1/company_leads_controller.rb
create app/pipelines/api/v1/company_lead_pipeline.rb
create app/serializers/api/v1/company_lead_serializer.rb
create app/services/api/v1/company_leads/create.rb
create app/services/api/v1/company_leads/update.rb
create app/services/api/v1/company_leads/destroy.rb
create spec/requests/api/v1/company_leads/index_spec.rb

  create  spec/requests/api/v1/company_leads/show_spec.rb

  create  spec/requests/api/v1/company_leads/create_spec.rb

  create  spec/requests/api/v1/company_leads/update_spec.rb

  create  spec/requests/api/v1/company_leads/destroy_spec.rb

route namespace :api do

A

CompanyLead

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
183
Q

Index shows the list of resources, but likely only an abbreviated portion of those resources.

Show shows the full details of a single resource. potentially with more information from other resources.

A

Index VS Show

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
184
Q

A blob is a record that contains the metadata about a file and a key for where that file resides on the service. … Subsequent to the file being uploaded server-side to the service via create_after_upload!.

A

What is active storage blob?

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
185
Q

Functional programming lets you describe what you want to do, as opposed to how you want it done. An example of what would be “Give me all the even numbers in this list.“. You don’t really care about how it’s doing it, you’re telling it what you want

A

Functional programming

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
186
Q

What the pluck () function does is that it essentially loops through a collection and collects all the data from the particular field and stores it in another collection. That would mean, it plucks the concerned value from a large set of data and stores them in a separate collection for later usage.

A

How does pluck work?

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
187
Q

new is a class method, which generally creates an instance of the class (this deals with the tricky stuff like allocating memory that Ruby shields you from so you don’t have to get too dirty). Then, initialize , an instance method, tells the object to set its internal state up according to the parameters requested

A

What does New do in Ruby?

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
188
Q

The call() method calls a function with a given this value and arguments provided individually.

A

call() method

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
189
Q

What happens after you call map?
Map returns a new array with the results.
It won’t change the original.
If you want to change the original array you can use map!.

A

Map Method in Ruby

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
190
Q

git restore spec/serializers/api/v1/user_lead_serializer_spec.rb

A

git restore work if you have not committed your code and need to restore your code within some file back to its original state.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
191
Q

Ruby interprets semicolons and newline characters as the ending of a statement. However, if Ruby encounters operators, such as +, −, or backslash at the end of a line, they indicate the continuation of a statement.

A

Line Endings in Ruby Program

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
192
Q

Ruby is a perfect Object Oriented Programming Language. The features of the object-oriented programming language include −

Data Encapsulation
Data Abstraction
Polymorphism
Inheritance

A

Ruby is a perfect Object Oriented Programming Language

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
193
Q

Variables in a Ruby Class
Ruby provides four types of variables −

Local Variables − Local variables are the variables that are defined in a method. Local variables are not available outside the method. You will see more details about method in subsequent chapter. Local variables begin with a lowercase letter or _.

Instance Variables − Instance variables are available across methods for any particular instance or object. That means that instance variables change from object to object. Instance variables are preceded by the at sign (@) followed by the variable name.

Class Variables − Class variables are available across different objects. A class variable belongs to the class and is a characteristic of a class. They are preceded by the sign @@ and are followed by the variable name.

Global Variables − Class variables are not available across classes. If you want to have a single variable, which is available across classes, you need to define a global variable. The global variables are always preceded by the dollar sign ($).

A

Variables in a Ruby Class

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
194
Q

Class methods can only be called on classes
Instance methods can only be called on instances of classes
Class methods are always defined def self.method_name
Instance methods are always defined def method_name

A

Instance methods vs class methods

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
195
Q

Classes are a grouping of methods that exist to construct an object by creating a new instance of the class. Instances are the objects created by a class.

A

Instance methods vs class methods part: 2

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
196
Q

A class is the blueprint from which individual objects are created

A

Duh

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
197
Q

A class is the blueprint from which individual objects are created

A

Yup

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
198
Q

rails db:migrate:status

A

db migrate

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
199
Q

rails db:migrate:status

A

db migrate status

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
200
Q

find_by will not throw an error but find will

A

find vs find_by

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
201
Q

When installing a gem make sure not to use install because that will install it locally and so you need to store the gem inside the gem file

A

Gem Install

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
202
Q

lead = Lead.first

A

var = model.method. The model has the data base associations which all have values

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
203
Q

bin/rails generate pipeline Api::V1::Map_Areas::Contact create update destroy

A

Generate Leads contacts

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
204
Q

contact = ::Api::V1::Leads::Contacts::Create.call contact_params

A

might need

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
205
Q

The backend validators generate errors, they pass errors to the Front-End

A

Backend Validators in Ruby

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
206
Q

The “newer” syntax is only for symbols.

{hello: ‘world’} is equivalent to {:hello => ‘world’} but if your key is a string then you still have to use the “hash rocket” syntax: {‘hello’ => ‘world’}

A

For symbols.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
207
Q

Ruby operators
The following table shows common Ruby operators ordered by precedence (highest precedence first):

Category Symbol
Resolution, access operators :: .
Array operators [ ] [ ]=
Exponentiation **
Not, complement, unary plus, minus ! ~ + -
Multiply, divide, modulo * / %
Addition, subtraction + -
Shift operators &laquo_space;»
Bitwise and &
Bitwise or, logical or ^ |
Relational operators > >= < <=
Bitwise or, logical or ^ |
Equality, pattern match operators <=> == === != =~ !~
Logical and &&
Logical or ||
Range operators .. …
Ternary ?:
Assignment operators = += -= *= **= /= %= &= |= ^= «=&raquo_space;= ||= &&=
Alternate negation not
Alternate logical or, and or and

A

Ruby operators
The following table shows common Ruby operators ordered by precedence (highest precedence first):

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
208
Q

Persisted if the contact saved than the contact persisted but if the contact did not save than it did not persist

A

Persisted in Ruby

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
209
Q

devise-jwt is a devise extension which uses JWT tokens for user authentication. It follows secure by default principle. This gem is just a replacement for cookies when these can’t be used. As cookies, a token expired with devise-jwt will mandatorily have an expiration time.

A

devise-jwt

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
210
Q

Class variables begin with @@ and must be initialized before they can be used in method definitions.

A

Class variables

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
211
Q

When an uninitialized local variable is referenced, it is interpreted as a call to a method that has no arguments.

A

Uninitialized local variable

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
212
Q

Ruby Constants
Constants begin with an uppercase letter. Constants defined within a class or module can be accessed from within that class or module, and those defined outside a class or module can be accessed globally.

Constants may not be defined within methods. Referencing an uninitialized constant produces an error. Making an assignment to a constant that is already initialized produces a warning.

A

Ruby Constants

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
213
Q

Ruby Pseudo-Variables
They are special variables that have the appearance of local variables but behave like constants. You cannot assign any value to these variables.

self − The receiver object of the current method.

true − Value representing true.

false − Value representing false.

nil − Value representing undefined.

__FILE__ − The name of the current source file.

__LINE__ − The current line number in the source file.

A

Ruby Pseudo-Variables

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
214
Q

Example
123 # Fixnum decimal
1_234 # Fixnum decimal with underline
-500 # Negative Fixnum
0377 # octal
0xff # hexadecimal
0b1011 # binary
?a # character code for ‘a’
?\n # code for a newline (0x0a)
12345678901234567890 # Bignum

A

Ruby Literals and Integers

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
215
Q

http://localhost:3000/rails/info/routes

A

Looking up routes on the front-end side

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
216
Q

Example
123 # Fixnum decimal
1_234 # Fixnum decimal with underline
-500 # Negative Fixnum
0377 # octal
0xff # hexadecimal
0b1011 # binary
?a # character code for ‘a’
?\n # code for a newline (0x0a)
12345678901234567890 # Bignum

A

Ruby Literals and Integers

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
217
Q

open coverage/index.html

A

The coverage plugin helps you know how much your test covers

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
218
Q

create app/controllers/api/v1/notes_controller.rb
create app/pipelines/api/v1/note_pipeline.rb
create app/serializers/api/v1/note_serializer.rb
create app/services/api/v1/notes/create.rb
create app/services/api/v1/notes/update.rb
create app/services/api/v1/notes/destroy.rb
create spec/requests/api/v1/notes/create_spec.rb
create spec/requests/api/v1/notes/update_spec.rb
create spec/requests/api/v1/notes/destroy_spec.rb

A

Generated paths for notes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
219
Q

ActiveRecord::Base.connection.tables
ActiveRecord::Base.connection.columns(‘projects’).map(&:name)

A

Grabbing tables in ruby console

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
220
Q

https://apidock.com/rails/ActionController/Parameters/permit

https://apidock.com/rails/Hash/slice

A

Examples for permit
and slice

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
221
Q

Two services folders exist one is for spec and the other is for normal services

A

Service folder structure

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
222
Q

In Ruby, nil is a special value that to serve as an indication of the absence of any value. Nil is an object of NilClass. nil is Ruby’s way of referring to nothing or void

A

Nil in Ruby

223
Q

build_stubbed is the younger, more hip sibling to build ; it instantiates and assigns attributes just like build , but that’s where the similarities end.

A

build_stubbed

224
Q

Ruby if…else Statement

if conditional [then]
code…
[elsif conditional [then]
code…]…
[else
code…]
end

A

Ruby if…else Statement

225
Q

Ruby provides a special statement which is referred as unless statement. This statement is executed when the given condition is false. … In if statement, the block executes once the given condition is true, however in unless statement, the block of code executes once the given condition is false.

A

The unless statement

226
Q

Reloads the attributes of this object from the database. The optional options argument is passed to find when reloading so you may do e.g. record.reload(:lock => true) to reload the same record with an exclusive row lock.

A

Reload

227
Q

Reloads the attributes of this object from the database. The optional options argument is passed to find when reloading so you may do e.g. record.reload(:lock => true) to reload the same record with an exclusive row lock.

A

Reload in Ruby

228
Q

You misunderstood build. It’s just an alias of new, nothing special.

build won’t “create” a record in database, just create a new object in memory so that the view can take this object and display something, especially for a form.

A

Build

229
Q

The HyperText Transfer Protocol (HTTP) 401 Unauthorized response status code indicates that the client request has not been completed because it lacks valid authentication credentials for the requested resource.

A

401

230
Q

Gulp is a tool that helps you out with several tasks when it comes to web development. It’s often used to do front end tasks like: Spinning up a web server. Reloading the browser automatically whenever a file is saved.

A

Why do we need gulp?

231
Q

knock-pro-web git:(lc/notes-update-lead) git pull origin staging
➜ knock-pro-web git:(lc/notes-update-lead) ✗ ga
➜ knock-pro-web git:(lc/notes-update-lead) gcm

knock-pro-web git:(lc/notes-update-lead) git push origin lc/notes-update-lead -f

A

fixing commit error

232
Q

rails g pipeline Api::V1::NameOfEndpoint action options: [show create index update destroy]

bin/rails generate pipeline Api::V1::Map_Areas show create index update destroy

A

example for generate

233
Q

create app/controllers/api/v1/map_areas_controller.rb
create app/pipelines/api/v1/map_area_pipeline.rb
create app/serializers/api/v1/map_area_serializer.rb
create app/services/api/v1/map_areas/create.rb
create app/services/api/v1/map_areas/update.rb
create app/services/api/v1/map_areas/destroy.rb
create spec/requests/api/v1/map_areas/index_spec.rb
create spec/requests/api/v1/map_areas/show_spec.rb
create spec/requests/api/v1/map_areas/create_spec.rb
create spec/requests/api/v1/map_areas/update_spec.rb
create spec/requests/api/v1/map_areas/destroy_spec.rb
route namespace :api do

A

routes and file for map_areas

234
Q

What are transactions in rails?

A

Rails transactions are a way to ensure that a set of database operations will only occur if all of them succeed. Otherwise they will rollback to the previous state of data

235
Q

Strong Parameters is a feature of Rails that prevents assigning request parameters to objects unless they have been explicitly permitted. It has its own DSL (Domain Specific Language, or in other words, a predefined syntax it understands), that allows you to indicate what parameters should be allowed

A

Strong Parameters in Rails

236
Q

What does ‘?’ Mean in Ruby?
i know that the ‘?’ in ruby is something that checks the yes/no fulfillment.

A

?

237
Q

def destroy
render json: ::Api::V1::MapAreaPipeline.destroy(params[:id])
end

A

controller/destroy

238
Q

def destroy id
map_area = MapArea.find id
map_area.destroy

    ::BaseSerializer.empty
  end
A

pipeline/destroy

239
Q

frozen_string_literal: true

require “rails_helper”

RSpec.describe “[DELETE] /api/v1/map_areas/:id”, type: :request do
Given(:path) { “/api/v1/map_areas/#{map_area.id}” }
Given(:group) { FactoryBot.create :group }
Given(:user) { FactoryBot.create :user, id: 1 }

Given(:map_area) {
FactoryBot.create(
:map_area,
id: 1,
group_id: group.id,
name: “name”,
hex_color: “#4ef9e8”,
coordinates: [{ lat: 1.222, lon: 1.333 }],
user_ids: [],
)
}

context “with valid params” do
When { delete path, headers: api_auth_headers(user) }

Then {
  expect(response).to be_successful
  expect(response_body[:data]).to be_empty
  expect(response_body[:errors]).to be_empty
}   end

context “with unauthenticated user” do
When { delete path }

Then { expect(response).to be_unauthorized }   end end
A

spec/destroy

240
Q

Assignment Branch Condition (ABC) size is a measurement of the size of a method. It is essentially determined by counting the number of Assignments, Branches, and Conditional statements

To reduce ABC score, you could move some of those assignments into before_action calls:

A

Assignment Branch Condition (ABC)

241
Q

strong Params and Rails permit nested hash attributes

A

Grab explanations for these

242
Q

A transverse activity is an activity executed by several objects in some combination. The activity is described as a single unit, separately from the descriptions of the participating objects. … Usual language mechanisms such as class, object etc

A

Transverse in coding

243
Q

Enumerator, specifically, is a class in Ruby that allows both types of iterations – external and internal. Internal iteration refers to the form of iteration which is controlled by the class in question, while external iteration means that the environment or the client controls the way iteration is performed.

A

Enumerator in Ruby

244
Q

rails g pipeline Api::V1::Map_Icon_Settings index

A
245
Q

The before(:each) method is where we define the setup code. When you pass the :each argument, you are instructing the before method to run before each example in your Example Group i.e. the two it blocks inside the describe block in the code above.

A

The before(:each) method

246
Q

Factory Bot’s creates test fixtures that are fake test objects that can be re-used throughout testing an application.

A

Factory Bot Definition

247
Q

A Domain-Specific Language, or DSL, is “a programming language of limited expressiveness focused on a particular domain”. It makes tasks in its domain easier by removing extraneous code for a particular task and allowing you to focus on the specific task at hand.

A

A Domain-Specific Language, or DSL

248
Q

rails generate pipeline Api::V1::UserMapAreas::map_area_id destroy

A
249
Q

I bet that often you see a lot of enormous scopes in Ruby on Rails models, endless chains of queries in controllers and even bulky chunks of raw SQL.

A

enormous scopes

250
Q

These problems can be solved by using Query Object pattern — a common technique that isolates your complex queries.
Query Object in ideal case is a separate class that contains one specific query that implements just one business logic rule.

A

DB queries application problems: Solved

251
Q

An OpenStruct is a data structure, similar to a Hash, that allows the definition of arbitrary attributes with their accompanying values. This is accomplished by using Ruby’s metaprogramming to define methods on the class itself.

OpenStruct is the most complex (it’s a wrapper for Hash) so it’s the slowest. However the magnitude of the difference in speed is kind of surprising.

A

An OpenStruct

252
Q

A data structure is a specific way to organize & access data.

Examples include:

Arrays
Binary trees
Hashes
Different data structures excel at different tasks.

A

What is a data structure?

253
Q

What is contiguous in coding?
Contiguous describes two or more objects that are adjacent to each other. In computing, contiguous data is data that is moved or stored in a solid uninterrupted block.

A

What is contiguous in coding?

254
Q

In simple terms, models are Ruby classes that can holds value of a single row in a database table. Since they all inherit ActiveRecord::Base through ApplicationRecord class, they are equipped with all the Active Record methods which enables them to interact with the database.

A

Rails Models
What are models?

255
Q

Decoupling is a coding strategy that involves taking the key parts of your classes’ functionality (specifically the hard-to-test parts) and replacing them with calls to an interface reference of your own design. With decoupling, you can instantiate two classes that implement that interface.

A

Decoupling Part One

256
Q

Decoupling is a tool that allows decomposing a complicated problem in a series of simpler ones, solving them independently and then combining the results

A

Decoupling Part One

257
Q

Active Record objects can be created from a hash, a block, or have their attributes manually set after creation. The new method will return a new object while create will return the object and save it to the database. A call to user. save will commit the record to the database.

A

Active Record objects

258
Q

Middleware is software that lies between an operating system and the applications running on it. Essentially functioning as hidden translation layer, middleware enables communication and data management for distributed applications.

A

Middleware is software

259
Q

Data: /opt/homebrew/var/lib/elasticsearch/elasticsearch_logancratty/
Logs: /opt/homebrew/var/log/elasticsearch/elasticsearch_logancratty.log
Plugins: /opt/homebrew/var/elasticsearch/plugins/
Config: /opt/homebrew/etc/elasticsearch/

A

elasticsearch

260
Q

transport.tcp.port. 9300. The port that is used for communication between Elasticsearch nodes in a cluster.

A

tcp

261
Q

index data when changes are made happens when
include Elasticsearch::Model::Callbacks is included

With Elasticsearch::Model::Callbacks, whenever a movie is added, modified, or deleted, its document on Elasticsearch is also updated.

A

include Elasticsearch::Model::Callbacks

262
Q

You can use the search API to search and aggregate data stored in Elasticsearch data streams or indices. The API’s query request body parameter accepts queries written in Query DSL. The following request searches my-index-000001 using a match query. This query matches documents with a user.id value of kimchy

A

How do you search in Elasticsearch?

263
Q

nock-pro-web git:(lc/company-users-index) rails generate pipeline Api::V1::Company_Users index
create app/controllers/api/v1/company_users_controller.rb
create app/pipelines/api/v1/company_user_pipeline.rb
create app/serializers/api/v1/company_user_serializer.rb
create spec/requests/api/v1/company_users/index_spec.rb
route namespace :api do
namespace :v1 do
resources :company_users, only: [:index]
end
end

A

pipeline Api::V1::Company_Users index

264
Q

A nested query is a query that has another query embedded within it. The embedded query is called a subquery. A subquery typically appears within the WHERE clause of a query. It can sometimes appear in the FROM clause or HAVING clause.Jul

A

What is nested query?

265
Q

A Callback is a function that is to be executed after another function has finished executing — hence the name ‘call back’.

What is a Callback Function?

Functions which takes Funs(i.e. functional objects) as arguments, or which return Funs are called higher order functions.
Any function that is passed as an argument is called a callback function.
a callback function is a function that is passed to another function (let’s call this other function otherFunction) as a parameter, and the callback function is called (or executed) inside the otherFunction.

A

Call back vs Callback Function

266
Q

In computer programming, a callback is a reference to executable code, or a piece of executable code, that is passed as an argument to other code. This allows a lower-level software layer to call a subroutine (or function) defined in a higher-level layer.

A

Callback function part two

267
Q

Nested queryedit. Wraps another query to search nested fields. The nested query searches nested field objects as if they were indexed as separate documents. If an object matches the search, the nested query returns the root parent document.

A

What is nested query in Elasticsearch?

268
Q

ES is document oriented; it stores its entire objects inside documents. It also indexes these documents to make them searchable. A document belongs to a type and a type belongs to an index. You can draw some parallels to how a traditional relational database is structured:

Relational DB ⇒ Databases ⇒ Tables ⇒ Rows ⇒ Columns
Elasticsearch ⇒ Indices ⇒ Types ⇒ Documents ⇒ Fields

A

Elastic-Search is document Oriented

269
Q

One shard each from Node 1 and Node 2 have moved to the new Node 3, and we have two shards per node, instead of three. This means that the hardware resources (CPU, RAM, I/O) of each node are being shared among fewer shards, allowing each shard to perform better.

A shard is a fully fledged search engine in its own right, and is capable of using all of the resources of a single node. With our total of six shards (three primaries and three replicas), our index is capable of scaling out to a maximum of six nodes, with one shard on each node and each shard having access to 100% of its node’s resources.

A

Shards explained in elastic-search

270
Q

delete searchable

A

do not forget

271
Q

email
full name
first name
last name
group id

A

For ES

272
Q

GET /development_knock_pro_web_user/_search
{
“query”: {
“nested”: {
“path”: “profile”,
“query”: {
“bool”: {
“must”: [
{
“match”: {
“profile.full_name”: “Sebulba”
}
},
{
“match”: {
“profile.phone_number”: “+3817569173539”
}
}
]
}
}
}
}
}

A

ES query example

{“query”: {
“bool”: {
“must”: [
{“‘nested”: {
“path”: “”,
“query”: {
“bool”: {
“must”: [
{
“match”: {
“user.email”:”art_kautzer@lakin.io”}}]
}
}
}},
{“nested”: {
“path”: “”,
“query”: {
“bool”: {
“must”: [
{
“match”: { “profile.full_name”: “Sebulba”}}]
}
}
}}
]
}
}}

273
Q

Elastic-search Aggregations provide you with the ability to group and perform calculations and statistics (such as sums and averages) on your data by using a simple search query. An aggregation can be viewed as a working unit that builds analytical information across a set of documents.

A

Elastic-search Aggregations

274
Q

Must means: Clauses that must match for the document to be included.

Should means: If these clauses match, they increase the _score; otherwise, they have no effect. They are simply used to refine the relevance score for each document.

A

Must vs should in Elastic-Search

275
Q

Wildcard query
Returns documents that contain terms matching a wildcard pattern.

A wildcard operator is a placeholder that matches one or more characters. For example, the * wildcard operator matches zero or more characters. You can combine wildcard operators with other characters to create a wildcard pattern.

A

Wildcard query

276
Q

query_string supports Lucene syntax to interpret the text, where as multi_match just attempts to match the given “text” against the listed fields’ indexed values.

A

query_string vs multi_match

277
Q

The key difference is that a query_string query (with multiple fields and
the AND operator) will match when each term exists in at least one field
while a multi-match query (also using AND) matches only when all the terms
exist in at least one field. The terms of a query_string query do not need
to exist in the same field, while it does matter in a multi-match.

A

query_string vs multi_match Part 2

278
Q

must means: The clause (query) must appear in matching documents. These clauses must match, like logical AND.

should means: At least one of these clauses must match, like logical OR.

Basically they are used like logical operators AND and OR. See this.

Now in a bool query:

must means: Clauses that must match for the document to be included.

should means: If these clauses match, they increase the _score; otherwise, they have no effect. They are simply used to refine the relevance score for each document

A

Must vs Should

279
Q

What is fuzziness in Elasticsearch?
In Elasticsearch, fuzzy query means the terms in the queries don’t have to be the exact match with the terms in the Inverted Index. To calculate the distance between query, Elasticsearch uses Levenshtein Distance Algorithm

A

Fuzziness in Elastic-search?

280
Q

What is fuzziness in Elastic-search?
In Elastic-search, fuzzy query means the terms in the queries don’t have to be the exact match with the terms in the Inverted Index. To calculate the distance between query, Elastic-search uses Levenshtein Distance Algorithm

A

Fuzziness in Elastic-search?

281
Q

Monte Carlo methods, or Monte Carlo experiments, are a broad class of computational algorithms that rely on repeated random sampling to obtain numerical results. The underlying concept is to use randomness to solve problems that might be deterministic in principle.

A

Monte Carlo Methods || Monte Carlo experiments

282
Q

Parameters for
gt
(Optional) Greater than.
gte
(Optional) Greater than or equal to.
lt
(Optional) Less than.
lte
(Optional) Less than or equal to.
format
(Optional, string) Date format used to convert date values in the query.

By default, Elasticsearch uses the date format provided in the ‘s mapping. This value overrides that mapping format.

A

Parameters for

283
Q

indices.query.bool.max_nested_depth
(Static, integer) Maximum nested depth of bool queries. Defaults to 20.

This setting limits the nesting depth of bool queries. Deep nesting of boolean queries may lead to stack overflow.

A

indices.query.bool.max_nested_depth

284
Q

Options hash is a nice concept enabled by a feature of ruby parser. Say, you have a method with some required arguments. Also you may pass some optional arguments. Over time you may add more optional arguments or remove old ones. To keep method declaration clean and stable, you can pass all those optional arguments in a hash. Such method would look like this:

A

Options hash

285
Q

What is parser used for?
Parser. A parser is a software component that takes input data (frequently text) and builds a data structure – often some kind of parse tree, abstract syntax tree or other hierarchical structure, giving a structural representation of the input while checking for correct syntax.

A

What is parser used for?

286
Q

A :: scope operator refers to the global scope instead of local.

module Music
module Record
# perhaps a copy of Abbey Road by The Beatles?
end

module EightTrack
# like Gloria Gaynor, they will survive!
end
end

module Record
# for adding an item to the database
end
To access Music::Record from outside of Music you would use Music::Record.

To reference Music::Record from Music::EightTrack you could simply use Record because it’s defined in the same scope (that of Music).

However, to access the Record module responsible for interfacing with your database from Music::EightTrack you can’t just use Record because Ruby thinks you want Music::Record. That’s when you would use the scope resolution operator as a prefix, specifying the global/main scope: ::Record.

A

Scope Operator

287
Q

How do I know if a code is prefix code?
If you have 0, 00, 1, 11 all as keys, this is not a prefix-code because 0 is a prefix of 00, and 1 is a prefix of 11. A prefix code is where none of the keys starts with another key. So for example, if your keys are 0, 10, 11 this is a prefix code and uniquely decipherable.

A

How do I know if a code is prefix code?

288
Q

GET /development_knock_pro_web_user/_search
{
“query”: {
“query_string”: {
“query”: “(company_id:1 OR group_id:1) AND (company_id:2 OR group_id:2)”
}
}
}

A

id query

289
Q

{
“query”: {
“query_string”: {
“fields”: [ “company_id”, “group_id” ],
“query”: “1 AND 1”
}
}
}

{
“query”: {
“terms”: {
“group_id”: [ “1”, “2”, “3” ]
}
}
}

A

query_string and query/terms

290
Q

GET /development_knock_pro_web_user/_search

   {   "query": {
"query_string": {
  "fields": [ "company_id", "group_id" ],
  "query": "2 AND 2"
}   } } {   "query": {
"terms": {
  "group_id": [ "6", "10", "12" ] 
}   } } { "query": {
"bool": {
    "should": [
        {
            "nested": {
                "path": "profile",
                "query": {
                    "multi_match": {
                        "query": "Sebulba",
                        "fields": ["profile.full_name"]
                    }
                }
            } 
        },
           {
            "multi_match": {
                "query": "tyree_johns@yost.biz",
                "fields": ["email"]
            }
        }
    ]
} } }
A

{
“query”: {
“bool”: {
“should”: [
{
“nested”: {
“path”: “profile”,
“query”: {
“multi_match”: {
“query”: “Sebulba”,
“fields”: [“profile.full_name”, “profile.first_name”, “profile.last_name”]
}
}
}
},
{
“multi_match”: {
“query”: “tyree_johns@yost.biz”,
“fields”: [“email”]
}
},
{
“query”: {
“query_string”: {
“fields”: [ “company_id”, “group_id” ],
“query”: “1 AND 1”
}
}
}
]
}
}

291
Q

str? equivalent to type?(String)
int? equivalent to type?(Integer)
float? equivalent to type?(Float)
decimal? equivalent to type?(BigDecimal)
bool? equivalent to type?(Boolean)
date? equivalent to type?(Date)
time? equivalent to type?(Time)
date_time? equivalent to type?(DateTime)
array? equivalent to type?(Array)
hash? equivalent to type?(Hash)

A

Shorthand for common Ruby types:

292
Q

In the modern era, software is commonly delivered as a service: called web apps, or software-as-a-service. The twelve-factor app is a methodology for building software-as-a-service apps that:

Use declarative formats for setup automation, to minimize time and cost for new developers joining the project;

Have a clean contract with the underlying operating system, offering maximum portability between execution environments;

Are suitable for deployment on modern cloud platforms, obviating the need for servers and systems administration;

Minimize divergence between development and production, enabling continuous deployment for maximum agility;

And can scale up without significant changes to tooling, architecture, or development practices.

A

Software is commonly delivered as a service

293
Q

Declares which components, directives, and pipes belong to the module.
Makes some of those components, directives, and pipes public so that other module’s component templates can use them.
Imports other modules with the components, directives, and pipes that components in the current module need.
Provides services that other application components can use.

A

Angular modularity

294
Q

Ngrx is a group of Angular libraries for reactive extensions. Ngrx/Store implements the Redux pattern using the well-known RxJS observables of Angular 2. It provides several advantages by simplifying your application state to plain objects, enforcing unidirectional data flow, and more.

A

Ngrx is a group of Angular libraries for reactive extensions.

295
Q

Both observables and promises help us work with asynchronous functionality in JavaScript. Promises deal with one asynchronous event at a time, while observables handle a sequence of asynchronous events over a period of time.

A

What is difference between Observable and promises?

296
Q

Image result for angular observable
Angular Observable use as an interface to handle a variety of common asynchronous operations such as send observable data from child to parent component by defining custom events, handle AJAX or HTTP requests and responses, listen and respond user input in Angular Router and Forms

A

What is an Observable in Angular 8?

297
Q

An overview of Reactive Programming Reactive programming is the term which you hear much these days, but what it means? Reactive programming is mainly the way through which the applications handle events as well as the data flow in the applications. In the concept of reactive programming, you will design the components along with some different pieces of the software to react to these changes rather than asking for changes. It could certainly be a great movement.

Read more at: https://www.freelancinggig.com/blog/2020/03/11/what-is-the-difference-between-ngrx-and-rxjs/

A

An overview of Reactive Programming Reactive

298
Q

git remote add origin yourremotegitrepository
After

git fetch //you should get all remote branches

git checkout branchname

A

Git repo to work

299
Q

Basically, it’s the “model” of the objects required for your business purposes.

Say you were making a sales tracking website - you’d potentially have classes such as Customer, Vendor, Transaction, etc. That entire set of classes, as well as the relationships between them, would constitute your Domain Model.

A

Domain Model

300
Q

Template variables help you use data from one part of a template in another part of the template. Use template variables to perform tasks such as respond to user input or finely tune your application’s forms.

A

Template variables

301
Q

Why we use controls in Angular?
The built-in form controls target native HTML elements such as inputs, text areas, checkboxes, etc. formControlName property applied to it. And this is how the HTML element gets binded to the form. Whenever the user interacts with the form inputs, the form value and validity state will be automatically re-calculated

A

Why we use controls in Angular?

302
Q

https://www.concretepage.com/angular-2/angular-2-ngform-with-ngmodel-directive-example

A

Angular NgForm with NgModel Directive Example

303
Q

From Wikipedia, the free encyclopedia. In object-oriented programming, a member variable (sometimes called a member field) is a variable that is associated with a specific object, and accessible for all its methods (member functions).

A

What is meant by member variable?

304
Q

A class groups a set of values and a set of operations. The values and the operations of a class are called its members. Member variables implement the values and member functions implement the operations.

A

What is member variable and member function?

305
Q

Parsing is the process of analyzing text made of a sequence of tokens to determine its grammatical structure with respect to a given (more or less) formal grammar.

The parser then builds a data structure based on the tokens. This data structure can then be used by a compiler, interpreter or translator to create an executable program or library.

is syntactically valid for that language’s grammar

A

Parsing

306
Q

If I gave you an english sentence, and asked you to break down the sentence into its parts of speech (nouns, verbs, etc.), you would be parsing the sentence.

That’s the simplest explanation of parsing I can think of.

That said, parsing is a non-trivial computational problem. You have to start with simple examples, and work your way up to the more complex.

A

Parsing 2

307
Q

Webpack is a tool that lets you compile JavaScript modules, also known as module bundler. Given a large number of files, it generates a single file (or a few files) that run your app. It can perform many operations: helps you bundle your resources. watches for changes and re-runs the tasks.

A

What is Webpack and why use it?

308
Q

“pk.eyJ1IjoiZGFybHBlcGl0byIsImEiO
iJjazdma3c3cXIwM3ljM29wZ3Rpbm
42OTRuIn0.RBmcyKFsAUsXoqWzbQLGDQ”;

A

sales-app

309
Q

‘pk.eyJ1IjoiZmF0aW1hZ3JhY2UiLCJhIjoiY2s5Z
TNtdDlvMGFlMDNlbnViazA3YmUwNi
J9.wCbrbShpdtHikD_LWTgBZA’;

A

setter-app

310
Q

Why This Is a Good Question
This is a tough question to Google for unless you know the right search terms. The #{} operator technically performs expression substitution inside a string literal.

The Answer
The #{} literal is the operator used for interpolation inside double-quoted strings the same way that the backticks or $() construct would be used in Bash. From a practical point of view, the expression inside the literal is evaluated, and then the entire #{} expression (including both the operator and the expression it contains) is replaced in situ with the result.

A

{} operator technically performs expression substitution inside a string literal.

311
Q

The API key is a unique identifier that authenticates requests associated with your project for usage and billing purposes. You must have at least one API key associated with your project.

A

The API key

312
Q

Restricting API keys adds security to your application by ensuring only authorized requests are made with your API key.

A

Restricting API keys

313
Q

With the Maps SDK for Android, add maps to your Android app including Wear OS apps using Google Maps data, map displays, and map gesture responses. You can also provide additional information for map locations and support user interaction by adding markers, polygons, and overlays to your map.

A

What is a map SDK?

314
Q

Maps SDKs. Bring the real world to your users with dynamic maps for the web and mobile.

With the Maps SDK for Android, add maps to your Android app including Wear OS apps using Google Maps data, map displays, and map gesture responses. You can also provide additional information for map locations and support user interaction by adding markers, polygons, and overlays to your map.

A

What is a map SDK?

315
Q

AIzaSyDRhVHrzLA4L1-6PLpxFNjIVc806Zob_l0

A

Android API Key

316
Q

4A:67:8D:E7:2E:E0:71:8A:AF:EC:F3:E9:07:67:D0:70:C8:DC:16:BD

A

SHA KEY

317
Q

The Service Usage API is an infrastructure service of Google Cloud that lets you list and manage APIs and Services in your Cloud projects. You can list and manage APIs and Services provided by Google, Google Cloud, and third-party producers

A

Service Usage API

318
Q

What is Confluence used for?
Confluence is a collaboration wiki tool used to help teams to collaborate and share knowledge efficiently. With confluence, we can capture project requirements, assign tasks to specific users, and manage several calendars at once with the help of Team Calendars add-on

A

What is Confluence used for?

319
Q

%i = All values within an array are individually given a symbol

A

%i operator

320
Q

Image result for what is a components template
A template is a form of HTML that tells Angular how to render the component. Views are typically arranged hierarchically, allowing you to modify or show and hide entire UI sections or pages as a unit. The template immediately associated with a component defines that component’s host view.

A

What is Angular component template?

321
Q

The functional programming paradigm was explicitly created to support a pure functional approach to problem solving. Functional programming is a form of declarative programming. In contrast, most mainstream languages, including object-oriented programming (OOP) languages such as C#, Visual Basic, C++, and Java, were designed to primarily support imperative (procedural) programming.

With an imperative approach, a developer writes code that specifies the steps that the computer must take to accomplish the goal. This is sometimes referred to as algorithmic programming. In contrast, a functional approach involves composing the problem as a set of functions to be executed. You define carefully the input to each function, and what each function returns. The following table describes some of the general differences between these two approaches.

A

Imperative Programing is Procedural Programing

Declarative Programing is Functional Programing

322
Q

Markup is what HTML do to the text inside them. They mark it as a certain type of text(like bold, italic, underline etc). HTML is a language as it has its own code words like any other language. Due to these reasons HTML is calles Markup language

A

Why is it called Mark up language?

323
Q

As with most things you should pick which to use based on the context and what is conceptually the correct way to go. A switch is really saying “pick one of these based on this variables value” but an if statement is just a series of boolean checks.

Also switches implement strict comparisons

A

Switch Statement vs If statement

324
Q

Angular’s component model offers strong encapsulation and an intuitive application structure. Components also make your application painless to unit test and can improve the overall readability of your code.

A

Angular’s component model offers strong

325
Q

Every component has an HTML template that declares how that component renders. You define this template either inline or by file path.

A

Angular Template

326
Q

Angular extends HTML with additional syntax that lets you insert dynamic values from your component. Angular automatically updates the rendered DOM when your component’s state changes. One application of this feature is inserting dynamic text,

A

Angular extends HTML

327
Q

Notice the use of double curly braces–they instruct Angular to interpolate the contents within them.

A

interpolate <p>{{ message }}</p>

328
Q

Notice the use of the square brackets–that syntax indicates that you’re binding the property or attribute to a value in the component class.

A

[style.color]=”fontColor”>

329
Q

Data-binding =communication
TypeScript Code —-> Output Data Template HTML
(Business Logic)

You can output Data through String interpolation and property Binding

React to User Events with event Binding

To react to both you use Two way Binding

A

data binding

330
Q

Ternary Conditional Operator Typescript

A

The Typescript conditional operator is a Ternary Operator, which takes three operands. The first operand is a condition to evaluate. It is followed by a question mark (?), then an expression (expression1). It is then followed by a colon (:) and second expression (expression2). If the condition is true, then expression1 executes & if the condition is false, then expression2 executes. The conditional operator is a shorthand way to write an If else statement.

331
Q

String Interpolation has to resolve to a string in the end

A

String Interpolation

332
Q

Borrowed from MDN Docs, this definition of DOM Events is perhaps the most accurate one. Events are nothing but a way of letting us know that some change has occurred in the DOM. This allows us to make our web pages interactive, make them react to these changes. Let us see how we can act on these changes using the TypeScript programming language.

A

Definition DOM Events

333
Q

What objects are and how they are related to each other is Inheritance

A

Inheritance

334
Q

With Composition you are describing what an object can do

A

Composition

335
Q

With Composition you are describing what an object can do
You can create a number of different composable objects that you can create.

First you have Functions that define what all the object can do

Create new functions that return new objects that give you all the functionality you want inside of them

It give you more flexibility compared to having to follow an inheritance tree

A

Composition

336
Q

Testing
Help with refactoring your code/ drying up code
and helps a Developer see what behavior it has

Difference between Behavior and Implementation

A

Benefits of Testing

337
Q

Directives VS Decorators

A

Directives

Directives are the building blocks of Angular applications.

An Angular component isn’t more than a directive with a template. When we say that components are the building blocks of Angular applications,

https://angular.io/guide/attribute-directives

https://www.sitepoint.com/practical-guide-angular-directives/

Decorators

Decorator that marks a class as an Angular component and provides configuration metadata that determines how the component should be processed, instantiated, and used at runtime.

Decorators are functions that are invoked with a prefixed @ symbol, and immediately followed by a class, parameter, method or property. The decorator function is supplied information about the class, parameter or method.

We can say Decorators are functions, and there are four things (class, parameter, method and property) that can be decorated, which will follows with each different function signatures.

There are some good blogs you can read them for more info…

https://angular-2-training-book.rangle.io/features/typescript/decorators

https://codecraft.tv/courses/angular/es6-typescript/decorators/

338
Q
A

Android Permissions

339
Q

NSLocationAlwaysUsageDescription
Your location is not needed. This request has popped up due to a 3rd party framework used by the app in a context that does NOT need you to reveal you location. Do be sure to check audit trail for the location queries on ios 15 or later.
NSLocationWhenInUseUsageDescription
You will get zero benefit allowing this app accessing your location. You should never see this alert. If you do alert technical support at foo@bar.baz

A

IOS permissions

340
Q

Sources

A

A map or layer source states which data the map should display. Specify the type of source with the “type” property, which must be one of vector, raster, raster-dem, geojson, image, video.

A source provides map data that Mapbox GL JS can use with a style document to render a visual representation of that data. This delegation makes it possible to style the same source in different ways, as you might do to differentiate the appearances of different types of roads in a highways layer.

341
Q

enableMapLayer(map: mapboxgl.Map){
map.loadImage(
‘https://docs.mapbox.com/mapbox-gl-js/assets/cat.png’,
(error, image) => {
if (error) throw error;

      // Add the image to the map style.
      map.addImage('cat', image);

      // Add a data source containing one point feature.
      map.addSource('point', {
          'type': 'geojson',
          'data': {
              'type': 'FeatureCollection',
              'features': [
                  { 'type': 'Feature',
                    'geometry': {
                        'type': 'Point',
                        'coordinates': [
                            -111.80923,
                            39.954685
                        ]
                    },
                    'properties': {
                        'title': 'Mapbox',
                        'description': 'Utah, USA'
                    }
                  }
              ]
          }
      });

      // Add a layer to use the image to represent the data.
      map.addLayer({
          'id': 'points',
          'type': 'symbol',
          'source': 'point', // reference the data source
          'layout': {
              'icon-image': 'cat', // reference the image
              'icon-size': 0.25
          }
      });
  }   ); }; }
A

Icons in Angular

342
Q

public geojson = {
type: ‘FeatureCollection’,
features: [
{
type: ‘Feature’,
geometry: {
type: ‘Point’,
coordinates: new mapboxgl.LngLat(-111.80923, 39.954685)
},
properties: {
title: ‘Mapbox’,
description: ‘Utah, USA’
}
},
{
type: ‘Feature’,
geometry: {
type: ‘Point’,
coordinates: new mapboxgl.LngLat(-122.414, 37.776)
},
properties: {
title: ‘Mapbox’,
description: ‘San Francisco, California’
}
}
]
}
// enableMapLayer(map: mapboxgl.Map) {
// const marker = new mapboxgl.Marker()
// .setLngLat([-122.414, 37.776])
// .addTo(map); // add the marker to the map
// }
// }

enableMapLayer(map: mapboxgl.Map) {
// add markers to map
for (const feature of this.geojson.features) {
// create a HTML element for each feature
// const el = document.createElement(‘div’)
// el.className = ‘marker’

  // make a marker for each feature and add it to the map
  console.log(feature)
  new mapboxgl.Marker()
    .setLngLat(feature.geometry.coordinates)
    .addTo(map)

}   } }
A

Markers in Angular

343
Q

Every component consuming the shared service receives the most up to date data

A

Behavior Subject any => any

344
Q

From what I understand, to “resolve a dependency” means to “go get” it (i.e. from the service container) so it can be “used” where it’s being injected or “passed” into.

A

Resolve a Dependency

345
Q

From my own personal notes (mostly snippets from the docs, google group posts, and SO posts):

Modules

provide a way to namespace/group services, directives, filters, configuration information and initialization code
help avoid global variables
are used to configure the $injector, allowing the things defined by the module (or the whole module itself) to be injected elsewhere (Dependency Injection stuff)
Angular modules are not related to CommonJS or Require.js. As opposed to AMD or Require.js modules, Angular modules don’t try to solve the problem of script load ordering or lazy script fetching. These goals are orthogonal and both module systems can live side by side and fulfill their goals (so the docs claim).
Services

are singletons, so there is only one instance of each service you define. As singletons, they are not affected by scopes, and hence can be accessed by (shared with) multiple views/controllers/directives/other services
You can (and probably should) create custom services when
two or more things need access to the same data (don’t use root scope) or you just want to neatly encapsulate your data
you want to encapsulate interactions with, say, a web server (extend $resource or $http in your service)
Built-in services start with ‘$’.
To use a service, dependency injection is required on the dependent (e.g., on the controller, or another service, or a directive).
Directives (some of the items below say essentially the same thing, but I’ve found that sometimes a slightly different wording helps a lot)

are responsible for updating the DOM when the state of the model changes
extend HTML vocabulary = teach HTML new tricks.
Angular comes with a built in set of directives (e.g., ng-* stuff) which are useful for building web applications but you can add your own such that HTML can be turned into a declarative Domain Specific Language (DSL). E.g., the and elements on the Angular home page demo “Creating Components”.
Non-obvious built-in directives (because they don’t start with “ng”): a, form, input, script, select, textarea. Under Angular, these all do more than normal!
Directives allow you to “componentize HTML”. Directives are often better than ng-include. E.g., when you start writing lots of HTML with mainly data-binding, refactor that HTML into (reusable) directives.
The Angular compiler allows you to attach behavior to any HTML element or attribute and even create new HTML elements or attributes with custom behavior. Angular calls these behavior extensions directives.
When you boil it all down, a directive is just a function which executes when the Angular compiler encounters it in the DOM.
A directive is a behavior or DOM transformation which is triggered by a presence of an attribute, an element name, a class name, or a name in a comment. Directive is a behavior which should be triggered when specific HTML constructs are encountered in the (HTML) compilation process. The directives can be placed in element names, attributes, class names, as well as comments.
Most directives are restricted to attribute only. E.g., DoubleClick only uses custom attribute directives.
see also What is an angularjs directive?
Define and group Angular things (dependency injection stuff) in modules.
Share data and wrap web server interaction in services.
Extend HTML and do DOM manipulation in directives.
And make Controllers as “thin” as possible.

A

A good explanation on modules, services, and directives

346
Q

A Markup Language
HTML is a type of markup language. It encapsulates, or “marks up” data within HTML tags, which define the data and describe its purpose on the webpage. The web browser then reads the HTML, which tells it things like which parts are headings, which parts are paragraphs, which parts are links, etc.

A

HTML

347
Q

markup language
CSS is the acronym for Cascade Styling Sheets. In short, it is a sheet style language, which is a type of language you can use to describe the presentation of a markup language – in this case, to describe the movements of HTML.

A

CSS but I like saying its a styling language

348
Q

A provider is an object declared to Angular so that it can be injected in the constructor of your components, directives and other classes instantiated by Angular

A

What is provider

349
Q

https://blog.angular-university.io/angular-dependency-injection

A

Angular Dependency Injection: Complete Guide

350
Q

https://www.tektutorialshub.com/angular/angular-providers/

A

The four types of of providers

351
Q

Arrays and objects are reference types and have nothing to do with Angular and everything to do with Javascript

A

Reference types

352
Q

You can use the slice method to return a new array

A

slick()

353
Q

In Angular, RxJS provides 4 types of subjects to create an observable. Those 4 types are Subject, BehaviorSubject, ReplaySubject and AsyncSubject. They can be distinguished from each other by looking at how they react to subscribe.

A

In Angular, RxJS provides 4 types of subjects to create an observable

354
Q

The next() method returns an object with two properties done and value. You can also provide a parameter to the next method to send a value to the generator.

A

The next() function is a generator function

355
Q

Observable uses generators to represent values that change over time. Generators enable interaction, animation, realtime data streaming, and all the other exciting, dynamic capabilities of Observable notebooks. The simplest generator is a cell that yields a single value

A

Are Observables generators?

356
Q

Generators are functions that return an object which conforms to the Iterable- and Iterator protocols. You might not have heard of these protocols, but, ever since ES2015, they are used to loop over or spread objects like Array, Map, Set, and String.

A

When would you use a generator function?

357
Q

In Rails, pluck is a shortcut to select one or more attributes without loading the corresponding records just to filter out the selected attributes. It returns an Array of attribute values

A

Pluck Method in Ruby

358
Q

The next method allows you to execute code within your generator. The next method has two properties that re done and value. The value will be whatever is yielded and the done property will evaluate too true or false. True meaning there is not code to run and false meaning their is still code that needs to be run.

A

More on the Next Method

359
Q

A promise is used to handle the asynchronous result of an operation. JavaScript is designed to not wait for an asynchronous block of code to completely execute before other synchronous parts of the code can run. With Promises, we can defer the execution of a code block until an async request is completed.

A

Are promises asynchronous?

360
Q

In JavaScript, yield is used to pause the execution of a function. When the function is invoked again, the execution continues from the last yield statement. A function that yields values is a generator.

A

What is yield JavaScript?

361
Q

When you pass return it will exit you out of the generator function

A

Passing return when dealing with generators

362
Q

BehaviorSubject
First of all, you need to have basic knowledge of how the Subject works. When you subscribe to the Subject, you will get every event emitted from the Subject after you subscribed to it. Refer to this video.

But in the BehaviorSubject, it seems to work same as the Subject, except it receives the last event that occurred before the subscription. Refer to this video.

A

BehaviorSubject and subject

363
Q

https://learning.edx.org/course/course-v1:HarvardX+CS50+X/block-v1:HarvardX+CS50+X+type@sequential+block@3c550787b1d1470bbdba91d14392bd43/block-v1:HarvardX+CS50+X+type@vertical+block@bf9eb5b02f014c70b314cf0f4e190a34

A

Harvard course

364
Q

TypeScript is compiled, rather than interpreted like JavaScript, which means errors can be caught before execution; IDEs that perform background incremental compilation can spot such errors during the coding process

A

TypeScript is compiled, rather than interpreted like JavaScript

365
Q

A subject is a special type of Observable which shares a single execution path among the observers which results in a multicast (one to many).
There are four types of Subjects available based on how they behave:
Subject – No initial value or replay available
AsyncSubject – Emits latest values to subscribers on completion of the async task
BehaviouralSubject – requires an initial value and emits current values to new subscribers
ReplaySubject – replays a specified number of last values to new subscribers

A

The four subjects in Angular

366
Q

A constructor is a special function that creates and initializes an object instance of a class. In JavaScript, a constructor gets called when an object is created using the new keyword. The purpose of a constructor is to create a new object and set values for any existing object properties

A

Is constructor a method or function?

367
Q

build a array of geo location data show me a template/html call new directive that iterates over the array

A

current task

368
Q

https://www.pluralsight.com/guides/using-http-with-rxjs-observables

A

good explanation for observables

369
Q

The Component ‘LeadsViewOptionsComponent’ is declared by more than one NgModule.

A

more than one NgModule error

370
Q

Enums are one of the few features TypeScript has which is not a type-level extension of JavaScript.

Enums allow a developer to define a set of named constants. Using enums can make it easier to document intent, or create a set of distinct cases. TypeScript provides both numeric and string-based enums.

A

Enums in typescript

371
Q

https://angular.io/guide/ngmodule-faq

A

Angular doesn’t like NgModules with circular references, so don’t let Module ‘A’ import Module ‘B’, which imports Module ‘A’.

372
Q

Angular modules consolidate components, directives, and pipes into cohesive blocks of functionality… Modules can also add services

A

Angular modules

373
Q

ng generate module ListMapViewFeatureModule

A

How to generate a feature module

374
Q

git reset –soft HEAD^

A

uncommitted the most recent branch

375
Q

Gateways should only include logic that supports this translation between domestic and foreign concepts. Any logic that builds on that should be in clients of the gateway.

A

Gateway Pattern

376
Q

It’s often useful to add a connection object to the basic structure of the gateway. The connection is a simple wrapper around the call to the foreign coded. The gateway translates its parameters into the foreign signature, and calls the connection with that signature. The connection then just calls the foreign API and returns its result. The gateway finishes by translating that result to a more digestible form. The connection can be useful in two ways. Firstly it can encapsulate any awkward parts of the call to the foreign code, such as the manipulations needed for a REST API call. Secondly it acts as a good point for inserting a Test Double.

A

Connector Object with the Gateway Pattern

377
Q

use URLSearchParams to query url

A

URLSearchParams

378
Q

How do you create a spy for a function in Jasmine?
We may just want to test its getNextSeason() method without actually calling the nextSeason() method. Jasmine provides the spyOn() function for such purposes. spyOn() takes two parameters: the first parameter is the name of the object and the second parameter is the name of the method to be spied upon.

A

The first parameter is the name of the object and the second parameter is the name of the method to be spied upon.

379
Q

How do you use fixtures?
Fixtures are used to feed some data to the tests such as database connections, URLs to test and some sort of input data. Therefore, instead of running the same code for every test, we can attach fixture function to the tests and it will run and return the data to the test before executing each test.

A

How do you use fixtures?

380
Q

What is traversing in coding?

A

Traversing a data structure means: “visiting” or “touching” the elements of the structure, and doing something with the data. (Traversing is also sometimes called iterating over the data structure)

381
Q

The purpose of a garbage collector is to monitor memory allocation and determine when a block of allocated memory is no longer needed and reclaim it.

A

What is purpose of garbage collection in typescript?

382
Q

first commit what you have
change the name to white-pages.connection.ts
& commit it
get rid of @Injectable and commit it
return data.current_residents[0].name will be your gate way

A

TODO: for Aug 10th

383
Q

Free balling first and than when you refactor use code organization. do not worry about the beforeEach until the refactor phase/code organization

A

Initial testing phase [0]

384
Q

Car class with a function that reports on the engine and another function that swaps the engine so I can report on the engine

A

https://stackblitz.com/edit/typescript-playground-zaigpq?file=index.ts

385
Q

// create the Car Class
// constructors to initialize the field values
class Car {
fordReport: string;
swapFordEngine: string;
space: string;

constructor(fordReport: string, space: string, swapFordEngine: string) {
this.fordReport = fordReport;
this.swapFordEngine = swapFordEngine;
this.space = space;
}

engineReport(): string {
return ${this.fordReport};
}
engineSwap(): string {
return ${this.swapFordEngine};
}
}

// create an instance of the car class
const combine = new Car(‘Ford Engine Report’, ‘ ‘, ‘Ford Engine was swaped’);

// call the both methods engineReport() && engineSwap()
const finalReport = combine.engineReport() + combine.space + combine.engineSwap();

console.log(finalReport);

A

https://stackblitz.com/edit/typescript-playground-zaigpq?file=index.ts

386
Q

// create the Car Class
// constructors to initialize the field values
class Car {
fordReport: string;
swapFordEngine: string;
space: string;

constructor(fordReport: string, space: string, swapFordEngine: string) {
this.fordReport = fordReport;
this.swapFordEngine = swapFordEngine;
this.space = space;
}

engineReport(): string {
return ${this.fordReport};
}
engineSwap(): string {
return ${this.swapFordEngine};
}
}

// create an instance of the car class
const combine = new Car(‘Ford Engine Report’, ‘ ‘, ‘Ford Engine was swaped’);

// call the both methods engineReport() && engineSwap()
const finalReport = combine.engineReport() + combine.space + combine.engineSwap();

console.log(finalReport);

A

https://stackblitz.com/edit/typescript-playground-zaigpq?file=index.ts

387
Q

Javascript is used for web applications that are in the web browser/front end, web servers/ backend, —-> native mobile and desktop applications

A

Javascript uses

388
Q

ES is ECMAScript

A

ECMAScript have to do with the on going javascript updates

389
Q

Every value javascript is an object except primitive values which is a value that is not an object

A

Two types of values in Javascript

390
Q

7 primitive data types exist in JavaScript

A

Primitive data types

391
Q

Data Types are determined automatically due to Javascript being a dynamically typed language

A

Dynamic Data types

392
Q

The value holds the data type not the variable

A

Value/Data Types

393
Q

Focus on 7 and 8 and design, usage, and behavior

A

Code Wars

394
Q

Initialize within a typescript constructor

A

Look it up

395
Q

object encapsulation

A

Look it up

396
Q

Gateways should only include logic that supports this translation between domestic and foreign concepts. Any logic that builds on that should be in clients of the gateway. It’s often useful to add a connection object to the basic structure of the gateway.

The connection is a simple wrapper around the call to the foreign coded. The gateway translates its parameters into the foreign signature, and calls the connection with that signature. The connection then just calls the foreign API and returns its result
white_check_mark
eyes
raised_hands

I use a gateway whenever I access some external software and there is any awkwardness in that external element. Rather than let the awkwardness spread through my code, I contain to a single place in the gateway.

I like these explanations, it helped me see why you structured your gateway and connector the way you did

A

Gateways && Connection Pattern

397
Q

We stub out dependencies like fetch Because we changed a behavior it is not a refactor

A

Notes

398
Q

expect(actual).toContain(resident1)

A

toContain should drive you it block title

399
Q

// Usage: Is based on your test
Also your tests ACT must call to the class its testing against not that classes dependencies

A

Usage and ACT

400
Q

During a rebase, each commit is re-applied. So if there is conflict then it can be tedious to resolve.

A

Using rebase

401
Q

https://github.com/basarat/typescript-book

A

Free typescript book

402
Q

Would you rather have silly errors during development, or insanity-inducing errors in production

A

Typescript has tooling to catch bugs

403
Q

[′sü·pər‚set] (computer science) A programming language that contains all the features of a given language and has been expanded or enhanced to include other features as well.

A

Typescript SuperSet

404
Q

any opts you out of the typing system by annotating a var with by. The complier will not type check it

A

any in Typescript

405
Q

In computer programming, a comment is a programmer-readable explanation or annotation in the source code of a computer program. They are added with the purpose of making the source code easier for humans to understand, and are generally ignored by compilers and interpreters

A

Why do programmers annotate their code?

406
Q

The expression implicit used to refer to something done behind the scene, on the other hand, explicit refers to the manual approach of applying things.

A

implicit typing. vs explicit typing

407
Q

Finally, let’s talk about the pros of implicit typing
1- Flexibility: this is one of the Typescript compiler strengths, unlike other strongly typed programming languages, we don’t need to define the type for everything in our code.
2- Less Time Consuming: imagine refactoring a codebase with too much explicit typing, It’ll take much time and efforts regarding the change of the time

A

pros of implicit typing

408
Q

Interfaces help define the shape of the object that you are applying

A

Interfaces in Typescript

409
Q

Strictly typed languages/TS help you gain
Intellisense over whatever you doing with an object

A

IntelliSense is a general term for various code editing features including: code completion, parameter info, quick info, and member lists. IntelliSense features are sometimes called by other names such as “code completion”, “content assist”, and “code hinting.” or gain a better understanding

410
Q

Tuple is a fixed length array where each element has it own assigned type

A

Tuple in Typescript

411
Q

Generics in typescript

A

Using a type inside a class or a function:

412
Q

git checkout staging
git pull origin staging
git checkout lc/white-pages-integration
git merge staging

A

Show conflicts that need to be resolved

413
Q

C++ is widely considered an object-oriented programming language. Stroustrup developed C++ by adding object-oriented capabilities to the C programming language. When we say that a language is an object-oriented programming language, we often mean that it supports object-oriented programming

A

And C sharp is object oriented

414
Q

https://medium.com/javascript-scene/the-forgotten-history-of-oop-88d71b9b2d9f

A

Forgotten History of Object oriented programing

415
Q

TypeScript Generics is a tool which provides a way to create reusable components. It creates a component that can work with a variety of data types rather than a single data type. It allows users to consume these components and use their own types

A

TypeScript Generics

416
Q

In TypeScript, generics can be used to better describe the types in classes that are reusable with multiple derived types. Angular does not support instantiation of generic components, but this limitation can be worked around by creating a derived component for each derived type we want to use it with.

A

What is generic in angular?

417
Q

The behavior of each operation depends entirely on what value we had in the first place.

A

Typescript tip

418
Q

What is a behavior subject in Angular?
Image result for behavior subject angular
BehaviorSubject is both observer and type of observable. BehaviorSubject always need an initial/default value. Every observer on subscribe gets current value. Current value is either latest value emitted by source observable using next() method or initial/default value.

A

What is a behavior subject in Angular?

419
Q

What is a behavior subject in Angular?
Image result for behavior subject angular
BehaviorSubject is both observer and type of observable. BehaviorSubject always need an initial/default value. Every observer on subscribe gets current value. Current value is either latest value emitted by source observable using next() method or initial/default value.

A

What is a behavior subject in Angular? You get the Current value is either latest value emitted by source observable using next() method or initial/default value. This Depends on what the user chooses to do.

420
Q

Creating reusable components is generics, that is, being able to create a component that can work over a variety of types rather than a single one. This allows users to consume these components and use their own types.

A

Generics

421
Q

To put it simply, user authentication has three tasks:

Manage the connection between the human (user) and the website’s server (computer). Verify users’ identities. Approve (or decline) the authentication so the system can move to authorizing the user.

A

How do I create a user authentication?

422
Q

The pipe is an instance method

A

The pipe as an instance method is used as below. We the operators op1, op2 etc are passed as the argument to pipe method. The output of op1 method becomes input of the op2 operator and so forth.

obs.pipe(
op1(),
op2(),
op3(),
op3(),
)

423
Q

echo and print are more or less the same. They are both used to output data to the screen. The differences are small: echo has no return value while print has a return value of 1 so it can be used in expressions. echo can take multiple parameters (although such usage is rare) while print can take one argument.

A

Is echo the same as print?

424
Q

-> is used to call a method, or access a property, on the object of a class

=> is used to assign values to the keys of an array

A

-> vs =>

425
Q

DOCKER

A

NOTES

426
Q

BusyBox

A

BusyBox combines tiny versions of many common UNIX utilities into a single small executable. It provides minimalist replacements for most of the utilities you usually find in GNU coreutils, util-linux, etc.

427
Q

A Linux distribution – often shortened to “Linux distro” – is a version of the open source Linux operating system that is packaged with other components, such as an installation programs, management tools and additional software such as the KVM hypervisor.

A

A Linux distribution

428
Q

Docker process

A

File—>Image—>Container

429
Q

package.json file/ goes inside Create a file thats code/docker-nod

A

Look up how to install node with docker/ Front-End Tackle the Front End with Node

430
Q

With multi-stage builds, you use multiple FROM statements in your Dockerfile. Each FROM instruction can use a different base, and each of them begins a new stage of the build. You can selectively copy artifacts from one stage to another, leaving behind everything you don’t want in the final image.

A

With multi-stage builds

431
Q

access from the Docker host is the current issue

A

current docker problem

432
Q

Web server works. When someone makes a request to open a webpage, the browser contacts the web server of that website. Then, the web server looks for the requested files for the page and sends it to the browser. This is only the simplest kind of request.

A

How a web server works and how NGINX works

433
Q

The example above is also considered as a single thread. A traditional web server creates a single thread for every request, but NGINX does not work that way. As stated before, NGINX performs with an asynchronous, event-driven architecture. It means that similar threads are managed under one worker process, and each worker process contains smaller units called worker connections. This whole unit is then responsible for handling concurrent requests. Worker connections deliver the requests to a worker process, which will also send it to the master process. Finally, the master process provides the result of those requests.

That may sound simple, but one worker connection can take care of up to 1024 similar requests.

A

More on web server works and how NGINX works

434
Q

en-juh-neks

A

NGINX

435
Q

SID stands for String Identifier. It’s a unique key that is used to identify specific resources. At Twilio, each SID has 34 digits and you can identify the type of SID and the product it’s associated with by the first two characters

A

SID stands for String Identifier.

436
Q

The super() method refers to the parent class.

By calling the super() method in the constructor method, we call the parent’s constructor method and gets access to the parent’s properties and methods.

A

Using Super

437
Q

Dependency injection (DI) is a pattern where components necessary for your code to run are hot-swappable. This means that your dependencies are not hard-coded in your implementation and can change as your environment changes.

A

What is dependency injection in React native?

438
Q

REST is an architectural style (not a protocol like SOAP, not a technology itself or even not an implementation, it is basically a set of a rule), This architecture offers some constraints for using HTTP. If you stick by this architectural constraints while using HTTP, it is called RESTful, otherwise, it is not-RESTful.

A

non-RESTful vs. RESTful

439
Q

Image result for REST vs SOAP
SOAP is a protocol, whereas REST is an architectural style

An API is designed to expose certain aspects of an application’s business logic on a server, and SOAP uses a service interface to do this while REST uses URIs.

A

What is difference between SOAP and REST API?

440
Q

A Domain Specific Language, or DSL for short, is a language that’s specialized to a particular application domain. In other words, it’s a programming language that’s used for a more specific application or use case than a general-purpose language like Python. For example, regular expressions are a DSL.

A

What is a Domain Specific Language?

441
Q

When it comes to the purpose of the programming languages, there are two main types: domain-specific and general-purpose languages.

A

The two main types of coding languages

442
Q

The domain-specific languages are used within specific application domains. For example, SQL is a domain-specific language. It’s used mainly for querying data from relational databases. And SQL cannot be used for other purposes.

A

An example on Domain Specific Language?

443
Q

arrange
act
assert

A

TESTING

444
Q

git remote show origin

A

Shows all the tracked and non tracked branches

445
Q

Callbacks take two params: The first param is the value being the first and the key/index second

A

Callbacks/two params

446
Q

cp .env.dev .env
comment out env file: env dev in the docker.compose.yml file

A
447
Q

network request vs connecting directly to grab data
a network request is more of a strong interface and a connection is just grabbing data

A
448
Q

npm install –save-dev @angular-devkit/build-angular
export NODE_OPTIONS=–openssl-legacy-provider
npm install @ngrx/store –legacy-peer-deps

A
449
Q

An Anaemic Domain Model is a model with no logic in it. Domain classes look more like a bunch of public setters and getters without domain logic where the client of the class has control over how to instantiate and modify the class. In these models, the client has to interpret the class purpose and use

A

What is an anemic data model?

450
Q

Is to combine data and process together

A

The basic idea of object-oriented design

451
Q

What is procedural way an object oriented way or a functional way?

A

Procedural programming organizes the code into chunks of procedures, Object-oriented code restricts the programmer to think of objects which represent a concept or real-world component and Functional programming orients the programmer in the world of pure functions.

452
Q

Domain-driven design (DDD) is a major software design approach,[1] focusing on modelling software to match a domain according to input from that domain’s experts.[2]

Under domain-driven design, the structure and language of software code (class names, class methods, class variables) should match the business domain. For example, if software processes loan applications, it might have classes like LoanApplication and Customer, and methods such as AcceptOffer and Withdraw.

Domain-driven design is predicated on the following goals:

placing the project’s primary focus on the core domain and domain logic;
basing complex designs on a model of the domain;
initiating a creative collaboration between technical and domain experts to iteratively refine a conceptual model that addresses particular domain problems.
Criticisms of domain-driven design argue that developers must typically implement a great deal of isolation and encapsulation to maintain the model as a pure and helpful construct. While domain-driven design provides benefits such as maintainability, Microsoft recommends it only for complex domains where the model provides clear benefits in formulating a common understanding of the domain

A

What is DDD

453
Q

Look up what the field-pro app is doing. Sign in and see what it offers. See what end points are being used. Top three things people are doing in the app and see what end points are getting hit to do those things.

A
454
Q

Have the Frontend and the backend setup
My schedule select appointment load appointment
spin up docker frontend and look at he network for the backend activity. In the terminal when see the end point go and look into the backend code where the end point is and report it

A

Task

455
Q

The var_dump function displays structured information about variables/expressions including its type and value. Arrays are explored recursively with values indented to show structure. It also shows which array values and object properties are references.

The print_r() displays information about a variable in a way that’s readable by humans. array values will be presented in a format that shows keys and elements. Similar notation is used for objects.

A

var_dump() vs print_r()

456
Q

What is the major difference between MySQL and SQL? SQL is a query programming language for managing RDBMS. In contrast, MySQL is an RDBMS (Relational Database Management System) that employs SQL. So, the major difference between the two is that MySQL is software, but SQL is a database language

A
457
Q

php vendor/bin/codecept generate:cest api GetCustomerDetail

A

get_customer_detail

458
Q

essential configurations and it does not come out of the box —–>env

A
459
Q

sunrise-app/src/app/pages/system-production/enphase/enphase.page.html

A
460
Q

{
“method”: “get_solar_id”,
“project_id”: “a004T00000X2BBMQA3”
}

A
461
Q

ion-header {
width: 400px;
margin: 0 auto;
text-align: center !important;
}

article {
position: absolute;
text-align: center;
top: 30%;
width: 100%;
}

<h1>Well be back soon!</h1>

<div>
<p>Sorry for the inconvenience. Were performing some maintenance at the moment.</p>
<p>— Ion Solar Dev Team</p>
</div>

A
462
Q

The try statement defines the code block to run (to try).

The catch statement defines a code block to handle any error.

The finally statement defines a code block to run regardless of the result.

The throw statement defines a custom error.

A
463
Q

In PHP, mainly four types of errors are considered: Syntax Error or Parse Error. Fatal Error. Warning Error.

A

PHP, mainly four types of errors

464
Q

new date and just calling time

A
465
Q

’ (dot) operator is PHP’s concatenation operator. Two string operands are joined together (characters of right hand string appended to left hand string) and returns a new string. PHP also has

A
466
Q

SQL injection, also known as SQLI, is a common attack vector that uses malicious SQL code for backend database manipulation to access information that was not intended to be displayed. This information may include any number of items, including sensitive company data, user lists or private customer details.

A

What do SQL injections attack?

467
Q

Working on persisting through sessions with multiple requests

A
468
Q

make a hard reset to the #4 commit

A
469
Q

Curl sessions, multiple instantiation with dependency injection, deprecated versions on the server vs local env, not being able to handle multiple sessions,
figuring it all out with expired and refresh tokens. Error handling made it harder because of its lack of reporting. Reimplement on the database and the next thing is to check every endpoint

A
470
Q

mysql fieldpro_app -u root -p

A
471
Q

mysql fieldpro_app -u fieldpro_user -p

A
472
Q

desc app_users

A
473
Q

mysql -help

A
474
Q
A
475
Q

https://developer.android.com/

A
476
Q

Make assumptions on their PRs(put yourself in their shoes) 👞 and think how can it be done better
what is the 20 percent will make it 80 percent better

A
477
Q

NgClass
DIRECTIVE
Adds and removes CSS classes on an HTML element.

A
478
Q

The ngModel directive is a directive that is used to bind the values of the HTML controls (input, select, and textarea) or any custom form controls, and stores the required user value in a variable and we can use that variable whenever we require that value. It also is used during form validations.

A
479
Q

A space-separated list of the classes of the element. Classes allows CSS and JavaScript to select and access specific elements via the class selectors or functions like the method Document.getElementsByClassName().

A
480
Q

The onblur event occurs when an element loses focus.

The onblur event is often used on input fields.

The onblur event is often used with form validation (when the user leaves a form field).

A
481
Q

Project_Id
:
“a008b00001UKhCHAA1”

A
482
Q

lc/duplicate-accounts-bug)

A

front

483
Q

lc/duplicate-accounts-bu

A

back

484
Q

Abdulhai, Sherif - (919) 454-1732

A
485
Q

Jonathan Crawford(1) 11:27 and imran abdullah(2) 10:45 && 11:02 created the Abdulhai, Sherif twice
These guys are setters that are on the same team Raleigh Sales team
Look for images within the account
Do they have the same address

A
486
Q

Once the the lead gets converted to a customer and the calendar is filled out it does not show up unless refreshed. So users might be making another one and seeing it.

A
487
Q

held date setters get a part of what they are owed

A
488
Q

contract execution date sales and setter gets payed out

A
489
Q

Notes

on line 97

A
490
Q

Clear and descriptive endpoints in POSTMAN. Helps with Testing and finding errors. Testflight does not replace POSTMAN

A
491
Q

Separate PRs for white spaces because it makes the really hard to read in PRs

A
492
Q

Separate your commits and separate PRs if the task is very large. In Jira break up the functionality/task with in it being one PR. If not a huge PR could result in us missing mistakes and not seeing Edge cases.

A
493
Q

Make the title and mainly the background much more descriptive to avoid edge cases

A
494
Q

Prove and show you tested it

A
495
Q

var arr = [2, 5, 6, 3, 8, 9];
var val,j=0;

// use of push() method    
for(j=0; j<4 ; j++){
  var y = arr[j];
  var x = y * j;
  val = arr.push(x);
}
// printing element
console.log( arr );    // [2, 5, 6, 3] which is related to j<4    // 0, 1, 2, 3 = Incrementing pattern from j<4    // 0: 0 * 0 = 0    // 1: 1 * 5 = 5    // 2: 2 * 6 = 12    // 3: 3 * 3 = 9
A
496
Q

Binding types other than interpolation have a target name to the left of the equal sign. The target of a binding is a property or event, which you surround with square bracket ([ ]) characters, parenthesis (( )) characters, or both ([( )]) characters.

The binding punctuation of [], (), [()], and the prefix specify the direction of data flow.

Use [] to bind from source to view
Use () to bind from view to source
Use [()] to bind in a two-way sequence of view to source to view

A
497
Q

Use interpolation to display the value of this variable in the corresponding component template:

content_copy

<h3>Current customer: {{ currentCustomer }}</h3>

A
498
Q

Appointment = Schedule or Disposition
Schedule a number of schedules pertaining to its number per day, yesterday,weekly, monthly, ect
Deposition is held Apts or not held Apts

A
499
Q

DNS pins are the only pin that is not a held pin. All the Scheduling info it held in Sales Force

A
500
Q

You are grabbing the whole teams Appointments/Schedules

A
501
Q

dev.iondeveloper.com

A
502
Q

{
“method”: “get_sales_team_qs”,
“timeframe”: “TODAY”,
“startDate”: “2020-01-01”,
“endDate”: “2020-01-01”
}

A
503
Q

{
“method”: “get_knock_stats”
}

A
504
Q

Appointment_Held_Date_Time_Stamp__c

A

SF Call

505
Q

getQuickStatsForIndividual
getAllQSData

A
506
Q

Return_Appointment_Date_Time__c its in UTC and convert moutain standard time

A
507
Q

Use intelligent caching strategies: Use intelligent caching strategies, such as dynamic caching and stale-while-revalidate, to balance the need for fresh data with the need for quick access to pre-cached resources.

—Customize the pre-caching strategy based on your specific requirements.—

A

CACHING

508
Q

Repos is in memory and logic is in Memory. This is important to understand when talking about pre-caching or you can say caching. Also caching in memory vs from a Redis server. Caching in memory in the local browser is MUCH FASTER. This helps your pages load faster and your server does not get bogged down. Developers control over the cache, meaning they can determine when and how long a file is cached as well as serve it to the browser without going to the network, meaning it can be used to create web apps that work offline.

A
509
Q

$start_date = “2014-01-01T00:00:00.000Z”;
$end_date = date(“Y-m-d”).”T23:59:59.999Z”;

A
510
Q

$startDate = new DateTime($body[‘startDate’]);
$startDate = $startDate->format(‘Y-m-d’);

			$endDate = new DateTime($body['endDate']);
			$endDate = $endDate->format('Y-m-d');
A
511
Q

$start = date(‘Y-m-d\TH:i:s\Z’, strtotime($res[0]->Return_Appointment_Date_Time__c . ‘ 00:00:00’));
$end = date(‘Y-m-d\TH:i:s\Z’, strtotime($res[0]->Return_Appointment_Date_Time__c . ‘ 23:59:59’));
// $dateRange = $this->formatDateRange($dateLiteral, “Return_Appointment_Date_Time__c”, $start, $end);

	// $dateRange = $this->formatDateRange($dateLiteral, "Return_Appointment_Date_Time\_\_c", date('Y-m-d', $start), date('Y-m-d', $end));
	// $start = $end = strtotime($res[0]->Return_Appointment_Date_Time\_\_c);
	// $end = strtotime($res[0]->Return_Appointment_Date_Time\_\_c . ' 23:59:59');
	$dateRange = $this->formatDateRange($dateLiteral, "Return_Appointment_Date_Time\_\_c", date('Y-m-d H:i:s', $start), date('Y-m-d H:i:s', $end));

	// $appointmentDate = new DateTime($res[0]->Return_Appointment_Date_Time\_\_c);
	// $appointmentDate = $appointmentDate->format('Y-m-d');
	// $start = strtotime($appointmentDate);
	// $end = strtotime($appointmentDate . ' 23:59:59');
	// $dateRange = $this->formatDateRange($dateLiteral, "Return_Appointment_Date_Time\_\_c", date('Y-m-d H:i:s', $start), date('Y-m-d H:i:s', $end));
A
512
Q

onGoClick() {
let start = moment(this.startDate).format(“YYYY-MM-DD”);
let end = moment(this.endDate).format(“YYYY-MM-DD”);

this.utilities.showToast("Please wait...");

// this.selectedPeriod.periodNew = 'CUSTOM';
this.fetchQuickStats();   }
A
513
Q

// Get Return_Apt_held/Total Appointments
// $start = date(“Y-m-d\TH:i:s\Z”, strtotime($start));
// $end = date(“Y-m-d\TH:i:s\Z”, strtotime($end));
// $start = date(“Y-m-d\TH:i:s\Z”, $start);
// $end = date(“Y-m-d\TH:i:s\Z”, $end);

A
514
Q

Add alert for self Gen so that they have a disposition. Change the alert time from being the day after to 4 hours after the appointment so that when they disposition it. Thats for all appointments. There is self Gen and setters

A
515
Q

SELECT SalesPerson__r.Name, SalesPerson__r.Active__c FROM Project__c

A
516
Q

SELECT SalesPerson__c, SalesPerson__r.Active__c FROM Project__c WHERE SalesPerson__r.Active__c = false

A
517
Q

If all the values are returning as false when the Salesperson is active, then there may be an issue with the way the Active__c field is being evaluated in the backend code.

Here’s what you can do to troubleshoot:

Check the data in Salesforce to ensure that the Active__c field is being set correctly for each Salesperson.
Double-check the code to make sure that the logic for evaluating the Active__c field is correct. One possibility is that the value is being inverted somewhere in the code, causing true to be interpreted as false and vice versa.
Add some debug statements to the code to print out the value of the Active__c field for each Salesperson, and see if it matches what you expect based on the data in Salesforce. This can help pinpoint where the issue is occurring.

A
518
Q

Gertrude Gutierrez

A
519
Q

Update team and individual stats RFP stat to only return self sets

A
520
Q

sudo xcode-select –reset

A
521
Q

platform :ios, ‘14.0’
use_frameworks!

workaround to avoid Xcode caching of Pods that requires
# Product -> Clean Build Folder after new Cordova plugins installed
# Requires CocoaPods 1.6 or newer
install! ‘cocoapods’, :disable_input_output_paths => true

def capacitor_pods
pod ‘Capacitor’, :path => ‘../../node_modules/@capacitor/ios’
pod ‘CapacitorCordova’, :path => ‘../../node_modules/@capacitor/ios’
pod ‘CapacitorCommunityIntercom’, :path => ‘../../node_modules/@capacitor-community/intercom’
pod ‘CapacitorApp’, :path => ‘../../node_modules/@capacitor/app’
pod ‘CapacitorBrowser’, :path => ‘../../node_modules/@capacitor/browser’
pod ‘CapacitorCamera’, :path => ‘../../node_modules/@capacitor/camera’
pod ‘CapacitorClipboard’, :path => ‘../../node_modules/@capacitor/clipboard’
pod ‘CapacitorGeolocation’, :path => ‘../../node_modules/@capacitor/geolocation’
pod ‘CapacitorHaptics’, :path => ‘../../node_modules/@capacitor/haptics’
pod ‘CapacitorKeyboard’, :path => ‘../../node_modules/@capacitor/keyboard’
pod ‘CapacitorShare’, :path => ‘../../node_modules/@capacitor/share’
pod ‘CapacitorStatusBar’, :path => ‘../../node_modules/@capacitor/status-bar’
pod ‘CordovaPlugins’, :path => ‘../capacitor-cordova-ios-plugins’
end

target ‘App’ do
capacitor_pods
# Add your Pods here
end

A
522
Q

heroku logs -r staging
heroku logs -t -r staging
heroku login
heroku -version

A
523
Q

Manually Approve an App Device for a Sales Rep
Fix Customer Who Isn’t Getting a Password Reset Email

A
524
Q

When using NULL or “false” to represent a falsey value, it’s important to ensure that the comparison operators are appropriate. In your code, you’re using the != operator to check if Proposal_Requested_Date__c is not equal to “false”. This comparison will return true if Proposal_Requested_Date__c is NULL or false, which may not be what you intended. It may be better to use strict equality comparison (!== and ===) instead of loose equality comparison (!= and ==) to avoid any unexpected type coercion.

It’s also important to ensure that the data types of the values you’re comparing are consistent. For example, Financing__r->Contract_Stage_Complete__c may be returning a boolean value while you’re checking for NULL. If this is the case, the condition will always evaluate to false. Double-check the data types returned by the Salesforce API and adjust your code accordingly.

Another thing to consider is that the code currently assumes that the lifecycle stages are sequential and that each stage is completed before moving to the next one. However, this may not always be the case, especially if there are multiple parallel processes happening at the same time. It may be better to use a more flexible approach that allows for multiple stages to be in progress simultaneously.

Lastly, you may want to consider adding more error handling to the code to handle any unexpected exceptions that may occur during the API calls or data processing. This can help prevent your application from crashing and provide better feedback to the end user.

With these considerations in mind, you may want to review your implementation and make any necessary adjustments to ensure that it works as expected.

A
525
Q

Based on the code snippet, the issue seems to be related to how the NULL value is handled. In PHP, NULL is a special value that represents the absence of a value.

In the given code, if a value is set to NULL, the code does not handle this value and does not update the lifecycle accordingly. This is because the code only checks for non-null values when updating the lifecycle.

To fix this issue, you need to add a check for NULL values in each condition where the code is checking for non-null values. For example, instead of using if($res[0]->Proposal_Requested_Date__c != NULL), you should use if($res[0]->Proposal_Requested_Date__c !== NULL). The !== operator checks for strict equality, including the type of the value, which includes NULL.

A
526
Q

There are several benefits to creating your own libraries in Angular:

Reusability: Libraries allow you to create reusable components, services, and other functionality that can be used across multiple projects. This can save a significant amount of development time, as you don’t have to recreate the same functionality every time you start a new project.

Consistency: By creating your own libraries, you can ensure that your code is consistent across different projects. This can make it easier to maintain and update your codebase over time.

Scalability: Libraries can help you manage the complexity of larger projects by breaking them down into smaller, more manageable pieces. This can make it easier to add new features and functionality as your project grows.

Maintainability: Libraries can help you keep your codebase organized and maintainable by enforcing separation of concerns and providing clear boundaries between different parts of your application.

Collaboration: By creating your own libraries, you can share your code with other developers and collaborate more easily on projects. This can help you build better software faster, as you can leverage the expertise and experience of others in your team or community.

Overall, creating your own libraries in Angular can help you build better software faster, improve code quality and maintainability, and collaborate more effectively with others in your team or community.

A
527
Q

An Angular library can be defined as a collection of objects that provide reusable functionality for Angular applications. These objects can include components, services, directives, pipes, and other elements of an Angular application.

However, it’s important to note that an Angular library is not just a collection of objects - it’s also a packaged and distributable unit of code that can be published to a package registry such as npm. This packaged form of the library includes the compiled code and any dependencies needed for the library to work.

When you create an Angular library, you define a public API that exposes the objects and functionality that you want other developers to use. This API is defined in the public_api.ts file, which is the entry point to your library.

Overall, an Angular library can be thought of as a collection of objects, but it’s also a packaged and distributable unit of code with a defined public API.

A
528
Q

“Centric Maven” is not a commonly used phrase, but it can be interpreted as a person or business that is an expert in a particular area or industry and is focused on delivering customer-centric solutions or services.

The term “centric” refers to being centered or focused on a particular thing or group, while “maven” refers to someone who is highly knowledgeable or skilled in a particular field.

So, together, “Centric Maven” can be understood as a business or individual that is highly skilled and focused on delivering solutions or services that are centered around the needs and satisfaction of their customers

A
529
Q

To find micro businesses that may need your customer service services, you can try the following strategies:

Online search: Use search engines like Google to find small e-commerce businesses that may need customer service support. Use keywords like “small e-commerce business” or “micro business” to narrow down your search.

Social media: Check social media platforms like LinkedIn and Twitter for small business owners who may be looking for customer service support. You can also join groups and forums related to e-commerce and small business to connect with potential clients.

Local business directories: Check local business directories or chambers of commerce to find small businesses in your area that may need customer service support.

Networking: Attend networking events or conferences related to e-commerce or small business to meet potential clients and make connections.

Cold calling/emailing: You can also reach out to small businesses directly via email or phone to offer your services and see if they have any customer service needs.

Remember to tailor your approach to each potential client and demonstrate how your services can benefit their business. Be prepared to answer questions about your experience, pricing, and availability.

A
530
Q

Automating your clients’ customer service can help you create passive income by reducing the amount of time and effort you need to invest in each client. Here are some steps you can take to automate your clients’ customer service:

Use chatbots: Chatbots are automated systems that can answer common customer inquiries and provide support 24/7. You can use chatbots to handle basic customer inquiries and free up your time to focus on more complex issues.

Implement an FAQ section: Create a comprehensive FAQ section on your client’s website or app to answer common customer questions. This can reduce the number of inquiries your client receives and help customers find answers to their questions quickly and easily.

Use pre-written responses: Create a library of pre-written responses to common customer inquiries that you can quickly copy and paste when responding to emails or social media messages.

Use ticketing systems: Implement a ticketing system to track customer inquiries and ensure that they are addressed in a timely manner. You can set up automated responses to let customers know that their inquiry has been received and is being addressed.

Use customer feedback tools: Implement customer feedback tools to automatically collect feedback from customers and identify areas for improvement in your client’s customer service process.

By implementing these strategies, you can automate many of the routine tasks involved in customer service and free up your time to focus on higher-level tasks and growing your business.

A
531
Q

Yes, Pannellum is a JavaScript library that can handle 360 panoramic photos in various formats, including the .360 file format used by the GoPro MAX camera to save its 360 photos.

Pannellum supports multiple panoramic image formats such as equirectangular, cubemap, and multiresolution images, including the proprietary .360 format used by the GoPro MAX. To display a 360 photo captured by the GoPro MAX using Pannellum, you will need to convert the .360 file into a format that can be read by Pannellum, such as the equirectangular format.

To convert the .360 file to an equirectangular format, you can use the GoPro VR Reframe software, which is available for free on the GoPro website. Once you have converted the .360 file to an equirectangular format, you can then use Pannellum to display the 360 panoramic photo on your website or application.

A
532
Q

The error message suggests that you haven’t created a Cloud Firestore database in your Firebase project yet. To fix this error, follow these steps:

The error message suggests that the Cloud Storage bucket you are trying to use in your Firebase project requires a location setting to be configured, but it has not been set yet.

If you are using Firebase CLI to deploy your codebase to Firebase, and the terminal is asking whether to initialize a new codebase or overwrite an existing one, it means that Firebase CLI has detected that you have not previously deployed any codebase to your Firebase project.

If you are not seeing the “Cloud Resource Location” option in your Firebase project settings, it could be because your project was created before Google started enforcing regionalization of resources. In that case, you can try creating a new Firebase project with regionalization enabled and migrate your existing resources to the new project.

A
533
Q

Path based redirection
CORS
NGINX

A
534
Q

endpoint: new URL(‘https://api.iondeveloper.com/fieldpro/latest/admin’), endpoint: new URL(‘https://dev.iondeveloper.com/api/fieldpro/’),

A
535
Q

<?php

header(“Access-Control-Allow-Origin: *”);
header(“Access-Control-Allow-Headers: origin, content-type, accept”);
header(“Access-Control-Allow-Methods: GET, POST, PUT, DELETE”);
header(“Content-Type: application/json”);

include_once(‘../_includes/verifyApiKey.php’);

require_once(‘./controllers/TemplateController.php’);
require_once(‘./controllers/CategoryController.php’);
require_once(‘./controllers/QuestionController.php’);
require_once(‘./controllers/ResponseController.php’);
require_once(‘./controllers/WorkTypeController.php’);

$postBody = file_get_contents(‘php://input’);
$body = json_decode($postBody, true);
switch ($_SERVER[‘REQUEST_METHOD’]) {
case ‘OPTIONS’:
return;
break;
case ‘GET’:
switch ($_REQUEST[‘method’]) {
case ‘get_active_templates’:
$template = new TemplateController();
echo json_encode($template->getActiveTemplates());
return;
break;
case ‘get_template’:
$template = new TemplateController();
echo json_encode($template->getTemplate($_REQUEST[‘templateId’]));
return;
break;
case ‘get_complete_template’:
$template = new TemplateController();
echo json_encode($template->getCompleteTemplate($_REQUEST[‘id’]));
return;
break;
case ‘get_question_categories’:
$category = new CategoryController();
echo json_encode($category->getCategories($_REQUEST[‘templateId’]));
return;
break;
case ‘get_template_questions’:
$question = new QuestionController();
echo json_encode($question->getTemplateQuestions($_REQUEST[‘templateId’]));
return;
break;
case ‘get_question_types’:
$question = new QuestionController();
echo json_encode($question->getQuestionTypes());
return;
break;
case ‘get_response’:
$response = new ResponseController();
echo json_encode($response->getResponse($_REQUEST[‘id’]));
return;
break;
case ‘get_responses’:
$response = new ResponseController();
echo json_encode($response->getResponses($_REQUEST[‘page’]));
return;
break;
case ‘get_response_photos’:
$response = new ResponseController();
echo $response->getResponsePhotos($_REQUEST[‘id’]);
return;
break;
case ‘search_responses’:
$response = new ResponseController();
echo json_encode($response->searchResponses($_REQUEST[‘term’]));
return;
break;
case ‘get_work_types’:
$worktype = new WorkTypeController();
echo json_encode($worktype->getWorkTypes());
return;
break;
case ‘get_sf_work_types’:
$worktype = new WorkTypeController();
echo json_encode($worktype->getSFWorkTypes());
return;
break;
default:
$return[‘success’] = false;
$return[‘message’] = ‘Invalid or no API method sent’;
echo json_encode($return);
return;
break;
}
return;
break;

case 'POST':
    switch ($_REQUEST['method']) {
        case 'create_template':
            $template = new TemplateController();
            echo json_encode($template->createTemplate($body));
            return;
            break;
        case 'create_question_category':
            $category = new CategoryController();
            echo json_encode($category->createCategory($body));
            return;
            break;
        case 'create_question_categories':
            $category = new CategoryController();
            echo json_encode($category->createCategories($body));
            return;
            break;
        case 'create_question':
            $question = new QuestionController();
            echo json_encode($question->createQuestion($body));
            return;
            break;
        case 'create_questions':
            $question = new QuestionController();
            echo json_encode($question->createQuestions($body));
            return;
            break;
        case 'create_work_type':
            $worktype = new WorkTypeController();
            echo json_encode($worktype->mapWorkType($body));
            return;
            break;
        case 'create_work_types':
            $worktype = new WorkTypeController();
            echo json_encode($worktype->mapWorkTypes($body));
            return;
            break;
        default:
            $return['success'] = false;
            $return['message'] = 'Invalid or no API method sent';
            echo json_encode($return);
            return;
            break;
    }
    return;
    break;

case 'PUT':
    switch ($_REQUEST['method']) {
        case 'update_template':
            $template = new TemplateController();
            echo json_encode($template->updateTemplate($body));
            return;
            break;
        case 'deactivate_template':
            $template = new TemplateController();
            echo json_encode($template->deactivateTemplate($body));
            return;
            break;
        case 'updated_work_type':
            $worktype = new WorkTypeController();
            echo json_encode($worktype->mapWorkType($body));
            return;
            break;
        default:
            $return['success'] = false;
            $return['message'] = 'Invalid or no API method sent';
            echo json_encode($return);
            return;
            break;
    }
    return;
    break;

case 'DELETE':
    switch ($_REQUEST['method']) {
        case 'delete_work_type':
            $worktype = new WorkTypeController();
            echo json_encode($worktype->deleteWorkType($_REQUEST['id']));
            return;
            break;
        case 'delete_work_type_group':
            $worktype = new WorkTypeController();
            echo json_encode($worktype->deleteWorkTypeGroup($_REQUEST['id']));
            return;
            break;
        default:
            $return['success'] = false;
            $return['message'] = 'Invalid or no API method sent';
            echo json_encode($return);
            return;
            break;
    }
    return;
    break;

default:
    $return['success'] = false;
    $return['message'] = 'Invalid or no API method sent';
    echo json_encode($return);
    return;
    break; }
A
536
Q

<ion-header>
<ion-toolbar>
<ion-buttons>
<ion-back-button></ion-back-button>
</ion-buttons>
<ion-buttons *ngIf="isNotSyncedImage" slot="end" (click)="removeImage()">
<ion-icon></ion-icon>
</ion-buttons>
<ion-title>Image Details</ion-title>
</ion-toolbar>
</ion-header>

<div id=”panoramaViewer” *ngIf=”showPanorama”>
<iframe [src]=”panoramaUrl” width=”100%” height=”400px”></iframe>
</div>

<ion-content>
<ion-slides #slides pager="true" (ionSlidesDidLoad)="slideLoad()" style="vertical-align: middle"
(ionSlideDidChange)="slideChanged()">
<ion-slide *ngFor="let image of gallery[0]">
<img [src]="getSecuredImage(image.name)" (click)="showPanoramaViewer(image.name)" />
</ion-slide>
</ion-slides>
</ion-content>

A
537
Q

what does the cordova-plugin-telerik-imagepicker do

A
538
Q

In the provided code snippet, the function energyLifetime has a parameter $params that is set to null by default. This means that if no value is passed for $params when calling the energyLifetime function, it will be assigned the value null.

Setting the default value of a parameter to null provides flexibility when calling the function. If the caller wants to specify specific parameters for the API request, they can pass them as an argument when calling the function. If no specific parameters are needed, the function can be called without passing any arguments, and the default value of null will be used.

For example, the function can be called in the following ways:

energyLifetime(); - In this case, $params will be null, and the API request will be made without any additional parameters.
energyLifetime($specificParams); - Here, $params will take the value of $specificParams, and the API request will include the specified parameters.
By allowing $params to be set to null, the function provides flexibility for handling different scenarios and allows the caller to customize the parameters based on their requirements.

A
539
Q

Now you have two generic methods getEnphaseData and getSolarData that handle the API calls. The other methods (getEnphaseSystemInfo, getEnphaseInventory, etc.) utilize these generic methods by passing the appropriate parameters. This way, you have consolidated the API calls into two methods, reducing code duplication and improving maintainability. for system-data.ts

A
540
Q

Idea Gun options; Pulls all the guns that exist and gives you common prices, reviews, and specs. Cons and Pros.

A
541
Q

Disabling OPTIONS requests altogether is not recommended, as OPTIONS requests play a crucial role in the HTTP protocol and the CORS mechanism. The OPTIONS request is part of the CORS preflight process, which allows servers to specify which origins, methods, and headers are allowed for cross-origin requests.

By disabling OPTIONS requests and treating all requests as GET requests, you may encounter several issues:

Cross-origin requests may fail: Without the OPTIONS request and the CORS preflight process, browsers may block cross-origin requests. This can lead to security restrictions and prevent your application from accessing resources from different domains.

Limited functionality: OPTIONS requests provide important information about the server’s capabilities and supported methods. By treating all requests as GET, you might miss out on the ability to perform other types of requests, such as POST, PUT, or DELETE, which may be necessary for certain operations.

Security risks: The CORS mechanism is designed to protect users from cross-origin attacks. By bypassing the OPTIONS request and allowing all requests as GET, you may introduce security vulnerabilities, as your server won’t have the opportunity to validate and enforce CORS policies.

It’s important to understand and properly handle OPTIONS requests within your server-side code to ensure secure and reliable cross-origin communication.

A
541
Q

Disabling OPTIONS requests altogether is not recommended, as OPTIONS requests play a crucial role in the HTTP protocol and the CORS mechanism. The OPTIONS request is part of the CORS preflight process, which allows servers to specify which origins, methods, and headers are allowed for cross-origin requests.

By disabling OPTIONS requests and treating all requests as GET requests, you may encounter several issues:

Cross-origin requests may fail: Without the OPTIONS request and the CORS preflight process, browsers may block cross-origin requests. This can lead to security restrictions and prevent your application from accessing resources from different domains.

Limited functionality: OPTIONS requests provide important information about the server’s capabilities and supported methods. By treating all requests as GET, you might miss out on the ability to perform other types of requests, such as POST, PUT, or DELETE, which may be necessary for certain operations.

Security risks: The CORS mechanism is designed to protect users from cross-origin attacks. By bypassing the OPTIONS request and allowing all requests as GET, you may introduce security vulnerabilities, as your server won’t have the opportunity to validate and enforce CORS policies.

It’s important to understand and properly handle OPTIONS requests within your server-side code to ensure secure and reliable cross-origin communication.

A
542
Q

enphase.page.ts
import { Component, ElementRef, Input, OnInit, ViewChild } from ‘@angular/core’;
import { SystemData } from ‘src/app/providers/system-data’;

import { Chart } from ‘chart.js’;
import * as moment from ‘moment’;
import { ActivatedRoute } from ‘@angular/router’;
import { UtilityClass } from ‘src/app/utils/UtilityClass’;
import { InventoryModal } from ‘./inventory/inventory.modal’;

@Component({
selector: ‘app-enphase’,
templateUrl: ‘./enphase.page.html’,
styleUrls: [’./enphase.page.scss’],
})
export class EnphasePage implements OnInit {

@ViewChild('barCanvas', { static: false }) barCanvas: ElementRef;
barChart: any;

private enphaseId;
public summary = [];
public summarymwh = 0;
public timePeriod = 'days';

public lastSevenDays = [];
public sevenLabels = [];

public monthView = [];
public monthLabels = [];

private yearData = [];
private yearLabels = [];

public customView = [];
public customLabels = [];

public startDate;
public endDate;
public isCustom = false;
public errorLabel = "";

public lastSevenDaysTotal = 0;
public currentMonthTotal = 0;
public yearTotal = 0;

private sInventory;

constructor(private route: ActivatedRoute,
    private systemData: SystemData,
    private utils: UtilityClass) { }

ngOnInit() {
    this.enphaseId = this.route.snapshot.paramMap.get('eid');
}

ngAfterViewInit() {

    this.initiateDatas();

    this.barChart = new Chart(this.barCanvas.nativeElement, {
        type: 'bar',
        data: {
            labels: [],
            datasets: [{
                label: 'kWh',
                data: [],
                backgroundColor: '#2196F3',
                borderColor: ['rgba(fff,fff,fff,1)'],
                borderWidth: 1,
                radius: 0
            }]
        },
        options: {
            animation: {
                duration: 1500
            },
            maintainAspectRatio: false,
            legend: {
                display: false
            },
            scales: {
                xAxes: [{
                    display: true,
                    ticks: {
                        autoSkip: true,
                        maxTicksLimit: 12
                    }
                }],
                yAxes: [{
                    display: true,
                    ticks: {
                        beginAtZero: true
                    },
                    scaleLabel: {
                        labelString: "Values in kWh",
                        display: true
                    },
                }]
            }
        }
    });
}

ionViewDidEnter() {
    // Update the chart data and display the graph
    this.barChart.data.labels = this.sevenLabels;
    this.barChart.data.datasets[0].data = this.lastSevenDays;
    this.barChart.update();
}

setTimePeriod(period) {
    this.isCustom = false;
    if (period == 'days') {
        this.barChart.data.labels = this.sevenLabels;
        this.barChart.data.datasets[0].data = this.lastSevenDays;
        this.barChart.update();
    } else if (period == 'month') {
        this.barChart.data.labels = this.monthLabels;
        this.barChart.data.datasets[0].data = this.monthView;
        this.barChart.update();
    } else if (period == 'year') {
        this.barChart.data.labels = this.yearLabels;
        this.barChart.data.datasets[0].data = this.yearData;
        this.barChart.update();
    }
}

initiateDatas() {
    this.systemData.getEnphasePreviousSeven(this.enphaseId)
        .subscribe(data => {
            let production = [];
            if (data.production && data.production.length > 0) {
                for (let i = 0; i < data.production.length; i++) {
                    let prodValue = this.tokWh(data.production[i]);
                    this.lastSevenDaysTotal += data.production[i];
                    production.push(prodValue);
                }
                this.lastSevenDaysTotal = this.tokWh(this.lastSevenDaysTotal);
            }

            this.sevenLabels = this.Last7Days(data.start_date);
            this.lastSevenDays = production;
            this.barChart.data.labels = this.sevenLabels;
            this.barChart.data.datasets[0].data = this.lastSevenDays;
            this.barChart.update();
        });

    this.systemData.getEnphaseEnergyLife(this.enphaseId)
        .subscribe(data => {
            if (data == null) return

            let production = [];
            let labelsArray = [];
            if (data.production) {
                let monthYear = moment().format("YYYY-MM");
                let totalDays = moment(monthYear, "YYYY-MM").daysInMonth();
                let prodCount = 0;
                for (let day = 1; day <= totalDays; day++) {
                    if (prodCount < data.production.length) {
                        let prodValue = this.tokWh(data.production[prodCount]);
                        this.currentMonthTotal += data.production[prodCount];
                        production.push(prodValue);
                        prodCount++;
                    } else production.push(0);

                    labelsArray.push(day);
                }
                this.currentMonthTotal = this.toMWh(this.currentMonthTotal);
            }

            this.monthLabels = labelsArray;
            this.monthView = production;
            if (this.monthView.length < 1)
                this.monthView.push(0);

            this.barChart.data.labels = this.sevenLabels;
            this.barChart.data.datasets[0].data = this.lastSevenDays;
            this.barChart.update();
        });

    this.systemData.getEnphaseYearly(this.enphaseId)
        .subscribe(data => {
            console.log("Yearly", data)
            this.yearLabels = ['Jan', 'Feb', "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];

            let arrayData = [];
            let yearCount = 0;
            for (let i = 0; i < 12; i++) {
                arrayData.push(this.tokWh(data[i]));
                this.yearTotal += data[i];
                if (data[i] > 0) {
                    yearCount++;
                }
            }

            this.yearData = arrayData;
            this.yearTotal = this.toMWh(this.yearTotal);
        });

    this.startDate = moment().startOf('month').format('YYYY-MM-DD');
    this.endDate = moment().format('YYYY-MM-DD');
}

Last7Days(date) {
    let sevenArray = [];
    for (var i = 0; i < 7; i++) {
        let sDate = moment(date).add(i, "days");
        sevenArray.push(sDate.format("DD/MM"));
    }
    return sevenArray;
}

getGraphData(start, end, prod, startProd, labelFormat) {
    let labels = [];
    let datas = [];

    let toContinue = true;
    let startPush = false;
    let currD = moment(start);
    let prodCount = 0;
    while (toContinue) {
        if (currD.isSame(startProd)) startPush = true;

        if (startPush && prodCount < prod.length) {
            let prodValue = this.tokWh(prod[prodCount]);
            datas.push(prodValue);
            prodCount++;
        } else datas.push(0);

        labels.push(currD.format(labelFormat));

        if (currD.isSame(end)) toContinue = false;
        currD.add(1, "days");
    }

    return {
        label: labels,
        data: datas
    }
}

roundToTwoDec(num) {
    return Math.round(parseFloat(num) * 100) / 100;
}

roundToThreeDec(num) {
    return Math.round(parseFloat(num) * 1000) / 1000;
}

tokWh(watts) {
    return this.roundToTwoDec(watts / 1000);
}

toMWh(watts) {
    let kWh = watts / 1000;
    return this.roundToThreeDec(kWh / 1000);
}

getMomentDate(mDate, format) {
    if (mDate) return moment(mDate * 1000).format(format)
    else return "";
}

}

A
543
Q

system.data.ts
import { Injectable } from ‘@angular/core’;
import { Observable, of } from ‘rxjs’;
import { tap } from ‘rxjs/operators’;

import { IonSolarService } from ‘../services/ion-solar.service’;

@Injectable({
providedIn: ‘root’
})
export class SystemData {
private urlEndpointEnphase = “enphase/”;
private urlEndpointSolar = “solaredge/index.php”;

constructor(public ionService: IonSolarService) {}

private cache: { [key: string]: any } = {};

getEnphaseYearly(enphaseId): Observable<any> {
    const cacheKey = `enphaseYearly_${enphaseId}`;

    if (this.cache[cacheKey]) {
        return of(this.cache[cacheKey]);
    } else {
        const params = { method: 'year', enphase_id: enphaseId };
        return this.ionService.makeGETRequest(this.urlEndpointEnphase, params).pipe(
            tap(response => {
                if (response) {
                    this.cache[cacheKey] = response;
                }
            })
        );
    }
}

getEnphaseEnergyLife(enphaseId): Observable<any> {
    const cacheKey = `enphaseEnergyLife_${enphaseId}`;

    if (this.cache[cacheKey]) {
        return of(this.cache[cacheKey]);
    } else {
        const params = { method: 'energyLifetime', enphase_id: enphaseId };
        return this.ionService.makeGETRequest(this.urlEndpointEnphase, params).pipe(
            tap(response => {
                if (response) {
                    this.cache[cacheKey] = response;
                }
            })
        );
    }
}

getEnphasePreviousSeven(enphaseId): Observable<any> {
    const cacheKey = `enphasePreviousSeven_${enphaseId}`;

    if (this.cache[cacheKey]) {
        return of(this.cache[cacheKey]);
    } else {
        const params = { method: 'previousSeven', enphase_id: enphaseId };
        return this.ionService.makeGETRequest(this.urlEndpointEnphase, params).pipe(
            tap(response => {
                if (response) {
                    this.cache[cacheKey] = response;
                }
            })
        );
    }
}

getSolarMonthly(solarId) {
    let params = { method: 'month', solar_edge_id: solarId }
    return this.ionService.makeGETRequest(this.urlEndpointSolar, params);
}

getSolarYearly(solarId) {
    let params = { method: 'year', solar_edge_id: solarId }
    return this.ionService.makeGETRequest(this.urlEndpointSolar, params);
}

getSolarSeven(solarId) {
    let params = { method: 'seven', solar_edge_id: solarId }
    return this.ionService.makeGETRequest(this.urlEndpointSolar, params);
}

}

A
544
Q

To Native Cordova -> File resolveLocalFileSystemURI File626000404 [“options”: [file:///var/mobile/Containers/Data/Application/2C492E68-A6C4-40B5-99F4-C91C31C37C61/tmp/cdv_photo_106.jpg]]

A
545
Q

If you’re trying to load images from the user’s gallery, it’s important to note that the Pannellum viewer may have limitations or restrictions when it comes to loading local files directly from the device. Web browsers typically have security restrictions that prevent direct access to local file paths due to potential security risks.

To work with local files from the user’s gallery, you’ll need to use appropriate methods or plugins to access the file’s content and convert it into a format that can be used by the Pannellum viewer. This may involve reading the file using the File API, FileReader, or utilizing Cordova plugins specifically designed for accessing files on mobile devices.

Here’s an example of how you could modify the getSecuredImage method to handle loading images from the user’s gallery using the cordova-plugin-telerik-imagepicker plugin:

A
546
Q

<div id=”panoramaViewer” *ngIf=”showPanorama && panoramaUrl”>
<iframe [src]=”panoramaUrl” width=”100%” height=”400px”></iframe>
</div>

A
547
Q

The file file://var/mobile/Containers/Data/Applications/!31D9C72-197f-4681-BF45-D4D32830787/tmp/cdv_photo_219.jpg could not be accessed

A
548
Q

dataUrl The url starting with ‘data:image/jpeg;base64,’ and the base64 encoded string representation of the image, if using CameraResultType.DataUrl.

A
549
Q

openMultiplePhotoGallery

A
550
Q

openMultiplePhotoGallery(successCallback, errorCallback) {
let options: ImagePickerOptions = {
maximumImagesCount: 40,
quality: 80,
outputType: 0,
};

    this.imagePicker.requestReadPermission().then((res2) => {
      this.imagePicker.getPictures(options).then((filePaths) => {
        const convertedImages = [];
        const promises = [];
  
        for (let i = 0; i < filePaths.length; i++) {
          const filePath = filePaths[i];
          const fileName = filePath.substring(filePath.lastIndexOf('/') + 1);
          const fileExt = fileName.substring(fileName.lastIndexOf('.') + 1).toLowerCase();
  
          if (fileExt !== 'jpg' && fileExt !== 'jpeg') {
            const promise = this.convertToJpg(filePath).then((jpgFilePath) => {
              convertedImages.push(jpgFilePath);
            });
            promises.push(promise);
          } else {
            convertedImages.push(filePath);
          }
        }
  
        Promise.all(promises).then(() => {
          successCallback(convertedImages);
        });
      }, (err) => {
        errorCallback(err);
      });
    }).then(data => {
      // Handle the read permission
    }, (err) => {
      // Show the permissions alert
      if (this.platform.is('ios')) {
        this.createAlert(null, "FieldPro needs permissions to work.<br/><br/>Go to Settings, and scroll down to the list of apps, tap on FieldPro.<br/>Give permissions to Photos, Microphone, and Camera.", ['OK']);
      } else {
        this.createAlert(null, "FieldPro needs permissions to work.<br/><br/>Go to Settings -> Apps -> Field Pro.<br/>Give permissions to Files and Camera.", ['OK']);
      }
    });
  }
  
  convertToJpg(filePath) {
    return new Promise((resolve, reject) => {
      window['resolveLocalFileSystemURL'](filePath, (fileEntry) => {
        fileEntry.file((file) => {
          const reader = new FileReader();
  
          reader.onloadend = () => {
            const imgBlob = new Blob([reader.result], { type: 'image/jpeg' });
            const newFilePath = this.file.cacheDirectory + 'converted_' + Date.now() + '.jpg';
  
            this.writeFile(newFilePath, imgBlob).then(() => {
              resolve(newFilePath);
            }).catch((err) => {
              reject(err);
            });
          };
  
          reader.onerror = (err) => {
            reject(err);
          };
  
          reader.readAsArrayBuffer(file);
        }, (err) => {
          reject(err);
        });
      }, (err) => {
        reject(err);
      });
    });
  }
  
  writeFile(filePath, fileBlob) {
    return new Promise<void>((resolve, reject) => {
      window['resolveLocalFileSystemURL'](this.file.dataDirectory, (dirEntry) => {
        dirEntry.getFile(filePath, { create: true, exclusive: false }, (fileEntry) => {
          fileEntry.createWriter((fileWriter) => {
            fileWriter.onwriteend = () => {
              resolve();
            };
  
            fileWriter.onerror = (err) => {
              reject(err);
            };
  
            fileWriter.write(fileBlob);
          }, (err) => {
            reject(err);
          });
        }, (err) => {
          reject(err);
        });
      }, (err) => {
        reject(err);
      });
    });
  }
A
551
Q

As of my knowledge cutoff in September 2021, Pannellum does not have built-in support specifically for the “cnv_photo_jpg” file format. Pannellum primarily supports equirectangular and cube map image formats commonly used for 360 panoramas.

However, Pannellum provides a flexible API that allows you to create custom plugins and extensions, which means it might be possible to extend its functionality to support the “cnv_photo_jpg” format. You would need to write a custom plugin or extension that can handle parsing and displaying the specific file format.

I would recommend checking the Pannellum documentation and community resources to see if anyone has already developed a custom plugin or extension for the “cnv_photo_jpg” format or to get guidance on implementing your own custom solution if necessary.

A
552
Q

openMultiplePhotoGallery(successCallback, errorCallback) {
let options: ImagePickerOptions = {
maximumImagesCount: 40,
quality: 80,
outputType: 0,
};

    this.imagePicker.requestReadPermission().then((res2) => {
      this.imagePicker.getPictures(options).then((filePaths) => {
        const convertedFilePaths = [];
  
        const convertImage = (filePath: string) => {
          const isSupportedFormat = filePath.toLowerCase().endsWith('.jpg') || filePath.toLowerCase().endsWith('.jpeg') || filePath.toLowerCase().endsWith('.png');
  
          if (isSupportedFormat) {
            convertedFilePaths.push(filePath);
          } else {
            // Convert image file to JPEG or PNG format
            this.file.resolveLocalFilesystemUrl(filePath).then((fileEntry: FileEntry) => {
              const fileName = filePath.substr(filePath.lastIndexOf('/') + 1);
              const path = filePath.substr(0, filePath.lastIndexOf('/') + 1);
              const convertedFileName = 'converted_image.jpg'; // Set the desired converted file name
              const convertedFilePath = path + convertedFileName; // Set the desired converted file path and format
  
              fileEntry.file((file) => {
                const reader = new FileReader();
                reader.onloadend = () => {
                  // Convert base64 image to Blob
                  const blob = this.b64toBlob(reader.result as string, 'image/jpeg'); // Convert to JPEG format
                  // const blob = this.b64toBlob(reader.result as string, 'image/png'); // Convert to PNG format
  
                  // Write the Blob to the desired converted file path
                  this.file.writeFile(this.file.dataDirectory, convertedFileName, blob, { replace: true }).then(() => {
                    convertedFilePaths.push(convertedFilePath);
  
                    // Check if all files have been converted
                    if (convertedFilePaths.length === filePaths.length) {
                      successCallback(convertedFilePaths);
                    }
                  }).catch((error) => {
                    // Handle error while writing the converted file
                    console.error('Error writing converted file:', error);
                  });
                };
                reader.readAsDataURL(file);
              }, (error) => {
                // Handle error while getting the file
                console.error('Error getting file:', error);
              });
            }).catch((error) => {
              // Handle error while resolving file path
              console.error('Error resolving file path:', error);
            });
          }
        };
  
        for (const filePath of filePaths) {
          convertImage(filePath);
        }
  
        // Check if all files are already in a supported format
        if (convertedFilePaths.length === filePaths.length) {
          successCallback(convertedFilePaths);
        }
      }, (err) => {
        errorCallback(err);
      });
    }).then(data => {
    }, (err) => {
      if (this.platform.is('ios')) {
        this.createAlert(null, "FieldPro needs permissions to work.<br/><br/>Go to Settings, and scroll down to the list of apps, tap on FieldPro.<br/>Give permissions to Photos, Microphone, and Camera.", ['OK']);
      } else {
        this.createAlert(null, "FieldPro needs permissions to work.<br/><br/>Go to Settings -> Apps -> Field Pro.<br/>Give permissions to Files and Camera.", ['OK']);
      }
    });
  }
  
  b64toBlob(b64Data: string, contentType: string): Blob {
    const byteCharacters = atob(b64Data);
    const byteArrays = [];
  
    for (let offset = 0; offset < byteCharacters.length; offset += 512) {
      const slice = byteCharacters.slice(offset, offset + 512);
      const byteNumbers = new Array(slice.length);
  
      for (let i = 0; i < slice.length; i++) {
        byteNumbers[i] = slice.charCodeAt(i);
      }
  
      const byteArray = new Uint8Array(byteNumbers);
      byteArrays.push(byteArray);
    }
  
    const blob = new Blob(byteArrays, { type: contentType });
    return blob;
  }
A
553
Q

The file file:///var/mobile/Containers/Data/Application/54350720-9BEC-429F-B9F4-B22229471429/tmp/cdv_photo_024.jpg could not be accessed

A