Creating and reading Annotations & Reflection in Java

Annotations are very helpful tool while programming in Java. It is a alternative to the traditional XML based configurations. Spring has picked it up early and I must admit quite beautifully.
In case you are working on something and want to use annotations for your code, here is a small guide; it will definatly make your code look clean and also will kick off the trouble of reading XMLs.
For simplicity, lets create a mock of reading column name and its value, similar to JPA.
 Get the Code

Extending Our NodeJS static + Dynamic Server

Here, we would be extending / simplifying our server that we had made in our last post here.
Objectives –

  • We had a static URL handler which was invoked when URL pattern had /static/. It made the design very specific and not generic.
  • Need to make sure that in case there is no URL pattern handler for a given URL, a file for same name must be looked. If there is no such file, just raise 404 error.

 Get the server

Fully Functional NodeJS static + Dynamic Server

Off late I have seen many people struggling with creating a static Node server, also there have been questions like “How to have static & Dynamic files served by Node”. So here I have a fully functional server that can serve both static as well as dynamic files. Off course there is no need as there are many frameworks that can take care of these things. But always good to do things on your own to learn a new language or as we say Reinventing the wheels.
Below is the server that decides what content to serve based on URL. I have used /static/ to mark static content from URL pattern. That is any URL having this pattern would be considered static and would be served from file system.
Read Complete entry

Getting Started with MongoDB and NodeJS

Before we kick start Node application lets start by creating a MongoDB database and credentials. Though creating database, could have been achieved by using Node, but that would not provide us with user & password. And I believe no one would want their database to be accessible to everyone. 😀
I hope you have got MongoDB installed on your machine, just start up the server and open command prompt.

>mongo
MongoDB shell version: 2.0.6
connecting to: test
>use supaldubey
switched to db supaldubey
>db.addUser('supal', 'key')

Node Code Follows!

Your First NodeJs Application

If you are looking for a “Hello World!” example, I am sorry, you have landed to a wrong page, for hello World, your best bet is the Nodejs site.
Lets just have a brief discussion on what Node (Developers kinda like this name than Nodejs) really is. Node is a platform based on Google’s high performance (& open source) V8 Java script engine, if you are a “Geek” you must have read about it as Chrome uses it as well. Node being build on the Javascript engine, provides a JS like environment for Server side development. Yes, you read this right. Node is Server side Javascript framework.
Get the first Node App!

Creating a custom View Resolver in Spring MVC

Spring being one of the most customizable framework, provides an ability to plug in a custom view resolver.
Assume if the web application uses a particular JSP for festive time, having links or logic for some offers while other is vanila JSP page rendering response. I will demonstrate you how to achieve smooth transition in JSPs without messing up your controller return values and thus code release.
I will be using the code base from my previous example here.
Get the code!