Win a copy of OCP Java SE 8 Programmer II Exam Study Guide this week in the OCP forum!

jil shi

Greenhorn
+ Follow
since Feb 17, 2004
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by jil shi

i know at first have to write queue program. then how to let one out while the new input will come in?
13 years ago
simulate a 4*4 input-buffered switch with the first-in-first-out(FIFO) scheme and find the saturation throughput. Assume each packet is equally likely to be destinated for any output.

how to write a programming code to calculate saturation throughput?
13 years ago
i plan to add online camera to my website.
in website, it should be able to display live image that capture by camera.

previously i used axis camera which was an old camera. below are the following code i used.

function video() {
document.write("<OBJECT ID=\"AxisCamControl\" CLASSID=\"CLSID:917623D1-D8E5-11D2-BE8B-00104B06BDE3\" WIDTH=\"400\" HEIGHT=\"290\" CODEBASE=\"/activex/AxisCamControl.cab#Version=1,0,2,15\">");
document.write("<PARAM NAME=DisplaySoundPanel VALUE=0>");
document.write("<PARAM NAME=URL VALUE=\"http://192.168.1.95/axis-cgi/mjpg/video.cgi?camera=&resolution=640x 480\">");
document.write("</OBJECT>");
}


it works fine and able to work in my website.

** Recently i bought new camera brand Philips but do not how to write code so that enable to use in my web site.

is there any coding that can help me to attach my live camera to website??
i plan to create a website for user who stay in condominium. this website is speacially created to ease the residents who live condominium. Do you have any idea what are the features or facilities that i can put it the website?
for example, this website enable residents to pay their rental or maintenance fees online. or add forum to this web site.
Anyone who has idea do not hesitate to post it here. i would appreciate any advice.
13 years ago
My task is generate random user id and password for user to log in my web site.
Below are the data that inserted into database.
es_usr_id </t> es_password
A1001 </t> MWKBSP
A1002 </t> MWKBSP
A1003 </t> MWKBSP
A1012 </t> KSOKFN
A1013 </t> KSOKFN
A308 </t> VIJOWC
A309 </t> VIJOWC
A400 </t> VIJOWC
The problem is i can log in using A1001, A1012 and A308 only. The rest user id and password got error and i can't log in with that. How can i log in using all the user id and password that have been generated?
I unclude part of my coding:
<form name="form1" method="post" action="admin.jsp">
<% usr_nme = request.getParameter("empname");
passwrd = request.getParameter("pw");
boolean check_user = true;
boolean check_pass = true;
String sql_1 = "SELECT * FROM esaccs "+
"WHERE es_iden <> 'P' AND (es_iden <> 'O' OR es_iden <> 'T') ";
Statement stmt_1 = conn.createStatement();
ResultSet rset_1 = stmt_1.executeQuery(sql_1);
while (rset_1.next()) {
acc_no = rset_1.getString("es_access_no");
usr_id = rset_1.getString("es_usr_id");
passwd = rset_1.getString("es_password");
status = rset_1.getString("es_sts");
identi = rset_1.getString("es_iden");
session.setAttribute("iden", identi);
if ((!usr_nme.equals(usr_id))) {
check_user = false;
} else {
check_user = true;
}
if (!passwrd.equals(passwd)) {
check_pass = false;
} else {
check_pass = true;
}
if (check_user==true && check_pass==true) {
break;
}
}
if (!check_user && check_pass) { %>
<br><br><br><br><br>
<center><h2>Invalid Login Name!</h2>
<% } else if (!check_pass && check_user) { %>
<br><br><br><br><br>
<center><h2>Invalid Password!</h2>
<% } else if (!check_user && !check_pass) { %>
<br><br><br><br><br>
<center><h2>Invalid Login Name and Password!</h2>
<% } else {
session.setAttribute("access_no", acc_no);
session.setAttribute("user_name", usr_nme);
session.setAttribute("password", passwrd);
boolean chk = false;
String sql = "SELECT * FROM fcrsdt "+
"WHERE fs_access_no = '"+String.valueOf(session.getAttribute("access_no"))+"' ";
Statement stmt = conn.createStatement();
ResultSet rset = stmt.executeQuery(sql);
while(rset.next()) {
session.setAttribute("fs_lot_no", rset.getString("fs_lot_no"));
session.setAttribute("fs_access_no", rset.getString("fs_access_no"));
session.setAttribute("fs_name", rset.getString("fs_name"));
session.setAttribute("fs_proj_cde", rset.getString("fs_proj_cde"));
session.setAttribute("fs_phase_num", rset.getString("fs_phase_num"));
chk = true;
}
if (chk == false) {
String sql_2 = "SELECT fp_seq_no, fp_name FROM fcpubl "+
"WHERE fp_seq_no = '"+String.valueOf(session.getAttribute("access_no"))+"' ";
Statement stmt_2 = conn.createStatement();
ResultSet rset_2 = stmt_2.executeQuery(sql_2);
while (rset_2.next()) {
int seqno;
seqno = rset_2.getInt("fp_seq_no");
String sequenceno="";
sequenceno=Integer.toString(seqno);
session.setAttribute("fp_seq_no",sequenceno);
session.setAttribute("fp_name", rset_2.getString("fp_name"));
}
}
if (check_user && check_pass && (identi.equals("O") || identi.equals("T") || identi.equals("P"))) {%>
<h3> </h3>
<META HTTP-EQUIV="refresh" CONTENT="3; URL=admin.jsp">
<br><br><br><br><br>
<h3 align="center"><font color="#000099">Invalid Login!</font></h3>
<h3 align="center"><font color="#000099">You are not administrator, you have no authority to login.</font></h3>
<% } else if (check_user && check_pass && identi.equals("A")) {
response.sendRedirect("mainframe.jsp");
}
} %>
</form>
i am using jsp to create web site. How can i insert data into database but do not have text box in the web site. i want to have data automatically show in the database without having people key in data from web site. the purpose for doing this is i want to generate default answer for every member.
14 years ago
JSP
i try to send code but faced some problem. this web site cannot accept <, >. how can i post my code?
Property Description : (list bar)
Property Description : null
(submit button)
.............................................................................
As you can see from the above, i need to choose option from a list bar. after choose an option, it will automatically show at below replacing the null. when the statement is display, i can change it to replace with the more updated one. Then click submit button when property description is changed. the problem is my program can't automatically display statement when i choose option from list bar.
Property Description : (list bar)
Property Description : null
(submit button)
.............................................................................
As you can see from the above, i need to choose option from a list bar. after choose an option, it will automatically show at below replacing the null. when the statement is display, i can change it to replace with the more updated one. Then click submit button when property description is changed. the problem is my program can't automatically display statement when i choose option from list bar.
i knw this code is working fine. when i add list bar to the program, it return to the wrong page. that was the problem
14 years ago
JSP
The submit button is created at other page. Not the same page with the code that i provided. Below are part coding of submit button page:<form name="form1" method="post" action="select_2_property.jsp" onSubmit="return chk();">
<table border="0">
<tr><td><font color="#0929AF"><strong>Online Registration</strong></font></td></tr>
<tr><td>Select Property That You Are Interested</td></tr>
<tr><td>
<select name="prop">
<option value="done" selected="selected">----- Select -----</option-->
<option value="klcv">Kuala Lumpur Cityview</option>
<option value="sv">Sentul View</option>
</select>    
<input class="submit" type="submit" name="submit" value="Submit">
</td></tr>
</table>
</form>
14 years ago
JSP
<form name="form1" method="post" action="page1.jsp">
<%String propVal = request.getParameter("prop");
out.print(propVal);

if (propVal.equals("klcv")) {
//response.sendRedirect(response.encodeRedirectUrl("klcv_write_online_registration.jsp"));
String server = "localhost";
session.setAttribute("server", server);
String database = propVal;
session.setAttribute("database", database);

Class.forName("org.gjt.mm.mysql.Driver");
DriverManager.registerDriver((Driver) Class.forName("org.gjt.mm.mysql.Driver").newInstance());
String url = ("jdbc:mysql://"+server+"/"+database+"" );
Connection conn = (Connection)DriverManager.getConnection(url,"","");

String sql_1 = "SELECT * FROM smbyer INTO OUTFILE 'klcv_smbyer.txt' "+
"FIELDS TERMINATED BY '|' LINES TERMINATED BY '\r\n' ";
Statement stmt_1 = conn.createStatement();
ResultSet rset_1 = stmt_1.executeQuery(sql_1);
conn.close();

} else if (propVal.equals("sv")) {
//response.sendRedirect(response.encodeRedirectUrl("sv_write_online_registration.jsp"));
String server = "localhost";
session.setAttribute("server", server);
String database = propVal;
session.setAttribute("database", database);

Class.forName("org.gjt.mm.mysql.Driver");
DriverManager.registerDriver((Driver) Class.forName("org.gjt.mm.mysql.Driver").newInstance());
String url = ("jdbc:mysql://"+server+"/"+database+"" );
Connection conn = (Connection)DriverManager.getConnection(url,"","");
String sql_1 = "SELECT * FROM smbyer INTO OUTFILE 'sv_smbyer.txt' "+
"FIELDS TERMINATED BY '|' LINES TERMINATED BY '\r\n' ";
Statement stmt_1 = conn.createStatement();
ResultSet rset_1 = stmt_1.executeQuery(sql_1);
conn.close();

}

String brv= "brv";
session.setAttribute ("database", brv);%>
<h1> </h1>
<h1> </h1>
<META HTTP-EQUIV="refresh" CONTENT="2; URL=page1.jsp">
<h2 align="center"><font color="#000099">Data transfer completed!</font></h2>
</form>
14 years ago
JSP
i am creating my web site using jsp. the problem that is faced is when i click submit button after execute my page, it will return to wrong page. however i already type return to the relevant page in my program. how to make sure that after click submit button, my page will return to the relevant page. my program is using frame. Firstly, i select option from the list bar. after select, it will execute my program. unfortunately after execute it returned to the wrong page
14 years ago
JSP
i am creating my own web site using jsp. i plan to add 'chat service' like mirc or icq into my web site. how can i create the 'chat'? is there any third party software that i can use?
14 years ago
JSP

for your information, i'm using jsp to create my web page. i am inserting sequence number into the database. When first data in insert into database it will show number 1 in the database. when second data in insert in database, it will show number 2 in the database. the data are inserted when user click submit button from the web page.
i am creating a page name main.jsp. when the user select option from the list bar, it will link to new page. the option value in the list bar are 'sentul view' and 'cityview'. if the user choose 'cityview', it will link to new page that allows user to key in their information. the problem is sequence number was enter wrongly into database. when the first user click submit after selected "city view', sequence in 'cityview' database will increase. then when the other user register 'sentul view', the database sequence will start from number 2 in 'sentul view' database. how to avoid the problem...
i enclosed some part of the code:
<%
String sql_selectMax = "SELECT max(smb_regr_seq_no) as maxNo "+
"FROM smbyer ";
Statement stmt_selectMax = conn.createStatement();
ResultSet rset_selectMax = stmt_selectMax.executeQuery(sql_selectMax);
while(rset_selectMax.next()){
reqNo = rset_selectMax.getInt("maxNo");
out.print (reqNo);
}
reqNo = reqNo + 1;
%>