Re: Does GtkD work well on Windows?

2016-03-24 Thread Web Biz Owner via Digitalmars-d-learn
On Thursday, 24 March 2016 at 23:08:13 UTC, Zardoz wrote: On Thursday, 24 March 2016 at 21:00:36 UTC, Web Biz Owner wrote: [...] Short answer : Yes, but you need to install (or package with) Gtk dlls. Long answer : Install following this instructions : https://github.com/gtkd-developers/G

Re: Strange behavior in console with UTF-8

2016-03-24 Thread Jonathan Villa via Digitalmars-d-learn
On Friday, 25 March 2016 at 01:03:06 UTC, Ali Çehreli wrote: > Try char: char[] readerBuffer; Ali Also tried with dchar ... there's no changes.

Re: Strange behavior in console with UTF-8

2016-03-24 Thread Jonathan Villa via Digitalmars-d-learn
On Friday, 25 March 2016 at 01:03:06 UTC, Ali Çehreli wrote: On 03/24/2016 05:54 PM, Jonathan Villa wrote: Try char: char[] readerBuffer; flush() has no effect on input streams. Ali Thankf fot he quick reply. Unfortunately it behaves exactly as before with wchar.

Re: Strange behavior in console with UTF-8

2016-03-24 Thread Ali Çehreli via Digitalmars-d-learn
On 03/24/2016 05:54 PM, Jonathan Villa wrote: > I'm using WCHAR instead of CHAR > with the hope to get less problems in the future. Try char: char[] readerBuffer; > Also I tried stdin.flush() flush() has no effect on input streams. Ali

Strange behavior in console with UTF-8

2016-03-24 Thread Jonathan Villa via Digitalmars-d-learn
I prefer to post this thing here because it could that I'm doing something wrong. I'm using std.stdio -> readln() to read whatever I'm typing in the console. BUT, if the line contains some UTF-8 characters, the data obtained is EMPTY and module runnable; import std.stdio; import std.strin

Re: Does GtkD work well on Windows?

2016-03-24 Thread Zardoz via Digitalmars-d-learn
On Thursday, 24 March 2016 at 21:00:36 UTC, Web Biz Owner wrote: Hi group, I'm interested in developing some GUI programs in D on Windows. Looked into the various D GUI toolkit options a bit, on the D sites and by googling a bit. Thinking of using GtkD. So would like to know whether people th

Re: Updating D-based apps without recompiling it

2016-03-24 Thread cym13 via Digitalmars-d-learn
On Thursday, 24 March 2016 at 18:46:43 UTC, Jesse Phillips wrote: On Wednesday, 23 March 2016 at 17:29:50 UTC, Jacob Carlborg wrote: On 2016-03-23 18:15, Jesse Phillips wrote: Do you have an example of this being done in any other language? In Erlang it's possible to hot swap code. I'm not s

Does GtkD work well on Windows?

2016-03-24 Thread Web Biz Owner via Digitalmars-d-learn
Hi group, I'm interested in developing some GUI programs in D on Windows. Looked into the various D GUI toolkit options a bit, on the D sites and by googling a bit. Thinking of using GtkD. So would like to know whether people think it is a good option for GUI app dev on Windows. Note: I hav

Re: Checking if a port is listening

2016-03-24 Thread Lucien via Digitalmars-d-learn
On Thursday, 24 March 2016 at 12:17:35 UTC, Marc Schütz wrote: On Wednesday, 23 March 2016 at 21:37:09 UTC, Lucien wrote: When I remove the Thread.sleep, it doesn't find all adresses. Why ? Socket.select() will wait _at most_ 100 msecs. If a socket gets ready before that timeout, it will retu

Re: Updating D-based apps without recompiling it

2016-03-24 Thread Jesse Phillips via Digitalmars-d-learn
On Wednesday, 23 March 2016 at 17:29:50 UTC, Jacob Carlborg wrote: On 2016-03-23 18:15, Jesse Phillips wrote: Do you have an example of this being done in any other language? In Erlang it's possible to hot swap code. I'm not sure how it works though. But if we're talking servers, the easiest

Re: Struct array assignment behaviour using example from Programming in D, chapter 78

2016-03-24 Thread Ali Çehreli via Digitalmars-d-learn
On 03/24/2016 10:24 AM, data pulverizer wrote: > I have been playing with the matrix example given at the end of chapter > 78 of Ali Çehreli's For reference, it's "Multi-dimensional operator overloading example" here: http://ddili.org/ders/d.en/templates_more.html >having problems with overlo

Re: Struct array assignment behaviour using example from Programming in D, chapter 78

2016-03-24 Thread data pulverizer via Digitalmars-d-learn
On Thursday, 24 March 2016 at 17:24:38 UTC, data pulverizer wrote: I have been playing with the matrix example given at the end of chapter 78 of Ali Çehreli's fabulous book and am having problems with overloading the opAssign operator. rows is a private int[][] in a Matrix struct. I have adde

Re: Usage of custom class with JSONValue

2016-03-24 Thread Uldis via Digitalmars-d-learn
On Thursday, 24 March 2016 at 17:03:25 UTC, Andre wrote: I hoped there is some operator overloading for implicit conversion of my class to JSONValue. I solved the issue with an toJSON method and a generic functionality which checks for this method. Kind regards André Vibe.d has some serial

Re: Containers, Allocators and Purity

2016-03-24 Thread ZombineDev via Digitalmars-d-learn
On Thursday, 24 March 2016 at 11:18:06 UTC, Nordlöw wrote: Could somebody briefly outline how the thread-locality (non-GC-locked) of allocators relates to the purity of the containers using them? This because I want to move forward with optimizations in my knowledge graph that requires GC-fr

Struct array assignment behaviour using example from Programming in D, chapter 78

2016-03-24 Thread data pulverizer via Digitalmars-d-learn
I have been playing with the matrix example given at the end of chapter 78 of Ali Çehreli's fabulous book and am having problems with overloading the opAssign operator. rows is a private int[][] in a Matrix struct. I have added the following ... Matrix opAssign(int[][] arr) { this.rows =

Re: Containers, Allocators and Purity

2016-03-24 Thread ZombineDev via Digitalmars-d-learn
On Thursday, 24 March 2016 at 11:18:06 UTC, Nordlöw wrote: Could somebody briefly outline how the thread-locality (non-GC-locked) of allocators relates to the purity of the containers using them? This because I want to move forward with optimizations in my knowledge graph that requires GC-fr

Re: Usage of custom class with JSONValue

2016-03-24 Thread Andre via Digitalmars-d-learn
On Thursday, 24 March 2016 at 16:03:13 UTC, Edwin van Leeuwen wrote: On Thursday, 24 March 2016 at 11:39:13 UTC, arturg wrote: isnt alias this supposed to do this implicitly? convert this auto jsValue = JSONValue(new MyClass()); into this auto jsValue = JSONValue((new MyClass())._data); Good

Re: Usage of custom class with JSONValue

2016-03-24 Thread Edwin van Leeuwen via Digitalmars-d-learn
On Thursday, 24 March 2016 at 11:39:13 UTC, arturg wrote: isnt alias this supposed to do this implicitly? convert this auto jsValue = JSONValue(new MyClass()); into this auto jsValue = JSONValue((new MyClass())._data); Good point, I did not catch that. That indeed should work and seems to be

Re: getOverloads, but also include all the imported members

2016-03-24 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 24 March 2016 at 15:07:09 UTC, Yuxuan Shui wrote: Is there a way to do this automatically? No. You have to decide to bring them together if you want them to overload.

Re: getOverloads, but also include all the imported members

2016-03-24 Thread Yuxuan Shui via Digitalmars-d-learn
On Thursday, 24 March 2016 at 13:55:31 UTC, Adam D. Ruppe wrote: On Thursday, 24 March 2016 at 12:11:33 UTC, Marc Schütz wrote: On Wednesday, 23 March 2016 at 20:54:20 UTC, Yuxuan Shui wrote: module one; void func(int a){} / module two; import one; void func(float a){} Add

Re: inout and templates don't mix...

2016-03-24 Thread Steven Schveighoffer via Digitalmars-d-learn
On 3/23/16 6:25 PM, Ali Çehreli wrote: On 03/23/2016 02:31 PM, cy wrote: > struct Someop(Type) { >Type thing; >void foo() { > thing.bar(); >} > } > > struct Foo { >void bar() { > import std.stdio: writeln; > writeln("bar"); >} > } > > struct Bar

Re: parsing fastq files with D

2016-03-24 Thread eastanon via Digitalmars-d-learn
On Thursday, 24 March 2016 at 13:38:32 UTC, Marc Schütz wrote: Yes, it's read into your processes memory. You can use std.mmfile [1] to make things a bit more efficient. It will, too, read the data into memory, but it will do so in a way (memory mapping) that only loads what is actually accesse

Re: getOverloads, but also include all the imported members

2016-03-24 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 24 March 2016 at 12:11:33 UTC, Marc Schütz wrote: On Wednesday, 23 March 2016 at 20:54:20 UTC, Yuxuan Shui wrote: module one; void func(int a){} / module two; import one; void func(float a){} Add in module two: alias func = one.func; Indeed, the two funcs ar

Re: parsing fastq files with D

2016-03-24 Thread Marc Schütz via Digitalmars-d-learn
On Thursday, 24 March 2016 at 08:24:15 UTC, eastanon wrote: On Thursday, 24 March 2016 at 06:34:51 UTC, rikki cattermole wrote: As a little fun thing to do I implemented it for you. It won't allocate. Making this perfect for you. With a bit of work you could make Result have buffers for result

Re: Checking if a port is listening

2016-03-24 Thread Marc Schütz via Digitalmars-d-learn
On Wednesday, 23 March 2016 at 21:37:09 UTC, Lucien wrote: When I remove the Thread.sleep, it doesn't find all adresses. Why ? Socket.select() will wait _at most_ 100 msecs. If a socket gets ready before that timeout, it will return immediately. Therefore, you might not get the full TIMES*100

Re: getOverloads, but also include all the imported members

2016-03-24 Thread Marc Schütz via Digitalmars-d-learn
On Wednesday, 23 March 2016 at 20:54:20 UTC, Yuxuan Shui wrote: Say: module one; void func(int a){} / module two; import one; void func(float a){} Is there a way to get both func() in module two? Add in module two: alias func = one.func;

Re: Usage of custom class with JSONValue

2016-03-24 Thread arturg via Digitalmars-d-learn
On Thursday, 24 March 2016 at 08:24:46 UTC, Edwin van Leeuwen wrote: JSONValue only works with the build in types, not with user defined types. Either you define a specific function for the class that returns a JSONValue. Easiest way to do that would be to build an associative array with string

Containers, Allocators and Purity

2016-03-24 Thread Nordlöw via Digitalmars-d-learn
Could somebody briefly outline how the thread-locality (non-GC-locked) of allocators relates to the purity of the containers using them? This because I want to move forward with optimizations in my knowledge graph that requires GC-free array containers storing value typed elements (integers)

Re: Usage of custom class with JSONValue

2016-03-24 Thread Rene Zwanenburg via Digitalmars-d-learn
On Thursday, 24 March 2016 at 08:24:46 UTC, Edwin van Leeuwen wrote: Alternatively there are multiple serialization libraries that will allow you to turn any user defined type from and to JSONValues. https://code.dlang.org/packages/painlessjson https://code.dlang.org/packages/jsonizer Cheers,

Re: iota result as member variable

2016-03-24 Thread Alex via Digitalmars-d-learn
On Thursday, 24 March 2016 at 08:13:27 UTC, Edwin van Leeuwen wrote: Yeah this is one of the downsides of voldermort types. In these cases typeof and ReturnType are your friend. It often takes me a couple of tries to get it right, but the following seems to work: import std.traits : ReturnTyp

Re: parsing fastq files with D

2016-03-24 Thread rikki cattermole via Digitalmars-d-learn
On 24/03/16 9:24 PM, eastanon wrote: On Thursday, 24 March 2016 at 06:34:51 UTC, rikki cattermole wrote: As a little fun thing to do I implemented it for you. It won't allocate. Making this perfect for you. With a bit of work you could make Result have buffers for result instead of using the in

Re: Usage of custom class with JSONValue

2016-03-24 Thread Edwin van Leeuwen via Digitalmars-d-learn
On Thursday, 24 March 2016 at 08:15:12 UTC, Andre wrote: Hi, I have a class which has already an alias this to a string array, so I can use it in a foreach loop. class MyClass { string[] _data; alias _data this; // ... } void main() { import std.json;

Re: parsing fastq files with D

2016-03-24 Thread eastanon via Digitalmars-d-learn
On Thursday, 24 March 2016 at 06:34:51 UTC, rikki cattermole wrote: As a little fun thing to do I implemented it for you. It won't allocate. Making this perfect for you. With a bit of work you could make Result have buffers for result instead of using the input array allow for the source to be

Usage of custom class with JSONValue

2016-03-24 Thread Andre via Digitalmars-d-learn
Hi, I have a class which has already an alias this to a string array, so I can use it in a foreach loop. class MyClass { string[] _data; alias _data this; // ... } void main() { import std.json; auto jsValue = JSONValue(new MyClass()); } For some generic

Re: iota result as member variable

2016-03-24 Thread Edwin van Leeuwen via Digitalmars-d-learn
On Thursday, 24 March 2016 at 06:54:25 UTC, Alex wrote: Hi everybody, doing some optimization on my code, I faced some strange question: how to save a iota result in a class member? Say I have class A { ??? member; auto testIter4() { return iota(0,5); } } void main()

Re: byChunk odd behavior?

2016-03-24 Thread Hanh via Digitalmars-d-learn
On Wednesday, 23 March 2016 at 19:07:34 UTC, cym13 wrote: In Scala, 'take' consumes bytes from the iterator. So the same code would be buffer = range.take(N).toArray Then just do that! import std.range, std.array; auto buffer = range.take(N).array; auto example = iota(0, 200, 5)

Re: iota result as member variable

2016-03-24 Thread Alex via Digitalmars-d-learn
As a comment on my own post: I’m aware, that there are some different return types from functions like iota. And I’m also aware, that there are much less different range types. I can, maybe, define what kind of range type I want to have, the question is, how to map all the different function r