Re: Am I doing this right? (File byChunk)

2010-10-14 Thread Andrej Mitrovic
I'll be sure to check it out once I get my phone line back (forgot to pay the bills..). I'm currently on expensive wireless (Why is wireless so expensive anyway? What's so special about radiowaves that were invented half a century ago?..) Thanks for the heads up! On 9/14/10, Jonathan M Davis wr

Re: Am I doing this right? (File byChunk)

2010-09-14 Thread Jonathan M Davis
gmx.com seems to deal with mailing list e-mails correctly (by actually putting the ones you sent to the list in your inbox when they come from the list), and it has free imap and lots of disk space just like gmail (not to mention that it uses proper folders instead of labels), so I've switched o

Re: Am I doing this right? (File byChunk)

2010-09-13 Thread Andrej Mitrovic
That could be a good idea. On Mon, Sep 13, 2010 at 1:09 PM, bearophile wrote: > In byChunk() the content of buffer is reused across calls, so you are not > wasting allocations. I don't know if it's possible to use a fixed-size > char[4096] array to remove the first memory allocation too. I thin

Re: Am I doing this right? (File byChunk)

2010-09-13 Thread Andrej Mitrovic
Yes, because LPARAM is defined in the DFL library as a long. Actually, it's hardcoded, there's no static if or versioning. I'll keep an eye on that for when DMD is able to build 64bit binaries. On Mon, Sep 13, 2010 at 1:09 PM, bearophile wrote: > Andrej Mitrovic: > >> foreach (ubyte[] buf; file.b

Re: Am I doing this right? (File byChunk)

2010-09-13 Thread bearophile
> I think byChunk() needs a second optional argument, to give it a preallocated > buffer (like a slice of a fixed-size array). http://d.puremagic.com/issues/show_bug.cgi?id=4859

Re: Am I doing this right? (File byChunk)

2010-09-13 Thread bearophile
Andrej Mitrovic: > foreach (ubyte[] buf; file.byChunk(4096)) > { > sendEditor(SCI_ADDTEXT, buf.length, cast(LPARAM)buf.ptr); > } > ... > SCI_ADDTEXT(int length, const char *s) Keep in mind that the length of a D array is a size_t, this means a 32 or 64 bit long unsigned word. > The ADDTE

Re: Am I doing this right? (File byChunk)

2010-09-12 Thread Jonathan M Davis
On Sunday 12 September 2010 19:56:28 Andrej Mitrovic wrote: > I prefer 24-hour timestamps, but I've no idea where to set this in > Gmail. And I'm not using a special newsgroup reader because they're > all clumsy in their own little ways. I'm using a gmail account, but I'm using kmail to manage my

Re: Am I doing this right? (File byChunk)

2010-09-12 Thread Andrej Mitrovic
I prefer 24-hour timestamps, but I've no idea where to set this in Gmail. And I'm not using a special newsgroup reader because they're all clumsy in their own little ways. On Mon, Sep 13, 2010 at 4:46 AM, Jonathan M Davis wrote: > On Sunday 12 September 2010 19:31:23 Andrej Mitrovic wrote: >> I w

Re: Am I doing this right? (File byChunk)

2010-09-12 Thread Jonathan M Davis
On Sunday 12 September 2010 19:31:23 Andrej Mitrovic wrote: > I was refering to the open method, or when calling the constructor of > Text. But it doesn't actually *read* the contents until I ask it to > (which is a good thing). In other news it's late and I'm talking crazy > tonight, sorry. :) We

Re: Am I doing this right? (File byChunk)

2010-09-12 Thread Andrej Mitrovic
I was refering to the open method, or when calling the constructor of Text. But it doesn't actually *read* the contents until I ask it to (which is a good thing). In other news it's late and I'm talking crazy tonight, sorry. :) On Mon, Sep 13, 2010 at 4:01 AM, Jonathan M Davis wrote: > On Sunday

Re: Am I doing this right? (File byChunk)

2010-09-12 Thread Andrej Mitrovic
Ah, silly me, disregard that code. I was working around the issue but I didn't have to, here's the correct code: foreach (ubyte[] buf; file.byChunk(4096)) { sendEditor(SCI_ADDTEXT, buf.length, cast(LPARAM)buf.ptr); } Now, the explanation. The sendEditor function takes an opcode (uint), an

Re: Am I doing this right? (File byChunk)

2010-09-12 Thread Jonathan M Davis
On Sunday 12 September 2010 18:04:14 Andrej Mitrovic wrote: > Here's a little snippet of code that interfaces with Scintilla (it works > btw.): > > File file = File("test.txt", "r"); > foreach (ubyte[] buf; file.byChunk(4096)) > { > sendEditor(SCI_ADDTEXT, buf.length, (cast(char[])buf).idup)

Re: Am I doing this right? (File byChunk)

2010-09-12 Thread BCS
Hello Andrej, Here's a little snippet of code that interfaces with Scintilla (it works btw.): File file = File("test.txt", "r"); foreach (ubyte[] buf; file.byChunk(4096)) { sendEditor(SCI_ADDTEXT, buf.length, (cast(char[])buf).idup); } The cast looks ugly, but I *have* to send a copy. What do

Am I doing this right? (File byChunk)

2010-09-12 Thread Andrej Mitrovic
Here's a little snippet of code that interfaces with Scintilla (it works btw.): File file = File("test.txt", "r"); foreach (ubyte[] buf; file.byChunk(4096)) { sendEditor(SCI_ADDTEXT, buf.length, (cast(char[])buf).idup); } The cast looks ugly, but I *have* to send a copy. Am I doing it rig