Re: Automatic update system

2020-11-26 Thread Dukc via Digitalmars-d-learn
On Thursday, 26 November 2020 at 12:13:59 UTC, vnr wrote: Hello, I have a program written in D which is open-source on GitHub. I would appreciate it if, when I release a new version, users would be notified by the program and that it offers an automatic update, i.e. the user doesn't have to

Re: Simulating computed goto

2020-11-26 Thread Dukc via Digitalmars-d-learn
On Wednesday, 25 November 2020 at 20:05:28 UTC, NonNull wrote: So to simulate computed goto have to 1. wrap switch(x) in a loop [ while(0) ] 2. inside each case recompute x (instead of jump to computed y) 3. jump back to execute switch again [ continue ] It does look as if a nested switch can

Re: Simulating computed goto

2020-11-25 Thread Dukc via Digitalmars-d-learn
On Wednesday, 25 November 2020 at 18:44:52 UTC, NonNull wrote: Is there a good way to simulate computed goto in D? I haven't used assembly myself, but it's possible that you can define a mixin that does this, using inline assembly.

Re: Vibe.D TLS problem

2020-11-05 Thread Dukc via Digitalmars-d-learn
On Tuesday, 27 October 2020 at 17:36:53 UTC, Dukc wrote: ``` HTTP connection handler has thrown: Accepting SSL tunnel: error:1408F09C:SSL routines:ssl3_get_record:http request (336130204) ``` I figured out from the Vibe.D source code that if I enable the debug level of the console logger,

Re: How kill executables started with spawnShell or executeShell when program finish?

2020-10-27 Thread Dukc via Digitalmars-d-learn
On Tuesday, 27 October 2020 at 15:16:33 UTC, Marcone wrote: Becouse my program use plink.exe running with spawnShell or executeShell. But when my program finish with some crash, or killed with windows task manager by user, Plink still running. How can I stop all process initialized with

Vibe.D TLS problem

2020-10-27 Thread Dukc via Digitalmars-d-learn
I have a Vibe.D server binary that, locally at least, works. But only without TLS. I want to add TLS to it and test it locally with a self-signed certificate. I made one with LibreSSL, stored in `cert.crt` and `key.key`. The application main function: ``` shared static this() { import

Re: Memory management

2020-10-02 Thread Dukc via Digitalmars-d-learn
On Tuesday, 29 September 2020 at 10:57:07 UTC, novice3 wrote: Naive newbie question: Can we have (in theory) in D lang memory management like V lang? I don't know V so can't be sure, but doing it the same way as in the examples sounds possible. The first two calls are easy. D string

Re: Accessing non-binary Unicode properties with std.uni

2020-09-29 Thread Dukc via Digitalmars-d-learn
On Monday, 28 September 2020 at 18:23:43 UTC, Chloé Kekoa wrote: The documentation of std.uni [1] says that the unicode struct provides sets for several binary properties. I am looking for a way to query non-binary properties of a character. Is that possible with std.uni or do I need to use a

Re: Good way to send/receive UDP packets?

2020-07-22 Thread Dukc via Digitalmars-d-learn
On Wednesday, 22 July 2020 at 13:17:11 UTC, wjoe wrote: - Choosing a port which isn't in use right now isn't good enough because a few minutes later there may be another program using it, too, and for the same reason. But doesn't the UDP header include the sender IP address? So together with

Re: Good way to send/receive UDP packets?

2020-07-19 Thread Dukc via Digitalmars-d-learn
Thank you everybody - Especially for the links to the blogs. This is just the kind of stuff I seek (didn't give a close look yet, though). I think I'm going to try std.socket first, since it's in the standard library. If it feels like it could be easier, I'll consider Libasync.

Re: My RPN calculator code review?

2020-07-18 Thread Dukc via Digitalmars-d-learn
On Friday, 17 July 2020 at 21:37:46 UTC, AB wrote: I'd appreciate your opinions regarding style, mistakes/code smell/bad practice. Thank you. In a project this small, implementability (meaning, ease of writing) is really the main guideline, readability is a non-issue. When your codebase hits

Good way to send/receive UDP packets?

2020-07-18 Thread Dukc via Digitalmars-d-learn
I have a project where I need to take and send UDP packets over the Internet. Only raw UDP - my application uses packets directly, with their starting `[0x5a, packet.length.to!ubyte]` included. And only communication with a single address, no need to communicate with multiple clients

Re: Arduino and MCU Support

2020-06-26 Thread Dukc via Digitalmars-d-learn
On Thursday, 25 June 2020 at 03:00:04 UTC, Dylan Graham wrote: I'm currently making an automatic transmission controller with Arduino. C++ just has too many traps that I keep falling into. Since stability is critical (if the code screws up at 100km/h I'm dead), I'd rather use a sane language

Re: "if not" condition check (for data validation)

2020-06-18 Thread Dukc via Digitalmars-d-learn
On Thursday, 18 June 2020 at 12:50:35 UTC, Stanislav Blinov wrote: auto not(alias cond)() { return !cond(); } if (not!(() => abra && cadabra)) ... but that is indeed even less readable. No reason to use templates here ``` pragma(inline, true) auto not(bool cond) { return !cond(); } if

Re: "if not" condition check (for data validation)

2020-06-18 Thread Dukc via Digitalmars-d-learn
On Thursday, 18 June 2020 at 13:57:39 UTC, Dukc wrote: if (not!(abra && cadabra)) ... if (not(abra && cadabra)) ...

Re: unit test that show more than one failure

2020-06-16 Thread Dukc via Digitalmars-d-learn
On Tuesday, 16 June 2020 at 06:19:51 UTC, Joel wrote: I've tired different unit test libraries, but they jump out on errors instead of just adding to failed numbers. I'm thinking like this: ``` @("dummy"); unittset { 0.shouldEqual(0); 1.shouldEqual(2); 2.shouldEqual(3); } ``` Test:

Re: Windows + LDC/DMD installation nightmare when changing VS versions

2020-06-12 Thread Dukc via Digitalmars-d-learn
On Friday, 12 June 2020 at 15:21:12 UTC, Guillaume Piolat wrote: Any idea what could be causing this? Please help. This was a living nightmare. I just want a working setup... I don't know if this is any help, as I don't use Visual Studio myself, but: You're trying to build for a 32-bit

Re: Why is there no range iteration with index by the language?

2020-06-10 Thread Dukc via Digitalmars-d-learn
On Wednesday, 10 June 2020 at 15:34:57 UTC, Steven Schveighoffer wrote: My biggest problem with enumerate is that you can't bind the tuple to parameters for something like map: arr.enumerate.map!((idx, val) => ...) doesn't work. Instead you have to do: arr.enumerate.map!((tup) => ...) And

Re: how to append (ref) int[] to int[][]?

2020-06-08 Thread Dukc via Digitalmars-d-learn
On Monday, 8 June 2020 at 06:13:36 UTC, mw wrote: what I really want in (a) is append `ref arr` and output [[3], [3], [3]], i.e. the real `arr` be appended instead of its copy. I tried to change arrs' decl to: (ref (int[]))[] arrs; // the intended semantics I want 1) I'm wondering how

Re: Distinguish between a null array and an empty array

2020-05-26 Thread Dukc via Digitalmars-d-learn
On Sunday, 24 May 2020 at 12:29:23 UTC, 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 if it's null then it should not be

Re: redirect std out to a string?

2020-05-21 Thread Dukc via Digitalmars-d-learn
On Thursday, 21 May 2020 at 04:29:30 UTC, Kaitlyn Emmons wrote: is there a way to redirect std out to a string or a buffer without using a temp file? If you want to do the redirection at startup, it's possible. Have an another program to start your program by std.process functions and

Re: How to use this forum ?

2020-05-20 Thread Dukc via Digitalmars-d-learn
On Wednesday, 20 May 2020 at 20:49:52 UTC, Vinod K Chandran wrote: Hi all, I have some questions about this forum. 1. How to edit a post ? No can do :(. Well, moderators can delete posts so you could try to ask them nicely in some cases but the primary way tends to be the same as with email:

Re: Why emsi containers have @disabled this(this) ?

2020-05-20 Thread Dukc via Digitalmars-d-learn
On Tuesday, 19 May 2020 at 20:51:01 UTC, Luis wrote: I saw that they have postblit operator... But i don't understand exactly why. In special, when they implement InputRange over the containers, but having disabled postblit, make nearly useless (at least as I see on this old post

Re: variant visit not pure?

2020-05-08 Thread Dukc via Digitalmars-d-learn
On Thursday, 7 May 2020 at 20:12:03 UTC, learner wrote: Modules of D standard library aren't in a good shape, if everyone suggests alternatives for a basic building block as variant. I don't think Variant as a whole is the problem, when one uses it as the infinite variant it does fairly

Re: variant visit not pure?

2020-05-08 Thread Dukc via Digitalmars-d-learn
On Thursday, 7 May 2020 at 15:36:36 UTC, Ben Jones wrote: I've been using SumType... What are the main differences between it and TaggedAlgebraic? I have not used the the algebraic type of Taggedalgebraic tbh, but it also has a tagged union type that I have good experiences with. Unlike

Re: variant visit not pure?

2020-05-08 Thread Dukc via Digitalmars-d-learn
On Thursday, 7 May 2020 at 10:21:26 UTC, Dukc wrote: that's the reason why `std.range.enumerate` does not infer attributes for example This was wrong. `enumerate` can infer. It's `lockstep` that cannot.

Re: variant visit not pure?

2020-05-07 Thread Dukc via Digitalmars-d-learn
On Thursday, 7 May 2020 at 13:17:21 UTC, learner wrote: I've find this: https://issues.dlang.org/show_bug.cgi?id=16662 Hmm, that explains why it can't infer attributes. An unlimited variant could contain an object, and using it might or might not be . Of course, it could still infer the

Re: Is there a way to benchmark/profile portably?

2020-05-07 Thread Dukc via Digitalmars-d-learn
On Thursday, 7 May 2020 at 10:51:27 UTC, Simen Kjærås wrote: If I understand correctly, you want to measure how many cycles pass, rather than clock time? Something like that. Well, I would also like to eliminate differences based on different memory caches between machines. In addition,

Re: Is there a way to benchmark/profile portably?

2020-05-07 Thread Dukc via Digitalmars-d-learn
On Thursday, 7 May 2020 at 11:06:17 UTC, Dennis wrote: You can make a reference program that you use to get a measure for how fast the computer is that you run the benchmark on. Then you can use that to scale your actual benchmark results. When testing regressions there's a fairly obvious

Re: variant visit not pure?

2020-05-07 Thread Dukc via Digitalmars-d-learn
On Thursday, 7 May 2020 at 09:22:28 UTC, learner wrote: Good morning, Is there a reason why std.variant.visit is not inferring pure? I think `variant` will not infer any trributes. I'm not sure why. It could be some language limitation (that's the reason why `std.range.enumerate` does not

Is there a way to benchmark/profile portably?

2020-05-07 Thread Dukc via Digitalmars-d-learn
Is there some way to measure the performance of a function so that the results will be same in different computers (all x86, but otherwise different processors)? I'm thinking of making a test suite that could find performance regressions automatically. I figured out Bochs[1] could be used for

Re: How to get Code.dlang.org to update the package?

2020-02-12 Thread Dukc via Digitalmars-d-learn
On Wednesday, 12 February 2020 at 13:05:00 UTC, Petar Kirov [ZombineDev] wrote: On Wednesday, 12 February 2020 at 12:42:32 UTC, Dukc wrote: I have pushed a new release tag in Github around two weeks ago, and ordered a manual update at DUB, yet DUB has still not aknowledged the new tag. Is

How to get Code.dlang.org to update the package?

2020-02-12 Thread Dukc via Digitalmars-d-learn
I have pushed a new release tag in Github around two weeks ago, and ordered a manual update at DUB, yet DUB has still not aknowledged the new tag. Is there some requirement for the release tag for it to be recognized?

Re: How to set up multi-dimensional DUB package configuration?

2020-02-12 Thread Dukc via Digitalmars-d-learn
Illustration, I want to choose both an edition and marked copyright holder: ``` configuration "inhouse" { targetType "executable" versions "InhouseEdition" } configuration "salesmen" { targetType "executable" versions "SalesmenEdition" } configuration "internet" { targetType

How to set up multi-dimensional DUB package configuration?

2020-02-12 Thread Dukc via Digitalmars-d-learn
My application has two copyright holders, so I want to be able to specify in the build command whose copyright marks get compiled to the program. D part of the application is built by DUB. DUB configurations would do the trick, but they are already used to define different editions of the

Re: why local variables cannot be ref?

2019-11-25 Thread Dukc via Digitalmars-d-learn
On Monday, 25 November 2019 at 03:07:08 UTC, Fanda Vacek wrote: Is this preferred design pattern? ``` int main() { int a = 1; //ref int b = a; // Error: variable `tst_ref.main.b` only parameters or `foreach` declarations can be `ref` ref int b() { return a; } b = 2;

Re: Troubleshooting DUB invocations

2019-11-19 Thread Dukc via Digitalmars-d-learn
On Tuesday, 19 November 2019 at 13:41:32 UTC, Sebastiaan Koppe wrote: A @disabled function stub would serve better, unless I'm missing something. Either way, as long as there is a clear way to debug why it ended up there. Unlike what we have now where you need to dig endlessly. But the

Re: Troubleshooting DUB invocations

2019-11-19 Thread Dukc via Digitalmars-d-learn
On Monday, 18 November 2019 at 19:35:13 UTC, Sebastiaan Koppe wrote: Kinke made some changes in dub to facilitate separate linking for ldc. I am not aware of all the details but the major benefit is that it allows cross compilation with dub and ldc. Yeah, definitely useful if you want to

Re: Troubleshooting DUB invocations

2019-11-13 Thread Dukc via Digitalmars-d-learn
On Wednesday, 13 November 2019 at 15:41:01 UTC, Sebastiaan Koppe wrote: It has been on the back of my mind since 1.18-beta came out. I am going to reserve a little time tomorrow to work on it. Regarding that, perhaps I can save you a bit trouble if you also try to get 1.19 working: if you get

Re: Should I stop being interested in D language if I don't like to see template instantiation in my code?

2019-11-13 Thread Dukc via Digitalmars-d-learn
On Wednesday, 13 November 2019 at 14:59:57 UTC, Dukc wrote: 4: Templates. Same code size bloat as with options 1 and 3, Meant binary size bloat

Re: Why same pointer type for GC and manual memory?

2019-11-13 Thread Dukc via Digitalmars-d-learn
On Wednesday, 13 November 2019 at 11:07:12 UTC, IGotD- wrote: I'm trying to find the rationale why GC pointers (should be names managed pointers) are using the exact same type as any other pointer. Doesn't this limit the ability to change the default GC type? What does grabage collector type

Re: Troubleshooting DUB invocations

2019-11-13 Thread Dukc via Digitalmars-d-learn
On Tuesday, 12 November 2019 at 18:32:32 UTC, kinke wrote: Dub is open-source, so you can grep the source. - Dub uses it for all 3 compilers (e.g., https://github.com/dlang/dub/blob/f87302dd206b0e5871b39704e694b2194e294aa5/source/dub/compilers/ldc.d#L249), and I'm not sure it's really needed.

Re: Should I stop being interested in D language if I don't like to see template instantiation in my code?

2019-11-13 Thread Dukc via Digitalmars-d-learn
On Wednesday, 13 November 2019 at 14:01:13 UTC, BoQsc wrote: I don't like to see exclamation marks in my code in as weird syntax as these ones: to!ushort(args[1]) s.formattedRead!"%s!%s:%s"(a, b, c); No pressure to use templates. D is designed to be multi-paradigm, and in many was combines

Troubleshooting DUB invocations

2019-11-12 Thread Dukc via Digitalmars-d-learn
When trying to compile a project including newest Spasm (DUB package) using the newest LDC via DUB, the result is: ``` lld: error: unknown argument: --no-as-needed ``` I then ran DUB with -v switch and it turned out the invocation contained `-L--no-as-needed` as first of all the -L arguments.

Re: Good way let low-skill people edit CSV files with predefined row names?

2019-10-30 Thread Dukc via Digitalmars-d-learn
On Friday, 25 October 2019 at 21:58:27 UTC, Laeeth Isharc wrote: Another Symmetry project allows reading Excel files and a third is wrapper and bindings around a C library to write Excel files. We use them in production daily though there may be rough edges for features we don't use. I

Re: Good way let low-skill people edit CSV files with predefined row names?

2019-10-24 Thread Dukc via Digitalmars-d-learn
On Thursday, 24 October 2019 at 16:50:17 UTC, Dukc wrote: Hmm, I need to check whether I can do that on LibreOffice Calc. Unfortunately, no. If there's a way to do that, it's not obvious. I should be able to make an easy-to-use excel-to-csv translator using Atilas Excel utilites without too

Re: Good way let low-skill people edit CSV files with predefined row names?

2019-10-24 Thread Dukc via Digitalmars-d-learn
On Thursday, 24 October 2019 at 16:20:50 UTC, jmh530 wrote: If they are only opening it in Excel, then you can lock cells. You should be able to do that with VBA. At least I know it works with xlsx files. Not sure on csv now that I think on it. Hmm, I need to check whether I can do that on

Good way let low-skill people edit CSV files with predefined row names?

2019-10-24 Thread Dukc via Digitalmars-d-learn
We're planning to have our product preview program to calculate and suggest a price for the product displayed. There are a lot of variables to take into account, so it's essential the users can edit the price variables themselves. The problem is that many of them are not the best computer

Re: Good way let low-skill people edit CSV files with predefined row names?

2019-10-24 Thread Dukc via Digitalmars-d-learn
On Thursday, 24 October 2019 at 16:03:26 UTC, Dukc wrote: Even if it isn't CSV, it is going to be easier for me to write a translator than a GUI editor. Assuming the file format is simple, of course

Re: Pro programmer

2019-08-27 Thread Dukc via Digitalmars-d-learn
On Sunday, 25 August 2019 at 21:30:10 UTC, GreatSam4sure wrote: I am wondering as to what is the starting point of being a pro programmer. If I want to be a pro programmer what language must I start with? Any general purpose language will do. Basically everything can be expressed in any

Re: /usr/bin/ld.gold: error: failed to find object -lz

2019-08-15 Thread Dukc via Digitalmars-d-learn
On Thursday, 15 August 2019 at 12:02:00 UTC, kinke wrote: That's the library you need. You may have messed things up by installing a non-dev package from Fedora (!). Fortunately it's written in red at YAST, because it's not from the official repos. I can easily find it to get rid of it when I

Re: /usr/bin/ld.gold: error: failed to find object -lz

2019-08-15 Thread Dukc via Digitalmars-d-learn
Investigated this matter further. The most likely reason seems to be that the required library -zlib- (Yes, ld.gold was getting the arguments in correct form despite what I said. Sorry.) is installed only in dynamic form (.so), but ld.gold finds only static libraries (.a). Not 100% sure yet,

Re: How to run the dub bundle with dmd

2019-08-10 Thread Dukc via Digitalmars-d-learn
On Saturday, 10 August 2019 at 13:18:19 UTC, greatsam4sure wrote: I came across the problem recently. I have dub 1.11.0 install on my windows 10 core i7 but does not support the command "dub add package name" since all the packages in dub package register now use this command. I cannot find

Re: LNK4255 warning - should I be concerned?

2019-08-10 Thread Dukc via Digitalmars-d-learn
On Thursday, 8 August 2019 at 18:14:22 UTC, DanielG wrote: "warning LNK4255: library contain multiple objects of the same name; linking object as if no debug info" Is there some way to get more detail about this warning? Might help to know which objects ... My program is working fine now,

Getting a HTTP request body over wire for Vibe.d to process

2019-08-10 Thread Dukc via Digitalmars-d-learn
I am trying to use XMLHttpRequest[1] to send a request with a body for Vibe.D to process. However, it seems that I'm getting tripped up on serverside and client side api simultaenously, with no way to know what's really happening. I'm starting to be positive that I need a code example or I'll

Re: Module static constructor doesn't work?

2019-08-08 Thread Dukc via Digitalmars-d-learn
On Thursday, 8 August 2019 at 14:55:37 UTC, Andrey Zherikov wrote: I have the following code: // lib1/lib.d module lib; import std.stdio; static this() { writeln("+" ~ __FILE__); } static ~this() { writeln("-" ~ __FILE__); } // main.d int main() { import std.stdio;

Re: /usr/bin/ld.gold: error: failed to find object -lz

2019-08-07 Thread Dukc via Digitalmars-d-learn
Taking the LDC2 invocation and removing `-lz` and `-lresolv` seems to work around the problem. A bad long-term solution though.

Re: /usr/bin/ld.gold: error: failed to find object -lz

2019-08-07 Thread Dukc via Digitalmars-d-learn
On Wednesday, 7 August 2019 at 02:47:11 UTC, ?boing? wrote: On Tuesday, 6 August 2019 at 12:39:08 UTC, Dukc wrote: On Tuesday, 6 August 2019 at 11:41:25 UTC, kinke wrote: LDC definitely doesn't add that. zlib shouldn't be necessary, as Phobos contains an (IIRC, outdated) version of it.

Re: /usr/bin/ld.gold: error: failed to find object -lz

2019-08-07 Thread Dukc via Digitalmars-d-learn
On Wednesday, 7 August 2019 at 02:47:11 UTC, ?boing? wrote: On Tuesday, 6 August 2019 at 12:39:08 UTC, Dukc wrote: On Tuesday, 6 August 2019 at 11:41:25 UTC, kinke wrote: LDC definitely doesn't add that. zlib shouldn't be necessary, as Phobos contains an (IIRC, outdated) version of it.

Re: /usr/bin/ld.gold: error: failed to find object -lz

2019-08-06 Thread Dukc via Digitalmars-d-learn
On Tuesday, 6 August 2019 at 11:41:25 UTC, kinke wrote: LDC definitely doesn't add that. zlib shouldn't be necessary, as Phobos contains an (IIRC, outdated) version of it. Anyway, you should be able to please the linker by installing a zlib package, such as `zlib1g` on Debian/Ubuntu.

Re: LDC won't find ld linker -why?

2019-07-11 Thread Dukc via Digitalmars-d-learn
On Wednesday, 10 July 2019 at 23:15:38 UTC, Johan Engelen wrote: On Tuesday, 9 July 2019 at 15:25:17 UTC, Dukc wrote: I just downloaded ldc 1.15.0 for Linux from GH releases. Testing it, it will make the object file out of a hello world application, but then complain: ``` collect2: fatal

LDC won't find ld linker -why?

2019-07-09 Thread Dukc via Digitalmars-d-learn
I just downloaded ldc 1.15.0 for Linux from GH releases. Testing it, it will make the object file out of a hello world application, but then complain: ``` collect2: fatal error: cannot find ‘ld’ compilation terminated. ``` This is strange, because running either `ld` or `clang` (yes, I

Re: LDC won't find ld linker -why?

2019-07-09 Thread Dukc via Digitalmars-d-learn
On Tuesday, 9 July 2019 at 15:25:17 UTC, Dukc wrote: (ln is in `usr/bin/` meant that `ld` is there

Re: Reading .pem files for secured

2019-06-06 Thread Dukc via Digitalmars-d-learn
On Friday, 31 May 2019 at 12:17:14 UTC, Sebastiaan Koppe wrote: On Friday, 31 May 2019 at 10:35:46 UTC, Dukc wrote: But then came a problem that I need to feed the key from .pem to initialize RSA class. Just base64 decode the PEM data (without the ) and feed it to RSA.this(ubyte[]

Re: Reading .pem files for secured

2019-06-03 Thread Dukc via Digitalmars-d-learn
On Friday, 31 May 2019 at 10:35:46 UTC, Dukc wrote: if I understand the logic of Base64, it's that each character stores 6 bits. My private key .pem has 49 lines of 64 characters worth of Base64, though the sat line isn't full. Anyway, this is data worth of over 18000 bits. The RSA key is

Re: Reading .pem files for secured

2019-06-02 Thread Dukc via Digitalmars-d-learn
On Friday, 31 May 2019 at 12:17:14 UTC, Sebastiaan Koppe wrote: Just base64 decode the PEM data (without the ) and feed it to RSA.this(ubyte[] publicKey). Ought to be that simple. I assume the same should apply with private key and private key constructor (along with a random password of

Re: Reading .pem files for secured

2019-06-02 Thread Dukc via Digitalmars-d-learn
On Friday, 31 May 2019 at 12:17:14 UTC, Sebastiaan Koppe wrote: Just base64 decode the PEM data (without the ) and feed it to RSA.this(ubyte[] publicKey). Ought to be that simple. That's logic of SSL? Okay, I'll try that first.

Re: Reading .pem files for secured

2019-05-31 Thread Dukc via Digitalmars-d-learn
On Friday, 31 May 2019 at 11:09:07 UTC, KnightMare wrote: The reason is that if I understand the logic of Base64, it's that each character stores 6 bits. My private key .pem has 49 lines of 64 characters worth of Base64, though the sat line isn't full. Anyway, this is data worth of over 18000

Reading .pem files for secured

2019-05-31 Thread Dukc via Digitalmars-d-learn
I need to manually sign and verify stuff with asymmetric crypto keys. I ended up using rsa from secured. The key pair needs to be persistant between, so I made a 4096-bit private key with OpenSSL, stored in .pem file. Then I constructed a public key from the private one, again with OpenSSL.

Re: Dlang + emscripten

2019-05-16 Thread Dukc via Digitalmars-d-learn
On Thursday, 16 May 2019 at 18:23:12 UTC, SrMordred wrote: I´m following this link to build d+sdl2+emscripten on web: https://theartofmachinery.com/2018/12/20/emscripten_d.html And, i´m was able to compile but i get the warnings warning: Linking two modules of different data layouts / target

Re: Alias to template instance wokrs, but non-template does not?

2019-05-15 Thread Dukc via Digitalmars-d-learn
On Tuesday, 14 May 2019 at 14:36:21 UTC, Q. Schroll wrote: [snip] I've filed a bug report [1] some time ago. I'm posting here, because I want to understand what's going on here. I read through this post and while I don't know precisely what the compiler is thinking, it seems for me that your

Implementing a watchdog process for a console program

2019-05-14 Thread Dukc via Digitalmars-d-learn
So I'm implementing a watchdog process for my web server, or a deadman switch as it's called here: https://www.digitalmars.com/articles/b40.html But I ran into a problem with filtering watchdog kicks and then forwarding other I/O through the watchdog process. Here's what I have done so far:

Re: Erasing passwords from ram?

2019-05-10 Thread Dukc via Digitalmars-d-learn
On Thursday, 9 May 2019 at 19:10:04 UTC, Nick Sabalausky wrote: On Tuesday, 30 April 2019 at 08:15:15 UTC, Dukc wrote: I am currently programming a server. So I got the idea that after I've generated all the hashes I need from a password, I want to erase it from RAM before discarding it, just

Re: Erasing passwords from ram?

2019-05-07 Thread Dukc via Digitalmars-d-learn
On Monday, 6 May 2019 at 17:57:55 UTC, Cym13 wrote: So what I'm trying to say is that, given your threat model, it does not seem relevant to protect against memory disclosure specifically: you want to protect against the larger and more common threat of memory corruptions and that happens to

Re: Erasing passwords from ram?

2019-05-06 Thread Dukc via Digitalmars-d-learn
Oops, I forgot to check back this theard. But yes, just the info I was looking for. On Wednesday, 1 May 2019 at 22:14:52 UTC, Cym13 wrote: There are very few relevant threat models where removing a password from RAM is an adequate solution. Not an adequate solution... What else is usually

Re: Erasing passwords from ram?

2019-04-30 Thread Dukc via Digitalmars-d-learn
On Tuesday, 30 April 2019 at 08:31:40 UTC, Kagamin wrote: You better obfuscate the password on client side. No, this particular password does not come from clients. Rather, it's given by server maintainer and used to generate passcodes that are then distributed to clients.

Erasing passwords from ram?

2019-04-30 Thread Dukc via Digitalmars-d-learn
I am currently programming a server. So I got the idea that after I've generated all the hashes I need from a password, I want to erase it from RAM before discarding it, just to be sure it won't float around if the server memory is exposed to spyware by some buffer overflow. Is this wise

Re: Why is my @pure function @system when placed in a struct?

2019-02-27 Thread Dukc via Digitalmars-d-learn
On Wednesday, 27 February 2019 at 17:23:21 UTC, Q. Schroll wrote: For whatever reason, when I put the code in a struct, the @safe testing line tells me, it's @system now. I tested a bit, and it appears that attribute inference is not done at all for templates inside structs -the attribute

Re: Why is my @pure function @system when placed in a struct?

2019-02-27 Thread Dukc via Digitalmars-d-learn
On Wednesday, 27 February 2019 at 18:06:49 UTC, Stefan Koch wrote: the struct gets drawn into your delegate-context. and I guess that taints the function. Even if it did, it should not make the delegate @system. And it does not, since this manifest with static functions and function

Re: Ordered set container?

2019-01-29 Thread Dukc via Digitalmars-d-learn
On Monday, 28 January 2019 at 17:18:52 UTC, Victor Porton wrote: I want "ordered set" container (like list or vector but with the warranty of no duplicate elements). The above answers are ordered, but if you want a type that's a simple sorted array, there's none at the standard library

Re: Can LDC compile to supported legacy LLVM versions?

2019-01-28 Thread Dukc via Digitalmars-d-learn
On Monday, 28 January 2019 at 13:04:08 UTC, Nicholas Wilson wrote: Do you mean bitcode, LLVM IR or something different? The LDC built against a given version of LLVM can link to bitcode/compile LLMV IR, of that version. Bitcode in this case, but I think your following answer applies to

Can LDC compile to supported legacy LLVM versions?

2019-01-28 Thread Dukc via Digitalmars-d-learn
I have recenty updated my LDC to the most recent version (1.14). The problem is that it compiles to LLVM code version 7.0.1, but I need it to compile to LLVM 6.x.x or LLVM 5.x.x. The last release note said that LLVM versions from 3.something.something are supported, but does this mean only

Re: Runtime heterogeneous collections?

2019-01-17 Thread Dukc via Digitalmars-d-learn
On Thursday, 17 January 2019 at 02:27:20 UTC, Neia Neutuladh wrote: 1. Make a wrapper class. Now you can store Object[], or you can make a base class or base interface and use that. 2. Use Variant, which can wrap anything, or the related Algebraic, which can wrap a fixed collection of types.

Re: Is there a nice syntax to achieve optional named parameters?

2019-01-16 Thread Dukc via Digitalmars-d-learn
On Wednesday, 16 January 2019 at 11:21:53 UTC, Dukc wrote: a template that takes a single struct of arbitrary, meant "of arbitrary type"

Re: Is there a nice syntax to achieve optional named parameters?

2019-01-16 Thread Dukc via Digitalmars-d-learn
On Tuesday, 15 January 2019 at 11:14:54 UTC, John Burton wrote: This is ok, but I'm not so keen on separating the creation and construction like this. Is there a better way that's not ugly? You can make the constructor a template that takes a single struct of arbitrary, and inspects (at

Re: Why does nobody seem to think that `null` is a serious problem in D?

2018-12-04 Thread Dukc via Digitalmars-d-learn
Nulls/Nones are always a big gap in a language's type system. A common alternative is to have some Option/Maybe type like Rust or Haskell or D's Variant. How about making that required to plug the null gap? There are others too who feel like that too:

Re: Why does nobody seem to think that `null` is a serious problem in D?

2018-12-01 Thread Dukc via Digitalmars-d-learn
On Saturday, 1 December 2018 at 00:32:35 UTC, Tony wrote: isocpp.org just had a link to a blog post where someone makes a case for uninitialized variables in C++ being an advantage in that you can potentially get a warning regarding use of an uninitialized variable that points out an error in

Re: Why use while if only iterating once ?

2018-11-06 Thread Dukc via Digitalmars-d-learn
On Saturday, 3 November 2018 at 21:13:49 UTC, Jonathan M Davis wrote: There's a continue right above the default case. So, if the code hits that point, it will loop back to the top. - Jonathan M Davis There's also the benefit that FLAGS f exists only until the end of the loop, and thus

Re: Profiling with DUB?

2018-11-06 Thread Dukc via Digitalmars-d-learn
On Monday, 29 October 2018 at 10:14:23 UTC, Dukc wrote: When I run the program, where is the performance profile file supposed to appear? I can find nothing new in the program/project root directory. The same thing happens when I try to get a coverage report: No file appears.

Re: javascript or typescript

2018-11-05 Thread Dukc via Digitalmars-d-learn
On Monday, 5 November 2018 at 08:49:42 UTC, Laurent Tréguier wrote: On Monday, 5 November 2018 at 02:51:19 UTC, Fred wrote: hi, my javascript skill is bad. but i want to host some nodejs app i am aware that there is converter to js like dtojs. but it is out of date. i'd like to give d a

Re: javascript or typescript

2018-11-05 Thread Dukc via Digitalmars-d-learn
On Monday, 5 November 2018 at 02:51:19 UTC, Fred wrote: hi, my javascript skill is bad. but i want to host some nodejs app i am aware that there is converter to js like dtojs. but it is out of date. i'd like to give d a try. is there any other converter available. a decent one. Let me

Re: Profiling with DUB?

2018-11-05 Thread Dukc via Digitalmars-d-learn
On Thursday, 1 November 2018 at 13:59:39 UTC, Guillaume Piolat wrote: On Monday, 29 October 2018 at 10:14:23 UTC, Dukc wrote: I'm trying to profile my program, built like: dub build --build=profile When I run the program, where is the performance profile file supposed to appear? I can find

Profiling with DUB?

2018-10-29 Thread Dukc via Digitalmars-d-learn
I'm trying to profile my program, built like: dub build --build=profile When I run the program, where is the performance profile file supposed to appear? I can find nothing new in the program/project root directory. This happens regardless whether I compile with dmd or ldc2.

Re: Dealing with ranges where front and popFront do the same logic / eager ranges

2018-10-17 Thread Dukc via Digitalmars-d-learn
On Tuesday, 16 October 2018 at 22:59:50 UTC, Dennis wrote: [snip] The first thing to consider for invalid tokens, at least for me, would be to either have popFront set empty to true, or set front to some value representing a parsing error. A programming language parser almost certainly

Re: Reading binary streams with decoding to Unicode

2018-10-15 Thread Dukc via Digitalmars-d-learn
On Monday, 15 October 2018 at 10:49:49 UTC, Vinay Sajip wrote: Is there a standardised way of reading over buffered binary streams (at least strings, files, and sockets) where you can layer a decoder on top, so you get a character stream you can read one Unicode char at a time? Initially

Re: Is there an efficient byte buffer queue?

2018-10-10 Thread Dukc via Digitalmars-d-learn
On Monday, 8 October 2018 at 10:31:33 UTC, Nicholas Wilson wrote: Try searching for "circular buffer". I'm sure http://code.dlang.org/packages/iopipe has them in some form but I can't find them with a cursory search.

Re: Is there any reason to use non-ref foreach?

2018-09-04 Thread Dukc via Digitalmars-d-learn
On Tuesday, 4 September 2018 at 08:17:14 UTC, Andrea Fontana wrote: Waiting for this to be merged: https://github.com/dlang/dmd/pull/8437 Well, it seems Andrei has already approved the concept. well, THAT is a good reason to avoid this paradigm. Thanks for the info.

Re: Is there any reason to use non-ref foreach?

2018-09-04 Thread Dukc via Digitalmars-d-learn
On Monday, 3 September 2018 at 13:34:36 UTC, Andrea Fontana wrote: On Friday, 31 August 2018 at 09:59:20 UTC, Dukc wrote: For me, it seems that for generality you should always add ref into foreach loop variable. The reason is this: One good reason:

Re: Is there any reason to use non-ref foreach?

2018-08-31 Thread Dukc via Digitalmars-d-learn
On Friday, 31 August 2018 at 12:52:17 UTC, bauss wrote: In reality you're micro-optimizing something that doesn't require it. I think you misunderstood. I wasn't trying to optimize, I was looking for a general way to iterate. I can't see the benefit other than added complexity. I just

Is there any reason to use non-ref foreach?

2018-08-31 Thread Dukc via Digitalmars-d-learn
For me, it seems that for generality you should always add ref into foreach loop variable. The reason is this: import std.experimental.all; struct NoCopies { @disable this(this); int payload; } void main() { auto range = new NoCopies[20]; foreach(const ref el; range)

  1   2   >