Posts

Showing posts from 2014

Eclipse

Dynamic Web Project Make sure the files listed under are under webContent folder. When you publish the content to any embeded server, it only publishes content from webContent folder. So any resource under the top level project folder, but not under webContent folder will not be published to the server. If you are using web.xml web-app descriptor 2.5, then use Tomcat 6.x/ java ee 1.6 combination because Tomcat 5.x/java ee 1.5 combination may not work with it. This is what I have seen. Running Unit Tests inside Eclipse At times I have seen different results based on how you run the unit test. This may simply be the configuration issue. So If I am in the unit test class , right mouse click and do Run As =>Junit  Test, it runs fine. If I select the file from left navigation inside Package Explorer and click Run from top  "Run" menu, I see the result is different and at times tests fail.  Now If go and run the same test using maven command line, it is most stric...

NoSQL

NoSQL Data Stores MongoDB ( C++) - document database CouchDB - document database(key/value ) Cassandra - Column based , no single point of failure(Dynamo Architecture), Data modeling is based on Google Big Table. Hbase ( Java )  - Google BigTable based architecture, Column Oriented distributed database on top of HDFS ( non distributed version works on local filesystem also , but distributed is only supported on HDFS).  See  cassandra-vs-hbase  for differences between Cassandra vs. Hbase.  High availability(No single point of failure-almost 100% uptime) , high number of reads/writes and if read/write consistency is not big issue Cassandra is wins. If Read/Write consistency is important and also if you need to query(read) large amount of data and extract small amount of result out of it Hbase wins.  Cassandra includes data storage and management both while Hbase is only for data management. For most of other activities, it relies on external services l...

Git / BitBucket / SourceTree

 Reverting Commits --------------------- I am new to git but had to do some branching and merging etc. recently.   SourceTree as a git client works quite well. A few things though, at times the changes in repository don't reflect immediately in the SourceTree UI.  Let us say there is a commit from other team member, you may not see it in UI right away but when you do pull from UI, the window which pops up, does show all the changes in remote branches. There is a very good article for git starters. http://git-scm.com/book/en/v2/Git-Branching-Basc-Branching-and-Merging In source tree, you can open the command window by Actions->Open In Terminal.  It will open the Git shell for the selected project. There you can directly execute any command. I had a situation where I had to revert few commits into one branch. One of the commit was a merge from another branch also. A----AC1---C2(Merge from A)-----------AC3 B----BC1----(Merge into A)---------------...

OSGI

OSGI (Open Services Gateway Initiative)  specs define how modular systems can be built using Java, in which each modules can deployed, started , stopped and removed dynamically. Java 8 compact profiles potentially could have been implemented using OSGi.

oAuth , OpenID, OpenID Connect, SAML

oAuth : Open Authorization  Framework  It allows you to delegate access/authorization  to third parties without sharing credentials. Third parties can access the resources on your behalf.  oAuth framework evolved over time.  First oAuth 1.0 came up. It used HTTP ( not HTTPS )  but encrypted the sensitive information at the endpoints.  This made the implementation bit difficult and cumbersome.  oAuth 2.0   is very different than 1.0 and it addressed some of the challenges of 1.0/1.1.  It removed the need for encryption at the endpoints but it requires HTTPS, which is widely available.  It made the implementation faster and easier. It also came up with multiple flows ( auth code, implicit, resource owner credential, client credential, refresh token )  for different scenarios.  Here is link to  oAuth 2.0 flows OpenID is open standard for authentication , promoted by OpenID foundation.  It allows replying partie...

Ajax and 302

Did  you ever wonder what happens if use request a resource via Ajax ( XmlHttpRequest or ActivexObject) for which server sends back 302 ( browser redirect ) ?  Does the xmlhttp.status==302 below will ever be true ? --------------------------------- function test302() { var xmlhttp; if (window.XMLHttpRequest)   {   xmlhttp=new XMLHttpRequest();   } else   {   xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");   } xmlhttp.onreadystatechange=function()   {   if (xmlhttp.readyState==4 && xmlhttp.status==302)     {     document.getElementById("myDiv").innerHTML="resource moved."     }   } xmlhttp.open("GET","URL",true); xmlhttp.send(); } ------------------------ The answer is NO. Because browser handles it and never passes it to JavaScript.

Java Keystore, Certificates, Private Keys, Tomcat SSL

I was trying to setup Single Sign On using CAS and I had to deal with creating self signed certificate and configure Tomcat to use it. A few things I learned are following: 1. Tomcat SSL Connector can be configured in two way; JSSE or APR. JSSE uses native libraries and need different connector attributes to be configured.  APR stands for Advanced Portable Runtime. It requires additional libraries to be installed but provides more performance and flexibility.  For normal demo scenario, one may be good with JSSE connector configuration. 2.  To configure JSSE Tomcat SSL connector , you need a keystore. Assuming you are using self signed cert, use following command line. keytool -genkey  -alias ss   -keyalg RSA -keypass pwd  -storepass pwd -keystore  storefilepath This will prompt for first name , last name and organizational information.  Make sure you enter right value for the very first question "first and last name". This becomes CN ...

JAR file contents

Getting contents of all the jar files under a directory on windows:  for /f  %v in ('dir /s /b jboss*.jar')  do jar tvf %v