How to kill whole application if child thread raises an exception?

2016-10-26 Thread dm via Digitalmars-d-learn
Thanks all. I gues I must rewrote my app to send exeptions to other threads, use non blocking io, etc, etc.

Re: Unresolved Symbols in a nanovg Library

2016-10-26 Thread Jason C. Wells via Digitalmars-d-learn
I have a nice screen shot of the nanovg demo running. The old xeyes is a nice touch. I was excited to post the photo here but it looks like I cannot. I can tell by the animations that this will be precisely what I need to animate svg based instrumentation. I ended up making one more static

Re: Unresolved Symbols in a nanovg Library

2016-10-26 Thread ketmar via Digitalmars-d-learn
On Thursday, 27 October 2016 at 02:12:34 UTC, Jason C. Wells wrote: I have no idea where this ModuleInfoZ thing is coming from. as Adam said, it means that it imports some module, and you didn't passed it to dmd. in this case, it is iv.nanovg.oui package (this is Blender-like GUI controls --

Re: Unresolved Symbols in a nanovg Library

2016-10-26 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 27 October 2016 at 02:18:26 UTC, Jason C. Wells wrote: My learning process is very organic and trial and error. yeah, that's us too :) With time, knowing all the details is better - you'll learn a lot though the start can be slower. I usually keep my code simple, but there's a

Re: Unresolved Symbols in a nanovg Library

2016-10-26 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 27 October 2016 at 02:12:34 UTC, Jason C. Wells wrote: Error 42: Symbol Undefined _D2iv6nanovg3oui12__ModuleInfoZ That means some module was imported but not compiled. You can run the `ddemangle` program that comes with dmd to translate it (or you'll get used to just reading it

Re: Unresolved Symbols in a nanovg Library

2016-10-26 Thread Jason C. Wells via Digitalmars-d-learn
BTW, I am not ignoring you guys when I haven't used rdmd ( I tried briefly but got stuck) or specifying all *.d files on the command line (did that with some success). My learning process is very organic and trial and error. I appreciate what you are doing for me. Thanks for the invite to

Re: Unresolved Symbols in a nanovg Library

2016-10-26 Thread Jason C. Wells via Digitalmars-d-learn
Adding iv\stb\ttf.d cleared up most of the remaining linker errors. While compiling iv\nanovg_demo\example.d I am left with: bin\example.obj(example) Error 42: Symbol Undefined _D2iv6nanovg3oui12__ModuleInfoZ bin\example.obj(example) Error 42: Symbol Undefined _D2iv6nanovg12__ModuleInfoZ

Re: Unresolved Symbols in a nanovg Library

2016-10-26 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 27 October 2016 at 01:48:54 UTC, Jason C. Wells wrote: arsd has ttf.d and stb_truetype.d. Comments in stb_truetype.d say use ttf.d instead. My ttf.d is just version 1.2 of stb_truetype.d basically... the two files are very similar and should be generally compatible. ketmar's

Re: Unresolved Symbols in a nanovg Library

2016-10-26 Thread ketmar via Digitalmars-d-learn
On Thursday, 27 October 2016 at 01:48:54 UTC, Jason C. Wells wrote: I'm not sure I fully understand name mangling, but it looks like nanovg wants to use iv\stb\ttf.d from it's own source tree. But Ketmar said "p.s. you will also need stb_ttf port, arsd repo has it under the name "ttf.d"." So

Unresolved Symbols in a nanovg Library

2016-10-26 Thread Jason C. Wells via Digitalmars-d-learn
I've gone about building static libraries for nanovg and arsd. (I'm feeling pretty good about what I've learned in the last couple days, so I gave it a whirl.) arsd has ttf.d and stb_truetype.d. Comments in stb_truetype.d say use ttf.d instead. nanovg has a ttf.d also. There are three

Re: [vibe.d] showing images

2016-10-26 Thread Nicholas Wilson via Digitalmars-d-learn
On Wednesday, 26 October 2016 at 18:39:00 UTC, Rene Zwanenburg wrote: On Wednesday, 26 October 2016 at 12:42:09 UTC, Nicholas Wilson wrote: [...] You need to make the images accessible over HTTP. Note the use of staticFileServer in the following example: http://vibed.org/docs#http-routing

Re: [vibe.d] showing images

2016-10-26 Thread Karabuta via Digitalmars-d-learn
On Wednesday, 26 October 2016 at 12:42:09 UTC, Nicholas Wilson wrote: doctype html html body -foreach(s; images) // it doesn't seem to like #{s} or !{s} img(src=s) [...] Inherit from Web interface?

Re: test for equality of the content of two AA

2016-10-26 Thread Ali Çehreli via Digitalmars-d-learn
On 10/26/2016 08:03 AM, Paolo Invernizzi wrote: As the subject states, what is the best idiomatic way for doing that? Thanks in advance /Paolo If you mean D's AAs, then that is already implemented: void main() { auto a = [ "hello" : 1, "world" : 2 ]; auto b = [ "world" : 2, "hello"

Re: [vibe.d] showing images

2016-10-26 Thread Rene Zwanenburg via Digitalmars-d-learn
On Wednesday, 26 October 2016 at 12:42:09 UTC, Nicholas Wilson wrote: doctype html html body -foreach(s; images) // it doesn't seem to like #{s} or !{s} img(src=s) -- shared static this() { auto router = new URLRouter;

Re: Map type to class instance at compile-time

2016-10-26 Thread Ali Çehreli via Digitalmars-d-learn
On 10/26/2016 10:48 AM, pontius wrote: > Apologies for the long post or stupid questions, I only started to learn > D today. Looking at what you've achieved in one day, we really need you! :) > I have a use case where various types (A, B, C) need to be associated > with instances of different

Map type to class instance at compile-time

2016-10-26 Thread pontius via Digitalmars-d-learn
Apologies for the long post or stupid questions, I only started to learn D today. I have a use case where various types (A, B, C) need to be associated with instances of different classes (ManagerA, ManagerB, ManagerC). A certain object (globalManager) should redirect operations on those types

test for equality of the content of two AA

2016-10-26 Thread Paolo Invernizzi via Digitalmars-d-learn
As the subject states, what is the best idiomatic way for doing that? Thanks in advance /Paolo

Re: How to kill whole application if child thread raises an exception?

2016-10-26 Thread Kagamin via Digitalmars-d-learn
On Wednesday, 26 October 2016 at 10:03:30 UTC, dm wrote: Why so strange default behavior do not kill other threads in case some of threads raise exception? But thanks anyway. AFAIK, on posix you should join the child thread, and when you do, the stored exception is rethrown in the joining

Re: How to kill whole application if child thread raises an exception?

2016-10-26 Thread Adam D. Ruppe via Digitalmars-d-learn
On Wednesday, 26 October 2016 at 08:42:02 UTC, dm wrote: I want to kill all my threads if it is unhandled exception. How can I do that? The spawnLinked function might help: http://dpldocs.info/experimental-docs/std.concurrency.spawnLinked.html

Re: [vibe.d] showing images

2016-10-26 Thread Nicholas Wilson via Digitalmars-d-learn
On Wednesday, 26 October 2016 at 12:57:24 UTC, wobbles wrote: On Wednesday, 26 October 2016 at 12:42:09 UTC, Nicholas Wilson wrote: [...] When you get the 404, do you see the contents of 'writeln(images);' in your terminal? yes. the 404 is only for the image the page still renders fine,

Re: [vibe.d] showing images

2016-10-26 Thread wobbles via Digitalmars-d-learn
On Wednesday, 26 October 2016 at 12:42:09 UTC, Nicholas Wilson wrote: [...] When you get the 404, do you see the contents of 'writeln(images);' in your terminal?

[vibe.d] showing images

2016-10-26 Thread Nicholas Wilson via Digitalmars-d-learn
doctype html html body -foreach(s; images) // it doesn't seem to like #{s} or !{s} img(src=s) -- shared static this() { auto router = new URLRouter; router.registerWebInterface(new CamController); auto settings = new HTTPServerSettings;

Re: Neural Networks / ML Libraries for D

2016-10-26 Thread Ilya Yaroshenko via Digitalmars-d-learn
On Tuesday, 25 October 2016 at 13:56:45 UTC, Saurabh Das wrote: On Tuesday, 25 October 2016 at 11:55:27 UTC, maarten van damme wrote: There is mir https://github.com/libmir/mir which is geared towards machine learning, I don't know if it has anything about neural networks, I've yet to use it.

Re: How to kill whole application if child thread raises an exception?

2016-10-26 Thread Paolo Invernizzi via Digitalmars-d-learn
On Wednesday, 26 October 2016 at 08:42:02 UTC, dm wrote: Hi. I tried code below: import std.concurrency; import std.stdio; void func() { throw new Exception("I'm an exception"); } void main() { auto tID = spawn(); foreach(line; stdin.byLine) send(tID, ""); } I expect my

Re: Avoiding GC

2016-10-26 Thread Edwin van Leeuwen via Digitalmars-d-learn
On Wednesday, 26 October 2016 at 08:18:07 UTC, hardreset wrote: Is there a page somewhere on how to program D without using the GC? How do I allocate / free structs / classes on the heap manually? New would be GCed memeory wouldnt it? Delete is being depreciated? thanks. There is the

Re: How to kill whole application if child thread raises an exception?

2016-10-26 Thread dm via Digitalmars-d-learn
On Wednesday, 26 October 2016 at 10:09:05 UTC, rikki cattermole wrote: If you throw an error it should crash the entire application. But really you need to set up sync points within your application to allow it to die gracefully. I tried throw new Error... But main thread still working. Tried

Re: How to kill whole application if child thread raises an exception?

2016-10-26 Thread rikki cattermole via Digitalmars-d-learn
On 26/10/2016 11:03 PM, dm wrote: On Wednesday, 26 October 2016 at 09:43:10 UTC, rikki cattermole wrote: ```D void entryPoint(alias func)() { try { func(); } catch (Exception e) { import std.stdio; writeln(e.toString()); } } void main() { auto tid =

Re: How to kill whole application if child thread raises an exception?

2016-10-26 Thread dm via Digitalmars-d-learn
On Wednesday, 26 October 2016 at 09:43:10 UTC, rikki cattermole wrote: ```D void entryPoint(alias func)() { try { func(); } catch (Exception e) { import std.stdio; writeln(e.toString()); } } void main() { auto tid =

Re: How to kill whole application if child thread raises an exception?

2016-10-26 Thread Basile B. via Digitalmars-d-learn
On Wednesday, 26 October 2016 at 09:43:10 UTC, rikki cattermole wrote: Basically when you spawn a thread giving the function, you pass it through another function which will catch any exceptions not normally caught. Of course this really should be the default behavior but somebody else may

Re: How to kill whole application if child thread raises an exception?

2016-10-26 Thread rikki cattermole via Digitalmars-d-learn
Basically when you spawn a thread giving the function, you pass it through another function which will catch any exceptions not normally caught. Of course this really should be the default behavior but somebody else may be more of a help here. And it is pseudo code, so please don't expect

Re: How to kill whole application if child thread raises an exception?

2016-10-26 Thread dm via Digitalmars-d-learn
On Wednesday, 26 October 2016 at 08:53:13 UTC, rikki cattermole wrote: Simple, handle the exceptions on each thread. I don't want handle exceptions. I want my application crash with exception description. Can you change my code above to show how it can be made?

Re: How to kill whole application if child thread raises an exception?

2016-10-26 Thread rikki cattermole via Digitalmars-d-learn
On 26/10/2016 9:42 PM, dm wrote: Hi. I tried code below: import std.concurrency; import std.stdio; void func() { throw new Exception("I'm an exception"); } void main() { auto tID = spawn(); foreach(line; stdin.byLine) send(tID, ""); } I expect my application will die

How to kill whole application if child thread raises an exception?

2016-10-26 Thread dm via Digitalmars-d-learn
Hi. I tried code below: import std.concurrency; import std.stdio; void func() { throw new Exception("I'm an exception"); } void main() { auto tID = spawn(); foreach(line; stdin.byLine) send(tID, ""); } I expect my application will die immediatly, but main thread still

Re: Avoiding GC

2016-10-26 Thread Andrea Fontana via Digitalmars-d-learn
On Wednesday, 26 October 2016 at 08:18:07 UTC, hardreset wrote: Is there a page somewhere on how to program D without using the GC? How do I allocate / free structs / classes on the heap manually? New would be GCed memeory wouldnt it? Delete is being depreciated? thanks. Probably you want

Avoiding GC

2016-10-26 Thread hardreset via Digitalmars-d-learn
Is there a page somewhere on how to program D without using the GC? How do I allocate / free structs / classes on the heap manually? New would be GCed memeory wouldnt it? Delete is being depreciated? thanks.

Re: Module Name Resolution

2016-10-26 Thread Jason C. Wells via Digitalmars-d-learn
On Wednesday, 26 October 2016 at 05:46:30 UTC, ketmar wrote: this is a repository name. it is supposed to be named just "iv", and git names main directory by repository name if you are doing a simple clone. my bad, i should have made that clear. Ok. That helps.