468,504 Members | 1,956 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,504 developers. It's quick & easy.

I need Hashing program!!!!

1
hi,

help me!!! i need hashing program in C or in Java..

tnx,
cheche
Sep 6 '06 #1
1 3188
HI
Below is the code which I wrote for one application in JAVA
in this I used Hash I think it may help you a little



import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.text.*;
import java.util.Date;
import java.util.Calendar;

public class DAUpdate extends HttpServlet {

private String IP,port,user,password, OpertionType;

public void doGet(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException {
doPost(request,response);

}

public void doPost(HttpServletRequest request, HttpServletResponse res) {
String AccountName ;
ArrayList result = new ArrayList();
Object retobj = new Object();
String partnerid;
int counter;
String InterResult;
Hashtable ServiceDARecord = new Hashtable();
//Intermediate Result added by Awkash 09/01/2006
String ServiceDARecordKeys[] =
{
"TransactionType" ,
"ServiceID" ,
"EventID" ,
"InstrumentType" ,
"IntermediateResult",
"ServiceName" ,
"ShareType" ,
"ShareValue" ,
"PartnerID",
"DiscountType" ,
"DiscountRate" ,
"EffectiveStartDate" ,
"EffectiveEndDate",

};


//getting values from session
HttpSession session = request.getSession(true);
user = (String)session.getAttribute("PBSUserName");
password = (String)session.getAttribute("PBSUserPass");
IP=(String)session.getAttribute("PBSIP");
port=(String)session.getAttribute("PBSport");
//partnerid = (String)session.getAttribute("partnerid");
String ServiceType = (String)session.getAttribute("ServiceType");

int updateFlag = 0;

int i=0;
int j=0;
//String PartnerID = partnerid;
Object Values[][] = new Object[1][16];//its size is 15 earlier
String textbox;
String thpHost ="10.8.54.64";
String thpPort ="10009"; // FOR RIC_DEV Use This Port "10009";
Properties properties = new Properties();
properties.setProperty("ThpHost", IP);
properties.setProperty("ThpPort", port);
TreConnection conn = new TreConnection(properties);
conn.treConnect(user,password,"");

String temp;
PrintWriter out;
try{
out = res.getWriter();
}catch(Exception exc){
return;
}

//System.out.println("Service Type : " + ServiceType + " in DAInsert.java");

for (i=0;i<=0;i++) { //We are having only one row at any given time
//Index inceramented to handle additional field intermediate results
for (j=0;j<=12;j++){
textbox= "x"+i+"y"+j;

if (j==11){
temp = (String)request.getParameter(textbox);

ServiceDARecord.put(ServiceDARecordKeys[j],
new String( temp + " 00:00:00" ));
}
else if (j==12){
temp = (String)request.getParameter(textbox);

ServiceDARecord.put(ServiceDARecordKeys[j],
new String( temp + " 23:59:59" ));
}
else{
temp = (String)request.getParameter(textbox);
System.out.println("Temp recieved is " + textbox + ": " + temp + "[[");
ServiceDARecord.put(ServiceDARecordKeys[j], temp);

}
}
/* Just for debugging*/
//System.out.println("Copying Values in Hash");

// 2 - Update
ServiceDARecord.put("OperationType", new Integer(2));

ServiceDARecord.put("ServiceType", ServiceType);

ServiceDARecord.put("UpdateFlag", (String)request.getParameter("updt"));

Object te[] = new Object[1];
te[0] = ServiceDARecord;

try{



System.out.println("Calling fRIC_Partner_BillingDA_Update...");
retobj = conn.treVariantCall("fRIC_Partner_BillingDA_Update ?[]",new Date(),te);

counter = i + 1;
out.println("Row Inserted.\n" );
result = (ArrayList)retobj;
//Putting result in session to be extracted later
//session.setAttribute("val", result);

//System.out.println("result ArrayList :" + result);
conn.treDisconnect();
res.sendRedirect("Rep_Partner_Service_Details.jsp" );
//res.sendRedirect("Rep_Partner_Service_Details.jsp" );
//System.out.println(result);

}
catch(Exception exc){
System.out.println(exc.toString());
out.println(exc.toString());
return;
}
finally{
//conn.treDisconnect();
}
}
//conn.treDisconnect();
}
}
Sep 6 '06 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by Bikini Browser | last post: by
1 post views Thread by djg | last post: by
3 posts views Thread by gieforce | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.