Skip to main content

Posts

Map,Filter,Reduce array functions in Javascript

Today let's discuss about the following array functions in Javascript which most of the developers use it for ease of use Map function actually reads thru the entire array and we can perform any operation on each array item The output here would be Filter function as the name suggests we can add any condition and will return only values returning true The output here would be Reduce function it is used for accumulating values in a array by doing some kind of arithmetical operation to each item in array. In the following example we are using addition as an example The output here would be

Destructuring in Arrays & Objects

 Today we will learn about the de structuring in java script. Let us take a simple example how a regular array is defined var capital =["Delhi","London","Paris"] now if we want to access London then we have to pass the value as capital[1].  Now an alternate way and when we want to remember the names rather than indexes to query an array is var [India,England,France] = ["Delhi","London","Paris"]  In here in order to access London we can say console.log(England) and the output would be London This is a simple way to de structure an array. Similarly we can do the same the for an object as well const myfav = { fruit : "apple" , color : "red" }; console . log (myfav); If we have multiple values in an object const myfav = [ { fruit : "apple" , color : "red" }, { fruit : "mango" , color : "yellow" } ]; Now if we have to get mango details then it shou...

REST API (GET,POST,PUT,PATCH,DELETE)

 The word API means application programming interface. Predominantly they are two important protocols which are used in world a) SOAP API (Simple object access protocol) API b) REST API means representational state transfer API's are used to interact with the web applications, many of the major applications create API's so that the end users can interact with their platform programmatically. Similar to database where we can perform operations such as insert, update, delete. In API's also we can perform such operations. Rest API is one of the highest used API's in the current web applications So in Rest API we have the following methods calls a) Get - Get method is used to fetch the data from a web application b) Post - Post method is used to insert the data into a web application c) Delete - As the name suggests delete method is used to delete data from a web application, in here we can perform a select deletion or complete deletion as well d) Put - Put method is used t...

How to Push Node Js code into Heroku

 Simple native or client side java script can run on browser session can give us the desired output. This can be run either directly on browser if we have all the code on our machine or may be host it on github and can be accessed everywhere without needing to have code on our local machine Github can only run client side javacript code but if we have server side javascript then we may need to use service providers such as heroku/AWS/Google/Azure to run our application Server side coding is done for more complex applications and also not to expose our entire code to the rest of the world For our code to be deployed following are the steps  create. a Procfile with same naming convention and add the following line web: node index.js. This will help the heroku to identify what is the staring JS file on which the code should be run git init git add . git commit -m "version name" heroku create app name . This is to give a specific app name or else heroku would create a name for ou...

How to push git code into a repository with out all node packages

 As am trying to learn node JS, I've learnt that we need a lot of packages to run a web application. Like any web app we would want to push (store) this code in Github. No one wants to have all the projects present in our local machine. Storing data in Github applications will help us to access the code from any where any system. Also we get to choose if we want this application to be public/private In a simple application we would be requiring so many packages eg As we can see they are so many packages and ideally we don't require all this code to be uploaded in Github. As long we have uploaded package.json we can always download these files by using the following command i.e. npm -i install once we download the project from github While uploading the project to github we need to create .gitignore file and enter the filenames which we want not to be uploaded ".gitignore" file is a hidden file For ignoring the node modules enter the following directory Then next steps...

How to use AWS CLI for uploading/downloading/deleting files

 Hello again It's been a lot of time that we have posted here. So let's start with AWS S3 CLI.  We can use AWS CLI for various operations such as Uploading files from local machine into S3 bucket Downloading files from S3 bucket into local machine Listing all the files in a S3 bucket Deleting files from the S3 bucket For all the above operations to be performed we would need relevant access permissions to the specified bucket as well. Apart from permissions the three things which we would need are a) Bucket name b)Access key c) Secret Access key First lets install AWS CLI on our machine. In Mac Installing aws cli curl "https://awscli.amazonaws.com/AWSCLIV2.pkg" -o "AWSCLIV2.pkg" sudo installer -pkg AWSCLIV2.pkg -target / In order to test this has worked or not try the simple command aws --version We should get a result in above format Now lets configure for that we need to pass the following command aws configure upon clicking enter it would ask for enter ac...

$LOOKUP ( Similar to LEFT OUTER JOIN in RDBMS) in MongoDB

In RDBMS, we have different type of joins to join the tables and get the required data from joined tables. As MongoDB is a NO Sql database, MongoDB will not support those type of joins. But we can implement LEFT OUTER JOIN using $lookup function in MongoDB. This function is there in MongoDB 3.2 version. To join two collections we need to have a common field in both the collections. $lookup works with aggregate function only. Syntax: db.collection1.aggregate([  {     $lookup:       {          from:"collection2",          localField:"common field name from collection1",          foreignField:"common field name from collection2",          as:"Alias name for collection2"      }  } ]) Here in above syntax, collection1 -- Collection name which is ac...

Check Count, Delete Documents and Drop Collections in MongoDB

Checking the count of documents from collection in MongoDB: In RDBMS, to check the count from table, we need to use count function. In MongoDB also, we have count() method to get the count from collection. Syntax: db.<Collection Name>.count() Example: db.FirstCollection.count(). This query will return the count of total number of records. To get the count of records with specific filter then we need to use find() metho along with count(). Let's say we have records with different Student_Id values in StudentData collection. And we have to find the number of records with Student_Id 201. To do this, we have to pass below query. db.StudentData.find({"Student_Id":201}).count() Delete Documents in MongoDB: In RDBMS, to delete data from table, we need to use DELETE statements.As MongoDB is noSQL database, we have to use remove() method to delete data from collection. Syntax: db.<Collection Name>.remove({<data selection criteria>},{<...

Updating Collection in MongoDB

We can use update() method to update a collection in MongoDB. Basic syntax will be like this: db.<Collection Name>.update(). To update() method, we need to pass the data selection criteria and what we need to update in the selected data. I have a below collection and data. I want to update student name who is having ID 100 in the above collection. To do this, I have to execute below query. We can upsert data as well into collection (Upsert definition: If data exists for the selection criteria then data will be updated otherwise, data will be inserted as new document into collection) To upsert data, we need to pass "upsert":true option to the update() method. In the below example, i am trying to upsert record with Student Id 102. But this 102 does not exist so it should insert as new record. update() will update only first record by default. To update multiple records, we need to pass "true" value for "multi" key in update query...

Creating Collection And Inserting Data in MongoDB

Creating Collection in MongoDB:           We can create a collection in mongoDB using createCollecion(). This method will take collection name as parameter(collection name is the collection which you want to create). Syntax: db.createCollection('<Collection name>',options) Here, we can also pre-allocate space for new collection. This is optional. Let's assume, You have to create a collection with name "FirstCollection". You have to run below command. db.createCollection('FirstCollection') You can see the created collections using command "show collections". Inserting Documents: We can use insert() method to insert documents into a collection. If collection exists then document will be inserted. If not exists, it will create collection first and then it will insert document. Syntax: db.<collection Name>.insert() Below are the sample queries which will insert data into existing collection. Below are the...

Informatica Transformation: Source Qualifier

Source Qualifier is Active Transformation Source Qualifier is connected transformation. It should be there in pipeline. This is default transformation which comes along with source instance when you drag and drop into mapping area.But there is some exceptional case with XML and COBOL sources. This is mandatory transformation to read data from sources and it converts the source data types to the informatica native data types. So, you should not alter the data types of the ports in the source qualifier transformation. If we are not using Push Down Optimization, then every port of source qualifier should have link from source instance. Otherwise, workflow will fail. If we are using Push Down Optimization, then at-least one port of source qualifier should have link from source instance. Otherwise, workflow will fail. Source Qualifier Properties: Below are the Source qualifier properties and there are enable when we are using tables as sources. In case of files as source, th...