|
Hi guys, I think I'm going to lose my mind with this, I cant make my chunked transfer manager to work right.
The problem I'm having is that reading the amount of data specified in the chunk-size, I end up having the next chunk size inside the body, so, when I call the next getchunksize, it fails.
The first call to getChunkSize() works great and I get the size value as expected.
The BufferedReader is connected to the sock
<br />
s = new Socket(connectTo, portNum);<br />
sIn = new BufferedReader(new InputStreamReader(s.getInputStream()) );<br />
Thanks a lot guys, I hope any of you understands what's going on...
<br />
private String processChunked(BufferedReader sIn, String newData) throws IOException {<br />
<br />
newData += LINEBREAK;
<br />
int size = 0;<br />
String body = new String();<br />
<br />
size = getChunkSize(sIn);<br />
<br />
while(size > 0) {<br />
<br />
body = getChunkData(sIn, size); <br />
size = getChunkSize(sIn);<br />
<br />
newData += body;<br />
body = "";<br />
<br />
}<br />
<br />
return newData;<br />
<br />
}<br />
<br />
private String getChunkData(BufferedReader sIn, int lenght) throws IOException {<br />
<br />
int val = 0;<br />
String res = new String();<br />
char chr = ' ';<br />
<br />
for(int i= 0; i<lenght; i++)="" {<br="" mode="hold" /> <br />
val = sIn.read();<br />
<br />
if(val == -1)<br />
break;<br />
<br />
chr = (char)val;<br />
<br />
res += Character.valueOf(chr).toString();<br />
<br />
}<br />
<br />
<br />
return res;<br />
}<br />
<br />
private int getChunkSize(BufferedReader sIn) throws IOException {<br />
<br />
char chr = ' ', prvChr = ' ';<br />
int val = 0;<br />
String tmpSize = new String();<br />
int size = 0;<br />
int readed = 0;<br />
<br />
do {
<br />
prvChr = chr;<br />
val = sIn.read();<br />
<br />
if (val == -1) {<br />
break;<br />
}<br />
<br />
readed++;<br />
<br />
chr = (char) val;<br />
<br />
tmpSize += Character.valueOf(chr).toString();<br />
<br />
} while (prvChr != '\r' && chr != '\n');<br />
<br />
<br />
if(tmpSize.indexOf(";") != -1) {
tmpSize = tmpSize.substring(0, tmpSize.indexOf(";"));<br />
}<br />
<br />
tmpSize = tmpSize.trim();<br />
<br />
try {<br />
size = Integer.valueOf(tmpSize, 16); <br />
} catch (NumberFormatException e) {<br />
size = 0;<br />
}<br />
<br />
return size;<br />
}<br />
<br />
|
|
|
|
|
hey. i need help LOTS herE!
can anyone explain to me what delta compiler is?
how does it work?
How do i modify a programme codes?
trawler is a programme that runs on pc.
so what is the programme that runs in trawler?
if i'm not mistaken, it's Delta.
can somebody explain to me what is it??
seha
|
|
|
|
|
For more details and orderliness,here gives items to show what I want a program A could do these:
1.Supervise how much memory the program B consumed.If the program B was running and allocated memory exceeded the speciafied number,then report back to screen.
2.Restrict the priority of accessing the files out of its directory/folder to program B.Avoid running the dangerous code like system("reboot") from programs.
3.Kill the Process B if there includes any code lead to never finish running.e.g while(1){}.Of course,if a legal program run out time will be also killed.
4.How can I capture these above return messages,e.g Runtime error,stack overflow,Memory Limit Exceed.So much information just for users.
Note:This is very similar to a online judge system.
Thanks In Advance.
no cross no crown.
|
|
|
|
|
as long as your "judge" doesn't go inspect the binary code directly in the .class file, i don't really think most of your points can be done.
btw: No need to REPOST !!! this is a forum, not a chat, so please be patient
|
|
|
|
|
How wud i make an RSS Reader in Java. Provided tht i have to make an interface in Java too by using AWT or swing.... ?
|
|
|
|
|
|
Why would you use java to compile C/C++ ?¡
And for what you want to do (full control over the compilation) you should resort to something like make and predefine each and every step in the process, and calling the makefile in your exec(...)
Don't you also love the code?
|
|
|
|
|
Please help me!!
I need to loop through all my textboxes in a contentpage.
I saw an article on internet, but in the code was a form tag which I do not have in my masterpage.
Can you please provide me some code, how to loop through my textboxes in a contentpage to look for the backgroundcolor of the textbox?
Thanks in advance for helping a beginner in Javascript!!
Dennis
|
|
|
|
|
]]>
this is my database connection
public ResultSet getUnique() throws SQLException{
try{
getDBConnection();
stmt = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
ResultSet.CONCUR_READ_ONLY);
query="SELECT url,SUM(data_received) xyz FROM logs GROUP BY url ORDER BY SUM(data_received) desc";
System.out.println("\nExecuting query: " + query);
rset = stmt.executeQuery(query);
}
catch (SQLException ex) {
logException(ex);
conn.rollback();
}
return rset;
}
the problem here is on web page message displayed is invalid column what is wrong?
|
|
|
|
|
i have written a program which should be run after certain time
i have wriiten .properties file where in i am specifying the path of the java program
this is my .properties file
# Timer for thread to sleep
thread.sleep = 9000
# To run the thread as daemon process
thread.run = true
# Copy command
thread.cmd = java abc
is this a correct way.
|
|
|
|
|
Hi everybody!
has anybody tried to change the ntfs-security on a win-xp system using java and wmi?
the problem: i can retrieve the win32_securitydescriptor, but a can't change(or writeback) the dacl.
thanx for a example or tip!
modified on Monday, April 28, 2008 8:17 AM
|
|
|
|
|
i want to include the functionality of right click option in my java code..
meaning...
if i right click on a .txt then it shows Open,print,edit..soon options from that i want to call one option with my java code.
any help???
-Jazz
|
|
|
|
|
I have been tasked with creating a thumbnail page that when a member clicks on the thumbnail it opens the image in a new window with all bars disabled, right clicking disabled, no status bar, no ability to resize, etc. The window should be 350x250. We want to do this without having to create any extra pages beyond the thumbnail page. I have a script already that opens the images in a new window with everything but right clicking disabled/gone. I know most people say don't disable right click, but it is on a secured members only site and we are showing possabilities for our membership to use as the mast heads for their new websites and we don't want them to be able to save the images.
|
|
|
|
|
I am developing some web pages in which iam using a java applet. so far the intended user are supposed to be using Internet Explorer 7. the problem i am facing is that when i press the tab key within the applet. the control get transferred to new tab position in the web page outside the applet and i have to click back to the applet to get control again transferred to the applet.
i want to restrict the control of tab so that when tab is pressed within the applet the tab should not move to next tab position in the page and remain confined within the applet.
Can someone please help me how can i achieve this and whether i have to do coding for it in the applet or in the web page...so that within the applet the Internet Explorer tab control should remain disabled..
|
|
|
|
|
Please can any one tell me how to create an audio plugin in Java or in any software...urgent!! plz...
|
|
|
|
|
I am ducanh.
I am leaning Java.
i need check Form register but i dont understand
cant you send me some code check form ?
Thank you.
email: ducanhthanhhoa.vn@gmail.com
|
|
|
|
|
Hi..
I am searching for java codes that uses JAVA NATIVE INTERFACE (JNI) for opening MSWORD 2003.
To be brief.
I created HTML form called Employee_data.
if i click on Submit button a word document should be opened.This should be using JNI.
I have also created a servlet in jsp to process the form data and store it into database(mysql).;
Please help me to find the codes to open MSWORD on submit click and to write the database entries into word file.Can i get the full code for that.This is so urgent.
Thanks in advance.
|
|
|
|
|
|
I m working for project in Java. It works like answering machine for telephone. But when all connection(modem, telephone)are done and after trying to run it shows Above screen.
Please tell me someone what is problem in connections.
Terminal is Physical endpoint of connection.
i'm confused it is argent
|
|
|
|
|
Hi,
I have to display UP and Down arrows in the JSP,in such a way that if the user selects the Up arrow then the selected row should move up and the above row should move down and the arrows displaying must change with respect to their positions.Like the first row sould come up with only DOWN arrow and middle rows with UP and Down arrows and last row with UP arrow.
Please can anyone help me out in solving.
Waiting for your replies..
Thanks.
|
|
|
|
|
Hi,
I have developed couple of java utilities (.jar) for java enabled mobiles.
1. Digit.jar
2. Muhurt.jar
These utilities are developed using J2ME SDK.
For more details and download these utilities please visit
Thanks,
Sandeep
modified on Thursday, April 24, 2008 1:31 AM
|
|
|
|
|
Hi,
It should be possible to get the scoll lock key status(ON or OFF) in javascript. any one help me out.
thanks in advance!
Have A Nice Day!
Murali.M
|
|
|
|
|
Like this:
scrollLockStatus=confirm("Please click OK if scroll lock is on, CANCEL if it is off.");
allwrong.wordpress.com[^]
|
|
|
|
|
First, I see that java isn't a topic of much discussion. Is there any place on CP that has real articles on java programming?
Onto my question,
I am semi-familiar with threads in java. At least with running a single one.
class whatever implments Runnable{
public void init(){
Thread t=new Thread(this);
t.start(); //starts(obviously) the thread, calling run()
}
public void run(){
//this is where the code in my thread goes
}
}
So what if you want two threads at the same time? Say...Thread t1 and t2. Because I don't see a way of differentiating the different run() functions once t1.start() and t2.start() were called. Any input on how to do this? Thanks
Chris
-- modified at 21:39 Wednesday 10th May, 2006
|
|
|
|
|
You probably figured this out by now
But just to keep this secret place alive:
class Thread1 implements Runnable
{
public void run()
{
System.out.println("Thread 1 running");
}
}
class Thread2 implements Runnable
{
public void run()
{
System.out.println("Thread 2 running");
}
}
class Program
{
public static void main(string[] args)
{
try
{
Thread thread1 = new Thread(new Thread1());
thread1.start();
Thread thread2 = new Thread(new Thread2());
thread2.start();
}
catch(Exception e)
{
System.error.println(e);
}
}
}
"God doesn't play dice" - Albert Einstein
"God not only plays dice, He sometimes throws the dices where they cannot be seen" - Niels Bohr
|
|
|
|