Jason Marlyn

Ranch Hand
+ Follow
since Jan 13, 2009
Merit badge: grant badges
For More
V.C.
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 Jason Marlyn

How can I open the phone native contact list, in order to select "one" contact (one phone number) from the list.
something like UC when sharing something.

I don't need to have contact list, or a contact entry information.
just selecting a number from the contact list ( native ).
12 years ago
I think I have to swap my eyes
many thanks Joe, I've just got a big help, as you said and according to API the following code may help. does it? I think.

Thanks again.
13 years ago
HI Joe, thanks for helping, well I read the HTTP rfc and it says

The Request-Line begins with a method token, followed by the Request-URI and the protocol version, and ending with CRLF. The elements are separated by SP characters. No CR or LF is allowed except in the final CRLF sequence.


well the CRLF is known as "\r\n" and when I tried to determine the end of the stream with this (Just in GET method)

it has the same result, waiting....
but I tried it like this

it seems work fine (but I cannot bet on it) with get method, when for methods which has body it requires some condition of course.
so the new question is, according to http rfc and spec, how to determine it? I mean CRLF.
13 years ago
Hi Andrey Kozhanov.
well because it's a http server I don't have any hand to handle requests from clients, generally clients are browsers, so as you mentioned, how can I determine that browser(client) stream is completed and getting into the line 14? any solution? is there any standard belong browsers to notify servers about complete incoming stream?
13 years ago
Hi guys, I'm really sorry for this post, but I still couldn't solve my problem.
well as API says, BufferedReader readLine() method returns null if end of the stream (EOS) reached. but it waits, here is my code.

the above code listens on port x and reads the Incoming stream from the client(Browser e.g. FF, IE) and parse it (very simple http server).
generally I'm not wondered using BufferedReader, any solution that help me out to solve this problem, I've tried to use InputStreamReader and InputStream classes but I could not.

my config: winxp sp2(sorry),tested in both JDK1.6.0.20 and Apache harmony 6M2 (same result).
13 years ago
Hi guys. I'm developing a simple http server with java. well when I send (i.e. 13MB) file to server it eats CPU and memory. really terrible. I sore them in ByteBuffer and String classes. the question is which way is best for storing large objects (file, byte stream,...) is it right that store them to a temp file instead of memory?
Thanks.
13 years ago
Hi Mike and Rob. you mentioned very important note. well as you said the ready() method just is useful when only next byte of the stream available. and available() method says how many byte you can buffer that it won't help me anyway. but as you said I started to read the stream with read() method directly. but in low-bandwidth connection it returns -1 (EOS) when I'm sure that the stream is not ready. but readline() method from buffered reader, reads a line well, but as I said sometimes it works crazy when EOS is reached.
generally I cannot trust read() method and according to API if I can combine two ready() and read() method together to ensure that next byte is ready for read, may my problem will be solved. I don't know. except my solution, what's you solution about this problem? thanks
Sorry Mike I've got mistake while I was typing, yes InputStream doesn't have any ready() method, it's for Reader interface.
13 years ago
Hi Alex. I mean which object (component) is used most memory usage?
13 years ago
hi guys. I'm wonder about BufferedReader and it's stream ready state. I mean does BufferedReader (readline() method) take care of ready state of incoming stream or not? because when I try to read stream with InputStream or InputStreamReader I have to check the ready state of the stream (ready() method) before begin reading the stream (read() method), I've faced with kinda this issue when the connection between two node is provided with a low-bandwidth connection.
according to API and my tests it seems take care of ready state (just readline() method) but API says it will returns null when end of the stream (EOF) is reached but sometimes it cannot work well, it seems data is blocked. I don't know.
I parse the Socket incoming stream.
My JVM version is 1.6.0.16 (OS: windxp sp2, x86 and win2003).
Thnaks
13 years ago
Hi guys, I'm weak in j2me and I've tried to create my first application and I've faced with a issue, it's not really a issue it's more like a question, anyway, I'd would to know, what is the most heavy class(interface implemented) in j2me classes? such a Ticker or Alert, I don't know. so please help me out with this issue. thanks
13 years ago
Sorry Jim, as I said I found a solution then I introduced it to Sockets guys and we found that the solution won't okay for low-bandwidth connection, then I tested this solution (edited above syntax [sorry for formatting]), well as Henry mentioned it's not possible to implement it with wait and notify, so I tried it with empty statement instead of wait and notify, the question is that it's okay that I use semi-intolerable loop instead of wait(), and according to my profile, deposit yield() method it friends with CPU. Sorry for terrible syntax.
Thanks
Sify, I'm not expert in Threads. and I haven't worked with JExcel. the whole of the work can be like this that, create 3 or n thread (according to your files) with a controller(main) thread and start them(main starts other), and then it's dependence on your business that how do you want combine these files, row by row? sheet by sheet? (i.e. row by row.), the main thread reads a row of each thread an put it in the target file. I think you have to synchronize threads, and communicate with them with wait() and notify() guys. anyway Threading guys would help you better.
wow,wow,wow, hi guys, it's me again, sorry for my pertness, anyway, I've tried this guy and it works okay and, is friend with CPU(I think), but it's recommended you Threading guys accept this solution. is this solution okay or not?is it right way?
thanks

what's your Idea? thanks.
Wow, new issue, Rob you said it right and mentioned an important point Thanks. as I said I face with new issue after find a solution. the combination of available and read method won't work(okay) for low-bandwidth connection. in fact it's not certain that incoming connection has stream or not. it requires something like wait(), I don't know, I introduced this problem with InputStreamReader class which has a method called ready() that take care of these problems for thread and synch guys. they told me there is not a standard way to synchronize the incoming stream, (using best solution wait and notify). now the problem is that server should wait for incoming stream and check it that it's empty or has content. for better understanding my issue imagine a HTTP server. any help, any solution, Thanks.
Rob, I've tried it with available() method and read(), and it works cool, well the problem is with incoming stream, the outputstream is okay, and mention that, the IOException will be thrown whenever the socket, incoming or, output stream is closed. the problem is looks solved till I find new issue of course. Thank you Rob, you mentioned an important point which a server application should care of it.
Thanks. I will reply this thread whenever I face with new issue.