Java: Sample Active Directory authentication code

Here is a sample Java code to authenticate against Windows Active Directory server.

  • The code finds all available active directory servers in your network.
  • It uses one of the available active directory server for authentication.
  • If an active directory server is down then it starts using next available server if any.
  • This class is thread-safe, you can create one instance and re-use them multiple times.
  • I tested this code from Linux and Windows box.

You can find the below source code in GitHub as well.
ActiveDirectoryAuthentication.java
Read more of this post

Some statistics on programming language

Some interesting statistics on open source programming language based on TIOBE Programming Community Index.

Programming Language First
Released
Ratings
Oct 2013
C

1972

17.25%

Java

1995

16.11%

C++

1980

8.66%

PHP

1995

6.09%

Python

1991

3.11%

JavaScript

1995

2.04%

Perl

1987

1.61%

Ruby

1993

1.25%

Groovy

2003

0.66%

Scala

2003

0.35%

Haskell

1990

0.25%

Source:

http://www.tiobe.com/tpci.htm

http://en.wikipedia.org/wiki/History_of_programming_languages

Alternative to JPA / Hibernate

Ours is a legacy application, we are migrating from desktop to JavaEE web based application. Since it is desktop application database triggers, functions and procedures are heavy used to do lots important functionality. Some of our team members were proposing JPA to move trigger, function and procedure logic to Java layer but many of us (including me) felt is too risky for our business, time to market and lots of data needs to be migrated.

I started looking for a simple alternative framework for JPA which can help us to retain database objects at the same time simplify our Java code like JPA . Here are my findings Read more of this post

There is no language yet available to replace Java!

There is a perception created in the software development industry that Java is out-dated and Ruby, Python, Scala, etc. are going to take over Java’s position. Some “hyper-enthusiasts” are already left Java platform. Sun’s profit model collapse, Applet, Jini, EJB and JSF heavyweight framework failures added fuel to these campaigns. I still believe no language yet available in the market to replace Java. I don’t have to talk why Java is better because it is proven solution for more than a decade but I would like to talk about how false campaigns are created by “hyper-enthusiasts”. It is easy to fall into these false campaigns because as a developer we want new challenges and something new to learn. Read more of this post

Wicket in OC4J / OracleAS

Recently I tried deploying wicket framework based web application in OC4J container it didn’t work, whereas the same code works well in Tomcat. While googling found a few solution which recommends to use wicket servlet configuration instead of servlet filter to resolve the issue. I did the same but no luck. Then I tried associating a bookmarkable page for the homepage then it works well. Here is the code snippet: Read more of this post

Single-Sign-On (SSO) in Java Platform using Active Directory

Sorry guys it been long time writing in my blog.

Nowadays single-sign-on became a hot selling feature for all desktop and web-based products. In this article I talk about single-sign-on implementation in Java platform with Active Directory server. Since Microsoft Windows has become one of the most common corporate network platforms it is worth integrating with your product. Starting from Windows 2000 Microsoft supports Kerberos protocol. It is unusal that Microsoft support open-standard protocol, but they do in this case; good for us :-) Read more of this post

JEXL – A simple expression evaluation engine

When I was developing a framework looking for a solution very similar to eval() function in JavaScript. Initially I thought of Velocity but somehow I wasn’t convinced with that approach. (Struts2 uses Velocity to externalize the HTML generation to make it customizable). Later I wrote my own parser to evaluate an expression that returns a Boolean value. Recently I found an open source which exactly meets my requirement. I don’t have to talk much about this open source you can find lot more information in their website. I thought it might be useful to others as well.
Reference: http://commons.apache.org/jexl/

Pure Java Print PDF Open Source API

PDF became widely used file format to exchange documents. There are a quite a few open source API available to create PDF document from Java application. Almost there is no good open source API available to view and print the PDF content from Java application. Fortunately sun released a open source API to fill this gap. Read more of this post