Re: How to link a msvcr120.dll in an inverse recursive way after a Windows .exe binary deployment

2022-09-05 Thread BoQsc via Digitalmars-d-learn
On Sunday, 4 September 2022 at 22:05:24 UTC, ShadoLight wrote: On Sunday, 4 September 2022 at 15:16:47 UTC, BoQsc wrote: **Folder structure** .\msvcr120.dll .\folder1\HelloWorld.exe .\folder2\HelloWorld.exe You don't need to do this. msvcr120.dll is already shipped with the DMD compiler

How to link a msvcr120.dll in an inverse recursive way after a Windows .exe binary deployment

2022-09-04 Thread BoQsc via Digitalmars-d-learn
![HelloWorld](https://i.imgur.com/5BjVIU9.png) **Folder structure** .\msvcr120.dll .\folder1\HelloWorld.exe .\folder2\HelloWorld.exe Basic binaries produced by DMD.exe compiler require Microsoft Compiler Runtime DLL As you might know that a basic D Language example `HelloWorld.exe`

Importing module from the perspective of submodule.

2022-07-02 Thread BoQsc via Digitalmars-d-learn
Is it possible to import module that is not in the module's current directory's folder or subfolders? For example: I want to import `somemodule2.d` and `somemodule3.d` into a **`somemodule.d`** **.\somefolder\somemodule.d** .\somemodule2.d .\someotherfolder\somemodule3.d

What exact debugging information is added to the binary and how to parse it all?

2022-05-13 Thread BoQsc via Digitalmars-d-learn
Haven't used debuggers or debugged a lot just yet, but I've had this question in my mind and I'd like to inspect some debugging information manually. Are there some kind of documentation or specification and are there a lot of information that is hidden in a an average "debuggable" binary?

Re: DUB issues

2022-04-18 Thread BoQsc via Digitalmars-d-learn
On Monday, 18 April 2022 at 05:27:32 UTC, Danny Arends wrote: Hey All, For some reason I cannot reset my password to get into dub (https://code.dlang.org/), after trying I never receive the email to reset my password. I was unsure at first if I had signed up at all, but trying to make a

Collect the arguments of all the function calls at a compile time in the whole program.

2022-04-15 Thread BoQsc via Digitalmars-d-learn
Let's say I have this example program. I want to get the arguments of all the `some_function();` in the whole program. **Even if the scope of the function call is never executed.** (Ex. due to IF statement being negative.) I tried to use `__traits` but it seems to not gather any information

Re: A weird example of .toUTF16z concatination side-effects in wcsncat

2022-04-07 Thread BoQsc via Digitalmars-d-learn
On Thursday, 7 April 2022 at 12:51:26 UTC, Stanislav Blinov wrote: On Thursday, 7 April 2022 at 10:50:35 UTC, BoQsc wrote: wchar_t* clang_string = cast(wchar_t *)"AA"; You're witnessing undefined behavior. "AA" is a string literal and is stored in the data

Re: A weird example of .toUTF16z concatination side-effects in wcsncat

2022-04-07 Thread BoQsc via Digitalmars-d-learn
On Thursday, 7 April 2022 at 11:03:39 UTC, Tejas wrote: On Thursday, 7 April 2022 at 10:50:35 UTC, BoQsc wrote: Here I try to concatenate three character strings using `wcsncat()`. [...] Maybe try using `wstring` instead of string? Also use the `w` postfix ```d wstring dlang_string =

A weird example of .toUTF16z concatination side-effects in wcsncat

2022-04-07 Thread BoQsc via Digitalmars-d-learn
Here I try to concatenate three character strings using `wcsncat()`. `clang_string` AA `dlang_string` BBB `winpointer_to_string` CC ``` import std.stdio; @system void main(){ import std.utf: toUTF16z, toUTF16; import

How to print or check if a string is "\0" (null) terminated in the D programming language?

2022-04-06 Thread BoQsc via Digitalmars-d-learn
I have a feeling that some parts of my code contains unterminated strings and they do overflow into other string that is to be combined. I'd like to take a look at strings, analyse them manually and see if any of them end up terminated or not. Please provide any relevant examples of how you

Re: Check if Key exists in Associative Array using D language.

2022-04-05 Thread BoQsc via Digitalmars-d-learn
On Tuesday, 5 April 2022 at 11:53:19 UTC, Dennis wrote: On Tuesday, 5 April 2022 at 11:26:27 UTC, BoQsc wrote: I'd like to know if there is similar function: that can check if a **key** inside a [Associative Array][2] can be found. You can use the `in` operator for that:

Check if Key exists in Associative Array using D language.

2022-04-05 Thread BoQsc via Digitalmars-d-learn
I've found [std.algorithm: canFind][1] to be useful on a **regular arrays**. I'd like to know if there is similar function: that can check if a **key** inside a [Associative Array][2] can be found. [1]:https://dlang.org/phobos/std_algorithm_searching.html#.canFind

Re: How to exclude function from being imported in D language?

2022-03-09 Thread BoQsc via Digitalmars-d-learn
On Tuesday, 8 March 2022 at 22:28:27 UTC, bauss wrote: On Tuesday, 8 March 2022 at 20:12:40 UTC, BoQsc wrote: I think D Language needs and lacks conditional compilation condition and attribute of "exclude". The exclude keyword or code block in the exclude, would be made sure to not be

Re: How to exclude function from being imported in D language?

2022-03-08 Thread BoQsc via Digitalmars-d-learn
I think D Language needs and lacks conditional compilation condition and attribute of "exclude". The exclude keyword or code block in the exclude, would be made sure to not be imported by any means. Now it seems all to be only workarounds.

How to exclude function from being imported in D language?

2022-03-08 Thread BoQsc via Digitalmars-d-learn
Premise: In D language, only one main(){} function can exist in a program. Having two `main()` functions throws an error. Let's say I want to use some functionality of another program, but it has a `main(){}` function. How can I import and use functions without importing the `main(){}`

Re: SendMessageTimeoutW requires casting string to uint?

2022-03-05 Thread BoQsc via Digitalmars-d-learn
Update: 2022-03-04 ChangeLog: * Fixed Typos * Added Switch Statement for Command Line Interface Arguments * Added Switch Statement for Policy, intl, Environment * Added Switch Statement for Error handling: Exit status, Error level * Increased window "timeout" from 1 to 1000

Re: How to remove all characters from a string, except the integers?

2022-03-04 Thread BoQsc via Digitalmars-d-learn
On Thursday, 3 March 2022 at 12:14:13 UTC, BoQsc wrote: I need to check if a string contains integers, and if it contains integers, remove all the regular string characters. I've looked around and it seems using regex is the only closest solution. ``` import std.stdio; void main(string[]

Re: How to remove all characters from a string, except the integers?

2022-03-03 Thread BoQsc via Digitalmars-d-learn
On Thursday, 3 March 2022 at 13:25:32 UTC, Stanislav Blinov wrote: On Thursday, 3 March 2022 at 12:14:13 UTC, BoQsc wrote: I need to check if a string contains integers, and if it contains integers, remove all the regular string characters. I've looked around and it seems using regex is the

How to remove all characters from a string, except the integers?

2022-03-03 Thread BoQsc via Digitalmars-d-learn
I need to check if a string contains integers, and if it contains integers, remove all the regular string characters. I've looked around and it seems using regex is the only closest solution. ``` import std.stdio; void main(string[] args){ if (args.length > 1){

How to convert a string command line argument to an int?

2022-03-02 Thread BoQsc via Digitalmars-d-learn
I tried to use `std.conv.parse(args[2])`, ``` import std.stdio; import std.conv; void main(string[] args){ if (args.length > 1) { writeln(broadcastSettingChange(args[1])); if (args.length == 2) { // TODO: second argument needs parse to

Declaring a reusable formula and using it in other scopes.

2022-02-12 Thread BoQsc via Digitalmars-d-learn
`bool nextArgumentDoesNotReachEndOfArray = i + 1 < args.length;` How can I declare it out of scope and reuse it in any scope that has `i` and `args.length` declared?

Re: Is this Windows Win32 fileapi.h header accessible in D language?

2022-02-08 Thread BoQsc via Digitalmars-d-learn
On Tuesday, 8 February 2022 at 18:21:46 UTC, duser wrote: On Tuesday, 8 February 2022 at 16:10:19 UTC, BoQsc wrote: Unsure where to start, so I decided to ask here how to get use of this win32 header. https://docs.microsoft.com/en-us/windows/win32/api/fileapi/ the specific module containing

Is this Windows Win32 fileapi.h header accessible in D language?

2022-02-08 Thread BoQsc via Digitalmars-d-learn
Unsure where to start, so I decided to ask here how to get use of this win32 header. https://docs.microsoft.com/en-us/windows/win32/api/fileapi/

Re: How to loop through characters of a string in D language?

2021-12-08 Thread BoQsc via Digitalmars-d-learn
On Wednesday, 8 December 2021 at 14:16:16 UTC, bauss wrote: On Wednesday, 8 December 2021 at 11:23:45 UTC, BoQsc wrote: Let's say I want to skip characters and build a new string. The string example to loop/iterate: ``` import std.stdio; void main() { string a="abc;def;ab"; } ``` The

Re: How to loop through characters of a string in D language?

2021-12-08 Thread BoQsc via Digitalmars-d-learn
On Wednesday, 8 December 2021 at 12:49:39 UTC, Adam D Ruppe wrote: On Wednesday, 8 December 2021 at 11:23:45 UTC, BoQsc wrote: The string example to loop/iterate: foreach(ch; a) { } does the individual chars of the string you can also foreach(dchar ch; a) { } to decode the utf 8 Thanks

Re: How to loop through characters of a string in D language?

2021-12-08 Thread BoQsc via Digitalmars-d-learn
On Wednesday, 8 December 2021 at 11:35:39 UTC, Biotronic wrote: On Wednesday, 8 December 2021 at 11:23:45 UTC, BoQsc wrote: Let's say I want to skip characters and build a new string. The string example to loop/iterate: ``` import std.stdio; void main() { string a="abc;def;ab"; } ```

How to loop through characters of a string in D language?

2021-12-08 Thread BoQsc via Digitalmars-d-learn
Let's say I want to skip characters and build a new string. The string example to loop/iterate: ``` import std.stdio; void main() { string a="abc;def;ab"; } ``` The character I want to skip: `;` Expected result: ``` abcdefab ```

Re: How to use std.windows.registry, there are no documentations.

2021-11-30 Thread BoQsc via Digitalmars-d-learn
On Saturday, 27 November 2021 at 19:59:24 UTC, Imperatorn wrote: On Wednesday, 24 November 2021 at 12:07:44 UTC, BoQsc wrote: On Thursday, 11 July 2019 at 08:53:35 UTC, BoQsc wrote: [...] ``` import std.stdio; import std.windows.registry; [...] You could add some examples to the

Re: Include .def definition file information for the linker into a .d source file

2021-11-24 Thread BoQsc via Digitalmars-d-learn
On Wednesday, 24 November 2021 at 20:29:36 UTC, Imperatorn wrote: On Wednesday, 24 November 2021 at 17:38:42 UTC, BoQsc wrote: On Wednesday, 24 November 2021 at 17:29:09 UTC, Adam D Ruppe wrote: On Wednesday, 24 November 2021 at 17:23:07 UTC, BoQsc wrote: The many times I tried this pragma, it

Re: Include .def definition file information for the linker into a .d source file

2021-11-24 Thread BoQsc via Digitalmars-d-learn
Since the **linkerDirective pragma** is not supported for OMF object file. Linker directives are only supported for MS-COFF output. https://dlang.org/spec/pragma.html#linkerDirective I doubt that this thread is completely resolved.

Re: Include .def definition file information for the linker into a .d source file

2021-11-24 Thread BoQsc via Digitalmars-d-learn
On Wednesday, 24 November 2021 at 17:38:42 UTC, BoQsc wrote: [...] **The obvious problem now is:** How can you compile without specifying the flags. With plain dmd. It probably has to do something with the default target of dmd (`-m32`) generating **OMF object file**.

Re: Include .def definition file information for the linker into a .d source file

2021-11-24 Thread BoQsc via Digitalmars-d-learn
On Wednesday, 24 November 2021 at 17:29:09 UTC, Adam D Ruppe wrote: On Wednesday, 24 November 2021 at 17:23:07 UTC, BoQsc wrote: The many times I tried this pragma, it did not even get recognised as pragma at all. You need to use `dmd -m32mscoff` or `dmd -m64`. Plain `dmd` won't work. If

Re: Include .def definition file information for the linker into a .d source file

2021-11-24 Thread BoQsc via Digitalmars-d-learn
On Wednesday, 24 November 2021 at 17:14:42 UTC, Adam D Ruppe wrote: On Wednesday, 24 November 2021 at 17:06:21 UTC, BoQsc wrote: **The question:** Is there a way to include the `.def` file instructions inside `.d` file, so that there won't be a need for additional `.def` file when compiling.

Include .def definition file information for the linker into a .d source file

2021-11-24 Thread BoQsc via Digitalmars-d-learn
I'm not sure if I have sucessfully achieved something like this before or is it even possible right now, but there is a sample file that comes with DMD compiler: `D\dmd2\samples\d\winsamp.d` **The problem:** `winsamp.d` have to be compiled with `.def` file. ``` /+ Compile with: + dmd winsamp

How to use std.windows.registry, there are no documentations.

2021-11-24 Thread BoQsc via Digitalmars-d-learn
On Thursday, 11 July 2019 at 08:53:35 UTC, BoQsc wrote: https://dlang.org/phobos/std_windows_registry.html https://github.com/dlang/phobos/blob/master/std/windows/registry.d Can someone provide some examples on how to: set, change, receive something from the Windows registry using Phobos

How to make a new dub subpackage? [Answered]

2021-11-20 Thread BoQsc via Digitalmars-d-learn
Note: It is not possible to make subpackage inside subpackage. To make a subpackage with dub; follow these general guidelines. **General guidelines** 1. Create a new folder. 2. Open the folder. 3. Initialise a new package. (`dub init`) 4. Open `dub.json` file * Append this: ```

Re: How to read a single character in D language?

2021-11-19 Thread BoQsc via Digitalmars-d-learn
On Friday, 19 November 2021 at 18:01:57 UTC, Adam D Ruppe wrote: On Friday, 19 November 2021 at 17:36:55 UTC, BoQsc wrote: Let's say I want to write a simple program that asks for an input of a single character. After pressing a single key on a keyboard, the character is printed out and the

How to read a single character in D language?

2021-11-19 Thread BoQsc via Digitalmars-d-learn
Let's say I want to write a simple program that asks for an input of a single character. After pressing a single key on a keyboard, the character is printed out and the program should stop.

Re: Find a char among string (string.findAmong.char)

2021-07-07 Thread BoQsc via Digitalmars-d-learn
I think nested foreach loops are more readable. ``` import std; void main() { alias alphabet = letters; char[26] letters = ['a','b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r',

Re: Find a char among string (string.findAmong.char)

2021-07-06 Thread BoQsc via Digitalmars-d-learn
On Tuesday, 6 July 2021 at 15:48:35 UTC, rassoc wrote: You can also do: ```d import std; void main() { // https://dlang.org/phobos/std_ascii.html#.lowercase "Book.".filter!(c => lowercase.canFind(c)) .each!(c => writeln(c, " found")); // Output: // o found //

Re: Find a char among string (string.findAmong.char)

2021-07-06 Thread BoQsc via Digitalmars-d-learn
On Monday, 5 July 2021 at 19:48:13 UTC, jfondren wrote: On Monday, 5 July 2021 at 19:34:14 UTC, BoQsc wrote: But I really don't like how it looks less readable and makes less sense on first look. `if (([letter].findAmong(alphabet)).length)` I'd like to use some method on the `letter` instead

Re: Find a char among string (string.findAmong.char)

2021-07-05 Thread BoQsc via Digitalmars-d-learn
On Monday, 5 July 2021 at 19:25:23 UTC, jfondren wrote: On Monday, 5 July 2021 at 19:19:19 UTC, BoQsc wrote: If I use `[letter].findAmong(alphabet)` in my code, it considers a dot (.) punctuation character as a letter. You can see it here: https://run.dlang.io/is/YWmaXU It returns a

Re: Find a char among string (string.findAmong.char)

2021-07-05 Thread BoQsc via Digitalmars-d-learn
On Monday, 5 July 2021 at 18:59:09 UTC, jfondren wrote: On Monday, 5 July 2021 at 18:53:27 UTC, jfondren wrote: If you replace the findAmong call with `[letter].findAmong(alphabet)`, this works. Consider: ```d import std; void main() { import std.ascii : alphabet = letters;

Find a char among string (string.findAmong.char)

2021-07-05 Thread BoQsc via Digitalmars-d-learn
I get an error when I try to find that letter is among alphabet. onlineapp.d(13): Error: template `std.algorithm.searching.findAmong` cannot deduce function from argument types `!()(immutable(char), immutable(string))`, candidates are:

Download a file into array (using std.net.curl.download)

2021-07-05 Thread BoQsc via Digitalmars-d-learn
Let's say I can't store information into files. Is it possible to download a file into an array. This is what I have now. It saves a download into a file named: file.txt import std; import std.net.curl; void main() { writeln("Hello D");

Re: Is there an alias for standard libraries to use in import statement?

2021-07-04 Thread BoQsc via Digitalmars-d-learn
On Sunday, 4 July 2021 at 08:50:54 UTC, Mike Parker wrote: You can use named imports, but then you have to use the name as a namespace: ``` import system = std; void main() { system.writeln("Hello D"); } ``` These were the examples that might feel more readable and natural than

Is there an alias for standard libraries to use in import statement?

2021-07-04 Thread BoQsc via Digitalmars-d-learn
I just started with a fresh look at the D language and would like to be able to rewrite this code: import std; void main() { writeln("Hello D"); } Into more readable standard library name: import system; void main() { writeln("Hello D"); } Or into this import library.standard;

Re: writeln Function while reading a Text File is printing appending text "before text" and "after text" at the same position

2020-06-03 Thread BoQsc via Digitalmars-d-learn
On Wednesday, 3 June 2020 at 20:05:52 UTC, ttk wrote: On Wednesday, 3 June 2020 at 19:53:03 UTC, BoQsc wrote: Removing the last element of the string got it resolved. Might not be the best way and adding additional check for carriage return before removing the element would be better, so this

Re: writeln Function while reading a Text File is printing appending text "before text" and "after text" at the same position

2020-06-03 Thread BoQsc via Digitalmars-d-learn
Removing the last element of the string got it resolved. Might not be the best way and adding additional check for carriage return before removing the element would be better, so this is only initial proof. Improved example with the above comments resolved. testingGround.d import

Re: writeln Function while reading a Text File is printing appending text "before text" and "after text" at the same position

2020-06-03 Thread BoQsc via Digitalmars-d-learn
On Wednesday, 3 June 2020 at 18:49:38 UTC, ttk wrote: On Wednesday, 3 June 2020 at 18:23:51 UTC, BoQsc wrote: Here you can see ". hahahahahahaha" and "nononono" and even lineNumber is being merged into the same position. Why is this happening and can this be simply resolved? Your string in

writeln Function while reading a Text File is printing appending text "before text" and "after text" at the same position

2020-06-03 Thread BoQsc via Digitalmars-d-learn
C:\Users\vaida\Desktop\Associative Array Sorting> rdmd testingGround.d 0. The quick brown fox jumps over the lazy dog nonononoahahahaha Sphinx of black quartz, judge my vow. 2. # How vexingly quick daft zebras jump! 3. # The five boxing wizards jump quickly 4. # Maecenas consectetur risus a

How to efficiently resolve Associative Arrays not being sorted?

2020-06-02 Thread BoQsc via Digitalmars-d-learn
I want to read a file, put it into an array, make some search and replace on the content and output the modified text. However Associative Arrays seem to be unsorted by default. Should I drop the Associative Arrays and use something else? What are the ways to resolve this randomness in

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

2020-05-27 Thread BoQsc via Digitalmars-d-learn
I always wanted to know if there is any proven example on how to interface with USB devices by using Windows operating system. Any explanations, snippets in relation to topic would help. What I expect: Being able to detect if a new USB device is connected. Being able to read USB device name.

Re: Unable to access a variable declared inside an if statement (Error: is shadowing variable)

2020-05-27 Thread BoQsc via Digitalmars-d-learn
On Wednesday, 27 May 2020 at 11:13:09 UTC, Simen Kjærås wrote: On Wednesday, 27 May 2020 at 11:03:51 UTC, BoQsc wrote: I'm lacking knowledge on how to achieve what I want and getting an error. What is the correct way to do what I tried to achieve in this code? Everything was intuitive until I

Unable to access a variable declared inside an if statement (Error: is shadowing variable)

2020-05-27 Thread BoQsc via Digitalmars-d-learn
I'm lacking knowledge on how to achieve what I want and getting an error. What is the correct way to do what I tried to achieve in this code? Everything was intuitive until I started to add notice variable to the writeln. Rdmd says variable `notice` is shadowing variable. rdmd output:

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

2020-05-23 Thread BoQsc via Digitalmars-d-learn
On Tuesday, 19 May 2020 at 10:05:00 UTC, BoQsc wrote: On Monday, 18 May 2020 at 20:00:51 UTC, BoQsc wrote: I'm kind of stuck right now on how. Some more Updates and it seems that it is impossible to scroll the history of the output. Some relevant discussion:

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

2020-05-19 Thread BoQsc via Digitalmars-d-learn
On Monday, 18 May 2020 at 20:00:51 UTC, BoQsc wrote: I'm kind of stuck right now on how. Some more Updates and it seems that it is impossible to scroll the history of the output. import std.stdio : write, writeln, readln, writefln; import std.process : spawnShell, wait, executeShell,

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

2020-05-19 Thread BoQsc via Digitalmars-d-learn
On Monday, 18 May 2020 at 20:40:47 UTC, Adam D. Ruppe wrote: 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. Returning does what I need, however I still need to get a working example on killing/terminating

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: 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: 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 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 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 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

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: 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

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

[GTK-D] dub run leads to lld-link: error: could not open libcmt.lib: no such file or directory

2020-05-13 Thread BoQsc via Digitalmars-d-learn
A simple example I tried to run. #!/usr/bin/env dub /+ dub.sdl: name "hello" dependency "gtk-d" version="~>3.9.0" +/ import gtk.MainWindow; import gtk.Label; import gtk.Main; void main(string[] args) { Main.init(args); MainWindow win = new MainWindow("Hello World");

Concatenation/joining strings together in a more readable way

2019-12-25 Thread BoQsc via Digitalmars-d-learn
Are there any other ways to join two strings without Tilde ~ character? I can't seems to find anything about Tilde character concatenation easily, nor the alternatives to it. Can someone share some knowledge on this or at least point out useful links/resources?

What would it take to bring preinstalled D language compiler in the major Linux Distributions?

2019-12-23 Thread BoQsc via Digitalmars-d-learn
I would love to see D language available out of box in major Linux distributions and use without much care of installation. Anyone have a though about it? Was there any serious efforts to bring D language to Major distributions?

What kind of Editor, IDE you are using and which one do you like for D language?

2019-12-22 Thread BoQsc via Digitalmars-d-learn
There are lots of editors/IDE's that support D language: https://wiki.dlang.org/Editors What kind of editor/IDE are you using and which one do you like the most?

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

2019-11-13 Thread BoQsc via Digitalmars-d-learn
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); I'm not sure why, but template instantiation syntax is prevalent in the documentation examples of d lang libraries. It almost seems like every other

When should we use Modules and when Should we use Classes?

2019-09-18 Thread BoQsc via Digitalmars-d-learn
Would be nice to have a short summary or detailed answer on this. Some resources to discuss this topic: https://dlang.org/spec/class.html https://dlang.org/spec/module.html

Make executable archive just like Java's .jar archive?

2019-09-12 Thread BoQsc via Digitalmars-d-learn
Is there a way to archive multiple .d source code files and make that archive executable, or something similar?

Re: Make executable archive just like Java's .jar archive?

2019-09-12 Thread BoQsc via Digitalmars-d-learn
On Thursday, 12 September 2019 at 12:52:48 UTC, BoQsc wrote: Is there a way to archive multiple .d source code files and make that archive executable, or something similar? https://en.wikipedia.org/wiki/JAR_(file_format)

What is "dmd" Internal API, can I use it just like std Library Reference?

2019-08-20 Thread BoQsc via Digitalmars-d-learn
Hello everyone, again, I had an idea that I want some colors in the output of Command Line (For Windows) and the Terminal (For Linux) I found https://dlang.org/phobos/dmd_console.html and wanted to use it. But it seems I'm not being successful, and I do not understand why. Here, you can

Re: Downloading a file and showing progress via curl.

2019-08-20 Thread BoQsc via Digitalmars-d-learn
On Tuesday, 20 August 2019 at 11:51:03 UTC, Daniel Kozak wrote: For that you can use https://dlang.org/phobos/std_file#append Thank you, seems to work. import std.net.curl : HTTP; import std.stdio: writeln; import std.file : append; void main() { auto http = HTTP(); // Track

Downloading a file and showing progress via curl.

2019-08-20 Thread BoQsc via Digitalmars-d-learn
Hello everyone, I found this snippet on https://dlang.org/phobos/std_net_curl.html#.HTTP import std.net.curl : HTTP; import std.stdio : writeln; void main() { auto http = HTTP(); // Track progress http.method = HTTP.Method.get; http.url =

Re: How to setup D language with Apache httpd cgi?

2019-07-31 Thread BoQsc via Digitalmars-d-learn
On Wednesday, 31 July 2019 at 14:19:20 UTC, bachmeier wrote: is going to compile every time it runs, which makes the program unnecessarily slow If only I could add dub --single --rdmd to the shebang, I think dub might stop compiling every time. However as pointed out in the above post, I'm

Re: How to setup D language with Apache httpd cgi?

2019-07-31 Thread BoQsc via Digitalmars-d-learn
However I tried to add options (--single) to the dub shebang and apache now throwing: "bad header error" Without "--single" option seems to work. #!/usr/bin/env -vS dub --single /+ dub.sdl: name "application" dependency "arsd-official:dom" version="4.0.2" +/ import std.stdio; import

Re: How to setup D language with Apache httpd cgi?

2019-07-31 Thread BoQsc via Digitalmars-d-learn
is going to compile every time it runs, which makes the program unnecessarily slow, and if it's used heavily, will add quite a load to the server. I finally done it, and I'm not sure if it compiles every time. It opens the page lightning fast since I use SSD drive. I'm not sure how to check

Re: How to setup D language with Apache httpd cgi?

2019-07-31 Thread BoQsc via Digitalmars-d-learn
Hmm, it seems that once I remove sudo from the shebang, the error disappears and Internal Server Error disappears. example.d - does not work #!/usr/bin/env -S sudo dub /+ dub.sdl: name "hello" +/ import std.stdio; void main() { writeln(`Content-type: text/html`);

Re: How to setup D language with Apache httpd cgi?

2019-07-31 Thread BoQsc via Digitalmars-d-learn
On Wednesday, 31 July 2019 at 09:09:12 UTC, BoQsc wrote: On Wednesday, 31 July 2019 at 09:03:47 UTC, BoQsc wrote: And this is the error I get now: [Wed Jul 31 11:51:15.341790 2019] [cgid:error] [pid 870:tid 140153708345088] [client >127.0.0.1:50318] End of script output before headers:

Re: How to setup D language with Apache httpd cgi?

2019-07-31 Thread BoQsc via Digitalmars-d-learn
On Wednesday, 31 July 2019 at 09:03:47 UTC, BoQsc wrote: And this is the error I get now: [Wed Jul 31 11:51:15.341790 2019] [cgid:error] [pid 870:tid 140153708345088] [client >127.0.0.1:50318] End of script output before headers: example.d And I have no idea how to deal with it. Cgi shows

Re: How to setup D language with Apache httpd cgi?

2019-07-31 Thread BoQsc via Digitalmars-d-learn
On Wednesday, 31 July 2019 at 08:32:43 UTC, BoQsc wrote: Added sudo to the shebang, it started to say that sudo requires tty, meaning that there is no graphical interface for user to input the password. So, I remove the need to type password when using sudo command, by following these

Re: How to setup D language with Apache httpd cgi?

2019-07-31 Thread BoQsc via Digitalmars-d-learn
On Wednesday, 31 July 2019 at 07:57:01 UTC, BoQsc wrote: [Wed Jul 31 10:44:26.887024 2019] [cgid:error] [pid 846:tid 140090256426752] [client >127.0.0.1:57052] malformed header from script 'example.d': Bad header: Fetching arsd-official 4.0.1 ( /usr/lib/cgi-bin/.dub/packages/: Permission

Re: How to setup D language with Apache httpd cgi?

2019-07-31 Thread BoQsc via Digitalmars-d-learn
On Wednesday, 31 July 2019 at 07:42:22 UTC, BoQsc wrote: This seems to work well when running not from cgi, so there is That was not true, it didn't work even from Linux Shell, I corrected shebang, now it works from Linux Shell. An, unexpected thing: It did require permissions: sudo

Re: How to setup D language with Apache httpd cgi?

2019-07-31 Thread BoQsc via Digitalmars-d-learn
This seems to work well when running not from cgi, so there is That was not true, it didn't work even from Linux Shell, I corrected shebang, now it works from Linux Shell. An, unexpected thing: It did require permissions: sudo ./example.d which was not the case with rdmd. cgi still shows

Re: How to setup D language with Apache httpd cgi?

2019-07-31 Thread BoQsc via Digitalmars-d-learn
I tried to change shebang, but: Internal Server Error still appears. #!/usr/bin/env dub run --single /+ dub.sdl: name "hello" dependency "arsd-official" version="~>4.0.1" +/ import std.stdio; void main() { writeln(`Content-type: text/html`); writeln(``);

Re: How to setup D language with Apache httpd cgi?

2019-07-31 Thread BoQsc via Digitalmars-d-learn
There are some other bad news, I switched from rdmd to dub package manager since I need a package from Adam D. Ruppe. It is all good and well: this one works perfectly. #!/usr/bin/env dub /+ dub.sdl: name "hello" +/ import std.stdio; void main() { writeln(`Content-type:

Re: How to setup D language with Apache httpd cgi?

2019-07-31 Thread BoQsc via Digitalmars-d-learn
On Wednesday, 31 July 2019 at 06:52:46 UTC, 0xEAB wrote: On Wednesday, 31 July 2019 at 06:30:03 UTC, BoQsc wrote: This can be solved by using single quotes in the argument content places #!/usr/bin/env rdmd import std.stdio; void main() { writeln("Content-type: text/html"); writeln("");

Re: How to setup D language with Apache httpd cgi?

2019-07-31 Thread BoQsc via Digitalmars-d-learn
On Wednesday, 31 July 2019 at 06:55:06 UTC, 0xEAB wrote: On Wednesday, 31 July 2019 at 06:30:03 UTC, BoQsc wrote: On Wednesday, 31 July 2019 at 05:56:46 UTC, BoQsc wrote: what causes the Internal Server Error. Internal Server Error might as well appear when D language syntax is not correct.

Re: How to setup D language with Apache httpd cgi?

2019-07-31 Thread BoQsc via Digitalmars-d-learn
On Wednesday, 31 July 2019 at 05:56:46 UTC, BoQsc wrote: what causes the Internal Server Error. Internal Server Error might as well appear when D language syntax is not correct. Considering this: this example has Internal Server Error, since writeln argument and argument content cannot

Re: How to setup D language with Apache httpd cgi?

2019-07-31 Thread BoQsc via Digitalmars-d-learn
On Tuesday, 30 July 2019 at 21:55:00 UTC, Adam D. Ruppe wrote: the required blank line to separate headers from content. That's exactly what causes the Internal Server Error. This is a working example.d #!/usr/bin/env rdmd import std.stdio; void main() { writeln(""); } And this one,

How to setup D language with Apache httpd cgi?

2019-07-30 Thread BoQsc via Digitalmars-d-learn
Hello, I would like to know how to setup D language project, so that it would work with Apache httpd cgi. Do I need some kind of cgi library for D language? Right now all I'm getting is internal server error. Btw. Unix Bash script examples seems to work well with with Apache httpd cgi, they

Calling / running / executing .d script from another .d script

2019-07-28 Thread BoQsc via Digitalmars-d-learn
Right now, I'm thinking what is correct way to run another .d script from a .d script. Do you have any suggestions?

Is it possible to disallow import for certain functions?

2019-07-27 Thread BoQsc via Digitalmars-d-learn
I would like to make sure that function in module that I have won't be imported, is this possible to achieve? Test subject: mainFile.d import otherFile; void main(){ } otherFile.d import std.stdio : writeln; import std.file : mkdir; int main(){ writeln("test ");

Re: Blog Post #0052: MVC V - ComboBox with Integers

2019-07-12 Thread BoQsc via Digitalmars-d-learn
On Friday, 12 July 2019 at 11:13:31 UTC, Ron Tarrant wrote: Today's post deals with integers in a ComboBox. It's not exactly tricky, but a little clarification never hurts, right? Here's where you'll find it: https://gtkdcoding.com/2019/07/12/0052-mvc-v-int-combobox.html Gnome project

Re: Is it possible to execute a function inside .d script that has no main function?

2019-07-12 Thread BoQsc via Digitalmars-d-learn
On Thursday, 11 July 2019 at 10:41:38 UTC, Alex wrote: On Thursday, 11 July 2019 at 09:43:55 UTC, BoQsc wrote: Here I have a file named: module.d [...] There is no main() function since, I want to import this module, into another .d file. ( If I try to import and module.d does have

Is it possible to execute a function inside .d script that has no main function?

2019-07-11 Thread BoQsc via Digitalmars-d-learn
Here I have a file named: module.d import std.stdio : writeln; void interestingFunction(){ writeln("Testing"); } There is no main() function since, I want to import this module, into another .d file. ( If I try to import and module.d does have main() function I get this error:

  1   2   >