Tutorials

Tutorials

Angular 5 Interview Questions

Angular 5 Interview Questions

Name the building blocks of Angular:
Components
Data Binding
Dependency Injection
Directive
Modules
Routing
Services
Templates

What is Transpiling in Angular?
Transpiling is the process of converting typescript into javascript (it uses Traceur, a js compiler).

Differentiate between Components and Directives in Angular 5?
Components are application blocks where the data can be displayed in the HTML using some logic.
Directives add behaviors to existing DOM elements.

What are the Pipes?
It`s a feature used to format the data that will be displayed.

What is the use of @Input and @Output?
It`s used to communication between parent and child components, @Input is used to send data from parent to child. @Output is used to child send and event to the parent.

What is ng-content Directive?
Its used to render custom content in components. Its placeholder for custom HTML.

What does a router.navigate do?
It`s used to navigate to other components.

What is ViewEncapsulation?
It defines how the component styles will affect the entire application.
Emulated: styles from components spread to the component.
Native: styles from components do not spread to the component.
None: styles defined in a component are visible to all components.

What are Services in Angular and what command is used to create a service?
Services is a feature used to provide modularity and reusability avoiding code to be duplicated.
With the creation of the services you can use the same code in different components.

What is Dependency Injection in Angular?
One component is dependent on another component, service, pipe, etc… it will be provided through injection by the constructor during run-time.

What is Routing in Angular?
It helps the user to navigate to different pages using links.

How to handle Events in Angular 5?
Any DOM event is passed from HTML to a typescript event.

What is a RouterOutlet?
Its used to render components at a specific location of the page.

Explain the usage of {{}}?
Also Known as Interpolation, it`s used to display component data in the html.

In how many ways the Data Binding can be done?
Event Binding.
Data Binding.
Property Binding.

What is the sequence of Angular Lifecycle Hooks?
OnChange
OnInit
DoCheck
AfterContentInit
AfterContentChecked
AfterViewInit
AfterViewChecked
OnDestroy

What is the purpose of using package.json in the angular project?
Manage project dependencies.

How is SPA (Single Page Application) technology different from the traditional web technology?
In Traditional Web apps the client requests a page and the server will respond with the HTML of the whole page, this process consumes a lot of time due to a lot of reloading.
In SPA app the maintain only one page even if the URL changes and only part of the page content changes.

What is Component in Angular Terminology?
Component is a block of code that can display data on the HTML with some logic usually written in typescript.

What are ngModel and how do we represent it?
NgModel is directive used for 2 way data binding and its represented by [()]

What does a Subscribe method do in Angular?
Observables need a subscription in order execute, the subscribe method will do that.

Differentiate between Observable and Promises.
Observable are lazy and an execution will happen only when a subscription is made. It may handle zero or more events.
Promises are eager and will be executed when its created. It handles only one event.

What is an AsyncPipe in Angular?
With AsyncPipe the promise or observable can be used direct in the HTML and in this case a temporary property is not required.

Explain Authentication and Authorization.
Authentication: The client send the user credentials to an api, the api will evaluate it and return a JWT in case of success, the JTW has the user claims and it will be used to identify the user.
Authorization: The process of checking if the user is authorized to access some data or resource.

What is AOT Compilation?
Every angular application gets compiled internally. The angular compiler takes javascript code, compiles it and produces javascript code again. Ahead-of-Time Compilation does not happen every time or for every user.

What is Redux?
It`s a library used to maintain the state of application.

Differentiate between ng-Class and ng-Style.
NgClass is used to set css classes.
NgStyle is used to set css styles.

Why Typescript with Angular?
Offers OOP concepts like Interfaces, Inheritance, Generics Arrow Functions:
Lovingly called the fat arrow (because -> is a thin arrow and => is a fat arrow) and also called a lambda function (because of other languages). Another commonly used feature is the fat arrow function ()=>something. The motivation for a fat arrow is:
You don’t need to keep typing function
It lexically captures the meaning of this
It lexically captures the meaning of arguments
It`s flexible and easy for programmers experienced with .net and java


Read More

Web APP con ASP .NET CORE MVC

Web APP con ASP .NET CORE MVC

Vamos a crear una Web App con las siguientes tecnologías:
Visual Studio 2017
ASP .NET CORE MVC
Microsoft SQL Server
C#
HTML
CSS
JavaScript
JQuery
BootStrap
DevExtreme DataGrid

public class Startup
    {
        public Startup(IConfiguration configuration)
        {
            Configuration = configuration;
        }

        public IConfiguration Configuration { get; }

        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.Configure<CookiePolicyOptions>(options =>
            {
                // This lambda determines whether user consent for non-essential cookies is needed for a given request.
                options.CheckConsentNeeded = context => true;
                options.MinimumSameSitePolicy = SameSiteMode.None;
            });       services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2)
                .AddJsonOptions(options => options.SerializerSettings.ContractResolver = new DefaultContractResolver());
            services.AddDbContext<SchoolCoreDbContext>(options =>
            options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));
        }

        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
            }
            app.UseStaticFiles();
            app.UseCookiePolicy();

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Student}/{action=List}/{id?}");
            });
        }
    }
 public class SchoolCoreDbContext : DbContext
    {
        public SchoolCoreDbContext(DbContextOptions<SchoolCoreDbContext> options) : base(options)
        {
        }
        public DbSet<Student> Student { get; set; }
    }
[Table("Student")]
    public class Student
    {
        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        public int StudentId { get; set; }

        [Required]
        [MinLength(3)]
        [MaxLength(30)]
        [Display(Name = "First Name")]
        public string FirstName { get; set; }

        [Required]
        [MinLength(3)]
        [MaxLength(30)]
        [Display(Name = "Last Name")]
        public string LastName { get; set; }
    }
public class StudentViewModel
    {
        public Student Student { get; set; }
    }
public class StudentController : Controller
    {
        private readonly SchoolCoreDbContext _dbContext;

        public StudentController(SchoolCoreDbContext dbContext)
        {
            _dbContext = dbContext;
        }

        public IActionResult List()
        {
            return View();
        }

        [HttpGet]
        public object GetStudentList(DataSourceLoadOptions loadOptions)
        {
            var lstStudents = _dbContext.Student.ToList();
            var vmStudent = new List<StudentViewModel>();

            foreach (var student in lstStudents)
            {
                vmStudent.Add(new StudentViewModel
                {
                    Student = student
                });
            }
            return vmStudent;
        }

        [HttpPost]
        public IActionResult StudentInsert(string values)
        {
            var vmStudent = new StudentViewModel();
            JsonConvert.PopulateObject(values, vmStudent);

            _dbContext.Student.Add(new Student {
                FirstName = vmStudent.Student.FirstName,
                LastName = vmStudent.Student.LastName
            });
            _dbContext.SaveChanges();
            return RedirectToAction("List");
        }

        [HttpPut]
        public IActionResult StudentUpdate(int key, string values)
        {
            var vmStudent = new StudentViewModel();
            JsonConvert.PopulateObject(values, vmStudent);
            var StudentUpdate = _dbContext.Student.First(s => s.StudentId == key);
            StudentUpdate.FirstName = vmStudent.Student.FirstName;
            StudentUpdate.LastName = vmStudent.Student.LastName;
            _dbContext.Update(StudentUpdate);
            _dbContext.SaveChanges();
            return RedirectToAction("List");
        }
        public IActionResult StudentDelete(int key, DataSourceLoadOptions loadOptions)
        {
            var StudentDelete = _dbContext.Student.First(s => s.StudentId == key);
            _dbContext.Student.Remove(StudentDelete);
            _dbContext.SaveChanges();
            return RedirectToAction("List");
        }
    }
@{
    ViewData["Title"] = "List";
    Layout = "~/Views/Shared/_DashBoard.cshtml";
}
@(Html.DevExtreme().DataGrid<SchoolCore.ViewModels.StudentViewModel>()
        .DataSource(ds => ds.Mvc()
            .Controller("Student")
            .LoadAction("GetStudentList")
            .InsertAction("StudentInsert")
            .UpdateAction("StudentUpdate")
            .DeleteAction("StudentDelete")
            .Key("Student.StudentId")
    )
    .RemoteOperations(true)
    .Columns(columns => {
        columns.AddFor(m => m.Student.StudentId);
        columns.AddFor(m => m.Student.FirstName);
        columns.AddFor(m => m.Student.LastName);
    })
    .Editing(e => e
        .AllowAdding(true)
        .AllowUpdating(true)
        .AllowDeleting(true)
    )
)
Read More

SAP FICO Definitions

General Ledger: contains all the transaction details of a company. It acts as the primary record to maintain all accounting details. Common general ledger entries are customer transactions, purchases from vendors, and internal company transactions.

Asset Accounting: deals with all the fixed asset of the company and provides all the transaction details about fixed assets.
Accounting Bank Accounting: It deals with all the transactions done through bank. It includes all the incoming and outgoing transactions performed, balance management and bank transaction master data.

Company: is defined as the smallest unit for which financial statements can be created in accordance with commercial legal regulations.

Company Code: is the smallest unit in an organization for which financial statements (profit-loss statement, etc.) can be generated.

Business Areas: are used to differentiate transactions that come from different lines of business in a company.

Function Areas: in finance accounting are used to define the expenses in a company according to individual function units.

Credit Control: in FI is used to check the credit limit for the customer and it can use one or more codes. It is used for credit management in Application components such as Account Receivable (AR) and Sales and Distribution.

Chart of Accounts: represents the list of GL accounts that are used to meet the daily needs and the operating country’s legal requirement in a company. The master chart of accounts must be assigned to each company code.

Chart of Accounts Group: effectively manage and control a large number of G/L accounts, you should use COA groups.

Retained Earnings Account: is used to carry forward the balance from one fiscal year to the next fiscal year. You can assign a Retained Earning Account to each P&L account in the chart of accounts (COA).

General Ledger (G/L) Accounts: are used to provide a picture of external accounting and accounts and to record all the business transactions in a SAP system.

Financial Statement Versions: are used to create the financial statements, to run account balance reports and for General Ledger accounting planning.

Journal Entry (JE) Posting: in SAP FI is to take a batch, validate it for consistency, and create FI documents and post those entries in various line item accounts needed for subsequent business processing.

Fiscal Year Variant: contains the number of posting periods in a fiscal year and the number of special periods. You can define up to 16 posting periods in a fiscal year in the controlling component CO.

Posting Period Variant: is used to maintain accounting periods that are open for posting and all closed period are balanced. This is used for opening and closing period in the fiscal year for posting purpose.

Field Status Variant: is used to define the fields which are used for input like cost center, profit center, plant, etc., which are entry fields, and hidden fields. Field status Variant is a tool which is provided by SAP to assign the same set of properties to more than one object.

Field Status Group: is assigned to GL account. Through field status group, one can define a field as optional, suppressed, or mandatory. According to the field status groups, respective fields will be displayed are mandatory or suppressed when the postings are made to that GL account.

Posting Keys: are used to determine Account types (A, D, K, M, and S) and also the type of posting. It is 2-digit numerical key.

Document Type Key: is used to distinguish between different business transactions and to classify the accounting documents. It is also used to determine the number range for documents and account types such as asset, material, vendor, etc. for posting.

Accounts Receivable: component records and manages accounting data of all customers. It is also an integral part of sales management.

Accounts Payable: is used to manage and record accounting data for all the vendors. All invoices and deliveries are managed as per vendor requests. Payables are managed as per the payment program and all the payments can be made using checks, transfer, electronic transfers, etc.

Vendor Master Records: are used by both the Accounting component and the Purchasing component.

Cost Center: is defined as a component in an organization that adds to the cost and indirectly adds to the profit of the organization.

Profit Center: is used for managing internal controlling. When you divide your company into profit centers, it allows you to delegate responsibility to decentralized units and treat them as separate companies in a company. It also allows you to calculate key figures in cost accounting like ROI, Cash flow, etc.

Read More