digitalmars.D.learn - DFL, Progress Bar, and how to use it against a download
- Lester L. Martin II (6/6) Nov 17 2007 Hello,
- Lester L. Martin II (4/11) Nov 17 2007 Or tango's httpclient; I think I know how I'm just not sure that when yo...
- Chris Miller (5/28) Nov 17 2007 Not sure about Tango, but with the DFL ProgressBar, you can set the
- Lester L. Martin II (4/38) Nov 18 2007 So are you using phobos or your own socket implementation.
- Lester L. Martin II (22/64) Nov 18 2007 Wait now I think I see a way.
Hello, I could probably figure this out if I actually put some time to it but I seldom have enough time to think such through perfectly. My question is how do you use DFL's progress bar with Tango's HTTPget and display a progress. If anyone has an answer I would love to see it as this is going to be needed really bad in the project I'm working on(maybe others will join) and I'd rather not spend a whole day implementing this perfectly when their is already a way to do it so I can put my attention to more important things. Thanks in advance, Lester L. Martin II
Nov 17 2007
Lester L. Martin II Wrote:Hello, I could probably figure this out if I actually put some time to it but I seldom have enough time to think such through perfectly. My question is how do you use DFL's progress bar with Tango's HTTPget and display a progress. If anyone has an answer I would love to see it as this is going to be needed really bad in the project I'm working on(maybe others will join) and I'd rather not spend a whole day implementing this perfectly when their is already a way to do it so I can put my attention to more important things. Thanks in advance, Lester L. Martin IIOr tango's httpclient; I think I know how I'm just not sure that when you call read with the delegate and length will read call the delegate and supply the array of specified length and do so until it gets through or will it read that length and stop and wait for you to call read again. If anyone has an example with HttpClient and the delegate read thing I described I'd love to see it. If it does require to call read more than once, how do you check that you have read everything and there is nothing more to read. Lester L. Martin II
Nov 17 2007
On Sat, 17 Nov 2007 11:11:38 -0500, Lester L. Martin II <Lester ewam-associates.com> wrote:Lester L. Martin II Wrote:Not sure about Tango, but with the DFL ProgressBar, you can set the 'maximum' property to the file size and update the 'value' property to the current size downloaded.Hello, I could probably figure this out if I actually put some time to it but I seldom have enough time to think such through perfectly. My question is how do you use DFL's progress bar with Tango's HTTPget and display a progress. If anyone has an answer I would love to see it as this is going to be needed really bad in the project I'm working on(maybe others will join) and I'd rather not spend a whole day implementing this perfectly when their is already a way to do it so I can put my attention to more important things. Thanks in advance, Lester L. Martin IIOr tango's httpclient; I think I know how I'm just not sure that when you call read with the delegate and length will read call the delegate and supply the array of specified length and do so until it gets through or will it read that length and stop and wait for you to call read again. If anyone has an example with HttpClient and the delegate read thing I described I'd love to see it. If it does require to call read more than once, how do you check that you have read everything and there is nothing more to read. Lester L. Martin II
Nov 17 2007
Chris Miller Wrote:On Sat, 17 Nov 2007 11:11:38 -0500, Lester L. Martin II <Lester ewam-associates.com> wrote:So are you using phobos or your own socket implementation. How would you use the socket for a HTTP connection if you are using sockets in you example. Lester L. Martin IILester L. Martin II Wrote:Not sure about Tango, but with the DFL ProgressBar, you can set the 'maximum' property to the file size and update the 'value' property to the current size downloaded.Hello, I could probably figure this out if I actually put some time to it but I seldom have enough time to think such through perfectly. My question is how do you use DFL's progress bar with Tango's HTTPget and display a progress. If anyone has an answer I would love to see it as this is going to be needed really bad in the project I'm working on(maybe others will join) and I'd rather not spend a whole day implementing this perfectly when their is already a way to do it so I can put my attention to more important things. Thanks in advance, Lester L. Martin IIOr tango's httpclient; I think I know how I'm just not sure that when you call read with the delegate and length will read call the delegate and supply the array of specified length and do so until it gets through or will it read that length and stop and wait for you to call read again. If anyone has an example with HttpClient and the delegate read thing I described I'd love to see it. If it does require to call read more than once, how do you check that you have read everything and there is nothing more to read. Lester L. Martin II
Nov 18 2007
Lester L. Martin II Wrote:Chris Miller Wrote:Wait now I think I see a way. auto pb = new ProgressBar(); auto client = new HttpClient(HttpClient.Get, "http://www.yahoo.com"); client.open(); if (client.isResponseOK) { // extract content length auto length = client.getResponseHeaders.getInt (HttpHeader.ContentLength, uint.max); pb.maximum(length); client.read(&sink, length); } then the sink void sink(void[] content) { //assuming file is inside class; file.write(content); pb.value = content.length; } is there somewhere I messed up( such as I don't know if you can get the size of a void array, or should I have a loop that gets it maybe 10 bytes(whatever it measures by) at a time). Thanks for all your help. Lester L. Martin IIOn Sat, 17 Nov 2007 11:11:38 -0500, Lester L. Martin II <Lester ewam-associates.com> wrote:So are you using phobos or your own socket implementation. How would you use the socket for a HTTP connection if you are using sockets in you example. Lester L. Martin IILester L. Martin II Wrote:Not sure about Tango, but with the DFL ProgressBar, you can set the 'maximum' property to the file size and update the 'value' property to the current size downloaded.Hello, I could probably figure this out if I actually put some time to it but I seldom have enough time to think such through perfectly. My question is how do you use DFL's progress bar with Tango's HTTPget and display a progress. If anyone has an answer I would love to see it as this is going to be needed really bad in the project I'm working on(maybe others will join) and I'd rather not spend a whole day implementing this perfectly when their is already a way to do it so I can put my attention to more important things. Thanks in advance, Lester L. Martin IIOr tango's httpclient; I think I know how I'm just not sure that when you call read with the delegate and length will read call the delegate and supply the array of specified length and do so until it gets through or will it read that length and stop and wait for you to call read again. If anyone has an example with HttpClient and the delegate read thing I described I'd love to see it. If it does require to call read more than once, how do you check that you have read everything and there is nothing more to read. Lester L. Martin II
Nov 18 2007