interview questions

https://stackoverflow.com/questions/9752287/how-to-delete-a-record-with-a-foreign-key-constraint

Structural directives are responsible for HTML layout. They shape or reshape the DOM’s structure, typically by adding, removing, or manipulating elements.

ngif,ngfor,ngswitch,

passing json data to iframe

int numberOfObjectsPerPage = 10;
var queryResultPage = queryResult
  .Skip(numberOfObjectsPerPage * (pageNumber - 1))
  .Take(numberOfObjectsPerPage);

https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-reliable-services-quick-start

mvc to download excel file

lock,mutex,semaphore

DELETE
FROM Data_Excel
WHERE rowid NOT IN (
    SELECT MIN(rowid)
    FROM Data_Excel
    GROUP BY P_Name,
      P_Address,
      P_city
    );

 Employee table.

SELECT [FirstName],     [LastName],     [Country],     COUNT(*) AS CNTFROM [SampleDB].[dbo].[Employee]GROUP BY [FirstName],       [LastName],       [Country]HAVING COUNT(*) > 1;
Standard

MVC Questions

Types of action filters:

  • output cache
  • Handle error
  • Authorize

123456

System.componentmodel.dataannotation

 

Updatemodel:

Employee ob=new Employee();

updateModel(ob);

 

Tryupdatemodel

Formcollection

[bind] classname obname

 

[httppost(routeName)]

 

Modelstate.isvalid

 

When you an HTML helper, such as LabelFor() or TextBoxFor(), it displays a model property in a fixed manner. For example, LabelFor() renders a model property name in a <label> tag and TextBoxFor() renders a textbox in which a model property is shown for editing. Although this arrangement works fine in many cases, at times you need more control over the way data is shown to the end user. Consider, for example, that you have a model property that represents currency. While displaying this property value to the end user, you want to show a currency symbol such as $ along with the property value. Such a customization is not possible with the above-mentioned HTML helpers. Another example could be a DateTime model property that needs to be displayed in a specific custom format.

  • DisplayFor()
  • DisplayForModel()
  • EditorFor()
  • EditorForModel()

Updatemodel with include and exclude properties

@html.textbox(“id”,”value”,new{

Style=”bg-color:red;…”

Or

@class=”redtextbox”,@readonly=”true”

})

Editor template name is same as model name

Display

Displayformat

Scaffoldingcolomun(false/true)

 

@html.displaymodelfor

Sharedàdisplay temaplatesàurl

[UiHint(“to give other displaytemplate name”)]

Displayformodel

Editformodel

Automatically take the model and build the view…………

MvcBuildViews-àto enable compile time error checking

 

validateInput

@html.raw-àwill take html tags and render it and display appropriately

 

Standard

test

-Java script:

  • Procedural oriented programming language
  • There is no class objects all code are writing in one place
  • Lot of code and conflicts
  • No compilation of code checking
  • Time taken process and no proper productivity and difficult to manage the huge applications

Typescript:

  • Will fallows oops features
  • Code can be clearly modularized
  • TS=JS+extra features[oops]+ES6[modren javascript]
  • installation of typescript
    1. Typescript compiler
    2. npm install typescript
  • compilation
    1. tsc test.ts[tsc   typescript compiler]
    2. this compiler will convert from typescript to javascript
  • excecution
    1. node test.js
  • check which version on typescript installed
    1. tsc -v

 

 

 

Standard

Typescript Basics

Keywords:

  1. let—block level scope in es6 they introduced
  2. var—function level scope and it will be accessed very closest function
  3. const—to const creations
  4. enum–group of constants

when var is there why let came?

to reduce the conflicts  we are using this let and name duplicacy…

and when u changed the value outside it becomes coflict

 

conditional statements: if, ifelse, ternery

loops:

  • foreach—visit and process the element and retrun nothing and performs some …… function there u can write logic on the item

 

  • map—visit and process the element and return the array

 

  • for…in—no separate function here 

 

  • include—>to check the particular value that is available in an array nt …will check with the help of include

 

  • reduce: it will always take previous result…..reduce.png
  • If u want to match the current value with previous value we need to use reduce…

    Accumulator-àis the result of last value

    Current valueàis the current idex

    1st timeàaccumulatorà20

    And current index is: 30

 

  • indexof : to check the index of where variable is availble, and return index and if the value is not available it will return -1 always

 

Standard

Angular 2 Training

1) what is the angular

  • Angular2 came in 2016
  • There is no class objects all code are writing in one place
  • All code is written in one place
  • Lot of code and conflicts
  • No customization of js code
  • Less conflicts and less issues are there
  • Time taken process and no proper productivity and difficult to manage the huge applications

Angular 2:

  • No similarity between angular js and angular…
  • Angular js we will write code again in javascript
  • Again same issues are coming
  • That’s why in angular2 code is coming  in Typesctipt
  • Angular invented by Google
  • TypeScript invented by Microsoft

what is typescript and what is javascript

  • even though you write code in typescript browser can understand in javascript…
  • so typescript will convert to javascript with compiler ???
  • with javascript we can write procedural based programming pop—-creating functions and all and oops features wont able to support by javascript
  • so typescript came into the market so we can write oops features in typescript
  • TS=JS+extra features[oops]+ES6[modren javascript]
  • installation of typescript
    • Typescript compiler
    • npm install typescript
  • compilation
    • tsc test.ts[tsc   typescript compiler]
    • this compiler will convert from typescript to javascript
  • excecution
    • node test.js
  • check which version on typescript installed
    • tsc -v

 

 

                    

 

Standard

my working node code

const express = require(‘express’);
const app=express();
var mongo = require(‘mongodb’);
app.use(express.json());
const coursesArray=[
{id:1,name:’course1′},
{id:2,name:’course2′},
{id:3,name:’course3′},
{id:4,name:’course4′},
{id:5,name:’course5′}
];
app.get(‘/api/courses/:id’,(req,res)=>{
console.log(req.param.id)
constcourse=coursesArray.find(c=>c.id===parseInt(req.params.id));
if(!course) res.status(404).send(“requested course id is not avilable”)
elseres.send(course)
});
app.post(‘/api/courses’,(req,res)=>{
varbody=req.body;
coursesArray.push(body);
res.send(coursesArray);
});
app.delete(‘/api/courses’,(req,res)=>{
varqueryParmId=req.query.id;
constcourse=coursesArray.find(c=>c.id===parseInt(req.query.id));
coursesArray.pop(course);
res.send(coursesArray);
});
app.listen(4000, ()=>console.log(“app listening 4000 port “))
Standard

json customized code

var validationErrors = [];

var reqPayload = context.getVariable(‘request.content’);

reqPayload= JSON.parse(reqPayload);

var type=context.getVariable(‘type’).toLowerCase();

type=type.charAt(0).toUpperCase() + type.substring(1)

var kvmData=JSON.parse(context.getVariable(type));

var schemaEntryArray = kvmData[‘jsonSchema’];

 

if(reqPayload.length===0){

     validationErrors.push({“field”: “request payload”, “reason”: “Request Payload Is Missing. Please correct your request and try again..”})  ;  

}

else if((schemaEntryArray!== null && schemaEntryArray.length > 0) &&

reqPayload!==null && reqPayload.length > 0){

 var dataPayload = reqPayload[0];

  schemaEntryArray.forEach(function validatePayload(eachEntry) { 

        var key = eachEntry.fieldName;

        if(eachEntry.parentField !== ‘root’){

            var keyAgain = eachEntry.fieldName; 

            var childName = eachEntry.parentField +”.”+keyAgain;

            var parentData = dataPayload[eachEntry.parentField+”];//hasOwnProperty(parentKey);

          if(parentData!==undefined && parentData!==null){

              if(!parentData[keyAgain+”]){

                  validationErrors.push({“field”: “request payload”,”reason”: “Missing required fields [“+childName+”]  in the payload.Please correct your request and try again..”})  ; 

              }

          }

          else{

               validationErrors.push({“field”: “request payload”,”reason”: “Missing required fields [“+childName+”]  in the payload.Please correct your request and try again..”})  ;

          }

         

           

        }else{

            if(!dataPayload.hasOwnProperty(key)){

                print(key);

                validationErrors.push({“field”: “request payload”,”reason”: “Missing required fields [“+key+”] in the payload. Please correct your request and try again..”})  ;

            }

        }

    } )

}

if (validationErrors.length > 0) {

  context.setVariable(‘flow.myapi.error.httpStatusCode’, ‘400’);

  context.setVariable(‘flow.myapi.error.httpStatusReason’,  ‘Bad Request’);

  context.setVariable(‘flow.myapi.error.message’, ‘Request Validation Failed’);

  context.setVariable(‘flow.myapi.error.errors’, validationErrors);

  context.setVariable(‘flow.myapi.error.code’, ‘gateway.transactions.badRequest’);

  throw Error()

}

 

SEI Internal Communication Only

Thanks,

Maha Lakshmi Kalyani, Contractor for SEI

IMS

SEI  New ways. New answers.

———————————————————————————————————————————————————————————————————————————————————
1 Freedom Valley Drive, Oaks, PA 19456  T +1 610-230-5981 M +91-9000528735   www.seic.com

Disclaimer:

This e-mail and any files transmitted with it are confidential and intended solely for the use of the recipient(s) to whom they are addressed, even if addressed incorrectly.  If you are not the intended recipient you should not disseminate, distribute or copy this e-mail.  Please notify the sender immediately by e-mail if you have received this by mistake and delete this e-mail from your system.  SEI may archive and review outgoing and incoming email and may produce any email at the request of regulators.

 

Standard

angular js session topics–jalandhar

diestion cycle
2way
service
factory
controller to view—$scope
controller to controller-rootscope,broadcast,emit,service and factory
local storage
sesiion storage
customdirective-isolation scope—>shopping cart template
scope->=,&,$
restrictive–>a,e,c
factory–>will return plain json
service—>singleton object–>loading object will take time
app.directive(‘myDir’,function(){
restrictive:’a,c,e’
templateurl:
scope
});
filters:
app.filter(”, function () {
return function () {
return;
};
});

Standard

Docker

Flexible: Even the most complex applications can be containerized.
  • Lightweight: Containers leverage and share the host kernel.
  • Interchangeable: You can deploy updates and upgrades on-the-fly.
  • Portable: You can build locally, deploy to the cloud, and run anywhere.
  • Scalable: You can increase and automatically distribute container replicas.
  • Stackable: You can stack services vertically and on-the-fly.
## List Docker CLI commands
docker
docker container --help

## Display Docker version and info
docker --version
docker version
docker info

## Execute Docker image
docker run hello-world

## List Docker images
docker image ls

## List Docker containers (running, all, all in quiet mode)
docker container ls
docker container ls --all
docker container ls -aq

  • docker-compose.dcproj – The file representing the project. Includes a <DockerTargetOS> element specifying the OS to be used.
  • .dockerignore – Lists the file and directory patterns to exclude when generating a build context.
  • docker-compose.yml – The base Docker Compose file used to define the collection of images built and run with docker-compose build and docker-compose run, respectively.
  • docker-compose.override.yml – An optional file, read by Docker Compose, with configuration overrides for services. Visual Studio executes docker-compose -f "docker-compose.yml" -f "docker-compose.override.yml" to merge these files.
Standard