Re: Reflection in D

2017-01-27 Thread rumbu via Digitalmars-d-learn
On Saturday, 28 January 2017 at 07:10:27 UTC, medhi558 wrote: I have a last question, currently i use : if(lc.name.indexOf("protocol.messages") != -1) To know if the class is a NetworkMessage, Would be possible to do this if(lc is NetworkMessage) Sorry for my English, i speak french. if (

Re: Reflection in D

2017-01-27 Thread medhi558 via Digitalmars-d-learn
I have a last question, currently i use : if(lc.name.indexOf("protocol.messages") != -1) To know if the class is a NetworkMessage, Would be possible to do this if(lc is NetworkMessage) Sorry for my English, i speak french.

Re: Reflection in D

2017-01-27 Thread medhi558 via Digitalmars-d-learn
I develop a game server. Currently I use a switch : import protocol.messages.connection.Message1; import protocol.messages.connection.Message2; import protocol.messages.queues.Message3; import .. import protocol.messages.NetworkMessage; class ProtocolMessageManager { public static N

Re: Partial arrays reclaimed?

2017-01-27 Thread Adam D. Ruppe via Digitalmars-d-learn
On Friday, 27 January 2017 at 23:36:58 UTC, Stefan Koch wrote: It should reclaim the memory from the beginning of the array. I doubt the current implementation will though, you should check.

Concurrent containers

2017-01-27 Thread Arun Chandrasekaran via Digitalmars-d-learn
Does phobos offer concurrent containers? I couldn't find one at http://dlang.org/phobos/std_container.html Any other in the D land? Arun

Re: Partial arrays reclaimed?

2017-01-27 Thread Stefan Koch via Digitalmars-d-learn
On Friday, 27 January 2017 at 23:22:17 UTC, Nick Sabalausky wrote: Suppose an array is being used like a FIFO: --- T[] slice; // Add: slice ~= T(); // Remove: slice = slice[1..$]; --- Assuming of course there's no other references to the memory, as thi

Partial arrays reclaimed?

2017-01-27 Thread Nick Sabalausky via Digitalmars-d-learn
Suppose an array is being used like a FIFO: --- T[] slice; // Add: slice ~= T(); // Remove: slice = slice[1..$]; --- Assuming of course there's no other references to the memory, as this gets used, does the any of the memory from the removed elements ev

Re: D package for optimizing/compressing images

2017-01-27 Thread Ali Çehreli via Digitalmars-d-learn
On 01/27/2017 03:03 AM, aberba wrote: Are there any dub package for compressing images uploaded through web forms? Cropping/resizing may also come in handy. I want one for a vibe.d project. I have a minimal MagickWand binding if you want to use or extend: https://github.com/acehreli/alibum/

Re: D package for optimizing/compressing images

2017-01-27 Thread aberba via Digitalmars-d-learn
On Friday, 27 January 2017 at 19:14:19 UTC, Jesse Phillips wrote: On Friday, 27 January 2017 at 11:03:15 UTC, aberba wrote: Are there any dub package for compressing images uploaded through web forms? Cropping/resizing may also come in handy. I want one for a vibe.d project. I don't know of

Re: Reflection in D

2017-01-27 Thread Adam D. Ruppe via Digitalmars-d-learn
On Friday, 27 January 2017 at 21:02:13 UTC, medhi558 wrote: Hello, I would like to know if it is possible to recover all classes in the project in D. Yes, `foreach(mod; ModuleInfo) foreach(lc; mod.localClasses)`... but why do you want it? That facility is kinda limited in doing many things wi

Reflection in D

2017-01-27 Thread medhi558 via Digitalmars-d-learn
Hello, I would like to know if it is possible to recover all classes in the project in D. Example in c# : Assembly asm = Assembly.GetAssembly(typeof(MyClass)); foreach (Type type in asm.GetTypes()) { }

Re: D package for optimizing/compressing images

2017-01-27 Thread Jesse Phillips via Digitalmars-d-learn
On Friday, 27 January 2017 at 11:03:15 UTC, aberba wrote: Are there any dub package for compressing images uploaded through web forms? Cropping/resizing may also come in handy. I want one for a vibe.d project. I don't know of any D projects. If I were doing this I'd be running the vibe.d ser

Re: Bug in documentation or misunderstanding it?

2017-01-27 Thread H. S. Teoh via Digitalmars-d-learn
On Thu, Jan 26, 2017 at 06:47:21PM +, Suliman via Digitalmars-d-learn wrote: > On Thursday, 26 January 2017 at 18:42:29 UTC, Suliman wrote: > > On Thursday, 26 January 2017 at 17:52:24 UTC, H. S. Teoh wrote: > > > On Thu, Jan 26, 2017 at 05:38:59PM +, Suliman via > > > Digitalmars-d-learn w

Re: A matter of propiety

2017-01-27 Thread Adam D. Ruppe via Digitalmars-d-learn
On Friday, 27 January 2017 at 16:30:14 UTC, WhatMeWorry wrote: But it seems like I'm committing some great sin by doing this. meh i see no problem with it. Just another quick question: is the module that holds the main() function just the same as any other module? It is the same as any ot

A matter of propiety

2017-01-27 Thread WhatMeWorry via Digitalmars-d-learn
module_common import app; // Ugly? Bad? Better way? common_func() { static if (compileTimeFlag1) codeBlockA static if (compileTimeFlag2) codeBlockB static if (compileTimeFlag3) codeBlockC } I want to have many stan

Re: D idom for removing array elements

2017-01-27 Thread cym13 via Digitalmars-d-learn
On Friday, 27 January 2017 at 15:39:57 UTC, cym13 wrote: On Friday, 27 January 2017 at 08:30:41 UTC, Dukc wrote: [...] Note that if the set of values to be excluded isn't smaller than the haystack then using partition is way faster and your method is the slowest of all. If the order of the a

Re: D idom for removing array elements

2017-01-27 Thread cym13 via Digitalmars-d-learn
On Friday, 27 January 2017 at 08:30:41 UTC, Dukc wrote: On Friday, 27 January 2017 at 08:15:56 UTC, Dukc wrote: My method is much better for large arrays I tested here. Trough, considering the size of the arrays the performance difference should be even greater, like 1000X better instead of

Re: Problems compiling sqlite-d

2017-01-27 Thread Stefan Koch via Digitalmars-d-learn
On Friday, 27 January 2017 at 12:21:29 UTC, Nestor wrote: On Friday, 27 January 2017 at 12:06:33 UTC, Stefan Koch wrote: On Friday, 27 January 2017 at 12:04:06 UTC, Stefan Koch wrote: I take it you build without dub ? Have you specified source/sqlite.d on your compile commandline ? That was

Re: Problems compiling sqlite-d

2017-01-27 Thread Nestor via Digitalmars-d-learn
On Friday, 27 January 2017 at 12:06:33 UTC, Stefan Koch wrote: On Friday, 27 January 2017 at 12:04:06 UTC, Stefan Koch wrote: I take it you build without dub ? Have you specified source/sqlite.d on your compile commandline ? That was supposed to say. sqlite-d/source/sqlited.d Please feel fr

Re: Problems compiling sqlite-d

2017-01-27 Thread Stefan Koch via Digitalmars-d-learn
On Friday, 27 January 2017 at 12:04:06 UTC, Stefan Koch wrote: I take it you build without dub ? Have you specified source/sqlite.d on your compile commandline ? That was supposed to say. sqlite-d/source/sqlited.d Please feel free to post here or contact me directly regarding the usage of sq

Re: Problems compiling sqlite-d

2017-01-27 Thread Stefan Koch via Digitalmars-d-learn
On Friday, 27 January 2017 at 12:01:30 UTC, Nestor wrote: Hi, I was trying to use https://github.com/UplinkCoder/sqlite-d Unfortunately even something as simple as this doesn´t compile (at least on Windows): import std.stdio, sqlited; void main(string[] args) { string filename = (args.len

Problems compiling sqlite-d

2017-01-27 Thread Nestor via Digitalmars-d-learn
Hi, I was trying to use https://github.com/UplinkCoder/sqlite-d Unfortunately even something as simple as this doesn´t compile (at least on Windows): import std.stdio, sqlited; void main(string[] args) { string filename = (args.length == 2 ? args[1] : "data.db"); Database db = Database(f

Re: D idom for removing array elements

2017-01-27 Thread Dukc via Digitalmars-d-learn
On Friday, 27 January 2017 at 10:20:19 UTC, albert-j wrote: I am also wondering why the standard library doesn't have convenience functions for this, e.g. like Java's removeAll? Now there's more typing than necessary for a relatively common task. That might be a good addition considering how w

D package for optimizing/compressing images

2017-01-27 Thread aberba via Digitalmars-d-learn
Are there any dub package for compressing images uploaded through web forms? Cropping/resizing may also come in handy. I want one for a vibe.d project.

Re: D idom for removing array elements

2017-01-27 Thread albert-j via Digitalmars-d-learn
On Friday, 27 January 2017 at 08:15:56 UTC, Dukc wrote: TickDuration(28085) TickDuration(42868) TickDuration(1509) Thank you, this is very helpful. I am also wondering why the standard library doesn't have convenience functions for this, e.g. like Java's removeAll? Now there's more typing t

Re: Parsing a UTF-16LE file line by line, BUG?

2017-01-27 Thread Era Scarecrow via Digitalmars-d-learn
On Friday, 27 January 2017 at 07:02:52 UTC, Jack Applegame wrote: On Monday, 16 January 2017 at 14:47:23 UTC, Era Scarecrow wrote: static char[1024*4] buffer; //4k reusable buffer, NOT thread safe Maybe I'm wrong, but I think it's thread safe. Because static mutable non-shared variables

Re: D idom for removing array elements

2017-01-27 Thread Dukc via Digitalmars-d-learn
On Friday, 27 January 2017 at 08:15:56 UTC, Dukc wrote: My method is much better for large arrays I tested here. Trough, considering the size of the arrays the performance difference should be even greater, like 1000X better instead of 15X better so it's definitely not that great.

Re: D idom for removing array elements

2017-01-27 Thread Dukc via Digitalmars-d-learn
On Thursday, 26 January 2017 at 23:10:02 UTC, albert-j wrote: Will it also work correctly and fast for arrays of custom objects? How should opCmp() be defined if objects don't have a meaningful ordering? The order of elements in the original array does not matter. Two options: either define o

Re: D idom for removing array elements

2017-01-27 Thread Dukc via Digitalmars-d-learn
On Friday, 27 January 2017 at 05:48:27 UTC, Stefan Koch wrote: To me it looks rather slow. please benchmark! void main() { import std.stdio, std.algorithm, std.range, std.array, std.datetime; int[] a = [1, 2, 3, 4, 5, 6, 7, 4].cycle.take(2000).array; int[] b = [3, 4, 6].cycle.take(2