Re: GTKD resources

2017-08-11 Thread Mr. Pib via Digitalmars-d-learn
Here is what I came up with import gdkpixbuf.Pixbuf; GdkPixbuf*[string] __ImageCache; void SetImage(string imgName)(gtk.Image T) { import std.path, std.conv, gdkpixbuf.Pixbuf; GError* err = null; if (imgName !in __ImageCache) { GdkPixbufLoader*

Re: Persistent Storage

2017-08-11 Thread Mr. Pib via Digitalmars-d-learn
On Saturday, 12 August 2017 at 01:16:35 UTC, HyperParrow wrote: On Friday, 11 August 2017 at 22:21:53 UTC, Mr. Pib wrote: [...] Try a serialization library or inifiled. Some may even use a DB with ORM for this. https://code.dlang.org/packages/inifiled

Re: Persistent Storage

2017-08-11 Thread HyperParrow via Digitalmars-d-learn
On Friday, 11 August 2017 at 22:21:53 UTC, Mr. Pib wrote: Does D have a persistent storage somewhere? I'd like something easy to use that allows me to load and save settings to disk in between executions of the program. I want to specify the variable to be saved or loaded and a default value.

Re: task parallelize dirEntries

2017-08-11 Thread Arun Chandrasekaran via Digitalmars-d-learn
On Friday, 11 August 2017 at 21:58:20 UTC, Johnson wrote: Just a thought, maybe the GC isn't cleaning up quick enough? You are allocating and md5 digest each iteration. Possibly, an opitimization is use use a collection of md5 hashes and reuse them. e.g., pre-allocate 100(you probably only

Re: Bug in D?!

2017-08-11 Thread H. S. Teoh via Digitalmars-d-learn
On Fri, Aug 11, 2017 at 11:34:04PM +, Adam D. Ruppe via Digitalmars-d-learn wrote: > On Friday, 11 August 2017 at 22:43:02 UTC, Mr. Pib wrote: > > int and I should be able to append an int without having to worry > > about the value of the int. > > Appending an int to a string really ought

Re: Bug in D?!

2017-08-11 Thread Mr. Pib via Digitalmars-d-learn
On Friday, 11 August 2017 at 23:34:04 UTC, Adam D. Ruppe wrote: On Friday, 11 August 2017 at 22:43:02 UTC, Mr. Pib wrote: int and I should be able to append an int without having to worry about the value of the int. Appending an int to a string really ought to just be a type mismatch error.

Re: Bug in D?!

2017-08-11 Thread Adam D. Ruppe via Digitalmars-d-learn
On Friday, 11 August 2017 at 22:43:02 UTC, Mr. Pib wrote: int and I should be able to append an int without having to worry about the value of the int. Appending an int to a string really ought to just be a type mismatch error. We might be able to convince the leadership to do that too,

Re: Bug in D?!

2017-08-11 Thread Mr. Pib via Digitalmars-d-learn
On Friday, 11 August 2017 at 22:50:53 UTC, ketmar wrote: Mr. Pib wrote: Wow, that is pretty screwed up! I thought D was against implicit conversions that might cause problems? I'm passing an int and I should be able to append an int without having to worry about the value of the int.

Re: Bug in D?!

2017-08-11 Thread ketmar via Digitalmars-d-learn
Mr. Pib wrote: Wow, that is pretty screwed up! I thought D was against implicit conversions that might cause problems? I'm passing an int and I should be able to append an int without having to worry about the value of the int. Instead D chose to do something very strange, awkward, and error

Re: Bug in D?!

2017-08-11 Thread Mr. Pib via Digitalmars-d-learn
On Friday, 11 August 2017 at 04:17:32 UTC, ketmar wrote: Mr. Pib wrote: string Q(alias T, alias D)() { pragma(msg, T); pragma(msg, D); enum x = T~" = "~D~";"; pragma(msg, x); } mixin(Q!(`x`, 100)()); outputs, at compile time, x 100 x = d; there is no

Persistent Storage

2017-08-11 Thread Mr. Pib via Digitalmars-d-learn
Does D have a persistent storage somewhere? I'd like something easy to use that allows me to load and save settings to disk in between executions of the program. I want to specify the variable to be saved or loaded and a default value. e.g., Persist_Load(Some_variable, 100); will load

Re: task parallelize dirEntries

2017-08-11 Thread Johnson via Digitalmars-d-learn
On Friday, 11 August 2017 at 21:33:51 UTC, Arun Chandrasekaran wrote: I've modified the sample from tour.dlang.org to calculate the md5 digest of the files in a directory using std.parallelism. When I run this on a dir with huge number of files, I get:

Re: task parallelize dirEntries

2017-08-11 Thread Arun Chandrasekaran via Digitalmars-d-learn
On Friday, 11 August 2017 at 21:33:51 UTC, Arun Chandrasekaran wrote: I've modified the sample from tour.dlang.org to calculate the [...] RHEL 7.2 64 bit dmd v2.075.0 ldc 1.1.0

task parallelize dirEntries

2017-08-11 Thread Arun Chandrasekaran via Digitalmars-d-learn
I've modified the sample from tour.dlang.org to calculate the md5 digest of the files in a directory using std.parallelism. When I run this on a dir with huge number of files, I get: core.exception.OutOfMemoryError@src/core/exception.d(696): Memory allocation failed Since dirEntries returns

How to make http requests to unix socket?

2017-08-11 Thread dvnguyen via Digitalmars-d-learn
How to make http requests to unix socket? For example, in Docker engine api, curl --unix-socket /var/run/docker.sock http:/v1.24/containers/json

Re: __dtor vs __xdtor

2017-08-11 Thread bitwise via Digitalmars-d-learn
On Friday, 11 August 2017 at 17:20:18 UTC, HyperParrow wrote: [...] I made a mistake but it's not about i, which is a global. I meant "other.__dtor." just before the last assert. This doesn't change the results. hmm...indeed ;) On Friday, 11 August 2017 at 17:24:17 UTC, HyperParrow wrote:

Re: __dtor vs __xdtor

2017-08-11 Thread HyperParrow via Digitalmars-d-learn
On Friday, 11 August 2017 at 17:10:14 UTC, bitwise wrote: On Friday, 11 August 2017 at 17:02:20 UTC, HyperParrow wrote: On Friday, 11 August 2017 at 16:53:02 UTC, bitwise wrote: What do they do? What's the difference? Thanks __xdtor() also calls the __dtor() that are mixed with template

Re: __dtor vs __xdtor

2017-08-11 Thread HyperParrow via Digitalmars-d-learn
On Friday, 11 August 2017 at 17:12:22 UTC, bitwise wrote: On Friday, 11 August 2017 at 17:06:40 UTC, HyperParrow wrote: [...] int i; struct Foo { template ToMix(){ ~this(){i;}} ~this(){++i;} mixin ToMix; } void main() { Foo* foo = new Foo; foo.__xdtor; assert(i==3);

Re: __dtor vs __xdtor

2017-08-11 Thread bitwise via Digitalmars-d-learn
On Friday, 11 August 2017 at 17:06:40 UTC, HyperParrow wrote: [...] int i; struct Foo { template ToMix(){ ~this(){i;}} ~this(){++i;} mixin ToMix; } void main() { Foo* foo = new Foo; foo.__xdtor; assert(i==3); Foo* other = new Foo; foo.__dtor;

Re: __dtor vs __xdtor

2017-08-11 Thread bitwise via Digitalmars-d-learn
On Friday, 11 August 2017 at 17:02:20 UTC, HyperParrow wrote: On Friday, 11 August 2017 at 16:53:02 UTC, bitwise wrote: What do they do? What's the difference? Thanks __xdtor() also calls the __dtor() that are mixed with template mixins while __dtor() only call the __dtor() that matches to

Re: __dtor vs __xdtor

2017-08-11 Thread HyperParrow via Digitalmars-d-learn
On Friday, 11 August 2017 at 17:02:20 UTC, HyperParrow wrote: On Friday, 11 August 2017 at 16:53:02 UTC, bitwise wrote: What do they do? What's the difference? Thanks __xdtor() also calls the __dtor() that are mixed with template mixins while __dtor() only call the __dtor() that matches to

Re: __dtor vs __xdtor

2017-08-11 Thread HyperParrow via Digitalmars-d-learn
On Friday, 11 August 2017 at 16:53:02 UTC, bitwise wrote: What do they do? What's the difference? Thanks __xdtor() also calls the __dtor() that are mixed with template mixins while __dtor() only call the __dtor() that matches to the normal ~this(){}

__dtor vs __xdtor

2017-08-11 Thread bitwise via Digitalmars-d-learn
What do they do? What's the difference? Thanks

Re: DCD as a library - stops working after some thread is created.

2017-08-11 Thread Vadim Lopatin via Digitalmars-d-learn
On Friday, 11 August 2017 at 08:17:32 UTC, Vadim Lopatin wrote: I'm using DCD as a library in DlangIDE. All DCD calls are made from separate thread. DCD works ok until some thread is created (e.g. to invoke DUB for building). /// call this function after DCD ModuleCache is instantiated to

Re: Vectorflow noob

2017-08-11 Thread BitR via Digitalmars-d-learn
On Thursday, 10 August 2017 at 19:10:05 UTC, Jiyan wrote: Hey, wanted to the following simple thing with vectorflow: ... You'll want to end your stack with your wanted output size (1 - being the sum). Training it with the "square" function seems to give the best result for simple additions.

Re: Vectorflow noob

2017-08-11 Thread Michael via Digitalmars-d-learn
On Thursday, 10 August 2017 at 19:10:05 UTC, Jiyan wrote: Hey, wanted to the following simple thing with vectorflow: [...] I'm worried there might not be many on the forums who can help too much with vectorflow given how new it is. Maybe some in the community are more familiar with neural

Re: DLL loading behaviors and pragma(lib)

2017-08-11 Thread David Zhang via Digitalmars-d-learn
On Friday, 11 August 2017 at 04:50:48 UTC, rikki cattermole wrote: On 11/08/2017 12:18 AM, David Zhang wrote: I've been working on getting OpenGL to load on windows without a library, and encountered something curious; Context creation fails when I try to use the function pointer retrieved

DCD as a library - stops working after some thread is created.

2017-08-11 Thread Vadim Lopatin via Digitalmars-d-learn
I'm using DCD as a library in DlangIDE. All DCD calls are made from separate thread. DCD works ok until some thread is created (e.g. to invoke DUB for building). After this operation DCD stops working correctly and can locate symbols only from current source file. Root cause: If some another

Re: DlangUI Error

2017-08-11 Thread Jiyan via Digitalmars-d-learn
On Friday, 11 August 2017 at 02:25:51 UTC, Mike Parker wrote: On Thursday, 10 August 2017 at 23:38:42 UTC, Jiyan wrote: [...] Sounds like you used the script from the download page that installs the compiler per user. It's designed to allow you to have multiple versions installed in your

Re: Fix gtkD api display

2017-08-11 Thread Antonio via Digitalmars-d-learn
On Thursday, 10 August 2017 at 14:59:52 UTC, Adam D. Ruppe wrote: On Thursday, 10 August 2017 at 14:55:06 UTC, Mike Wey wrote: [...] Oh, I see. My generator lists them on the index, but doesn't recreate it each time, it just links. For example: