Any equivalent to python's dir(object) in D?

2014-05-05 Thread Chris Piker via Digitalmars-d-learn
Is there any way to get a list of the properties and functions provided by a module or class or generic variable in D at runtime? I've grown quite accustomed to doing the following kinds of exploration in Python. With in the python interperter I can issue: a =

Re: CMake for D

2014-05-08 Thread Chris Piker via Digitalmars-d-learn
On Monday, 24 March 2014 at 23:55:14 UTC, Dragos Carp wrote: I moved cmaked2 to github [1], updated and simplified the usage a little (system cmake patch not necessary anymore). You can give it a try. Dub registry support is also on the way. [1] - https://github.com/dcarp/cmake-d Verified

Re: CMake for D

2014-05-09 Thread Chris Piker via Digitalmars-d-learn
On Monday, 24 March 2014 at 23:55:14 UTC, Dragos Carp wrote: I moved cmaked2 to github [1], updated and simplified the usage a little (system cmake patch not necessary anymore). You can give it a try. Dub registry support is also on the way. Dragos What is the best way to specify a mixin

Re: CMake for D

2014-05-09 Thread Chris Piker via Digitalmars-d-learn
On Friday, 9 May 2014 at 21:43:04 UTC, Trent Forkert wrote: The way I've tackled that in my (still work-in-progress) CMake fork[1] is to add an `include_directories(TEXT ...)` signature. I like that, it seems clean. Unfortunately, you'll need to build my CMake from source, though that isn't

Recommendation on option parsing

2014-05-09 Thread Chris Piker via Digitalmars-d-learn
Phobos' std.getopt is a bit spare for my taste, as there is no builtin general help facility with word-wrapping. Does anyone have a recommendation on which of the existing command line option parsing libraries floating around in the wild to use? If it doesn't compile against the current version

Re: Recommendation on option parsing

2014-05-12 Thread Chris Piker via Digitalmars-d-learn
On Saturday, 10 May 2014 at 11:59:03 UTC, Robert Schadek via Digitalmars-d-learn wrote: On 05/10/2014 01:09 AM, Chris Piker via Digitalmars-d-learn wrote: Phobos' std.getopt is a bit spare for my taste, as there is no builtin general help facility with word-wrapping. ... -- Chris please help

Re: Recommendation on option parsing

2014-05-12 Thread Chris Piker via Digitalmars-d-learn
On Saturday, 10 May 2014 at 09:50:04 UTC, Jacob Carlborg wrote: On 2014-05-10 01:09, Chris Piker wrote: Phobos' std.getopt is a bit spare for my taste, as there is no builtin general help facility with word-wrapping. ... I'm using the one in Tango [1] with some additions [2]. It's a bit

Re: Recommendation on option parsing

2014-05-12 Thread Chris Piker via Digitalmars-d-learn
On Monday, 12 May 2014 at 23:11:57 UTC, Robert Schadek via Digitalmars-d-learn wrote: Chris please help to make this happen https://github.com/D-Programming-Language/phobos/pull/2072 I'm not sure what you are asking for. Would you like me to tryout getoptEx? yes please test it Okay, I

Re: Recommendation on option parsing

2014-05-13 Thread Chris Piker via Digitalmars-d-learn
Okay, I replaced the std.getopt that came with dmd with your version. My code compiles, but of course it doesn't link against the old libphobos.so. Well, it is a pull request for std.getopt, therefore it can't stand alone. That been said, get into getopt.d and copy anything below line 1061 (

Re: Recommendation on option parsing

2014-05-13 Thread Chris Piker via Digitalmars-d-learn
On Tuesday, 13 May 2014 at 12:08:51 UTC, Vladimir Panteleev wrote: On Tuesday, 13 May 2014 at 03:40:57 UTC, Chris Piker wrote: I like your enthusiasm. If you have any modules that don't require me to rebuild libphobos, I'll be happy to give them a whirl. Thank's for responding to my inquiry.

Re: Recommendation on option parsing

2014-05-13 Thread Chris Piker via Digitalmars-d-learn
On Wednesday, 14 May 2014 at 04:15:04 UTC, Jesse Phillips wrote: Anyway, D's libraries are not as extensive as Python/Ruby/Perl. True, but they wouldn't need to have much more to pass the good-enough threshold for me. In my current position I mostly write relatively simple server side

Comple error in std.experimental.logger.core.d

2015-10-27 Thread Chris Piker via Digitalmars-d-learn
Using DMD64 (v2.068.2) on Linux CentOS 6.7, compiler was downloaded from this link: http://downloads.dlang.org/releases/2.x/2.068.2/dmd-2.068.2-0.fedora.x86_64.rpm I get the following compile errors from the experimental logger class:

How to set Global Log level in an application

2015-10-27 Thread Chris Piker via Digitalmars-d-learn
On Tuesday, 27 October 2015 at 21:50:31 UTC, Chris Piker wrote: I get the following compile errors from the experimental logger class: /usr/include/dmd/phobos/std/experimental/logger/core.d(702): Error: long has no effect in expression (cast(ubyte)160u) Solved: Finally found how to set

Re: Testing for object property supporting "<" comparison

2021-05-11 Thread Chris Piker via Digitalmars-d-learn
On Wednesday, 12 May 2021 at 00:06:52 UTC, Paul Backus wrote: On Tuesday, 11 May 2021 at 19:42:34 UTC, Chris Piker wrote: std.traits.isOrderingComparable https://phobos.dpldocs.info/std.traits.isOrderingComparable.html Well I feel sheepish, don't know how I missed that one. Hey thanks for

Re: Recommendations on avoiding range pipeline type hell

2021-05-16 Thread Chris Piker via Digitalmars-d-learn
On Monday, 17 May 2021 at 00:27:01 UTC, SealabJaster wrote: On Sunday, 16 May 2021 at 23:52:06 UTC, Adam D. Ruppe wrote: ... I've opened a PR (https://github.com/dlang/dmd/pull/12526) with a super hacked together proof-of-concept. As I say in the PR I don't know if I'm actually capable of

Any suggestions on dmd error message formatting?

2021-05-14 Thread Chris Piker via Digitalmars-d-learn
Hi D So the compile error messages getting from dmd are starting to remind me of the notorious 130 line error message I once got from a C++ compiler for missing a comma in a template. :-/ (After fixing that bug, I left work early and came back the next day with a python book.) So, like

Recommendations on avoiding range pipeline type hell

2021-05-15 Thread Chris Piker via Digitalmars-d-learn
Hi D Since the example of piping the output of one range to another looked pretty cool, I've tried my own hand at it for my current program, and the results have been... sub optimal. Basically the issue is that if one attempts to make a range based pipeline aka: ```d auto mega_range =

Re: Any suggestions on dmd error message formatting?

2021-05-15 Thread Chris Piker via Digitalmars-d-learn
On Saturday, 15 May 2021 at 06:12:25 UTC, SealabJaster wrote: On Saturday, 15 May 2021 at 04:54:15 UTC, Chris Piker wrote: T_T My eyes burn. Good, it's not just me. If figured the Deities out there visually parse these messages even hung over. Seems the final `int function` parameter

State of D for webassembly

2021-05-17 Thread Chris Piker via Digitalmars-d-learn
Hi D Our group has some spectragram (aka dynamic spectra) creation algorithms that are fast in Java and since D has many Java-ish concepts it looks like it would be do-able to port the code to D. If I take on this project my target would be to run as a webassembly program. What is the

Re: Recommendations on avoiding range pipeline type hell

2021-05-15 Thread Chris Piker via Digitalmars-d-learn
On Saturday, 15 May 2021 at 11:51:11 UTC, Adam D. Ruppe wrote: On Saturday, 15 May 2021 at 11:25:10 UTC, Chris Piker wrote: The idea is you aren't supposed to care what the type is, just what attributes it has, e.g., can be indexed, or can be assigned, etc. (Warning, new user rant ahead.

Re: Recommendations on avoiding range pipeline type hell

2021-05-15 Thread Chris Piker via Digitalmars-d-learn
On Saturday, 15 May 2021 at 14:05:34 UTC, Paul Backus wrote: If you post your code (or at least a self-contained subset of it) someone can probably help you figure out where you're running into trouble. Smart idea. It's all on github. I'll fix a few items and send a link soon as I get a

Re: Recommendations on avoiding range pipeline type hell

2021-05-15 Thread Chris Piker via Digitalmars-d-learn
On Saturday, 15 May 2021 at 13:43:29 UTC, Mike Parker wrote: On Saturday, 15 May 2021 at 11:25:10 UTC, Chris Piker wrote: In addition to what Adam said, if you do need to store the result for use in a friendlier form, just import `std.array` and append `.array` to the end of the pipeline.

Re: Recommendations on avoiding range pipeline type hell

2021-05-16 Thread Chris Piker via Digitalmars-d-learn
Thanks to everyone who has replied. You've given me a lot to think about, and since I'm not yet fluent in D it will take a bit to digest it all, though one thing is clear. This community is one of the strong features of D. I will mention it to others as a selling point. Best,

Re: Recommendations on avoiding range pipeline type hell

2021-05-16 Thread Chris Piker via Digitalmars-d-learn
On Saturday, 15 May 2021 at 14:05:34 UTC, Paul Backus wrote: If you post your code (or at least a self-contained subset of it) someone can probably help you figure out where you're running into trouble. The error messages by themselves do not provide enough information--all I can say from

Re: Recommendations on avoiding range pipeline type hell

2021-05-16 Thread Chris Piker via Digitalmars-d-learn
On Sunday, 16 May 2021 at 09:17:47 UTC, Jordan Wilson wrote: Another example: ```d auto r = [iota(1,10).map!(a => a.to!int),iota(1,10).map!(a => a.to!int)]; # compile error ``` Hi Jordan Nice succinct example. Thanks for looking at the code :) So, honest question. Does it strike you as

Re: Recommendations on avoiding range pipeline type hell

2021-05-16 Thread Chris Piker via Digitalmars-d-learn
On Sunday, 16 May 2021 at 10:10:54 UTC, SealabJaster wrote: It's due to a quirk with passing lambdas as template arguments. Each lambda is actually separated into its own function. Hey that was a very well laid out example. Okay, I think the light is starting do dawn. So if I use lambdas

Re: Recommendations on avoiding range pipeline type hell

2021-05-16 Thread Chris Piker via Digitalmars-d-learn
On Sunday, 16 May 2021 at 13:35:02 UTC, Adam D. Ruppe wrote: Wait, what's the bug there? The typeof DOES tell you they are separate. Error: cannot implicitly convert expression `b` of type `S!(func2)` to `S!(func1)` Sorry, it's a forum post, so I really should have been more explicit. It

Testing for object property supporting "<" comparison

2021-05-11 Thread Chris Piker via Digitalmars-d-learn
Hi D I'm working on a bit of code that handles selecting one *.front from multiple range-ish objects. It's a select-or-drop algorithm for a data streaming service, the details aren't important. The algorithm takes a range of something I'll call "PriorityRange" objects. PriorityRange

Re: wanting to try a GUI toolkit: needing some advice on which one to choose

2021-05-30 Thread Chris Piker via Digitalmars-d-learn
On Thursday, 27 May 2021 at 07:00:32 UTC, Imperatorn wrote: I would like to recommend DlangUI [1], but we have tried now for months to get in contact with the owner of it (to take over development) and are getting no reponse. 1. https://github.com/buggins/dlangui Of the 107 forks of dlangui

Selected elements from splitter output

2021-05-04 Thread Chris Piker via Digitalmars-d-learn
Hi D I have a white-space delimited file with quite a few columns, but I only care about columns 0, 2, 3, 4, 8, 9, 10. Since I don't need most of the 60+ columns it seemed like: std.algorithm.iteration.splitter() would be a better function to use then std.array.split(). My problem is

Re: Selected elements from splitter output

2021-05-04 Thread Chris Piker via Digitalmars-d-learn
On Tuesday, 4 May 2021 at 22:02:11 UTC, Ali Çehreli wrote: On 5/4/21 1:40 PM, Chris Piker wrote: > I only care about columns 0, 2, 3, 4, 8, 9, 10. That's std.range.stride. > char[][] wanted = string_range.get( [1, 5, 7] ); // pseudo-code element That's std.range.indexed. Hey Thanks! And

Contributing CDF bindings to Deimos

2021-03-22 Thread Chris Piker via Digitalmars-d-learn
Hi D There is a C library that's important for my line of work, https://cdf.gsfc.nasa.gov/ but it's not exactly a popular library in the general sense. I willing to contribute & maintain D bindings for this library following the Deimos guidelines but am wondering if it's too specific to

Re: noobie question, dub or meson?

2021-03-22 Thread Chris Piker via Digitalmars-d-learn
On Saturday, 20 March 2021 at 18:33:20 UTC, James Blachly wrote: Chris: for one of my (D) libraries that also links in an .o file that's built from C source, I have a makefile for the C and call `make` during the dub build process. It is not incredibly sophisticated, but works well for us.

Re: Contributing CDF bindings to Deimos

2021-03-25 Thread Chris Piker via Digitalmars-d-learn
On Thursday, 25 March 2021 at 16:57:05 UTC, Bastiaan Veelo wrote: On Thursday, 25 March 2021 at 04:00:33 UTC, Chris Piker wrote: As an aside, software developers at NASA Goddard have now heard of D which is nice. They were pleased to see that it was supported by gcc. (Hat tip to the GDC team)

Re: Contributing CDF bindings to Deimos

2021-03-25 Thread Chris Piker via Digitalmars-d-learn
On Friday, 26 March 2021 at 00:50:36 UTC, Jordan Wilson wrote: Nice one. I've used HDF5/NetCDF, will have to check out and see what CDF offers. AFAIK CDF is much simpler than NetCDF. If you do generate CDF files and want other common tools to understand your data structures, use the ISTP

Re: Creating a .di file for a custom C library

2021-03-30 Thread Chris Piker via Digitalmars-d-learn
On Tuesday, 30 March 2021 at 04:01:12 UTC, Brad wrote: I would like to use an updated version of the Termbox library (written in C) with D. I have the .h file. This is new territory for me (why try something easy - right?). I think I need to create a .di file that corresponds to the .h

Re: Need for speed

2021-04-01 Thread Chris Piker via Digitalmars-d-learn
On Thursday, 1 April 2021 at 16:52:17 UTC, Nestor wrote: I was hoping to beat my dear Python and get similar results to Go, but that is not the case neither using rdmd nor running the executable generated by dmd. I am getting values between 350-380 ms, and 81ms in Python. Nice test. I'm new

Re: Contributing CDF bindings to Deimos

2021-03-24 Thread Chris Piker via Digitalmars-d-learn
On Tuesday, 23 March 2021 at 05:54:13 UTC, mw wrote: On Tuesday, 23 March 2021 at 05:34:57 UTC, Chris Piker wrote: Create a github repo, and create an account on: https://code.dlang.org/ Then you can register your project there, and supported by dub build. Okay, that's done. The repo

Re: Static initialization of associative arrays

2021-03-11 Thread Chris Piker via Digitalmars-d-learn
On Thursday, 11 March 2021 at 18:41:08 UTC, Ali Çehreli wrote: On 3/11/21 10:06 AM, Chris Piker wrote: >https://dlang.org/spec/hash-map.html#static_initialization > > that this feature is not yet implemented. I use a shared static this() block: immutable string[int] aa; shared static

Static initialization of associative arrays

2021-03-11 Thread Chris Piker via Digitalmars-d-learn
Hi D At work I've begun writing programs in D that I would typically write in python. My goal is to get away from split python/C development and just use one language most of the time. Today I ran across a situation where an immutable associative array would be handy. While perusing the

Re: Static initialization of associative arrays

2021-03-11 Thread Chris Piker via Digitalmars-d-learn
On Thursday, 11 March 2021 at 19:12:34 UTC, H. S. Teoh wrote: On Thu, Mar 11, 2021 at 06:06:35PM +, Chris Piker via immutable int[string] aa; shared static this() { aa = [ "abc": 123, "def": 456, /* ... */ ]; } Hi H.S.T Yes, I'm using static if, but do

rdmd and D equivalent for PYTHONPATH?

2021-03-16 Thread Chris Piker via Digitalmars-d-learn
Hi D I've writing little test scripts using rdmd to understand what various functions are really doing (ex: .take(5)). I'm up to the point where I need to write sample code to understand mir-algorithm a little better, but of course the library is not installed on my system. So two related

Re: rdmd and D equivalent for PYTHONPATH?

2021-03-16 Thread Chris Piker via Digitalmars-d-learn
On Wednesday, 17 March 2021 at 03:43:22 UTC, Chris Piker wrote: Note: I'm aware of dub. This isn't a question about dub. I'm making scripts for local use, not redistributable binaries, so I would like to "install" mir-algorithm and similar libraries for my rdmd scripts to use. Sorry to

Re: rdmd and D equivalent for PYTHONPATH?

2021-03-17 Thread Chris Piker via Digitalmars-d-learn
On Wednesday, 17 March 2021 at 06:07:01 UTC, user1234 wrote: You can use local a specific local version too, for example the git repository #!/usr/bin/env dub /+ dub.sdl: dependency "mir-algorithm" path="/home/x/repositories/mir/mir-algorithm" +/ In addition with --nodeps, no

Re: noobie question, dub or meson?

2021-03-19 Thread Chris Piker via Digitalmars-d-learn
On Thursday, 18 March 2021 at 06:02:03 UTC, Elronnd wrote: Meson doesn't track dependencies properly for d, so your dirty builds will be wrong if you go that route. You might consider keeping the c and d code in the same repository, but with separate build systems; using dub to build the d

Re: rdmd and D equivalent for PYTHONPATH?

2021-03-17 Thread Chris Piker via Digitalmars-d-learn
On Wednesday, 17 March 2021 at 09:34:21 UTC, Mike Parker wrote: On Wednesday, 17 March 2021 at 07:13:31 UTC, Chris Piker wrote: Very handy example. Unfortunately it means that paths are embedded in scripts, which is usually a bad idea. The ability to use D source modules “script style” is

Re: rdmd and D equivalent for PYTHONPATH?

2021-03-17 Thread Chris Piker via Digitalmars-d-learn
On Wednesday, 17 March 2021 at 20:24:19 UTC, Tobias Pankrath wrote: For scripts this could be a good way, but it does not really work with most dub packages: 1. put all your dependencies into a single location, like /home//dstuff 2. add -I /home//dstuff to your call to rdmd/dmd (or put

Re: rdmd and D equivalent for PYTHONPATH?

2021-03-17 Thread Chris Piker via Digitalmars-d-learn
On Wednesday, 17 March 2021 at 20:13:49 UTC, Imperatorn wrote: On Wednesday, 17 March 2021 at 19:33:26 UTC, Chris Piker wrote: On Wednesday, 17 March 2021 at 09:34:21 UTC, Mike Parker wrote: [...] Sure will, thanks for the invite to contribute in a specific way. [...] You probably

noobie question, dub or meson?

2021-03-17 Thread Chris Piker via Digitalmars-d-learn
Hi D I've started a D layer for one of my C libraries that's adds some new functionality and a bit of an interface upgrade. In turn I'm using this combined code-base as a dependency for D "scripts". Since my software is used by a few outside groups in my field, it seems I should get used

Recommendations on parsing XML via an InputRange

2021-09-13 Thread Chris Piker via Digitalmars-d-learn
Hi D I just finished a ~1K line project using `dxml` as the XML reader for my data streams. It works well in my test examples using memory mapped files, but like an impulse shopper I didn't notice that dxml requires `ForwardRange` objects. That's unfortunate, because my next enhancement

Is std.variant useful for types only known at run time?

2021-09-08 Thread Chris Piker via Digitalmars-d-learn
Hi D I'm working on data streaming reading module where the encoding of each input array isn't known until runtime. For example date-time column values may be encoded as: * An ISO-8601 UTC time string (aka char[]) * A ASCII floating point value with an indicated unit size and epoch

Re: Is std.variant useful for types only known at run time?

2021-09-08 Thread Chris Piker via Digitalmars-d-learn
On Wednesday, 8 September 2021 at 08:39:53 UTC, jfondren wrote: so I'd look at a std.sumtype of them first: Wow, this forum is like a CS department with infinite office hours! Interesting. I presume that the big win for using std.sumtype over a class set is value semantics instead of

Looking to get typeof parseXML return value

2021-09-06 Thread Chris Piker via Digitalmars-d-learn
Hi D I'm using the **dxml** library since I like it's "pull here for more data" mentality. I've come across the need to save an entity range created by the `parseXML` function as a class member so that I can tuck it away and pull more data as needed. Like almost all new users to D I'm

Re: Looking to get typeof parseXML return value

2021-09-06 Thread Chris Piker via Digitalmars-d-learn
On Tuesday, 7 September 2021 at 04:13:08 UTC, Chris Piker wrote: Any ideas on how to get the return type of `parseXML` below: ``` import dxml.parser; const(char)[] _mmfile; //_mmfile initialization TYPE??? _entityRng = parseXML!(simpleXML)(_mmfile); ``` Though it's ususally bad form to

Re: Looking to get typeof parseXML return value

2021-09-06 Thread Chris Piker via Digitalmars-d-learn
On Tuesday, 7 September 2021 at 04:40:25 UTC, jfondren wrote: typeof(parseXML!simpleXML("")) xml; Hey, I like this trick! I was wondering what to use for the const(char)[] variable in the typeof statement. It's blindingly obvious in retrospect. Wouldn't work so well if there wasn't a

UFC creating name conflict

2021-10-09 Thread Chris Piker via Digitalmars-d-learn
Hi D I have and old C structure that I have to wrap that has a member named '.seconds', and in the module that handles this I also have conversion functions to go from an internal time representation to struct SysTime values. Unfortunately importing `core.time` brings in a seconds function,

Re: UFC creating name conflict

2021-10-09 Thread Chris Piker via Digitalmars-d-learn
On Saturday, 9 October 2021 at 21:37:27 UTC, Paul Backus wrote: On Saturday, 9 October 2021 at 21:26:52 UTC, Chris Piker wrote: A struct member always takes priority over a UFCS function, so there must be something else going on that you've left out of your explanation. Can you post a

Using D "rocket" logo in outside presentation

2021-09-28 Thread Chris Piker via Digitalmars-d-learn
Hi D I'm to give a presentation to a combined NASA/ESA group in a few hours and would like to include a copy of the D "rocket" logo when mentioning new server side tools that I've written in D. Is such use of this particular [D

Re: Using D "rocket" logo in outside presentation

2021-10-01 Thread Chris Piker via Digitalmars-d-learn
On Wednesday, 29 September 2021 at 05:44:59 UTC, Mike Parker wrote: On Wednesday, 29 September 2021 at 04:24:13 UTC, Chris Piker wrote: I'm to give a presentation to a combined NASA/ESA group in a few hours and would like to include a copy of the D "rocket" logo when mentioning new server side

Re: gdc or ldc for faster programs?

2022-03-10 Thread Chris Piker via Digitalmars-d-learn
On Tuesday, 25 January 2022 at 20:04:04 UTC, Adam D Ruppe wrote: Not surprising at all: gdc is excellent and underrated in the community. The performance metrics are just a bonus. Gdc is the main reason I can get my worksite to take D seriously since we're a traditional unix shop (solaris

Re: Source code for vibe.d listenTCP()

2022-03-08 Thread Chris Piker via Digitalmars-d-learn
On Sunday, 27 February 2022 at 01:45:35 UTC, Adam D Ruppe wrote: My dpldocs.info search engine is not great right now but it can sometimes help find these things: http://search.dpldocs.info/?q=listenTCP Hi Adam Your site has been super helpful given the state of the vibe.d docs. It only

Write UTF-8 bytes directly to stack buffer

2022-03-10 Thread Chris Piker via Digitalmars-d-learn
Hi D There are quite a few string, array and range functions in phobos so I'm getting confused as to the right way to encode string data as UTF-8 directly into a stack buffer while keeping track of the write point. I have some output packets I'm building up in a tight loop. For speed I'm

Re: Write UTF-8 bytes directly to stack buffer

2022-03-13 Thread Chris Piker via Digitalmars-d-learn
On Thursday, 10 March 2022 at 17:59:33 UTC, H. S. Teoh wrote: Probably what you're looking for is std.format.formattedWrite. For example: ```d import std; void main() { ubyte[65536] buf; char[] usable_buf = cast(char[]) buf[]; usable_buf.formattedWrite!"Blah %d blah %s"(123,

Tips on TCP socket to postgresql middleware

2022-02-19 Thread Chris Piker via Digitalmars-d-learn
Hi D I'm about to start a small program to whose job is: 1. Connect to a server over a TCP socket 2. Read a packetized real-time data stream 3. Update/insert to a postgresql database as data arrive. In general it should buffer data in RAM to avoid exerting back pressure on the input socket

Re: Tips on TCP socket to postgresql middleware

2022-02-20 Thread Chris Piker via Digitalmars-d-learn
On Sunday, 20 February 2022 at 15:20:17 UTC, eugene wrote: Most people will probably say this is crazy, but as to PG, one can do without libraries. I am doing so during years (in C, not D) and did not expierienced extremely complex troubles. I mean I do not use libpq - instead I implement some

Re: Set output location for dub --single

2022-02-28 Thread Chris Piker via Digitalmars-d-learn
On Monday, 28 February 2022 at 08:03:24 UTC, Basile B. wrote: That 's not exactly what you ask for but you can define the path in the embedded recipe (targetPath) ```d #!/usr/bin/env dub /+ dub.sdl: dependency "mypackage" version="*" path=".." targetPath "./bin" +/ ``` Hey thanks!

Re: Source code for vibe.d listenTCP()

2022-02-26 Thread Chris Piker via Digitalmars-d-learn
On Sunday, 27 February 2022 at 01:45:35 UTC, Adam D Ruppe wrote: and my website also offers a "see implementation" link at the bottom which has some inline code navigation jump links too to help. Yes! Freaking awesome! This needs to be a link on the regular D pages, or at least in the package

Simple way to handle rvalues and templates.

2022-02-26 Thread Chris Piker via Digitalmars-d-learn
Hi D I have bit of code that was tripping me up. I need to parse small fields out of a big binary read, and it looks like some operations just can't be composed when it comes to using templates. So this works: ```d import std.bitmanip, std.system; ubyte[8192] data; ubyte[] temp =

Re: Source code for vibe.d listenTCP()

2022-02-26 Thread Chris Piker via Digitalmars-d-learn
On Saturday, 26 February 2022 at 22:25:46 UTC, Chris Piker wrote: Anyway if someone can just help me find the source code to listenTCP inside vibe.d I'd be grateful. Sorry to reply to myself, but I found the function. It was separated out into a separate package:

Source code for vibe.d listenTCP()

2022-02-26 Thread Chris Piker via Digitalmars-d-learn
Hi D I'm trying out the vibe.d framework for the first time and it looks like many of the functions mutate some hidden global state. Take for example `listenTCP`. To help me build a mental picuture of the framework I'd like to see what global state is mutated, but for the life of me I

Set output location for dub --single

2022-02-27 Thread Chris Piker via Digitalmars-d-learn
Hi D Coming from a python background it's worked well to organize my D projects as a dub `sourceLibrary` and then to put top level programs in a directory named `scripts` that are just dub single file projects. So the layout looks like this: ``` rootdir/ | +- mypackage/ || |

Re: Tips on TCP socket to postgresql middleware

2022-02-20 Thread Chris Piker via Digitalmars-d-learn
On Sunday, 20 February 2022 at 17:58:41 UTC, Ali Çehreli wrote: Another one is to set the message box sizes to throttle. Message sizes and rates are relatively well know so it will be easy to pick a throttle point that's unlikely to backup the source yet provide for some quick DB maintenance

Re: Tips on TCP socket to postgresql middleware

2022-02-20 Thread Chris Piker via Digitalmars-d-learn
On Sunday, 20 February 2022 at 18:00:26 UTC, eugene wrote: Yes, here is my engine with example (echo client/server pair): - [In D (for Linux & FreeBSD)](http://zed.karelia.ru/0/e/edsm-2022-02-20.tar.gz) The code is terse and clean, thanks for sharing :) I'm adverse to reading it closely

Re: Tips on TCP socket to postgresql middleware

2022-02-20 Thread Chris Piker via Digitalmars-d-learn
On Sunday, 20 February 2022 at 18:36:21 UTC, eugene wrote: I often use two connections, one for perform main task (upload some data and alike) and the second for getting notifications from PG, 'cause it very incovinient to do both in a single connection. Ah, a very handy tip. It would be

Re: Tips on TCP socket to postgresql middleware

2022-02-22 Thread Chris Piker via Digitalmars-d-learn
On Monday, 21 February 2022 at 07:00:52 UTC, eugene wrote: On Monday, 21 February 2022 at 04:46:53 UTC, Chris Piker wrote: On Sunday, 20 February 2022 at 18:00:26 UTC, eugene wrote: I'm adverse to reading it closely since there was no license file and don't want to accidentally violate

Re: How to print current type of a SumType?

2023-09-30 Thread Chris Piker via Digitalmars-d-learn
We posted at the same time! Thanks for help nonetheless. I do hope over time, SumTypes get the Ali Çehreli treatment. I keep his book open on my desk all the time.

Re: How to print current type of a SumType?

2023-09-30 Thread Chris Piker via Digitalmars-d-learn
On Sunday, 1 October 2023 at 01:17:50 UTC, Chris Piker wrote: ```d alias Vec3 = SumType!(void* /* invalid vector */, byte[3], short[3], char[][3]); ``` I know it's bad form to reply to my own question, but I think I found a reasonably simple way: ```d string prnType(Vec3 vec){ return

How to print current type of a SumType?

2023-09-30 Thread Chris Piker via Digitalmars-d-learn
Hi D I've a simple question but it's bedeviling me anyway. How do I get a string representation of the current type of a SumType? I'm trying to avoid something like this: ```d alias Vec3 = SumType!(void* /* invalid vector */, byte[3], short[3], char[][3]); string prnType(Vec3 vec){

SumType structure wrapping seems to fail (dmd v2.105.2)

2023-09-30 Thread Chris Piker via Digitalmars-d-learn
Hi D As suggested in other threads I've tried wrapping a SumType in a structure to add functionality and used `alias ... this` to make assignment, etc. easier. However the following code fails in dmd 2.105.2. ```d import std.sumtype; struct Item{ SumType!(void*, byte[3], ubyte[3],

Re: What are (were) the most difficult parts of D?

2022-05-22 Thread Chris Piker via Digitalmars-d-learn
On Wednesday, 11 May 2022 at 05:41:35 UTC, Ali Çehreli wrote: What are you stuck at? What was the most difficult features to understand? etc. To make it more meaningful, what is your experience with other languages? Ali Hi Ali, thanks for asking. Coming from C background I had problems

Re: What are (were) the most difficult parts of D?

2022-05-22 Thread Chris Piker via Digitalmars-d-learn
On Sunday, 22 May 2022 at 19:33:21 UTC, rikki cattermole wrote: I should probably jump back to another thread, but maybe one more reply isn't too much off topic discussion... DMD and LDC would have produced the same set of issues, because its the same frontend. Oh, the compile stage works

Re: What are (were) the most difficult parts of D?

2022-05-22 Thread Chris Piker via Digitalmars-d-learn
On Sunday, 22 May 2022 at 19:01:41 UTC, rikki cattermole wrote: On 23/05/2022 6:06 AM, Chris Piker wrote: Iain's workload should be decreasing now that it is using the up to date frontend. Rather than the older C++ version with backports that he has been maintaining. Hats off to Iain for

Re: What are (were) the most difficult parts of D?

2022-05-22 Thread Chris Piker via Digitalmars-d-learn
On Sunday, 22 May 2022 at 20:11:12 UTC, rikki cattermole wrote: On 23/05/2022 8:05 AM, Chris Piker wrote: Vibe.d is well tested against the frontend. Its part of dmd's test suite. See: https://buildkite.com/dlang/dmd/builds/26775 Thanks, that's handy.  Do you know where the equivalent test

Re: importC and cmake

2022-09-29 Thread Chris Piker via Digitalmars-d-learn
On Wednesday, 28 September 2022 at 06:04:36 UTC, zjh wrote: On Wednesday, 28 September 2022 at 05:29:41 UTC, Chris Piker wrote: `Xmake` is indeed simpler. `Xmake` is really nice! zjh Sorry to go off topic for a moment, but do you happen to know how to tell xmake that my project is C

Re: importC and cmake

2022-09-27 Thread Chris Piker via Digitalmars-d-learn
On Wednesday, 7 September 2022 at 00:31:53 UTC, zjh wrote: `xmake` is simpler. Thanks for the recommendation. Was struggling with cmake for a dependent clib. Xmake is indeed simpler.

Re: Is there such a JSON parser?

2023-01-02 Thread Chris Piker via Digitalmars-d-learn
On Monday, 2 January 2023 at 14:56:27 UTC, SealabJaster wrote: Are you asking for a SAX-styled parser for JSON? I have an upcoming project (about 3-6 months away) that could make use of this as well. If you need someone to try it out please let me know and I'll give it a spin. Good luck

Use dub to create source lib and executables

2023-03-04 Thread Chris Piker via Digitalmars-d-learn
Hi D I normally work in a *nix environment, typically on server-side code. For many projects I have gnu makefiles that build a small lib along with command line utilities. Up to now I've been creating a dub.json file for just the sourceLibrary, and then putting embedded dub comments at the

Re: Using Windbg to debug D applications and unittests

2023-03-04 Thread Chris Piker via Digitalmars-d-learn
On Monday, 27 February 2023 at 12:09:50 UTC, Basile B. wrote: At least this is what is done for the Dexed GDB widget, so that gdb breaks automatically when an Error or an Exception is new'd (https://gitlab.com/basile.b/dexed/-/blob/master/src/u_gdb.pas#L2072). Glad you mentioned Dexed. I Had

Re: Use dub to create source lib and executables

2023-03-04 Thread Chris Piker via Digitalmars-d-learn
On Saturday, 4 March 2023 at 21:31:09 UTC, Richard (Rikki) Andrew Cattermole wrote: Yes dub was setup to cover the most common cases, but ignores when you have multiple outputs. Not ideal. There is a PR to add build steps currently, which will help improve things, so there is work to make dub

Re: Use dub to create source lib and executables

2023-03-04 Thread Chris Piker via Digitalmars-d-learn
On Saturday, 4 March 2023 at 20:23:29 UTC, Steven Schveighoffer wrote: On 3/4/23 1:33 PM, Chris Piker wrote: If you mean that you have multiple subprojects inside your main dub project, my advice is to follow what other such projects do. I always look at vibe for my example. I have been

Re: Deciding one member of iteration chain at runtime

2023-02-17 Thread Chris Piker via Digitalmars-d-learn
On Friday, 17 February 2023 at 17:42:19 UTC, Ali Çehreli wrote: // Two different steps auto g1 = r.map!((int n) => n * n); auto g2 = r.map!((int n) => n * 10); // The rest of the algoritm auto result = choose(condition, g1, g2) .array; Now that's a handy

Deciding one member of iteration chain at runtime

2023-02-17 Thread Chris Piker via Digitalmars-d-learn
Hi D I have a main "loop" for a data processing program that looks much as follows: ```d sourceRange .operatorA .operatorB .operatorC .operatorD .operatorE .operatorF .operatorG .operatorH .copy(destination); ``` Where all `operator` items above are InputRange structs that

Re: Deciding one member of iteration chain at runtime

2023-02-17 Thread Chris Piker via Digitalmars-d-learn
On Friday, 17 February 2023 at 17:44:20 UTC, H. S. Teoh wrote: Here's an actual function taken from my own code, that returns a different range type depending on a runtime condition, maybe this will help you? Thanks, this was helpful. I keep forgetting to expand my horizons on what can be

Recommendation on plotting library

2023-07-19 Thread Chris Piker via Digitalmars-d-learn
Hi D One of my jobs is to release and maintain public data archives from long-running scientific instruments. In order to help people understand how to process the data, sample code is often included with the archive. Recently this has been in the form of short programs that generate a plot

Re: Recommendation on plotting library

2023-07-19 Thread Chris Piker via Digitalmars-d-learn
On Thursday, 20 July 2023 at 03:58:05 UTC, Andrew wrote: If you're already using python, it's probably best to keep using that. Oh of course. Examples *have* to be provided in python, since that's the default language of science these days. But extra examples don't hurt, and it would be

Pre-import version statements

2023-07-19 Thread Chris Piker via Digitalmars-d-learn
Hi D In my C code I used to typically put the line: ``` #define _POSIX_C_SOURCE 200112L ``` in the source before importing any standard library headers. Is there something equivalent for phobos? Say `version(phobos2.100)` or similar? I don't particularly need this functionality, just

Re: Pre-import version statements

2023-07-20 Thread Chris Piker via Digitalmars-d-learn
On Thursday, 20 July 2023 at 06:44:30 UTC, Jonathan M Davis wrote: D has nothing equivalent to that. You compile your code with whichever version of dmd (or ldc, gdc, etc.) that you want, and it either compiles or it doesn't. Thanks :) As I developer that doesn't bother me too much, though

Re: Recommendation on plotting library

2023-07-21 Thread Chris Piker via Digitalmars-d-learn
On Friday, 21 July 2023 at 06:15:10 UTC, Jonathan M Davis wrote: On Thursday, July 20, 2023 10:57:22 PM MDT Chris Piker via Digitalmars-d-learn wrote: Regardless though, dub really isn't designed with packaging anything in mind. Rather, it's designed to build your code as well as pull in D

Re: Recommendation on plotting library

2023-07-21 Thread Chris Piker via Digitalmars-d-learn
On Friday, 21 July 2023 at 17:40:25 UTC, Greggor wrote: Up to date versions of Windows 10 should have curl included and dub can run commands before building, so you could try downloading a prebuilt lib for windows via curl. https://everything.curl.dev/get/windows Hey, nice! This might be a

Re: Recommendation on plotting library

2023-07-22 Thread Chris Piker via Digitalmars-d-learn
Thanks for the both of the long replies. I've ready them twice and will do so again. To focus in on one aspect of D package support: On Saturday, 22 July 2023 at 02:24:08 UTC, Greggor wrote: In general whenever possible I think its better for everyone that stuff is built from source. It

  1   2   >