Re: Link error 42 (WinApi)

2016-02-15 Thread ref2401 via Digitalmars-d-learn
On Tuesday, 16 February 2016 at 06:22:33 UTC, Rikki Cattermole wrote: Found the problem, you haven't linked against gdi. Thank you It works. I should have done this: set filesToUse=main.d gdi32.lib dmd @filesToUse -ofconsole-app.exe -debug -unittest -wi

Re: How to Generate Entities from an Existing Database in D language ORM?

2016-02-15 Thread ZardoZ via Digitalmars-d-learn
On Monday, 15 February 2016 at 14:33:24 UTC, Eliatto wrote: Hello! I've found the following C++/Qt project: http://www.treefrogframework.org/ It contains ORM. Treefrog can generate model stubs from the existing database. Is it possible to do the same in any D language ORM library? BTW, similar

Re: Link error 42 (WinApi)

2016-02-15 Thread Rikki Cattermole via Digitalmars-d-learn
On 16/02/16 7:13 PM, ref2401 wrote: On Tuesday, 16 February 2016 at 05:39:26 UTC, Rikki Cattermole wrote: Try compiling with 64bit. If it works, its just the import libs not containing the symbol. dmd main.d -ofconsole-app.exe -debug -unittest -wi -m64 That's what I'm getting now:

Re: Link error 42 (WinApi)

2016-02-15 Thread ref2401 via Digitalmars-d-learn
On Tuesday, 16 February 2016 at 05:39:26 UTC, Rikki Cattermole wrote: Try compiling with 64bit. If it works, its just the import libs not containing the symbol. dmd main.d -ofconsole-app.exe -debug -unittest -wi -m64 That's what I'm getting now: console-app.obj : error LNK2019: unresolved

Re: Link error 42 (WinApi)

2016-02-15 Thread Rikki Cattermole via Digitalmars-d-learn
On 16/02/16 6:36 PM, ref2401 wrote: import core.sys.windows.windows; void main(string[] args) { // I'm aware it would not work properly. int formatIndex = ChoosePixelFormat(null, null); } When I compile the code above I'm getting the following link error: OPTLINK (R) for Win32

Re: Confusion regarding struct lifecycle

2016-02-15 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 16 February 2016 at 03:39:00 UTC, Matt Elkins wrote: On Tuesday, 16 February 2016 at 03:31:51 UTC, maik klein wrote: In D you can always call Foo.init even with @disable this(), Foo.init can be called implicitly (not just explicitly)? If so, why even have @disable this(), if it

Re: Confusion regarding struct lifecycle

2016-02-15 Thread Matt Elkins via Digitalmars-d-learn
On Tuesday, 16 February 2016 at 03:31:51 UTC, maik klein wrote: In D you can always call Foo.init even with @disable this(), Foo.init can be called implicitly (not just explicitly)? If so, why even have @disable this(), if it offers no guarantees? The first 3 destructor calls are from the 3

Re: Confusion regarding struct lifecycle

2016-02-15 Thread maik klein via Digitalmars-d-learn
On Tuesday, 16 February 2016 at 02:09:15 UTC, Matt Elkins wrote: I've been bitten again by my lack of understanding of the D struct lifecycle :-/. I managed to reduce my buggy program to the following example: [...] In D you can always call Foo.init even with @disable this(), The first 3

Confusion regarding struct lifecycle

2016-02-15 Thread Matt Elkins via Digitalmars-d-learn
I've been bitten again by my lack of understanding of the D struct lifecycle :-/. I managed to reduce my buggy program to the following example: [code] import std.stdio; struct Foo { @disable this(); @disable this(this); this(int valueIn) {value = valueIn;} ~this()

Re: What is the best way to stop App after exception?

2016-02-15 Thread Mike Parker via Digitalmars-d-learn
On Monday, 15 February 2016 at 15:38:07 UTC, Suliman wrote: Since C's "exit" function is not liked, best thing you can do is to throw an Error when you want to close the program. You are not supposed to catch Errors. So, it eventually will stop the currently running thread. but if I throw

Re: What is the best way to stop App after exception?

2016-02-15 Thread Sean Campbell via Digitalmars-d-learn
On Monday, 15 February 2016 at 11:38:05 UTC, Suliman wrote: I have got class Config with method parseconfig. I need terminate App if parsing of config was failed. The problem that I do not know how to do it better. void parseconfig() { try { //something go wrong } catch(Exception e) {

Re: What is the best way to stop App after exception?

2016-02-15 Thread hjkl via Digitalmars-d-learn
On Monday, 15 February 2016 at 11:38:05 UTC, Suliman wrote: What is the best practice to stop app ? Iveseenthisnewlibtheotherday:https://github.com/John-Colvin/exitclean

Re: joiner: How to iterate over immutable ranges?

2016-02-15 Thread Bastiaan Veelo via Digitalmars-d-learn
On Monday, 15 February 2016 at 18:13:48 UTC, Ali Çehreli wrote: On 02/15/2016 06:25 AM, Bastiaan Veelo wrote: > I didn't even know about save... Its documentation is hidden > quite > well, because I still cannot find it. Heh. :) It is a part of the ForwardRange interface (more correctly,

Re: joiner: How to iterate over immutable ranges?

2016-02-15 Thread Ali Çehreli via Digitalmars-d-learn
On 02/15/2016 06:25 AM, Bastiaan Veelo wrote: > I didn't even know about save... Its documentation is hidden quite > well, because I still cannot find it. Heh. :) It is a part of the ForwardRange interface (more correctly, "concept"?). It looks like "the additional capability that one can save

Re: What is the best way to stop App after exception?

2016-02-15 Thread Ali Çehreli via Digitalmars-d-learn
On 02/15/2016 03:38 AM, Suliman wrote: > I have got class Config with method parseconfig. I need terminate App if > parsing of config was failed. The problem that I do not know how to do > it better. As others said, exceptions inherited from Error indicate situations where the application

Re: What is the best way to stop App after exception?

2016-02-15 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, February 15, 2016 15:38:07 Suliman via Digitalmars-d-learn wrote: > On Monday, 15 February 2016 at 15:17:01 UTC, tcak wrote: > > Since C's "exit" function is not liked, best thing you can do > > is to throw an Error when you want to close the program. You > > are not supposed to catch

Re: What is the best way to stop App after exception?

2016-02-15 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, February 15, 2016 11:38:05 Suliman via Digitalmars-d-learn wrote: > I have got class Config with method parseconfig. I need terminate > App if parsing of config was failed. The problem that I do not > know how to do it better. > > void parseconfig() > { > try > { >//something go

Re: What is the best way to stop App after exception?

2016-02-15 Thread Messenger via Digitalmars-d-learn
On Monday, 15 February 2016 at 15:17:01 UTC, tcak wrote: [...] BUT (This is a big but with single t), in multithreaded process, throwing Error in a thread that is not the main thread won't stop your process still and you are still left with "exit" function. Mind, if you're doing the normal

Re: What is the best way to stop App after exception?

2016-02-15 Thread Suliman via Digitalmars-d-learn
On Monday, 15 February 2016 at 15:17:01 UTC, tcak wrote: On Monday, 15 February 2016 at 11:38:05 UTC, Suliman wrote: I have got class Config with method parseconfig. I need terminate App if parsing of config was failed. The problem that I do not know how to do it better. void parseconfig() {

Re: What is the best way to stop App after exception?

2016-02-15 Thread tcak via Digitalmars-d-learn
On Monday, 15 February 2016 at 11:38:05 UTC, Suliman wrote: I have got class Config with method parseconfig. I need terminate App if parsing of config was failed. The problem that I do not know how to do it better. void parseconfig() { try { //something go wrong } catch(Exception e) {

Re: joiner: How to iterate over immutable ranges?

2016-02-15 Thread Bastiaan Veelo via Digitalmars-d-learn
On Monday, 15 February 2016 at 01:42:30 UTC, Mike Parker wrote: On Sunday, 14 February 2016 at 19:32:31 UTC, Bastiaan Veelo wrote: Maybe this [1] will help shed some light. [1] https://www.packtpub.com/books/content/understanding-ranges Good idea. I have your book, but it is very nice to

How to Generate Entities from an Existing Database in D language ORM?

2016-02-15 Thread Eliatto via Digitalmars-d-learn
Hello! I've found the following C++/Qt project: http://www.treefrogframework.org/ It contains ORM. Treefrog can generate model stubs from the existing database. Is it possible to do the same in any D language ORM library? BTW, similar situation was discussed here:

Re: joiner: How to iterate over immutable ranges?

2016-02-15 Thread Bastiaan Veelo via Digitalmars-d-learn
On Monday, 15 February 2016 at 01:14:10 UTC, Ali Çehreli wrote: On 02/14/2016 11:32 AM, Bastiaan Veelo wrote: If it's acceptable for you, the following code calls .save on the elements and it works: import std.algorithm.iteration; import std.stdio; import std.array;// <-- ADDED void

Re: Photoshop programming

2016-02-15 Thread thedeemon via Digitalmars-d-learn
On Sunday, 14 February 2016 at 09:48:54 UTC, Patience wrote: Photoshop has the ability to be controlled by scripts and programming languages. For example, C# can be used to access photoshop by adding the appropriate reference and using directives. I believe it is COM based but I am not totally

Re: Customizing printing of structs (writeln / to!sth behavior).

2016-02-15 Thread cym13 via Digitalmars-d-learn
On Monday, 15 February 2016 at 12:03:44 UTC, ciechowoj wrote: It there a way to change how writeln converts structs to strings? I read in the documentation it uses to!string to convert the struct. Is there a way to overload to!string for my own type? Let say I have: struct Point { int

Customizing printing of structs (writeln / to!sth behavior).

2016-02-15 Thread ciechowoj via Digitalmars-d-learn
It there a way to change how writeln converts structs to strings? I read in the documentation it uses to!string to convert the struct. Is there a way to overload to!string for my own type? Let say I have: struct Point { int x, y; } and I want writeln(Point(3, 4)); to print "[3, 4]"

Re: Scala Spark-like RDD for D?

2016-02-15 Thread data pulverizer via Digitalmars-d-learn
On Monday, 15 February 2016 at 11:09:10 UTC, data pulverizer wrote: Are there are any plans to create a scala spark-like RDD class for D (https://www.cs.berkeley.edu/~matei/papers/2012/nsdi_spark.pdf)? This is a powerful model that has taken the data science world by storm; it would be useful

What is the best way to stop App after exception?

2016-02-15 Thread Suliman via Digitalmars-d-learn
I have got class Config with method parseconfig. I need terminate App if parsing of config was failed. The problem that I do not know how to do it better. void parseconfig() { try { //something go wrong } catch(Exception e) { writeln(e.msg); // throw any exception here } } But my

Scala Spark-like RDD for D?

2016-02-15 Thread data pulverizer via Digitalmars-d-learn
Are there are any plans to create a scala spark-like RDD class for D (https://www.cs.berkeley.edu/~matei/papers/2012/nsdi_spark.pdf)? This is a powerful model that has taken the data science world by storm; it would be useful to have something like this in the D world. Most of the algorithms

Re: D Book page 402 Concurrency FAIL

2016-02-15 Thread thedeemon via Digitalmars-d-learn
On Sunday, 14 February 2016 at 22:54:36 UTC, Brother Bill wrote: Please provide full replacement of this toy program that works with D version 2.070.0 This one works fine for me in Windows with VisualD and DMD 2.070.0: -- import std.concurrency, std.stdio,