Wednesday, September 08, 2010

The Cassandra Distributed Database

Check out this SlideShare Presentation:

Wednesday, June 16, 2010

Caution while using "and" and "or" operator in standard visual snippet

The "and" & “or” operator from standard visual snippet doesn't execute the way it is getting executed in Java. In visual snippet case it does differently

The translated code

java.lang.String __result__1 = null;
input1 = __result__1;
boolean __result__4 = input1.trim().length() != 0;
boolean __result__3 = input1 != null;
boolean __result__5;
{// and
__result__5 = __result__3 && __result__4;
}

In the above snippet the string is null, when using the "and" & “or” operator. It executes the left and right hand side conditions separately and stores in a variable and then does an 'and' operation on the variable.

While executing you will get a null pointer exception, because the string is null on top of that we are trying to trim().length()


The visual snippet operator will unnecessarily execute both the left and right hand side conditions which we don't want to do


To avoid this use the 'and' logical operator '&&' in the visual snippet.

boolean __result__6 = input1 != null && input1.trim().length() != 0;

In this case it executes as it does it in Java the safer way. :-)

Wednesday, March 31, 2010

Connect windows VOBs from solaris: Clear Case

Not sure whether this is will be a everyday requirement, but this one popped in front us some time back. Like all other things we kept this so called idea on the shelf and kept watching. At last we decided to try this out so that we can implement this setup. Rolled up our sleeves and got it to action

First downloaded the clear case solaris installation passport advantage. Download the clear case as per our requirement check before downloading whether it's for Intel (X86) or for SPARC.
After downloading copy those file to target machine where installation needs to be done.
Make sure you have enough space on the target machine (preferably free space 2GB)
Check whether you have root user access before starting the installation
From the downloaded installation copy you will find cc_ms_install.pdf keep that open you might need that for reference and Google at standby ;-)
We followed this technote which worked
Add the machine name and IP in the hosts file in both the machines (UNIX & windows vice versa) to identify in the network

Installation


Run the site_prep script which will prepare the environment before installation, will ask about the registry server and license server.
Note: The registry & License server should be common one for windows for Linux
Enter the details which you know, skip the other details or confirm it twice before entering.
After that completion of script run install_script file for installing actual clear case
Select standard installation, since you have already entered the necessary data in site_prep it will ask for confirmation. So keep going

Clear Case Setup

Create a UNIX region in solaris machine using the clear case command for creating region
After region creation, make sure the region created is visible on windows machine & solaris machine
Here After follow whatever given in the article which you have opened
Create the UNIX snapshot view (check the article)
Create the VOB tag for the UNIX region (check the article)
Load the VOB

Pitfalls

While creating snapshot view, check the option carefully there is value "-tmode strip_cr" which will make your files loading will be slow and may not load some of the files which are not compatible to UNIX.
Loading the VOB, if you loading ends up only top level folder, follow this
Here is small trick if you follow the article the clear case will be loaded but only the top level folders will be loaded., You are correct this behaviour is not common if you face this. We have a solution. create a snapshot view in windows using that view open the edcs, copy the contents in that and use the same in your UNIX machine. There goes all your files will start loading.

I'm not a SCM guy and many thanks to subbu who ran the show and for PS & naveen for helping and guiding to make this happen.

There was not enough material on this topic, so thought of my 2 cents contributions to the SCM community. ... :-)

Thursday, March 04, 2010

Check ActiveX Controls Enabled through JavaScript

Interenet Explorer has activeX controls, which can be controlled by user. Before allowing user to access the application which uses activeX controls it is good to run a check on the users browser requirements.

Standard set of the browser check is easy and pretty common like

  • JavaScript Check
  • Cookie check
  • Adobe Reader Check
  • Windows Media Player Check

But to check whether the user has disabled activeX controls there is no straight forward way (as of i knew...if any body know do let me know).

One more way is to create an AJAX request, and check whether we can create XMLHTTP request. If you disable activeX controls in the Internet Explorer options the XMLHTTP request object created will be empty.

Code snippet

function createRequestObject() {
var xmlhttp;
try {
xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch(e) {
try {
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
catch(e) {
xmlhttp=null;
}
}
if(!xmlhttp&&typeof XMLHttpRequest!="undefined") {
xmlhttp=new XMLHttpRequest();
}
return xmlhttp;
}
var activex=createRequestObject();
if(activex==null) {
alert('activex Disable XMLXTTP');
} else {
alert('activex Enable XMLXTTP');
}
I have ran tests on this code and looks good. There one more way to do activeX check, thats is via windows Media player check

Here is the code for that
var minVersion = "11";
var WMP = PluginDetect.isMinVersion('WindowsMediaPlayer', minVersion);
if (WMP == -2) {
alert('activex Disable XMLXTTP');
} else {
alert('activex Enable XMLXTTP');
}
This snippet also works fine, but we may land into trouble when the system doesn't have windows Media player. So the latter one is safe bet.

Saturday, February 20, 2010

Experince with Omni E

Some (hmmm...not right) most of the lesson are learned in hard way. This suits for every person. I learned some most important lessons while driving in hardd way. Last Saturday i started my journey from my home town to BLR. Loaded the petrol and start driving checked the spare tire (stepney commonly in india) which is good condition. So started my journey towards the destination. Maintained a speed of 80 to 90 KM/h along the course checked the fuel in between which was ok. After some 2 hours of driving i noticed one of the lights on the dashboard started glowing.. i was curious but it was on the highway so i waited to enter some town to check whats the indication meant kept on driving...Entered a city there is unusual sound coming from the engine so we stopped the vehicle.
checked the dashboard clearly my god the temperature is on highhhhh. we stopped the vehicle were struggling to open the radiator to check at last we succeed. i have seen those kind of heat from the engine in some movies now i experienced the same in my vehicle ..we waited for some time poured some water and waited the temp to come down..it came down bit so our next plan is to take the vehicle to garage and check. We took the vehicle to a local garage and he said the upper horse connecting the radiator and engine got damaged so he said that needs to be replaced we agreed and after replacement we started again we drove some distance and found again the same thing is happening so drove back to same garage guy.He told he needs to open the engine and check further The time was almost 9 PM, i decided to go an authorized service station. So halted the night at Gobi's uncle house .

The very next day went to the authorized guy for check. He said the same thing as the local guy. They opened the engine and found the head had some issues he said it will take easily two or three days to repair that. No going back we accepted for the changes and work is currently going on.


The entire story could be avoided if before traveling radiator water, engine oil and coolant has been checked and my negligence in doing that has caused this. luckily there was no family members traveling with me at that time it was just us so we managed this situation.

So the hardd lesson do check the above said things before starting a trip and keep an eye on the temp if anything seems suspicious stop immediately and call the on road service guys to assist you.