digitalmars.D - std.file read with start position
- Etienne (4/4) Jun 24 2014 I'm currently brainstorming a persistent database scheme and it
- H. S. Teoh via Digitalmars-d (5/9) Jun 24 2014 std.file? Shouldn't you be looking at std.stdio?
- Etienne (3/10) Jun 24 2014 I did, couldn't find a way to read a specific length (serialized data)
- H. S. Teoh via Digitalmars-d (17/32) Jun 24 2014 Easy:
- Etienne (7/21) Jun 24 2014 Well, that solves it for me ;)
- H. S. Teoh via Digitalmars-d (7/14) Jun 24 2014 Please file a bug in the bugtracker so that we don't forget about this
- H. S. Teoh via Digitalmars-d (12/24) Jun 24 2014 [...]
- Andrei Alexandrescu (4/25) Jun 24 2014 This has been a long-standing issue that I actually fixed a long time
- Jonathan M Davis via Digitalmars-d (4/17) Jun 24 2014 ddoc is very useful, but with regards to links, it _is_ a joke. It has n...
- H. S. Teoh via Digitalmars-d (17/31) Jun 24 2014 [...]
- H. S. Teoh via Digitalmars-d (19/33) Jun 24 2014 [...]
- Etienne Cimon (4/6) Jun 24 2014 Well, that was quick!
- H. S. Teoh via Digitalmars-d (8/18) Jun 25 2014 Quick, but not quite complete:
- Andrei Alexandrescu (5/20) Jun 24 2014 std.file -> files are handled as a unit (file is opened and closed
I'm currently brainstorming a persistent database scheme and it surprised me that random-access reading/writing isn't implemented in std.file. With SSDs becoming more commonplace, this practice is just fine. Any other reason for this?
Jun 24 2014
On Tue, Jun 24, 2014 at 12:23:08PM -0400, Etienne via Digitalmars-d wrote:I'm currently brainstorming a persistent database scheme and it surprised me that random-access reading/writing isn't implemented in std.file. With SSDs becoming more commonplace, this practice is just fine. Any other reason for this?std.file? Shouldn't you be looking at std.stdio? T -- I think the conspiracy theorists are out to get us...
Jun 24 2014
On 2014-06-24 12:56 PM, H. S. Teoh via Digitalmars-d wrote:On Tue, Jun 24, 2014 at 12:23:08PM -0400, Etienne via Digitalmars-d wrote:I did, couldn't find a way to read a specific length (serialized data) so std.file seemed more of a fit for that.I'm currently brainstorming a persistent database scheme and it surprised me that random-access reading/writing isn't implemented in std.file. With SSDs becoming more commonplace, this practice is just fine. Any other reason for this?std.file? Shouldn't you be looking at std.stdio? T
Jun 24 2014
On Tue, Jun 24, 2014 at 01:07:42PM -0400, Etienne via Digitalmars-d wrote:On 2014-06-24 12:56 PM, H. S. Teoh via Digitalmars-d wrote:Easy: auto f = File(myDataFile, "r"); f.seek(someOffset); ubyte[] buf; buf.length = sizeOfData; ubyte[] dataRead = f.rawRead(buf); if (dataRead.length != sizeOfData) throw new Exception("Unexpected truncated data"); // do whatever you want with dataRead Hope this helps. And yes, the documentation should use some improvement. A lot of improvement even. :P Please feel free to submit a pull request, or at least file a bug against the docs. T -- In theory, there is no difference between theory and practice.On Tue, Jun 24, 2014 at 12:23:08PM -0400, Etienne via Digitalmars-d wrote:I did, couldn't find a way to read a specific length (serialized data) so std.file seemed more of a fit for that.I'm currently brainstorming a persistent database scheme and it surprised me that random-access reading/writing isn't implemented in std.file. With SSDs becoming more commonplace, this practice is just fine. Any other reason for this?std.file? Shouldn't you be looking at std.stdio? T
Jun 24 2014
On 2014-06-24 1:46 PM, H. S. Teoh via Digitalmars-d wrote:Easy: auto f = File(myDataFile, "r"); f.seek(someOffset); ubyte[] buf; buf.length = sizeOfData; ubyte[] dataRead = f.rawRead(buf); if (dataRead.length != sizeOfData) throw new Exception("Unexpected truncated data"); // do whatever you want with dataRead Hope this helps. And yes, the documentation should use some improvement. A lot of improvement even. :P Please feel free to submit a pull request, or at least file a bug against the docs. TWell, that solves it for me ;) I think the documentation could use more code samples, and a smarter table of contents. e.g. http://dlang.org/phobos/std_stdio.html clicking on the "read" keyword redirects to... enum LockType.read There's no mention about reading in the struct File; example ugh :/
Jun 24 2014
On Tue, Jun 24, 2014 at 02:07:20PM -0400, Etienne via Digitalmars-d wrote: [...]I think the documentation could use more code samples, and a smarter table of contents. e.g. http://dlang.org/phobos/std_stdio.html clicking on the "read" keyword redirects to... enum LockType.read There's no mention about reading in the struct File; example ugh :/Please file a bug in the bugtracker so that we don't forget about this issue. T -- Acid falls with the rain; with love comes the pain.
Jun 24 2014
On Tue, Jun 24, 2014 at 12:36:12PM -0700, H. S. Teoh via Digitalmars-d wrote:On Tue, Jun 24, 2014 at 02:07:20PM -0400, Etienne via Digitalmars-d wrote: [...][...] P.S. the problem with the table of contents links pointing to the wrong place is a known bug: https://issues.dlang.org/show_bug.cgi?id=11575 This badly needs to be fixed; as things stand, it makes ddoc look like a joke (it generates non-unique HTML element ID's, which both violates the HTML spec and causes erratic browser behaviour when you click on said links). T -- EMACS = Extremely Massive And Cumbersome SystemI think the documentation could use more code samples, and a smarter table of contents. e.g. http://dlang.org/phobos/std_stdio.html clicking on the "read" keyword redirects to... enum LockType.read There's no mention about reading in the struct File; example ugh :/Please file a bug in the bugtracker so that we don't forget about this issue.
Jun 24 2014
On 6/24/14, 12:39 PM, H. S. Teoh via Digitalmars-d wrote:On Tue, Jun 24, 2014 at 12:36:12PM -0700, H. S. Teoh via Digitalmars-d wrote:This has been a long-standing issue that I actually fixed a long time ago in https://github.com/D-Programming-Language/dlang.org/pull/271. Of course, it's now bit rotting in peace. -- AndreiOn Tue, Jun 24, 2014 at 02:07:20PM -0400, Etienne via Digitalmars-d wrote: [...][...] P.S. the problem with the table of contents links pointing to the wrong place is a known bug: https://issues.dlang.org/show_bug.cgi?id=11575 This badly needs to be fixed; as things stand, it makes ddoc look like a joke (it generates non-unique HTML element ID's, which both violates the HTML spec and causes erratic browser behaviour when you click on said links).I think the documentation could use more code samples, and a smarter table of contents. e.g. http://dlang.org/phobos/std_stdio.html clicking on the "read" keyword redirects to... enum LockType.read There's no mention about reading in the struct File; example ugh :/Please file a bug in the bugtracker so that we don't forget about this issue.
Jun 24 2014
Sent: Tuesday, June 24, 2014 at 12:39 PM From: "H. S. Teoh via Digitalmars-d" <digitalmars-d puremagic.com> To: digitalmars-d puremagic.com Subject: Re: std.file read with start position P.S. the problem with the table of contents links pointing to the wrong place is a known bug: https://issues.dlang.org/show_bug.cgi?id=11575 This badly needs to be fixed; as things stand, it makes ddoc look like a joke (it generates non-unique HTML element ID's, which both violates the HTML spec and causes erratic browser behaviour when you click on said links).ddoc is very useful, but with regards to links, it _is_ a joke. It has no understanding of code hierarchy whatsoever, making it just plain stupid when it generates links. - Jonathan M Davis
Jun 24 2014
On Tue, Jun 24, 2014 at 10:23:45PM +0200, Jonathan M Davis via Digitalmars-d wrote:[...]From: "H. S. Teoh via Digitalmars-d" <digitalmars-d puremagic.com>[...] Actually, https://github.com/D-Programming-Language/dmd/pull/1174 appears to have fixed this issue (see also bug 6017). However, the fix is incomplete: it doesn't work with template members, so members of template structs/classes will still get global unqualified anchors instead of qualified anchors. I've traced the problem to src/dmd/doc.c's emitAnchorName() function. It appears that template members' DSymbol nodes have their .parent pointer set to NULL, so it doesn't know to emit the parent template's name. I'm no DMD expert, so if someone could kindly explain to me why this is so, and how I can get at the parent template's name, I should be able to fix this. :-) T -- "Real programmers can write assembly code in any language. :-)" -- Larry WallP.S. the problem with the table of contents links pointing to the wrong place is a known bug: https://issues.dlang.org/show_bug.cgi?id=11575 This badly needs to be fixed; as things stand, it makes ddoc look like a joke (it generates non-unique HTML element ID's, which both violates the HTML spec and causes erratic browser behaviour when you click on said links).ddoc is very useful, but with regards to links, it _is_ a joke. It has no understanding of code hierarchy whatsoever, making it just plain stupid when it generates links.
Jun 24 2014
On Tue, Jun 24, 2014 at 10:23:45PM +0200, Jonathan M Davis via Digitalmars-d wrote: [...][...]From: "H. S. Teoh via Digitalmars-d" <digitalmars-d puremagic.com>[...] Actually, that's not entirely true: https://github.com/D-Programming-Language/dmd/pull/1174 Qualified anchor names have been with us for a while; it's just that the std.algorithm docs haven't been properly updated to reference them correctly. However, pull 1174 leaves out something: https://issues.dlang.org/show_bug.cgi?id=10366 But, have no fear! I've managed to figure out how to fix it: https://github.com/D-Programming-Language/dmd/pull/3693 Once this goes in, ddoc anchors should be *much* saner. While I don't have the confidence this is the last we'll hear of ddoc anchor issues, I think it should improve the situation significantly. T -- They pretend to pay us, and we pretend to work. -- Russian sayingP.S. the problem with the table of contents links pointing to the wrong place is a known bug: https://issues.dlang.org/show_bug.cgi?id=11575 This badly needs to be fixed; as things stand, it makes ddoc look like a joke (it generates non-unique HTML element ID's, which both violates the HTML spec and causes erratic browser behaviour when you click on said links).ddoc is very useful, but with regards to links, it _is_ a joke. It has no understanding of code hierarchy whatsoever, making it just plain stupid when it generates links.
Jun 24 2014
On 2014-06-24 20:33, H. S. Teoh via Digitalmars-d wrote:Once this goes in, ddoc anchors should be*much* saner. While I don't have the confidence this is the last we'll hear of ddoc anchor issues, IWell, that was quick! I might contribute some documentation in phobos, there's obviously a little bit of work to do in there =)
Jun 24 2014
On Tue, Jun 24, 2014 at 10:06:51PM -0400, Etienne Cimon via Digitalmars-d wrote:On 2014-06-24 20:33, H. S. Teoh via Digitalmars-d wrote:Quick, but not quite complete: https://github.com/D-Programming-Language/dmd/pull/3695Once this goes in, ddoc anchors should be*much* saner. While I don't have the confidence this is the last we'll hear of ddoc anchor issues, IWell, that was quick!I might contribute some documentation in phobos, there's obviously a little bit of work to do in there =)Please do, the state of phobos docs in many places are quite sad. Any help in facelifting them would be appreciated. :) T -- Change is inevitable, except from a vending machine.
Jun 25 2014
On 6/24/14, 10:07 AM, Etienne wrote:On 2014-06-24 12:56 PM, H. S. Teoh via Digitalmars-d wrote:std.file -> files are handled as a unit (file is opened and closed within the same function) std.stdio -> files are first-class AndreiOn Tue, Jun 24, 2014 at 12:23:08PM -0400, Etienne via Digitalmars-d wrote:I did, couldn't find a way to read a specific length (serialized data) so std.file seemed more of a fit for that.I'm currently brainstorming a persistent database scheme and it surprised me that random-access reading/writing isn't implemented in std.file. With SSDs becoming more commonplace, this practice is just fine. Any other reason for this?std.file? Shouldn't you be looking at std.stdio? T
Jun 24 2014