Re: How to get a screenshot?

2016-09-21 Thread Konstantin Kutsevalov via Digitalmars-d-learn
On Wednesday, 21 September 2016 at 16:36:32 UTC, Adam D. Ruppe wrote: On Wednesday, 21 September 2016 at 16:33:58 UTC, Konstantin Kutsevalov wrote: do anybody know how to get screenshot (for now in Linux only)? May be some library , examples? simplest might be to just call out to

Re: Module Clarification

2016-09-21 Thread tcak via Digitalmars-d-learn
On Wednesday, 21 September 2016 at 14:17:56 UTC, Jonathan Marler wrote: I'm working on a code generation tool and wanted to make sure my module approach was correct. The generated code has a module hierarchy, where modules can appear at any level of the hierarchy. module foo; module

Vibe.d help

2016-09-21 Thread Gestalt Theory via Digitalmars-d-learn
1. I get this error when trying to run a project in VS. dub doesn't give the error. First-chance exception: core.exception.AssertError free() called with null array. at vibe-d-0.7.26\source\vibe\utils\memory.d(110) It constantly pops up then I get an access violation and crash. 2. Many

Re: Stacktrace on Null Pointer Derefence

2016-09-21 Thread Jonathan Marler via Digitalmars-d-learn
On Wednesday, 21 September 2016 at 23:36:08 UTC, Nordlöw wrote: Doing a null deref such as int* y = null; *y = 42;// boom [...] Can you include compiler command line? I use -g -gs -debug to get stack traces on windows.

Re: Stacktrace on Null Pointer Derefence

2016-09-21 Thread ketmar via Digitalmars-d-learn
On Wednesday, 21 September 2016 at 23:36:08 UTC, Nordlöw wrote: Is there a way to get a stacktrace instead? { import etc.linux.memoryerror; registerMemoryErrorHandler(); } warning: this is hightly system-specific, and may work or not work depending of the moon phase, and may broke on any

Stacktrace on Null Pointer Derefence

2016-09-21 Thread Nordlöw via Digitalmars-d-learn
Doing a null deref such as int* y = null; *y = 42;// boom currently outputs /home/per/.emacs.d/auto-builds/dmd/Debug-Unittest-Require-Full-Coverage/home/per/foo[0x406474] /lib/x86_64-linux-gnu/libpthread.so.0(+0x113d0)[0x7f08cf25e3d0]

Re: Vibe.d compilation error: backend/cgelem.c 5018 dmd failed with exit code 1.

2016-09-21 Thread Rene Zwanenburg via Digitalmars-d-learn
On Wednesday, 21 September 2016 at 20:22:42 UTC, llaine wrote: The project is pretty big, DustMite would handle this? Yes, but it may take some time. For large projects, running it on a server is advisable. 3K LOC should be doable on a desktop machine. Dub has built-in support for running

Re: Vibe.d compilation error: backend/cgelem.c 5018 dmd failed with exit code 1.

2016-09-21 Thread llaine via Digitalmars-d-learn
On Wednesday, 21 September 2016 at 15:24:08 UTC, Saurabh Das wrote: On Wednesday, 21 September 2016 at 14:15:30 UTC, llaine wrote: I'm sure some more experienced forum readers will weigh in soon, but my understanding is that: All ICEs are errors in the compiler. You should submit it as a bug

Re: Question about __treats

2016-09-21 Thread Steven Schveighoffer via Digitalmars-d-learn
On 9/21/16 3:38 AM, Suliman wrote: On Wednesday, 21 September 2016 at 07:09:01 UTC, rikki cattermole wrote: On 21/09/2016 7:06 PM, Suliman wrote: It's seems that __treats is language keyword that help to get info from compile-time. But there is also lib named std.traits and I can't understand

Re: thisExePath purity

2016-09-21 Thread Steven Schveighoffer via Digitalmars-d-learn
On 9/20/16 3:42 PM, crimaniak wrote: On Tuesday, 20 September 2016 at 13:35:27 UTC, Steven Schveighoffer wrote: Note that if you don't import the module that contains the static ctor, it should be trimmed by the linker. Let's imagine linker can trim even imported module with static ctor, if

Re: Using Libraries

2016-09-21 Thread Karabuta via Digitalmars-d-learn
On Wednesday, 21 September 2016 at 16:23:35 UTC, Darren wrote: Also I've been making a bit of a mess in dub apparently. I'm getting: Locally registered package gl3n ~master was not found. Please run "dub remove-local C:\Users\Darren\D stuff\opengl\lib". whenever dub gets used. Then if I

Re: How to get a screenshot?

2016-09-21 Thread Adam D. Ruppe via Digitalmars-d-learn
On Wednesday, 21 September 2016 at 16:33:58 UTC, Konstantin Kutsevalov wrote: do anybody know how to get screenshot (for now in Linux only)? May be some library , examples? simplest might be to just call out to `shellExec("import -window root filename.png");` and it will write the file.

How to get a screenshot?

2016-09-21 Thread Konstantin Kutsevalov via Digitalmars-d-learn
Hello everyone, do anybody know how to get screenshot (for now in Linux only)? May be some library , examples?

Re: Vibe.d compilation error: backend/cgelem.c 5018 dmd failed with exit code 1.

2016-09-21 Thread Saurabh Das via Digitalmars-d-learn
On Wednesday, 21 September 2016 at 14:15:30 UTC, llaine wrote: Using dmd every day and since one day I'm getting this error when I'm compiling using the -b release flag (dub build -b release). I'm compiling a vibe.d application that has roughly 3k LoC. Removing the -b flag solves the

Re: Custom test runner

2016-09-21 Thread Nick Sabalausky via Digitalmars-d-learn
On 09/21/2016 02:26 AM, Jacob Carlborg wrote: On 2016-09-21 07:51, Nick Sabalausky wrote: IIRC, there is some way to hook in and use a custom unittest-runner. How does one go about that? http://dlang.org/phobos/core_runtime.html#.Runtime.moduleUnitTester Cool, thanks. I got that to work,

Module Clarification

2016-09-21 Thread Jonathan Marler via Digitalmars-d-learn
I'm working on a code generation tool and wanted to make sure my module approach was correct. The generated code has a module hierarchy, where modules can appear at any level of the hierarchy. module foo; module foo.bar; In this case, module foo and foo.bar are independent modules. The foo

Vibe.d compilation error: backend/cgelem.c 5018 dmd failed with exit code 1.

2016-09-21 Thread llaine via Digitalmars-d-learn
Using dmd every day and since one day I'm getting this error when I'm compiling using the -b release flag (dub build -b release). I'm compiling a vibe.d application that has roughly 3k LoC. Removing the -b flag solves the problem. Dmd version : v2.071.0 Vibe.d version : 0.7.26

Re: What is the best way to store bitarray (blob) for pasting in database?

2016-09-21 Thread Vadim Lopatin via Digitalmars-d-learn
On Wednesday, 6 April 2016 at 12:56:39 UTC, Suliman wrote: I have next task. There is PostgreSQL DB. With field like: id, mydata. mydata - is binary blob. It can be 10MB or even more. I need load all data from PostgreSQL to SQLLite. I decided ti create struct that and fill it with data. And

Re: PostgreSQL. Unknown parameter of configuration : "autocommit"

2016-09-21 Thread Vadim Lopatin via Digitalmars-d-learn
On Tuesday, 5 April 2016 at 07:53:20 UTC, Suliman wrote: Is there anybody who have success connect to PostgreSQL with ddbc? I am getting next error: https://github.com/buggins/ddbc/issues/22 Fixed.

Re: Using Libraries

2016-09-21 Thread Darren via Digitalmars-d-learn
On Tuesday, 20 September 2016 at 19:45:57 UTC, Karabuta wrote: On Tuesday, 20 September 2016 at 15:38:55 UTC, Darren wrote: On Tuesday, 20 September 2016 at 15:07:53 UTC, rikki cattermole wrote: Ok lets start at the very beginning... I think I need to start before that, haha. I might need

Re: Template overloads involving `string` and `char[constant]` return value

2016-09-21 Thread Adam D. Ruppe via Digitalmars-d-learn
On Wednesday, 21 September 2016 at 12:39:57 UTC, Johan Engelen wrote: It should really be mentioned in the documentation of toHexString, with an actual example instead of a unittest. Do you use my dpldocs.info? I add such notes there from time to time:

Re: Template overloads involving `string` and `char[constant]` return value

2016-09-21 Thread Johan Engelen via Digitalmars-d-learn
On Wednesday, 21 September 2016 at 13:06:08 UTC, Adam D. Ruppe wrote: the variable you are assigning the result to never does anything with regard to overloads or template args. Gotcha, thanks.

Re: Template overloads involving `string` and `char[constant]` return value

2016-09-21 Thread Adam D. Ruppe via Digitalmars-d-learn
On Wednesday, 21 September 2016 at 12:29:54 UTC, Johan Engelen wrote: Wouldn't something like this be possible? `T toHexString(string toHexString(Order order = Order.increasing, LetterCase letterCase = LetterCase.upper, T)(.) if (T == string)` I'm not sure what that's supposed to

Allocating Heap/GC Storage upon Default Construction of RC Containers

2016-09-21 Thread Nordlöw via Digitalmars-d-learn
Is there any way to make a default constructor of a struct container allocate/initialize an internal pointer? I need this in a container with RC behaviour similar to struct Container { this()// this is currently forbidden: { _rcStore =

Re: Template overloads involving `string` and `char[constant]` return value

2016-09-21 Thread Johan Engelen via Digitalmars-d-learn
On Wednesday, 21 September 2016 at 12:20:14 UTC, Adam D. Ruppe wrote: This is a pretty common pitfall (and IMO one of the most egregious design flaws in the language), I see it all the time. I write very little D code, so I guess it had to happen at some point then. Man, this is really bad

Re: Template overloads involving `string` and `char[constant]` return value

2016-09-21 Thread Johan Engelen via Digitalmars-d-learn
On Wednesday, 21 September 2016 at 12:20:14 UTC, Adam D. Ruppe wrote: It is neither, the compiler chose the right overload (remember, overloads are chosen based on the arguments alone, the type you specify for the variable holding the return value isn't a consideration there) and the

Re: Template overloads involving `string` and `char[constant]` return value

2016-09-21 Thread Adam D. Ruppe via Digitalmars-d-learn
On Wednesday, 21 September 2016 at 12:07:31 UTC, Johan Engelen wrote: string a = toHexString(hash); This is a pretty common pitfall (and IMO one of the most egregious design flaws in the language), I see it all the time. toHexString, when given a static array, returns a static array,

Template overloads involving `string` and `char[constant]` return value

2016-09-21 Thread Johan Engelen via Digitalmars-d-learn
What's the bug in the following code: ```d import std.digest.md; import std.stdio; pragma(inline, false) // just in case string getHash() { ubyte[16] hash = [1,2,3,4,5,6,6,78,8,8,7,7,6,3,2,3]; string a = toHexString(hash); return a; } pragma(inline, false) // just in case void

Re: Error: no property 'select' for type 'ddbc.core.Statement'

2016-09-21 Thread Vadim Lopatin via Digitalmars-d-learn
On Sunday, 31 January 2016 at 09:15:04 UTC, Suliman wrote: I hope that here I will get answer faster then on https://github.com/buggins/ddbc/issues/18 I am using ddbc diver for access to mysql. I need to return result of request to struct. My code is next: import std.stdio; import ddbc.all;

Re: D and math, can you isolate this ?

2016-09-21 Thread Basile B. via Digitalmars-d-learn
On Tuesday, 20 September 2016 at 12:35:18 UTC, Basile B. wrote: The problem is here: https://github.com/BBasile/iz/blob/master/import/iz/math.d#L849 - f(x,c) = 1.0 - pow(1.0 - pow(x, 2.0/c), c * 0.5); - c(f0.5)) = ? Which means that I ask you if you can isolate c for y = 1.0 - pow(1.0 -

Re: D and math, can you isolate this ?

2016-09-21 Thread Nicholas Wilson via Digitalmars-d-learn
On Wednesday, 21 September 2016 at 08:21:29 UTC, Basile B. wrote: On Wednesday, 21 September 2016 at 01:34:06 UTC, Nicholas Wilson wrote: On Tuesday, 20 September 2016 at 12:35:18 UTC, Basile B. wrote: [...] So if we rearrange and take the logs of both sides and divide by c we get

Re: D and math, can you isolate this ?

2016-09-21 Thread Basile B. via Digitalmars-d-learn
On Wednesday, 21 September 2016 at 01:34:06 UTC, Nicholas Wilson wrote: On Tuesday, 20 September 2016 at 12:35:18 UTC, Basile B. wrote: I've recently started an easing/interpolation family of function in my D user library. It's based on something I know well since I've already used them in

Re: Question about __treats

2016-09-21 Thread rikki cattermole via Digitalmars-d-learn
On 21/09/2016 7:38 PM, Suliman wrote: On Wednesday, 21 September 2016 at 07:09:01 UTC, rikki cattermole wrote: On 21/09/2016 7:06 PM, Suliman wrote: It's seems that __treats is language keyword that help to get info from compile-time. But there is also lib named std.traits and I can't

Re: Question about __treats

2016-09-21 Thread Suliman via Digitalmars-d-learn
On Wednesday, 21 September 2016 at 07:09:01 UTC, rikki cattermole wrote: On 21/09/2016 7:06 PM, Suliman wrote: It's seems that __treats is language keyword that help to get info from compile-time. But there is also lib named std.traits and I can't understand difference

Re: Question about __treats

2016-09-21 Thread rikki cattermole via Digitalmars-d-learn
On 21/09/2016 7:06 PM, Suliman wrote: It's seems that __treats is language keyword that help to get info from compile-time. But there is also lib named std.traits and I can't understand difference https://dlang.org/spec/traits.html https://dlang.org/phobos/std_traits.html Could you explain

Question about __treats

2016-09-21 Thread Suliman via Digitalmars-d-learn
It's seems that __treats is language keyword that help to get info from compile-time. But there is also lib named std.traits and I can't understand difference https://dlang.org/spec/traits.html https://dlang.org/phobos/std_traits.html Could you explain the difference?

Re: Custom test runner

2016-09-21 Thread Jacob Carlborg via Digitalmars-d-learn
On 2016-09-21 07:51, Nick Sabalausky wrote: IIRC, there is some way to hook in and use a custom unittest-runner. How does one go about that? http://dlang.org/phobos/core_runtime.html#.Runtime.moduleUnitTester -- /Jacob Carlborg

Re: What exactly does the compiler switch -betterC do?

2016-09-21 Thread Jacob Carlborg via Digitalmars-d-learn
On 2016-09-21 02:25, Anonymouse wrote: On Monday, 20 June 2016 at 06:35:32 UTC, Jacob Carlborg wrote: It is intended to allow you to link an application without druntime. [...] What is the equavilent in gdc and ldc? No idea, try ldc/gdc --help ;) -- /Jacob Carlborg

Re: setting fields of object using traits

2016-09-21 Thread Jacob Carlborg via Digitalmars-d-learn
On 2016-09-20 21:45, Ram_B wrote: I'm trying to set fields of object from JSON with traits library. How i can to it properly? import std.stdio; import std.json; import std.traits; import std.meta: Alias; class Obj{ void fromJSON(this T)(JSONValue j){ foreach(field;