Friday, July 16, 2010

Sweet Java Reminders

Sometimes, the mind turns again to hacking. This time it was hacking a little application to download the whole tree from a Subversion location exposed through an Apache Web Server.

I had to resort to this method, as they (at the svn end) at somehow disabled PROPFIND request. So I couldn't download the whole thing using my Subclipse installation in Eclipse. Earlier I could do it by switching from JavaHL (Native JNI) to SvnKit (Pure Java). Now I was denied this also.

So to get back to hacking, I had to write code which will go over the Internet and do the retrieval stuff. As it happens, I again forgot which are parameters related to proxy servers that need to be set. Moreover this time I had to deal with HTTP Password challenge also.

So this post is meant to be a reminder to me and a point to come back to when in need.

1) How to set proxy paramters?

We can do it on the command line, in the code, from a GUI etc. Whatever the method following four system propeties need to be set
a) http.proxyHost
b) http.proxyPort
c) http.proxyUser
d) http.proxyPassword

2) How to answer HTTP challenge
Quite easy. Two ways that I tried.
a) In the URL itself, embed the credentials as follows
"http://user:password@www.some-server.com"
b) Before opening the connection, execute the following
Authenticator.setDefault(new Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(
"", "".toCharArray());
}
});

Other ways include using third party libraries, like this one from Apache.

* I promise myself to learn usage of code formatting in blog posts and update these entries.

Catch you later.

Monday, July 12, 2010

New word that I learned [elided]

v. elided

It is a transitive verb, that means to leave or strike out. Also, from m-w.com, elide is to suppress or alter (as a vowel or syllable) by elision.

Example from wordweb desktop dictionary: This vowel is usually elided before a single consonant

Click here & here & here to learn more.

And lastly, I encountered this word while reading the good book 'Apache Struts 2 Web Application Development' by Packt Publishing. Will blog about it, once I am done with it.

The secret in their eyes

I came across a photograph. It was a close up. It had a girl and a cat looking intensely in the camera and following sprang in my mind

Their gaze so intense
Catches all pretense
It seems to say
Not comfy: look the other way


And I give these lines the title 'The secret in their eyes'

Saturday, July 10, 2010

Far Away

Far away



Far away
Do not sway
It is but a glimmer
Not before long it will shimmer
Just keep on tight
you WILL see light

What is Leadership?

Ok I got another idea about a blogging topic and here goes...

What is Leadership?
Why does this concept look like as if it is shrouded in mystery, behind some thick fog?

Is it that is too hard because it requires great skill? Or is it because the art of leadership is really a mystery?

Let us consider some feedback from those who are NOT leaders:
- I don't understand how to go about it.
- I probably don't have guts to do it.
- I have acute stage-fright.
- Its a messy Job.
- I don't have time for this, I have tons of things to do.
- etc.

And what we can make out from the above list?
The Following:
- 'I' is somehow the keyword
- Leadership seems messy. Maybe it is, after all leader has to guide many.
- Fear of doing new prevails. In other words possibly idiotic/awkward/ridiculous things do not seem worthwhile to try
- Narrow mind-set. Typically like basement programmer; give him chips, pizza, and problem statement; he is good to go.

Now I am not a guru myself. I am myself trying to understand Leadership and possibly realize those traits in me. I have been reading 'A Passion for Excellence: The Leadership Difference' by Tom Peters & Nancy Austin. The book is a little old but full of nuggets. Its a collection of stories that move you, smack you into thinking with right perspective.

And luckily today I got hold a video that tells (rather demonstrates) the key aspects of Leadership. Click here to watch the video on the youtube. Alternately you can visit this blog, where I originally found it.

I will conclude this post by mentioning traits of a Leader as I have learned
  1. A leader is not afraid of doing something new. Because it has never been done before, it is more a spur, to do it even more.
  2. A leader does not act like a boss.
  3. A leader treats everyone like a leader; consequently nurturing the thought in others that they are also veritable leaders in the making.
  4. A leader does enough coaching/educating/sponsoring/confrontation and leaves it to the person to do his/her thing. A leader always trusts others
  5. A leader is a public person
The one BIG thing about leadership is that actually it's easy to do. It is as easy as going out in the open and start singing/dancing/talking. And because it's so easy, not many attempt it. They think it is ridiculous and not so important. They stay away and do their own seemingly important stuff in their own little shell.

So share your insights on Leadership. And yes, the video is sure an eye opener.

Todays' Learnings on Struts2 (2.1.8.1)

I continued with my experimentation with Struts 2.1.8.1 and these are some of todays findings:

  1. All the struts library files (i.e. jar files) need to be together, otherwise they don't work. Put them all in either /WEB-INF/lib or /lib. This observation is at least true for tiles plugin.
  2. If in struts.xml there is a '.' in the name of an action, then all url's must have '.action' appended. Otherwise they don't work. If there is no '.' in the name of an action, then struts applies the default '.action' itself and is able to find the mapping.
  3. If you are using property files for i18n, and there are misspelled or missing entries, the key specified in the JSP file will show. For e.g., for if label.username cannot be found in the properties file, then 'label.username' itself will be used for display. So I guess the lesson here is that, key names should be meaningful to be able find them quickly for modifications, if necessary.