26 May 2013

Bringing Html Elements Into Single Line

Sometimes HTML elements even though we have not applied breaks they move into separate lines so if we have to bring them into a single line the following is the code:-

The following brings 3 div's into a single line:-

<div>
<div style="display:inline-block"> happy home</div>
<div style="display:inline-block"> singapoore</div>
<div style="display:inline-block"> India </div>
</div>

Output of the above code:-

happy home 
singapoore 
India


24 May 2013

Placing DIV's side by side without effecting the container DIV's height

I find the following as the best solution for such requirement.


<div style="border:2px solid red; overflow: hidden;">
       <div style="width:100px;height:100px;border:2px solid yellow;float:left;"></div>
       <div style="width:100px;height:150px;border:2px solid black;float:left">   </div>
       <div style="width:100px;height:100px;border:2px solid black;float:left">   </div>
 </div>

Actually "float" property when applied to child it erases the parent default properties. When "overflow:hidden" is placed in the parent element the default behavior will be restored.

23 May 2013

What is IRC?

The expansion of IRC is "Internet Relay Chat". It is a protocol built for chatting. It is mainly designed for group communications in discussion forums which are called as channels. This protocol was created by  "Jarkko Oikarinen" in  August 1988. IRC is a open protocol that uses TCP, optionally TLS. An IRC server can connect to other IRC servers to expand the IRC network. Users can connect to IRC servers using IRC clients.

14 May 2013

How To Create A SSL ServerSocket On Android

On Android to create a Successful SSL Server Socket First you need to create a keystore using "keytool" that comes with jdk. We need to run this tool with the option of  "storetype BKS". BKS stands for Bouncy Castle. Androids default keystore type is BKS. But the jdk that comes from oracle site does not have this security provider. So first we need to download the jar which has this provider files. This can be downloaded from  http://repo2.maven.org/maven2/org/bouncycastle/bcprov-ext-jdk15on/1.46/bcprov-ext-jdk15on-1.46.jar 

After downloading this jar file place this jar file in "jre/lib/ext". After placing the jar file you need to modify the  "java.security" file under "jre/lib/security" folder. Open the "java.security" file and add the following entry without quotes "security.provider.7=org.bouncycastle.jce.provider.BouncyCastleProvider". 

After all this now we need to generate a keystore using keytool. To generate the keystore run the following command without quotes. 
"keytool -genkey -keystore ServerKeystore -storetype BKS -provider org.bouncycastle.jce.provider.BouncyCastleProvider".


If you run the above command then it generates an error saying that "java.security.InvalidKeyException:illegal Key Size".  To avoid this, download "jce policy files" from oracle site. For suppose if you are using jdk6 then you can download the "jcp policy files" from http://www.oracle.com/technetwork/java/javase/downloads/jce-6-download-429243.html 

After downloading this zip file extract the contents into a directory and copy the "local_policy.jar" and "US_export_policy.jar" from the extracted directory and paste them in "jre/lib/security" folder(these files already may exist but you need to replace them). 

After all this open the command prompt and run the keytool as stated above. This generates the keystore which can be used in Android. Copy this keystore file into one of your project directory. 

After all the above the following is the code to successfully create a SSLServerSocket.

try{                
      String keyStoreType = KeyStore.getDefaultType();
      KeyStore keyStore = KeyStore.getInstance(keyStoreType);
      keyStore.load(Dummy.class.getResourceAsStream("ServerKeystore"), "12345".toCharArray());                

      String keyalg=KeyManagerFactory.getDefaultAlgorithm();
      KeyManagerFactory kmf=KeyManagerFactory.getInstance(keyalg);
      kmf.init(keyStore, "dhar9654".toCharArray());

      SSLContext context = SSLContext.getInstance("TLS");
      context.init(MainActivity.kmf.getKeyManagers(), null, null);          
      SSLServerSocket ss=(SSLServerSocket)context.getServerSocketFactory().createServerSocket(Constants.CHAT_SERVER_PORT);

  }catch(Exception e){
     e.printStackTrace();
   }   

Hope this helps.  I have struggled a lot to find this. So thought to document. 

16 June 2012

Challenges that we faced in LucidLims

We have faced quite a few challenges in this project. the technical problems that we faced and solutions that we found are:-
  1. when deleting rows from JTable or a vector in a loop always it has to start in a decremental order that means  if there are 10 rows in a table the loop should be "for(int i=10;i>=0;i--)". this is because in a vector or a table when you delete a record the vector shrinks to one size in its length. so always we have to start the loop in decremental order.
  2. to make the JTable non editable we have to override the Model's "isCellEditable" and return false for that method so that the entire JTable will be non editable.

04 June 2012

Lucid Lims first phase completed

Today I have completed the first phase of lucid lims. I am very happy to work on this project. Faced lot of challenges but completed successfully. I have learnt so many things in this project especially on swings. very exiting to work with swings. soon i will be documenting the challenges and solutions that i found in creating lims. 

28 May 2012

Test Sample Registry Completed

Today I have completed "Test Sample Registry". It  is like a major success. I am so happy for this.