Re: Make sure lifetime of helper structs is less than owning struct

2021-11-15 Thread WebFreak001 via Digitalmars-d-learn
On Monday, 15 November 2021 at 19:24:56 UTC, Sebastiaan Koppe wrote: On Monday, 15 November 2021 at 15:56:57 UTC, WebFreak001 wrote: is this currently possible or maybe possible with DIP1000? Yes it is. But besides `-dip1000` and `@safe`, it requires the use of a pointer: ```D @safe:

Make sure lifetime of helper structs is less than owning struct

2021-11-15 Thread WebFreak001 via Digitalmars-d-learn
I have an API with some struct like a file reader. I want to add byChunks-like functionality to it, so I'm trying to implement it with a helper struct that implements opApply. I have disabled copying the file reader struct because it cleans up the resources once it goes out of scope, however

Re: __cpuid like in C

2021-11-02 Thread WebFreak001 via Digitalmars-d-learn
On Monday, 1 November 2021 at 16:16:12 UTC, Arsium wrote: On Monday, 1 November 2021 at 16:02:20 UTC, Paul Backus wrote: On Monday, 1 November 2021 at 16:00:05 UTC, Arsium wrote: Hello, Currently, I'm working to implement myself WinAPI functions. However, I could not find anything matching

Re: TimeoutException for connecting to MySQL using a hunt-entity.

2021-10-22 Thread WebFreak001 via Digitalmars-d-learn
On Friday, 22 October 2021 at 11:42:34 UTC, greenbyte wrote: Hi, all! I use the hunt-entity library to work with MySQL. I get the hunt.Exceptions.TimeoutException: "Timeout in 30 secs" when trying to connect. I configured MySQL and ran the code from the instructions

Re: tkd does not build anymore after 2.096

2021-10-13 Thread WebFreak001 via Digitalmars-d-learn
On Wednesday, 13 October 2021 at 02:03:30 UTC, rikki cattermole wrote: The repo itself hasn't been archived as of this writing. So a PR may succeed. But yeah the guy is gone by the looks. If he is willing this could be a possible candidate for moving it to dlang-community although it'll need

Re: Better debugging?

2021-10-04 Thread WebFreak001 via Digitalmars-d-learn
On Sunday, 3 October 2021 at 22:27:20 UTC, Tim wrote: On Sunday, 3 October 2021 at 22:26:15 UTC, Imperatorn wrote: On Sunday, 3 October 2021 at 22:21:45 UTC, Tim wrote: [...] You don't say which operating system you are using. I usually use Visual D which works great imo. If I use vscode I

Re: Using D "rocket" logo in outside presentation

2021-09-29 Thread WebFreak001 via Digitalmars-d-learn
On Wednesday, 29 September 2021 at 04:24:13 UTC, Chris Piker wrote: 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

Re: Piping from terminal into D program

2021-09-04 Thread WebFreak001 via Digitalmars-d-learn
On Saturday, 4 September 2021 at 15:41:51 UTC, eXodiquas wrote: Hello everyone, I created a small little D program that reads in a string from the command line and shuffles the letters of the nouns a bit around. This is pretty straight forward, but what I see now happening is a bit strange,

Re: scope(exit) with expected library

2021-08-25 Thread WebFreak001 via Digitalmars-d-learn
On Wednesday, 25 August 2021 at 15:30:57 UTC, Steven Schveighoffer wrote: [...] Another approach is to let the compiler deal with the error handling and not muddy your return type. Swift does something similar, where it rewrites the throw/catch into a standard return and doesn't do actual

Re: scope(exit) with expected library

2021-08-25 Thread WebFreak001 via Digitalmars-d-learn
On Wednesday, 25 August 2021 at 14:52:34 UTC, Steven Schveighoffer wrote: On 8/25/21 10:42 AM, Steven Schveighoffer wrote: I think it's possible to work with some mechanics that aren't necessarily desirable. Something like: One has to weigh how much this is preferred to actual exception

Re: scope(exit) with expected library

2021-08-25 Thread WebFreak001 via Digitalmars-d-learn
On Wednesday, 25 August 2021 at 14:42:07 UTC, Steven Schveighoffer wrote: On 8/25/21 10:22 AM, Paul Backus wrote: On Wednesday, 25 August 2021 at 14:04:54 UTC, WebFreak001 wrote: [...] Probably the only principled way to make this work would be to define some kind of "concept"/structural

Re: Emacs AutoComplete Tutorial Video for D Language

2021-08-25 Thread WebFreak001 via Digitalmars-d-learn
On Monday, 23 August 2021 at 17:59:44 UTC, Mahdi wrote: I made this video for people asking how to configure Dlang in Emacs environment:) : https://peertube.linuxrocks.online/w/62pWpmw2r4Se1XvmYiWm75 cool, I think you might wanna post this in General or Announce instead so more people see

Re: scope(exit) with expected library

2021-08-25 Thread WebFreak001 via Digitalmars-d-learn
On Wednesday, 25 August 2021 at 14:22:26 UTC, Paul Backus wrote: On Wednesday, 25 August 2021 at 14:04:54 UTC, WebFreak001 wrote: [...] Probably the only principled way to make this work would be to define some kind of "concept"/structural interface that's recognized by the compiler to mean

scope(exit) with expected library

2021-08-25 Thread WebFreak001 via Digitalmars-d-learn
Would it be possible to extend `scope(exit)` and `scope(success)` to trigger properly for functions returning `Expected!T` as defined in the [expectations](https://code.dlang.org/packages/expectations) and [expected](https://code.dlang.org/packages/expected) DUB libraries? For example is it

Re: Vibe.d error

2021-08-23 Thread WebFreak001 via Digitalmars-d-learn
On Friday, 20 August 2021 at 17:39:29 UTC, JG wrote: On Friday, 20 August 2021 at 10:50:12 UTC, WebFreak001 wrote: On Wednesday, 18 August 2021 at 19:51:00 UTC, JG wrote: [...] There might be incompatibilities with how openssl is used and the installed openssl version or config. If you

Re: Vibe.d error

2021-08-20 Thread WebFreak001 via Digitalmars-d-learn
On Wednesday, 18 August 2021 at 19:51:00 UTC, JG wrote: Hi, We are intermittently getting the following error: Accept TLS connection: server OpenSSL error at ../ssl/record/rec_layer_s3.c:1543: error:14094416:SSL routines:ssl3_read_bytes:sslv3 alert certificate unknown (SSL alert number 46)

Re: Registering-unregistering threads

2021-08-01 Thread WebFreak001 via Digitalmars-d-learn
On Friday, 30 July 2021 at 23:48:41 UTC, solidstate1991 wrote: I'm doing some audio-related work, and one thing I need is to unregister from (and maybe later temporarily re-register to) the GC, since it would cause some issues, and it would be nice if I still could use the GC during disk

Re: D compiler equivilent of "gcc -E" for debug/view template instantiation(generated) code?

2021-07-30 Thread WebFreak001 via Digitalmars-d-learn
On Friday, 30 July 2021 at 06:00:41 UTC, dangbinghoo wrote: hi, is there any D compiler option or other method to view the final template instantiation but not compiled (in asm or binary) code? if there's a way, it might be very usefull for newbies like me to learn and understand the the

Re: How to reset the website when the user leaves it, with vibe.d?

2021-06-29 Thread WebFreak001 via Digitalmars-d-learn
On Tuesday, 29 June 2021 at 16:25:09 UTC, vnr wrote: Hello  I have a bit of a problem that seems simple enough, but I can't find an answer to my questions. On my website, I have two textareas that the user can write on. When the user reloads the page or closes it and then reopens it, the

Re: How to reset the website when the user leaves it, with vibe.d?

2021-06-29 Thread WebFreak001 via Digitalmars-d-learn
On Tuesday, 29 June 2021 at 19:05:43 UTC, WebFreak001 wrote: [...] I should add that this is a convenience feature for users and you should avoid setting this unless it absolutely doesn't make sense that stuff is prefilled for the user. It's there to keep input in case you accidentally

Re: Vibe.d diet templates

2021-06-17 Thread WebFreak001 via Digitalmars-d-learn
On Thursday, 17 June 2021 at 16:26:57 UTC, JG wrote: [...] Thanks, this works. I would have thought this would be a common enough use case to have support in diet. Anyone else wanted this? Opened an issue here: https://github.com/rejectedsoftware/diet-ng/issues/91

Re: Vibe.d diet templates

2021-06-17 Thread WebFreak001 via Digitalmars-d-learn
On Thursday, 17 June 2021 at 08:23:54 UTC, JG wrote: Suppose I have an array of attributes and values v is there any way to apply these attributes to a tag? So that something like tag(#{v[0]0]}=#{v[0][1]},...}) becomes where v[0][0]="attribute0" and v[0][1]="value0"? I think there is

Re: Financial Library

2021-06-14 Thread WebFreak001 via Digitalmars-d-learn
On Sunday, 13 June 2021 at 12:46:29 UTC, Financial Wiz wrote: What are some of the best Financial Libraries for D? I would like to be able to aggregate as much accurate information as possible. Thanks. if you want a type-safe money handling type, try https://code.dlang.org/packages/money

Re: Schroedinger's Ranges

2021-06-03 Thread WebFreak001 via Digitalmars-d-learn
On Thursday, 3 June 2021 at 00:39:04 UTC, vacuum_tube wrote: I've been trying to make a struct for CSV parsing and manipulating. The code was as follows: ``` struct CSVData(bool HeaderFromFirstLine) { char[][] header = []; char[][][] rest = []; ``` [...] additionally to the

Re: serve-d and emacs

2021-04-26 Thread WebFreak001 via Digitalmars-d-learn
On Monday, 26 April 2021 at 18:45:08 UTC, Christian Köstlin wrote: Does anybody use serve-d with emacs (lsp-mode or eglot)? I would love to see the configuration! Kind regards, Christian if you configure it yourself, feel free to share the configuration and maybe PR it to serve-d repo.

Re: Is there a more elegant way to do this in D?

2021-04-08 Thread WebFreak001 via Digitalmars-d-learn
On Thursday, 8 April 2021 at 03:57:23 UTC, Brad wrote: I am trying to take an array and convert it to a string. I know that Split will let me easily go the other way. I searched for the converse of Split but have not been able to locate it. I can think of two brute force methods of doing

Re: Derived type

2021-04-01 Thread WebFreak001 via Digitalmars-d-learn
On Tuesday, 30 March 2021 at 19:02:09 UTC, novice2 wrote: [...] Strange syntax. Behavour exactly what i want, but this code not works for me :( enum Xobj : void*; Xobj var; //DMD Error: enum test7.Xobj forward reference of Xobj.init You can add a custom init value if you want to allow

Re: Derived type

2021-03-30 Thread WebFreak001 via Digitalmars-d-learn
On Tuesday, 30 March 2021 at 13:28:55 UTC, novice3 wrote: Hello. When i adapt C code, i see new type creation: typedef void* Xobj; Or code like this: struct _Xobj; typedef struct _Xobj *Xobj; I want create derived type in D, found std.typecons.Typedef template, and write: alias

Re: Issue with opening files on VSCode "D Language utility extension pack"

2020-11-16 Thread WebFreak001 via Digitalmars-d-learn
On Monday, 16 November 2020 at 01:38:10 UTC, data pulverizer wrote: Hi All, On VS Code "D Language utility extension pack", I notice that if I open a random D file, on the bottom left of the IDE, a message says "D: workspace/(0.0%): starting up...". It stays at 0.0% and doesn't go away and

Re: Efficient sort function allowing own test and swap function as parameter

2020-10-07 Thread WebFreak001 via Digitalmars-d-learn
On Tuesday, 6 October 2020 at 22:18:39 UTC, Alaindevos wrote: I have a large table consisting of two columns.One with words.Another with frequencies. I want to sort them efficiently according to the names or frequency. For this I need an efficient sort function where I can plugin my proper

Re: vibe.d / experience / feedback

2020-10-01 Thread WebFreak001 via Digitalmars-d-learn
On Thursday, 1 October 2020 at 08:24:42 UTC, ab wrote: On Thursday, 1 October 2020 at 06:32:23 UTC, Robert M. Münch wrote: 3. Vibe can't handle GET & POST on the same URL... we solved this one as well: fortunately (and: of course) vibe can handle this. what lead us to believe otherwise,

Re: Templates and unaryFun!

2020-09-24 Thread WebFreak001 via Digitalmars-d-learn
On Thursday, 24 September 2020 at 11:15:11 UTC, ddcovery wrote: [...] Example: I tried with a global function Dot!R dt(alias fun, T, R)(Dot!T t){ auto f = cast(R function(T)) unaryFun!fun; return t.dot!R(f); } [...] the problem is the template can't automatically determine the type "R".

Re: Good repos to learn D

2020-09-21 Thread WebFreak001 via Digitalmars-d-learn
On Saturday, 19 September 2020 at 08:26:36 UTC, Imperatorn wrote: What are some good examples of pretty large/medium size, good structured repos in D? I'm looking for examples to learn from Thanks! I would include vibe.d in there of course! https://github.com/vibe-d/vibe.d Some legacy

Re: vibe.d and video files?

2020-09-17 Thread WebFreak001 via Digitalmars-d-learn
On Thursday, 17 September 2020 at 18:29:12 UTC, bauss wrote: Does vibe.d not work properly with ex. mp4 files? I have a consistent issues that it will only play part of video files in the browser. As if it won't "stream" the rest of the video. Is that a problem with vibe.d or is it some

Re: vibe.d: How to get the conent of a file upload ?

2020-09-17 Thread WebFreak001 via Digitalmars-d-learn
On Thursday, 17 September 2020 at 16:00:33 UTC, wjoe wrote: I found this [1] but unfortunately the post this refers to is a dead link and the content, unfortunately, didn't tell me anything that I didn't already find in the docs. What I can get from the form is the form fields with content,

Re: Install multiple executables with DUB

2020-09-04 Thread WebFreak001 via Digitalmars-d-learn
On Thursday, 3 September 2020 at 08:22:25 UTC, glis-glis wrote: Hi, I have a few modules for parsing different file formats and a folder with d-scripts using these parsers to perform manipulations, extract information, ... Until now, I just added #!/usr/bin/env rdmd to the d-scripts and

Re: How to use libmir --> mir-algorithm, numir, mir-random?

2020-09-02 Thread WebFreak001 via Digitalmars-d-learn
On Wednesday, 2 September 2020 at 07:01:48 UTC, Shaleen Chhabra wrote: Hi, The libmir libraries can be found here: https://github.com/libmir I wish to use mir-algorithm and numir so that i can directly use .npy format from python and perform the required analysis. I checked out latest

Re: Tuple poilerplate code

2020-09-01 Thread WebFreak001 via Digitalmars-d-learn
On Tuesday, 1 September 2020 at 02:08:54 UTC, JG wrote: [...] Here is some fun with operator overloading and pointers, but I don't really like it because it seems unsafe: import std; auto _(T...)(return ref T refs) @safe { static struct Assigner(Ptrs...) { @disable this(this);

Re: DMD: how to restore old unittest+main

2020-08-13 Thread WebFreak001 via Digitalmars-d-learn
On Thursday, 13 August 2020 at 07:52:07 UTC, novice3 wrote: Hello. I don't use dub. I use Windows and *.d file association to compile small apps by dmd with "-i -unittest -g" switches. Now i update dmd, and found, that apps compiled with "-unittest" not runs main(). How i can restore old

Re: vibe.d and my first web service

2020-08-13 Thread WebFreak001 via Digitalmars-d-learn
On Wednesday, 12 August 2020 at 21:11:54 UTC, Daniel Kozak wrote: [...] Unfortunately, I think vibe-d is dead. With every release it is worse than before and it seems there is almost no activity. So D really need new champion here maybe hunt will be next champion. Can you give an example

Re: Files and UTF

2020-08-06 Thread WebFreak001 via Digitalmars-d-learn
On Thursday, 6 August 2020 at 07:19:37 UTC, WebFreak001 wrote: [...] In line 11 in my example code this makes a better, safer if than `if (s.length)`: if (s.length && s[$ - 1] == '\n') s = s[0 .. $ - 1]; Note that I only need to do this because of the readln API, it would be much safer and

Re: Files and UTF

2020-08-06 Thread WebFreak001 via Digitalmars-d-learn
On Wednesday, 5 August 2020 at 17:39:36 UTC, Mike Surette wrote: In my efforts to learn D I am writing some code to read files in different UTF encodings with the aim of having them end up as UTF-8 internally. As a start I have the following code: import std.stdio; import std.file; void

Re: Strong typing and physical units

2020-07-28 Thread WebFreak001 via Digitalmars-d-learn
On Tuesday, 28 July 2020 at 04:40:33 UTC, Cecil Ward wrote: I found an earlier post somewhere about work someone has done on physical units such as kg, volts and so forth. It would be very good to catch bugs such as volts_t v = input_current; [...] This is easily done and uses enums:

Re: How DerelictCL works

2020-07-22 Thread WebFreak001 via Digitalmars-d-learn
On Tuesday, 21 July 2020 at 12:00:03 UTC, bioinfornatics wrote: Dear, I would like to use OpenCL in D. Thus I try to use DerelictCL. But I fail to use it I encounter this error message: -- /opt/jonathan/jonathan-dlang_ldc2092/root/usr/include/d/derelict/opencl/constants.di(835):

Re: Alternative to std.range.choose

2020-07-22 Thread WebFreak001 via Digitalmars-d-learn
On Wednesday, 22 July 2020 at 04:33:20 UTC, James Gray wrote: Is there a better way to achieve behaviour similar to rangeFuncIf below? f gives a contrived example of when one might want this. g is how one might try and achieve the same with std.range.choose. import std.stdio; import std.range

Re: D Wiki: run.dlang.io integration?

2020-07-16 Thread WebFreak001 via Digitalmars-d-learn
On Thursday, 16 July 2020 at 13:54:56 UTC, aberba wrote: On Thursday, 16 July 2020 at 13:41:31 UTC, aberba wrote: On Thursday, 16 July 2020 at 09:47:02 UTC, WebFreak001 wrote: [...] Since its based on WikiMedia, searched an came up with this [1] to embed in iframe 1.

Re: Using_string_mixins_for_logging error

2020-07-16 Thread WebFreak001 via Digitalmars-d-learn
On Wednesday, 15 July 2020 at 07:36:49 UTC, Vitalii wrote: Many thanks! I have now deprecated the old wiki page and linked to a new one with more examples: https://wiki.dlang.org/Logging_mechanisms

D Wiki: run.dlang.io integration?

2020-07-16 Thread WebFreak001 via Digitalmars-d-learn
Is there a way to integrate some kind of "run this source code" button into the D wiki using run.dlang.io? If there isn't, it would be nice to add this kind of thing as plugin with the possibility of also including the editor so you never need to leave the wiki. (like on the D Tour)

Re: Error: `std.uni.isUpper` conflicts with `std.ascii.isUpper`

2020-07-15 Thread WebFreak001 via Digitalmars-d-learn
On Wednesday, 15 July 2020 at 11:25:34 UTC, aberba wrote: On Wednesday, 15 July 2020 at 07:01:34 UTC, WebFreak001 wrote: On Tuesday, 14 July 2020 at 20:37:53 UTC, Marcone wrote: [...] Additionally to the other answers telling you how to fix it, it's important to know why it happens in the

Re: Using_string_mixins_for_logging error

2020-07-15 Thread WebFreak001 via Digitalmars-d-learn
On Wednesday, 15 July 2020 at 07:07:55 UTC, Vitalii wrote: Hello everyone! I try to compile this recipe with dmd (2.089.0), ldc2 (1.18.0): https://wiki.dlang.org/Using_string_mixins_for_logging but get the same error: mixin_log.d(64): Error: basic type expected, not __FUNCTION__

Re: Error: `std.uni.isUpper` conflicts with `std.ascii.isUpper`

2020-07-15 Thread WebFreak001 via Digitalmars-d-learn
On Tuesday, 14 July 2020 at 20:37:53 UTC, Marcone wrote: import std: isUpper, writeln; void main(){ writeln(isUpper('A')); } Why I get this error? How can I use isUpper()? Additionally to the other answers telling you how to fix it, it's important to know why it happens in the first

Re: Choosing a non-default linker for dmd (via dub)

2020-07-13 Thread WebFreak001 via Digitalmars-d-learn
On Sunday, 12 July 2020 at 16:36:09 UTC, Per Nordlöw wrote: The line dflags "-linker=gold" platform="linux-ldc" # use GNU gold linker in dub.sdl enables me to change linker for LDC. Is it possible to choose a specific linker for DMD aswell in a similar way? I only find the flag `-L` that

opOpAssign of AA: defined behavior?

2020-06-23 Thread WebFreak001 via Digitalmars-d-learn
I have the following code: double[string] foo; foo["a"] += 1; how is the opOpAssign on the AA defined? Is it defined to set the value to the value to the right of the opOpAssign if it isn't set for primitives or does it add the given value onto T.init? Doing foo["b"]++; gives

Re: How debugg unittest with visual code + code-d

2020-06-06 Thread WebFreak001 via Digitalmars-d-learn
On Saturday, 6 June 2020 at 08:06:02 UTC, Luis wrote: On Friday, 5 June 2020 at 18:13:52 UTC, WebFreak001 wrote: [...] It isn't working correctly on my case : I get this error : Performing "unittest" build using dmd for x86_64. ddiv ~sparseSet: building configuration "unittest"...

Re: How debugg unittest with visual code + code-d

2020-06-05 Thread WebFreak001 via Digitalmars-d-learn
On Friday, 5 June 2020 at 17:03:40 UTC, Luis wrote: So I actually managed to "debug" my unittests but It requires that I run previsuly "dub test" on console, so the executable is update. As I understand, I need to setup a task to be prelaunched by debug to generate the unittest executable, but

Re: [Windows]Need an example: How to read and list names of USB devices via Windows API without using Utilities

2020-05-29 Thread WebFreak001 via Digitalmars-d-learn
On Friday, 29 May 2020 at 09:04:30 UTC, WebFreak001 wrote: [...] I realized it may be useful to have a much more complete example, so replace the while (true) loop in my first code with this to get much more information dumped: while (true) {

Re: [Windows]Need an example: How to read and list names of USB devices via Windows API without using Utilities

2020-05-29 Thread WebFreak001 via Digitalmars-d-learn
On Wednesday, 27 May 2020 at 14:16:56 UTC, BoQsc wrote: I always wanted to know if there is any proven example on how to interface with USB devices by using Windows operating system. Any explanations, snippets in relation to topic would help. What I expect: Being able to detect if a new USB

Re: How to parse enum from a string ?

2020-05-27 Thread WebFreak001 via Digitalmars-d-learn
On Wednesday, 27 May 2020 at 17:33:33 UTC, Vinod K Chandran wrote: Hi all, Assume that i have an enum like this. enum TestEnum { Received = 1, Started , Finished , Sent } I am saving this enum values as string in database. So, when i retrieve them from the database, how can i

Re: Assign Range: layout = X, AlignRight;

2020-05-26 Thread WebFreak001 via Digitalmars-d-learn
On Tuesday, 26 May 2020 at 13:36:34 UTC, Виталий Фадеев wrote: [...] I want this feature in D! I think you are rather looking for tuples: void opAssign(Args...)(Tuple!Args args) { foreach( a; args ) { _layouts ~= a; }

Re: Distinguish between a null array and an empty array

2020-05-26 Thread WebFreak001 via Digitalmars-d-learn
On Sunday, 24 May 2020 at 12:37:20 UTC, ag0aep6g wrote: On 24.05.20 14:29, bauss wrote: Dang, that sucks there is no proper way and I would say that's a big flaw of D. Because what I need it for is for some data serialization but if the value is an empty array then it should be present and

Re: Compare string with German umlauts

2020-05-18 Thread WebFreak001 via Digitalmars-d-learn
On Monday, 18 May 2020 at 13:44:15 UTC, Martin Tschierschke wrote: Hi, I have to find a certain line in a file, with a text containing umlauts. How do you do this? The following was not working: foreach(i,line; file){ if(line=="My text with ö oe, ä ae or ü"){ writeln("found it at

Re: Easy way to format int in pragma msg ?

2020-05-14 Thread WebFreak001 via Digitalmars-d-learn
On Thursday, 14 May 2020 at 09:49:15 UTC, wjoe wrote: Is there an easy way to print an int in hexadecimal, octal or binary representation ? The documentation on pragma(msg, ...) and a quick web search didn't provide an answer. for simple hex/binary/etc printing use import std.conv;

Re: Get months / years between two dates.

2020-05-07 Thread WebFreak001 via Digitalmars-d-learn
On Wednesday, 6 May 2020 at 19:51:01 UTC, bauss wrote: How do you exactly do that? Like if I have two dates as std.datetime.DateTime How will I get the months or years between the two dates? I was surprised to learn that Duration does not support them and only has weeks, days etc. but not

Re: std.uni, std.ascii, std.encoding, std.utf ugh!

2020-05-06 Thread WebFreak001 via Digitalmars-d-learn
On Wednesday, 6 May 2020 at 10:57:59 UTC, learner wrote: On Tuesday, 5 May 2020 at 19:24:41 UTC, WebFreak001 wrote: On Tuesday, 5 May 2020 at 18:41:50 UTC, learner wrote: Good morning, Trying to do this: ``` bool foo(string s) nothrow { return s.all!isDigit; } ``` I realised that the

Re: Error running concurrent process and storing results in array

2020-05-06 Thread WebFreak001 via Digitalmars-d-learn
On Wednesday, 6 May 2020 at 07:42:44 UTC, data pulverizer wrote: On Wednesday, 6 May 2020 at 07:27:19 UTC, data pulverizer wrote: On Wednesday, 6 May 2020 at 06:54:07 UTC, drug wrote: Thing are really interesting. So there is a space to improve performance in 2.5 times :-) Yes, `array` is

Re: std.uni, std.ascii, std.encoding, std.utf ugh!

2020-05-05 Thread WebFreak001 via Digitalmars-d-learn
On Tuesday, 5 May 2020 at 18:41:50 UTC, learner wrote: Good morning, Trying to do this: ``` bool foo(string s) nothrow { return s.all!isDigit; } ``` I realised that the conversion from char to dchar could throw. I need to validate and operate over ascii strings and utf8 strings, possibly in

Re: real operations imprecise?

2020-05-05 Thread WebFreak001 via Digitalmars-d-learn
On Tuesday, 5 May 2020 at 14:15:03 UTC, H. S. Teoh wrote: On Tue, May 05, 2020 at 01:44:18PM +, WebFreak001 via Digitalmars-d-learn wrote: [...] Whoa, hold your horses right there! What does `pragma(msg, real.dig);` output on your machine? [...] You are right, probably should have

real operations imprecise?

2020-05-05 Thread WebFreak001 via Digitalmars-d-learn
I was dumping the full PI value on my machine with the highest precision it could get and got: $ rdmd --eval='printf("%.70llf\n", PI)' 3.14159265358979323851280895940618620443274267017841339111328125 now this all looks good, but when I tried to print PI_2 I got $ rdmd

Re: Dub failing with message about DFLAGS

2020-04-28 Thread WebFreak001 via Digitalmars-d-learn
On Tuesday, 28 April 2020 at 14:26:11 UTC, Russel Winder wrote: On Tue, 2020-04-28 at 14:03 +, WebFreak001 via Digitalmars-d-learn wrote: […] in this case, try dub upgrade --vverbose and the full exception message should hopefully show I have no idea what has changed, but things are now

Re: Dub failing with message about DFLAGS

2020-04-28 Thread WebFreak001 via Digitalmars-d-learn
On Tuesday, 28 April 2020 at 13:44:14 UTC, Russel Winder wrote: On Tue, 2020-04-28 at 12:04 +, WebFreak001 via Digitalmars-d-learn wrote: [...] I am not sure this gives any further information. :-( [...] in this case, try dub upgrade --vverbose and the full exception message should

Re: Dub failing with message about DFLAGS

2020-04-28 Thread WebFreak001 via Digitalmars-d-learn
On Tuesday, 28 April 2020 at 11:56:26 UTC, Russel Winder wrote: Hi, Has anyone seen this before, it has just started happening to me and is stopping me doing any work on this D project. |> dub build Invalid variable: DFLAGS try running with `dub build -v`

Re: mir: How to change iterator?

2020-04-17 Thread WebFreak001 via Digitalmars-d-learn
On Friday, 17 April 2020 at 08:40:36 UTC, WebFreak001 wrote: On Tuesday, 14 April 2020 at 20:24:05 UTC, jmh530 wrote: [...] Use std.algorithm:equal for range compare with approxEqual for your comparator: assert(equal!approxEqual(y, [2.5, 2.5].sliced(2))); simplified:

Re: mir: How to change iterator?

2020-04-17 Thread WebFreak001 via Digitalmars-d-learn
On Tuesday, 14 April 2020 at 20:24:05 UTC, jmh530 wrote: In the code below, I multiply some slice by 5 and then check whether it equals another slice. This fails for mir's approxEqual because the two are not the same types (yes, I know that isClose in std.math works). I was trying to convert

Re: make dub use my version of dmd

2020-04-17 Thread WebFreak001 via Digitalmars-d-learn
On Thursday, 16 April 2020 at 19:56:44 UTC, Adam D. Ruppe wrote: For future reference, newer dubs (v 1.17 + i think) allow --compiler=dmd-version for example. You need to put the exe in your PATH and rename it yourself, but it recognizes *dmd-* (or *ldc2-* or *gdc-*) all the same so you can

interop with c++ coroutines

2020-04-14 Thread WebFreak001 via Digitalmars-d-learn
To my understanding the C++20 coroutines are very similar to what we have in D using Fibers. How could I interop with a library exposing this kind of functionality in D? I haven't really used C++ coroutines but I would like to have some sort of compatibility with the standard C++ types for

switch case range inclusive or exclusive?

2020-04-06 Thread WebFreak001 via Digitalmars-d-learn
In the D spec it says for CaseRangeStatement: https://dlang.org/spec/statement.html#CaseRangeStatement A CaseRangeStatement is a shorthand for listing a series of case statements from FirstExp to LastExp. does this mean LastExp is inclusive or exclusive part of the range? I think the spec

Re: How user dub packages in dmd without dub.exe ?

2020-04-05 Thread WebFreak001 via Digitalmars-d-learn
On Sunday, 5 April 2020 at 14:02:19 UTC, Baby Beaker wrote: On Saturday, 4 April 2020 at 21:54:34 UTC, Andre Pany wrote: On Saturday, 4 April 2020 at 20:21:03 UTC, Marcone wrote: [...] [...] If you can copy the D packages from the Dub packages into your main source folder, the command

Re: Vibe-d Error Message and failed with exit code 1

2020-04-05 Thread WebFreak001 via Digitalmars-d-learn
On Saturday, 4 April 2020 at 14:40:16 UTC, Baby Beaker wrote: Program.d #!/usr/bin/env dub /+ dub.sdl: name "hello_vibed" dependency "vibe-d" version="~>0.8.0" +/ import vibe.vibe; import std; [...] First of all try using the latest vibe.d release instead: /+ dub.sdl: name

Re: Static if a Function Exists

2020-04-03 Thread WebFreak001 via Digitalmars-d-learn
On Friday, 3 April 2020 at 01:03:01 UTC, Jonathan Levi wrote: I am trying to make a templated function for any arguments which will work for another. Like this: ``` class Cls { auto opBinary(string op, T)(T b) if (__traits(compiles, opBinaryImpl!op(this, b))) { return

Re: Whats wrong with binery heap or i am not understand something?

2020-04-02 Thread WebFreak001 via Digitalmars-d-learn
On Thursday, 2 April 2020 at 12:59:06 UTC, AlexM wrote: Please explain me whats wrong with binery heap?!!! Simple example: import std.container.binaryheap; import std.stdio; void main() { int[] a = [ 4, 1, 3, 2, 16, 9, 10, 14, 8, 7 ]; int[] b = new int[a.length]; auto h =

Re: What does the [] operator do here?

2020-04-02 Thread WebFreak001 via Digitalmars-d-learn
On Wednesday, 1 April 2020 at 19:35:30 UTC, Net wrote: from the below code, the expression "case [c]": void main() { import std.stdio, std.string, std.algorithm, std.conv; // Reduce the RPN expression using a stack readln.split.fold!((stack, op) { switch (op) {

Re: How add all folders of a diretory using -J ?

2020-04-02 Thread WebFreak001 via Digitalmars-d-learn
On Wednesday, 1 April 2020 at 23:19:39 UTC, Baby Beaker wrote: Exemple: Inside folder Project I have ten folders. How can I add this ten folders using dmd and -J command? I don't want add one by one. you could use `-J .` (-J projectFolder) so in your imports you can use

Re: dub sourceFiles

2020-04-01 Thread WebFreak001 via Digitalmars-d-learn
On Tuesday, 31 March 2020 at 15:23:48 UTC, Anonymouse wrote: I have a library package that I split up into subpackages, but I'm having to do mental gymnastics to make it only compile the files I want. [...] how about targetType "none" if you don't have any source in the main package but

Re: How to deploy on GitHub pages

2020-04-01 Thread WebFreak001 via Digitalmars-d-learn
On Tuesday, 31 March 2020 at 12:52:09 UTC, Ahmat wrote: Hi all, I want to use vibe.d for my personal website hosted on Github pages. I am not familiar with vibe.d and I am confused about how to approach this. Any suggestions, ideas ? I will appreciate your help. as Mathias said, GitHub

Re: Allocating an empty non null associative arary

2020-03-31 Thread WebFreak001 via Digitalmars-d-learn
On Tuesday, 31 March 2020 at 02:51:11 UTC, Superstar64 wrote: I want to be modify an associative array by reference from another function. However null associative arrays are pass by value. How do I generically create an empty associative array? --- import std.stdio; void addElement(int[int]

Re: Find the heir.

2020-03-30 Thread WebFreak001 via Digitalmars-d-learn
On Sunday, 29 March 2020 at 15:07:37 UTC, Simen Kjærås wrote: On Sunday, 29 March 2020 at 14:04:53 UTC, TodNaz wrote: Hello! class A { ... } class B : A { ... } class C : A { ... } A example1; B example2 = new B(...); A = example2; auto heir = A.whoheir(); /// The question in

Re: Blog post about multidimensional arrays in D

2020-03-27 Thread WebFreak001 via Digitalmars-d-learn
On Friday, 27 March 2020 at 10:57:10 UTC, p.shkadzko wrote: I decided to write a small blog post about multidimensional arrays in D on what I learnt so far. It should serve as a brief introduction to Mir slices and how to do basic manipulations with them. It started with a small file with

Re: How package Dlang in a standalone portable executable?

2020-03-27 Thread WebFreak001 via Digitalmars-d-learn
On Thursday, 26 March 2020 at 23:19:20 UTC, Marcone wrote: I need package Dlang in a standalone portable executable. I need packcages all dependencies, dlls, files, etc in one executable file. by default if you use dub it will statically link phobos and druntime into the executable, so you

Re: How to code Z-Function of string?

2020-03-27 Thread WebFreak001 via Digitalmars-d-learn
On Thursday, 26 March 2020 at 20:08:39 UTC, Dennis wrote: On Thursday, 26 March 2020 at 19:34:08 UTC, Quantium wrote: 1. How can I make string ONLY char[] (Not immutable) You can use .dup to make a mutable copy of an array. ``` char[] a = "abc".dup; ``` extending on this: if you want to

Re: Swedish letters fuck up parsing into SQL querry

2020-03-24 Thread WebFreak001 via Digitalmars-d-learn
On Tuesday, 24 March 2020 at 11:15:24 UTC, matheus wrote: On Monday, 23 March 2020 at 15:41:50 UTC, Adam D. Ruppe wrote: On Monday, 23 March 2020 at 15:15:12 UTC, Anders S wrote: I'm creating a connection to the db and conn.exec(sql) It depends on the library but it is almost always easier

Re: Swedish letters fuck up parsing into SQL querry

2020-03-24 Thread WebFreak001 via Digitalmars-d-learn
On Monday, 23 March 2020 at 15:15:12 UTC, Anders S wrote: On Monday, 23 March 2020 at 15:07:31 UTC, Adam D. Ruppe wrote: On Monday, 23 March 2020 at 14:26:46 UTC, Anders S wrote: do you mean I should loop through each pos till strlen(cellTab[CellIndex].name) to find "\0"? strlen is ok, that

@future attribute / @future keyword?

2020-03-18 Thread WebFreak001 via Digitalmars-d-learn
I have read about @future before being some kind of opposite of deprecated. However when trying to search about it now again I can't find any mentions of it anywhere except on https://dlang.org/spec/traits.html#isFuture It's difficult enough to search for "future" but even if limiting it to

@safe std.file.read

2020-01-06 Thread WebFreak001 via Digitalmars-d-learn
I was wondering, how are you supposed to use std.file : read in @safe code when it returns a void[] but you want to get all bytes in the file? Is void[] really the correct type it should be returning instead of ubyte[] when it just reads a (binary) file to memory? Or should void[] actually

Re: How to debug in vscode Windows?

2020-01-01 Thread WebFreak001 via Digitalmars-d-learn
On Friday, 27 December 2019 at 18:48:50 UTC, cfcd14f496326e429ce03c48650b7966 wrote: Hello. I spent many time to searching for find a solutions. Many posts not clearly or tell like brief. :( I tried "Microsoft C/C++(ms-vscode.cpptools)" and "Native Debug (webfreak.debug )" plugin. And I

Re: Blog Post #79: Notebook, Part III - Customized Tabs, Part I

2019-10-15 Thread WebFreak001 via Digitalmars-d-learn
On Tuesday, 15 October 2019 at 20:03:00 UTC, Ron Tarrant wrote: On Tuesday, 15 October 2019 at 14:00:32 UTC, WebFreak001 wrote: thank you so much for these tutorials! I love how they are progressing. Thanks, WebFreak001. Small, simple and concise topics with good images, nice drawings, and

Re: Blog Post #79: Notebook, Part III - Customized Tabs, Part I

2019-10-15 Thread WebFreak001 via Digitalmars-d-learn
On Tuesday, 15 October 2019 at 12:07:22 UTC, Ron Tarrant wrote: Well, if that title isn't confusing, I'm not doing my job right. Today's post starts a three-part mini-series within the Notebook series on building customized tabs in a DrawingArea. There's a ton of stuff to go over; that's why

Re: Blog Post #0039 - File Dialog V - Adding SaveAs and Titlebar Filename Reflection

2019-05-28 Thread WebFreak001 via Digitalmars-d-learn
On Tuesday, 28 May 2019 at 09:47:23 UTC, Ron Tarrant wrote: Good day to you all. 'Tis another Tuesday and time for a new blog post. This is a continuation of the series on Dialogs and further, a continuation of the mini-series-within-a-series on file Dialogs. The subject is in the title as

Bug with profiling GC with multiple threads/fibers

2019-04-21 Thread WebFreak001 via Digitalmars-d-learn
I'm trying to GC profile serve-d which uses a lot of fibers potentially also across some threads and some threads doing some dedicated work, however -profile=gc doesn't seem to work properly. It logs `shared static this` calls and some methods, however none of the actual stuff is in there (and

Re: Linux & DMD & GtkD

2019-02-16 Thread WebFreak001 via Digitalmars-d-learn
On Saturday, 16 February 2019 at 13:35:57 UTC, Ron Tarrant wrote: Hi guys, I finally got a Linux Mint installation happening (very impressed, BTW) and did the usual HelloWorld.d compile with dmd, but I'm having trouble working out how to link to GtkD. dmd -de -w -m64 -L+gtkd

Re: Submenu Not Responding Until Second Click

2019-02-05 Thread WebFreak001 via Digitalmars-d-learn
On Monday, 4 February 2019 at 18:34:55 UTC, Ron Tarrant wrote: I posted about this over on the GtkD site, but I suspect no one's home until later in the day. [...] works fine here, can't reproduce with your example code. Maybe some GTK configuration of your system?

  1   2   >