Re: Concurrency on Windows (spawn)

2014-06-18 Thread Chris via Digitalmars-d-learn
On Wednesday, 18 June 2014 at 11:57:06 UTC, Chris wrote: Windows: in a D-DLL I'm trying to spawn a thread. However, nothing happens auto myThread = spawn(&myFunction, thisTid); send(myThread, arg); The thread is never called. Any ideas? Thanks! PS In an old DLL it used to work, there I called

Re: Concurrency on Windows (spawn)

2014-06-19 Thread Chris via Digitalmars-d-learn
On Wednesday, 18 June 2014 at 15:23:11 UTC, Kapps wrote: On Wednesday, 18 June 2014 at 15:03:55 UTC, Ali Çehreli wrote: On 06/18/2014 06:28 AM, Chris wrote: On Wednesday, 18 June 2014 at 11:57:06 UTC, Chris wrote: Windows: in a D-DLL I'm trying to spawn a thread. However, nothing happens aut

Re: [OT]I throw in the towel

2014-06-26 Thread Chris via Digitalmars-d-learn
On Thursday, 26 June 2014 at 08:36:15 UTC, Chris wrote: On Wednesday, 25 June 2014 at 09:29:35 UTC, Orfeo wrote: I wanted to create a simple application to display and edit data from postgresql database using GtkD and ddb (https://github.com/pszturmaj/ddb) The application should run on WinXp

Re: [OT]I throw in the towel

2014-06-26 Thread Chris via Digitalmars-d-learn
On Wednesday, 25 June 2014 at 09:29:35 UTC, Orfeo wrote: I wanted to create a simple application to display and edit data from postgresql database using GtkD and ddb (https://github.com/pszturmaj/ddb) The application should run on WinXp or Win7. After a week of work I throw in the towel ...

Re: [OT]I throw in the towel

2014-06-26 Thread Chris via Digitalmars-d-learn
On Thursday, 26 June 2014 at 08:39:46 UTC, Chris wrote: On Thursday, 26 June 2014 at 08:36:15 UTC, Chris wrote: On Wednesday, 25 June 2014 at 09:29:35 UTC, Orfeo wrote: I wanted to create a simple application to display and edit data from postgresql database using GtkD and ddb (https://github

Re: ~ ?

2014-06-27 Thread Chris via Digitalmars-d-learn
On Friday, 27 June 2014 at 05:58:14 UTC, pgtkda wrote: What does this symbol mean in relation to D? ~ ~ D means it's about the best language I've come across so far.

Re: Bizarre compile error in GtkD

2014-06-30 Thread Chris via Digitalmars-d-learn
On Sunday, 29 June 2014 at 20:28:23 UTC, Evan Davis wrote: Hello, I have a compile error when trying to use GtkD 2.3.3. When I try to create a FileChooseDialog, I call new FileChooserDialog("Save File", editor.drawingArea.getParent().getParentWindow(),

Re: How to interact with fortran code

2014-07-09 Thread Chris via Digitalmars-d-learn
On Wednesday, 9 July 2014 at 15:00:25 UTC, seany wrote: I apologize many times for this question, may be this had already been answered somewhere, but considering today the last of my nerve is broken, I can not really find the soution. So I have a D code, which acts as a central manager of all

Re: Small part of a program : d and c versions performances diff.

2014-07-09 Thread Chris via Digitalmars-d-learn
On Wednesday, 9 July 2014 at 15:09:09 UTC, Larry wrote: On Wednesday, 9 July 2014 at 14:30:41 UTC, John Colvin wrote: On Wednesday, 9 July 2014 at 13:46:59 UTC, Larry wrote: The rest of the code is numerical so it will not change by much the fact that d cannot get back the huge launching time.

Re: How to interact with fortran code

2014-07-10 Thread Chris via Digitalmars-d-learn
On Thursday, 10 July 2014 at 12:12:20 UTC, Marc Schütz wrote: On Wednesday, 9 July 2014 at 15:09:08 UTC, Chris wrote: On Wednesday, 9 July 2014 at 15:00:25 UTC, seany wrote: I apologize many times for this question, may be this had already been answered somewhere, but considering today the las

DMDScript

2014-07-11 Thread Chris via Digitalmars-d-learn
Tried to compile on linux, got this error message (I guess I can fix it): dmd -c textgen.d textgen.d(36): Error: cannot implicitly convert expression ("DMDScript fatal runtime error: ") of type string to char[] textgen.d(36): Error: cannot implicitly convert expression (0) of type int to char[

Re: DMDScript

2014-07-14 Thread Chris via Digitalmars-d-learn
On Sunday, 13 July 2014 at 07:18:38 UTC, Jason King wrote: On Friday, 11 July 2014 at 15:45:42 UTC, Chris wrote: Tried to compile on linux, got this error message (I guess I can fix it): dmd -c textgen.d textgen.d(36): Error: cannot implicitly convert expression ("DMDScript fatal runtime erro

Re: DMDScript

2014-07-15 Thread Chris via Digitalmars-d-learn
On Monday, 14 July 2014 at 21:22:12 UTC, Jason King wrote: My idea is to use (at least test) DMDScript for server side JS. I don't mean to sound like a D-hater here, but V8 has had about 2 years more work on it than DMDScript. At one time they were. IIRC, quite close performance-wise but lo

LuaD: How to load modules

2014-07-17 Thread Chris via Digitalmars-d-learn
I'm using / testing LuaD atm. It works very well, however, I've encountered a problem. When I load the module lualsp (for "lua server pages") the app crashes. If I run the lua script on its own $ lua5.1 test.lua it works perfectly fine. The lua server page is executed correctly. If I run the

Re: LuaD: How to load modules

2014-07-17 Thread Chris via Digitalmars-d-learn
On Thursday, 17 July 2014 at 10:53:56 UTC, Chris wrote: I'm using / testing LuaD atm. It works very well, however, I've encountered a problem. When I load the module lualsp (for "lua server pages") the app crashes. If I run the lua script on its own $ lua5.1 test.lua it works perfectly fine.

Grabing C(++) stdout

2014-07-23 Thread Chris via Digitalmars-d-learn
Short question: how can I grab the stdout written to by C(++), i.e. C code: fwrite(...); std.cstream will be replaced sooner or later.

Re: Grabing C(++) stdout

2014-07-23 Thread Chris via Digitalmars-d-learn
On Wednesday, 23 July 2014 at 15:12:13 UTC, John Colvin wrote: On Wednesday, 23 July 2014 at 14:53:35 UTC, Chris wrote: Short question: how can I grab the stdout written to by C(++), i.e. C code: fwrite(...); std.cstream will be replaced sooner or later. I don't think I understand the ques

Re: Grabing C(++) stdout

2014-07-23 Thread Chris via Digitalmars-d-learn
On Wednesday, 23 July 2014 at 15:27:23 UTC, John Colvin wrote: On Wednesday, 23 July 2014 at 15:22:41 UTC, Chris wrote: On Wednesday, 23 July 2014 at 15:12:13 UTC, John Colvin wrote: On Wednesday, 23 July 2014 at 14:53:35 UTC, Chris wrote: Short question: how can I grab the stdout written to by

Re: Grabing C(++) stdout

2014-07-23 Thread Chris via Digitalmars-d-learn
The C++ code does this: size_t fwrite ( const void * ptr, size_t size, size_t count, FILE * stream ); // stream is stdout and text appears in the console (a string). I don't how to grab the text that is written to console. I might have to redirect it from within the C++ code.

Re: Grabing C(++) stdout

2014-07-24 Thread Chris via Digitalmars-d-learn
On Wednesday, 23 July 2014 at 16:46:04 UTC, FreeSlave wrote: On Wednesday, 23 July 2014 at 15:35:59 UTC, Chris wrote: The C++ code does this: size_t fwrite ( const void * ptr, size_t size, size_t count, FILE * stream ); // stream is stdout and text appears in the console (a string). I don't

[vibe.d] Proper use of preWriteCallback

2014-08-22 Thread Chris via Digitalmars-d-learn
Maybe a trivial question: How do I use "preWriteCallback" properly? It doesn't work properly for me yet (I might not see the forest for the trees at the moment). I am trying to set a field in the HTTPServerResponse. http://vibed.org/api/vibe.http.fileserver/HTTPFileServerSettings.preWriteCallb

Re: [vibe.d] Proper use of preWriteCallback

2014-08-22 Thread Chris via Digitalmars-d-learn
On Friday, 22 August 2014 at 13:58:02 UTC, Chris wrote: Maybe a trivial question: How do I use "preWriteCallback" properly? It doesn't work properly for me yet (I might not see the forest for the trees at the moment). I am trying to set a field in the HTTPServerResponse. http://vibed.org/api/

[vibe.d] Reference to std/metastrings.d

2014-08-28 Thread Chris via Digitalmars-d-learn
dmd v2.066: templ/parsetools.d has a reference to std/metastrings.d which no longer exists there.

Re: [vibe.d] Reference to std/metastrings.d

2014-08-28 Thread Chris via Digitalmars-d-learn
On Thursday, 28 August 2014 at 13:21:57 UTC, Dicebot wrote: On Thursday, 28 August 2014 at 13:19:42 UTC, Chris wrote: dmd v2.066: templ/parsetools.d has a reference to std/metastrings.d which no longer exists there. Fixed in vibe.d master afaik, you need to wait for new release or use master.

Build failed LuaD & vibe.d

2014-09-17 Thread Chris via Digitalmars-d-learn
DUB version 0.9.21 dmd version 2.065.0 vibe.d version 0.7.20 Since v0.7.19 vibe.d has vibe.utils.dictionarylist. This doesn't go well with LuaD's vibe.utils.dictionarylist (same goes for higher versions of dmd and vibe.d, see below) Compiling... source/luad/conversions/structs.d-mixin-38(38): E

Cannot deduce from type

2014-09-22 Thread Chris via Digitalmars-d-learn
Why is that? import std.stdio, std.array void main() { auto output = appender!(string); output ~= "world!"; // output.data.insertInPlace(0, "Hello, "); // Doesn't work auto asString = output.data; asString.insertInPlace(0, "Hello, "); // Works writeln(asString); // prints "Hello, w

Re: Cannot deduce from type

2014-09-22 Thread Chris via Digitalmars-d-learn
On Monday, 22 September 2014 at 15:00:09 UTC, anonymous wrote: On Monday, 22 September 2014 at 14:45:31 UTC, Chris wrote: Why is that? import std.stdio, std.array void main() { auto output = appender!(string); output ~= "world!"; // output.data.insertInPlace(0, "Hello, "); // Doesn't work

[dub] Building DLLs

2014-09-29 Thread Chris via Digitalmars-d-learn
Today I tried to build a dll via dub, unfortunately I didn't succeed. I couldn't find much on the internet about it. Is it at all possible, and if yes, what's the config I have to use? I tried this (and similar configs) { "name": "myDLL32bit", "targetName": "myDLL.dll", "targ

Re: Localizing a D application - best practices?

2014-09-29 Thread Chris via Digitalmars-d-learn
On Sunday, 28 September 2014 at 21:29:21 UTC, Cliff wrote: Coming from the C# world, all of localization we did was based on defining string resource files (XML-formatted source files which were translated into C# classes with named-string accessors by the build process) that would get included

Obedient threads

2014-10-02 Thread Chris via Digitalmars-d-learn
What is the best way to kill a thread when it pleases the owner (main thread)? The background is playing audio files. The playback happens in a separate thread so the owner can keep on listening to events triggered by the user (like stop, pause). I have to queue audio files, wait until one has

Re: Obedient threads

2014-10-02 Thread Chris via Digitalmars-d-learn
On Thursday, 2 October 2014 at 10:33:02 UTC, thedeemon wrote: Just use non-blocking receives in main thread's event loop. When you get a message from child thread that it's finished playing and you decide you don't need that thread anymore, send a message to child "you're dismissed". The child

Re: Obedient threads

2014-10-02 Thread Chris via Digitalmars-d-learn
On Thursday, 2 October 2014 at 13:05:00 UTC, ketmar via Digitalmars-d-learn wrote: On Thu, 02 Oct 2014 11:36:06 + Chris via Digitalmars-d-learn wrote: you can use receiveTimeout! to check if there is some message available. That won't do. It blocks the main thread too (fo

Re: Obedient threads

2014-10-02 Thread Chris via Digitalmars-d-learn
On Thursday, 2 October 2014 at 18:08:40 UTC, Ali Çehreli wrote: On 10/02/2014 06:49 AM, Chris wrote: On Thursday, 2 October 2014 at 13:05:00 UTC, ketmar via Digitalmars-d-learn wrote: On Thu, 02 Oct 2014 11:36:06 + Chris via Digitalmars-d-learn wrote: you can use receiveTimeout! to

Re: Obedient threads

2014-10-03 Thread Chris via Digitalmars-d-learn
On Friday, 3 October 2014 at 04:39:38 UTC, ketmar via Digitalmars-d-learn wrote: On Thu, 02 Oct 2014 20:42:49 + Chris via Digitalmars-d-learn wrote: I'll try that now. Somehow the 1.msecs solution doesn't seem clean enough. it seems that you want thread messaging to be int

Re: Beginner ?. Why does D suggest to learn java

2014-10-17 Thread Chris via Digitalmars-d-learn
On Thursday, 16 October 2014 at 22:26:51 UTC, RBfromME wrote: I'm a newbie to programming and have been looking into the D lang as a general purposing language to learn, yet the D overview indicates that java would be a better language to learn for your first programming language. Why? Looks l

Re: Beginner ?. Why does D suggest to learn java

2014-10-17 Thread Chris via Digitalmars-d-learn
On Friday, 17 October 2014 at 14:38:39 UTC, ketmar via Digitalmars-d-learn wrote: On Fri, 17 Oct 2014 14:33:57 + eles via Digitalmars-d-learn wrote: On Friday, 17 October 2014 at 13:59:03 UTC, ketmar via Digitalmars-d-learn wrote: > On Fri, 17 Oct 2014 10:10:09 +0200 > spir via Digitalm

Re: Embedding D Shared Library in WSGI Web Server

2014-10-28 Thread Chris via Digitalmars-d-learn
On Tuesday, 28 October 2014 at 00:16:03 UTC, John McFarlane wrote: Hi, I've written a modest shared library in D that I'd like to call directly from a Python web server (Linux/OS X, Apache, WSGI, Pyramid). I can call it reliably from within Python unit tests but on a running server, the libra

Re: HTML Parsing lib

2014-10-28 Thread Chris via Digitalmars-d-learn
On Sunday, 26 October 2014 at 06:20:45 UTC, Suliman wrote: Unfortunately that library has no dub package. But you can include it in your project. See info here http://code.dlang.org/package-format I can't understand how to set in dub that I need to to include in compilation process other file

Re: Pointer across threads

2014-11-04 Thread Chris via Digitalmars-d-learn
On Tuesday, 4 November 2014 at 12:47:11 UTC, Chris wrote: The following struct DATA { short* data; size_t len; } // data and len are provided by a C function // ... auto data = mymodule.getSpeechData(); // cast to immutable, because of concurrency immutable short* tmp = cast(immutable)(data.d

Pointer across threads

2014-11-04 Thread Chris via Digitalmars-d-learn
The following struct DATA { short* data; size_t len; } // data and len are provided by a C function // ... auto data = mymodule.getSpeechData(); // cast to immutable, because of concurrency immutable short* tmp = cast(immutable)(data.data); auto proc = spawn(&processData, thisTid); send(proces

Re: Pointer across threads

2014-11-04 Thread Chris via Digitalmars-d-learn
On Tuesday, 4 November 2014 at 14:01:16 UTC, anonymous wrote: On Tuesday, 4 November 2014 at 12:47:11 UTC, Chris wrote: The following struct DATA { short* data; size_t len; } // data and len are provided by a C function // ... auto data = mymodule.getSpeechData(); // cast to immutable, because

Re: Pointer across threads

2014-11-04 Thread Chris via Digitalmars-d-learn
On Tuesday, 4 November 2014 at 14:36:19 UTC, Chris wrote: On Tuesday, 4 November 2014 at 14:01:16 UTC, anonymous wrote: On Tuesday, 4 November 2014 at 12:47:11 UTC, Chris wrote: The following struct DATA { short* data; size_t len; } // data and len are provided by a C function // ... auto dat

Re: Pointer across threads

2014-11-04 Thread Chris via Digitalmars-d-learn
On Tuesday, 4 November 2014 at 14:47:49 UTC, anonymous wrote: On Tuesday, 4 November 2014 at 14:36:19 UTC, Chris wrote: I'm still curious, though, how D handles this internally, because data.data is still mutable while the other reference to the same address (tmp) is not. What if I change data.

Re: Pointer across threads

2014-11-04 Thread Chris via Digitalmars-d-learn
On Tuesday, 4 November 2014 at 16:07:11 UTC, thedeemon wrote: On Tuesday, 4 November 2014 at 14:36:19 UTC, Chris wrote: I'm still curious, though, how D handles this internally, because data.data is still mutable while the other reference to the same address (tmp) is not. What if I change data.

Re: Live without debugger?

2014-11-10 Thread Chris via Digitalmars-d-learn
On Sunday, 9 November 2014 at 08:26:59 UTC, Suliman wrote: I know that a lot of people are using for programming tools like Sublime. I am one of them. But if for very simple code it's ok, how to write hard code? Do you often need debugger when you are writing code? For which tasks debugger ar

Re: Russian translation of the "range" term?

2014-11-11 Thread Chris via Digitalmars-d-learn
On Tuesday, 11 November 2014 at 15:03:40 UTC, ketmar via Digitalmars-d-learn wrote: On Tue, 11 Nov 2014 14:52:55 + Kagamin via Digitalmars-d-learn wrote: I was thinking about list comprehension, which is what programming on ranges is. Isn't it? "list" is a good term, but it's already tak

Re: Russian translation of the "range" term?

2014-11-11 Thread Chris via Digitalmars-d-learn
On Tuesday, 11 November 2014 at 16:10:33 UTC, ketmar via Digitalmars-d-learn wrote: On Tue, 11 Nov 2014 15:38:26 + Chris via Digitalmars-d-learn wrote: On Tuesday, 11 November 2014 at 15:03:40 UTC, ketmar via Digitalmars-d-learn wrote: > On Tue, 11 Nov 2014 14:52:55 + > Kagam

Re: Russian translation of the "range" term?

2014-11-11 Thread Chris via Digitalmars-d-learn
On Tuesday, 11 November 2014 at 16:15:36 UTC, Dicebot wrote: On Tuesday, 11 November 2014 at 16:14:10 UTC, Chris wrote: Does that entail the concept that ranges (in D) are homogeneous (i.e. every member/item is of the same type)? Yes (if you mean static type) ElementType!Range is used extensi

Crash on Windows with core.stdc.stdlib.free()

2014-11-12 Thread Chris via Digitalmars-d-learn
The following causes the DLL to crash on Windows: Input: immutable(short)* data (immutable because in separate thread). // Later core.stdc.stdlib.free(cast(short *)data); (short* data is provided by the C library, where the memory is allocated) On Linux it works fine and never crashes, in t

Re: Crash on Windows with core.stdc.stdlib.free()

2014-11-12 Thread Chris via Digitalmars-d-learn
On Wednesday, 12 November 2014 at 12:58:19 UTC, ketmar via Digitalmars-d-learn wrote: On Wed, 12 Nov 2014 12:40:30 + Chris via Digitalmars-d-learn wrote: The following causes the DLL to crash on Windows: Input: immutable(short)* data (immutable because in separate thread). // Later

Re: Crash on Windows with core.stdc.stdlib.free()

2014-11-12 Thread Chris via Digitalmars-d-learn
On Wednesday, 12 November 2014 at 14:26:15 UTC, ketmar via Digitalmars-d-learn wrote: On Wed, 12 Nov 2014 14:11:35 + Chris via Digitalmars-d-learn wrote: On Wednesday, 12 November 2014 at 12:58:19 UTC, ketmar via Digitalmars-d-learn wrote: > On Wed, 12 Nov 2014 12:40:30 + >

Re: Crash on Windows with core.stdc.stdlib.free()

2014-11-12 Thread Chris via Digitalmars-d-learn
On Wednesday, 12 November 2014 at 14:42:34 UTC, Chris wrote: On Wednesday, 12 November 2014 at 14:26:15 UTC, ketmar via if you can extend C DLL, just add wrapper for `free()` there. so you will not call `free()` from D, but call C DLL function which will free the memory. it's a good practice an

Re: Crash on Windows with core.stdc.stdlib.free()

2014-11-13 Thread Chris via Digitalmars-d-learn
On Wednesday, 12 November 2014 at 16:10:34 UTC, ketmar via Digitalmars-d-learn wrote: On Wed, 12 Nov 2014 16:03:08 + Chris via Digitalmars-d-learn wrote: On Wednesday, 12 November 2014 at 14:42:34 UTC, Chris wrote: > On Wednesday, 12 November 2014 at 14:26:15 UTC, ketmar via >&g

Re: Crash on Windows with core.stdc.stdlib.free()

2014-11-14 Thread Chris via Digitalmars-d-learn
On Thursday, 13 November 2014 at 10:17:35 UTC, ketmar via Digitalmars-d-learn wrote: On Thu, 13 Nov 2014 10:08:47 + Chris via Digitalmars-d-learn wrote: Interesting though that it never crashes on Linux, only on Windows did this cause problems. seems that libc allocator is not marking

[dub] Size of executable

2014-11-27 Thread Chris via Digitalmars-d-learn
[Maybe this has been asked before.] I usually use dub to create and build projects. I built one of the projects with dub and then by hand with dmd[1] passing all the files etc. Turned out that the executable built with dub was 1.4 MB whereas the one built by hand was only 807 kB. Why is that?

[dub] Size of executable

2014-11-27 Thread Chris via Digitalmars-d-learn
[Maybe this has been asked before.] I usually use dub to create and build projects. I built one of the projects with dub and then by hand with dmd[1] passing all the files etc. Turned out that the executable built with dub was 1.4 MB whereas the one built by hand was only 807 kB. Why is that?

Re: [dub] Size of executable

2014-11-27 Thread Chris via Digitalmars-d-learn
On Thursday, 27 November 2014 at 12:29:03 UTC, Gary Willoughby wrote: On Thursday, 27 November 2014 at 09:33:49 UTC, Chris wrote: I usually use dub to create and build projects. I built one of the projects with dub and then by hand with dmd[1] passing all the files etc. Turned out that the exec

Re: [dub] Size of executable

2014-11-27 Thread Chris via Digitalmars-d-learn
On Thursday, 27 November 2014 at 13:59:23 UTC, CraigDillabaugh wrote: On Thursday, 27 November 2014 at 13:56:19 UTC, Chris wrote: On Thursday, 27 November 2014 at 12:29:03 UTC, Gary Willoughby wrote: On Thursday, 27 November 2014 at 09:33:49 UTC, Chris wrote: I usually use dub to create and bui

Re: [dub] Size of executable

2014-11-28 Thread Chris via Digitalmars-d-learn
On Thursday, 27 November 2014 at 17:08:00 UTC, CraigDillabaugh wrote: On Thursday, 27 November 2014 at 14:14:50 UTC, Chris wrote: On Thursday, 27 November 2014 at 13:59:23 UTC, CraigDillabaugh wrote: On Thursday, 27 November 2014 at 13:56:19 UTC, Chris wrote: On Thursday, 27 November 2014 at 12

Re: Why the DMD Backend?

2014-12-02 Thread Chris via Digitalmars-d-learn
On Friday, 28 November 2014 at 19:59:40 UTC, Xinok wrote: Given that we have GDC with the GCC backend and LDC with the LLVM backend, what are the benefits of keeping the DMD compiler backend? It seems to me that GCC and LLVM are far more developed and better supported by their respective commun

Re: Why the DMD Backend?

2014-12-02 Thread Chris via Digitalmars-d-learn
On Tuesday, 2 December 2014 at 10:37:18 UTC, bearophile wrote: Chris: As others have said already, the reasons why I use dmd are: Walter has developed the back-end of DMD and he wants to keep using it no matter what. But I love the very small compilation time of dmd sources. Bye, bearophi

Re: Why the DMD Backend?

2014-12-02 Thread Chris via Digitalmars-d-learn
On Tuesday, 2 December 2014 at 10:57:20 UTC, Temtaime wrote: It's only words. If we speak about LDC it can compile fast in debug mode with performance average to DMD's backend but with much great performance in release mode thanks to vectorization and other techniques. Also LDC thanks to LLVM

Re: Learning D for a non computer science background person : pre-requisite knowledge?

2014-12-05 Thread Chris via Digitalmars-d-learn
On Tuesday, 2 December 2014 at 21:10:33 UTC, Meta wrote: On Tuesday, 2 December 2014 at 16:38:34 UTC, Mayuresh Kathe wrote: While I have been a programmer for close to 23 years, it's been mostly API level code cobbling work. Would like to learn "D", but am a bit intimidated by the fact that I

Re: Learning to XML with D

2015-02-06 Thread Chris via Digitalmars-d-learn
On Friday, 6 February 2015 at 09:15:54 UTC, Derix wrote: So, I set sails to transform a bunch of HTML files with D. This, of course, will happen with the std.xml library. There is this nice example : http://dlang.org/phobos/std_xml.html#.DocumentParser that I put to some use already, however so

Re: Learning to XML with D

2015-02-06 Thread Chris via Digitalmars-d-learn
On Friday, 6 February 2015 at 14:11:19 UTC, CraigDillabaugh wrote: On Friday, 6 February 2015 at 14:09:51 UTC, CraigDillabaugh wrote: On Friday, 6 February 2015 at 11:39:32 UTC, Chris wrote: On Friday, 6 February 2015 at 09:15:54 UTC, Derix wrote: clip Thxxx The documentation says: "Warn

Re: is eC alot like D?

2015-03-13 Thread Chris via Digitalmars-d-learn
On Wednesday, 11 March 2015 at 03:16:50 UTC, Taylor Hillegeist wrote: So I found http://ec-lang.org/ it seems alot like D, But it has a company backing it. It just seems interesting. Seems to me that structs are not the same as in D, and structs in D are very powerful. I don't like the fact th

[Dscanner] Textadept integration

2015-03-24 Thread Chris via Digitalmars-d-learn
I tried to use Dscanner with Textadpet, but it doesn't work. I created the directory modules/dmd and copied the init.lua file from here [1] into it. What am I doing wrong, or is it an old version that is no longer supported? [1] https://bitbucket.org/SirAlaran/ta-d/

Re: [Dscanner] Textadept integration

2015-03-24 Thread Chris via Digitalmars-d-learn
On Tuesday, 24 March 2015 at 16:54:47 UTC, Chris wrote: I tried to use Dscanner with Textadpet, but it doesn't work. I created the directory modules/dmd and copied the init.lua file from here [1] into it. What am I doing wrong, or is it an old version that is no longer supported? [1] https://

[dub]

2015-04-14 Thread Chris via Digitalmars-d-learn
I get the following message from dub when using "--build=release": Linking... .dub/build/myprogram-release-linux.posix-x86_64-dmd_2067-C1A5273464ACE9961E3F3BA6AC04084B/abairtts.o:(.data._D65TypeInfo_xC3std5range10interfaces18__T10InputRangeTiZ10InputRange6__initZ+0x10): undefined reference to `

[dub] Release build fails with 2.067.0

2015-04-14 Thread Chris via Digitalmars-d-learn
Sorry, I forgot the title the first time around! I get the following message from dub when using "--build=release": Linking... .dub/build/myprogram-release-linux.posix-x86_64-dmd_2067-C1A5273464ACE9961E3F3BA6AC04084B/abairtts.o:(.data._D65TypeInfo_xC3std5range10interfaces18__T10InputRangeTiZ10In

Re: [dub] Release build fails with 2.067.0

2015-04-15 Thread Chris via Digitalmars-d-learn
On Tuesday, 14 April 2015 at 15:58:18 UTC, Chris wrote: Sorry, I forgot the title the first time around! I get the following message from dub when using "--build=release": Linking... .dub/build/myprogram-release-linux.posix-x86_64-dmd_2067-C1A5273464ACE9961E3F3BA6AC04084B/abairtts.o:(.data._D

Re: [dub] Release build fails with 2.067.0

2015-04-15 Thread Chris via Digitalmars-d-learn
On Wednesday, 15 April 2015 at 10:26:55 UTC, John Colvin wrote: On Wednesday, 15 April 2015 at 10:11:17 UTC, Chris wrote: On Tuesday, 14 April 2015 at 15:58:18 UTC, Chris wrote: Sorry, I forgot the title the first time around! I get the following message from dub when using "--build=release":

GC: Memory keeps growing

2015-04-15 Thread Chris via Digitalmars-d-learn
My garbage collected app starts with ~10 MB in memory, however with every execution of code it grows by at least 0.2 MB (or more depending on the input). Although I can see memory being freed (say it goes up to 32 MB and drops to 14 MB), it keeps on growing slowly but surely. I use structs fo

Re: GC: Memory keeps growing

2015-04-15 Thread Chris via Digitalmars-d-learn
On Wednesday, 15 April 2015 at 11:48:26 UTC, Rikki Cattermole wrote: On 15/04/2015 11:44 p.m., Chris wrote: My garbage collected app starts with ~10 MB in memory, however with every execution of code it grows by at least 0.2 MB (or more depending on the input). Although I can see memory being f

Re: GC: Memory keeps growing

2015-04-17 Thread Chris via Digitalmars-d-learn
On Thursday, 16 April 2015 at 18:51:25 UTC, Kagamin wrote: On Wednesday, 15 April 2015 at 12:03:49 UTC, Chris wrote: There might be some low-hanging fruit there. However, before I change anything, maybe you guys have some suggestions. See if switching to 64-bit mode changes anything. 64bit i

Templates: Array slices not recognized

2015-04-18 Thread Chris via Digitalmars-d-learn
The following: import std.stdio : writefln; import std.range.primitives : isInputRange, hasLength; void main() { size_t[] a = [1, 2, 3, 4, 5, 6, 7, 8, 9]; doSomething(a); // works doSomething(a[0..5]); // ---> Error: template slices.doSomething cannot deduce function from argument type

Re: Templates: Array slices not recognized

2015-04-18 Thread Chris via Digitalmars-d-learn
On Saturday, 18 April 2015 at 16:26:57 UTC, Max Klyga wrote: On 2015-04-18 13:46:19 +, Chris said: The following: import std.stdio : writefln; import std.range.primitives : isInputRange, hasLength; void main() { size_t[] a = [1, 2, 3, 4, 5, 6, 7, 8, 9]; doSomething(a); // works do

Re: Templates: Array slices not recognized

2015-04-20 Thread Chris via Digitalmars-d-learn
On Saturday, 18 April 2015 at 17:59:19 UTC, ketmar wrote: On Sat, 18 Apr 2015 17:50:56 +, Chris wrote: Doh! You're right! My bad. However, this makes the function less generic, but it doesn't matter here. maybe `auto ref` can help here? Yes, auto ref does the trick. I prefer it to pass

Re: Templates: Array slices not recognized

2015-04-20 Thread Chris via Digitalmars-d-learn
On Monday, 20 April 2015 at 09:58:06 UTC, Marc Schütz wrote: On Monday, 20 April 2015 at 09:07:54 UTC, Chris wrote: On Saturday, 18 April 2015 at 17:59:19 UTC, ketmar wrote: On Sat, 18 Apr 2015 17:50:56 +, Chris wrote: Doh! You're right! My bad. However, this makes the function less gene

Re: Templates: Array slices not recognized

2015-04-20 Thread Chris via Digitalmars-d-learn
On Monday, 20 April 2015 at 10:27:00 UTC, anonymous wrote: On Monday, 20 April 2015 at 10:14:27 UTC, Chris wrote: string a = "bla"; string b = "blub"; auto res = doSomething(a, b); If I didn't use "auto ref" or "ref", string would get copied, wouldn't it? auto ref doSomething(R needle, R ha

Re: Templates: Array slices not recognized

2015-04-20 Thread Chris via Digitalmars-d-learn
On Monday, 20 April 2015 at 10:42:54 UTC, Chris wrote: On Monday, 20 April 2015 at 10:27:00 UTC, anonymous wrote: On Monday, 20 April 2015 at 10:14:27 UTC, Chris wrote: string a = "bla"; string b = "blub"; auto res = doSomething(a, b); If I didn't use "auto ref" or "ref", string would get cop

multiSort for sorting AA by value

2015-04-21 Thread Chris via Digitalmars-d-learn
The following works great. It sorts an AA by value: 1. by frequency of word 2. by alphabetic order (if two or more words have the same value) import std.stdio : writefln; import std.algorithm.sorting : multiSort; void main() { size_t[string] wcount = [ "hamster":5, "zorro":80, "tr

Re: multiSort for sorting AA by value

2015-04-21 Thread Chris via Digitalmars-d-learn
On Tuesday, 21 April 2015 at 11:46:24 UTC, bearophile wrote: Chris: I'm happy with it, but maybe there is a more concise implementation? This is a bit shorter and a bit better (writefln is not yet able to format tuples nicely): void main() { import std.stdio: writeln; import std.a

Re: multiSort for sorting AA by value

2015-04-21 Thread Chris via Digitalmars-d-learn
Maybe something like bearophile's example should go into the documentation of std.algorithm.sorting.multiSort. It's a common enough thing in programming.

Re: Fibers and async io stuff for beginners

2015-04-23 Thread Chris via Digitalmars-d-learn
On Thursday, 23 April 2015 at 16:57:30 UTC, Jens Bauer wrote: On Thursday, 23 April 2015 at 14:22:01 UTC, Ali Çehreli wrote: On 04/23/2015 06:56 AM, ref2401 wrote: http://ddili.org/ders/d.en/fibers.html I appreciate any feedback before the book is finally printed sometime before DConf. This

Re: Fibers and async io stuff for beginners

2015-04-24 Thread Chris via Digitalmars-d-learn
On Thursday, 23 April 2015 at 22:26:28 UTC, Jens Bauer wrote: On Thursday, 23 April 2015 at 19:24:31 UTC, Chris wrote: On Thursday, 23 April 2015 at 16:57:30 UTC, Jens Bauer wrote: 3: Audio mixing and playback (eg. a MOD player for instance). 5: Queueing up a bunch of different jobs; At the m

Re: Fibers and async io stuff for beginners

2015-04-24 Thread Chris via Digitalmars-d-learn
On Friday, 24 April 2015 at 12:38:39 UTC, Jens Bauer wrote: On Friday, 24 April 2015 at 09:15:21 UTC, Chris wrote: I was more thinking of the audio thread. But the audio is probably better off in a separate thread. I think you could do this too. In fact, this is very similar to how the audio

[dvm] Can't install compilers on Mac

2015-04-28 Thread Chris via Digitalmars-d-learn
I keep getting this message. Why? Fetching: http://ftp.digitalmars.com/dmd.2.067.0.zip [>] 56256/54884 KB Installing: dmd-2.067.0 An unknown error occurred: tango.core.Exception.IOException@/Users/doob/development/d/tango/tango/core/Exception.d(59): /User

Re: [dvm] Can't install compilers on Mac

2015-04-29 Thread Chris via Digitalmars-d-learn
On Wednesday, 29 April 2015 at 06:41:30 UTC, Jacob Carlborg wrote: On 2015-04-28 19:46, Chris wrote: I keep getting this message. Why? Fetching: http://ftp.digitalmars.com/dmd.2.067.0.zip [>] 56256/54884 KB Installing: dmd-2.067.0 An unknown error occurr

Factory pattern in D

2015-05-01 Thread Chris via Digitalmars-d-learn
What would be the D equivalent of the factory pattern? This obviously doesn't work: struct A { int x = 42; } struct B { int x = 7; } auto factory(string type) { if (type == "A") return A(); else if (type == "B") return B(); else return A(); // default } void main() {

Re: Factory pattern in D

2015-05-01 Thread Chris via Digitalmars-d-learn
On Friday, 1 May 2015 at 10:04:46 UTC, Namespace wrote: How about this: struct A { int x = 42; } struct B { int x = 7; } T factory(T)() { return T(); } void main() { auto a = factory!(A); } That's what I was looking for, I just couldn't get it right. Thanks. Rikki: I w

Re: Factory pattern in D

2015-05-01 Thread Chris via Digitalmars-d-learn
On Friday, 1 May 2015 at 10:27:16 UTC, biozic wrote: On Friday, 1 May 2015 at 10:12:36 UTC, Chris wrote: On Friday, 1 May 2015 at 10:04:46 UTC, Namespace wrote: How about this: struct A { int x = 42; } struct B { int x = 7; } T factory(T)() { return T(); } void main() { auto a = factor

Re: Factory pattern in D

2015-05-01 Thread Chris via Digitalmars-d-learn
On Friday, 1 May 2015 at 10:46:20 UTC, Chris wrote: On Friday, 1 May 2015 at 10:27:16 UTC, biozic wrote: On Friday, 1 May 2015 at 10:12:36 UTC, Chris wrote: On Friday, 1 May 2015 at 10:04:46 UTC, Namespace wrote: How about this: struct A { int x = 42; } struct B { int x = 7; } T factor

Re: Factory pattern in D

2015-05-01 Thread Chris via Digitalmars-d-learn
On Friday, 1 May 2015 at 10:47:22 UTC, Chris wrote: On Friday, 1 May 2015 at 10:46:20 UTC, Chris wrote: On Friday, 1 May 2015 at 10:27:16 UTC, biozic wrote: On Friday, 1 May 2015 at 10:12:36 UTC, Chris wrote: On Friday, 1 May 2015 at 10:04:46 UTC, Namespace wrote: How about this: struct

Re: Factory pattern in D

2015-05-01 Thread Chris via Digitalmars-d-learn
On Friday, 1 May 2015 at 11:11:28 UTC, biozic wrote: On Friday, 1 May 2015 at 11:01:29 UTC, Chris wrote: Thinking about it, T factory(T)() { return T(); } is better suited for a factory (with static type checks). But then I don't know what factory!X() provides that X() alone doesn't.

Re: vibed: how to use pure HTML instead of template engine?

2015-05-06 Thread Chris via Digitalmars-d-learn
On Wednesday, 6 May 2015 at 13:32:48 UTC, Suliman wrote: By default vibed use Diet. Maybe it's cool, but for me it's easier to write in pure HTML. What is the best way to do it? You want to serve html files instead of templates, right? It should be something like router.get("*", serveStaticF

Re: vibed: how to use pure HTML instead of template engine?

2015-05-06 Thread Chris via Digitalmars-d-learn
On Wednesday, 6 May 2015 at 13:50:04 UTC, Chris wrote: On Wednesday, 6 May 2015 at 13:32:48 UTC, Suliman wrote: By default vibed use Diet. Maybe it's cool, but for me it's easier to write in pure HTML. What is the best way to do it? You want to serve html files instead of templates, right? It

Re: vibed: how to use pure HTML instead of template engine?

2015-05-06 Thread Chris via Digitalmars-d-learn
On Wednesday, 6 May 2015 at 14:21:24 UTC, Chris wrote: On Wednesday, 6 May 2015 at 14:07:09 UTC, Suliman wrote: I mean that I know that template can be changes dynamically, but I thought that 99% of dynamic is javascript code... Templates are like PHP, JSP, LSP etc. They can do stuff on the s

Re: vibed: how to use pure HTML instead of template engine?

2015-05-06 Thread Chris via Digitalmars-d-learn
On Wednesday, 6 May 2015 at 14:07:09 UTC, Suliman wrote: I mean that I know that template can be changes dynamically, but I thought that 99% of dynamic is javascript code... Templates are like PHP, JSP, LSP etc. They can do stuff on the server side via embedded D code, load files for example.

Re: vibed: how to use pure HTML instead of template engine?

2015-05-06 Thread Chris via Digitalmars-d-learn
On Wednesday, 6 May 2015 at 14:28:26 UTC, Adam D. Ruppe wrote: On Wednesday, 6 May 2015 at 14:23:27 UTC, Chris wrote: Especially this: http://vibed.org/templates/diet#embedded-code I think that's a misfeature... if I used vibe.d, I'd want to avoid the diet too. I have never used the templat

<    1   2   3   >