Re: std.stdio.File.seek error

2016-03-13 Thread stunaep via Digitalmars-d-learn
It seems my lacking knowledge of C has gotten the best of me and longs in C only have a signed int range? It looks like in C, fseeko() is needed on linux and _fseeki64() is needed on windows, but I dont see either of these in stdc.stdio.

Re: std.stdio.File.seek error

2016-03-13 Thread stunaep via Digitalmars-d-learn
On Monday, 14 March 2016 at 03:07:05 UTC, Nicholas Wilson wrote: On Monday, 14 March 2016 at 00:12:46 UTC, stunaep wrote: On Sunday, 13 March 2016 at 12:21:11 UTC, Nicholas Wilson wrote: [...] I'm on 64 bit but it needs to work on both. It works for anything between 0 and 2147483647.

Re: Where do I learn to use GtkD

2016-03-13 Thread Gerald via Digitalmars-d-learn
On Sunday, 13 March 2016 at 19:53:35 UTC, karabuta wrote: On Sunday, 13 March 2016 at 19:34:36 UTC, WebFreak001 wrote: and in the (not quite complete) documentation you can find widgets you might want to use. Its a great place for getting ideas on which widgets to use imo.

Re: Where do I learn to use GtkD

2016-03-13 Thread Gerald via Digitalmars-d-learn
On Sunday, 13 March 2016 at 19:28:57 UTC, karabuta wrote: Any help on where I can get better leaning materials(GtkD)? Repo, blogs post, etc please I starting learning both D and GTK back in October, I found that a combination of looking at an example D GtkD app, Grestful

Re: std.stdio.File.seek error

2016-03-13 Thread Nicholas Wilson via Digitalmars-d-learn
On Monday, 14 March 2016 at 00:12:46 UTC, stunaep wrote: On Sunday, 13 March 2016 at 12:21:11 UTC, Nicholas Wilson wrote: On Sunday, 13 March 2016 at 10:32:41 UTC, stunaep wrote: I have a very large file I need to read data from at certain positions, but I have run into this error [...] when

Re: Programming in D vs The D Programming Language

2016-03-13 Thread Ali Çehreli via Digitalmars-d-learn
On 03/13/2016 02:40 PM, Saša Janiška wrote: >> quality of the softcover by CreateSpace > Have you seen this one: > > http://www.amazon.com/gp/customer-reviews/R1WWT9EIV3UDI0/ref=cm_cr_arp_d_rvw_ttl?ie=UTF8=0692599436 Yes, I had seen that one. It is unfortunate... :-/ >> I've gone all the

Re: std.stdio.File.seek error

2016-03-13 Thread stunaep via Digitalmars-d-learn
On Sunday, 13 March 2016 at 12:21:11 UTC, Nicholas Wilson wrote: On Sunday, 13 March 2016 at 10:32:41 UTC, stunaep wrote: I have a very large file I need to read data from at certain positions, but I have run into this error std.conv.ConvOverflowException@std\conv.d(1328): Conversion positive

Re: How to return a const handle (view) to a mutable member of an agregate

2016-03-13 Thread anonymous via Digitalmars-d-learn
On Sunday, 13 March 2016 at 22:34:54 UTC, Chris Wright wrote: In theory, it can't be modified. As a practical matter, unions and casts will allow people to modify it. Saying that it *can't* be modified is slightly besides the point, yeah. It *must* not be modified. Casting away const and then

Re: How to return a const handle (view) to a mutable member of an agregate

2016-03-13 Thread Chris Wright via Digitalmars-d-learn
On Sun, 13 Mar 2016 21:14:59 +, anonymous wrote: > On Sunday, 13 March 2016 at 20:10:57 UTC, Basile B. wrote: >> ref const(Array!Type) view(){} >> >> Unless the result is explicitly cast later it can't me modified. > > No, it can't be modified, period. Casting away const and then mutating >

Re: Programming in D vs The D Programming Language

2016-03-13 Thread Saša Janiška via Digitalmars-d-learn
Ali Çehreli writes: > You may find that D has changed since TDPL was printed but it's still > a great read. In some places it explains tradeoffs in language design > in general. Yeah, I like, based on what I've seen some portions which explains 'why'. > PiD starts as a

Re: Is D a good choice for embedding python/octave/julia

2016-03-13 Thread Laeeth Isharc via Digitalmars-d-learn
On Sunday, 13 March 2016 at 18:42:59 UTC, Bastien wrote: The sticking point is unless I commit the rest of my life to maintaining this software, I can't write it all in D. The algorithms change/are improved yearly; the output format from the instrument changes once in a while and therefore

Re: How to return a const handle (view) to a mutable member of an agregate

2016-03-13 Thread anonymous via Digitalmars-d-learn
On Sunday, 13 March 2016 at 20:10:57 UTC, Basile B. wrote: ref const(Array!Type) view(){} Unless the result is explicitly cast later it can't me modified. No, it can't be modified, period. Casting away const and then mutating is not allowed, it has undefined behavior.

Re: How to list all version identifiers?

2016-03-13 Thread Iakh via Digitalmars-d-learn
On Sunday, 13 March 2016 at 20:16:36 UTC, Basile B. wrote: On Sunday, 13 March 2016 at 16:28:50 UTC, Iakh wrote: On Sunday, 13 March 2016 at 15:50:47 UTC, Basile B. wrote: trivial answer, let's say you have dcd-server running in the background: dcd-client -c8 <<< "version(" Thanks. Will

Re: How to return a const handle (view) to a mutable member of an agregate

2016-03-13 Thread ParticlePeter via Digitalmars-d-learn
On Sunday, 13 March 2016 at 20:28:33 UTC, JR wrote: On Sunday, 13 March 2016 at 20:13:03 UTC, Basile B. wrote: On Sunday, 13 March 2016 at 20:10:57 UTC, Basile B. wrote: [...] Basile beat me to it. Yes, ref const(Array!T) accessor. http://dpaste.dzfl.pl/cb2bc5cf9917 Thank you very much,

Re: How to return a const handle (view) to a mutable member of an agregate

2016-03-13 Thread JR via Digitalmars-d-learn
On Sunday, 13 March 2016 at 20:13:03 UTC, Basile B. wrote: On Sunday, 13 March 2016 at 20:10:57 UTC, Basile B. wrote: [...] Basile beat me to it. Yes, ref const(Array!T) accessor. http://dpaste.dzfl.pl/cb2bc5cf9917

Re: How to list all version identifiers?

2016-03-13 Thread Basile B. via Digitalmars-d-learn
On Sunday, 13 March 2016 at 16:28:50 UTC, Iakh wrote: On Sunday, 13 March 2016 at 15:50:47 UTC, Basile B. wrote: trivial answer, let's say you have dcd-server running in the background: dcd-client -c8 <<< "version(" Thanks. Will try. But it was a joke actually. It works but this is not

Re: How to return a const handle (view) to a mutable member of an agregate

2016-03-13 Thread Basile B. via Digitalmars-d-learn
On Sunday, 13 March 2016 at 20:10:57 UTC, Basile B. wrote: Unless the result is explicitly cast later it can't me modified. import std.stdio, std.container.array; struct Foo { private Array!int arr; ref const(Array!int) view() { return arr; } } void main(string[]

Re: How to return a const handle (view) to a mutable member of an agregate

2016-03-13 Thread Basile B. via Digitalmars-d-learn
On Sunday, 13 March 2016 at 19:37:42 UTC, ParticlePeter wrote: I have a struct that privately warps an std.container.array. I would like to return a read-only reference of this array, it should not be duplicated. How can I do this? Cheers, ParticlePeter ref const(Array!Type) view(){}

Re: Where do I learn to use GtkD

2016-03-13 Thread karabuta via Digitalmars-d-learn
On Sunday, 13 March 2016 at 19:34:36 UTC, WebFreak001 wrote: On Sunday, 13 March 2016 at 19:28:57 UTC, karabuta wrote: Any help on where I can get better leaning materials(GtkD)? Repo, blogs post, etc please there isn't much about GtkD specificly, but as a start there is this:

How to return a const handle (view) to a mutable member of an agregate

2016-03-13 Thread ParticlePeter via Digitalmars-d-learn
I have a struct that privately warps an std.container.array. I would like to return a read-only reference of this array, it should not be duplicated. How can I do this? Cheers, ParticlePeter

Re: Where do I learn to use GtkD

2016-03-13 Thread WebFreak001 via Digitalmars-d-learn
On Sunday, 13 March 2016 at 19:28:57 UTC, karabuta wrote: Any help on where I can get better leaning materials(GtkD)? Repo, blogs post, etc please there isn't much about GtkD specificly, but as a start there is this: https://sites.google.com/site/gtkdtutorial/ If you get the basics from

Where do I learn to use GtkD

2016-03-13 Thread karabuta via Digitalmars-d-learn
Gtk3 from python3 has got I nice book with examples that are not so advanced but enough to get you doing real work(from a beginner point of view). GtkD seem to have changed the API structure compared to python3 Gtk3 and the demo examples just "show-off" IMO :). The documentation is really^ not

Re: Is D a good choice for embedding python/octave/julia

2016-03-13 Thread Bastien via Digitalmars-d-learn
On Sunday, 13 March 2016 at 18:12:07 UTC, cym13 wrote: On Sunday, 13 March 2016 at 13:02:16 UTC, Bastien wrote: Hi, apologies for what may be a fairly obvious question to some. ## The background: I have been tasked with building software to process data output by scientific instruments for

Re: Is D a good choice for embedding python/octave/julia

2016-03-13 Thread cym13 via Digitalmars-d-learn
On Sunday, 13 March 2016 at 13:02:16 UTC, Bastien wrote: Hi, apologies for what may be a fairly obvious question to some. ## The background: I have been tasked with building software to process data output by scientific instruments for non-experts - basically with GUI, menus, easy config

Re: Get address of object in constructor.

2016-03-13 Thread Adam D. Ruppe via Digitalmars-d-learn
On Sunday, 13 March 2016 at 16:16:55 UTC, MGW wrote: void* thisAddr = cast(void*) This doesn't really make sense anyway, this is a local variable, you want to do cast(void*) this in a class if you need the address (which btw, you shouldn't actually, the reference itself ought to be enough)

Re: Programming in D vs The D Programming Language

2016-03-13 Thread Ali Çehreli via Digitalmars-d-learn
On 03/13/2016 09:27 AM, gour wrote: > a) how much is Andrei's book still relevant? You may find that D has changed since TDPL was printed but it's still a great read. In some places it explains tradeoffs in language design in general. > b) whether PiD is recommended one to start with D

Re: Programming in D vs The D Programming Language

2016-03-13 Thread _d0s_ via Digitalmars-d-learn
On Sunday, 13 March 2016 at 16:27:07 UTC, gour wrote: Hello, after quite some time I'm returning to D being fed up with some other languages to become more ready for writing open-source multi-platform desktop app(s)... I already own copy of Andrei's The D Programming Language book, but

Re: Is D a good choice for embedding python/octave/julia

2016-03-13 Thread Chris Wright via Digitalmars-d-learn
On Sun, 13 Mar 2016 13:02:16 +, Bastien wrote: > The sticking point is unless I commit the rest of my life to maintaining > this software, I can't write it all in D. The algorithms change/are > improved yearly; the output format from the instrument changes once in a > while and therefore these

Re: How to list all version identifiers?

2016-03-13 Thread Iakh via Digitalmars-d-learn
On Sunday, 13 March 2016 at 15:50:47 UTC, Basile B. wrote: trivial answer, let's say you have dcd-server running in the background: dcd-client -c8 <<< "version(" Thanks. Will try.

Programming in D vs The D Programming Language

2016-03-13 Thread gour via Digitalmars-d-learn
Hello, after quite some time I'm returning to D being fed up with some other languages to become more ready for writing open-source multi-platform desktop app(s)... I already own copy of Andrei's The D Programming Language book, but never went fully through it, but I see in the meantime

Re: Get address of object in constructor.

2016-03-13 Thread MGW via Digitalmars-d-learn
On Sunday, 13 March 2016 at 16:02:07 UTC, WebFreak001 wrote: However note that this is not the same as that function. cast(void*)this and are 2 different things. So if you want to do the same as saveThis just do void* thisAddr = cast(void*) instead void* thisAddr = cast(void*) Error

Re: Is D a good choice for embedding python/octave/julia

2016-03-13 Thread Lass Safin via Digitalmars-d-learn
On Sunday, 13 March 2016 at 13:02:16 UTC, Bastien wrote: Hi, apologies for what may be a fairly obvious question to some. ## The background: I have been tasked with building software to process data output by scientific instruments for non-experts - basically with GUI, menus, easy config

Re: Get address of object in constructor.

2016-03-13 Thread WebFreak001 via Digitalmars-d-learn
On Sunday, 13 March 2016 at 15:43:02 UTC, MGW wrote: Cfoo foo = new Cfoo(); foo.saveThis(); However note that this is not the same as that function. cast(void*)this and are 2 different things. So if you want to do the same as saveThis just do void* thisAddr = cast(void*) instead

Re: Get address of object in constructor.

2016-03-13 Thread MGW via Digitalmars-d-learn
On Sunday, 13 March 2016 at 15:49:20 UTC, WebFreak001 wrote: On Sunday, 13 March 2016 at 15:43:02 UTC, MGW wrote: I want to get address of object Cfoo in constructor. Whether it is possible? class Cfoo { void* adrThis; this() { adrThis = cast(void*) this;

Re: How to list all version identifiers?

2016-03-13 Thread Basile B. via Digitalmars-d-learn
On Sunday, 13 March 2016 at 15:15:22 UTC, Iakh wrote: There is trick for gcc: gcc -dM -E - < /dev/null It shows all default #defines Is there way to show all version identifiers for D? For all or any compiler you know trivial answer, let's say you have dcd-server running in the background:

Re: Get address of object in constructor.

2016-03-13 Thread WebFreak001 via Digitalmars-d-learn
On Sunday, 13 March 2016 at 15:43:02 UTC, MGW wrote: I want to get address of object Cfoo in constructor. Whether it is possible? class Cfoo { void* adrThis; this() { adrThis = cast(void*) this; } } ... Cfoo foo = new Cfoo(); "this" should work (pun

Get address of object in constructor.

2016-03-13 Thread MGW via Digitalmars-d-learn
I want to get address of object Cfoo in constructor. Whether it is possible? now: - class Cfoo { void* adrThis; void saveThis(void* adr) { adrThis = adr; } } ... Cfoo foo = new Cfoo(); foo.saveThis(); shall be -- class Cfoo { void* adrThis;

Re: In D, lexically, which are the chars that can follow $, exactly ?

2016-03-13 Thread Basile B. via Digitalmars-d-learn
On Sunday, 13 March 2016 at 14:55:36 UTC, Marc Schütz wrote: On Sunday, 13 March 2016 at 14:07:31 UTC, Basile B. wrote: '$' is only valid in an indexExpression (https://dlang.org/spec/grammar.html#IndexExpression), so it can only be followed by - ' ' - ']' - operators , usually '-' but also

How to list all version identifiers?

2016-03-13 Thread Iakh via Digitalmars-d-learn
There is trick for gcc: gcc -dM -E - < /dev/null It shows all default #defines Is there way to show all version identifiers for D? For all or any compiler you know

Re: In D, lexically, which are the chars that can follow $, exactly ?

2016-03-13 Thread Marc Schütz via Digitalmars-d-learn
On Sunday, 13 March 2016 at 14:07:31 UTC, Basile B. wrote: '$' is only valid in an indexExpression (https://dlang.org/spec/grammar.html#IndexExpression), so it can only be followed by - ' ' - ']' - operators , usually '-' but also '/', '+', '>>' etc Is that right ? I'd like to relax the

Re: Clearing associative array.

2016-03-13 Thread ciechowoj via Digitalmars-d-learn
On Sunday, 13 March 2016 at 13:42:02 UTC, cym13 wrote: The problem was brought up a few days ago (can't remember where) and it happens to be a documentation mistake: there is a clear() method planned but for a future release (the next one?). That would be great : )

Re: Is there a sorted map?

2016-03-13 Thread cym13 via Digitalmars-d-learn
On Sunday, 13 March 2016 at 14:11:14 UTC, Anonymouse wrote: On Sunday, 13 March 2016 at 13:44:35 UTC, cym13 wrote: Note that implementing an (admitedly not perfect) ordered associative array yourself really isn't much work: https://github.com/cym13/miscD/blob/master/ordered_aa.d Unsigned

Re: Is there a sorted map?

2016-03-13 Thread Anonymouse via Digitalmars-d-learn
On Sunday, 13 March 2016 at 13:44:35 UTC, cym13 wrote: Note that implementing an (admitedly not perfect) ordered associative array yourself really isn't much work: https://github.com/cym13/miscD/blob/master/ordered_aa.d Unsigned integer comparison with -1 in the remove function, by the way.

In D, lexically, which are the chars that can follow $, exactly ?

2016-03-13 Thread Basile B. via Digitalmars-d-learn
'$' is only valid in an indexExpression (https://dlang.org/spec/grammar.html#IndexExpression), so it can only be followed by - ' ' - ']' - operators , usually '-' but also '/', '+', '>>' etc Is that right ? I'd like to relax the lexical rule for C.E static macros which currently is -

Re: Filling an array

2016-03-13 Thread user42 via Digitalmars-d-learn
On Saturday, 12 March 2016 at 18:33:16 UTC, Alex wrote: On Saturday, 12 March 2016 at 16:37:25 UTC, user42 wrote: On Saturday, 12 March 2016 at 14:33:19 UTC, Alex wrote: /snip I thought this was supposed to halt with an error rather than compile and set all members to 1. The syntax, to me

Re: Is there a sorted map?

2016-03-13 Thread cym13 via Digitalmars-d-learn
On Sunday, 13 March 2016 at 10:06:24 UTC, stunaep wrote: On Sunday, 13 March 2016 at 08:33:43 UTC, Jonathan M Davis wrote: On Sunday, March 13, 2016 02:35:27 stunaep via Digitalmars-d-learn wrote: [...] The closest that we have in Phobos at the moment is RedBlackTree in std.container. Its

Re: Clearing associative array.

2016-03-13 Thread cym13 via Digitalmars-d-learn
On Saturday, 12 March 2016 at 12:59:02 UTC, ciechowoj wrote: On Saturday, 12 March 2016 at 12:42:04 UTC, Adam D. Ruppe wrote: On Saturday, 12 March 2016 at 12:34:16 UTC, ciechowoj wrote: If above doesn't work how am I supposed to clear the array? `x = string[string].init;` is somewhat ugly.

Gdmd compiling error

2016-03-13 Thread Orkhan via Digitalmars-d-learn
Hello. I need your help ! I am struggling to compile and install ca Xcom server files which is using gdmd . It is in linux system , and when I type make command it returns error like: /bin/sh: 1: gdmd: not found Makefile:35: recipe for target 'protocol-daemon' failed make:

Is D a good choice for embedding python/octave/julia

2016-03-13 Thread Bastien via Digitalmars-d-learn
Hi, apologies for what may be a fairly obvious question to some. ## The background: I have been tasked with building software to process data output by scientific instruments for non-experts - basically with GUI, menus, easy config files (JSON or similar) - and the ability to do some serious

Re: std.stdio.File.seek error

2016-03-13 Thread Nicholas Wilson via Digitalmars-d-learn
f.seek(173445340 , SEEK_SET); f.seek(173445340 , SEEK_REL); oops that should be 3173445340.

Re: std.stdio.File.seek error

2016-03-13 Thread Nicholas Wilson via Digitalmars-d-learn
On Sunday, 13 March 2016 at 10:32:41 UTC, stunaep wrote: I have a very large file I need to read data from at certain positions, but I have run into this error std.conv.ConvOverflowException@std\conv.d(1328): Conversion positive overflow when seeking to 6346890680. Seeking to smaller values

std.stdio.File.seek error

2016-03-13 Thread stunaep via Digitalmars-d-learn
I have a very large file I need to read data from at certain positions, but I have run into this error std.conv.ConvOverflowException@std\conv.d(1328): Conversion positive overflow when seeking to 6346890680. Seeking to smaller values such as 3580720 work with no problem. The file is well over

Re: Is there a sorted map?

2016-03-13 Thread stunaep via Digitalmars-d-learn
On Sunday, 13 March 2016 at 08:33:43 UTC, Jonathan M Davis wrote: On Sunday, March 13, 2016 02:35:27 stunaep via Digitalmars-d-learn wrote: [...] The closest that we have in Phobos at the moment is RedBlackTree in std.container. Its API is geared towards sets, not maps, but you can get it

Re: Is there a sorted map?

2016-03-13 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, March 13, 2016 02:35:27 stunaep via Digitalmars-d-learn wrote: > Is there any sorted map in D? I need a map and I need to be able > to get the highest key in the map. In java I would use a TreeMap > and use map.lastKey(), but since associative arrays are not > sorted that would be O(n).