Re: How to deploy single exe application (?)

2021-11-30 Thread bauss via Digitalmars-d-learn
On Monday, 29 November 2021 at 14:58:07 UTC, Willem wrote: Thanks again for all the responses. For now -- I am simply adding the DLL to the EXE and writing it out to the working directory. Not elegant - but it does work. If you intend to distribute it then becareful with this as it

Re: what i don't like about dub

2021-11-23 Thread bauss via Digitalmars-d-learn
On Tuesday, 23 November 2021 at 10:19:29 UTC, Tejas wrote: On Tuesday, 23 November 2021 at 07:06:17 UTC, bauss wrote: On Tuesday, 23 November 2021 at 01:19:44 UTC, Alain De Vos wrote: [...] Well, it's not always possible to check such things without heavy performance cost. It can take a

Re: what i don't like about dub

2021-11-22 Thread bauss via Digitalmars-d-learn
On Tuesday, 23 November 2021 at 01:19:44 UTC, Alain De Vos wrote: What i don't like about dub is that is does not check which software is installed on the host. Currentlu tck86 is installed on the host including header files & shared libraries. But dub says let me just download my own personal

Re: Null pointer in __vptr

2021-11-22 Thread bauss via Digitalmars-d-learn
On Friday, 19 November 2021 at 20:27:11 UTC, frame wrote: On Friday, 19 November 2021 at 18:14:03 UTC, Adam D Ruppe wrote: I've gotten that before as a result of a compiler bug... I had an abstract method that wasn't implemented but the compile time error got swallowed by a bug and thus the

Re: Exceptions names list

2021-11-16 Thread bauss via Digitalmars-d-learn
On Monday, 15 November 2021 at 22:44:35 UTC, Ali Çehreli wrote: On 11/15/21 2:28 PM, pascal111 wrote: > I want to know where the list of exceptions names that "throw" statement > uses. Such a list is not very useful. Normally all we need is Exception and occasionally one or two other specific

Re: What is D's "__debugbreak()" equivalent?

2021-10-29 Thread bauss via Digitalmars-d-learn
On Friday, 29 October 2021 at 11:36:13 UTC, Adam D Ruppe wrote: On Friday, 29 October 2021 at 09:32:07 UTC, bauss wrote: } else version(D_InlineAsm_X86_64) { just fyi but `int 3;` works just as well in 32 bit as 64 Yeah, that's why I noted that there's also D_InlineAsm_X86 but I

Re: What is D's "__debugbreak()" equivalent?

2021-10-29 Thread bauss via Digitalmars-d-learn
On Thursday, 28 October 2021 at 09:54:44 UTC, Dennis wrote: On Wednesday, 27 October 2021 at 16:54:49 UTC, Simon wrote: What is the equivalent in D? With LDC, you have: ```D import ldc.intrinsics: llvm_debugtrap; ``` Combining that with previous answers, you can make something like this:

Re: Error: Could not open 'libcmt.lib'

2021-10-27 Thread bauss via Digitalmars-d-learn
On Monday, 25 October 2021 at 14:43:06 UTC, Willem wrote: Just starting out new with D. Up until now I have been using Python and a bit of OCaml. Error when linking: "lld-link: error: could not open 'libcmt.lib': no such file or directory" What I did: I installed the complete D setup in

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

2021-10-27 Thread bauss via Digitalmars-d-learn
On Monday, 25 October 2021 at 12:54:32 UTC, greenbyte wrote: On Monday, 25 October 2021 at 07:45:26 UTC, Imperatorn wrote: 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:

Re: std.zip expand: memory allocation failed

2021-10-27 Thread bauss via Digitalmars-d-learn
On Tuesday, 26 October 2021 at 13:43:36 UTC, Steven Schveighoffer wrote: On 10/26/21 2:32 AM, bauss wrote: On Monday, 25 October 2021 at 22:38:38 UTC, Imperatorn wrote: On Monday, 25 October 2021 at 20:50:40 UTC, Steven Schveighoffer wrote: On 10/24/21 8:00 AM, Selim Ozel wrote: It turns out

Re: std.zip expand: memory allocation failed

2021-10-26 Thread bauss via Digitalmars-d-learn
On Monday, 25 October 2021 at 22:38:38 UTC, Imperatorn wrote: On Monday, 25 October 2021 at 20:50:40 UTC, Steven Schveighoffer wrote: On 10/24/21 8:00 AM, Selim Ozel wrote: It turns out my computer was literally running out of memory as the file was getting unzipped. For some reason  to

Re: Why do we have Dmain?

2021-10-25 Thread bauss via Digitalmars-d-learn
On Monday, 25 October 2021 at 07:49:44 UTC, user1234 wrote: so with the D main you're directly in the the D "domain". In theory from that point, you don't need to ever use `strlen` for example. Not just that, but you shouldn't use it at all, rather you can't use it! You might be able to

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

2021-10-25 Thread bauss via Digitalmars-d-learn
On Sunday, 24 October 2021 at 20:58:22 UTC, greenbyte wrote: On Friday, 22 October 2021 at 11:51:03 UTC, WebFreak001 wrote: 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:

Re: __traits(compiles) is true with warnings as errors

2021-10-14 Thread bauss via Digitalmars-d-learn
On Thursday, 14 October 2021 at 05:41:01 UTC, Tejas wrote: On Wednesday, 13 October 2021 at 17:58:23 UTC, Jonathan Levi wrote: When dmd is passed the "-w" tag, it "treats warnings as errors" but not with the "__traits(compiles)" expression. Is this the intended action? This code should

Re: Linker error

2021-10-12 Thread bauss via Digitalmars-d-learn
On Tuesday, 12 October 2021 at 00:01:25 UTC, jfondren wrote: On Monday, 11 October 2021 at 23:43:17 UTC, Ruby The Roobster wrote: package mixin template move__() { pragma(inline) package void mv(Point moveby, ref Skeleton tomove) { foreach(i;tomove.faces) {

Re: How to "stringnify"?

2021-10-11 Thread bauss via Digitalmars-d-learn
On Sunday, 10 October 2021 at 09:51:27 UTC, rempas wrote: On Sunday, 10 October 2021 at 08:48:21 UTC, Imperatorn wrote: For simple stuff you have .stringof Thanks! Just remember .stringof is not "literal" as in there are certain expression that won't return exactly what you're trying to

Re: Mutually recursive template expansion

2021-10-04 Thread bauss via Digitalmars-d-learn
On Friday, 1 October 2021 at 14:26:39 UTC, jfondren wrote: On Friday, 1 October 2021 at 14:03:06 UTC, Stephen wrote: This code should work should mutual recursion be supported. It still wouldn't work, because structs are value types and it's impossible to say how large either struct is:

Re: Why sometimes stacktraces are printed and sometimes not?

2021-09-30 Thread bauss via Digitalmars-d-learn
On Wednesday, 29 September 2021 at 12:15:30 UTC, Steven Schveighoffer wrote: On 9/29/21 6:57 AM, JN wrote: What makes the difference on whether a crash stacktrace gets printed or not? Sometimes I get a nice clean stacktrace with line numbers, sometimes all I get is "segmentation fault error

Re: What is the meaning of @future ?

2021-09-17 Thread bauss via Digitalmars-d-learn
On Thursday, 16 September 2021 at 20:53:34 UTC, Elmar wrote: Hello D community. I was browsing the `__traits` keywords and I found `isFuture` whose descriptions says something about `@future`-annotated variables. [link](https://dlang.org/spec/traits.html#isFuture) I didn't find anything

Re: Is this a compiler aliasing bug?

2021-09-17 Thread bauss via Digitalmars-d-learn
On Friday, 17 September 2021 at 09:44:53 UTC, Chris Katko wrote: I'm debugging some code I wrote back in 2017 and a bounding box collision detection kept giving spurious answers till I resorted to assuming nothing and dumped every variable and alias. I kept getting results like it was

Re: GC seems to crash my C-code function

2021-09-16 Thread bauss via Digitalmars-d-learn
On Thursday, 16 September 2021 at 11:35:27 UTC, frame wrote: On Thursday, 16 September 2021 at 11:11:56 UTC, bauss wrote: On Thursday, 16 September 2021 at 11:06:04 UTC, frame wrote: On Thursday, 16 September 2021 at 10:48:19 UTC, bauss wrote: Use toStringz and not .ptr. Or append \0 to

Re: GC seems to crash my C-code function

2021-09-16 Thread bauss via Digitalmars-d-learn
On Thursday, 16 September 2021 at 11:06:04 UTC, frame wrote: On Thursday, 16 September 2021 at 10:48:19 UTC, bauss wrote: Use toStringz and not .ptr. Or append \0 to your string. Stupid me should really know that already, thanks =) Of course I have dup'ed the \0 from the string away...

Re: GC seems to crash my C-code function

2021-09-16 Thread bauss via Digitalmars-d-learn
On Thursday, 16 September 2021 at 10:48:19 UTC, bauss wrote: On Thursday, 16 September 2021 at 10:28:37 UTC, frame wrote: I have C-code translated in D that acts sometimes incorrect if the GC has made some collect. I would like to know why. - Code runs correct if the GC collections are off -

Re: GC seems to crash my C-code function

2021-09-16 Thread bauss via Digitalmars-d-learn
On Thursday, 16 September 2021 at 10:28:37 UTC, frame wrote: I have C-code translated in D that acts sometimes incorrect if the GC has made some collect. I would like to know why. - Code runs correct if the GC collections are off - There are no allocations within the C-translated-code except

Re: GDC - program runs in one thread, DMD - in 4 threads, why?

2021-09-10 Thread bauss via Digitalmars-d-learn
On Friday, 10 September 2021 at 12:46:36 UTC, eugene wrote: On Friday, 10 September 2021 at 12:10:58 UTC, Adam D Ruppe wrote: btw why do the threads cause you trouble? Well... probably it is subjective thing - just do not 'like' when a program is doing something that is not explicitly in it's

Re: GDC - program runs in one thread, DMD - in 4 threads, why?

2021-09-10 Thread bauss via Digitalmars-d-learn
On Friday, 10 September 2021 at 10:39:48 UTC, Basile B. wrote: On Friday, 10 September 2021 at 09:27:49 UTC, eugene wrote: Here is test program (which is using DList aggressively) [...] Can this (really unwanted) behavior be disabled in DMD? I do not want to have multiple threads, a program

Re: Ali's Book - Programming in D

2021-09-10 Thread bauss via Digitalmars-d-learn
On Friday, 10 September 2021 at 10:46:25 UTC, Ron Tarrant wrote: I guess this is mainly a question for Ali, but if anyone else knows the answer, please jump in... If I were to buy a paperback copy of "Programming in D: Tutorial & Reference" from Amazon (this link:

Re: Looking to get typeof parseXML return value

2021-09-07 Thread bauss via Digitalmars-d-learn
On Tuesday, 7 September 2021 at 08:27:33 UTC, JN wrote: On Tuesday, 7 September 2021 at 04:13:08 UTC, Chris Piker wrote: Like almost all new users to D I'm tripping over how to save and pass around variables since nothing has an understandable type anymore and you can't use "auto" for *class

Re: Module import incompatibility

2021-08-31 Thread bauss via Digitalmars-d-learn
On Tuesday, 31 August 2021 at 12:26:28 UTC, frame wrote: I'm sure it was asked before but can't find the thread: How to deal best with an older library that uses the same class name as module name? I get a lot of `Error: module ABC from file ...ABC.d must be imported with 'import ABC'` Do

Re: vibe.d: is it possible to use bare HTML with the functionalty of DIET templates ?

2021-08-31 Thread bauss via Digitalmars-d-learn
On Tuesday, 31 August 2021 at 00:09:14 UTC, someone wrote: Regarding vibe.d I think I'll give it a try (maybe placing it behind nginx at first) since I do really got a good first-impression ... kudos to the developers/maintainers :) I like the idea of having D at my disposal within a web

Re: vibe.d community/forum/whatever ?

2021-08-30 Thread bauss via Digitalmars-d-learn
On Monday, 30 August 2021 at 02:39:06 UTC, someone wrote: https://forum.rejectedsoftware.com/groups/rejectedsoftware.vibed/ I've been reading vibe.d tour and some documentation today to get some first impressions. https://vibed.org/community pointed to the link above ... but it seems it is

Re: foreach() behavior on ranges

2021-08-25 Thread bauss via Digitalmars-d-learn
On Tuesday, 24 August 2021 at 19:06:44 UTC, Alexandru Ermicioi wrote: On Tuesday, 24 August 2021 at 09:15:23 UTC, bauss wrote: A range should be a struct always and thus its state is copied when the foreach loop is created. Actually the range contracts don't mention that it needs to be a

Re: foreach() behavior on ranges

2021-08-24 Thread bauss via Digitalmars-d-learn
On Tuesday, 24 August 2021 at 08:36:18 UTC, frame wrote: Consider a simple input range that can be iterated with empty(), front() and popFront(). That is comfortable to use with foreach() but what if the foreach loop will be cancelled? If a range isn't depleted yet and continued it will supply

Re: Associative Array with double[][]

2021-07-22 Thread bauss via Digitalmars-d-learn
On Thursday, 22 July 2021 at 03:13:14 UTC, seany wrote: I have a perimeter of a shape, given by a `double [][]` . I want to keep the lengths of various diagonals in another associative array. So, /// define some associative array to keep track of diagonals here.. auto perimeter =

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

2021-07-21 Thread bauss via Digitalmars-d-learn
On Wednesday, 21 July 2021 at 03:25:03 UTC, apz28 wrote: VisualD project - Any hint to work around DMD version: DMD32 D Compiler v2.096.0-rc.1-dirty Copyright (C) 1999-2021 by The D Language Foundation, All Rights Reserved written by Walter Bright Failed Build Command line: dmd -release

Re: Method definition

2021-07-21 Thread bauss via Digitalmars-d-learn
On Wednesday, 21 July 2021 at 12:08:21 UTC, Tim Gunesh wrote: Is it possible to define methods outside the class in C ++ style? Something like this: ```d class Parent{ void Print(); } void Parent.Print(){ writeln("Hello, D!"); } ``` No and it doesn't make much sense to do so. The

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

2021-07-21 Thread bauss via Digitalmars-d-learn
On Tuesday, 20 July 2021 at 15:59:30 UTC, Dukc wrote: 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) {

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

2021-07-20 Thread bauss via Digitalmars-d-learn
On Tuesday, 20 July 2021 at 09:24:07 UTC, Mark Lagodych wrote: Let's say I have this code: ```d import std.stdio; class X { int x(int param) { static int myvar = 1234; if (param == 0) return myvar; else { myvar = param; return myvar; } } } void main() { X

Re: float price; if (price == float.nan) { // initialized } else { // uninitialized } ... valid ?

2021-07-08 Thread bauss via Digitalmars-d-learn
On Wednesday, 30 June 2021 at 16:41:40 UTC, someone wrote: On Wednesday, 30 June 2021 at 16:24:38 UTC, Andre Pany wrote: Side note: in case you want to work with money, you may consider using a specific data type like https://code.dlang.org/packages/money instead of float/double. Yes, I've

Re: float price; if (price == float.nan) { // initialized } else { // uninitialized } ... valid ?

2021-07-08 Thread bauss via Digitalmars-d-learn
On Wednesday, 30 June 2021 at 16:19:35 UTC, someone wrote: On Wednesday, 30 June 2021 at 10:38:05 UTC, jmh530 wrote: You've never given something away for free? ... more often than usual LoL Now, seriously, something for free has not a price = 0, it has NO price, that's what null is for;

vibe.d and video files?

2020-09-17 Thread bauss via Digitalmars-d-learn
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 configuration that needs to be enabled?

Re: vibe.d and my first web service

2020-07-19 Thread bauss via Digitalmars-d-learn
On Saturday, 18 July 2020 at 17:23:06 UTC, Mr. Backup wrote: On Saturday, 18 July 2020 at 12:16:09 UTC, Andre Pany wrote: On Saturday, 18 July 2020 at 09:10:04 UTC, Mr. Backup wrote: [...] I assume you are using vibe.d 0.8.4 or older. Please check whether adding this to dub.json solves your

Re: Vibe.d and NodeJs with Express

2020-07-14 Thread bauss via Digitalmars-d-learn
On Sunday, 12 July 2020 at 19:16:32 UTC, aberba wrote: 3) packages, now it might be better though. But I've always felt that there's not a lot of people using D for complete web dev projects... I'm one of the few but then again I don't use a lot of external packages either other than what

Re: constructing labels for static foreach inside switch inside foreach

2020-07-07 Thread bauss via Digitalmars-d-learn
On Wednesday, 8 July 2020 at 02:06:01 UTC, Steven Schveighoffer wrote: OK, so I have a situation where I'm foreaching over a compile-time list of types. Inside the loop, I'm using a second loop over a set of input. Inside that loop, I'm using a switch on the input, and inside the switch, I'm

Re: I want Sublime 3 D auto import !

2020-06-03 Thread bauss via Digitalmars-d-learn
On Wednesday, 3 June 2020 at 11:54:57 UTC, Виталий Фадеев wrote: On Tuesday, 2 June 2020 at 20:08:09 UTC, bauss wrote: What happens if you have the same symbol in multiple modules? Ex. two libraries that implement symbols with same name. First module will inserted. Is there a way to be

Re: I want Sublime 3 D auto import !

2020-06-02 Thread bauss via Digitalmars-d-learn
On Tuesday, 2 June 2020 at 06:00:10 UTC, Виталий Фадеев wrote: On Monday, 1 June 2020 at 18:55:03 UTC, Paul Backus wrote: On Monday, 1 June 2020 at 16:18:44 UTC, Виталий Фадеев wrote: I do it! https://github.com/vitalfadeev/SublimeDlangAutoImport What happens if you have the same symbol in

Re: How to get the pointer of "this" ?

2020-05-26 Thread bauss via Digitalmars-d-learn
On Tuesday, 26 May 2020 at 12:08:29 UTC, Johannes Loher wrote: On Tuesday, 26 May 2020 at 11:44:58 UTC, Vinod K Chandran wrote: On Monday, 25 May 2020 at 16:39:30 UTC, Mike Parker wrote: On Monday, 25 May 2020 at 08:39:23 UTC, John Burton wrote: I believe that in D *this* is a reference to

Re: How to get the pointer of "this" ?

2020-05-25 Thread bauss via Digitalmars-d-learn
On Monday, 25 May 2020 at 17:14:13 UTC, Vinod K Chandran wrote: On Monday, 25 May 2020 at 16:54:11 UTC, Mike Parker wrote: On Monday, 25 May 2020 at 16:26:31 UTC, Vinod K Chandran wrote: [...] The error has nothing to do with taking a pointer to `this`. It's suggesting that somewhere in

Re: How to get the pointer of "this" ?

2020-05-24 Thread bauss via Digitalmars-d-learn
On Sunday, 24 May 2020 at 17:05:16 UTC, Vinod K Chandran wrote: Hi all, I have a class like this. class Button : Control { ... HWND createButton(){ ... SetWindowSubclass(this.mHandle, SUBCLASSPROC(), UINT_PTR(subClsID), cast(DWORD_PTR) this); } } But

Re: Variable "i" can not be read at compile time

2020-05-24 Thread bauss via Digitalmars-d-learn
On Sunday, 24 May 2020 at 17:13:23 UTC, data pulverizer wrote: On Sunday, 24 May 2020 at 16:57:54 UTC, ag0aep6g wrote: On 24.05.20 18:34, data pulverizer wrote: Since `kernel` is a `Tuple`, you can only access it with compile-time constant indices. But your loop variable `i` is not a

Re: Using Vibe.d for not HTTP

2020-05-24 Thread bauss via Digitalmars-d-learn
On Sunday, 24 May 2020 at 08:10:33 UTC, Russel Winder wrote: Hi, Clearly Vibe.d is mostly for people doing HTTP and HTTPS stuff. Yet it claims to be able to support TCP and UDP working with other protocols. However, all the serious examples are HTTP/HTTPS related. All the TCP and UDP

Re: Distinguish between a null array and an empty array

2020-05-24 Thread bauss via Digitalmars-d-learn
On Sunday, 24 May 2020 at 12:26:42 UTC, ag0aep6g wrote: On 24.05.20 14:12, bauss wrote: Is there a way to do that? Since the following are both true: int[] a = null; int[] b = []; assert(a is null); assert(!a.length); assert(b is null); assert(!b.length); What I would like is to tell that

Re: Distinguish between a null array and an empty array

2020-05-24 Thread bauss via Digitalmars-d-learn
On Sunday, 24 May 2020 at 12:12:31 UTC, bauss wrote: Is there a way to do that? Since the following are both true: int[] a = null; int[] b = []; assert(a is null); assert(!a.length); assert(b is null); assert(!b.length); What I would like is to tell that b is an empty array and a is a null

Distinguish between a null array and an empty array

2020-05-24 Thread bauss via Digitalmars-d-learn
Is there a way to do that? Since the following are both true: int[] a = null; int[] b = []; assert(a is null); assert(!a.length); assert(b is null); assert(!b.length); What I would like is to tell that b is an empty array and a is a null array.

Re: Learning Vibe.d

2020-05-23 Thread bauss via Digitalmars-d-learn
On Saturday, 23 May 2020 at 17:57:22 UTC, Russel Winder wrote: On Sat, 2020-05-23 at 16:56 +, bauss via Digitalmars-d-learn wrote: […] Had similar experiences on non-windows platforms. I forgot to mention I was on Linux (Debian Sid). I am (sort of) pleased it isn't just me – definitely

Re: Learning Vibe.d

2020-05-23 Thread bauss via Digitalmars-d-learn
On Saturday, 23 May 2020 at 15:47:59 UTC, Russel Winder wrote: Hi, I thought I would try and do the async version of my mock AVR850 using the vibe.d TCP stuff. This is not HTTP, it is proper networking! ;-) Problem one is that vibe.d sever processes never seem to terminate. I am using

std.container.array pointer

2020-05-23 Thread bauss via Digitalmars-d-learn
Is it possible to have a pointer to a nogc array? Like for regular arrays you can just do .ptr How would you do the same for a nogc array? The reason is I need to read different types of values from a nogc byte array. Ex. reading an int at offset 12 of the array. With normal arrays it can

to but nothrow?

2020-05-22 Thread bauss via Digitalmars-d-learn
Is there anyway to use the "to" template from std.conv but as nothrow? Having it throw exceptions is not always acceptable because it's generally expensive. Something that attempted to convert would be far more fesible. Is there anything like that? Ex. from C# there's int.TryParse etc.

Re: D and Async I/O

2020-05-11 Thread bauss via Digitalmars-d-learn
On Monday, 11 May 2020 at 14:02:54 UTC, Russel Winder wrote: OK, so I need to create an asynchronous TCP server (not HTTP or HTTPS, this is a real server ;-) ). I think the normal response is "Use Vibe.d". However, recently I see Hunt is an alternative. Has anyone any way of choosing between

Re: Why does indexing a string inside of a recursive call yield a different result?

2020-05-10 Thread bauss via Digitalmars-d-learn
On Sunday, 10 May 2020 at 10:02:18 UTC, Adnan wrote: In my naive implementation of edit-distance finder, I have to check whether the last characters of two strings match: ulong editDistance(const string a, const string b) { if (a.length == 0) return b.length; if (b.length ==

Re: Is is a Bug or just me?

2020-05-09 Thread bauss via Digitalmars-d-learn
On Friday, 8 May 2020 at 14:16:10 UTC, foerdi wrote: Hi d community, I got a strange behavior since dmd 2.090 (dmd 2.089 is the last working version). See this reduced code: https://run.dlang.io/is/yoyHXC I would expect that foo() returns 2. My guess in foo is: The return value of val is

Re: Get months / years between two dates.

2020-05-09 Thread bauss via Digitalmars-d-learn
On Thursday, 7 May 2020 at 11:40:36 UTC, WebFreak001 wrote: 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

Re: Get months / years between two dates.

2020-05-06 Thread bauss via Digitalmars-d-learn
On Wednesday, 6 May 2020 at 19:58:59 UTC, Adam D. Ruppe wrote: On Wednesday, 6 May 2020 at 19:51:01 UTC, bauss wrote: How will I get the months or years between the two dates? What's the length of a month or a year? That's the tricky part - they have variable lengths. So a difference of one

Get months / years between two dates.

2020-05-06 Thread bauss via Digitalmars-d-learn
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 months or years. I can't seem to find any standard way

Re: .get refuses to work on associative array

2020-04-15 Thread bauss via Digitalmars-d-learn
On Wednesday, 15 April 2020 at 22:09:32 UTC, H. S. Teoh wrote: On Wed, Apr 15, 2020 at 09:46:58PM +, p.shkadzko via Digitalmars-d-learn wrote: I am quite confused by the following exception during dub build: > dub build --single demo.d --compiler=ldc2 --force Performing "debug" build

Re: Swedish letters fuck up parsing into SQL querry

2020-03-23 Thread bauss via Digitalmars-d-learn
On Monday, 23 March 2020 at 14:26:46 UTC, Anders S wrote: On Monday, 23 March 2020 at 13:53:50 UTC, Adam D. Ruppe wrote: My first thought is to!string(cellTab[CellIndex].name) is wrong, if it is a char[20] you should be scanning it to find the length and slicing. Maybe [0 ..

Re: Best way to learn 2d games with D?

2020-03-17 Thread bauss via Digitalmars-d-learn
On Tuesday, 17 March 2020 at 23:09:32 UTC, Dennis wrote: On Tuesday, 17 March 2020 at 22:47:43 UTC, Sebastiaan Koppe wrote: Dont trust that marketing, there is actually decent scripting in gamemaker, which you'll need if you get creative. Second that. GameMaker is how I got into programming

Re: Best way to learn 2d games with D?

2020-03-15 Thread bauss via Digitalmars-d-learn
On Monday, 16 March 2020 at 02:52:56 UTC, Mike Parker wrote: On Sunday, 15 March 2020 at 18:14:44 UTC, bauss wrote: I would recommend using Derelict and SDL with D since it's the most mature. Please don't recommend Derelict to anyone :-) bindbc-sdl is what folks should be using now. I'm

Re: Best way to learn 2d games with D?

2020-03-15 Thread bauss via Digitalmars-d-learn
On Sunday, 15 March 2020 at 17:58:58 UTC, Steven Schveighoffer wrote: I want to try and learn how to write 2d games. I'd prefer to do it with D. I've found a ton of tutorials on learning 2d gaming with other languages. Is there a place to look that uses D for learning? Should I just start

Re: D create many thread

2020-02-06 Thread bauss via Digitalmars-d-learn
On Thursday, 6 February 2020 at 22:00:26 UTC, tchaloupka wrote: On Wednesday, 5 February 2020 at 13:05:59 UTC, Eko Wahyudin wrote: Hi all, I'm create a small (hallo world) application, with DMD. But my program create 7 annoying threads when create an empty class. If you don't want the

Re: How do I fix my failed PRs?

2020-02-02 Thread bauss via Digitalmars-d-learn
On Sunday, 2 February 2020 at 12:49:31 UTC, MoonlightSentinel wrote: On Sunday, 2 February 2020 at 08:54:02 UTC, mark wrote: However, four have not been accepted, apparently for technical reasons. But I don't understand what's wrong or what I need to do to fix them. (I'm not very knowledgeable

Re: How do I fix my failed PRs?

2020-02-02 Thread bauss via Digitalmars-d-learn
On Sunday, 2 February 2020 at 08:54:02 UTC, mark wrote: I've done quite a few small corrections/improvements to the D-tour's English. Almost all have been accepted. However, four have not been accepted, apparently for technical reasons. But I don't understand what's wrong or what I need to

Re: Constant GC allocations when sending large messages to threads?

2020-01-31 Thread bauss via Digitalmars-d-learn
On Friday, 31 January 2020 at 07:14:30 UTC, cc wrote: On Wednesday, 29 January 2020 at 21:10:53 UTC, Steven Schveighoffer wrote: I'm pretty sure std.concurrency uses Variant to pass message data, which boxes when it gets over a certain size. You are probably crossing that threshold. The

Re: format with floating points GC allocating in DMD 2.090

2020-01-31 Thread bauss via Digitalmars-d-learn
On Friday, 31 January 2020 at 07:20:17 UTC, cc wrote: char[4096] buf; writeln(GC.stats.usedSize); foreach (i; 0 .. 10) { sformat(buf, "%f", 1.234f); writeln(GC.stats.usedSize); } Output with DMD32 D Compiler v2.089.1-dirty (Win10

Re: How change window Backgound Color when press a Button when using "ResEdit Resource Editor" to design?

2020-01-29 Thread bauss via Digitalmars-d-learn
On Thursday, 30 January 2020 at 03:49:29 UTC, Marcone wrote: I created a GUI using "ResEdit Resource Editor" and embeded to Dlang using this code above. Now I want to change the window Backgound Color when press a Button. How can I make it? You need to handle WM_ERASEBKGND And then you

Re: Blog Post #0096: Hardware III - Keyboard and Mouse

2019-12-31 Thread bauss via Digitalmars-d-learn
On Tuesday, 31 December 2019 at 09:27:44 UTC, Ron Tarrant wrote: This week's post wraps up the year by looking at how to access keyboard and mouse events through the hardware Seat. You'll find it here: https://gtkdcoding.com/2019/12/31/0096-hardware-iii-keyboard-pointer.html Have a happy New

Re: D vs Java which is more powerful

2019-11-16 Thread bauss via Digitalmars-d-learn
On Saturday, 16 November 2019 at 07:24:50 UTC, GreatSam4sure wrote: According to this [1] a person that java is much more powerful than D. I am really surprised at this claim. Is this true? Because I believe D much more powerful than Java. I will really appreciate detail analysis

Re: Is there any writeln like functions without GC?

2019-11-11 Thread bauss via Digitalmars-d-learn
On Saturday, 9 November 2019 at 22:03:03 UTC, Ferhat Kurtulmuş wrote: On Thursday, 31 October 2019 at 03:56:56 UTC, lili wrote: Hi: why writeln need GC? Upon this post, I thought writing a gc-free writeln would be a good learning practice. Although it is not a feature-complete one, it

Re: Blog Post #0062: Cairo Load & Display Images

2019-08-17 Thread bauss via Digitalmars-d-learn
On Saturday, 17 August 2019 at 19:22:54 UTC, Ron Tarrant wrote: On Friday, 16 August 2019 at 12:44:15 UTC, bauss wrote: Amazing! You might be able to answer me something, whether you could use gtkd solely for image manipulation using ex. Pixbuf? or would it only work with the internals of

Re: Blog Post #0062: Cairo Load & Display Images

2019-08-16 Thread bauss via Digitalmars-d-learn
On Friday, 16 August 2019 at 11:42:01 UTC, Ron Tarrant wrote: Continuing on with Cairo, this post covers loading and displaying three types of image (including a structured drawing) using two different load-n-display methods. As an extra bonus, you'll see a photo of my cat, Bob, and three of

Re: Cannot take the .keys of shared AA. Is this a regression in 2.087 or a feature?

2019-08-15 Thread bauss via Digitalmars-d-learn
On Thursday, 15 August 2019 at 19:51:30 UTC, Jonathan M Davis wrote: n Thursday, August 15, 2019 11:33:06 AM MDT Piotr Mitana via Digitalmars-d- learn wrote: Code: import std; shared(string[string]) dict; void main() { dict.keys; } Error:

Re: Speed of Random Numbers

2019-08-03 Thread bauss via Digitalmars-d-learn
On Saturday, 3 August 2019 at 17:47:46 UTC, Giovanni Di Maria wrote: On Saturday, 3 August 2019 at 17:44:44 UTC, lithium iodate wrote: On Saturday, 3 August 2019 at 16:35:34 UTC, Giovanni Di Maria wrote: [...] First off you could try to use a faster RNG engine than the default. The easiest

Re: Is there a way to adjust lookup paths for modules during compilation?

2019-07-31 Thread bauss via Digitalmars-d-learn
On Wednesday, 31 July 2019 at 17:29:58 UTC, Andrey Zherikov wrote: I want my program to add some directories into module lookup process (like adding -I dmd options). List of directories is known at compile time but the choice of what exact directories to add depends on `-version` parameter.

Re: vibe / self contained standalone executable?

2019-07-28 Thread bauss via Digitalmars-d-learn
On Sunday, 28 July 2019 at 18:54:37 UTC, Sebastiaan Koppe wrote: On Sunday, 28 July 2019 at 14:42:48 UTC, Robert M. Münch wrote: On 2019-07-28 14:14:06 +, Sebastiaan Koppe said: I am using https://dlang.org/spec/expression.html#import_expressions for text files. Don't know if it works on

Re: vibe / self contained standalone executable?

2019-07-28 Thread bauss via Digitalmars-d-learn
On Sunday, 28 July 2019 at 14:14:06 UTC, Sebastiaan Koppe wrote: On Sunday, 28 July 2019 at 13:45:50 UTC, Robert M. Münch wrote: Is it possible to pack a complete "web-app" (serving web-pages and providing REST API) into a single executable so that no other files need to be accessed and

Re: Is betterC affect to compile time?

2019-07-25 Thread bauss via Digitalmars-d-learn
On Thursday, 25 July 2019 at 18:06:02 UTC, Jonathan Marler wrote: On Thursday, 25 July 2019 at 12:46:48 UTC, Oleg B wrote: On Thursday, 25 July 2019 at 12:34:15 UTC, rikki cattermole wrote: Those restrictions don't stop at runtime. It's vary sad. What reason for such restrictions? It's

Re: Mixin mangled name

2019-07-02 Thread bauss via Digitalmars-d-learn
On Monday, 1 July 2019 at 23:52:49 UTC, Andrey wrote: Hello, Is it possible to mixin in code a mangled name of some entity so that compiler didn't emit undefined symbol error? For example mangled function name or template parameter? Perhaps: https://dlang.org/spec/pragma.html#mangle

Re: dll

2019-06-27 Thread bauss via Digitalmars-d-learn
On Thursday, 27 June 2019 at 16:56:00 UTC, fred wrote: https://forum.dlang.org/thread/osnema$d5s$1...@digitalmars.com dll support is it ok now? i cant find the docs on thatm Not much better.

Re: Create empty SList or DList.

2019-06-26 Thread bauss via Digitalmars-d-learn
On Wednesday, 26 June 2019 at 19:06:24 UTC, drug wrote: 26.06.2019 20:39, bauss пишет: auto stack = SList!int(0); stack.removeFront(); Then something that just allowed you to do: auto stack = SList!int; this compiles: ``` auto stack = SList!int(); ``` Maybe something else triggered it for

Create empty SList or DList.

2019-06-26 Thread bauss via Digitalmars-d-learn
Is there a way to achieve that instead of something hacky like adding an initialized element and then removing it. Ex. instead of: auto stack = SList!int(0); stack.removeFront(); Then something that just allowed you to do: auto stack = SList!int; // Not allowed. --- I feel like this makes

Re: bug in compiles?

2019-04-11 Thread bauss via Digitalmars-d-learn
On Thursday, 11 April 2019 at 18:13:48 UTC, Alex wrote: The following code works when I comment out the static if //static if (__traits(compiles, __traits(getAttributes, T))) static foreach(a; __traits(getAttributes, T)) Attributes ~= There seems to be absolutely no reason why this code

Re: Iterate/sort associative array by value?

2019-04-07 Thread bauss via Digitalmars-d-learn
On Sunday, 7 April 2019 at 16:44:01 UTC, Robert M. Münch wrote: On 2019-04-07 16:24:52 +, Cym13 said: You could use sort to gather the indexes in order then traverse from there: aa.byKey.array.sort!((a, b) => aa[a] That doesn't work: Error: no property array for type Result With

Re: What's the correct way to interface with a intptr_t?

2019-04-07 Thread bauss via Digitalmars-d-learn
On Sunday, 7 April 2019 at 13:45:15 UTC, Paul Backus wrote: On Sunday, 7 April 2019 at 12:19:10 UTC, bauss wrote: On Saturday, 6 April 2019 at 20:16:06 UTC, Paul Backus wrote: On Saturday, 6 April 2019 at 19:31:15 UTC, Robert M. Münch wrote: I have a C interface that uses a parameter of type

Re: == comparison of string literals, and their usage

2019-04-07 Thread bauss via Digitalmars-d-learn
On Saturday, 6 April 2019 at 19:47:14 UTC, lithium iodate wrote: On Saturday, 6 April 2019 at 15:35:22 UTC, diniz wrote: So, I still could store and use and compare string pointers myself [1], and get valid results, meaning: pointer equality implies (literal) string equality. Or am I wrong?

Re: What's the correct way to interface with a intptr_t?

2019-04-07 Thread bauss via Digitalmars-d-learn
On Saturday, 6 April 2019 at 20:16:06 UTC, Paul Backus wrote: On Saturday, 6 April 2019 at 19:31:15 UTC, Robert M. Münch wrote: I have a C interface that uses a parameter of type intptr_t. Wondering if size_t is the correct D equivalent? The correct equivalent is `intptr_t` from

Re: why is ifThrown un@safe?

2019-03-15 Thread bauss via Digitalmars-d-learn
On Friday, 15 March 2019 at 18:04:05 UTC, Bastiaan Veelo wrote: In the code below (https://run.dlang.io/is/d0oTNi), ifThrown is inferred as un@safe. If instead I write the implementation of ifThrown out (after res2) then it is @safe. As far as I can see, there is no real difference. So why

Re: Simplifying a string mixin

2019-02-26 Thread bauss via Digitalmars-d-learn
On Monday, 25 February 2019 at 21:04:48 UTC, Adam D. Ruppe wrote: On Monday, 25 February 2019 at 20:57:37 UTC, Victor Porton wrote: Can string mixing be split into several parts? I have a mixin like this: mixin("struct " ~ name ~ " {\n" ~ " struct Regular {\n" ~ "

Re: variant .init value

2019-02-07 Thread bauss via Digitalmars-d-learn
On Thursday, 7 February 2019 at 07:33:50 UTC, Norm wrote: Hi, I'm trying to use Variant in a struct and want a default init value like so: --- struct S { Variant v = Variant(10); } void main() {auto s = S();} but when I try to build this I get the following error:

Re: Singleton in Action?

2019-02-04 Thread bauss via Digitalmars-d-learn
On Saturday, 2 February 2019 at 16:56:45 UTC, Ron Tarrant wrote: Hi guys, I ran into another snag this morning while trying to implement a singleton. I found all kinds of examples of singleton definitions, but nothing about how to put them into practice. Can someone show me a code example

Re: crashing with no stack trace, why?

2019-01-31 Thread bauss via Digitalmars-d-learn
On Thursday, 31 January 2019 at 11:09:56 UTC, DanielG wrote: I have a program that was crashing due to a "Conversion positive overflow", specifically calling .to!int on a too-large unsigned value. However it was simply crashing with an exit code (-1073740771 / ‭0xC41D‬), and I was having

  1   2   3   4   5   >