Re: forcing tabs in regex

2018-02-27 Thread Dmitry Olshansky via Digitalmars-d-learn
On Wednesday, 28 February 2018 at 05:09:03 UTC, psychoticRabbit wrote: On Wednesday, 28 February 2018 at 01:06:30 UTC, dark777 wrote: Regex validates years bisexto and not bisextos in format: const std::regex

Re: forcing tabs in regex

2018-02-27 Thread psychoticRabbit via Digitalmars-d-learn
On Wednesday, 28 February 2018 at 01:06:30 UTC, dark777 wrote: Regex validates years bisexto and not bisextos in format: const std::regex

Re: What's the latest news for calling D from python 3 using ctypes?

2018-02-27 Thread chuoiit18 via Digitalmars-d-learn
On Wednesday, 28 February 2018 at 02:40:59 UTC, Nicholas Wilson wrote: On Wednesday, 28 February 2018 at 01:19:25 UTC, Enjoys Math wrote: [...] For some reason, idk why, PyD is a dub source dependency (as opposed to a library). If you add \path\to\pyd to the include directory(?) dub

Re: What's the latest news for calling D from python 3 using ctypes?

2018-02-27 Thread Nicholas Wilson via Digitalmars-d-learn
On Wednesday, 28 February 2018 at 01:19:25 UTC, Enjoys Math wrote: Can't build now: -- Build started: Project: categorytheorybackend, Configuration: debug Win32 -- Building C:\MyProjects\___ENJOYS_MATH\CategoryTheoryFrontend\CategoryTheoryBackend\categorytheorybackend.exe... Error:

Re: What's the latest news for calling D from python 3 using ctypes?

2018-02-27 Thread Enjoys Math via Digitalmars-d-learn
On Wednesday, 28 February 2018 at 00:18:17 UTC, Nicholas Wilson wrote: On Tuesday, 27 February 2018 at 23:59:10 UTC, Enjoys Math wrote: I am making a library that will run very speedily in D (or, failing that, C++) and do the backend work of a PyQt5 gui. Was wondering the simplest route to

Re: What's the latest news for calling D from python 3 using ctypes?

2018-02-27 Thread Enjoys Math via Digitalmars-d-learn
Can't build now: -- Build started: Project: categorytheorybackend, Configuration: debug Win32 -- Building C:\MyProjects\___ENJOYS_MATH\CategoryTheoryFrontend\CategoryTheoryBackend\categorytheorybackend.exe... Error: Error writing file

Re: What's the latest news for calling D from python 3 using ctypes?

2018-02-27 Thread Enjoys Math via Digitalmars-d-learn
On Wednesday, 28 February 2018 at 01:10:36 UTC, Enjoys Math wrote: Got it. dub init myproject from within my python frontend source dir will create a subdirectory. Then you do dub generate visuald from within the subdir myproject.

Re: What's the latest news for calling D from python 3 using ctypes?

2018-02-27 Thread Enjoys Math via Digitalmars-d-learn
Got it. dub init myproject from within my python frontend source dir will create a subdirectory.

forcing tabs in regex

2018-02-27 Thread dark777 via Digitalmars-d-learn
Regex validates years bisexto and not bisextos in format: const std::regex

Re: What's the latest news for calling D from python 3 using ctypes?

2018-02-27 Thread Enjoys Math via Digitalmars-d-learn
On Wednesday, 28 February 2018 at 00:18:17 UTC, Nicholas Wilson wrote: On Tuesday, 27 February 2018 at 23:59:10 UTC, Enjoys Math wrote: I am making a library that will run very speedily in D (or, failing that, C++) and do the backend work of a PyQt5 gui. Was wondering the simplest route to

Re: What's the latest news for calling D from python 3 using ctypes?

2018-02-27 Thread Nicholas Wilson via Digitalmars-d-learn
On Tuesday, 27 February 2018 at 23:59:10 UTC, Enjoys Math wrote: I am making a library that will run very speedily in D (or, failing that, C++) and do the backend work of a PyQt5 gui. Was wondering the simplest route to accomplish this, preferably in ctypes calls. Thanks.

Re: Equivalent to Python with Statement

2018-02-27 Thread Seb via Digitalmars-d-learn
On Tuesday, 27 February 2018 at 16:18:43 UTC, Stefan Koch wrote: On Tuesday, 27 February 2018 at 16:17:20 UTC, Jonathan wrote: I know Python's `with` statement can be used to have an automatic close action: ``` with open("x.txt") as file: #do something with file #`file.close()`

What's the latest news for calling D from python 3 using ctypes?

2018-02-27 Thread Enjoys Math via Digitalmars-d-learn
I am making a library that will run very speedily in D (or, failing that, C++) and do the backend work of a PyQt5 gui. Was wondering the simplest route to accomplish this, preferably in ctypes calls. Thanks.

Re: Making mir.random.ndvariable.multivariateNormalVar create bigger data sets than 2

2018-02-27 Thread jmh530 via Digitalmars-d-learn
On Tuesday, 27 February 2018 at 21:54:34 UTC, Nathan S. wrote: Cross-posting from the github issue (https://github.com/libmir/mir-random/issues/77) with a workaround (execute it at https://run.dlang.io/is/Swr1xU): [snip] Step in the right direction at least.

Re: Cast a 2d static array to a 1d static array. T[s][r] -> T[s*r]

2018-02-27 Thread TheFlyingFiddle via Digitalmars-d-learn
On Tuesday, 27 February 2018 at 22:17:25 UTC, Jonathan wrote: On Tuesday, 27 February 2018 at 22:13:05 UTC, Jonathan wrote: Is it possible to cast a 2d static length array to a 1d static length array? E.g. int[2][2] a = [[1,2],[3,4]]; int[4]b = cast(int[4])a; Is not the byte data in

Re: Cast a 2d static array to a 1d static array. T[s][r] -> T[s*r]

2018-02-27 Thread Jonathan via Digitalmars-d-learn
On Tuesday, 27 February 2018 at 22:13:05 UTC, Jonathan wrote: Is it possible to cast a 2d static length array to a 1d static length array? E.g. int[2][2] a = [[1,2],[3,4]]; int[4]b = cast(int[4])a; Is not the byte data in memory exactly the same? *( [pos,size].ptr .cst!(void*)

Cast a 2d static array to a 1d static array. T[s][r] -> T[s*r]

2018-02-27 Thread Jonathan via Digitalmars-d-learn
Is it possible to cast a 2d static length array to a 1d static length array? E.g. int[2][2] a = [[1,2],[3,4]]; int[4]b = cast(int[4])a; Is not the byte data in memory exactly the same?

Re: Making mir.random.ndvariable.multivariateNormalVar create bigger data sets than 2

2018-02-27 Thread Nathan S. via Digitalmars-d-learn
Cross-posting from the github issue (https://github.com/libmir/mir-random/issues/77) with a workaround (execute it at https://run.dlang.io/is/Swr1xU): I am not sure what the correct interface should be for this in the long run, but for now you can use a wrapper function to convert an

Re: Struct ctor called with cast

2018-02-27 Thread Radu via Digitalmars-d-learn
On Tuesday, 27 February 2018 at 21:04:59 UTC, ag0aep6g wrote: On 02/27/2018 09:59 PM, Radu wrote: On Tuesday, 27 February 2018 at 20:51:25 UTC, ag0aep6g wrote: On 02/27/2018 09:30 PM, Radu wrote: [...] [...] [...] So the bug is that somehow the templated version makes it so there is an

Re: Struct ctor called with cast

2018-02-27 Thread Steven Schveighoffer via Digitalmars-d-learn
On 2/27/18 3:59 PM, Radu wrote: On Tuesday, 27 February 2018 at 20:51:25 UTC, ag0aep6g wrote: On 02/27/2018 09:30 PM, Radu wrote: enum Type { a }; struct S(Type t = Type.a) { this(Type)(Type t) { import std.stdio; writeln("ctor called."); } } void main() {    

Re: Struct ctor called with cast

2018-02-27 Thread ag0aep6g via Digitalmars-d-learn
On 02/27/2018 09:59 PM, Radu wrote: On Tuesday, 27 February 2018 at 20:51:25 UTC, ag0aep6g wrote: On 02/27/2018 09:30 PM, Radu wrote: [...] enum Type { a }; struct S(Type t = Type.a) { this(Type)(Type t) { import std.stdio; writeln("ctor called."); } } [...]

Re: Struct ctor called with cast

2018-02-27 Thread Radu via Digitalmars-d-learn
On Tuesday, 27 February 2018 at 20:51:25 UTC, ag0aep6g wrote: On 02/27/2018 09:30 PM, Radu wrote: enum Type { a }; struct S(Type t = Type.a) {     this(Type)(Type t)     {     import std.stdio;     writeln("ctor called.");     } } void main() {    auto x = S!(Type.a)(Type.a);   

Re: Struct ctor called with cast

2018-02-27 Thread ag0aep6g via Digitalmars-d-learn
On 02/27/2018 09:30 PM, Radu wrote: enum Type { a }; struct S(Type t = Type.a) {     this(Type)(Type t)     {     import std.stdio;     writeln("ctor called.");     } } void main() {    auto x = S!(Type.a)(Type.a);    void* y =    auto z = (cast(S!(Type.a)) y); }

Re: How do I trace that memory error?

2018-02-27 Thread Marc via Digitalmars-d-learn
On Tuesday, 27 February 2018 at 16:55:27 UTC, Marc wrote: [...] So deep down the error is in that method which I call from deserializeLine() function: void setValue(T, V)(auto ref T aggregate, string field, V value) { writeln("setting {", field, "} to {",

Struct ctor called with cast

2018-02-27 Thread Radu via Digitalmars-d-learn
I have this: enum Type { a }; struct S(Type t = Type.a) { this(Type)(Type t) { import std.stdio; writeln("ctor called."); } } void main() { auto x = S!(Type.a)(Type.a); void* y = auto z = (cast(S!(Type.a)) y); } Surprisingly the cast will actually

Re: Equivalent to Python with Statement

2018-02-27 Thread Daniel Kozak via Digitalmars-d-learn
yes, for classes you can use scoped: import std.stdio; import std.typecons : scoped; class A { void saySomething() { writeln("Hi from A"); } ~this() { writeln("Destruct A"); } } void main() { with(scoped!A()) { saySomething();

Re: Validity of cast(void*)size_t.max

2018-02-27 Thread Ali Çehreli via Digitalmars-d-learn
On 02/27/2018 11:56 AM, Steven Schveighoffer wrote: On 2/27/18 11:37 AM, Nordlöw wrote: On Tuesday, 27 February 2018 at 16:31:51 UTC, Steven Schveighoffer wrote: Why not use null? It's already used to indicate that a slot is free. :) cast(void*)1 is likely to be unused. -Steve And to

Re: Validity of cast(void*)size_t.max

2018-02-27 Thread Steven Schveighoffer via Digitalmars-d-learn
On 2/27/18 11:37 AM, Nordlöw wrote: On Tuesday, 27 February 2018 at 16:31:51 UTC, Steven Schveighoffer wrote: Why not use null? It's already used to indicate that a slot is free. :) cast(void*)1 is likely to be unused. -Steve

Re: Making mir.random.ndvariable.multivariateNormalVar create bigger data sets than 2

2018-02-27 Thread jmh530 via Digitalmars-d-learn
On Tuesday, 27 February 2018 at 17:24:22 UTC, Nathan S. wrote: On Tuesday, 27 February 2018 at 16:42:00 UTC, Nathan S. wrote: On Tuesday, 27 February 2018 at 15:08:42 UTC, jmh530 wrote: Nevertheless, it probably can't hurt to file an issue if you can't get something like the first one to work.

Re: Making mir.random.ndvariable.multivariateNormalVar create bigger data sets than 2

2018-02-27 Thread Nathan S. via Digitalmars-d-learn
On Tuesday, 27 February 2018 at 16:42:00 UTC, Nathan S. wrote: On Tuesday, 27 February 2018 at 15:08:42 UTC, jmh530 wrote: Nevertheless, it probably can't hurt to file an issue if you can't get something like the first one to work. I would think it should just work. The problem is that

Re: How do I trace that memory error?

2018-02-27 Thread Marc via Digitalmars-d-learn
On Tuesday, 27 February 2018 at 15:08:23 UTC, Stefan Koch wrote: On Monday, 26 February 2018 at 18:01:07 UTC, Marc wrote: I've tried both gdb and windbg debugger both it either get a "received signal ?" from gdb or crash the GUI application (windbg). The error is:

Re: How do I trace that memory error?

2018-02-27 Thread Marc via Digitalmars-d-learn
On Tuesday, 27 February 2018 at 15:08:23 UTC, Stefan Koch wrote: On Monday, 26 February 2018 at 18:01:07 UTC, Marc wrote: I've tried both gdb and windbg debugger both it either get a "received signal ?" from gdb or crash the GUI application (windbg). The error is:

Re: Making mir.random.ndvariable.multivariateNormalVar create bigger data sets than 2

2018-02-27 Thread Nathan S. via Digitalmars-d-learn
On Tuesday, 27 February 2018 at 15:08:42 UTC, jmh530 wrote: Nevertheless, it probably can't hurt to file an issue if you can't get something like the first one to work. I would think it should just work. The problem is that `mir.random.ndvariable` doesn't satisfy

Re: Validity of cast(void*)size_t.max

2018-02-27 Thread Nordlöw via Digitalmars-d-learn
On Tuesday, 27 February 2018 at 16:31:51 UTC, Steven Schveighoffer wrote: Why not use null? -Steve It's already used to indicate that a slot is free. :)

Re: Validity of cast(void*)size_t.max

2018-02-27 Thread Steven Schveighoffer via Digitalmars-d-learn
On 2/27/18 9:13 AM, Nordlöw wrote: Is `cast(void*)size_t.max` always an invalid address? You mean, can it point at valid data? Possibly, but likely not. In my past as an embedded developer, a lot of times the interrupt vectors are stored at the end of address space. Is so, could it be

Re: Equivalent to Python with Statement

2018-02-27 Thread Jonathan via Digitalmars-d-learn
On Tuesday, 27 February 2018 at 16:18:43 UTC, Stefan Koch wrote: On Tuesday, 27 February 2018 at 16:17:20 UTC, Jonathan wrote: I know Python's `with` statement can be used to have an automatic close action: ``` with open("x.txt") as file: #do something with file #`file.close()`

Equivalent to Python with Statement

2018-02-27 Thread Jonathan via Digitalmars-d-learn
I know Python's `with` statement can be used to have an automatic close action: ``` with open("x.txt") as file: #do something with file #`file.close()` called automatically ``` I know D's `with` statement does something different but is there some sort of equivalent?

Re: Equivalent to Python with Statement

2018-02-27 Thread Stefan Koch via Digitalmars-d-learn
On Tuesday, 27 February 2018 at 16:17:20 UTC, Jonathan wrote: I know Python's `with` statement can be used to have an automatic close action: ``` with open("x.txt") as file: #do something with file #`file.close()` called automatically ``` I know D's `with` statement does

Re: Making mir.random.ndvariable.multivariateNormalVar create bigger data sets than 2

2018-02-27 Thread jmh530 via Digitalmars-d-learn
On Tuesday, 27 February 2018 at 09:23:49 UTC, kerdemdemir wrote: I need a classifier in my project. Since it is I believe most easy to implement I am trying to implement logistic regression. I am trying to do the same as the python example:

Re: How do I trace that memory error?

2018-02-27 Thread Stefan Koch via Digitalmars-d-learn
On Monday, 26 February 2018 at 18:01:07 UTC, Marc wrote: I've tried both gdb and windbg debugger both it either get a "received signal ?" from gdb or crash the GUI application (windbg). The error is: core.exception.OutOfMemoryError@src\core\exception.d(696): Memory allocation failed How do

Re: How do I trace that memory error?

2018-02-27 Thread Marc via Digitalmars-d-learn
On Tuesday, 27 February 2018 at 14:06:19 UTC, Nicholas Wilson wrote: On Monday, 26 February 2018 at 18:01:07 UTC, Marc wrote: I've tried both gdb and windbg debugger both it either get a "received signal ?" from gdb or crash the GUI application (windbg). The error is:

Re: CMake support for D

2018-02-27 Thread King_DuckZ via Digitalmars-d-learn
On Tuesday, 27 February 2018 at 09:20:21 UTC, Russel Winder wrote: On Mon, 2018-02-26 at 20:28 +, King_DuckZ via Digitalmars-d-learn wrote: […] One [more] year ahead, and I found this old thread I had forgotten about. In the meantime, trentforkert has stopped (apparently) working on

Validity of cast(void*)size_t.max

2018-02-27 Thread Nordlöw via Digitalmars-d-learn
Is `cast(void*)size_t.max` always an invalid address? Is so, could it be used to indicate removed/delete elements in hash tables with open addressing and a key type being either a pointer or class? And will it work correctly with the GC?

Re: How do I trace that memory error?

2018-02-27 Thread Nicholas Wilson via Digitalmars-d-learn
On Monday, 26 February 2018 at 18:01:07 UTC, Marc wrote: I've tried both gdb and windbg debugger both it either get a "received signal ?" from gdb or crash the GUI application (windbg). The error is: core.exception.OutOfMemoryError@src\core\exception.d(696): Memory allocation failed How do

Re: iota to array

2018-02-27 Thread Steven Schveighoffer via Digitalmars-d-learn
On 2/26/18 6:34 PM, psychoticRabbit wrote: On Sunday, 25 February 2018 at 14:52:19 UTC, Steven Schveighoffer wrote: 1 == 1.0, no? no. at least, not when a language forces you to think in terms of types. But you aren't. You are thinking in terms of text representation of values (which is

Re: Derelict GLFW3 and dynamic linking on Linux

2018-02-27 Thread Kayomn via Digitalmars-d-learn
On Tuesday, 27 February 2018 at 13:14:38 UTC, Mike Parker wrote: On Tuesday, 27 February 2018 at 12:00:20 UTC, Kayomn wrote: [...] It *is* a version problem. The exception is a SymbolLoadException, which means the loader found the library just fine (you can see it in the file name,

Re: Derelict GLFW3 and dynamic linking on Linux

2018-02-27 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 27 February 2018 at 12:00:20 UTC, Kayomn wrote: derelict.util.exception.SymbolLoadException@../../.dub/packages/derelict-util-2.0.6/source/derelict/util/exception.d(35): Failed to load symbol glfwSetWindowIcon from shared library /u sr/lib/x86_64-linux-gnu/libglfw.so.3.1 I was

Derelict GLFW3 and dynamic linking on Linux

2018-02-27 Thread Kayomn via Digitalmars-d-learn
Hi, I've been working on something using Windows and now I'm attempting to build it on Linux with Dub, however I appear to be having an issue. import base.application; import derelict.opengl3.gl3; import derelict.glfw3.glfw3; int main(string[] args) { DerelictGL3.load();

Making mir.random.ndvariable.multivariateNormalVar create bigger data sets than 2

2018-02-27 Thread kerdemdemir via Digitalmars-d-learn
I need a classifier in my project. Since it is I believe most easy to implement I am trying to implement logistic regression. I am trying to do the same as the python example: https://beckernick.github.io/logistic-regression-from-scratch/ I need to data sets with which I will test. This

Re: CMake support for D

2018-02-27 Thread Russel Winder via Digitalmars-d-learn
On Mon, 2018-02-26 at 20:28 +, King_DuckZ via Digitalmars-d-learn wrote: > […] > > One [more] year ahead, and I found this old thread I had > forgotten about. In the meantime, trentforkert has stopped > (apparently) working on cmake, and dcarp's has failed me for > projects larger than a