Re: dub creates unrunnable binary in "build" dir

2023-02-24 Thread tastyminerals--- via Digitalmars-d-learn
On Thursday, 23 February 2023 at 12:28:35 UTC, Richard (Rikki) Andrew Cattermole wrote: On 24/02/2023 1:10 AM, tastyminer...@gmail.com wrote: The symbol exists if I understood correctly. -imports shows you the imports of the binary, not the exports. So no it does not exist (probably came

dub creates unrunnable binary in "build" dir

2023-02-23 Thread tastyminerals--- via Digitalmars-d-learn
I have been using dub to build one project of mine and its been 2021 the last time I tried to rebuild it... I made some code changes today and wanted to run unittests. Here is what I got after running `dub build -b tests`: ``` Starting Performing "tests" build using

Re: How to update Associative Array?

2022-02-10 Thread tastyminerals via Digitalmars-d-learn
On Thursday, 10 February 2022 at 12:04:04 UTC, bauss wrote: On Thursday, 10 February 2022 at 10:59:17 UTC, tastyminerals wrote: [...] You can just do: aa[key] = value. If the key exist then it's updated, if it doesn't then it's added. The reason for the update function is simply in cases

How to update Associative Array?

2022-02-10 Thread tastyminerals via Digitalmars-d-learn
Not sure if the `update` method got changed but I am having trouble with understanding it now. I assumed it would work as easy as in Python:) Just do `mydic.update(dic)` or `mydic["key"].update(anotherDic)`. The docs have the following example. ``` class C{} C[string] aa; C older; C newer;

Re: How to use sets in D?

2022-02-10 Thread tastyminerals via Digitalmars-d-learn
On Tuesday, 8 February 2022 at 21:42:06 UTC, H. S. Teoh wrote: On Tue, Feb 08, 2022 at 09:08:47PM +, tastyminerals via Digitalmars-d-learn wrote: [...] > [...] [...] [...] E is whatever key type you want to use. String, or integer ID, or whatever you want to put in your

How to use sets in D?

2022-02-08 Thread tastyminerals via Digitalmars-d-learn
https://forum.dlang.org/post/mailman.1072.1581112984.31109.digitalmars-d-le...@puremagic.com On Friday, 7 February 2020 at 22:03:00 UTC, H. S. Teoh wrote: On Fri, Feb 07, 2020 at 07:37:08PM +, mark via Digitalmars-d-learn wrote: [...] bool[E] works just fine. The bool does take up 1

Dub fails to run inside a docker container on MacBook

2021-12-02 Thread tastyminerals via Digitalmars-d-learn
I am trying to create a Docker image where I can build my dub project. Here is a simple Dockerfile. ``` FROM ubuntu as build RUN apt-get update \ && apt-get install --no-install-recommends -y -q locales build-essential apt-transport-https ca-certificates dub\ && apt-get clean \

Re: tkd does not build anymore after 2.096

2021-10-15 Thread tastyminerals via Digitalmars-d-learn
On Wednesday, 13 October 2021 at 01:55:38 UTC, russhy wrote: On Tuesday, 12 October 2021 at 18:18:45 UTC, tastyminerals wrote: On Tuesday, 12 October 2021 at 17:35:53 UTC, russhy wrote: [...] Yes, I can locally "fix" that but I would also like whoever wants to compile the app in the company

Re: How to check if value is null, today?

2021-10-15 Thread tastyminerals via Digitalmars-d-learn
On Thursday, 14 October 2021 at 12:43:36 UTC, jfondren wrote: On Thursday, 14 October 2021 at 11:58:29 UTC, tastyminerals wrote: Here is an example code that doesn't work with the new compiler anymore: ``` if (someValue.isNull) ``` Attempting to run the above throws: ``` Error: incompatible

How to check if value is null, today?

2021-10-14 Thread tastyminerals via Digitalmars-d-learn
The new `DMD v2.097.2` deprecated implicit null conversions `std.typecons.Nullable!double.Nullable.get_`. The deprecation warning tell you to `Please use .get explicitly.`. Here is an example code that doesn't work with the new compiler anymore: ``` if (someValue.isNull) ``` Attempting to

Re: tkd does not build anymore after 2.096

2021-10-12 Thread tastyminerals via Digitalmars-d-learn
On Tuesday, 12 October 2021 at 17:35:53 UTC, russhy wrote: Recent version for nullable removed implicit conversion, you must call .get now.. wich is a pain to update i suggest using a previous version of ``struct Nullable`` https://github.com/dlang/phobos/blob/v2.096.1/std/typecons.d

tkd does not build anymore after 2.096

2021-10-12 Thread tastyminerals via Digitalmars-d-learn
There have been numerous deprecation warnings for nice **tkd** library: https://github.com/nomad-software/tkd and with the current ldc 1.27.1 it fails to build. ``` x11 1.0.21: building configuration "tcltk-import"... tcltk 8.6.5: building configuration "library"... tkd 1.1.13: building

Re: How to convert PDF to PNG using DMagick?

2021-09-25 Thread tastyminerals via Digitalmars-d-learn
On Saturday, 25 September 2021 at 16:27:35 UTC, Tejas wrote: On Saturday, 25 September 2021 at 15:14:50 UTC, Mike Wey wrote: On 25-09-2021 15:21, tastyminerals wrote: [...] It's been awhile since i used it myself, but if imagemagick supports reading PDF's this might work: ``` Image pdf =

How to convert PDF to PNG using DMagick?

2021-09-25 Thread tastyminerals via Digitalmars-d-learn
When I need to convert a PDF image in console, I use ImageMagick: `convert doc.pdf doc.png` command. Today I found ImageMagick D bindings -- DMagick https://github.com/MikeWey/DMagick. I would like to script this operation using DMagick. However, I couldn't find any code samples and was not

Re: How to make clang use a different tk framework version on MacOS?

2021-09-22 Thread tastyminerals via Digitalmars-d-learn
On Monday, 20 September 2021 at 21:58:27 UTC, tastyminerals wrote: My tkd GUI app started getting compiled with an outdated 8.5 Tk framework version which gets shipped with command line tools: `xcode-select --install`. As a result, the UI doesn't display icons and is laggy. When you run the

Re: zsh: command not found: rdmd

2021-09-20 Thread tastyminerals via Digitalmars-d-learn
On Monday, 20 September 2021 at 11:04:42 UTC, leikang wrote: Enter dmd lk01.d in vscode, the terminal displays zsh: command not found: dmd, an error is reported, I don't know what the problem is, can it only be run in /Users/mac1094/dmd2/osx/bin? Keep in mind that if you have M1 machine, you

How to make clang use a different tk framework version on MacOS?

2021-09-20 Thread tastyminerals via Digitalmars-d-learn
My tkd GUI app started getting compiled with an outdated 8.5 Tk framework version which gets shipped with command line tools: `xcode-select --install`. As a result, the UI doesn't display icons and is laggy. When you run the compiled tk app, you get a notorious warning: ``` DEPRECATION

Re: How to simply parse and print the XML with dxml?

2021-09-10 Thread tastyminerals via Digitalmars-d-learn
On Thursday, 9 September 2021 at 18:40:53 UTC, jfondren wrote: On Thursday, 9 September 2021 at 17:17:23 UTC, tastyminerals wrote: [...] dxml.parser is a streaming XML parser. The documentation at http://jmdavisprog.com/docs/dxml/0.4.0/dxml_parser.html has a link to more information about

How to simply parse and print the XML with dxml?

2021-09-09 Thread tastyminerals via Digitalmars-d-learn
Maybe I missed something obvious in the docs but how can I just parse the XML and print its content? ``` import dxml.parser; auto xml = parseXML!simpleXML(layout); xml.map!(e => e.text).join.writeln; ``` throws

Re: DUB "Error: only one `main` allowed."

2021-08-11 Thread tastyminerals via Digitalmars-d-learn
On Wednesday, 11 August 2021 at 11:44:42 UTC, Steven Schveighoffer wrote: On 8/11/21 5:31 AM, tastyminerals wrote: [...] `dub -b unittest` should work (you don't need the extra build type stuff) dub test does something funky -- it removes the *whole module* where your main function is (if

Re: DUB "Error: only one `main` allowed."

2021-08-11 Thread tastyminerals via Digitalmars-d-learn
On Wednesday, 11 August 2021 at 09:31:46 UTC, tastyminerals wrote: I would like to trigger tests in a simple dub project. ``` source/my_script.d dub.json ``` Here is a dub config: ```json { "targetPath": "build", "targetType": "executable", "sourcePaths": ["source"],

DUB "Error: only one `main` allowed."

2021-08-11 Thread tastyminerals via Digitalmars-d-learn
I would like to trigger tests in a simple dub project. ``` source/my_script.d dub.json ``` Here is a dub config: ```json { "targetPath": "build", "targetType": "executable", "sourcePaths": ["source"], "name": "my_script", "buildTypes": {

Re: DUB "Error: only one `main` allowed."

2021-08-11 Thread tastyminerals via Digitalmars-d-learn
On Wednesday, 11 August 2021 at 09:31:46 UTC, tastyminerals wrote: I would like to trigger tests in a simple dub project. ``` source/my_script.d dub.json ``` Here is a dub config: ```json { "targetPath": "build", "targetType": "executable", "sourcePaths": ["source"],

Re: How to put an arbitrary string to clipboard in D?

2021-07-31 Thread tastyminerals via Digitalmars-d-learn
On Friday, 30 July 2021 at 20:01:09 UTC, rikki cattermole wrote: On 31/07/2021 7:33 AM, tastyminerals wrote: I made a GUI app using tkd library. I am reading the string from one of the app widgets and would like to put it into the clipboard. Does anyone have an idea how to copy a string to

How to put an arbitrary string to clipboard in D?

2021-07-30 Thread tastyminerals via Digitalmars-d-learn
I made a GUI app using tkd library. I am reading the string from one of the app widgets and would like to put it into the clipboard. Does anyone have an idea how to copy a string to the clipboard in D?

Re: Receiving "pthread_mutexattr_init" during compilation when using FileLogger.

2021-06-07 Thread tastyminerals via Digitalmars-d-learn
On Monday, 7 June 2021 at 11:29:44 UTC, tastyminerals wrote: On Monday, 7 June 2021 at 10:36:23 UTC, Mike Parker wrote: On Monday, 7 June 2021 at 09:29:08 UTC, tastyminerals wrote: I getting ``` import/core/sync/mutex.d(87,36): Error: `pthread_mutexattr_init` cannot be interpreted at compile

Re: Receiving "pthread_mutexattr_init" during compilation when using FileLogger.

2021-06-07 Thread tastyminerals via Digitalmars-d-learn
On Monday, 7 June 2021 at 10:36:23 UTC, Mike Parker wrote: On Monday, 7 June 2021 at 09:29:08 UTC, tastyminerals wrote: I getting ``` import/core/sync/mutex.d(87,36): Error: `pthread_mutexattr_init` cannot be interpreted at compile time, because it has no available source code ``` compile

Receiving "pthread_mutexattr_init" during compilation when using FileLogger.

2021-06-07 Thread tastyminerals via Digitalmars-d-learn
I getting ``` import/core/sync/mutex.d(87,36): Error: `pthread_mutexattr_init` cannot be interpreted at compile time, because it has no available source code ``` compile time error. One of those D exceptions which doesn't say where it happened in your code so you need to comment out the

How to parse JSON in D?

2021-03-29 Thread tastyminerals via Digitalmars-d-learn
We need to parse a bunch of JSON files. What does D have? It has std.json which is strangely slower than Python json :( Ok, we go to dub repository and search for something that is faster. There are basically two implementations fast.json and stdx.data.json. The first one refuses to work on Mac

Re: What happened to std.net.curl HTTP execute?

2021-03-25 Thread tastyminerals via Digitalmars-d-learn
On Wednesday, 17 March 2021 at 16:02:58 UTC, tastyminerals wrote: I am using std.net.curl and the following chunk of code in many places: """ http.setPostData(userData, "application/json"); http.addRequestHeader("Accept", "application/json"); http.addRequestHeader("Authorization",

What happened to std.net.curl HTTP execute?

2021-03-17 Thread tastyminerals via Digitalmars-d-learn
I am using std.net.curl and the following chunk of code in many places: """ http.setPostData(userData, "application/json"); http.addRequestHeader("Accept", "application/json"); http.addRequestHeader("Authorization", "BEARER " ~ clientAccessToken); auto jsonData =

Re: dub support for Mac M1?

2021-03-05 Thread tastyminerals via Digitalmars-d-learn
On Thursday, 4 March 2021 at 23:57:25 UTC, kinke wrote: On Thursday, 4 March 2021 at 22:30:17 UTC, tastyminerals wrote: I got a company MacBook with M1 chip and gradually migrate all the stuff from Linux machine. I got precompiled ldc binary installed without any problem now is the time for

dub support for Mac M1?

2021-03-04 Thread tastyminerals via Digitalmars-d-learn
I got a company MacBook with M1 chip and gradually migrate all the stuff from Linux machine. I got precompiled ldc binary installed without any problem now is the time for dub since I have couple of D projects I use at work and all of them use dub. I can only see the

Re: DMD support for Apples new silicon

2021-03-02 Thread tastyminerals via Digitalmars-d-learn
On Sunday, 10 January 2021 at 14:50:44 UTC, Guillaume Piolat wrote: On Sunday, 10 January 2021 at 14:22:25 UTC, Christian Köstlin wrote: [...] Hello Christian, [...] I see that there is a ldc2-1.25.1-osx-arm64.tar.xz already among https://github.com/ldc-developers/ldc/releases So, one

Re: How to rebind the default tkd GUI keybinds?

2020-11-25 Thread tastyminerals via Digitalmars-d-learn
On Saturday, 17 October 2020 at 18:39:54 UTC, starcanopy wrote: On Saturday, 17 October 2020 at 09:33:04 UTC, tastyminerals wrote: On Sunday, 11 October 2020 at 18:51:17 UTC, tastyminerals wrote: [...] So, this is even tricky in Python TkInter but possible. In tkd this is not possible

Re: How to rebind the default tkd GUI keybinds?

2020-10-17 Thread tastyminerals via Digitalmars-d-learn
On Sunday, 11 October 2020 at 18:51:17 UTC, tastyminerals wrote: Tk default keys are somewhat different from what we used to use for selecting, copying and pasting the text. So, any Tk based GUI app starts with writing the rebinding function for "ctrl+a", "ctrl+c", "ctrl+x" and "ctrl+v" keys,

Re: How to add an additional config dir in DUB under source?

2020-10-13 Thread tastyminerals via Digitalmars-d-learn
On Tuesday, 13 October 2020 at 05:13:18 UTC, Mike Parker wrote: On Monday, 12 October 2020 at 22:31:53 UTC, tastyminerals wrote: [...] This: readText("conf.toml"); [...] Thanks. I remembered that I read about them in Ali's book but never actually used them.

How to add an additional config dir in DUB under source?

2020-10-12 Thread tastyminerals via Digitalmars-d-learn
I have the following project structure: source/ media/ icon.png config/ conf.toml In order to access "icon.png" without explicitly providing the path I added in dub.json "stringImportPaths": [ "source/media", "source/config" ] It works for "icon.png" but doesn't work for

Re: vibe.d / experience / feedback

2020-10-11 Thread tastyminerals via Digitalmars-d-learn
On Sunday, 11 October 2020 at 11:56:29 UTC, Robert M. Münch wrote: On 6 Oct 2020 at 10:07:56 CEST, "ddcovery" wrote: I found myself in a similar situation recently, and I can't help but ask you: What technology do you use regularly? Hi, well we use a couple of different things. Scripting

How to rebind the default tkd GUI keybinds?

2020-10-11 Thread tastyminerals via Digitalmars-d-learn
Tk default keys are somewhat different from what we used to use for selecting, copying and pasting the text. So, any Tk based GUI app starts with writing the rebinding function for "ctrl+a", "ctrl+c", "ctrl+x" and "ctrl+v" keys, at least. I did it when writing TkInter based apps in Python.

Re: How to hide a function return type in order to wrap several functions into an associated array?

2020-10-03 Thread tastyminerals via Digitalmars-d-learn
On Sunday, 27 September 2020 at 20:03:21 UTC, Paul Backus wrote: On Sunday, 27 September 2020 at 18:54:11 UTC, tastyminerals wrote: [...] You can use an Algebraic [1] or SumType [2] for this: alias Feature = SumType!(ulong, double, bool); Feature numberOfPunctChars(string text) { // ...

Re: How to hide a function return type in order to wrap several functions into an associated array?

2020-10-03 Thread tastyminerals via Digitalmars-d-learn
On Sunday, 27 September 2020 at 22:55:14 UTC, Ali Çehreli wrote: On 9/27/20 11:54 AM, tastyminerals wrote: > [...] input, a string. > [...] function does > [...] [...] Thank you. Quite an inspirational example with delegates.

How to hide a function return type in order to wrap several functions into an associated array?

2020-09-27 Thread tastyminerals via Digitalmars-d-learn
This is rather a generic implementation question not necessarily related to D but I'd like to get some opinions. I have a collection of functions that all have the same input, a string. The output however is different and depending on what the function does it can be ulong, double or bool. The

Re: How to use std.net.curl with specific curl query?

2020-09-03 Thread tastyminerals via Digitalmars-d-learn
On Thursday, 3 September 2020 at 11:14:14 UTC, tastyminerals wrote: I have a specific curl query that I want to use in a D script via std.net.curl. Here is the query: curl -v -X POST --data-urlencode "username=u...@gmail.net" --data-urlencode "password=12345" -H

How to use std.net.curl with specific curl query?

2020-09-03 Thread tastyminerals via Digitalmars-d-learn
I have a specific curl query that I want to use in a D script via std.net.curl. Here is the query: curl -v -X POST --data-urlencode "username=u...@gmail.net" --data-urlencode "password=12345" -H "Content-Type: application/x-www-form-urlencoded" -H "Accept:

Re: 2-D array initialization

2020-08-04 Thread tastyminerals via Digitalmars-d-learn
On Sunday, 2 August 2020 at 19:19:51 UTC, Andy Balba wrote: On Sunday, 2 August 2020 at 06:37:06 UTC, tastyminerals wrote: You haven't said anything about efficiency because if you care and your arrays are rather big, you better go with https://github.com/libmir/mir-algorithm as mentioned

Re: 2-D array initialization

2020-08-02 Thread tastyminerals via Digitalmars-d-learn
On Sunday, 2 August 2020 at 02:00:46 UTC, Andy Balba wrote: On Saturday, 1 August 2020 at 22:00:43 UTC, Ali Çehreli wrote: On 8/1/20 12:57 PM, Andy Balba wrote: > On Saturday, 1 August 2020 at 00:08:33 UTC, MoonlightSentinel wrote: >> On Friday, 31 July 2020 at 23:42:45 UTC, Andy Balba wrote:

Re: D Mir: standard deviation speed

2020-07-15 Thread tastyminerals via Digitalmars-d-learn
On Wednesday, 15 July 2020 at 07:51:31 UTC, 9il wrote: On Wednesday, 15 July 2020 at 07:34:59 UTC, tastyminerals wrote: On Wednesday, 15 July 2020 at 06:57:21 UTC, 9il wrote: On Wednesday, 15 July 2020 at 06:55:51 UTC, 9il wrote: On Wednesday, 15 July 2020 at 06:00:46 UTC, tastyminerals

Re: Contributing to D wiki

2020-07-15 Thread tastyminerals via Digitalmars-d-learn
On Wednesday, 15 July 2020 at 16:04:56 UTC, aberba wrote: So I'm looking to make changes to the D wiki but I'm not sure who to talk to about such changes. Currently: Move all other IDEs low-quality down (maybe to Others) and focus on just the few that really works (IntelliJ, Visual Studio

Re: D Mir: standard deviation speed

2020-07-15 Thread tastyminerals via Digitalmars-d-learn
On Wednesday, 15 July 2020 at 06:57:21 UTC, 9il wrote: On Wednesday, 15 July 2020 at 06:55:51 UTC, 9il wrote: On Wednesday, 15 July 2020 at 06:00:46 UTC, tastyminerals wrote: On Wednesday, 15 July 2020 at 02:08:48 UTC, 9il wrote: On Tuesday, 14 July 2020 at 19:04:45 UTC, tastyminerals wrote:

Re: D Mir: standard deviation speed

2020-07-15 Thread tastyminerals via Digitalmars-d-learn
On Wednesday, 15 July 2020 at 02:08:48 UTC, 9il wrote: On Tuesday, 14 July 2020 at 19:04:45 UTC, tastyminerals wrote: @fastmath private double sd0(T)(Slice!(T*, 1) flatMatrix) @fastmath shouldn't be really used with summation algorithms except the `"fast"` version of them. Otherwise, they

Re: D Mir: standard deviation speed

2020-07-15 Thread tastyminerals via Digitalmars-d-learn
On Tuesday, 14 July 2020 at 19:36:21 UTC, jmh530 wrote: On Tuesday, 14 July 2020 at 19:04:45 UTC, tastyminerals wrote: [...] It would be helpful to provide a link. You should only need one accumulator for mean and centered sum of squares. See the python example under the Welford example

D Mir: standard deviation speed

2020-07-14 Thread tastyminerals via Digitalmars-d-learn
I am trying to implement standard deviation calculation in Mir for benchmark purposes. I have two implementations. One is the straightforward std = sqrt(mean(abs(x - x.mean())**2)) and the other follows Welford's algorithm for computing variance (as described here:

Re: Why is this allowed

2020-06-30 Thread tastyminerals via Digitalmars-d-learn
On Tuesday, 30 June 2020 at 16:22:57 UTC, JN wrote: Spent some time debugging because I didn't notice it at first, essentially something like this: int[3] foo = [1, 2, 3]; foo = 5; writeln(foo); // 5, 5, 5 Why does such code compile? I don't think this should be permitted, because it's

Why infinite loops are faster than finite loops?

2020-06-20 Thread tastyminerals via Digitalmars-d-learn
I am not sure that this is a question about D or a more general one. I have watched this nice presentation "Speed Is Found In The Minds of People" by Andrei: https://www.youtube.com/watch?v=FJJTYQYB1JQ=youtu.be?t=2596 and on 43:20 he says that "push_heap" is slow because of structured loops and

Using autowrap to build a D library for Python

2020-06-16 Thread tastyminerals via Digitalmars-d-learn
I am trying out autowrap to build a D library for Python. After I ran "dub build" which builds mylib.so and try to import it in Python interpreter, I get: "ImportError: dynamic module does not define module export function (PyInit_libautowrap_mylib)" Which means the library was build for

Re: Looking for a Code Review of a Bioinformatics POC

2020-06-11 Thread tastyminerals via Digitalmars-d-learn
On Thursday, 11 June 2020 at 21:54:31 UTC, duck_tape wrote: On Thursday, 11 June 2020 at 20:24:37 UTC, tastyminerals wrote: Mir Slices instead of standard D arrays are faster. Athough looking at your code I don't see where you can plug them in. Just keep in mind. Thanks for taking a look!

Re: Looking for a Code Review of a Bioinformatics POC

2020-06-11 Thread tastyminerals via Digitalmars-d-learn
On Thursday, 11 June 2020 at 16:13:34 UTC, duck_tape wrote: Hi! I'm new to dlang but loving it so far! One of my favorite first things to implement in a new language is an interval library. In this case I want to submit to a benchmark repo: https://github.com/lh3/biofast If anyone is willing

Re: Looking for a Code Review of a Bioinformatics POC

2020-06-11 Thread tastyminerals via Digitalmars-d-learn
On Thursday, 11 June 2020 at 16:13:34 UTC, duck_tape wrote: Hi! I'm new to dlang but loving it so far! One of my favorite first things to implement in a new language is an interval library. In this case I want to submit to a benchmark repo: https://github.com/lh3/biofast If anyone is willing

Re: Metaprogramming with D

2020-06-09 Thread tastyminerals via Digitalmars-d-learn
On Monday, 8 June 2020 at 14:41:55 UTC, Jan Hönig wrote: On Sunday, 7 June 2020 at 00:45:37 UTC, Ali Çehreli wrote: dmd -mixin= ... thanks for the tip! writeln(q{ void foo() { } }); What is the name of this `q` thing? How do i find it? Are there any recent tutorials