Simple Java AD/LDAP Authenticaion Code

January 20, 2012 Leave a comment

There are so much of code and reference available for AD/LDAP integration in Java. I also searched a lot and the below code worked for me.
As a non-java developer I found so interesting while working on some complex java stuff.

 

import java.util.*;
import javax.naming.*;
import javax.naming.directory.*;
public class ADTestNew {
    public static void main(String[] args) {
    try {
        Hashtable env = new Hashtable();

        env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory");

        env.put(Context.PROVIDER_URL,"ldap://192.168.100.225:389"); //replace with your server URL/IP

        // This line is optional based on environment. You can try with comment or without comment also.
        env.put(Context.SECURITY_AUTHENTICATION,"DIGEST-MD5"); //No other SALS worked with me

        env.put(Context.SECURITY_PRINCIPAL,"login"); // the user name.

        env.put(Context.SECURITY_CREDENTIALS, "Passw0rD"); //the password.

        DirContext ctx = new InitialDirContext(env);

        ctx.close();

    } catch(NamingException ne) {
        System.out.println("Error authenticating user:");
        System.out.println(ne.getMessage());
        return;
    }
    //if no exception, the user is already authenticated.
    System.out.println("OK, successfully authenticating user");
    }
}

Happy Java.

2011 in review

January 1, 2012 Leave a comment

The WordPress.com stats helper monkeys prepared a 2011 annual report for this blog.

Here’s an excerpt:

Madison Square Garden can seat 20,000 people for a concert. This blog was viewed about 61,000 times in 2011. If it were a concert at Madison Square Garden, it would take about 3 sold-out performances for that many people to see it.

Click here to see the complete report.

Categories: General, me Tags: , ,

How to enable Apache mod_rewrite in openSUSE

December 26, 2011 Leave a comment

I got a situation where my Apache mod_rewrite module was not enabled for my openSUSE machine.
Here is the simple way to do it.

First check which apache modules are enabled in your machine.

ankur@ankur:/srv/www/htdocs> grep "^APACHE_MODULES" /etc/sysconfig/apache2
APACHE_MODULES="actions alias auth_basic authn_file authz_host authz_groupfile authz_default authz_user autoindex cgi dir env expires include log_config mime negotiation setenvif ssl userdir php5"

Second Change the apache2 config for modules and restart your apache.

ankur@ankur:/srv/www/htdocs> sudo vi /etc/sysconfig/apache2
ankur@ankur:/srv/www/htdocs> sudo /etc/init.d/apache2 restart
Syntax OK
Shutting down httpd2 (waiting for all children to terminate) done
Starting httpd2 (prefork) done

Finally, chech you module is installed.

ankur@ankur:/srv/www/htdocs> grep "^APACHE_MODULES" /etc/sysconfig/apache2
APACHE_MODULES="actions alias auth_basic authn_file authz_host authz_groupfile authz_default authz_user autoindex cgi dir env expires include log_config mime negotiation setenvif ssl userdir php5 rewrite"

huh!! Its working.

Happy Apache.

Hindu Rituals and Routines on daily basis.

December 23, 2011 Leave a comment

Hindu Rituals and Routines.

Hindu Rituals and Routines.pdf

Categories: General

What is Vision

December 20, 2011 Leave a comment

Vision

The only way to discover the limits of the possible is to go beyond them into the limits of the impossible.

From my desk calender.

Categories: General

Achyutam Keshavam (अच्युतम केशवं ) Hindi Lyrics

November 29, 2011 3 comments

अच्युतम केशवं कृष्ण दामोदरं, राम नारायणं जानकी वल्लभं || -2

कौन कहता है भगवान आते नहीं, तुम मीरा के जैसे बुलाते नहीं |
अच्युतम केशवं कृष्ण दामोदरं, राम नारायणं जानकी वल्लभं ||

कौन कहता है भगवान खाते नहीं, बेर शबरी के जैसे खिलते नहीं |
अच्युतम केशवं कृष्ण दामोदरं, राम नारायणं जानकी वल्लभं ||

कौन कहता है भगवान सोते नहीं, माँ यशोदा के जैसे सुलाते नहीं |
अच्युतम केशवं कृष्ण दामोदरं, राम नारायणं जानकी वल्लभं ||

कौन कहता है भगवान नाचते नहीं, तुम गोपी के जैसे नचाते नहीं |
अच्युतम केशवं कृष्ण दामोदरं, राम नारायणं जानकी वल्लभं ||

कौन कहता है भगवान नचाते नहीं, गोपियों की तरह तुम नाचते नहीं |
अच्युतम केशवं कृष्ण दामोदरं, राम नारायणं जानकी वल्लभं ||

अच्युतम केशवं कृष्ण दामोदरं, राम नारायणं जानकी वल्लभं ||

Shiv Tandav Stotra in Sanskrit-Hindi Lyrics with easy readble format

November 27, 2011 Leave a comment

||सार्थशिवताण्डवस्तोत्रम् ||

||श्रीगणेशाय नमः ||

जटा टवी गलज्जल प्रवाह पावितस्थले, गलेऽवलम्ब्य लम्बितां भुजङ्ग तुङ्ग मालिकाम् |
डमड्डमड्डमड्डमन्निनाद वड्डमर्वयं, चकार चण्डताण्डवं तनोतु नः शिवः शिवम् ||१||

जटा कटा हसंभ्रम भ्रमन्निलिम्प निर्झरी, विलो लवी चिवल्लरी विराजमान मूर्धनि |
धगद् धगद् धगज्ज्वलल् ललाट पट्ट पावके किशोर चन्द्र शेखरे रतिः प्रतिक्षणं मम ||२||

धरा धरेन्द्र नंदिनी विलास बन्धु बन्धुरस् फुरद् दिगन्त सन्तति प्रमोद मानमानसे |
कृपा कटाक्ष धोरणी निरुद्ध दुर्धरापदि क्वचिद् दिगम्बरे मनो विनोदमेतु वस्तुनि ||३||

लता भुजङ्ग पिङ्गलस् फुरत्फणा मणिप्रभा कदम्ब कुङ्कुमद्रवप् रलिप्तदिग्व धूमुखे |
मदान्ध सिन्धुरस् फुरत् त्वगुत्तरीयमे दुरे मनो विनोद मद्भुतं बिभर्तु भूतभर्तरि ||४||

सहस्र लोचनप्रभृत्य शेष लेखशेखर प्रसून धूलिधोरणी विधूस राङ्घ्रि पीठभूः |
भुजङ्ग राजमालया निबद्ध जाटजूटक श्रियै चिराय जायतां चकोर बन्धुशेखरः ||५||

ललाट चत्वरज्वलद् धनञ्जयस्फुलिङ्गभा निपीत पञ्चसायकं नमन्निलिम्प नायकम् |
सुधा मयूखले खया विराजमानशेखरं महाकपालिसम्पदे शिरोज टालमस्तु नः ||६||

कराल भाल पट्टिका धगद् धगद् धगज्ज्वल द्धनञ्जयाहुती कृतप्रचण्ड पञ्चसायके |
धरा धरेन्द्र नन्दिनी कुचाग्र चित्रपत्रक प्रकल्प नैक शिल्पिनि त्रिलोचने रतिर्मम |||७||

नवीन मेघ मण्डली निरुद् धदुर् धरस्फुरत्- कुहू निशीथि नीतमः प्रबन्ध बद्ध कन्धरः |
निलिम्प निर्झरी धरस् तनोतु कृत्ति सिन्धुरः कला निधान बन्धुरः श्रियं जगद् धुरंधरः ||८||

प्रफुल्ल नीलपङ्कज प्रपञ्च कालिम प्रभा- वलम्बि कण्ठकन्दली रुचिप्रबद्ध कन्धरम् |
स्मरच्छिदं पुरच्छिदं भवच्छिदं मखच्छिदं गजच्छि दांध कच्छिदं तमंत कच्छिदं भजे ||९||

अखर्व सर्व मङ्गला कला कदंब मञ्जरी रस प्रवाह माधुरी विजृंभणा मधुव्रतम् |
स्मरान्तकं पुरान्तकं भवान्तकं मखान्तकं गजान्त कान्ध कान्त कं तमन्त कान्त कं भजे ||१०||

जयत् वदभ्र विभ्रम भ्रमद् भुजङ्ग मश्वस – द्विनिर्ग मत् क्रमस्फुरत् कराल भाल हव्यवाट् |
धिमिद्धिमिद्धिमिध्वनन्मृदङ्गतुङ्गमङ्गल ध्वनिक्रमप्रवर्तित प्रचण्डताण्डवः शिवः ||११||

स्पृषद्विचित्रतल्पयोर्भुजङ्गमौक्तिकस्रजोर्- – गरिष्ठरत्नलोष्ठयोः सुहृद्विपक्षपक्षयोः |
तृष्णारविन्दचक्षुषोः प्रजामहीमहेन्द्रयोः समप्रवृत्तिकः ( समं प्रवर्तयन्मनः) कदा सदाशिवं भजे ||१२||

कदा निलिम्पनिर्झरीनिकुञ्जकोटरे वसन् विमुक्तदुर्मतिः सदा शिरः स्थमञ्जलिं वहन् |
विमुक्तलोललोचनो ललामभाललग्नकः शिवेति मंत्रमुच्चरन् कदा सुखी भवाम्यहम् ||१३||

इदम् हि नित्यमेवमुक्तमुत्तमोत्तमं स्तवं पठन्स्मरन्ब्रुवन्नरो विशुद्धिमेतिसंततम् |
हरे गुरौ सुभक्तिमाशु याति नान्यथा गतिं विमोहनं हि देहिनां सुशङ्करस्य चिंतनम् ||१४||

पूजा वसान समये दशवक्त्र गीतं यः शंभु पूजन परं पठति प्रदोषे |
तस्य स्थिरां रथगजेन्द्र तुरङ्ग युक्तां लक्ष्मीं सदैव सुमुखिं प्रददाति शंभुः ||१५||

इति श्रीरावण- कृतम् शिव- ताण्डव- स्तोत्रम् सम्पूर्णम्

Quote

November 17, 2011 Leave a comment

दुखो से भरी इस दुनिया मैं वास्तविकता संपाती धन नहीं, संतुष्टता है।

Categories: General

Aarti Kunj Bihari Ki : Hindi Lyrics : Lord Krishana Bhajan

October 18, 2011 Leave a comment

From so many days I was searching for Lyrics on this bhajan “Aarti Kunj Bihari Ki, Shree Giridhar Krishna Murari Ki”.
Here is the hindi Lyrics for this hindi bhajan.

Bol Krishan Kanhiyaa Lal Ki Jai.

आरती कुंजबिहारी की, श्री गिरिधर कृष्ण मुरारी की ॥

गले में बैजंती माला, बजावै मुरली मधुर बाला ।
श्रवण में कुण्डल झलकाला, नंद के आनंद नंदलाला ।
गगन सम अंग कांति काली, राधिका चमक रही आली ।
लतन में ठाढ़े बनमाली |
भ्रमर सी अलक | (Fast)
कस्तूरी तिलक | (Fast)
चंद्र सी झलक | (Fast)
ललित छवि श्यामा प्यारी की ॥
श्री गिरिधर कृष्ण मुरारी की…

कनकमय मोर मुकुट बिलसै, देवता दरसन को तरसैं ।
गगन सों सुमन रासि बरसै;
बजे मुरचंग | (Fast)
मधुर मिरदंग | (Fast)
ग्वालिन संग | (Fast)
अतुल रति गोप कुमारी की ॥
श्री गिरिधर कृष्णमुरारी की…

जहां ते प्रकट भई गंगा, कलुष कलि हारिणि श्रीगंगा ।
स्मरन ते होत मोह भंगा;
बसी सिव सीस | (Fast)
जटा के बीच | (Fast)
हरै अघ कीच | (Fast)
चरन छवि श्रीबनवारी की ॥
श्री गिरिधर कृष्णमुरारी की…

चमकती उज्ज्वल तट रेनू, बज रही वृंदावन बेनू ।
चहुं दिसि गोपि ग्वाल धेनू;
हंसत मृदु मंद | (Fast)
चांदनी चंद | (Fast)
कटत भव फंद | (Fast)
टेर सुन दीन भिखारी की ॥
श्री गिरिधर कृष्णमुरारी की…

आरती कुंजबिहारी की, श्री गिरिधर कृष्ण मुरारी की ॥
आरती कुंजबिहारी की, श्री गिरिधर कृष्ण मुरारी की ॥

What is inspiration

September 6, 2011 Leave a comment

Many people have gone further than they imagined they could because somebody else thought they could.

From my Desktop Calender.

Categories: General

Customer Cycle for a company

August 8, 2011 Leave a comment

Customer Cycle for a company.

  1. Customer Acquisition
  2. Customer Feedback
  3. Customer Transition.
  4. Customer Gratification.
  5. Customer Retention.

Happy Customer.

Categories: General

what is Destiny

August 4, 2011 Leave a comment

Destiny is not a matter of chance,
It is a matter of choice.

It is not a thing to be waited for,
it is a thing to be achieved.

From my Desktop Calender.

Categories: General

what is confidence ?

July 5, 2011 Leave a comment

Confidence
It’s not who you are that holds you back,
it’s who you think you are.

From my desktop calendar.

Categories: General

Get time in millisecond in groovy

July 4, 2011 Leave a comment

I found there are 2 ways to get time in millisecond

 def m1 = System.currentTimeMillis()
 println m1

def m2 = new Date()
 println m2.getTime()
 

Neral – Matheran Mountain Railway

May 22, 2011 2 comments

I like rail-fanning though I am not giving too much time on my this hidden activity. But one day I will be active rail-fanning guy.
Want to know all about train and trains. Even though today also its like daily adventure traveling via train in mumbai.

So we have decided to visit Matheran via Neral-Matheran Mountain Railways.
The train timings are very convenient. There are very few routes in India where toy trains are running. You can see http://www.trainenquiry.com/StaticContent/Special_Hills.aspx like for more detail.

In season time and on weekends the trains are running full, so you make sure you book train tickets well in time. You can book tickets via IRCTC website. So we did the same we have already booked the tickets. :)

Nerail is situated in Mumbai – Pune rail road. From Neral we can catch Matheran Train which takes 90 minutes average.

Neral-Matheran Train Time Table.

Neral - Matheran Train Time Table

Neral Railway Station

Nerail Junction, Maharashtra

Matheran Railway Station

Neral-Matheran Railway Engine

Matheran Railway Station

Matheran Railway Station

Matheran Railway Station

A View of narrow gauge, it looks very less space between two tracks and put us into confusion that how a train run on such a narrow space.
At Matheran Railway Station

Neral – Matheran Train traveling is all about fun, curves, hight, slow speed, toy train, stops, views and panoramas.

I clicked some of the train engines.
Neral-Matheran Railway Engine

Neral-Matheran Railway Engine

Neral - Matheran Railway Engine

Neral - Matheran Railway Engine

Neral - Matheran Railway Engine

Neral-Matheran Train Engine

One by one every single engine is looking great and perfect. These trains are also used as passing goods to matheran city.
I clicked the insides engines photos also.. every other engines has its own gears and views…

Neral – Matheran Rail Engine Inside Views

Neral-Matheran Railway Engine

Neral - Matheran Railway Engine - Inside

The full track is covered as curves. Multiple curves in the routes.

Curves at Neral – Matheran route

Matheran Railway Track

Matheran Railway Track

And how about passing from tunnel – A fantastic view.
Neral-Matheran Railway Engine in Tunnel

It feels good when toy train stops at between station and you enjoy a sip of tea.
Matheran Mountain Toy Train

Matheran Mountain Toy Train

Train also passes the road multiple times, all the time human barriers are available for others.
Matheran Mountain Toy Train

It again feel fantastic when train give full throttle and full whistle and it gives WOW experience.

Matheran Mountain Toy Train

Matheran Mountain Toy Train

It was really memorable journey. It begins here.
Matheran Railway Station

Old Style Railway Signal on the way to Matheran-Neral

Happy Traveling.

Follow

Get every new post delivered to your Inbox.