Tuesday, March 27, 2012

WebSphere Application Server: Component vs Container Managed Authentication Alias

When defining the usage of an authentication alias in a resource in the administration console of WebSphere Application Server, there are two places the data can be specified:
  1. Component Managed Authentication
  2. Container Managed Authentication
Component Managed Authentication is used when the resource configured in the EJB’s deployment descriptor res-auth property is set to ‘Application’.
Container Managed Authentication is used when the resource configured in the EJB’s deployment descriptor res-auth property is set to ‘Container’.

http://blog.danzrobok.com/2008/10/09/websphere-application-server-component-vs-container-managed-authentication-alias/

Sunday, March 25, 2012

Eclipse PDT - Failed to load JavaHL Library

Following an update to subclipse, I got that error on Ubuntu 9.10. In order to fix it, i had to adjust the path in the config.ini file.
First, locate your libsvjavahl-1 library :
sudo updatedb
locate libsvnjavahl-1
Mine was under /usr/local/lib
Then edit the path in the config.ini. You have to pass the libsvnjavahl-1 path to the JVM.
Locate eclipse.ini and edit the path and add, UNDER the line : -vmargs
-Djava.library.path=/usr/local/lib 
 
http://superuser.com/questions/111748/eclipse-pdt-failed-to-load-javahl-library 

Robert Hanson's Tech Log: Testing Servlets with JUnit

Robert Hanson's Tech Log: Testing Servlets with JUnit

Monday, March 19, 2012

Difference between HashMap, LinkedHashMap and SortedMap in java

All three classes implement the Map interface and offer mostly the same functionality. The most important difference is the order in which iteration through the entries will happen:
  • HashMap makes absolutely not guarantees about the iteration order. It can (and will) even change completely when new elements are added.
  • TreeMap will iterate according to the "natural ordering" of the keys according to their compareTo() method (or an externally supplied Comparator). Additionally, it implements the SortedMap interface, which contains methods that depend on this sort order.
  • LinkedHashMap will iterate in the order in which the entries were put into the map
"Hashtable" is the generic name for hash-based maps. In the context of the Java API, Hashtable is an obsolete class from the days of Java 1.1 before the collections framework existed. It should not be used anymore, because its API is cluttered with obsolete methods that duplicate functionality, and its methods are synchronized (which can decrease performance and is generally useless).

http://stackoverflow.com/questions/2889777/difference-between-hashmap-linkedhashmap-and-sortedmap-in-java

Wednesday, March 14, 2012

Database indexing - how does it work?

Database products (RDMS) such as Oracle, MySQL builds their own indexing system, they give some control to the database administrators however nobody exactly knows what happens on the background except people makes research in that area, so why indexing :
Put simply, database indexes help speed up retrieval of data. The other great benefit of indexes is that your server doesn't have to work as hard to get the data. They are much the same as book indexes, providing the database with quick jump points on where to find the full reference (or to find the database row).
There are many indexing techiques for example :
  • Primary indexing, secondary indexing
  • B-trees and variants (B+-trees,B*-trees)
  • Hashing and variants (linear hashing, spiral etc.)
for example, just think that you have a database with the primary keys are sorted (simply) and these all data is stored in blocks (in hdd) so everytime you want to access the data you don't want to increase the access time (sometimes called transaction time or i/o time) the indexing helps you which data is stored in which block by using these primary keys. Alice (primary key is names, not good example but just give an idea)
Alice...
...
AZ...
Bob
Bri...
Bza...
Now you have an index in this index you only store Alice and Bob and the blocks they point, with this way users can access the data faster.The RDMS deals with the details.
I don't give the details but if you want to delve these topics, i offer you take an Database course or look at this popular book which is taught most of the universities.

Monday, March 12, 2012

new problem with ORA-01843: not a valid month

gee, nevermind, guys... fixed it... I replaced the to_timestamp() 's with to_date(date_value,date_format) 's and now it works Still not sure why the timestamp didn't work... anywayz used 'dd/mm/yyyy hh24:mi:ss' hope it helps somebody else! thanx for anybody who read all this (ouch!)

 http://arjudba.blogspot.com/2008/06/ora-01843-not-valid-month.html

Wednesday, March 7, 2012

Callback Methods

Callbacks methods are the way of managing life cycle of an instance. Callback methods are generally used by containers. The methods are called at specific time during the lifetime of an instance. For example in servlet destroy() method is called by the servlet container that indicates that the servlet is being taken out of service. This type of methods are generally called by the container, the developer does not need to call these methods explicitly. Most of the languages specifies the callback method by passing the address of the subroutine to the system to the request is calling back from, But java performs the same thing by using interfaces. Java does not allow passing the address of subroutine but allows passing an instance of a class that implements the standard interface. For this purpose anonymous classes are mainly used as they support a better compact definition of the class that is required as a new class.

One more example of callback methods is ejbCreate method that is used by an ejb container to create a ejb bean - the developer does not call it explicitly in code- the container calls it- although the developer can override it- or put stuff in it...

Callback methods have totally different meaning regarding the context of security. In order to login securely call the server which then calls us back. This makes it harder for you to spoof being someone else. This may be done over phone lines or over the Internet. It is the same scheme a jealous husband might use to ensure his wife is really home as she claims.

http://www.roseindia.net/help/java/c/callback-methods.shtml