|
i want to develop a project where i struck in a situation where i have to import two files with .jsp format and want to check whether that 1.jsp and 2.jsp two files are equal or not in their internal coding or it is different ?
Any idea please help
|
|
|
|
|
Member 8243693 wrote: Any idea Read each file, either line by line or block by block, and do a byte compare on the content.
Use the best guess
|
|
|
|
|
Hello,
Please have a look at Java Diff Utils project. You can compare two files using it. Here is a sample code which prints the differences between the two files, directly taken from the project.
import difflib.*;
public class BasicJavaApp_Task1 {
private static List<String> fileToLines(String filename) {
List<String> lines = new LinkedList<String>();
String line = "";
try {
BufferedReader in = new BufferedReader(new FileReader(filename));
while ((line = in.readLine()) != null) {
lines.add(line);
}
}
catch (IOException e) {
e.printStackTrace();
}
return lines;
}
public static void main(String[] args) {
List<String> original = fileToLines("originalFile.txt");
List<String> revised = fileToLines("revisedFile.xt");
Patch patch = DiffUtils.diff(original, revised);
for (Delta delta: patch.getDeltas()) {
System.out.println(delta);
}
}
}
Regards,
Prasad P. Khandekar
Knowledge exists, man only discovers it.
|
|
|
|
|
I anticipate to learn android.
|
|
|
|
|
Is this a question or a statement? If you are looking for help on Android development then please try the Android developers website[^].
Use the best guess
|
|
|
|
|
1) Shortest way of creation of Queue object and use push and pop methods.
2) Can the queue handle 50,000 thousand string elements in it?
|
|
|
|
|
|
|
Any body helps to me?
I would to implementation rijndael algorithm on java using netbeans, but i don't understaind how to ?
May be some body can helps me, to implementation this, please.
thanks before.
|
|
|
|
|
Is it difficult[^]? Or considering you can't even search for such a thing maybe this is what you want[^]; remember to change the comments.
Reality is an illusion caused by a lack of alcohol
|
|
|
|
|
thanks for your attention, but i don't understaind how to implementation using java swing with netbeans. may be you can help me, please..
|
|
|
|
|
Hi,
I have created an Eclipse plug-in, A dialog is shown using a command and when user click ok button, reads the data in the View and sends the data to Server using TCP/IP. But the problem is the dialog gets hanged till I receive the response from the TCP/IP.
My query is how to launch a thread for reading the data from the view and send to the TCP/IP?
Any suggestions please!!!
|
|
|
|
|
Sir i just wanted to know the code for K-means Clustering on text documents !!
As the code is available in C#!
but I am not able to get it!
and I am new to this site!
So can anybody help me please!
Thanks a lot!
|
|
|
|
|
Please don't post the same question in multiple locations.
|
|
|
|
|
hi this venky,
i have little bit confiussion?please tell me
|
|
|
|
|
forward: Control can be forward to resources available within the server from where the call is made. This transfer of control is done by the container internally and browser / client is not involved. This is the major difference between forward and sendRedirect. When the forward is done, the original request and response objects are transfered along with additional parameters if needed.
redirect: Control can be redirect to resources to different servers or domains. This transfer of control task is delegated to the browser by the container. That is, the redirect sends a header back to the browser / client. This header contains the resource url to be redirected by the browser. Then the browser initiates a new request to the given url. Since it is a new request, the old request and response object is lost.
More details here: http://javapapers.com/jsp/difference-between-forward-and-sendredirect/[^]
|
|
|
|
|
In case of sendRedirect()
- The url of the browser will be changed
- Always new Request is generated.
- using it you can go beyond the one context.
In case of RequestDispatcher's forward method
- The url of the browser will not change
- No new request is generated
- Data can be shared via request
- you cannot go beyond one context
- the final response is generated by the called servlet
|
|
|
|
|
Hi,
Now I am learning MVC architecture and I want to use time picker in jsp not in javascript.Can we use time picker in JSP? If we can use, how we write it ?
|
|
|
|
|
|
Think before creating anything.What is the purpose of creating a time picker in jsp instead of javascript? If there are no special purpose then go for javascript to save the implementation time.
Shubhashish
|
|
|
|
|
Hi ...
I have tried to create Jsp Invoice but i have some problem i hope you can help me to do it ..
This the javascript used to get price for the item
var xmlHttp
var xmlHttp
function showState(str){
if (typeof XMLHttpRequest != "undefined"){
xmlHttp= new XMLHttpRequest();
}
else if (window.ActiveXObject){
xmlHttp= new ActiveXObject("Microsoft.XMLHTTP");
}
if (xmlHttp==null){
alert("Browser does not support XMLHTTP Request")
return;
}
var url="getprice.jsp";
url +="?count="+encodeURI(str);
xmlHttp.onreadystatechange = stateChange;
xmlHttp.open("GET", url, true);
xmlHttp.send(null);
}
function stateChange(){
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){
document.getElementById("price").innerHTML=xmlHttp.responseText
}
}
This is the Inovice Page at JSP
<%----%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="java.sql.*"%>
<%
response.setCharacterEncoding("UTF-8");
request.setCharacterEncoding("UTF-8");
String user = "root";
String password = "0122308791";
String host = "jdbc:mysql://localhost:3306/POSWITHACCOUNT";
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection con = DriverManager.getConnection(host, user, password);
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("SELECT * FROM ITEMS");
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<HEAD>
<TITLE> Add/Remove dynamic rows in HTML table </TITLE>
<link rel="stylesheet" href="style.css">
<link rel="license" href="http://www.opensource.org/licenses/mit-license/">
<script src="script.js"></script>
<script src="jquery.js" type="text/javascript"></script>
<SCRIPT language="javascript">
function getrow() {
if (!document.getElementsByTagName || !document.createTextNode) return;
var rows = document.getElementById('dataTable').getElementsByTagName('tr');
var rowtyp=0;
for (i = 0; i < rows.length; i++) {
rows[i].onclick = function() {
rowtyp= this.rowIndex + 1;
}
}
}
function addRow(tableID) {
var table = document.getElementById(tableID);
var rowCount = table.rows.length;
var row = table.insertRow(rowCount);
var colCount = table.rows[0].cells.length;
for(var i=0; i<colCount; i++) {
var newcell = row.insertCell(i);
newcell.innerHTML = table.rows[1].cells[i].innerHTML;
}
}
function deleteRow(tableID) {
try {
var table = document.getElementById(tableID);
var rowCount = table.rows.length;
for(var i=0; i<rowCount; i++) {
var row = table.rows[i];
var chkbox = row.cells[0].childNodes[0];
if(null != chkbox && true == chkbox.checked) {
if(rowCount <= 1) {
alert("Cannot delete all the rows.");
break;
}
table.deleteRow(i);
rowCount--;
i--;
}
}
}catch(e) {
alert(e);
}
}
</SCRIPT>
</HEAD>
<BODY>
<h1>Recipient</h1>
<address contenteditable>
<p>Some Company<br>c/o Some Guy</p>
</address>
<form>
<table class="meta">
<tr>
<th><span contenteditable>Invoice #</span></th>
<td><span contenteditable>101138</span></td>
</tr>
<tr>
<th><span contenteditable>Date</span></th>
<td><span contenteditable>January 1, 2012</span></td>
</tr>
<tr>
<th><span contenteditable>Amount Due</span></th>
<td><span id="prefix" contenteditable>$</span><INPUT type="text" name="eStop" id="eStop" /></td>
</tr>
</table>
<TABLE id="dataTable" width="350px" border="1" class="inventory">
<thead>
<tr >
<th width="30px"><span contenteditable>No</span></th>
<th><span contenteditable>Items</span></th>
<th><span contenteditable>Description</span></th>
<th><span contenteditable>Quantity</span></th>
<th><span contenteditable>Price</span></th>
<th><span contenteditable>Tax</span></th>
<th><span contenteditable>Total</span></th>
</tr>
</thead>
<TR >
<TD width="30px"><INPUT type="checkbox" name="chk" /></TD>
<TD>
<SELECT name="items" onclick="showState(this.value)" onkeydown="showState(this.value)" onkeyup="showState(this.value);getrow()" class="uname">
<OPTION value="in">Select Items to Sale . .</OPTION>
<% while (rs.next()) {%>
<option value="<%=rs.getInt("idITEMS")%>"><%=rs.getString("ITEMNAME")%></option>
<%}%>
</SELECT>
</TD>
<TD><INPUT type="text" name="desc"/></TD>
<TD><INPUT type="text" name="quantity"/></TD>
<TD><div id="price"><INPUT type="text" name="price" value="0.0" /></div></TD>
<TD><INPUT type="text" name="tax" id="val" value="0.0"/></TD>
<TD><INPUT type="text" name="total" value="0.0"/></TD>
</TR>
</TABLE>
<br><br><br>
<INPUT type="button" value="+" onclick="addRow('dataTable')" class="add"/>
<INPUT type="button" value="deket" onclick="deleteRow('dataTable')" />
</form>
</BODY>
</HTML>
THIS IS THE getprice.jsp
page to get price
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@page import="java.sql.*"%>
<%
response.setCharacterEncoding("UTF-8");
request.setCharacterEncoding("UTF-8");
String user = "root";
String password = "0122308791";
String host = "jdbc:mysql://localhost:3306/POSWITHACCOUNT";
String buffer = "";
try {
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection con = DriverManager.getConnection(host, user, password);
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("SELECT SALEPRICE,BARCODE FROM ITEMS WHERE idITEMS='"+request.getParameter("count")+"'");
double price=0.0;
while (rs.next()) {
price=rs.getDouble("SALEPRICE");
}
out.println(price);
buffer = buffer + "<INPUT type='text' name='price' value='"+price+"'/>";
response.getWriter().println(buffer);
} catch (Exception e) {
System.out.println(e);
}
%>
The problem now
when i add new row and select item the item price affect at the price cell at the first row only ??
Now how can i went add new row and select new item the price of item show at the it`s row ?
|
|
|
|
|
|
I'm trying to find a good source of information on how to playback audio samples in java. Preferably with source code examples that I could learn from.
The sample durations are too short to be kept in individual files because of the time taken to load them.
So the idea is to playback samples that are equally spaced within one monolithic audio file.
It doesn't seem like an impossible task, but finding information on java audio (all in one article) has been difficult.
Q. Hey man! have you sorted out the finite soup machine?
A. Why yes, it's celery or tomato.
|
|
|
|
|
Apart from this[^] and this[^], what exactly are you looking for?
Use the best guess
|
|
|
|
|
This is my first Java database application so I'm sure I'm missing something. This is the code I have...
import java.sql.*;
public class ClsConn {
private Connection conn;
public Connection openConn() {
try {
System.out.println("Trying the connection now...");
Class.forName("net.sourceforge.jtds.jdbc.Driver");
conn = java.sql.DriverManager.getConnection("jdbc:jtds:sqlserver://localhost:1433;databaseName=Intranet;user=sa;password=passwrd");
System.out.println("DSN Connection ok.");
} catch (Exception e) {
System.out.println("DSN Exception: " + e.getMessage());
e.printStackTrace();
}
return conn;
}
}
This was originally using a DSN, but that didn't seem to work (I was getting some interesting behavior) so I've gone to what you see there. I'm getting this error message: Cannot open database "Intranet" requested by the login. The login failed.
For reference on the same server for my asp pages I have the following which is working:
Public Function OpenConnection() As Boolean
Dim connString As String
cnn = New SqlConnection
connString = "server=localhost; uid=sa; pwd=password; database=intranet"
Try
cnn.ConnectionString = connString
cnn.Open()
Return True
Catch ex As SqlException
GlobalClasses.Client_Alert(ex.Message)
Return False
End Try
End Function
I have opened up 1433 on the server so I have no idea what's going on... Any ideas would be greatly appreciated...
--Update 1--
For "fun" I just changed the Database to "Master" and the gosh darn thing "works"... well my query fails because the table it's looking for isn't in Master but the connection is working. I really need to start drinking or something. So it appears that everything is working for for some reason I can't see the database???
--Update 2--
Ok so I change my query figured that would be a good idea right? Nah... So I put in "use Intranet SELECT...." and get "Exception: Database 'Intranet' does not exist. Make sure that the name is entered correctly.". So I did what any good frustrated developer would do and opened up the mgmt studio for SQL Server and went to master and ran the same exact query with the "use..." (yes I cut and pasted it in just to be 100% sure) and imagine that it works. Yet my Java application is still saying it doesn't exist.
I am trying to figure this out not just waiting for an answer...
--Update 3--
Connection string is now:
conn = java.sql.DriverManager.getConnection("jdbc:jtds:sqlserver://localhost:1433/master;user=sa;password=passwrd");
modified 7-Mar-13 10:46am.
|
|
|
|