|
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.
|
|
|
|
|
Ok, combo of hatred of M$ and Java here.... apparently when I installed Visual Studio Web edition or IIS it put a copy of SQL Server 2008 Express and Java was nice enough to grab that one vs the 2012 which Visual studio was... Stopped the service for 2008 and now it's working... I'm going to go grab a drink now.
|
|
|
|
|
Hi I have one production issue related to database connection.
Earlier it was a single threaded now other team migrated to Multithreaded application. After migration we have some production related to database connectivity when we perform more operations.
Please find the below logs and hibernate config xml file.
Could some one help me to fix this issue.
Error logs :----
2013-03-01 10:23:53,803 (pool-2-thread-5) [DEBUG] CacheTranscodeManagerImpl - files copied from /opt/transcode/transcode/cache/SN-API-COMCAST_NATIONAL-HD-NC/3DBE3E900937F028BE397C9158CF8510 to /opt/transcode/transcode/output/559311
2013-03-01 10:23:54,449 (pool-2-thread-5) [WARN ] JDBCExceptionReporter - SQL Error: 0, SQLState: null
2013-03-01 10:23:54,449 (pool-2-thread-5) [ERROR] JDBCExceptionReporter - Connection is closed.
2013-03-01 10:23:54,449 (pool-2-thread-5) [ERROR] AbstractFlushingEventListener - Could not synchronize database state with session
org.hibernate.exception.GenericJDBCException: could not update: [com.scrippsnetworks.transcode.model.TranscodeCache#248019]
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2425)
at org.hibernate.persister.entity.AbstractEntityPersister.updateOrInsert(AbstractEntityPersister.java:2307)
at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2607)
at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:92)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:248)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:232)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:140)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
at org.springframework.orm.hibernate3.HibernateTemplate$27.doInHibernate(HibernateTemplate.java:801)
at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:362)
at org.springframework.orm.hibernate3.HibernateTemplate.flush(HibernateTemplate.java:799)
at com.scrippsnetworks.transcode.dao.impl.TranscodeCacheDaoImpl.saveTranscodeCache(TranscodeCacheDaoImpl.java:36)
at com.scrippsnetworks.transcode.service.impl.TranscodeCacheManagerImpl.saveTranscodeCache(TranscodeCacheManagerImpl.java:22)
at com.scrippsnetworks.transcode.service.impl.CacheTranscodeManagerImpl.getTranscodeResult(CacheTranscodeManagerImpl.java:201)
at sun.reflect.GeneratedMethodAccessor178.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:318)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:203)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:162)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:209)
at $Proxy23.getTranscodeResult(Unknown Source)
at com.scrippsnetworks.transcode.service.CacheRunner.run(CacheRunner.java:42)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.sql.SQLException: Connection is closed.
at org.apache.commons.dbcp.DelegatingConnection.checkOpen(DelegatingConnection.java:291)
at org.apache.commons.dbcp.DelegatingConnection.prepareStatement(DelegatingConnection.java:183)
at org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.prepareStatement(PoolingDataSource.java:278)
at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:505)
at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:94)
at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:87)
at org.hibernate.jdbc.AbstractBatcher.prepareBatchStatement(AbstractBatcher.java:222)
at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2354)
... 29 more
2013-03-01 10:23:54,452 (pool-2-thread-5) [ERROR] JDBCTransaction - Could not toggle autocommit
java.sql.SQLException: Connection is closed.
at org.apache.commons.dbcp.DelegatingConnection.checkOpen(DelegatingConnection.java:291)
at org.apache.commons.dbcp.DelegatingConnection.setAutoCommit(DelegatingConnection.java:268)
at org.apache.commons.dbcp.PoolingDataSource$PoolGuardC
Hibernate config xml :-
<bean id="dataSourceTS" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="url"><value>${jdbc.url}</value></property>
<property name="username"><value>${jdbc.username}</value></property>
<property name="password"><value>${jdbc.password}</value></property>
<property name="driverClassName"><value>${jdbc.driver}</value></property>
<property name="maxActive" value="100"/>
<property name="maxIdle" value="30"/>
<property name="maxWait" value="1000"/>
<property name="defaultAutoCommit" value="true"/>
<property name="removeAbandoned" value="true"/>
<property name="removeAbandonedTimeout" value="60"/>
</bean>
thanks in advance.
Thanks
Ravindra Reddy
|
|
|
|
|
Hello,
try specifying the instance parameter in connection string. Following text is extracted from the JTDS FAQ. SQL Server can run multiple so-called "named instances" (i.e. different server instances, running on different TCP ports) on the same machine. When using Microsoft tools, selecting one of these instances is made by using "<host_name>\<instance_name>" instead of the usual "<host_name>". With jTDS you will have to split the two and use the instance name as a property.
Regards,
Prasad P. Khandekar
Knowledge exists, man only discovers it.
|
|
|
|
|
I have problem for creating invoice
like OpenERP invoice
any one can help me?
|
|
|
|
|
This is not a well framed question! We cannot work out what you are trying to do/ask from the post.
You need to elaborate and be specific on what are you trying to do and where are you stuck. Use the "Edit" link to edit your question and provide better information.
|
|
|
|
|
hi friends, please assist me with a game that has 5 marbles(balls)and marbles are hit with a paddle and roll on the panel and drop to a circular hole.......in java
thanks
|
|
|
|
|
What help exactly? If you are expecting someone to write this for you then you will be disappointed. If you are looking for useful samples then go to the CodeProject Articles section[^].
Use the best guess
|
|
|
|
|
Hello,
I have a project that must use the artificial immune system as a method of classification.
I've asked my questions on other forums, but no large numbers of people who have used this method.
So please, someone he already used the AIS?
I depend on your support please for my project entitled:
"Application of the immune system for recognizing artificial
forms; the Arabic Script"
|
|
|
|
|
|
Hello,
I have a project that must use the artificial immune system as a method of classification.
I've asked my questions on other forums, but no large numbers of people who have used this method.
So please, someone he already used the AIS?
I depend on your support please for my project entitled:
"Application of the immune system for recognizing artificial
forms; the Arabic Script"
|
|
|
|