Posts

AngularJS Flow

AngularJS  is a very powerful JavaScript Framework. It is used in Single Page Application (SPA) projects. It extends HTML DOM with additional attributes and makes it more responsive to user actions. AngularJS is open source, completely free, and used by thousands of developers around the world. It is licensed under the Apache license version 2.0. AngularJS flow with a simple example <!doctype html> <html> <head> <script src = "https://ajax.googleapis.com/ajax/libs/angularjs/1.5.2/angular.min.js" ></script> </head> <body ng-app = "myapp" > <div ng-controller = "HelloController" > <h2> Welcome {{helloTo.title}} to the world of Tutorialspoint! </h2> </div> <script> angular . module ( "myapp" , []) . controller ( "HelloController" , function ( $scope...

How to get the tweets using Kafka producer and Consume it using MongoDB

Kafka_Mongo_Integration Sample POC on Kafka which will pull tweets from twitter and persist in to the MongoDB Technologies: Kafka Zookeeper MongoDB For full code  https://github.com/BrahmaR/KafkaMongoIntegration Kafka Producer: package com.royal.twitter.kafka; import java.util.Properties; import java.util.concurrent.BlockingQueue; import java.util.concurrent.LinkedBlockingQueue; import kafka.javaapi.producer.Producer; import kafka.producer.KeyedMessage; import kafka.producer.ProducerConfig; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.google.common.collect.Lists; import com.twitter.hbc.ClientBuilder; import com.twitter.hbc.core.Constants; import com.twitter.hbc.core.endpoint.StatusesFilterEndpoint; import com.twitter.hbc.core.processor.StringDelimitedProcessor; import com.twitter.hbc.httpclient.BasicClient; import com.twitter.hbc.httpclient.auth.Authentication; import com.twitter.hbc.httpcl...

Security breaches on Web Application

Security Breaches on Web Application Basically we have several types of security breaches on Web application 1. Session Fixation 2. CSRF 3. Click Jacking Session Fixation Session fixation, by most definitions, is a subclass of session hijacking. The most common basic flow is: Step 1. Attacker gets a valid session ID from an application Step 2. Attacker forces the victim to use that same session ID Step 3. Attacker now knows the session ID that the victim is using and can gain access to the victim’s account Step 2, which requires forcing the session ID on the victim, is the only real work the attacker needs to do. And even this action on the attacker’s part is often performed by simply sending the victim a link to a website with the session ID attached to the URL. We need to make sure about Fortunately, resolving session fixation is usually fairly simple. The basic advice is: Invalidate the user session once a successful login has occurred. The usual ...

Gradle vs Maven

Image
Gradle vs Maven vs Ant A simple snippet on Maven and Gradle as well.

Identify cursor leak in Oracle

As a developer it is important to know which Oracle cursor is not being closed or reused on each execution that leads to the following Oracle error: "ORA-01000: maximum open cursors exceeded." We can identify these type of leaks by using some tools but this is a bit hectic to identify in code level. So the solution is we can diagnose these from oracle database side with a minimal queries... 1. Identify the session by its Oracle username to retrieve the sid value. SQL> SELECT sid FROM v$session WHERE username = 'BRAHMA'; sid ----------- 1234 2. List the session's SQL statement addresses, which have more than one active reference. Using the sid value from the previous statement, execute a query against the v$open_cursor view. SQL> SELECT COUNT(*), address FROM v$open_cursor WHERE sid = 1234 GROUP BY address HAVING COUNT(address) > 1 ORDER BY COUNT(*); COUNT(*) ADDRESS ---------------- ---------------- 2 35E6083C 2 ...

Cache using @Cacheable annotation in Spring itself......

Spring 3.1 Provides Cache using @Cacheable annotation.. Methods for whom the result is stored into the cache so on subsequent invocations (with the same arguments), the value in the cache is returned without having to actually execute the method. In its simplest form, the annotation declaration requires the name of the cache associated with the annotated method: @Cacheable("books") public Book findBook(ISBN isbn) {...} Just like other services in the Spring Framework, the caching service is an abstraction (not a cache implementation) and requires the use of an actual storage to store the cache data - that is, the abstraction frees the developer from having to write the caching logic but does not provide the actual stores. This abstraction is materialized by the  org.springframework.cache.Cache  and  org.springframework.cache.CacheManager  interfaces. There are  a few implementations  of that abstraction available out of the box: JDK ...

Spring MVC Flow

Image
Spring MVC Flow is as follows: ----------------------------------------------------------------- The Dispatcher Servlet is heart of the Spring MVC and it involves in all the phases of the process. Step 1: First request will be received by DispatcherServlet. Step 2: DispatcherServlet will take the help of HandlerMapping and get to know the Controller class name associated with the given request. Step 3: So request transfer to the Controller, and then controller will process the request by executing appropriate methods and returns ModeAndView object (contains Model data and View name) back to the DispatcherServlet. Step 4: Now DispatcherServlet send the model object to the ViewResolver to get the actual view page. Step 5: Finally DispatcherServlet will pass the Model object to the View page to display the result. That’s it