Re: Non-blocking keyboard input

2024-01-14 Thread Joe--- via Digitalmars-d-learn
On Wednesday, 27 December 2023 at 13:27:53 UTC, Adam D Ruppe wrote: On Wednesday, 27 December 2023 at 05:07:04 UTC, Joe wrote: ??? Surely there there is a one liner library solution for this? It is not one line because it needs a bit of setup

Non-blocking keyboard input

2023-12-26 Thread Joe--- via Digitalmars-d-learn
??? Surely there there is a one liner library solution for this? I have a program that spawns a thread for debugging information and uses the keyboard input which allows me to display the information. If I use getchar or readline then it blocks the

D atomics

2023-12-18 Thread Joe--- via Digitalmars-d-learn
How does one really use atomics in D? shared string[int] AA; AA[s[2]].atomicStore(s[1]); causes a hangup. If I just assign it "works": AA[s[2]] = s[1]; I've had similar issues where: atomicOp!"+="(X[Y],1); fails and I have to use X[Y].atomicStore(1); or

Re: range shortened method not enabled, compile with compiler switch `-preview=shortenedMethods`

2023-09-24 Thread Joe--- via Digitalmars-d-learn
On Sunday, 24 September 2023 at 12:59:57 UTC, Steven Schveighoffer wrote: On Sunday, 24 September 2023 at 10:00:31 UTC, Joe wrote: For absolutely no reason I started getting this error. Last night I compiled the project and it worked just fine. This morning I made a single insignificant

Re: Vibe.d download function, how to get callback when done or error?

2023-09-24 Thread Joe--- via Digitalmars-d-learn
On Saturday, 23 September 2023 at 20:20:31 UTC, Christian Köstlin wrote: On 23.09.23 14:07, j...@bloow.edu wrote: I'm using download(url, filename) to download files in vibe.d. The issue is that I do not know when the download is finished or errors. There is a callback for the streaming side

Re: Vibe.d download function, how to get callback when done or error?

2023-09-24 Thread Joe--- via Digitalmars-d-learn
On Saturday, 23 September 2023 at 15:09:13 UTC, Elias wrote: On Saturday, 23 September 2023 at 12:07:38 UTC, Joe wrote: I'm using download(url, filename) to download files in vibe.d. The issue is that I do not know when the download is finished or errors. There is a callback for the streaming

range shortened method not enabled, compile with compiler switch `-preview=shortenedMethods`

2023-09-24 Thread Joe--- via Digitalmars-d-learn
For absolutely no reason I started getting this error. Last night I compiled the project and it worked just fine. This morning I made a single insignificant change and tried to compile and got that error. Only possible thing is that for some reason some change in updating the compiler may

Vibe.d download function, how to get callback when done or error?

2023-09-23 Thread Joe--- via Digitalmars-d-learn
I'm using download(url, filename) to download files in vibe.d. The issue is that I do not know when the download is finished or errors. There is a callback for the streaming side but not for the file download.

Re: Help on array pointers

2023-09-22 Thread Joe--- via Digitalmars-d-learn
On Monday, 18 September 2023 at 02:49:37 UTC, vino wrote: On Sunday, 17 September 2023 at 18:28:36 UTC, Joe wrote: On Friday, 15 September 2023 at 16:55:34 UTC, Vino wrote: [...] [...] char[] invalid = (cast(char*)malloc(char.sizeof * len))[0..len]; This is not the way to go about

Re: Help on array pointers

2023-09-17 Thread Joe--- via Digitalmars-d-learn
On Friday, 15 September 2023 at 16:55:34 UTC, Vino wrote: On Friday, 15 September 2023 at 15:27:00 UTC, Vino wrote: On Friday, 15 September 2023 at 02:25:09 UTC, Joe wrote: On Thursday, 14 September 2023 at 14:21:09 UTC, Vino wrote: [...] A pointer is a type that points to something. It's

Re: Help on array pointers

2023-09-14 Thread Joe--- via Digitalmars-d-learn
On Thursday, 14 September 2023 at 14:21:09 UTC, Vino wrote: Hi All, Request your help to guide me in understanding about pointers, the below code works,I have few question which i need your help for better understanding. Questions:1 ``` char[] invalid = (cast(char*)malloc(char.sizeof *

Re: parallel threads stalls until all thread batches are finished.

2023-08-29 Thread Joe--- via Digitalmars-d-learn
On Monday, 28 August 2023 at 22:43:56 UTC, Ali Çehreli wrote: On 8/28/23 15:37, j...@bloow.edu wrote: > Basically everything is hard coded to use totalCPU's parallel() is a function that dispatches to a default TaskPool object, which uses totalCPUs. It's convenient but as you say, not all

Re: parallel threads stalls until all thread batches are finished.

2023-08-28 Thread Joe--- via Digitalmars-d-learn
On Monday, 28 August 2023 at 10:33:15 UTC, Christian Köstlin wrote: On 26.08.23 05:39, j...@bloow.edu wrote: On Friday, 25 August 2023 at 21:31:37 UTC, Ali Çehreli wrote: On 8/25/23 14:27, j...@bloow.edu wrote: > "A work unit is a set of consecutive elements of range to be processed > by a

Re: parallel threads stalls until all thread batches are finished.

2023-08-25 Thread Joe--- via Digitalmars-d-learn
On Friday, 25 August 2023 at 21:43:26 UTC, Adam D Ruppe wrote: On Wednesday, 23 August 2023 at 13:03:36 UTC, Joe wrote: to download files from the internet. Are they particularly big files? You might consider using one of the other libs that does it all in one thread. (i ask about size cuz

Re: parallel threads stalls until all thread batches are finished.

2023-08-25 Thread Joe--- via Digitalmars-d-learn
On Friday, 25 August 2023 at 21:31:37 UTC, Ali Çehreli wrote: On 8/25/23 14:27, j...@bloow.edu wrote: > "A work unit is a set of consecutive elements of range to be processed > by a worker thread between communication with any other thread. The > number of elements processed per work unit is

Re: parallel threads stalls until all thread batches are finished.

2023-08-25 Thread Joe--- via Digitalmars-d-learn
On Wednesday, 23 August 2023 at 14:43:33 UTC, Sergey wrote: On Wednesday, 23 August 2023 at 13:03:36 UTC, Joe wrote: I use foreach(s; taskPool.parallel(files, numParallel)) { L(s); } // L(s) represents the work to be done. If you make for example that L function return “ok” in case file

Re: parallel threads stalls until all thread batches are finished.

2023-08-25 Thread Joe--- via Digitalmars-d-learn
On Wednesday, 23 August 2023 at 14:43:33 UTC, Sergey wrote: On Wednesday, 23 August 2023 at 13:03:36 UTC, Joe wrote: I use foreach(s; taskPool.parallel(files, numParallel)) { L(s); } // L(s) represents the work to be done. If you make for example that L function return “ok” in case file

parallel threads stalls until all thread batches are finished.

2023-08-23 Thread Joe--- via Digitalmars-d-learn
I use foreach(s; taskPool.parallel(files, numParallel)) { L(s); } // L(s) represents the work to be done. to download files from the internet. Everything works. The issue is this: the foreach will download 8 files at once. BUT it will not start the next batch of 8 *until* ALL of the previous

Re: Code organization, dub, etc.

2023-03-13 Thread Joe via Digitalmars-d-learn
On Monday, 13 March 2023 at 13:58:29 UTC, Adam D Ruppe wrote: I'm not particularly interested in defending dub - i consider it a useless piece of crap that I only suffer through cuz some users demanded it For the record, I wasn't trying to attack dub (or dfmt). I was more interested in

Re: Code organization, dub, etc.

2023-03-13 Thread Joe via Digitalmars-d-learn
On Monday, 13 March 2023 at 13:32:04 UTC, Mike Parker wrote: The package registry is full of libraries, yes. That's what it's primarily for. There aren't a lot of executables uploaded there because they're usually better distributed in other ways. But plenty of people are using dub to build

Re: Code organization, dub, etc.

2023-03-13 Thread Joe via Digitalmars-d-learn
On Monday, 13 March 2023 at 12:56:57 UTC, Bradley Chatha wrote: For better or for worse we're stuck with dub as the standard package manager + build tool one-in-all for most of our open source libraries. Yeah, it seems like it's *only* for libraries (and a few single-exe utilities). Looking

Re: Passing and returning arguments by ref

2023-03-03 Thread Joe via Digitalmars-d-learn
Thanks, Ali. On Friday, 3 March 2023 at 18:09:01 UTC, Ali Çehreli wrote: Think may be due to D not having reference variables. Sometimes one needs to use pointers. Ah! I'm about five chapters away from Pointers ;-). Actually, I had tried changing B.x1() to: `ref X x1() { return [0]; }`

Passing and returning arguments by ref

2023-03-03 Thread Joe via Digitalmars-d-learn
Let's say we have two classes, A and B. The latter has a dynamic array of X and type X has an add() method that can be used to append elements (of type C, another struct) to X's own dynamic array of C. So it's something like the following: ```d struct C {} struct X { C[] cs; void add(C c)

std.math log and family

2018-10-30 Thread Joe via Digitalmars-d-learn
I've discovered that the 'log' function as well several similar functions are only defined as taking a real argument and returning a real, unlike most other std.math functions, which have triple definitions (also supporting double and float types). This created a problem when I tried compiling

Re: Dlang tour - Unittesting example

2018-10-02 Thread Joe via Digitalmars-d-learn
On Tuesday, 2 October 2018 at 13:24:09 UTC, Basile B. wrote: The problem is the NaN madness. Since several values are NaN there's this strange stuff: void main() { import std.stdio; import std.math : isNaN; double d; writeln(d.init);// nan writeln(d); // nan

Re: Dlang tour - Unittesting example

2018-10-02 Thread Joe via Digitalmars-d-learn
On Tuesday, 2 October 2018 at 12:25:19 UTC, Joe wrote: On Tuesday, 2 October 2018 at 09:59:28 UTC, bauss wrote: On Tuesday, 2 October 2018 at 04:13:01 UTC, Joe wrote: There appears to be a problem with the example at https://tour.dlang.org/tour/en/gems/unittesting If compiled with -unittest

Re: Dlang tour - Unittesting example

2018-10-02 Thread Joe via Digitalmars-d-learn
On Tuesday, 2 October 2018 at 09:59:28 UTC, bauss wrote: On Tuesday, 2 October 2018 at 04:13:01 UTC, Joe wrote: There appears to be a problem with the example at https://tour.dlang.org/tour/en/gems/unittesting If compiled with -unittest, the resulting program crashes. It happens with ldc2

Dlang tour - Unittesting example

2018-10-01 Thread Joe via Digitalmars-d-learn
There appears to be a problem with the example at https://tour.dlang.org/tour/en/gems/unittesting If compiled with -unittest, the resulting program crashes. It happens with ldc2 on Linux but it can also be seen if you click on "Export" and run it with dmd -unittest.

Re: Access to structures defined in C

2018-09-18 Thread Joe via Digitalmars-d-learn
On Tuesday, 18 September 2018 at 13:47:50 UTC, Atila Neves wrote: On Tuesday, 18 September 2018 at 02:39:39 UTC, Joe wrote: The second type is like that shown above. The first is a simpler array of pointers to int, e.g., int *yp = {2, 4, 0}; int *yq = {10, 12, 0}; This is valid C

Re: Access to structures defined in C

2018-09-17 Thread Joe via Digitalmars-d-learn
On Sunday, 10 June 2018 at 17:59:12 UTC, Joe wrote: That worked but now I have a more convoluted case: a C array of pointers to int pointers, e.g., int **xs[] = {x1, x2, 0}; int *x1[] = {x1a, 0}; int *x2[] = {x2a, x2b, 0}; ... int x2a[] = { 1, 3, 5, 0}; Only the first line is exposed

Re: Linking a C program with D library

2018-08-15 Thread Joe via Digitalmars-d-learn
On Wednesday, 15 August 2018 at 06:39:50 UTC, Mike Parker wrote: String literals are implicitly convertible to const(char)* and are guaranteed to be nul-terminated like a C string, so this works: [...] Does that help? Yes, indeed. I think I possibly read about literal strings being

Re: Linking a C program with D library

2018-08-14 Thread Joe via Digitalmars-d-learn
On Wednesday, 15 August 2018 at 01:56:34 UTC, Mike Parker wrote: The correct thing to do is to keep the original C function signatures in the converted code, i.e. don't change char* to string[]. And don't use anything from Phobos internally that requires linking. In other words, treat your

Linking a C program with D library

2018-08-14 Thread Joe via Digitalmars-d-learn
I'm attempting a piecemeal conversion of some C programs. I've converted a few that depend on C modules that are in a library and now I'm sort of in the middle of converting those C modules. One of them has an array of strings, i.e., array of char*, which most easily translated to D's

?? How to subscribe to Multicast Broadcasts ??

2018-08-12 Thread Joe via Digitalmars-d-learn
To(, adr[0]); Please Please Please Help, I am desperate! Many Thanks in Advance for your time & attention, -joe

How the Heck Do I Subscribe to Receiving Multicast Messages Broadcast to Organization's IP ??

2018-08-10 Thread Joe via Digitalmars-d
To(, adr[0]); Please Please Please Help, I am desperate! Many Thanks in Advance for your time & attention, -joe

Re: Error: only one main allowed. Previously found main at *

2018-07-17 Thread Joe smith via Digitalmars-d
I have also faced this same issue. But I couldn't recover from it. One of my friends suggests me to contact https://applesupportnumber.net/apple-customer-support/ for help. AS he said I contact them and they solved my issue. You should also try them.

Re: How to call a C function from D that takes a FILE * as an argument?

2018-07-03 Thread Joe via Digitalmars-d-learn
On Wednesday, 4 July 2018 at 02:16:00 UTC, Seb wrote: Hmm, calling e.g. fprintf with stdout should just work: --- void main() { import core.stdc.stdio; fprintf(stdout, "Hello %s", "world".ptr); } --- Could you maybe provide your whole code? This short test program shows the error:

Re: How to call a C function from D that takes a FILE * as an argument?

2018-07-03 Thread Joe via Digitalmars-d-learn
On Wednesday, 4 July 2018 at 01:58:15 UTC, Seb wrote: So just add the declaration to your D file: --- extern(C) void myCfunction(FILE* stream); --- I do have a similar declaration in D. It appears the problem is that the C program I'm trying to convert passes stdout as the argument and the

How to call a C function from D that takes a FILE * as an argument?

2018-07-03 Thread Joe via Digitalmars-d-learn
The subject basically says it all. The C function uses the argument to call fprintf and also passes it to other functions where it's used to call fileno, fprintf or putc.

Re: Access to structures defined in C

2018-06-10 Thread Joe via Digitalmars-d-learn
On Sunday, 10 June 2018 at 17:59:12 UTC, Joe wrote: That worked but now I have a more convoluted case: a C array of pointers to int pointers, e.g., int **xs[] = {x1, x2, 0}; int *x1[] = {x1a, 0}; int *x2[] = {x2a, x2b, 0}; ... int x2a[] = { 1, 3, 5, 0}; Only the first line is exposed

Re: Access to structures defined in C

2018-06-10 Thread Joe via Digitalmars-d-learn
On Wednesday, 14 March 2018 at 02:17:57 UTC, Adam D. Ruppe wrote: The type system would *like* to know, certainly for correct range errors, but if you declare it as the wrong length and use the .ptr, it still works like it does in C: extern(C) __gshared extern char*[1] files; // still works

Re: unittests, dub and libraries

2018-03-27 Thread Joe via Digitalmars-d-learn
On Wednesday, 28 March 2018 at 03:07:23 UTC, Jonathan M Davis wrote: Run dub test The problem is that an executable needs a main, and a library doesn't have one, whereas when you're testing a library, you need an executable. So, a main must be inserted - e.g. with the -main flag to dmd.

unittests, dub and libraries

2018-03-27 Thread Joe via Digitalmars-d-learn
I'm trying to build a very simple library. For now it just has a single class, constructor, destructor and one method. I added a unit test right after the method, declared the targetType to be "library" and a buildType of "unittest" (with options "unittests", "debugMode", "debugInfo"). When I

Re: core.stdc.stdlib._compare_fp_t and qsort

2018-03-18 Thread Joe via Digitalmars-d-learn
On Sunday, 18 March 2018 at 19:01:11 UTC, Joe wrote: I managed to get it working by declaring a D dynamic array, appending n_recs pointers to it and using it as argument to sort. Unfortunately, I then had to copy from the dynamic array to the fixed array in order to continue using the latter

Re: core.stdc.stdlib._compare_fp_t and qsort

2018-03-18 Thread Joe via Digitalmars-d-learn
On Sunday, 18 March 2018 at 18:11:02 UTC, Dmitry Olshansky wrote: Well since recs is array of pointers this looks like a null pointer in your data. The usual ways to fix that is either print stuff or poke around in debugger to see if a Record* is null or .name is null. The problem is that

Re: core.stdc.stdlib._compare_fp_t and qsort

2018-03-18 Thread Joe via Digitalmars-d-learn
On Sunday, 18 March 2018 at 13:10:08 UTC, Dmitry Olshansky wrote: Do this to get the usual ptr + length: sort!((a, b) => to!string((*a).name) < to!string((*b).name))(recs[]); Also to!string would be computed on each compare anew. May want to use schwartzSort to avoid that, on 10 elements

Re: core.stdc.stdlib._compare_fp_t and qsort

2018-03-18 Thread Joe via Digitalmars-d-learn
On Monday, 12 March 2018 at 03:50:42 UTC, Joe wrote: On Monday, 12 March 2018 at 03:13:08 UTC, Seb wrote: Out of interest: I wonder what's your usecase for using qsort. Or in other words: why you can't use the high-level std.algorithm.sorting.sort? This is only temporary. I will be using

Access to structures defined in C

2018-03-13 Thread Joe via Digitalmars-d-learn
What is the correct way to declare and access storage managed by C? For example, say a C module defines an array of filenames, e.g., char *files[] = { "one", "two", "three", 0}; The C header of course declares this as: extern char *files[]; The way to declare it in a D module appears to be:

Re: core.stdc.stdlib._compare_fp_t and qsort

2018-03-11 Thread Joe via Digitalmars-d-learn
On Monday, 12 March 2018 at 03:13:08 UTC, Seb wrote: Out of interest: I wonder what's your usecase for using qsort. Or in other words: why you can't use the high-level std.algorithm.sorting.sort? This is only temporary. I will be using std.algorithm.sorting.sort. I was converting a C program

Re: core.stdc.stdlib._compare_fp_t and qsort

2018-03-11 Thread Joe via Digitalmars-d-learn
const (void *) p1, scope const (void *) p2) Could you explain or direct me to something that elucidates why the "scope" qualifiers are needed? And is there something else that is necessary inside compar() or are the "scope"s just for decorative purposes? Joe

Re: core.stdc.stdlib._compare_fp_t and qsort

2018-03-11 Thread Joe via Digitalmars-d-learn
*, ulong, ulong, int function(const(void*) p1, const(void*) p2)) I fail to see which argument is causing the problem now. Joe

core.stdc.stdlib._compare_fp_t and qsort

2018-03-11 Thread Joe via Digitalmars-d-learn
argument types () I don't quite understand what those parentheses mean: is it implying "no arguments" and if so, where would one provide arguments? Joe

Re: Article: Why Const Sucks

2018-03-11 Thread joe via Digitalmars-d-announce
On Thursday, 8 March 2018 at 15:13:09 UTC, Steven Schveighoffer wrote: On 3/8/18 9:58 AM, joe wrote: On Monday, 5 March 2018 at 10:57:35 UTC, Jonathan M Davis wrote: Here's something I wrote up on const: /snip May be not entirely related, but a little gotcha. given: interface XY {} class

Re: Article: Why Const Sucks

2018-03-08 Thread joe via Digitalmars-d-announce
On Monday, 5 March 2018 at 10:57:35 UTC, Jonathan M Davis wrote: Here's something I wrote up on const: /snip May be not entirely related, but a little gotcha. given: interface XY {} class Foo: XY {} class Bar: XY {} void doSomething(in XY sth) { auto foo = cast(Foo)sth; // error in @safe

Re: Article: Why Const Sucks

2018-03-05 Thread joe via Digitalmars-d-announce
On Monday, 5 March 2018 at 10:57:35 UTC, Jonathan M Davis wrote: Here's something I wrote up on const: http://jmdavisprog.com/articles/why-const-sucks.html I suppose that it's not exactly the most positive article, but I feel that it's accurate. - Jonathan M Davis Interesting read and it

Re: Postgres and other database interfaces

2018-02-25 Thread Joe via Digitalmars-d
entioned earlier, I will delve into dpq2 (and vibe-d-postgresql) for my own project. So I'll keep in touch. Joe

Re: Postgres and other database interfaces

2018-02-25 Thread Joe via Digitalmars-d
e %s appears in the SQL string, the actual arguments are passed separately at invocation time, as either tuples or dicts (associative arrays). Joe

Re: Postgres and other database interfaces

2018-02-25 Thread Joe via Digitalmars-d
nection, because my users don't connect to a server". It will be up to the other developers to convince him or to arrive at some compromise (in the case of D an alias may be all that is needed to resolve such an impasse). Joe

Re: Postgres and other database interfaces

2018-02-24 Thread Joe via Digitalmars-d
no one has implemented a RETRIEVE or PROJECT statement in lieu of a SELECT statement (and note there *were* relational systems that used the former). Joe

Re: Postgres and other database interfaces

2018-02-24 Thread Joe via Digitalmars-d
interfaces. Joe

Re: Postgres and other database interfaces

2018-02-24 Thread Joe via Digitalmars-d
On Saturday, 24 February 2018 at 18:41:21 UTC, Denis F wrote: On Saturday, 24 February 2018 at 05:33:56 UTC, Joe wrote: 2. dpq2. Second most downloaded and built on top of derelict-pq. The "documentation" consists of a README listing the features and a single example, which appear

Re: Postgres and other database interfaces

2018-02-24 Thread Joe via Digitalmars-d
On Saturday, 24 February 2018 at 15:44:49 UTC, Paolo Invernizzi wrote: Joe: I think this is also a terrific 'welcome aboard' about how fast and quickly things can be done in D! I'm a bit overwhelmed by all the replies and "goodies" but I'd like to say thanks to Adam while I dig

Re: Postgres and other database interfaces

2018-02-24 Thread Joe via Digitalmars-d
/pszturmaj/ddb/blob/bd55beea0df6e5da86a71535ff6d9800c0711c7c/source/ddb/db.d#L19 I think no... The documentation on how to use the package is present, it's just inside the modules as Ddoc documentation. Joe, you can easily 'extract' it using the proper -D compiler switch As I said, I'm new

Postgres and other database interfaces

2018-02-23 Thread Joe via Digitalmars-d
Back on 13 January, I posted in the Learn forum some questions regarding using Postgres and got a reply that stated the following: On Monday, 15 January 2018 at 02:28:29 UTC, Matthias Klumpp wrote: In any case, please don't start another Postgres library and consider contributing to one of

Re: Understanding the AST...

2018-02-22 Thread joe via Digitalmars-d-learn
On Thursday, 22 February 2018 at 14:53:11 UTC, Seb wrote: On Tuesday, 6 February 2018 at 12:03:06 UTC, joe wrote: Hello everybody! Last week end I found this post ( https://dlang.org/blog/2017/08/01/a-dub-case-study-compiling-dmd-as-a-library/ ) on the Blog and thought to myself awesome

Re: Understanding the AST...

2018-02-22 Thread joe via Digitalmars-d-learn
On Thursday, 22 February 2018 at 13:44:51 UTC, RazvanN wrote: On Thursday, 22 February 2018 at 13:21:04 UTC, joe wrote: [...] Indeed, @Stefan is right. The ParseTimeVisitor only contains information available at parse time. If you are interested in the parent you have 2 options: either (1

Re: Negative index range violation

2018-02-22 Thread joe via Digitalmars-d-learn
On Thursday, 22 February 2018 at 02:41:30 UTC, Steven Schveighoffer wrote: On 2/21/18 7:30 PM, SrMordred wrote: But with a slice negative indexes are never allowed, even on a pointer. youd have to do (c-1)[0 .. 1]; Nice! Thank you both! In D Slice article it says "You can even use

Re: Understanding the AST...

2018-02-22 Thread joe via Digitalmars-d-learn
On Monday, 12 February 2018 at 08:47:58 UTC, RazvanN wrote: Hi Joe, /SNIP On Tuesday, 6 February 2018 at 12:03:06 UTC, joe wrote: [...] The FuncDeclaration node contains all the information for that. For example, you can access fd.parent to see if the function is declared at top-level

Re: Understanding the AST...

2018-02-22 Thread joe via Digitalmars-d-learn
On Monday, 12 February 2018 at 08:47:58 UTC, RazvanN wrote: Hi Joe, I suggest you watch this video which explains how the parse time visitors work: https://www.youtube.com/watch?v=tK072jcoWv4 . On Tuesday, 6 February 2018 at 12:03:06 UTC, joe wrote: [...] The FuncDeclaration node

Re: dub segfault

2018-02-10 Thread Joe via Digitalmars-d
On Sunday, 11 February 2018 at 00:59:10 UTC, Seb wrote: Ideally you could verify whether this also happens with the official release. Installing the official (ldc) release doesn't cause the problem, so presumably this is a problem with the Debian buster release. However, I notice the

dub segfault

2018-02-10 Thread Joe via Digitalmars-d
I'm getting a segmentation fault when I run 'dub build' and I specify a dependency. Specifically, the dependency is 'derelict-pq' but it could be anything (I tried 'dpq2' and even 'mysql-native', just for kicks). The segfault occurs when it's supposedly searching for the dependency. Here's

Understanding the AST...

2018-02-06 Thread joe via Digitalmars-d-learn
Hello everybody! Last week end I found this post ( https://dlang.org/blog/2017/08/01/a-dub-case-study-compiling-dmd-as-a-library/ ) on the Blog and thought to myself awesome. So I built the library and everything went smooth. Thanks for the effort of all the involved people who made that

Further questions on interfacing to Postgres libpq

2018-01-26 Thread Joe via Digitalmars-d-learn
An example test program that I'm using to learn D to C interfacing (specifically calling the libpq library) has a call to a C function declared as follows: void PQprint(FILE *fout, /* output stream */ const PGresult *res, const PQprintOpt *po);

Re: Using Postgres connection functions

2018-01-20 Thread Joe via Digitalmars-d-learn
On Saturday, 20 January 2018 at 04:54:47 UTC, Adam D. Ruppe wrote: Same as above. The general pattern is: C_Type[] name = new C_Type[](requested_size); // pass as `name.ptr`. This becomes a C_Type* Thanks, Adam. Perhaps something like this ought to make its way into the "D for C Programmers"

Re: Using Postgres connection functions

2018-01-19 Thread Joe via Digitalmars-d-learn
On Saturday, 13 January 2018 at 05:28:17 UTC, Joe wrote: Going beyond the connection, there are various other libpq functions that use a similar pattern of values passed using multiple parallel C arrays, e.g., PGresult *PQexecParams(PGconn *conn, const char *command

Re: Using Postgres connection functions

2018-01-15 Thread Joe via Digitalmars-d-learn
On Monday, 15 January 2018 at 02:28:29 UTC, Matthias Klumpp wrote: In any case, please don't start another Postgres library and consider contributing to one of the existing ones, so that we maybe have one really awesome, 100% complete library at some point. If, on the other hand, your goal

Re: Using Postgres connection functions

2018-01-13 Thread Joe via Digitalmars-d-learn
On Saturday, 13 January 2018 at 10:10:41 UTC, Jacob Carlborg wrote: There's a native D library, ddb [1], for connecting to Postgres. Then you don't have to worry about null-terminated strings. There are several D libraries that I would consider "native": derelict-pq, dpq, dpq2 and ddb. The

Re: Using Postgres connection functions

2018-01-12 Thread Joe via Digitalmars-d-learn
Going beyond the connection, there are various other libpq functions that use a similar pattern of values passed using multiple parallel C arrays, e.g., PGresult *PQexecParams(PGconn *conn, const char *command, int nParams,

Re: Using Postgres connection functions

2018-01-12 Thread Joe via Digitalmars-d-learn
On Saturday, 13 January 2018 at 04:26:06 UTC, Adam D. Ruppe wrote: If and only if the values are known at compile time, you can do: const char** keywords = ["hostaddr".ptr, "port".ptr, "dbname".ptr, null].ptr; or even do it inline: PQconnectdbParams(["hostaddr".ptr, "port".ptr,

Using Postgres connection functions

2018-01-12 Thread Joe via Digitalmars-d-learn
I'm trying to learn how to use D to connect (and send queries) to Postgres, i.e., libpq in C. Postgres has three families of connection functions: PQsetdbLogin which takes multiple individual arguments (all as const char *), PQconnectdb which takes a single connection string (which Postgres

Re: Follow-up post explaining research rationale

2016-05-15 Thread Joe Duarte via Digitalmars-d
On Sunday, 15 May 2016 at 10:52:47 UTC, Timon Gehr wrote: On 15.05.2016 05:02, Joe Duarte wrote: Type systems are quite arbitrary and primitive That may apply to the popular ones. -- we could've moved to real-world types The "real world" is complex and there are bound

Re: Follow-up post explaining research rationale

2016-05-14 Thread Joe Duarte via Digitalmars-d
On Friday, 13 May 2016 at 22:13:50 UTC, QAston wrote: Mainstream PL syntax is extremely unintuitive and poorly designed by known pedagogical, epistemological, and communicative science standards. The vast majority people who are introduced to programming do not pursue it (likely true of many

Re: Follow-up post explaining research rationale

2016-05-14 Thread Joe Duarte via Digitalmars-d
On Tuesday, 10 May 2016 at 13:40:30 UTC, Chris wrote: On Monday, 9 May 2016 at 19:09:35 UTC, Joe Duarte wrote: [snip] Let me give you a sense of the sorts of issues I'm thinking of. Here is a C sample from ProgrammingSimplified.com. It finds the frequency of characters in a string: int main

Re: Researcher question – what's the point of semicolons and curly braces?

2016-05-14 Thread Joe Duarte via Digitalmars-d
On Tuesday, 3 May 2016 at 22:17:18 UTC, cym13 wrote: In my opinion putting commas at the end of a line is useless: if it happens at the end of each line (not counting closing-braces ones) then the effective quantity of information brought is null, and in more than one case chaining

Re: Researcher question – what's the point of semicolons and curly braces?

2016-05-13 Thread Joe Duarte via Digitalmars-d
On Tuesday, 3 May 2016 at 12:47:42 UTC, qznc wrote: The parser needs information about "blocks". Here is an example: if (x) foo(); bar(); Is bar() always executed or only if (x) is true? In other words, is bar() part of the block, which is only entered conditionally? There are

Re: Follow-up post explaining research rationale

2016-05-09 Thread Joe Duarte via Digitalmars-d
On Monday, 9 May 2016 at 20:17:40 UTC, ag0aep6g wrote: Am 09.05.2016 um 21:09 schrieb Joe Duarte: 4. We switch the person or voice from an imperative "do this" as in printf, to some sort of narrator third-person voice with "gets". "gets" is still imperati

Re: Always false float comparisons

2016-05-09 Thread Joe Duarte via Digitalmars-d
On Monday, 9 May 2016 at 09:10:19 UTC, Walter Bright wrote: Don Clugston pointed out in his DConf 2016 talk that: float f = 1.30; assert(f == 1.30); will always be false since 1.30 is not representable as a float. However, float f = 1.30; assert(f == cast(float)1.30); will

Re: Follow-up post explaining research rationale

2016-05-09 Thread Joe Duarte via Digitalmars-d
On Monday, 9 May 2016 at 20:29:12 UTC, Joe Duarte wrote: On Monday, 9 May 2016 at 20:09:35 UTC, Adam D. Ruppe wrote: I'd also be surprised if you find an empirical gender gap after controlling for programming language syntax, too. Even if we grant that PL syntax is suboptimal, why would

Re: Follow-up post explaining research rationale

2016-05-09 Thread Joe Duarte via Digitalmars-d
On Monday, 9 May 2016 at 20:09:35 UTC, Adam D. Ruppe wrote: I'd also be surprised if you find an empirical gender gap after controlling for programming language syntax, too. Even if we grant that PL syntax is suboptimal, why would that result in a gender bias? But, hey, you never really know

Follow-up post explaining research rationale

2016-05-09 Thread Joe Duarte via Digitalmars-d
Hi all, As I mentioned on the other thread where I asked about D syntax, I'm a social scientist about to launch some studies of the effects of PL syntax on learnability, motivation to pursue programming, and differential gender effects on these factors. This is a long post – some of you

Re: Researcher question – what's the point of semicolons and curly braces?

2016-05-03 Thread Joe Duarte via Digitalmars-d
On Tuesday, 3 May 2016 at 04:24:37 UTC, Adam D. Ruppe wrote: On Tuesday, 3 May 2016 at 03:48:09 UTC, Joe Duarte wrote: Would it be difficult to compile the clean version? You realize your bias is showing very strongly in the wording of this question, right? I don't agree the naked version

Re: Researcher question – what's the point of semicolons and curly braces?

2016-05-03 Thread Joe Duarte via Digitalmars-d
On Tuesday, 3 May 2016 at 04:23:48 UTC, Walter Bright wrote: On 5/2/2016 8:48 PM, Joe Duarte wrote: Why are curly braces and semicolons necessary? What information do they carry that a compiler could not otherwise reliably obtain? You are correct in that they are (mostly) redundant. Some

Researcher question – what's the point of semicolons and curly braces?

2016-05-02 Thread Joe Duarte via Digitalmars-d
Hi all, I'm a social scientist and I'm preparing some studies on the effects of programming language syntax on learning, motivation to pursue programming, as well as any disproportionate effects that PL syntax has on the appeal of programming to women (more on the latter in a separate post).

Re: Any usable SIMD implementation?

2016-05-02 Thread Joe Duarte via Digitalmars-d
On Saturday, 23 April 2016 at 10:40:12 UTC, Johan Engelen wrote: On Monday, 18 April 2016 at 00:27:06 UTC, Joe Duarte wrote: Someone else said talked about marking "Broadwell" and other generation names. As others have said, it's better to specify features. I wanted to chime in wit

Re: Any usable SIMD implementation?

2016-04-17 Thread Joe Duarte via Digitalmars-d
On Tuesday, 5 April 2016 at 10:27:46 UTC, Walter Bright wrote: Besides, I think it's a poor design to customize the app for only one SIMD type. A better idea (I've repeated this ad nauseum over the years) is to have n modules, one for each supported SIMD type. Compile and link all of them in,

Re: A few notes on choosing between Go and D for a quick project

2015-03-13 Thread Joe Greer via Digitalmars-d
startWith() which started in the string domain and moved out the generality should be referenced with strings. The same is true of other class types as well, but string manipulating is very important in modern program development. Just my opinion, joe

Re: Compiler bug? (alias sth this; and std.signals)

2012-11-16 Thread Joe
Why would is(T == struct) be true but !isBuiltinType!T be false? This seems highly inconsistent. If T is a struct, it is not a builtin type, and if T is int (also making the condition false), then Property should never have been passed as a struct, but as the int gotten via the alias. On

Re: Compiler bug? (alias sth this; and std.signals)

2012-11-15 Thread Joe
On Wednesday, 14 November 2012 at 09:31:47 UTC, eskimo wrote: But first it is copied to every generic function that might be called on the way. Ok, I guess it just doesn't do what I understood it to do (which is too bad, but to be expected with a new language). In any case you would appear

Re: Compiler bug? (alias sth this; and std.signals)

2012-11-15 Thread Joe
On Thursday, 15 November 2012 at 09:37:55 UTC, eskimo wrote: But, considering that the alias this triggers only when you are issuing an operation not supported by the struct itself, it is pretty reasonable behaviour and everything else would be pretty surprising. Best regards, Robert I

Re: Compiler bug? (alias sth this; and std.signals)

2012-11-14 Thread Joe
On Tuesday, 13 November 2012 at 22:55:38 UTC, eskimo wrote: Property is a struct and thus it is passed by value, which means that the signal is copied. But wait! Due to alias get this;, f.prop shouldn't copy prop but call get (which it does in the working - second - case)! How to check?

  1   2   >