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:

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

2019-07-11 Thread BoQsc via Digitalmars-d-learn
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 std.windows.registry library?

Re: SendMessageTimeoutW requires casting string to uint?

2019-07-09 Thread BoQsc via Digitalmars-d-learn
On Tuesday, 9 July 2019 at 13:10:57 UTC, a11e99z wrote: On Tuesday, 9 July 2019 at 12:14:38 UTC, BoQsc wrote: On Tuesday, 9 July 2019 at 11:11:53 UTC, Dejan Lekic wrote: auto result = SendMessageTimeoutW( HWND_BROADCAST, WM_SETTINGCHANGE, 0, envi.toUTF16z,

Re: SendMessageTimeoutW requires casting string to uint?

2019-07-09 Thread BoQsc via Digitalmars-d-learn
On Tuesday, 9 July 2019 at 11:11:53 UTC, Dejan Lekic wrote: Now that I browsed the std.utf more, I realised what fits your need best is the https://dlang.org/phobos/std_utf.html#toUTF16z So far, this is what I have: Filename: myVersion.d import core.sys.windows.windows :

SendMessageTimeoutW requires casting string to uint?

2019-07-09 Thread BoQsc via Digitalmars-d-learn
I'm quite new to the programming, and I'm getting unsure how to make SendMessageTimeoutW to work with D lang. Most of my attention right now resides around the Argument of the SendMessageTimeoutW function: "Environment", It seems that SendMessageTimeoutW accepts only uint type, and string

Re: Changing Environment Paths using D language's Phobos Library

2019-06-29 Thread BoQsc via Digitalmars-d-learn
On Saturday, 29 June 2019 at 09:50:12 UTC, BoQsc wrote: On Saturday, 29 June 2019 at 09:28:03 UTC, BoQsc wrote: I checked the documentation and it seems that, you assumed the wrong syntax for "environment.opIndexAssign()" The correct syntax is: environment.opIndexAssign("Some Random Value

Re: Changing Environment Paths using D language's Phobos Library

2019-06-29 Thread BoQsc via Digitalmars-d-learn
On Saturday, 29 June 2019 at 09:28:03 UTC, BoQsc wrote: However, setting the variable via "environment.opIndexAssign" seems to not work. What should we do? I don't know. I'm glad I'm on this forum, I know exactly what you did wrong mr. BoQsc I checked the documentation and it seems that,

Changing Environment Paths using D language's Phobos Library

2019-06-29 Thread BoQsc via Digitalmars-d-learn
I would like to remove/add/change Environment Paths using D language's Phobos. https://en.wikipedia.org/wiki/PATH_(variable) I saw in the documentation that there is a class file "std.process : environment" that has the supposed ability to minipulate environment variables.

How to prepare and generate a simple lightweight binary?

2019-06-25 Thread BoQsc via Digitalmars-d-learn
There are lots of talks on this forum about Statical linking, Dynamic linking. There are even shouts: "use the ldc compiler instead, it can do all that and even more than the default dmd compiler!!!" and bunch of compiler flags, no instructions on how to start or even steps on how to reproduce

Is it possible to escape a reserved keyword in Import/module?

2019-06-19 Thread BoQsc via Digitalmars-d-learn
I would like to make sure that my modules do not interfere with d lang. Is there any way to escape reserved words? https://dlang.org/spec/lex.html#keywords import alias; C:\Users\Juozas\Desktop\om.d(2): Error: identifier expected following import C:\Users\Juozas\Desktop\om.d(2): Error: ;

Re: Blog Post #0043 - File Dialog IX - Custom Dialogs (2 of 3)

2019-06-17 Thread BoQsc via Digitalmars-d-learn
On Tuesday, 11 June 2019 at 09:06:10 UTC, Ron Tarrant wrote: This is the second in a series (Custom Dialogs) within a series (Dialogs) and deals with the action area. It's available here: http://gtkdcoding.com/2019/06/11/0043-custom-dialog-ii.html Aw man, your content have. "© Copyright 2019

Re: Suggest aesthetic way to Naming a module or a package with illegal lexical D lang keywords

2019-06-16 Thread BoQsc via Digitalmars-d-learn
On Sunday, 16 June 2019 at 11:38:27 UTC, rikki cattermole wrote: The style guide has an opinion about this (you don't have to follow it). https://dlang.org/dstyle.html#naming_keywords So if I follow dstyle guidelines on keywords, this would be a correct non-conflicting result: module

Suggest aesthetic way to Naming a module or a package with illegal lexical D lang keywords

2019-06-16 Thread BoQsc via Digitalmars-d-learn
Do not ask why I want to do that, you can however suggest alternative variations. As you all might know, 2. The Identifiers preceding the rightmost are the Packages that the module is in. The packages correspond to directory names in the source file path. Package and module names cannot be

File Exception, Access is denied - prompting for administrator's rights

2019-06-04 Thread BoQsc via Digitalmars-d-learn
Hello everyone, I'm Windows 10 as of right now, I have this situation where I would like to update /hosts file, however sometimes I do not have the required permissions, since sometimes I forget to run the .d script with administrator's rights. Is there any way to prompt for administrator's

Re: rdmd takes 2-3 seconds on a first-run of a simple .d script

2019-05-28 Thread BoQsc via Digitalmars-d-learn
On Tuesday, 28 May 2019 at 06:06:24 UTC, Seb wrote: On Tuesday, 28 May 2019 at 05:11:15 UTC, Andre Pany wrote: On Monday, 27 May 2019 at 07:16:37 UTC, BoQsc wrote: [...] I can confirm, without measuring the exact timing, "dmd -run test.d" feels much faster than "rdmd test.d". I would say 1

Re: rdmd takes 2-3 seconds on a first-run of a simple .d script

2019-05-27 Thread BoQsc via Digitalmars-d-learn
On Sunday, 26 May 2019 at 20:37:36 UTC, Jon Degenhardt wrote: On Saturday, 25 May 2019 at 22:18:16 UTC, Andre Pany wrote: On Saturday, 25 May 2019 at 08:32:08 UTC, BoQsc wrote: I have a simple standard .d script and I'm getting annoyed that it takes 2-3 seconds to run and see the results via

rdmd takes 2-3 seconds on a first-run of a simple .d script

2019-05-25 Thread BoQsc via Digitalmars-d-learn
rdmd is a companion to the dmd compiler that simplifies the typical edit-compile-link-run or edit-make-run cycle to a rapid edit-run cycle. Like make and other tools, rdmd uses the relative dates of the files involved to minimize the amount of work necessary. Unlike make, rdmd tracks

Why GNU coreutils/dd is creating a dummy file more efficiently than D's For loop?

2019-05-23 Thread BoQsc via Digitalmars-d-learn
This code of D creates a dummy 47,6 MB text file filled with Nul characters in about 9 seconds import std.stdio, std.process; void main() { writeln("Creating a dummy file"); File file = File("test.txt", "w"); for (int i = 0; i < 5000; i++) {

Re: How to "Clear the Screen" for Windows Command Processor? (Windows 10)

2019-05-21 Thread BoQsc via Digitalmars-d-learn
On Tuesday, 21 May 2019 at 12:51:41 UTC, Adam D. Ruppe wrote: On Tuesday, 21 May 2019 at 07:16:29 UTC, Boqsc wrote: I'm getting unsure why executeShell works on the pause command, but cls that is responsible for clearing the text do not. When you ran pause, did it print the text "press any

Re: How to "Clear the Screen" for Windows Command Processor? (Windows 10)

2019-05-21 Thread BoQsc via Digitalmars-d-learn
On Tuesday, 21 May 2019 at 10:03:38 UTC, KnightMare wrote: try next: spawnShell( "cls" ).wait; Wow, spawnShell indeed does the job as I would expect, as of right now. Thanks. spawnShell Function indeed sounds like it would spawn a new shell instead of what it does, at first I didn't look

How to "Clear the Screen" for Windows Command Processor? (Windows 10)

2019-05-21 Thread Boqsc via Digitalmars-d-learn
I'm getting unsure why executeShell works on the pause command, but cls that is responsible for clearing the text do not. import std.stdio, std.process; void main() { writeln("Some text that will appear in cmd"); executeShell("cls"); // Does not clear the text?

Parsing URL, Extracting Authority from the URL string

2019-05-20 Thread Boqsc via Digitalmars-d-learn
I wonder if there is a simple way to extract Authority from an URL string. What is Authority of URL: https://en.wikipedia.org/wiki/URL#Syntax https://dlang.org/phobos/std_path.html I was able to gather the filename of URL via std.path package function: baseName. import std.stdio, std.path;

Is using floating point type for money/currency a good idea?

2019-05-20 Thread Boqsc via Digitalmars-d-learn
https://dlang.org/spec/float.html I'm frozen in learning basics of D lang since I want to create a simple game and I really would like a clean and simple code, however to me floating points are magic. https://wiki.dlang.org/Review_Queue Since std.decimal is still work in progress and

Re: Why does D language do not support BigDecimal type?

2019-03-12 Thread Boqsc via Digitalmars-d-learn
On Tuesday, 12 March 2019 at 08:48:33 UTC, Cym13 wrote: On Monday, 11 March 2019 at 15:23:34 UTC, BoQsc wrote: There is Money datatype that can be provided by using a third party package: https://code.dlang.org/packages/money But that's only for money, what about math? Why such fundamental as

Why does D language do not support BigDecimal type?

2019-03-11 Thread BoQsc via Digitalmars-d-learn
There is Money datatype that can be provided by using a third party package: https://code.dlang.org/packages/money But that's only for money, what about math? Why such fundamental as BigDecimal is still not included into the D language itself? There is BigInt. If it is unavoidable to use

Re: Executing a D script without an [extension in the filename] leads to an error

2019-03-01 Thread BoQsc via Digitalmars-d-learn
On Friday, 1 March 2019 at 09:27:33 UTC, Cym13 wrote: On Friday, 1 March 2019 at 09:00:43 UTC, BoQsc wrote: I've installed D compiler, and when i try to run a D script with filename without an extension/file type named: program via: ./program I'm getting and error:

Executing a D script without an [extension in the filename] leads to an error

2019-03-01 Thread BoQsc via Digitalmars-d-learn
I've installed D compiler, and when i try to run a D script with filename without an extension/file type named: program via: ./program I'm getting and error: vaidas@SATELLITE-L855:~/Desktop$ ./program Error: module `program` is in file './program.d' which cannot be read import path[0] = .

Why The D Style constants are written in camelCase?

2018-05-09 Thread BoQsc via Digitalmars-d-learn
The D Style suggest to camelCase constants, while Java naming conventions always promoted uppercase letter. Is there an explanation why D Style chose to use camelCase instead of all UPPERCASE for constants, was there any technical problem that would appear while writing in all UPPERCASE?

Re: "Start a Minimal web server" example do not work.

2018-05-08 Thread BoQsc via Digitalmars-d-learn
On Tuesday, 8 May 2018 at 19:19:26 UTC, Seb wrote: On Tuesday, 8 May 2018 at 18:40:34 UTC, BoQsc wrote: On Tuesday, 8 May 2018 at 18:38:10 UTC, BoQsc wrote: On Tuesday, 8 May 2018 at 17:35:13 UTC, Jesse Phillips wrote: [...] Tested with these versions so far, and had all the same errors:

Re: "Start a Minimal web server" example do not work.

2018-05-08 Thread BoQsc via Digitalmars-d-learn
On Tuesday, 8 May 2018 at 18:38:10 UTC, BoQsc wrote: On Tuesday, 8 May 2018 at 17:35:13 UTC, Jesse Phillips wrote: On Tuesday, 8 May 2018 at 16:34:53 UTC, BoQsc wrote: On Tuesday, 8 May 2018 at 16:18:27 UTC, bachmeier wrote: On Tuesday, 8 May 2018 at 12:13:56 UTC, BoQsc wrote: This is the

Re: "Start a Minimal web server" example do not work.

2018-05-08 Thread BoQsc via Digitalmars-d-learn
On Tuesday, 8 May 2018 at 17:35:13 UTC, Jesse Phillips wrote: On Tuesday, 8 May 2018 at 16:34:53 UTC, BoQsc wrote: On Tuesday, 8 May 2018 at 16:18:27 UTC, bachmeier wrote: On Tuesday, 8 May 2018 at 12:13:56 UTC, BoQsc wrote: This is the code example, that was presented on the

Re: "Start a Minimal web server" example do not work.

2018-05-08 Thread BoQsc via Digitalmars-d-learn
On Tuesday, 8 May 2018 at 16:18:27 UTC, bachmeier wrote: On Tuesday, 8 May 2018 at 12:13:56 UTC, BoQsc wrote: This is the code example, that was presented on the https://dlang.org frontpage: Maybe that isn't the best choice of beginner example if even the D experts can't figure out how to

Re: "Start a Minimal web server" example do not work.

2018-05-08 Thread BoQsc via Digitalmars-d-learn
On Tuesday, 8 May 2018 at 16:02:02 UTC, rjframe wrote: On Tue, 08 May 2018 13:23:07 +, BoQsc wrote: On Tuesday, 8 May 2018 at 13:04:12 UTC, Seb wrote: Did you try the newer MSCOFF format dub --arch=x86_mscoff start_minimum_server.d or dub --arch=x64 start_minimum_server.d

Re: "Start a Minimal web server" example do not work.

2018-05-08 Thread BoQsc via Digitalmars-d-learn
On Tuesday, 8 May 2018 at 13:33:51 UTC, drug wrote: 08.05.2018 16:23, BoQsc пишет: On Tuesday, 8 May 2018 at 13:04:12 UTC, Seb wrote: On Tuesday, 8 May 2018 at 12:37:42 UTC, BoQsc wrote: On Tuesday, 8 May 2018 at 12:19:14 UTC, Adam D. Ruppe wrote: On Tuesday, 8 May 2018 at 12:13:56 UTC,

Re: "Start a Minimal web server" example do not work.

2018-05-08 Thread BoQsc via Digitalmars-d-learn
On Tuesday, 8 May 2018 at 13:04:12 UTC, Seb wrote: On Tuesday, 8 May 2018 at 12:37:42 UTC, BoQsc wrote: On Tuesday, 8 May 2018 at 12:19:14 UTC, Adam D. Ruppe wrote: On Tuesday, 8 May 2018 at 12:13:56 UTC, BoQsc wrote: [...] This one needs to be compiled+run with the dub package manager

Re: "Start a Minimal web server" example do not work.

2018-05-08 Thread BoQsc via Digitalmars-d-learn
On Tuesday, 8 May 2018 at 12:19:14 UTC, Adam D. Ruppe wrote: On Tuesday, 8 May 2018 at 12:13:56 UTC, BoQsc wrote: This is the code example, that was presented on the https://dlang.org frontpage: - #!/usr/bin/env dub This one needs to be compiled+run with the dub package

"Start a Minimal web server" example do not work.

2018-05-08 Thread BoQsc via Digitalmars-d-learn
This is the code example, that was presented on the https://dlang.org frontpage: - #!/usr/bin/env dub /+ dub.sdl: name "hello_vibed" dependency "vibe-d" version="~>0.8.0" +/ void main() { import vibe.d; listenHTTP(":8080", (req, res) { res.writeBody("Hello,

Re: Making an .exe that executes source file inside itself.

2018-04-27 Thread BoQsc via Digitalmars-d-learn
On Friday, 27 April 2018 at 04:30:32 UTC, IntegratedDimensions wrote: On Thursday, 26 April 2018 at 06:18:25 UTC, BoQsc wrote: On Wednesday, 25 April 2018 at 20:44:10 UTC, u0_a183 wrote: On Wednesday, 25 April 2018 at 19:54:26 UTC, BoQsc wrote: On Wednesday, 25 April 2018 at 19:43:31 UTC,

Re: Making an .exe that executes source file inside itself.

2018-04-26 Thread BoQsc via Digitalmars-d-learn
On Wednesday, 25 April 2018 at 20:44:10 UTC, u0_a183 wrote: On Wednesday, 25 April 2018 at 19:54:26 UTC, BoQsc wrote: On Wednesday, 25 April 2018 at 19:43:31 UTC, Jonathan M Davis wrote: On Wednesday, April 25, 2018 19:19:58 BoQsc via Digitalmars-d-learn wrote: So there has been idea I've got

Re: Making an .exe that executes source file inside itself.

2018-04-25 Thread BoQsc via Digitalmars-d-learn
On Wednesday, 25 April 2018 at 19:43:31 UTC, Jonathan M Davis wrote: On Wednesday, April 25, 2018 19:19:58 BoQsc via Digitalmars-d-learn wrote: So there has been idea I've got for around few months now: making a software which executable would contain a source file. A software that anyone

Making an .exe that executes source file inside itself.

2018-04-25 Thread BoQsc via Digitalmars-d-learn
So there has been idea I've got for around few months now: making a software which executable would contain a source file. A software that anyone could modify by opening an executable and quickly change a few lines of it, rerun an executable, see the changes. Could this be easily possible

<    1   2