Re: Detecting performance pitfall in array access

2020-05-18 Thread Adnan via Digitalmars-d-learn
On Sunday, 17 May 2020 at 11:39:30 UTC, kinke wrote: As a side note, using jagged arrays for multiple dimensions should probably be avoided whenever you can. By jagged array, do you mean vector of vectors? What would be an alternative?

Re: Detecting performance pitfall in array access

2020-05-18 Thread Adnan via Digitalmars-d-learn
On Sunday, 17 May 2020 at 09:41:55 UTC, Johan wrote: On Sunday, 17 May 2020 at 03:30:57 UTC, Adnan wrote: Hello, I am trying to examine what causes my similar D solution to lag behind performance. In the link, they don't have ldc or gdc but according to my machine, the dmd generated code

Re: undefined reference to 'deflateEnd'

2020-05-18 Thread ikod via Digitalmars-d-learn
On Monday, 18 May 2020 at 05:01:45 UTC, Andre Pany wrote: Hi, I have some issues, the get this program working on ubuntu: ``` Dockerfile FROM ubuntu:focal RUN apt-get update && apt-get upgrade -y \ && apt-get install --no-install-recommends -y build-essential ldc dub zlib1g-dev COPY

Re: undefined reference to 'deflateEnd'

2020-05-18 Thread Andre Pany via Digitalmars-d-learn
On Monday, 18 May 2020 at 06:02:03 UTC, ikod wrote: NAME="Ubuntu" VERSION="18.04.4 LTS (Bionic Beaver)" [...] Thanks a lot. Kind regards André

Re: undefined reference to 'deflateEnd'

2020-05-18 Thread ikod via Digitalmars-d-learn
On Monday, 18 May 2020 at 07:33:29 UTC, Andre Pany wrote: On Monday, 18 May 2020 at 06:02:03 UTC, ikod wrote: NAME="Ubuntu" VERSION="18.04.4 LTS (Bionic Beaver)" [...] Thanks a lot. Kind regards André Just discovered that we can import etc.c.zlib and use low level zlib directly

Re: D, Unit_Threaded, and GtkD

2020-05-18 Thread Russel Winder via Digitalmars-d-learn
On Sun, 2020-05-17 at 20:32 +, Luis via Digitalmars-d-learn wrote: > On Sunday, 17 May 2020 at 10:19:38 UTC, Russel Winder wrote: > > I am experimenting with using manual control of the Glib event > > loop using the pending and iteration methods on the default > > MainContext within each

Re: any chance to get it working on windows xp?

2020-05-18 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, May 17, 2020 11:36:01 PM MDT Mike Parker via Digitalmars-d-learn wrote: > Unfortunately, the minimum Windows version "officially" supported > is Windows 7: > > https://forum.dlang.org/post/ktfgps$2ghh$1...@digitalmars.com > > With no testing on XP, you are bound to run into

Re: How to get rid of "nothrow" ?

2020-05-18 Thread Vinod K Chandran via Digitalmars-d-learn
On Sunday, 17 May 2020 at 19:37:05 UTC, drug wrote: 17.05.2020 17:35, Vinod K Chandran пишет: It worked. Thanks :) I have one more question. Which is better, to include all the switch cases inside a single try catch or write separate try catch for each switch cases ? all the switch cases

Re: Spawn a Command Line application Window and output log information

2020-05-18 Thread BoQsc via Digitalmars-d-learn
On Monday, 18 May 2020 at 18:10:06 UTC, BoQsc wrote: Also, if you want some kind of Fancy ASCII art in your application Since I started this thread, I might share some more improvements. In this Update I managed to get the PID of the current process and in the future I hope the HelloWorld

Re: None of the overloads of kill are callable using argument types:

2020-05-18 Thread Adam D. Ruppe via Digitalmars-d-learn
On Monday, 18 May 2020 at 20:11:25 UTC, BoQsc wrote: I'm trying to kill my own process Don't kill yourself, just `return` from main.

None of the overloads of kill are callable using argument types:

2020-05-18 Thread BoQsc via Digitalmars-d-learn
I'm trying to kill my own process, but I'm being unsuccessful at the compilation of the program. It seems that neither getpid nor thisProcessID returns a correct type value for the kill function. HelloWorld.d(24): Error: none of the overloads of kill are callable using argument types (int),

Re: After compiling Hello World with DMD Compiler, .EXE file takes 1-3 seconds to run for the first time

2020-05-18 Thread BoQsc via Digitalmars-d-learn
On Monday, 18 May 2020 at 15:49:06 UTC, Adam D. Ruppe wrote: On Monday, 18 May 2020 at 15:47:40 UTC, BoQsc wrote: It seems strange that on the first run after D language compilation. Hello World program takes 1-3 seconds to launch. That's the Windows virus scanner again. It sees D programs

Re: Spawn a Command Line application Window and output log information

2020-05-18 Thread Panke via Digitalmars-d-learn
On Monday, 18 May 2020 at 16:36:11 UTC, BoQsc wrote: I'd like to have application as small as possible with a simple Command Line Window. I'd use that Window to output notices, log information and the like. Would this require GUI library and how can this be achieved? If you do not want to

Re: Spawn a Command Line application Window and output log information

2020-05-18 Thread Kagamin via Digitalmars-d-learn
On Monday, 18 May 2020 at 17:02:02 UTC, BoQsc wrote: The important question is: how can we change the name/title of this Command Line application. As the simplest solution, you can set the window title in shortcut properties.

Re: After compiling Hello World with DMD Compiler, .EXE file takes 1-3 seconds to run for the first time

2020-05-18 Thread kinke via Digitalmars-d-learn
On Monday, 18 May 2020 at 15:49:06 UTC, Adam D. Ruppe wrote: It sees D programs as unusual and gives them additional scrutiny... Is that really the case for all D programs on Windows, or just those built with -m32 and thus using the exotic DigitalMars C runtime?

Re: Spawn a Command Line application Window and output log information

2020-05-18 Thread BoQsc via Digitalmars-d-learn
On Monday, 18 May 2020 at 17:08:41 UTC, Kagamin wrote: On Monday, 18 May 2020 at 17:02:02 UTC, BoQsc wrote: The important question is: how can we change the name/title of this Command Line application. As the simplest solution, you can set the window title in shortcut properties. It seems

Re: Spawn a Command Line application Window and output log information

2020-05-18 Thread BoQsc via Digitalmars-d-learn
On Monday, 18 May 2020 at 17:51:54 UTC, BoQsc wrote: On Monday, 18 May 2020 at 17:20:17 UTC, BoQsc wrote: It would be great if we could change/customise the icon of the Command line application that run the HelloWorld application. But I have a bad feeling that it is probably not possible

Re: Spawn a Command Line application Window and output log information

2020-05-18 Thread BoQsc via Digitalmars-d-learn
On Monday, 18 May 2020 at 16:40:24 UTC, Panke wrote: On Monday, 18 May 2020 at 16:36:11 UTC, BoQsc wrote: I'd like to have application as small as possible with a simple Command Line Window. I'd use that Window to output notices, log information and the like. Would this require GUI library

Re: Spawn a Command Line application Window and output log information

2020-05-18 Thread BoQsc via Digitalmars-d-learn
On Monday, 18 May 2020 at 17:20:17 UTC, BoQsc wrote: It would be great if we could change/customise the icon of the Command line application that run the HelloWorld application. But I have a bad feeling that it is probably not possible without a GUI library. Forever thankful to Adam D. Ruppe

Re: Spawn a Command Line application Window and output log information

2020-05-18 Thread Kagamin via Digitalmars-d-learn
On Monday, 18 May 2020 at 17:20:17 UTC, BoQsc wrote: It would be great if we could change/customise the icon of the Command line application that run the HelloWorld application. But I have a bad feeling that it is probably not possible without a GUI library. I think the window icon is just

Spawn a Command Line application Window and output log information

2020-05-18 Thread BoQsc via Digitalmars-d-learn
I'd like to have application as small as possible with a simple Command Line Window. I'd use that Window to output notices, log information and the like. Would this require GUI library and how can this be achieved?

Re: Spawn a Command Line application Window and output log information

2020-05-18 Thread Adam D. Ruppe via Digitalmars-d-learn
On Monday, 18 May 2020 at 16:36:11 UTC, BoQsc wrote: Would this require GUI library and how can this be achieved? you might enjoy using my terminal lib https://code.dlang.org/packages/arsd-official%3Aterminal include that and set "subConfigurations": { "arsd-official:terminal":

Re: any chance to get it working on windows xp?

2020-05-18 Thread a beginner via Digitalmars-d-learn
Thanks to all of you for support. On Sunday, 17 May 2020 at 22:37:14 UTC, Seb wrote: Alternatively, if you have a working compiler building dub from scratch isn't hard. You just need to clone the repo and run the build script (build.bat in your case). Good luck! I recompiled latest dub 1.21

After compiling Hello World with DMD Compiler, .EXE file takes 1-3 seconds to run for the first time

2020-05-18 Thread BoQsc via Digitalmars-d-learn
I use Windows 10. I tried exactly like mentioned here: http://ddili.org/ders/d.en/hello_world.html It seems strange that on the first run after D language compilation. Hello World program takes 1-3 seconds to launch. While C Hello World program simply executes in a second or less. Why is

Re: Compare string with German umlauts

2020-05-18 Thread Steven Schveighoffer via Digitalmars-d-learn
On 5/18/20 9:44 AM, Martin Tschierschke wrote: Hi, I have to find a certain line in a file, with a text containing umlauts. How do you do this? The following was not working: foreach(i,line; file){  if(line=="My text with ö oe, ä ae or ü"){    writeln("found it at line",i)  } } I ended up

Re: Compare string with German umlauts

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

Compare string with German umlauts

2020-05-18 Thread Martin Tschierschke via Digitalmars-d-learn
Hi, I have to find a certain line in a file, with a text containing umlauts. How do you do this? The following was not working: foreach(i,line; file){ if(line=="My text with ö oe, ä ae or ü"){ writeln("found it at line",i) } } I ended up using line.canFind("with part of the text

Re: After compiling Hello World with DMD Compiler, .EXE file takes 1-3 seconds to run for the first time

2020-05-18 Thread Adam D. Ruppe via Digitalmars-d-learn
On Monday, 18 May 2020 at 15:47:40 UTC, BoQsc wrote: It seems strange that on the first run after D language compilation. Hello World program takes 1-3 seconds to launch. That's the Windows virus scanner again. It sees D programs as unusual and gives them additional scrutiny... You can set

Re: D and Async I/O

2020-05-18 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Thursday, 14 May 2020 at 09:36:33 UTC, Russel Winder wrote: Whilst C frameworks use callbacks and trampolines, high level languages seem to be basing things on futures – or things that are effectively isomorphic to futures. What I find most lacking is proper cancellation. Also, futures

Re: After compiling Hello World with DMD Compiler, .EXE file takes 1-3 seconds to run for the first time

2020-05-18 Thread Adam D. Ruppe via Digitalmars-d-learn
On Monday, 18 May 2020 at 16:01:14 UTC, kinke wrote: Is that really the case for all D programs on Windows, or just those built with -m32 and thus using the exotic DigitalMars C runtime? -m32mscoff does it too, and -m64 has a slight delay as well (though possible that's just a cold disk

Re: None of the overloads of kill are callable using argument types:

2020-05-18 Thread Ali Çehreli via Digitalmars-d-learn
On 5/18/20 1:11 PM, BoQsc wrote:> I'm trying to kill my own process, but I'm being unsuccessful at the > compilation of the program. It seems that neither getpid nor > thisProcessID returns a correct type value for the kill function. Of course, Adam D. Ruppe is right: You can simply return from

Re: any chance to get it working on windows xp?

2020-05-18 Thread rikki cattermole via Digitalmars-d-learn
On 19/05/2020 12:51 AM, a beginner wrote: @rikki cattermole Dmd and ldc's codegen haven't stood still for 10 years. They both will be emitting instructions your cpu cannot handle. Hence crashes. So... was I wrong to assume it generates code for the cpu it's running on (a P4 Northwood in my

Is it possible to implement operators as ordinary functions?

2020-05-18 Thread data pulverizer via Digitalmars-d-learn
I was wandering if it possible to implement operators as ordinary functions instead of as member functions of a class or struct for example something like this: ``` import std.stdio: writeln; struct Int{ int data = 0; } Int opBinary(string op)(Int x1, Int x2) { static if((op == "+") ||

Re: Is it possible to implement operators as ordinary functions?

2020-05-18 Thread data pulverizer via Digitalmars-d-learn
On Tuesday, 19 May 2020 at 02:42:22 UTC, Adam D. Ruppe wrote: On Tuesday, 19 May 2020 at 02:36:24 UTC, data pulverizer wrote: I was wandering if it possible to implement operators as ordinary functions instead of as member functions of a class or struct for example something like this: nope,

Re: Is it possible to implement operators as ordinary functions?

2020-05-18 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 19 May 2020 at 02:36:24 UTC, data pulverizer wrote: I was wandering if it possible to implement operators as ordinary functions instead of as member functions of a class or struct for example something like this: nope, it must be done as member functions.

Re: How to get rid of "nothrow" ?

2020-05-18 Thread drug via Digitalmars-d-learn
On 5/18/20 11:47 PM, Vinod K Chandran wrote: On Sunday, 17 May 2020 at 19:37:05 UTC, drug wrote: 17.05.2020 17:35, Vinod K Chandran пишет: It worked. Thanks :) I have one more question. Which is better, to include all the switch cases inside a single try catch or write separate try catch

Re: link error on Windows

2020-05-18 Thread Joel via Digitalmars-d-learn
I tried with DMD32 D Compiler v2.088.1-dirty, and it compiled and created an exe file, but not run (msvcr100.dll not found - and tried to find it on the net without success).