Add UNIQUE constraint to column in MySQL

Add UNIQUE Constraint

ALTER TABLE

ADD CONSTRAINT UNIQUE ()

Remove UNIQUE Constraint

ALTER TABLE

DROP INDEX ()

To add through Query browser GUI .

Select the Table , right click and edit
Then select the column to add the unique constraint , select “Indices” tab next to “Column details” , click the plus (+) button and add the constraint you need.

December 6, 2011 at 4:34 am Leave a comment

Could not find the main class. Program will exit.

Created a Test class with main() in Eclipse which ran successfully for a whole day. The very next day when I wanted to run the same application so that I can test my pet project..there goes the main in some hole.

Could not find the main class. Program will exit.

Tried a lot to fix .. Still have no clue what went wrong. But Creating another class with main method and copying the content from the non working class to this worked. Another lousy learning..But again that works for me!!

December 6, 2011 at 4:28 am Leave a comment

Unexpected Error Initializing Deployer: weblogic.management.ManagementException

Weblogic Exception

[java] Unexpected Error Initializing Deployer: weblogic.management.ManagementException: [Deployer:149163]The domain edit lock is owned by another session in non-exclusive mode - this deployment operation requires exclusive access to the edit lock and hence cannot proceed. If you are using "Automatically Aquire Lock and Activate Changes" in the console, then the lock will expire shortly so retry this operation.

Solution.

Search and delete all the .lok files from weblogic folder ( *.lok )

January 12, 2011 at 12:43 pm Leave a comment

Count open connections for a process – SOLARIS

Had an issue in SIT server , where all the connections of the MQManager server got exhausted.

This was because some process was holding the entire available connections and not releasing it.

The following code finds all the process id’s for a particular user and finds the count of all connections opened by each of that processes . This will be logged to a file.

username – the user name for which the process belongs
/folder/data.txt – the file which stores process id’s.
result.txt – results with PID – COUNT generated
AF_INET 127.0.0.1 – denotes the server to which connections are made

#!/bin/bash
ps -eaf -u username -opid > /folder/data.txt
echo > result.txt
while IFS= read -r file
do
[ -f "$file" ] && rm -f "$file"
cnt=$(pfiles $file |egrep 'AF_INET 127.0.0.1' | wc -l)
if [ $cnt -ne "0" ]
then
echo $file $cnt >> result.txt
fi
done < "/folder/data.txt"

This script helped me zero in on the process holding up all the connections

~HTH

October 14, 2010 at 4:49 pm Leave a comment

Java , Unix & Spanish Characters

Java , Unix & Spanish Characters

Continue Reading September 30, 2010 at 1:59 pm Leave a comment

Move/Rearrange HTML table rows

A simple javascript solution for moving html table rows up/down on click of an image.

function moveUp(node){

var changeNode;

var parent;

if(node.rowIndex!=0){

changeNode=getNextRow(-1,node.rowIndex);

parent = node.parentNode;

parent.insertBefore(node,changeNode);

}

}

function moveDown(node){

var changeNode;

var parent;

var ln = document.getElementById(“myTable”).rows.length;

if(node.rowIndex!=ln-1){

changeNode=getNextRow(1,node.rowIndex);

parent = node.parentNode;

parent.insertBefore(changeNode,node);

}

}

function getNextRow(diff,selectedRowIndex){

var table = document.getElementById(“myTable”);

var cnt;

for (var i = 0, row; row = table.rows[i]; i ++) {

if(row.rowIndex==selectedRowIndex){

cnt = i+diff;

return table.rows[cnt];

}

}

}

First Row Up Down
Second Row Up Down
Third Row Up Down
Fourth Row Up Down


~HTH

September 10, 2010 at 3:30 am Leave a comment

Samsung Jet S8003 . Add / Remove from Reject List

Just adding a number to Reject List alone won’t work with Samsung Jet S8003.
You need to activate the function from here.
Settings ->Application Settings->Call->All Calls->Auto Reject
Activation On / Off.
To remove a number from auto reject can also be done here.

May 19, 2010 at 3:24 pm 2 comments

Quote

Whether we wake or we sleep,

Whether we carol or weep,

The Sun with his Planets in chime,

Marketh the going of Time.

~Edward Fitzgerald

June 10, 2009 at 3:31 pm Leave a comment

Creating Microsoft Office Outlook 2007 Signatures when New Signature option is disabled.

The place where I work , we have company default signature for all the Outlook Messages we create.
I always wanted to add more information to that signature or create another project specific signature for my mails.

But the Tools->Options->Mail Format->Signatures->New Option is disabled in my Outlook.

Following is a workaround that I found to create/edit new/existing signature in Outlook 2007.

Additional tools that I used is Microsoft Office Word 2007 .

Create new Signature
——————————
Open MS Word and create a good looking signature of your choice with all the formatting , pictures , colours that you need.

Create a folder in your desktop ( eg: “My Signature” ) and save your newly created Word document to that folder.

Save the Word document in three formats from MS Word. Select File -> Save As

Save as -> Web Page
Save as -> Rich Text Format
Save as -> Plain Text [When asked for Text Encoding : select default , ie Windows ( Default )]

Save the file with same name ( eg: MySignature.txt , MySignature.rtf, MySignature.htm ).
Microsoft Word will create an addictional  folder when you save a document as Web Page for pictures and the styles for that page. Which will be  <your file name>_files folder.

So now you have three files with same name and a folder with you. Copy these files and folders ( not the directory you created , just the files and folders ) to

C:\Documents and Settings\<your login name>\Application Data\Microsoft\Signatures

This is the place where Outlook keeps its signatures.

Edit existing Signature
———————————

C:\Documents and Settings\<your login name>\Application Data\Microsoft\Signatures

Browse to the folder specified above , right click on the file ( will be same as your Signature name ) and select Edit. If you have Microsoft Office installed in your machine the document should open up in Microsoft Word. Do edit all the three formats of your signature , ie txt,rtf and htm which is available inside the Signatures folder.

Now you should be able to see your new signature listed for selection in your Outlook.  Good Luck!

April 17, 2009 at 9:09 am 1 comment

Checkbox selection logic

This js restricts the selection from a group of checkboxes to four. If a fifth one is selected , then the first one whichever was selected will be unchecked.

A combination of js and jQuery.

 

// Restricting the vehicle selection to FOUR – Start
var vehList=new Array();
vehList[0]=””;
vehList[1]=””;
vehList[2]=””;
vehList[3]=””;

var vehObjList = new Array();
vehObjList[0]=””;
vehObjList[1]=””;
vehObjList[2]=””;
vehObjList[3]=””;

function restrictVeh(obj,name){
  var selVin = name;
  var remVeh = “”;
  var remObj;
  if($(obj).attr(’checked’)){
    for(var incr=0;incr <= 3 ; incr++){
      if(vehList[incr]==””){
      vehList[incr]=selVin;
      vehObjList[incr]=obj;
      break;
       }
       if(incr==3){
        remVeh = vehList[0];
        remObj = vehObjList[0];
        $(remObj).attr(’checked’,false);
        for(var cnt=0;cnt<3;cnt++){
       vehList[cnt]=vehList[cnt+1];
       vehObjList[cnt]= vehObjList[cnt+1];
        }
        vehList[3]=selVin;
        vehObjList[3]=obj;
       }
     }
  }else{
    for(var incr=0;incr <= 3 ; incr++){
      if(vehList[incr]==selVin){
      vehList[incr]=””;
      vehObjList[incr]=””;
      for(var cnt=incr;cnt<3;cnt++){
       vehList[cnt]=vehList[cnt+1];
       vehObjList[cnt]=vehObjList[cnt+1]
      }
      vehList[3]=””;
      vehObjList[3]=””;
       }
  
    }  
  }
/* for(var incr=0;incr <= 3 ; incr++){
   alert(vehList[incr]);
  }  */
}
// Restricting the vehicle selection to FOUR – End

November 30, 2008 at 12:00 pm Leave a comment

Older Posts


 

January 2012
M T W T F S S
« Dec    
 1
2345678
9101112131415
16171819202122
23242526272829
3031  

Follow

Get every new post delivered to your Inbox.