Showing posts from October, 2013

Installing Groovy & Grails on Linux GVM is a tool for managing parallel Versions of multiple Software Development Kits on most Unix based systems. It provides a convenient command line interface for installing, switching, removing and listing Candidates. GVM was inspired by the highly useful RVM and rbenv tools, used at large by the Ruby community. Candidates that are currently supported are: GaidenGroovyGrailsGriffonGradleGroovyservLazybonesSpring Bootvert.x

Groovy REST Client

Using RESTClient for Groovy -

Example code:
package restclient

import static

restClient = new RESTClient( 'http://localhost:8080/CustomerDB/webresources/', JSON)
def resp = restClient.get(path: 'entities.customer')
assert resp.status == 200
def respHeaders = resp.getAllHeaders()
respHeaders.each { header ->
println header

Groovy By Example: For Java Programmers

This is based on -

Groovy is a JVM scripting language, it supports dynamically typed variable, comes with groovyc (interpreter), groovyConsole (small Swing editor). It interoperates with Java seamlessly - can call any Java method and use any Java class. The same holds true for Java - it can call into groovy scripts.

Example 1:
class GroovyPerson {
    // dynamically typed - no semi colons needed.
    def age
    // statically typed
    String name

    def printName() {
        println name

    static void main(String[] args) {
        // default constructor can accept any number of properties - no getters/setters
        def person = new GroovyPerson(age:7, name: 'Jake')

Example 2:

def cal = Calendar.instance
cal.clear() -- parens required if not passing params to a method
cal.set Calendar.MONTH, Calendar.JULY -- parens optional if passing params to method.
cal.set Calendar.DATE, 4
cal.set Calend…

Installing Oracle JDK on Ubuntu

JDK version 1.7.0 update 45
Linux Mint 15 x86-64


Remove OpenJDK sudo apt-get purge openjdk-\*sudo mkdir -p /usr/local/javasudo cp -r jdk-7u45-linux-x64.tar.gz /usr/local/javacd /usr/local/javaExtract the archive: sudo chmod a+x jdk-7u45-linux-x64.tar.gzsudo tar xvzf jdk-7u45-linux-x64.tar.gzCreate a symbolic link as: jdk7 -> jdk1.7.0_u45sudo ln -s jdk1.7.0_45 jdk7This is so to avoid doing all the steps when the next time we update the jdk then we just change the jdk7 symbolic link to point to the then latest jdk. Add JAVA_HOME to PATH environment variable:sudo gedit /etc/profilePaste and save:JAVA_HOME=/usr/local/java/jdk7
export JAVA_HOME
export PATH Inform Linux system where Oracle JDK is located:sudo update-alternatives --install "/usr/bin/java" "java" "/usr/local/java/jdk7/bin/java" 1sudo update-alternatives --install "/usr/bin/javac" …

REST Web APIs - Part 1

This my notes from the book REST Web APIs by Mike Amundsen.

RESTful architectures are designed for managing change. We all understand hypermedia in the context of the Web. It’s just a fancy word for links. Web pages link to each other, and the result is the World Wide Web, driven by hypermedia. Hypermedia is the single most important aspect of REST, and the least understood.We say that a URL is the URL of some thing: a product, a user, the home page. The technical term for the thing named by a URL is resource.When a web browser sends an HTTP request for a resource, the server sends a document in response (usually an HTML document, but sometimes a binary image or something else). Whatever document the server sends, we call that document a representation of the resource.URL identifies one and only one resource. If a website has two conceptually different things on it, we expect the site to treat them as two resources with different URLs.The principle of addressability just says that eve…

XPath Cheatsheet

<root xmlns:foo="" xmlns:bar=""> <actors> <actor id="1">Christian Bale</actor> <actor id="2">Liam Neeson</actor> <actor id="3">Michael Caine</actor> </actors> <foo:singers> <foo:singer id="4">Tom Waits</foo:singer> <foo:singer id="5">B.B. King</foo:singer> <foo:singer id="6">Ray Charles</foo:singer> </foo:singers> </root>
Excerpted from:

1. Select the document node/
2. Select the 'root' element/root
3. Select all 'actor' elements that are direct children of the 'actors' element./root/actors/actor
4. Select all 'singer' elements regardless of their positions in the document.//foo:singer
5. Select the 'id' attributes of the 'singer' elements regardless of …

OpenID Connect - OAuth 2.0 with Authentication

Connect | OpenID:
OpenID Connect 1.0 is a simple identity layer on top of the OAuth 2.0 protocol. It allows Clients to verify the identity of the End-User based on the authentication performed by an Authorization Server, as well as to obtain basic profile information about the End-User in an interoperable and REST-like manner.
'via Blog this'

Single Sign-on with Shibboleth IDP Server

What is Single Sign-on?
Single sign-on (SSO) is a property of access control of multiple related, but independent software systems. With this property a user logs in once and gains access to all systems without being prompted to log in again at each of them. Conversely, Single sign-off is the property whereby a single action of signing out terminates access to multiple software systems.

Single sign-on requires that users literally sign in once to establish their credentials. Systems which require the user to log in multiple times to the same identity are inherently not single sign-on. For example, an environment where users are prompted to log into their desktop, then log into their email using the same credentials, is not single sign-on.

SSO shares centralized authentication servers that all other applications and systems use for authentication purposes and combines this with techniques to ensure that users do not have to actively enter their credentials more than once.

Common …


Python is an interpreted and Object oriented language.

Variable is simply defined as:
my_string = "Always look on the bright side of life!"

Never use quotation marks (' or ") with booleans, and always capitalize the first letter! Python is case-sensitive (it cares about capitalization). 

In Python, statements are separated by whitespace (no ; at the end!).

Code needs to be indented by 4 spaces (or a tab).
def spam():
    eggs = 12
    return eggs

Comments begin with # or use triple quotation marks for a multi-line comment.
""" Hi there 
this is my comment

Long one indeed!"""

Arithmetic operators: +, -, *, /, % and ** (Exponentiation). The ** operator raises the first number, the base, to the power of the second number, theexponent.
my_var = 10**2
Ans: 100

Backslash (\) escapes a string with quotes.
'Help! Help! I\'m being repressed!'

So if you wanted "Y", you could just type &qu…

JRebel How-to: Using JRebel with JBoss Developer Studio and JBoss AS 7.1 |

Documenting REST APIs

implementing-rest - Exploring the implementation aspects of the REST architectural style. - Google Project Hosting

implementing-rest - Exploring the implementation aspects of the REST architectural style. - Google Project Hosting:

This is a place for exploring aspects of implementing applications using the REST architectural style. This may include statements about existing frameworks and libraries, general discussions about the nature of the style and how it may be expressed and/or encouraged via a programming framework, etc.

Featured ContentVideo and Audio ResourcesNEWREST Litmus Test for Web FrameworksDocumenting REST-ful ApplicationsThe Key AbstractionA RESTful SystemRichardson Maturity ModelFielding's REST API RulesREST Development PrinciplesWe've started a list of available REST Frameworks
'via Blog this'

Code::Blocks IDE


An open source IDE i started playing with today. Its fast, beautiful (neat syntax highlighting) and the best thing i liked so far is the code completion unlike i had ever seen before for C/C++ IDE. It also claims to be pretty fast in doing builds and debugging.

'via Blog this'

Best Practices for Speeding Up Your Web Site

Make Yahoo! Web Service REST Calls - YDN

RESTful API Design

Excerpted from:

Source: All response codes are included in the HTTP Status response header. Possible status codes include:
·200: Success (upon a successful GET, PUT, or DELETE request)
·201: Created (upon a successful POST request)
·400: Resource Invalid (improperly formatted request)
·401: Unauthorized (incorrect or missing authentication credentials)
·404: Resource Not Found
·405: Method Not Allowed (in case some HTTP method of GET/POST/PUT/DELETE is not supported for a given URI).
·406: Not Acceptable

·500: Application Error

SPDY Protocol - Road to HTTP/2.0

Its been 13 years since HTTP/1.1 version came into being (in 1999) and has wonderfully managed to keep up with the pace of development and growth in web usage and technologies.

SPDY Protocol (by Google) proposes to enhance HTTP 1.1 by bringing to the table these new core concepts to web delivery:

Multiplexing (allowing multiple requests to flow over a single connection)Prioritization (providing the ability to indicate that one resource is more important than another and should hence jump to the head of the line)Compression (making compression universal and extending it to headers)Server Push (allowing the server to give content to a user-agent before it is asked for)A strong recommendation for encryption (current implementations require it) - dropped from HTTP/2.0
IETF started HTTP/2.0 standards effort based on the proposals from SPDY protocol (as starting point). If everything goes well and according to the working group's stated goals, HTTP/2.0 will be faster, safer, and use fewer…

Understanding REST

The following is excerpted from:
What is REST?
REST stands for Representational State Transfer. It relies on a stateless, client-server, cacheable communications protocol -- mostly, the HTTP protocol is used. REST is an architecture style for designing networked applications. The idea is that, rather than using complex mechanisms such as CORBA, RPC or SOAP to connect between machines, simple HTTP is used to make calls between machines. REST uses HTTP for all four CRUD (Create/Read/Update/Delete) operations. Thus, REST is a lightweight alternative to mechanisms like RPC (Remote Procedure Calls) and Web Services (SOAP, WSDL, et al.).

The notion of REST was created in the PhD dissertation of Roy T. Fielding.

REST architecture has all the benefits of Web Service:
Platform-independent (you don't care if the server is Unix, the client is a Mac, or anything else),Language-independent (C# can talk to Java, etc.),Standards-based (runs on top of HTTP), andCan ea…