Javascript: Find duplicates in the array and delete from array.

Finding duplicates in array. Please go to groggyjava.

Deleting duplicates:

var duplicateCodes= [];
duplicateCodes.push(“ss”, “”, “ee”, “”,”ee”);  //inserting duplicates and some empty values.

duplicateCodes= duplicateCodes.filter(function(e){return e});  // removing empty values.
if(duplicateCodes.indexOf(“ee”) >= 0)  // checking if “ee” is already in the array
{
alert(“yes”);
}
alert(“Please remove \n” + duplicateCodes.join(‘\n’));

Advertisements

Checking if any control in view has changed in ASP.NET

The typical way to check for whether anything has changed in the view when you’re navigating away from a page is to bind a method to the change event of each input and to set a flag if this has happened. This flag is then checked when leaving the page and a notification is shown to the user if the flag is raised. This is all good but it does not take into account things like changing the order of inputs and changing values back to their original values. Also, creating dynamic elements makes this way of doing things a bit tricky because you have to add registering of the handlers to each method which adds new elements.

Just recently I had to implement this kind of checkin Continue reading

ActiveX control and using it in Javascript & Vbscript to add key value in the Registry.

ActiveX is a client-side technology only. It is designed to allow COM objects registered on the client machine to be instantiated in the browser. ActiveX controls can be used in clientside applications running in a web browser. When the user accesses a web page, the control is downloaded to the client machine and is run from the browser using a scripting language such as Javascript or VBScript. Continue reading