Skip to main content

Posts

Microservices In Nutshell

What are Microservices ? A dialect of service oriented architecure where the services are fine grained and loosely coupled. Also protocols for communication are lightweight. Whare are the major projects today in industry which are microservices ? Few companies which use microservices are : Comcast Cable,Uber,Netflix,Amazon,Ebay,Sound Cloud,Karma,Groupon. What are the problems in Service Oriented Architecture which microservices solved ?  - Allows skill set flexibility : Multiple technologies can be used to develop the parts isolated.  - Easy and less risky deployment : Replacing only the changed parts of the program.  - Individual services can be scaled.  - Application lifecycle flexibility : can develop individual services in isolation.  - Overall user experience improvement What is a monolithic architecture ? In monolithic application all ther requirements of the application will be provided by a single application abstraction. So, Is there a...

Smart Pointers in C++

* Smart pointer classes are defined in <memory> header, so we need to include "memory" header to use smart pointers. * The header gives access to three template based smart pointers each with unique features. * We get "unique_ptr", "shared_ptr", "weak_ptr" *  Unique pointer are type of smart pointers that can’t be copied.std::unique_ptr is a smart pointer that owns and manages another object through a pointer and disposes of that object when the unique_ptr goes out of scope. *  Shared pointer is much like “unique_prt” but we can make copies of it. *  Weak pointer is a special case of shared pointer. Weak pointer helps in breaking circular references.Destruction using weak pointer will not care about destruction of other objects referenced from this present object under destruction.

Drive Bot In A Path

#define LEFT 13 #define RIGHT 12 #define PATH_DURATION1 5000 #define PATH_DURATION2 1000 #define PATH_DURATION3 500 // the setup function runs once when you press reset or power the board void setup() {   // initialize digital pin LED_BUILTIN as an output.   pinMode(LEFT, OUTPUT);    pinMode(RIGHT, OUTPUT); } // the loop function runs over and over again forever void loop() {   moveStraight();   delay(PATH_DURATION1);          moveRight();   delay(PATH_DURATION2);        moveStraight();   delay(PATH_DURATION1);   moveLeft();   delay(PATH_DURATION2); } void moveStraight(){   digitalWrite(LEFT, HIGH);   digitalWrite(RIGHT,HIGH);           // turn the LED on (HIGH is the voltage level) } void moveRight(){   digitalWrite(LEFT,HIGH);   digitalWrite(RIGHT,LOW); } void moveLeft(){   digitalWrite(LEFT,LOW);  ...

Learning C from Snippets : Pointers to structures

struct exam{ int a; char *ch; }st[]={10,"Testing",11,"Computer",12,"Science",13,"Engineering",14,"Custo",15,"2018"}; int main() { struct exam *e = st; printf("%s, ",e++->ch); ++e; printf("%s, ",++e->ch);   // -> operator has higher precedence than the ++ opearator. printf("%s, ",++e++->ch); printf("%d, ",e[0].a); printf("%s",++e->ch); return 0; } OUTPUT : Testing, cience, ience, 13, ngineering

Learning C from Snippets : What does pointer +1 means ?

int main(int argc, char** argv) { char p[3][4]={{'R','B','R','a'},{'S','R','K','a'},{'A','P','J','a'}}; printf("%d\n",p); //Prints 7339584 printf("%d",p+1); //Prints 7339588 , i.e there is an addition of 4 to the previous number return 0; } int main(int argc, char** argv) { char p[3][3]={{'R','B','R'},{'S','R','K'},{'A','P','J'}}; printf("%d\n",p); //Prints 7339584 printf("%d",p+1);//Prints 7339583 return 0; } _________________________________________________________________________________ int main(int argc, char** argv) { char p[3][2]={{'R','A'},{'S','R'},{'A','P'}}; printf("%c",*(p+1)); //Prints B return 0; } int main(int argc, char** argv) { char p[3][3]={{'R','B','R...

Ensemble Learning

In ensemble learning we combine the output of multiple classifiers in order to on better prediction on classification accuracy. The classifcation of resultant classifer is better then the resultant classifier. We need a way to combine the output of multiple classifiers. First we generate a group of base learners. These learners will be using different algorithms.(say learner which uses a Dicision Tree,Neural Network, Support Vector Machine etc..), they could be same algorithms with different hyperparameters, could have different representations or may use different training sets. Muliple learner will give different classifications. 

Uniqueness of Scala

* The declared type of a symbol is given after the symbol and a colon. The declared type can often be omitted, because the compiler can infer it from the context. * A mixin is a class that provides certain functionality to be inherited by a subclass and isn’t meant for instantiation by itself. A mixin could also be viewed as an interface with implemented methods. * Array types are written Array[T] rather than T[], and array selections are written a(i) rather than a[i]. * Functions can be nested inside other functions. Nested functions can access parameters and local variables of enclosing functions. For instance, the name of the array xs is visible in functions swap and sort1, and therefore need not be passed as a parameter to them.