Re: print ubyte[] as (ascii) string

2022-01-07 Thread Dukc via Digitalmars-d-learn
On Thursday, 30 December 2021 at 09:34:27 UTC, eugene wrote: ```d char[] s = cast(char[])ioCtx.buf[0 .. strlen(cast(char*)ioCtx.buf.ptr) - 1]; // -1 is to eliminate terminating '\n' writefln("got '%s' from '%s:%d'", s, client.addr, client.port); ``` Is there some more concise/elegant way to

Re: Why do we have Dmain?

2021-10-22 Thread Dukc via Digitalmars-d-learn
On Friday, 22 October 2021 at 07:00:25 UTC, Mike Parker wrote: The entry point for your program is a function `_start`. That's implemented in the C runtime, which all D programs depend on. It in turn calls `main`, as it does for C and C++ programs. It is possible, in both C and D, to write

Re: better c fibers

2021-09-27 Thread Dukc via Digitalmars-d-learn
On Tuesday, 21 September 2021 at 09:37:30 UTC, Abby wrote: Hi there, I'm new in dlang I specially like betterC. I was hoping that d fibers would be implemented in without using classes, but there are not. Is there another way how to use async/await in dlang better c? Thank you for your help

Re: Array permutations

2021-09-11 Thread Dukc via Digitalmars-d-learn
On Saturday, 11 September 2021 at 19:37:42 UTC, Vino wrote: Request your help on the below to print the below array as "Required output", Was able to get these values "[1,2],[2,3],[3,4],[4,5]" by using list.slide(2), need your help to get values "1,3],[1,4],[1,5],[2,4],[2,5],[3,5]" ```d

Re: Ali's Book - Programming in D

2021-09-11 Thread Dukc via Digitalmars-d-learn
On Friday, 10 September 2021 at 22:26:34 UTC, Ali Çehreli wrote: https://bitbucket.org/acehreli/ddili/commits/ Ah it's there - gotta remember that place if I want to make corrections. Good book - It's the one that got me up to speed with D before I was commited enough to pay for anything.

Re: How to Fix Weird Build Failure with "-release" but OK with "-debug"?

2021-07-21 Thread Dukc via Digitalmars-d-learn
On Wednesday, 21 July 2021 at 14:15:51 UTC, Steven Schveighoffer wrote: 2. It's hard for me to see where the null dereference would be in that function (the `bool` implementation is pretty simple). -Steve DMD complains about dereferences in three different lines. I suspect it's `this`

Re: Can static variables in methods be local for each object?

2021-07-20 Thread Dukc via Digitalmars-d-learn
On Tuesday, 20 July 2021 at 09:24:07 UTC, Mark Lagodych wrote: Is there a way to make myvar local to each instance of `X` without making it a variable of `X`? Just curious. Yes. ```d import std.stdio; class X { int x(int param) { static int[typeof(this)] myvar; if (param

Re: Why can't we transpile C++ to D?

2021-06-10 Thread Dukc via Digitalmars-d-learn
On Thursday, 10 June 2021 at 15:09:02 UTC, Tejas wrote: Sorry, I'm rather ignorant when it comes to this, but why can't we use [pegged](https://github.com/PhilippeSigaud/Pegged) to transpile C++ code to D? Then we won't need a nogc compatible std library and so many other things could get

Re: coreutils with D trials, wc, binary vs well formed utf

2021-05-24 Thread Dukc via Digitalmars-d-learn
Is there a(n easy-ish) way to fix up that wc.d source in the blog to fallback to byte stream mode when a utf-8 reader fails an encoding? Rewrite `toLine`: ``` Line toLine(char[] l) pure { import std.array : array; import std.algorithm : filter; import std.utf : byDchar, replacementDchar;

Re: dlang opengl / gl / glu /glut library.

2021-04-21 Thread Dukc via Digitalmars-d-learn
On Sunday, 18 April 2021 at 23:36:58 UTC, Alain De Vos wrote: When doing graphics the number of functions explodes. So one needs always a list, compare to a header file in c. If there are "modern" alternatives to opengl feel free. More modern from which perspective? Simpler to use

Re: Dlang equivalent of #define/#ifdef : not... version

2021-04-21 Thread Dukc via Digitalmars-d-learn
On Tuesday, 20 April 2021 at 23:58:46 UTC, Steven Schveighoffer wrote: static if(i_am_a_feature) { ... } This would be correct if `i_am_a_feature` would be always defined, just set to `false` if not existent. But I think the idea was to not define the symbol at all if feature does not

Re: How to get Laptop battery level

2021-02-22 Thread Dukc via Digitalmars-d-learn
On Monday, 22 February 2021 at 21:14:48 UTC, Dukc wrote: Note that DGame seems to be currently unmaintained - it might have some bits that do not compile anymore. SDL2 is a commonly used library though - you should be able to find more examples about it if you need to. Plus, the example I

Re: How to get Laptop battery level

2021-02-22 Thread Dukc via Digitalmars-d-learn
On Monday, 22 February 2021 at 20:59:01 UTC, Greatsam4sure wrote: Dlang is a system programming language. How do I access the battery level of my system using code in dlang? As a systems language, D could access the hardware interface directly, if you knew it and loaded your program as a

Re: Profiling

2021-02-09 Thread Dukc via Digitalmars-d-learn
On Tuesday, 9 February 2021 at 16:39:25 UTC, Dukc wrote: You may have or may not have done it wrong, but in any case this is a bug. If you do something wrong, the program should tell you what you did wrong, instead of telling you that character '-' does not belong to middle of a long int. Oh

Re: Profiling

2021-02-09 Thread Dukc via Digitalmars-d-learn
On Tuesday, 9 February 2021 at 07:45:13 UTC, JG wrote: Is d-profile-viewer no longer working? Or did I do something wrong? You may have or may not have done it wrong, but in any case this is a bug. If you do something wrong, the program should tell you what you did wrong, instead of telling

Re: Open question: what code pattern you use usually for null safety problem

2021-01-15 Thread Dukc via Digitalmars-d-learn
On Thursday, 14 January 2021 at 18:24:44 UTC, ddcovery wrote: This is only an open question to know what code patterns you usually use to solve this situation in D: if(person.father.father.name == "Peter") doSomething(); if(person.father.age > 80 ) doSomething(); knowing that *person*, or

Re: Why many programmers don't like GC?

2021-01-14 Thread Dukc via Digitalmars-d-learn
On Thursday, 14 January 2021 at 14:28:43 UTC, Виталий Фадеев wrote: On Wednesday, 13 January 2021 at 18:58:56 UTC, Marcone wrote: I've always heard programmers complain about Garbage Collector GC. But I never understood why they complain. What's bad about GC? How write quickly without GC ?

Re: DConf talk : Exceptions will disappear in the future?

2021-01-06 Thread Dukc via Digitalmars-d-learn
On Monday, 4 January 2021 at 15:39:50 UTC, ludo456 wrote: Listening to the first visioconf of the Dconf 2020, titled Destroy All Memory Corruption, (https://www.youtube.com/watch?v=XQHAIglE9CU) Walter talks about not using exceptions any more in the future. He says something like "this is

Re: Floating point values in structs.

2020-12-22 Thread Dukc via Digitalmars-d-learn
On Friday, 18 December 2020 at 16:18:12 UTC, Dave P. wrote: If the compiler is going to introduce the overhead of initializing all the variables anyway, why set it to nan when integer types get set to the useful default of 0? Consider default value of `int*`. It is `null`, not a pointer to a

Re: Is there a standard function that combines take() and popFrontExactly()

2020-12-14 Thread Dukc via Digitalmars-d-learn
On Friday, 11 December 2020 at 19:07:23 UTC, realhet wrote: I've just made this unicode wordreplacer function working, but It seems not too nice and functional-ish. Are there ways to make it more simple? To answer the title, yes there is: ``` foreach(isWord, len; str.map!fun.group){ auto

Re: where is the memory corruption?

2020-12-09 Thread Dukc via Digitalmars-d-learn
On Wednesday, 9 December 2020 at 20:35:21 UTC, Jack wrote: the output is "h" rather "hello". What am I missing? In the sayHello function, you are converting a pointer to utf16 character into utf8 string, not utf16 string to utf8 string. Convert the C wstring to a D `wstring` first

Re: To use or not immutable?

2020-12-09 Thread Dukc via Digitalmars-d-learn
On Wednesday, 9 December 2020 at 16:47:43 UTC, Jack wrote: Do you use it in your code base? are there some design flaws, like there's in C++'s const, which I'm not aware of? There are downsides, Jonathan Davis has written about them: http://www.jmdavisprog.com/articles/why-const-sucks.html

Re: how to print progress of a long running parallel() loop?

2020-12-07 Thread Dukc via Digitalmars-d-learn
On Monday, 7 December 2020 at 08:16:50 UTC, mw wrote: r = Parallel(n_jobs=2, verbose=10)(delayed(sleep)(.2) for _ in range(10)) to print out the progress. How to do this in D's parallel loop? thanks. Allocate a `shared int` before the foreach loop. In the loop when, let's say `!(i &

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

  1   2   >