Re: Is there anybody who used FireBird DB?

2016-03-30 Thread Kagamin via Digitalmars-d-learn
You can also look here https://github.com/cruisercoder/dstddb/blob/master/src/std/database/odbc/database.d for an example of accessing ODBC from D (only strings are supported so far).

Re: Is there anybody who used FireBird DB?

2016-03-30 Thread Kagamin via Digitalmars-d-learn
Latest version of what? ODBC bindings are in phobos: http://dlang.org/phobos/etc_c_odbc_sql.html

Re: Error: template instance does not match template declaration

2016-03-30 Thread ref2401 via Digitalmars-d-learn
On Tuesday, 29 March 2016 at 18:29:27 UTC, Ali Çehreli wrote: So, dict is a template value parameter of type T[string]. I don't think you can use an associative array as a template value parameter. (Can we?) Found this in D language reference:

Re: Issue Turning Template into Variadic Template

2016-03-30 Thread jmh530 via Digitalmars-d-learn
On Wednesday, 30 March 2016 at 18:56:29 UTC, H. S. Teoh wrote: Does this do what you want? I think it does. That's an approach I would not have thought of. I do not really know much about AliasSeq.

Re: Issue Turning Template into Variadic Template

2016-03-30 Thread jmh530 via Digitalmars-d-learn
On Wednesday, 30 March 2016 at 18:56:29 UTC, H. S. Teoh wrote: Does this do what you want? Okay, I've looked at this a bit more thoroughly and it works perfectly (perhaps with a better name put in phobos?). If I'm understanding this correctly, the ImplType creates the correct type

Issue Turning Template into Variadic Template

2016-03-30 Thread jmh530 via Digitalmars-d-learn
I wrote a version of cartesianProduct that will return the cartesian product when the some of the types are not ranges. The original code is below. My issue is that I can't figure out how to turn it into a variadic template. The latest thing I tried is: auto mixedCartesianProduct(T...)(T x)

Re: char array weirdness

2016-03-30 Thread Jack Stouffer via Digitalmars-d-learn
On Wednesday, 30 March 2016 at 05:16:04 UTC, H. S. Teoh wrote: If we didn't have autodecoding, would be a simple matter of searching for sentinel substrings. This also indicates that most of the work done by autodecoding is unnecessary -- it's wasted work since most of the string data is

Re: Is there anybody who used FireBird DB?

2016-03-30 Thread Kagamin via Digitalmars-d-learn
Also there's ODBC driver http://www.firebirdsql.org/en/devel-odbc-driver/ - you can use it, phobos has ODBC bindings.

Re: Linking a shared library in dub

2016-03-30 Thread maik klein via Digitalmars-d-learn
On Wednesday, 30 March 2016 at 12:46:08 UTC, Vadim Lopatin wrote: On Wednesday, 30 March 2016 at 12:19:34 UTC, maik klein wrote: I want to finally convert my project to windows. That means that I want to build it on windows and linux. The problem is that I have one external c library 'glfw'.

Re: Is there anybody who used FireBird DB?

2016-03-30 Thread Suliman via Digitalmars-d-learn
I have found next driver http://www.ibpp.org/#what_is_ibpp Here http://sourceforge.net/projects/ibpp is link to zip package that include two exe files and ibpp.lib ibpp.h it's look like it's ass that need for binding. I tried to run htod.exe but got error: D:\Project\2016>htod.exe ibpp.h

Re: Issue Turning Template into Variadic Template

2016-03-30 Thread H. S. Teoh via Digitalmars-d-learn
On Wed, Mar 30, 2016 at 06:12:40PM +, jmh530 via Digitalmars-d-learn wrote: > I wrote a version of cartesianProduct that will return the cartesian > product when the some of the types are not ranges. The original code > is below. > > My issue is that I can't figure out how to turn it into a

Re: Is there anybody who used FireBird DB?

2016-03-30 Thread Kagamin via Digitalmars-d-learn
Mingw or windows platform SDK.

Re: Is there anybody who used FireBird DB?

2016-03-30 Thread Suliman via Digitalmars-d-learn
On Wednesday, 30 March 2016 at 18:31:35 UTC, Kagamin wrote: Also there's ODBC driver http://www.firebirdsql.org/en/devel-odbc-driver/ - you can use it, phobos has ODBC bindings. Where I can get the latest version? There is not any package on http://code.dlang.org/ and searching on github

How to escape control characters?

2016-03-30 Thread cy via Digitalmars-d-learn
This might be a dumb question. How do I format a string so that all the newlines print as \n and all the tabs as \t and such?

Re: How to escape control characters?

2016-03-30 Thread Seb via Digitalmars-d-learn
On Thursday, 31 March 2016 at 03:15:49 UTC, cy wrote: This might be a dumb question. How do I format a string so that all the newlines print as \n and all the tabs as \t and such? http://dlang.org/spec/lex.html#WysiwygString r"ab\n" or `ab\n`

Re: Async read an output stream but how many bytes ?

2016-03-30 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 31 March 2016 at 00:50:16 UTC, Basile B. wrote: There should be a way to know how many bytes are available ? You are already using poll()... I'd just use read() directly on the file number too. It will read as much as is available up to the max size of the buffer, but if it

Re: Linking a shared library in dub

2016-03-30 Thread maik klein via Digitalmars-d-learn
On Thursday, 31 March 2016 at 00:06:19 UTC, maik klein wrote: On Wednesday, 30 March 2016 at 17:38:15 UTC, maik klein wrote: On Wednesday, 30 March 2016 at 12:46:08 UTC, Vadim Lopatin wrote: On Wednesday, 30 March 2016 at 12:19:34 UTC, maik klein wrote: I want to finally convert my project to

Re: Is there anybody who used FireBird DB?

2016-03-30 Thread Suliman via Digitalmars-d-learn
On Wednesday, 30 March 2016 at 20:23:13 UTC, Kagamin wrote: You can also look here https://github.com/cruisercoder/dstddb/blob/master/src/std/database/odbc/database.d for an example of accessing ODBC from D (only strings are supported so far). Does ita mean that I would not able to select

Re: Async read an output stream but how many bytes ?

2016-03-30 Thread Basile B. via Digitalmars-d-learn
On Thursday, 31 March 2016 at 01:12:50 UTC, Adam D. Ruppe wrote: On Thursday, 31 March 2016 at 00:50:16 UTC, Basile B. wrote: There should be a way to know how many bytes are available ? You are already using poll()... I'd just use read() directly on the file number too. It will read as much

Re: How to escape control characters?

2016-03-30 Thread H. S. Teoh via Digitalmars-d-learn
On Thu, Mar 31, 2016 at 03:23:52AM +, Seb via Digitalmars-d-learn wrote: > On Thursday, 31 March 2016 at 03:15:49 UTC, cy wrote: > >This might be a dumb question. How do I format a string so that all > >the newlines print as \n and all the tabs as \t and such? > >

Re: char array weirdness

2016-03-30 Thread ag0aep6g via Digitalmars-d-learn
On 30.03.2016 19:30, Jack Stouffer wrote: Just to drive this point home, I made a very simple benchmark. Iterating over code points when you don't need to is 100x slower than iterating over code units. [...] enum testCount = 1_000_000; enum var = "Lorem ipsum dolor sit amet, consectetur

Re: Linking a shared library in dub

2016-03-30 Thread maik klein via Digitalmars-d-learn
On Wednesday, 30 March 2016 at 17:38:15 UTC, maik klein wrote: On Wednesday, 30 March 2016 at 12:46:08 UTC, Vadim Lopatin wrote: On Wednesday, 30 March 2016 at 12:19:34 UTC, maik klein wrote: I want to finally convert my project to windows. That means that I want to build it on windows and

const(int) cannot be sent as int message

2016-03-30 Thread Ali Çehreli via Digitalmars-d-learn
As expected, the following trivial case works: void main() { auto func = delegate(int i) {}; // expects int func(const(int)(42));// passes const(int) } The following concurrency program fails at runtime: import core.thread; import std.concurrency; void foo() {

Re: Issue Turning Template into Variadic Template

2016-03-30 Thread H. S. Teoh via Digitalmars-d-learn
On Wed, Mar 30, 2016 at 08:43:03PM +, jmh530 via Digitalmars-d-learn wrote: > On Wednesday, 30 March 2016 at 18:56:29 UTC, H. S. Teoh wrote: > > > >Does this do what you want? > > > > Okay, I've looked at this a bit more thoroughly and it works perfectly > (perhaps with a better name put in

Async read an output stream but how many bytes ?

2016-03-30 Thread Basile B. via Digitalmars-d-learn
Hey, I have a class that wraps a process and implements two events. One of them is called after poll() for example if new data are available. The event is called correctly but I don't know how exactly how to read the data: - per buffer of fixed size ? - using the stream information ? If i

dub, copyFiles and linux

2016-03-30 Thread Andre via Digitalmars-d-learn
Hi, I created a library which uses some shared objects. The dub.json looks like this: { "name": "sec", "configurations": [ { "name": "debug", "targetType": "library",

Re: How to escape control characters?

2016-03-30 Thread cy via Digitalmars-d-learn
Oh, cool. On Thursday, 31 March 2016 at 03:29:19 UTC, H. S. Teoh wrote: Or implement manual substitution with a pipeline: string myString = ...; string escapedStr = myString .chunks(1) .map!(c => (c == "\n") ? "\\n" : (c

Re: char array weirdness

2016-03-30 Thread Jack Stouffer via Digitalmars-d-learn
On Wednesday, 30 March 2016 at 22:49:24 UTC, ag0aep6g wrote: When byCodeUnit takes no time at all, isn't 1µs infinite times slower, instead of 100 times? And I think byCodeUnits's 1µs is so low that noise is going to mess with any ratios you make. It's not that it's taking no time at all,

Re: How to escape control characters?

2016-03-30 Thread cy via Digitalmars-d-learn
On Thursday, 31 March 2016 at 03:23:52 UTC, Seb wrote: http://dlang.org/spec/lex.html#WysiwygString r"ab\n" or `ab\n` Yes I know. But I mean like, string a = r"ab\n"; writeln(escape(a)); // => ab\n

Re: dub, copyFiles and linux

2016-03-30 Thread Andre via Digitalmars-d-learn
On Thursday, 31 March 2016 at 04:57:01 UTC, Andre wrote: I can't see why it is working with vibe-d projects (openssl libraries copied to application folder) but not for my project. There is no console output "copying files for..." while using dub for my application project. What is wrong?

Re: dub, copyFiles and linux

2016-03-30 Thread Andre via Digitalmars-d-learn
OK solved;) Shared libraries doesn't need to be mentioned in libs section in dub. Therefore copying after the linking is correct and is working fine. Kind regards André

Array Indexing/Slicing Range Checking, Exceptions and @nogc

2016-03-30 Thread Nordlöw via Digitalmars-d-learn
I'm working on a support-it-all Array implementation (with optional sortedness) at https://github.com/nordlow/justd/blob/master/packedarray.d that has a very flexible memory allocation model via either GC.malloc or via privately imported malloc, realloc and free. This in order to provide

Linking a shared library in dub

2016-03-30 Thread maik klein via Digitalmars-d-learn
I want to finally convert my project to windows. That means that I want to build it on windows and linux. The problem is that I have one external c library 'glfw'. I thought that I would just link with it explicitly but actually I am not completely sure how. So I just added a submodule,

Re: Joining AliasSeq/TypeTuple s

2016-03-30 Thread Adrian Matoga via Digitalmars-d-learn
On Tuesday, 29 March 2016 at 10:06:43 UTC, Adrian Matoga wrote: (...) Another version that doesn't misbehave if first and second are of different lengths: import std.meta : AliasSeq; template RR(A...) { template With(B...) { static if (A.length == 0 || B.length ==

Re: Linking a shared library in dub

2016-03-30 Thread Vadim Lopatin via Digitalmars-d-learn
On Wednesday, 30 March 2016 at 12:19:34 UTC, maik klein wrote: I want to finally convert my project to windows. That means that I want to build it on windows and linux. The problem is that I have one external c library 'glfw'. I thought that I would just link with it explicitly but actually

Re: Debugging D DLL from C# app with C linkage for native Unity 5 plugin

2016-03-30 Thread Benjamin Thaut via Digitalmars-d-learn
On Tuesday, 29 March 2016 at 23:41:28 UTC, Thalamus wrote: dmd dllmain.d dll.def -w -wi -g -map -ofLogic.dll -m64 -debug -shared Anyone know what I should try next? Am I missing something simple? :) thanks! Thalamus You should be using "-gc" instead of "-g" when building 64-bit D

Dustmiting a dmft assert

2016-03-30 Thread Nicholas Wilson via Digitalmars-d-learn
so $core.exception.AssertError@/Users/nicholaswilson/d/phobos/std/conv.d(4061): emplace: Chunk is not aligned. 4 dfmt0x000109536ace _d_assert_msg + 142 5 dfmt0x0001094d600f

Re: Dustmiting a dmft assert

2016-03-30 Thread Vladimir Panteleev via Digitalmars-d-learn
On Wednesday, 30 March 2016 at 09:06:20 UTC, Nicholas Wilson wrote: object.Exception@dustmite.d(244): Initial test fails Works for me: $ cat src/test.d import std.stdio; void main() { writeln("foo"); writeln("bar"); } $ dustmite src "cat test.d 2>&1 | grep -qF foo && dmd -c

Re: Dustmiting a dmft assert

2016-03-30 Thread Nicholas Wilson via Digitalmars-d-learn
On Wednesday, 30 March 2016 at 09:06:20 UTC, Nicholas Wilson wrote: so Oops. should be $ dfmt out.d core.exception.AssertError@/Users/nicholaswilson/d/phobos/std/conv.d(4061): emplace: Chunk is not aligned.

Re: Debugging D DLL from C# app with C linkage for native Unity 5 plugin

2016-03-30 Thread Thalamus via Digitalmars-d-learn
On Wednesday, 30 March 2016 at 07:38:07 UTC, Benjamin Thaut wrote: On Tuesday, 29 March 2016 at 23:41:28 UTC, Thalamus wrote: dmd dllmain.d dll.def -w -wi -g -map -ofLogic.dll -m64 -debug -shared Anyone know what I should try next? Am I missing something simple? :) thanks! Thalamus

Re: Array Indexing/Slicing Range Checking, Exceptions and @nogc

2016-03-30 Thread ag0aep6g via Digitalmars-d-learn
On 30.03.2016 15:12, Nordlöw wrote: https://github.com/nordlow/justd/blob/master/packedarray.d From there: this(R)(R values, bool assumeSortedParameter = false) @trusted nothrow @("complexity", "O(n*log(n))") if (isInputRange!R) This is off topic, but don't mark templates like

Re: Array Indexing/Slicing Range Checking, Exceptions and @nogc

2016-03-30 Thread Nordlöw via Digitalmars-d-learn
On Wednesday, 30 March 2016 at 13:38:40 UTC, Adam D. Ruppe wrote: Don't use your ptr method. Instead, make it a slice method: `return _store[0 .. _length];` Now you can just index it internally and let the compiler automatically insert range checks. When you need the pointer, you still have

Re: Array Indexing/Slicing Range Checking, Exceptions and @nogc

2016-03-30 Thread Adam D. Ruppe via Digitalmars-d-learn
On Wednesday, 30 March 2016 at 13:12:49 UTC, Nordlöw wrote: I'm however uncertain about how to implement error handling of bounds checking and how these interact with `@nogc`. My main goal is to match semantics of builtin D arrays and slices. I would actually cheat on this somehow and

Re: Array Indexing/Slicing Range Checking, Exceptions and @nogc

2016-03-30 Thread Nordlöw via Digitalmars-d-learn
On Wednesday, 30 March 2016 at 13:24:20 UTC, ag0aep6g wrote: On 30.03.2016 15:12, Nordlöw wrote: https://github.com/nordlow/justd/blob/master/packedarray.d From there: this(R)(R values, bool assumeSortedParameter = false) @trusted nothrow @("complexity", "O(n*log(n))") if

Re: Array Indexing/Slicing Range Checking, Exceptions and @nogc

2016-03-30 Thread ag0aep6g via Digitalmars-d-learn
On 30.03.2016 15:44, Nordlöw wrote: On Wednesday, 30 March 2016 at 13:24:20 UTC, ag0aep6g wrote: [...] This is off topic, but don't mark templates like that @trusted. By doing so you also trust R, but you don't know if it's memory safe. Should I post in group "General" instead? No, no, I

Re: Debugging D DLL from C# app with C linkage for native Unity 5 plugin

2016-03-30 Thread Rainer Schuetze via Digitalmars-d-learn
On 30.03.2016 01:41, Thalamus wrote: Apologies if this has been discussed before, but I wasn't able to find anything similar on the forums or web. I can't seem to figure out how to debug a D DLL from a C# EXE. (My actual purpose here is to use D to build native plugins for Unity 5, but Unity