Thursday, August 28, 2014

Change the version of Java to 1.7 when 1.6 is already installed

This post is to get knowledge on how to change the versions of java when there are multiple versions installed in any machine.

Platform : Windows 7
Java Versions installed : 1.6 and 1.7

We were facing an error when we tried to check the version of java from command prompt using the command "Java -version" the error seemed something like this,

One has to do the below steps to change the version of java to 1.7

  1. Open registry editor from Run window

  2. Go to the Java Run time environment from the tree of registry editor

  3. Check the current version

  4. Update the current version to 1.7

  5. Check the version from command prompt

Wednesday, August 27, 2014

Change Folder to ControlPanel

There are situations where you want to have your data secured. Hiding folder is typical way one would go for but everyone would be aware of un-hiding them. Here is one way of encrypting the data.

With this one can change the folder to control panel, technically you will use a bat file and change the folder to control panel. On double click of this folder, it would take you to control panel instead of taking to the folder contents.

Control panel will be identified using the keystring "21EC2020-3AEA-1069-A2DD-08002B30309D" in Windows XP and "ED7BA470-8E54-465E-825C-99712043E01C" in Windows 7. Do the below steps to change the folder to control panel.

  • Lets say you have a folder named "Example" in which you have some confidential information.
  • Open text pad and write the contents as given below
    ren Example ControlPanel.{ED7BA470-8E54-465E-825C-99712043E01C} 
  • Rename this file to <SomeFileName>.bat 
  • When you double click the file you can see that your folder "Example" will be converted to "ControlPanel"
Do the below steps to revert back to Example folder
  • Lets say you have a folder named "Example" in which you have some confidential information.
  • Open text pad and write the contents as given below
    ren ControlPanel.{ED7BA470-8E54-465E-825C-99712043E01C} Example
  • Rename this file to <SomeFileName>.bat
  • On double click this file you can see that your control pane will be converted back to "Example" folder.
Note : This post is only for those who are new to the computers and not meant to the people with average skills on internet browsing. 

Friday, August 1, 2014

Learnings from CORS : Call a webservice from other domains

Problem Statement :

We generally encounter a scenario where we have to access services which are not hosted locally (i.e., Other domain). This normally can't be achieved straight forwardly in html. We need to understand few points here which I will be explaining in this post.

References :

Explanation :

I would go with the assumption that one must know how to call a web service from html. If not the above reference would help in achieving this.

Note : A clear information that this is not possible in latest versions of chrome (I have tested only with browsers chrome and IE). This post is not meant for the applications which is using latest versions of chrome ( post would help you understand why).

Lets say you are using the same html file which is being explained in this post. Only difference being the gatewayURL which is the end point url being different.

How to solve it in IE :

Be it XMLHttpRequest or ajax request you can access services of cross domain using a browser property (this again depends on every client and also not secure). The property is as shown below in the image,

 After enabling this option one can access cross domain services in IE.

How to Enable in Chrome lower versions (I have chrome 16):

Although new versions of chrome doesn't support cross domain services at all but this can be achieved for lower versions of chrome using concept called "CORS". CORS stand for Cross Origin Resource Sharing. 

In Simple terms "Server has to authorize the client for cross domain accessing in case of chrome". This is not happening in IE as this is enabled at client side using settings of IE.

Problems/Resolution :

Possible errors from Chrome 16 are shown below :

Add below two properties to the website that you are using :

"Access-Control-Allow-Headers" with value "Content-Type"
"Access-Control-Allow-Origin" with value "*" (* generally represents allow any domain you have to google on how to give multiple domains, in general one domain is http://dhl-hyd1024)