Re: How to get output of piped process?

2021-03-07 Thread Jesse Phillips via Digitalmars-d-learn
On Saturday, 6 March 2021 at 21:20:30 UTC, kdevel wrote: ```pipechain.d import std.stdio; import std.process; import std.conv; import std.array; import std.range; import std.algorithm; int main (string [] args) { auto p = pipe (); auto proc1 = spawnProcess (["cat"], stdin, p.writeEnd);

Re: Is there any generic iteration function that stops at first match?

2021-03-05 Thread Jesse Phillips via Digitalmars-d-learn
On Friday, 5 March 2021 at 02:13:39 UTC, Jack wrote: something like filter[1] but that stops at first match? are there any native functions for this in D or I have to write one? just making sure to not reinvent the wheel [1]: https://devdocs.io/d/std_algorithm_iteration#filter

Re: How to get output of piped process?

2021-03-05 Thread Jesse Phillips via Digitalmars-d-learn
On Wednesday, 17 February 2021 at 06:58:55 UTC, Jedi wrote: I an using pipeShell, I have redirected stdout, stderr, and stdin. I am trying to read from the output and display it in my app. I have followed this code almost exactly except I use try wait and flush because the app is

Re: How can I use UFCS for a loop

2021-01-25 Thread Jesse Phillips via Digitalmars-d-learn
On Tuesday, 26 January 2021 at 02:19:10 UTC, Tim wrote: On Tuesday, 26 January 2021 at 01:38:45 UTC, Q. Schroll wrote: On Tuesday, 26 January 2021 at 00:47:09 UTC, Tim wrote: Hi all, How can I change the following to a more D-like approach by using UFCS? double[3] result; Unless you

Re: Reading files using delimiters/terminators

2020-12-27 Thread Jesse Phillips via Digitalmars-d-learn
On Sunday, 27 December 2020 at 13:21:44 UTC, Rekel wrote: On Sunday, 27 December 2020 at 02:41:12 UTC, Jesse Phillips wrote: Unfortunately std.csv is character based and not string. https://dlang.org/phobos/std_csv.html#.csvReader But your use case sounds like splitter is more aligned with

Re: Reading files using delimiters/terminators

2020-12-26 Thread Jesse Phillips via Digitalmars-d-learn
On Sunday, 27 December 2020 at 00:13:30 UTC, Rekel wrote: I'm trying to read a file with entries seperated by '\n\n' (empty line), with entries containing '\n'. I thought the File.readLine(KeepTerminator, Terminator) might work, as it seems to accept strings as terminators, since there seems

Re: question as to when a new command gets executed

2020-11-11 Thread Jesse Phillips via Digitalmars-d-learn
On Wednesday, 11 November 2020 at 22:29:00 UTC, SealabJaster wrote: On Wednesday, 11 November 2020 at 22:10:38 UTC, WhatMeWorry wrote: Thanks. Would you or anyone reading this know if this is unique to D or does C++ also behave like this? Also, where is the memory, that new allocates? Is it

Re: Return values from auto function

2020-11-07 Thread Jesse Phillips via Digitalmars-d-learn
On Saturday, 7 November 2020 at 15:49:13 UTC, James Blachly wrote: ``` return i > 0 ? cast(Result) Success!int(i) : cast(Result) Failure("Sorry"); ``` I don't know about the SumType but I would expect you could use a construction instead of cast. import std; alias Result =

Re: Return values from auto function

2020-11-06 Thread Jesse Phillips via Digitalmars-d-learn
On Friday, 6 November 2020 at 15:06:18 UTC, Andrey Zherikov wrote: On Friday, 6 November 2020 at 14:58:40 UTC, Jesse Phillips wrote: On Friday, 6 November 2020 at 14:20:40 UTC, Andrey Zherikov wrote: This issue seems hit the inability to implicitly convert custom types. May be it makes more

Re: Return values from auto function

2020-11-06 Thread Jesse Phillips via Digitalmars-d-learn
On Friday, 6 November 2020 at 20:05:36 UTC, Ferhat Kurtulmuş wrote: On Friday, 6 November 2020 at 10:51:20 UTC, Andrey Zherikov wrote: I have auto function 'f' that might return either an error (with some text) or a result (with some value). The problem is that the type of the error is not the

Re: Return values from auto function

2020-11-06 Thread Jesse Phillips via Digitalmars-d-learn
On Friday, 6 November 2020 at 14:20:40 UTC, Andrey Zherikov wrote: On Friday, 6 November 2020 at 12:03:01 UTC, Paul Backus wrote: You can't. Both return values have to have the same type, which means the failure function has to be able to return more than one type, which means it has to be a

Re: Why is vibe.d json serializer/deserializer so complex?

2020-10-31 Thread Jesse Phillips via Digitalmars-d-learn
On Saturday, 31 October 2020 at 22:42:20 UTC, James Blachly wrote: So I've been meaning to ask this as I have been learning Rust off-and-on recently for web development, and was impressed by the traits functionality. In particular, with traits and some agreed upon API, many packages are

Re: I think Associative Array should throw Exception

2020-09-03 Thread Jesse Phillips via Digitalmars-d-learn
On Thursday, 3 September 2020 at 15:12:14 UTC, Steven Schveighoffer wrote: int[int] aa; aa[4] = 5; auto b = aa[4]; How is this code broken? It's valid, will never throw, and there's no reason that we should break it by adding an exception into the mix. int foo() nothrow { return

Re: I think Associative Array should throw Exception

2020-09-03 Thread Jesse Phillips via Digitalmars-d-learn
On Tuesday, 1 September 2020 at 18:55:20 UTC, Steven Schveighoffer wrote: On 9/1/20 2:20 PM, Jesse Phillips wrote: Using RangeError is nice as it allows code to use array index inside `nothrow.` This is the big sticking point -- code that is nothrow would no longer be able to use AAs. It

I think Associative Array should throw Exception

2020-09-01 Thread Jesse Phillips via Digitalmars-d-learn
This is going to be a hard one for me to argue but I'm going to give it a try. Today if you attempt to access a key from an associative array (AA) that does not exist inside the array, a RangeError is thrown. This is similar to when an array is accessed outside the bounds. ```

Re: Installing D on Fresh Windows 10 machine is a pain

2020-08-31 Thread Jesse Phillips via Digitalmars-d-learn
On Friday, 28 August 2020 at 14:36:57 UTC, rikki cattermole wrote: On 28/08/2020 3:59 AM, Jesse Phillips wrote: DMD installer still is unable to find "VS installed" One of the reasons for this is that the environment variables have not been updated. You need to restart to do this. This

Re: Installing D on Fresh Windows 10 machine is a pain

2020-08-27 Thread Jesse Phillips via Digitalmars-d-learn
On Thursday, 27 August 2020 at 15:59:51 UTC, Jesse Phillips wrote: Upon compiling a 64bit hello world I get helloworld> dmd -m64 .\hello.d LINK : fatal error LNK1104: cannot open file 'libucrt.lib' Error: linker exited with status 1104 I solved this by either installing c++

Installing D on Fresh Windows 10 machine is a pain

2020-08-27 Thread Jesse Phillips via Digitalmars-d-learn
Installing D isn't new to me but I haven't really had to do a fresh install for awhile and come from a time when I was installing VS from 2010 and up. VS 2019 Professional is installed on the system. I have installed the C++ desktop development for VS. DMD installer still is unable to find

Re: Send empty assoc array to function

2020-07-09 Thread Jesse Phillips via Digitalmars-d-learn
On Thursday, 9 July 2020 at 20:08:47 UTC, Anonymouse wrote: On Thursday, 9 July 2020 at 19:53:42 UTC, JN wrote: void foo(int[int] bar) { // ... } Is it possible to send an empty array literal? foo( [ 0 : 2 ] ) works foo( [] ) doesn't int[int] empty; foo(empty); works but it's two lines

Re: Why is there no std.stream anymore?

2020-06-18 Thread Jesse Phillips via Digitalmars-d-learn
On Thursday, 18 June 2020 at 14:53:58 UTC, aberba wrote: On Tuesday, 12 December 2017 at 20:51:30 UTC, Steven Schveighoffer wrote: On 12/11/17 6:33 PM, Seb wrote: [...] Since iopipe was mentioned several times, I will say a couple things: [...] I should really try iopipe this time round.

Re: Why is there no range iteration with index by the language?

2020-06-10 Thread Jesse Phillips via Digitalmars-d-learn
On Tuesday, 9 June 2020 at 23:53:16 UTC, Q. Schroll wrote: Is there any particular reason why std.range : enumerate is a thing Someone already mentioned dictionary. Consider that most ranges don't actually have an index. In this case you aren't actually asking to add indexes, but a count of

Re: Alpine support for D

2020-06-10 Thread Jesse Phillips via Digitalmars-d-learn
On Wednesday, 10 June 2020 at 01:06:30 UTC, aberba wrote: On Tuesday, 9 June 2020 at 14:23:34 UTC, Jesse Phillips wrote: I notice that in the new release for Alpine Linux it mentions support for D. I was curious what was meant by this and thought someone here would know. Just high level,

Alpine support for D

2020-06-09 Thread Jesse Phillips via Digitalmars-d-learn
I notice that in the new release for Alpine Linux it mentions support for D. I was curious what was meant by this and thought someone here would know. Just high level, like druntime was ported or packages added to the repo?

Re: Array fill performance differences between for, foreach, slice

2020-04-01 Thread Jesse Phillips via Digitalmars-d-learn
On Wednesday, 1 April 2020 at 12:22:48 UTC, Adam D. Ruppe wrote: On Wednesday, 1 April 2020 at 06:48:09 UTC, Jacob Carlborg wrote: You have not enabled optimizations. You should compile with `-O -release -inline` to enable all optimizations. -release should *never* be used. You're trading

Re: Converting Lua source to D

2020-03-08 Thread Jesse Phillips via Digitalmars-d-learn
On Saturday, 7 March 2020 at 01:14:14 UTC, Jesse Phillips wrote: Now I should look at getting the CI up and Test failure fixed. Test failures were my local system and related to the stack overflow tests. I have the build pipeline up and running but hit a couple of snags.

Re: How to use sets in D?

2020-03-08 Thread Jesse Phillips via Digitalmars-d-learn
On Friday, 7 February 2020 at 19:37:08 UTC, mark wrote: I am porting code from other languages to D as part of learning D, and I find I've used sets quite a lot. AFAIK D doesn't have a built-in set type or one in the std. lib. However, I've been perfectly successfully using int[E] where E is

Re: Converting Lua source to D

2020-03-06 Thread Jesse Phillips via Digitalmars-d-learn
On Thursday, 5 March 2020 at 16:54:35 UTC, AB wrote: I am only guessing, but I think the problem is line 87. Arrays and slices in D contain a length field and thus do not need to be null terminated. The foreach at line 96 iterates on all valid indices and thus in the last iteration you call

Converting Lua source to D

2020-03-04 Thread Jesse Phillips via Digitalmars-d-learn
I am making an attempt convert Lua to D. This is less about the conversion and more about exploring the tooling to make it happen. I have chosen to do this file by file and attempting to start with linint. I wanted to make use of dpp, however I hit a segmentation fault and reduced dependency.

Re: iopipe: Writing output to std.io File

2020-01-29 Thread Jesse Phillips via Digitalmars-d-learn
On Tuesday, 28 January 2020 at 16:09:55 UTC, Steven Schveighoffer wrote: Everything is pulled with iopipe, even output, so it's just a matter of who is pulling and when. Pushing is a matter of telling the other end to pull. -Steve That statement I think will be very helpful to me. The

Re: iopipe: Writing output to std.io File

2020-01-27 Thread Jesse Phillips via Digitalmars-d-learn
On Monday, 27 January 2020 at 18:12:40 UTC, Steven Schveighoffer wrote: Before I show you what to do, let me explain what the above actually does. 1. You constructed a buffer of characters. Good, this is the first step. 2. You used encodeText to convert the data to ubyte. Note that for char

Re: iopipe: Writing output to std.io File

2020-01-26 Thread Jesse Phillips via Digitalmars-d-learn
On Monday, 27 January 2020 at 01:50:00 UTC, Jesse Phillips wrote: Just as I'm hitting send the part I'm missing clicked: I needed to add the text encoding because my buffer is `char` but File writes `ubyte` ```dlang auto output() { return std.io.File("somefile.txt",

Re: iopipe: Writing output to std.io File

2020-01-26 Thread Jesse Phillips via Digitalmars-d-learn
Just as I'm hitting send the part I'm missing clicked: I needed to add the text encoding because my buffer is `char` but File writes `ubyte` ```dlang /+ dub.sdl: name "iobuftofile" dependency "iopipe" version="~>0.1.7" dependency "io" version="~>0.2.4" +/ void main() { import

iopipe: Writing output to std.io File

2020-01-26 Thread Jesse Phillips via Digitalmars-d-learn
I'd like to start utilizing IOPipe[1] more. Right now I have an interest in utilizing it for buffering output (actually I don't have a need for buffering, I just want to utilize iopipe) Looking through some different examples[2][3] I thought I would have something with this: ```dlang /+

Re: CTFE, string mixins & code generation

2020-01-24 Thread Jesse Phillips via Digitalmars-d-learn
On Friday, 24 January 2020 at 16:21:48 UTC, Jan Hönig wrote: I am looking for a detailed explanation or showcase regarding CTFE and string mixins. I want to play with D a little bit regarding code generation. I would like to have a pseudo-AST, consisting of a few classes, to represent some

Re: Reading a file of words line by line

2020-01-15 Thread Jesse Phillips via Digitalmars-d-learn
On Wednesday, 15 January 2020 at 19:50:31 UTC, mark wrote: I really do need a set for the next part of the program, but taking your code and ideas I have now reduced the function to this: WordSet getWords(string filename, int wordsize) { WordSet words; File(filename).byLine

Re: Problem with std.algorithm.iteration::substitute

2020-01-11 Thread Jesse Phillips via Digitalmars-d-learn
You can also turn your function into a fold. auto searches = ["1", "2"]; writeln (searches.fold!((a, b)  => a.substitute(b, "number").to!string)("come 1 come 2")) ;

Re: Problem with std.algorithm.iteration::substitute

2020-01-11 Thread Jesse Phillips via Digitalmars-d-learn
On Saturday, 11 January 2020 at 17:10:02 UTC, Martin Brezl wrote: Hi, i have a function like this: ``` import std.algorithm.iteration : substitute; //... string replace(string content, string[] searches , string replace) { if(searches.empty) return content; auto

Re: D's equivalent List Comprehension

2019-12-14 Thread Jesse Phillips via Digitalmars-d-learn
On Friday, 13 December 2019 at 15:35:24 UTC, mipri wrote: It might help your blog posts to use drepl in your examples: https://code.dlang.org/packages/drepl That is nice. Is there a web frontend? Rightnow I am using run.dlang.io from my phone. Prior to that I didn't compile anything.

D's equivalent List Comprehension

2019-12-13 Thread Jesse Phillips via Digitalmars-d-learn
I had mentioned my take on list comprehension here: https://forum.dlang.org/post/qslt0q$2dnb$1...@digitalmars.com#post-ycbohbqaygrgmidyhjma:40forum.dlang.org However someone put together a more comprehensive tutorial of its power. So I took the opportunity to demonstrate the parallel in D.

Re: How to simulate Window's "Press any key to continue..."

2019-11-22 Thread Jesse Phillips via Digitalmars-d-learn
On Friday, 22 November 2019 at 04:10:23 UTC, FireController#1847 wrote: I'm an extreme beginner to DLang (just started using it.. oh, an hour ago?), and I already can't figure out a, what I'd consider, fairly simplistic thing. This is my current code: module DTestApp1; import std.stdio;

Re: Which is the active fork in DFL gui library ?

2019-11-03 Thread Jesse Phillips via Digitalmars-d-learn
On Sunday, 3 November 2019 at 16:48:52 UTC, Vinod K Chandran wrote: On Sunday, 3 November 2019 at 14:01:03 UTC, Jesse Phillips https://github.com/Rayerd/dfl @Jesse Phillips, Thank you for the reply. Does DWT is built upon Java's SWT ? I heard that SWT is somewhat slower in windows.

Re: Which is the active fork in DFL gui library ?

2019-11-03 Thread Jesse Phillips via Digitalmars-d-learn
On Saturday, 2 November 2019 at 20:01:27 UTC, Vinod K Chandran wrote: Hi all, I just found that DFL gui library very interesting. But after some searching, i can see that DFL is inactive and there is few other forks for it. So this is my question - Which fork is good for a gui development in

Re: Permission to Use Comments?

2019-10-14 Thread Jesse Phillips via Digitalmars-d-learn
On Monday, 14 October 2019 at 11:14:50 UTC, Ron Tarrant wrote: Hi all, I've been thinking about how to take GtkDcoding to the next level and one idea is to use (favourable) comments made here on the forum to help promote the blog. So, since I'm not clear on copyright law and how it affects

Simplifying process piping

2019-09-22 Thread Jesse Phillips via Digitalmars-d-learn
As noted in this announcement, I started writing some basic tutorials for D. https://forum.dlang.org/post/efpyegvrezybdrmug...@forum.dlang.org At a post a week, I've got 10 weeks of backlog posts. One of these is a post on input output piping.

Re: Question about generation of template functions

2019-08-29 Thread Jesse Phillips via Digitalmars-d-learn
On Wednesday, 28 August 2019 at 20:56:25 UTC, Machine Code wrote: I was writing a recursive function that uses template, I thought it would generate the proper template function on the fly to match the type in the parameter but it seems to not so so and try to use the called function,

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

2019-03-01 Thread Jesse Phillips via Digitalmars-d-learn
On Friday, 1 March 2019 at 11:38:51 UTC, BoQsc wrote: "And indeed rdmd won't call your script if it doesn't have the proper extension." Then why does Dlang Tour includes shebang: #!/usr/bin/env rdmd Instead of the one you mentioned, that is fool proof. (#!/bin/dmd -run) Is that an

Re: Am I missing with ref in this code?

2019-01-26 Thread Jesse Phillips via Digitalmars-d-learn
On Thursday, 24 January 2019 at 15:28:19 UTC, Suliman wrote: I am doing very small link-checker. Here is' code https://run.dlang.io/is/p8whrA I am expecting that on line: writefln("url: %s, status: %s", url.url, url.status); I will print link and it's status. But I am getting only: url:

Re: Co-developing application and library

2019-01-06 Thread Jesse Phillips via Digitalmars-d-learn
On Saturday, 5 January 2019 at 13:01:24 UTC, Russel Winder wrote: Dub seems to have the inbuilt assumption that libraries are dependencies that do not change except via a formal release when you developing an application. Clearly there is the workflow where you want to amend the library but

Re: 9999999999999999.0 - 9999999999999998.0

2019-01-05 Thread Jesse Phillips via Digitalmars-d-learn
On Sunday, 6 January 2019 at 00:20:40 UTC, Samir wrote: [1] https://news.ycombinator.com/item?id=18832155 [2] https://en.wikipedia.org/wiki/IEEE_754 Since you got your answer you may also like http://dconf.org/2016/talks/clugston.html

Re: dub doesn't work with dmd 1:2.082.0-1.0?

2018-09-14 Thread Jesse Phillips via Digitalmars-d-learn
On Friday, 14 September 2018 at 05:41:41 UTC, rmc wrote: I do wonder if `dmd` by itself on the command line works. Could it be some sort of 32 bit bug in the latest release of dmd? Relating to argc/argv. "source/dub/compilers/compiler.d(127)" That doesn't look like DMD source code.

Re: dub doesn't work with dmd 1:2.082.0-1.0?

2018-09-13 Thread Jesse Phillips via Digitalmars-d-learn
On Monday, 10 September 2018 at 09:23:19 UTC, SuperPrower wrote: dub was working nice until I updated my system (I run ArchLinux32) just now. dmd was updated from version 1:2.081.2-1.0 to 1:2.082.0-1.0 (according to pacman package manager). After that, I couldn't invoke dub for anything. Here

Re: [Unit tests] Mocking D objects

2018-08-23 Thread Jesse Phillips via Digitalmars-d-learn
On Wednesday, 22 August 2018 at 08:33:36 UTC, Andrey wrote: Hello, I know that D has build-in unit tests. If so, what mechanism D provides for mocking objects? I'd like to pose the question, what are you testing. This looks like you are testing that your mocked object returns 10. I usually

Re: D need an ORM library!

2018-08-20 Thread Jesse Phillips via Digitalmars-d-learn
On Monday, 20 August 2018 at 02:30:16 UTC, binghoo dang wrote: hi, I thinks D need an ORM library for Sqlite/Mysql/PostgreSQL, entity currently support all the three targets, but entity's API is too complex and cumbersome for using. Is there a more light-weight and simpler implementation

Re: Dependency injection pattern

2018-05-13 Thread Jesse Phillips via Digitalmars-d-learn
On Sunday, 13 May 2018 at 07:42:10 UTC, Suliman wrote: Could anybody give small example of Dependency injection pattern? I googled about it, but found only C# examples and I am not quite sure how to use them. Also I would like get some explanation/comments for code. Here is a quick example

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

2018-05-08 Thread Jesse Phillips via Digitalmars-d-learn
On Tuesday, 8 May 2018 at 18:38:10 UTC, BoQsc wrote: Tested with these versions so far, and had all the same errors: C:\Users\Vaidas>dmd --version DMD32 D Compiler v2.079.1 C:\Users\Vaidas>dub --version DUB version 1.8.1, built on Apr 14 2018 C:\Users\Vaidas>dmd --version DMD32 D Compiler

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

2018-05-08 Thread Jesse Phillips via Digitalmars-d-learn
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 https://dlang.org frontpage: Maybe that isn't the best choice of beginner

Re: dxml behavior after exception: continue parsing

2018-05-08 Thread Jesse Phillips via Digitalmars-d-learn
On Monday, 7 May 2018 at 22:24:25 UTC, Jonathan M Davis wrote: I've been considering adding more configuration options where you say something like you don't care if any invalid characters are encountered, in which case, you could cleanly parse past something like an unescaped &, but you'd

Re: dxml behavior after exception: continue parsing

2018-05-07 Thread Jesse Phillips via Digitalmars-d-learn
On Monday, 7 May 2018 at 19:46:00 UTC, Jesse Phillips wrote: So I have an XML like document which fails to adhere completely to XML. One of these such events is that & is used without escaping. My observation is that after the exception it is possible to move to the next element without

dxml behavior after exception: continue parsing

2018-05-07 Thread Jesse Phillips via Digitalmars-d-learn
So I have an XML like document which fails to adhere completely to XML. One of these such events is that & is used without escaping. My observation is that after the exception it is possible to move to the next element without issue. Is this something expected and will be maintained?

Re: Is HibernateD dead?

2018-05-07 Thread Jesse Phillips via Digitalmars-d-learn
You should get a hold of Vadim Lopatin and see if he would give you commit rights to the main repo. There was a great article I can't find by someone who would add contributors if they made good pull requests. It helped to keep his work living on and didn't need to keep involved. So I push

Re: Windows to Linux Porting - timeCreated and timeLastAccessed

2018-05-07 Thread Jesse Phillips via Digitalmars-d-learn
On Monday, 7 May 2018 at 14:31:23 UTC, Jesse Phillips wrote: I wouldn't use time created. It can be newer than last modified this wholey inacurate. Last accessed could be a much more appopriate choice if trying to determine what is important. Sorry, to answer your actual question, I do

Re: Windows to Linux Porting - timeCreated and timeLastAccessed

2018-05-07 Thread Jesse Phillips via Digitalmars-d-learn
On Friday, 4 May 2018 at 11:49:24 UTC, Vino wrote: Hi All, Request your help, I have a D program written on Windows platform and the program is working as expected, now i am trying to port the same program to Linux, my program use the function "timeCreated" from std.file for Windows hugely

Re: Get files from directory sorted by name

2018-04-27 Thread Jesse Phillips via Digitalmars-d-learn
On Thursday, 26 April 2018 at 16:59:45 UTC, Dr.No wrote: On Wednesday, 25 April 2018 at 19:25:11 UTC, Jesse Phillips wrote: On Wednesday, 25 April 2018 at 17:34:41 UTC, Dr.No wrote: Is there something implemented already to get the files from directory by name using D or I'm on my own and I

Re: Get files from directory sorted by name

2018-04-25 Thread Jesse Phillips via Digitalmars-d-learn
On Wednesday, 25 April 2018 at 17:34:41 UTC, Dr.No wrote: Is there something implemented already to get the files from directory by name using D or I'm on my own and I have to write it myself? I didn't find how do that with dirEntries() I want to add that sorting can be done, if you just call

Re: unittests, dub and libraries

2018-03-28 Thread Jesse Phillips via Digitalmars-d-learn
On Wednesday, 28 March 2018 at 21:29:22 UTC, Jesse Phillips wrote: And a note on the reverse, if you have an executable project $ dub test won't build in the app.d file since it contains main and dub test wants to avoid running your main function. For reference:

Re: unittests, dub and libraries

2018-03-28 Thread Jesse Phillips via Digitalmars-d-learn
On Wednesday, 28 March 2018 at 03:07:23 UTC, Jonathan M Davis wrote: Run dub test The problem is that an executable needs a main, and a library doesn't have one, whereas when you're testing a library, you need an executable. So, a main must be inserted - e.g. with the -main flag to dmd.

Re: How to use an associative array with array values.

2018-03-21 Thread Jesse Phillips via Digitalmars-d-learn
On Wednesday, 21 March 2018 at 18:31:29 UTC, tipdbmp wrote: I see. I guess the other would be: { int[8192] bar; int[8192][string] foo; foo["a"] = bar; foo["a"][8191] = -1; } https://run.dlang.io/is/AK2X2t Are you looking to use static arrays or dynamic? You can't use the new

Re: Is there any web browser control in D Lang to display html file ?

2018-03-16 Thread Jesse Phillips via Digitalmars-d-learn
On Friday, 16 March 2018 at 10:31:51 UTC, Jayam wrote: I creating one simple desktop application using dlang. I need to display some html file in my desktop application. How can make it works ? I believe on is available in dtw.

Re: Vibe.d rest & web service?

2018-02-07 Thread Jesse Phillips via Digitalmars-d-learn
On Wednesday, 7 February 2018 at 17:04:13 UTC, Nicholas Wilson wrote: Is it possible to have some urls routed to serve content and some to receive JSON in the same class? This seems unlikely to me, the function signature doesn't provide a way to distinguish between REST and not. I'm also

Re: invalid or corrupt file: duplicate COMDAT / Previous Definition Different

2018-01-10 Thread Jesse Phillips via Digitalmars-d-learn
On Wednesday, 10 January 2018 at 19:32:28 UTC, Anonymouse wrote: /usr/bin/ld: Warning: size of symbol I think your case is this bug: https://issues.dlang.org/show_bug.cgi?id=15324 Another COMDAT error is: https://issues.dlang.org/show_bug.cgi?id=16687

Re: git workflow for D

2017-12-05 Thread Jesse Phillips via Digitalmars-d-learn
I'm going to answer with something that others may not agree with, maybe they can enlighten me, but let me first get a generic principle of git and answer some questions. Git has 2 types of branches, local branches (you know them as just branches) and remotes (which have their own local

Re: Object oriented programming and interfaces

2017-12-05 Thread Jesse Phillips via Digitalmars-d-learn
On Monday, 4 December 2017 at 20:43:27 UTC, Dirk wrote: Hi! I defined an interface: interface Medoid { float distance( Medoid other ); uint id() const @property; } and a class implementing that interface: class Item : Medoid { float distance( Item i ) {...} uint id() const

Re: Basic questions about D lang?

2017-11-29 Thread Jesse Phillips via Digitalmars-d-learn
On Tuesday, 28 November 2017 at 13:39:11 UTC, Jayam wrote: Can we compile our program to multi program ? Based on your C# reference you must be referring to the "Mixed Platform" build option. No, that is a .NET thing and D is not on .NET (that project has died). D requires a more

Re: "version" private word

2017-10-31 Thread Jesse Phillips via Digitalmars-d-learn
On Tuesday, 31 October 2017 at 14:25:19 UTC, Igor Shirkalin wrote: On Tuesday, 31 October 2017 at 14:22:37 UTC, Jesse Phillips wrote: On Tuesday, 31 October 2017 at 13:46:40 UTC, Igor Shirkalin wrote: Hello! You goal should be to describe features. Version x86 ... Version = I can stand on

Re: "version" private word

2017-10-31 Thread Jesse Phillips via Digitalmars-d-learn
On Tuesday, 31 October 2017 at 13:46:40 UTC, Igor Shirkalin wrote: Hello! You goal should be to describe features. Version x86 ... Version = I can stand on my head ...

Re: CSV with empty values for integer fields

2017-10-29 Thread Jesse Phillips via Digitalmars-d-learn
Not really you'll need to parse it out as a string and do the conversion later. It probably would be good to support nullable!int pretty sure it doesn't currently.

Re: Assert and undefined behavior

2017-10-17 Thread Jesse Phillips via Digitalmars-d-learn
On Saturday, 14 October 2017 at 09:32:32 UTC, Timon Gehr wrote: The compiler can easily prove that the value of data.length does not change between the two points in the program. According to the specification, the behavior of the program is undefined in case the assertion fails, not just the

Re: Assert and undefined behavior

2017-10-13 Thread Jesse Phillips via Digitalmars-d-learn
On Thursday, 12 October 2017 at 15:37:23 UTC, John Burton wrote: This is an example of what I mean :- undefined what it is meant to do anyway, so the compiler can "optimize" out the if condition as it only affects the case where the language doesn't define what it's supposed to do anyway,

Re: CSV crash: "Quote located in unquoted token"

2017-10-13 Thread Jesse Phillips via Digitalmars-d-learn
On Friday, 13 October 2017 at 08:53:12 UTC, Dmitry wrote: Hi there. When I load csv, it crashes ("Quote located in unquoted token") on lines with quotes, like this: ResourceNode_RemoveFromView_Confirm,You are about to remove ""{0}"" from view ""{1}"". Continue?,You are about to remove

Re: Undo?

2017-10-12 Thread Jesse Phillips via Digitalmars-d-learn
On Thursday, 12 October 2017 at 02:18:49 UTC, Mr. Jonse wrote: A simple(incomplete) undo system. I'd think that for D you'd want to do type wrapping where a new type is created which saves changes and can manage an Undo tree. __gshared Data data = new Data(); auto undoable =

Re: Does D have an equivalent to C#'s String.IsNullOrWhiteSpace?

2017-10-12 Thread Jesse Phillips via Digitalmars-d-learn
On Thursday, 12 October 2017 at 18:17:54 UTC, Adam D. Ruppe wrote: On Thursday, 12 October 2017 at 18:11:55 UTC, Nieto wrote: Does D have an equivalent to C#'s String.IsNullOrWhiteSpace() in the standard library? import std.string; if(str.strip().length == 0) { // is null, empty, or all

Re: For fun: Expressive C++ 17 Coding Challenge in D

2017-10-04 Thread Jesse Phillips via Digitalmars-d-learn
On Wednesday, 4 October 2017 at 15:26:02 UTC, Ali Çehreli wrote: On 10/04/2017 02:04 AM, Biotronic wrote: ... Hey where is the list of features used e.g: ranges, ufcs...

Re: Looking for a mentor in D

2017-10-04 Thread Jesse Phillips via Digitalmars-d-learn
On Tuesday, 3 October 2017 at 06:54:01 UTC, eastanon wrote: I would like to choose D as my go to language and to do that I realise I need a mentor, someone who will walk and guide me and not get irritated by basic questions. I am pretty much a DIY person, so don't worry about mundane issues.

Re: Vibe.d using Windows Certificate binding, possible?

2017-10-04 Thread Jesse Phillips via Digitalmars-d-learn
On Wednesday, 4 October 2017 at 03:39:22 UTC, rikki cattermole wrote: On 04/10/2017 3:54 AM, Jesse Phillips wrote: https://msdn.microsoft.com/en-us/library/windows/desktop/cc307220(v=vs.85).aspx "Application program source files include the Http.h header file to access function prototypes

Re: Vibe.d using Windows Certificate binding, possible?

2017-10-03 Thread Jesse Phillips via Digitalmars-d-learn
On Tuesday, 3 October 2017 at 23:29:49 UTC, rikki cattermole wrote: On 03/10/2017 4:52 PM, Jesse Phillips wrote: I'm pretty sure this isn't possible, but maybe someone understands Windows better. Windows provides a means no bind a certificate to a port using netsh.exe. This means (at least

Vibe.d using Windows Certificate binding, possible?

2017-10-03 Thread Jesse Phillips via Digitalmars-d-learn
I'm pretty sure this isn't possible, but maybe someone understands Windows better. Windows provides a means no bind a certificate to a port using netsh.exe. This means (at least for standard Windows networking calls) connections to that port will be given the bound cert. The Vibe.d

Re: Is it possible to specify the address returned by the address of operator?

2017-09-27 Thread Jesse Phillips via Digitalmars-d-learn
On Wednesday, 27 September 2017 at 16:35:54 UTC, DreadKyller wrote: My question is about overloading, several operators can be overloaded in D, one of the ones that can't apparently is the address of operator (). My question is have I simply missed it or does it actually not exist, and if it's

Communication was [Re: What the hell is wrong with D?]

2017-09-20 Thread Jesse Phillips via Digitalmars-d-learn
On Wednesday, 20 September 2017 at 02:34:50 UTC, EntangledQuanta wrote: When they then make up excuses to try to justify the wrong and turn it in to a right, they deserved to be attacked. That isn't how it went down, you attacked then justification was provided. for someone that programs in

Re: What the hell is wrong with D?

2017-09-19 Thread Jesse Phillips via Digitalmars-d-learn
On Tuesday, 19 September 2017 at 19:16:05 UTC, EntangledQuanta wrote: The D community preaches all this safety shit but when it comes down to it they don't seem to really care(look at the other responses like like "Hey, C does it" or "Hey, look up the operator precedence"... as if those

Re: What the hell is wrong with D?

2017-09-19 Thread Jesse Phillips via Digitalmars-d-learn
On Tuesday, 19 September 2017 at 17:40:20 UTC, EntangledQuanta wrote: I assume someone is going to tell me that the compiler treats it as writeln((x + (_win[0] == '@')) ? w/2 : 0); Yeah, that is really logical! Yeah, I've been bitten by that in languages like C#. I wish D didn't follow in

Re: Ranges seem awkward to work with

2017-09-11 Thread Jesse Phillips via Digitalmars-d-learn
On Tuesday, 12 September 2017 at 01:18:21 UTC, Nicholas Wilson wrote: On Tuesday, 12 September 2017 at 01:13:29 UTC, Hasen Judy wrote: Is this is a common beginner issue? if `range.save` works use that, otherwise std.csv does not, IIRC. `range.dup` will duplicate the range That isn't a

Re: Little app using gtkD, how to make it well?

2017-09-11 Thread Jesse Phillips via Digitalmars-d-learn
On Monday, 11 September 2017 at 20:19:28 UTC, Romain wrote: Hello, I started an application using gtkD and libusb-d. I would love to get some hints about how to make good use of D since I'm a java developper and maybe use too much of it in D code or doing wrong things. The program will

Re: One path skips constructor - is this a bug?

2017-09-07 Thread Jesse Phillips via Digitalmars-d-learn
On Thursday, 7 September 2017 at 16:08:53 UTC, Piotr Mitana wrote: Code: === import std.conv; import std.regex; struct A This throws a compilation error: main.d(17): Error: one path skips constructor main.d(15): Error: return without calling constructor Why

Re: New programming paradigm

2017-09-07 Thread Jesse Phillips via Digitalmars-d-learn
On Monday, 4 September 2017 at 03:26:23 UTC, EntangledQuanta wrote: To get a feel for what this new way of dealing with dynamic types might look like: void foo(var y) { writeln(y); } var x = "3"; // or possibly var!(string, int) for the explicit types used foo(x); x = 3; foo(x); (just

Re: Bug in D!!!

2017-09-02 Thread Jesse Phillips via Digitalmars-d-learn
On Saturday, 2 September 2017 at 00:00:43 UTC, EntangledQuanta wrote: Regardless of the implementation, the idea that we should throw the baby out with the bathwater is simply wrong. At least there are a few who get that. By looking in to it in a serious manner an event better solution might

Re: Bug in D!!!

2017-09-01 Thread Jesse Phillips via Digitalmars-d-learn
I've love being able to inherit and override generic functions in C#. Unfortunately C# doesn't use templates and I hit so many other issues where Generics just suck. I don't think it is appropriate to dismiss the need for the compiler to generate a virtual function for every instantiated T,

Re: std.algorithm.joiner unexpected behavior

2017-08-31 Thread Jesse Phillips via Digitalmars-d-learn
On Thursday, 31 August 2017 at 18:26:33 UTC, Sergei Degtiarev wrote: Hi, I tried to create a simple range concatenating several files, something like this: File[] files; foreach(ln; joiner(files.map!(a => a.byLine))) writeln(ln); and I see every

Re: It makes me sick!

2017-07-27 Thread Jesse Phillips via Digitalmars-d-learn
On Thursday, 27 July 2017 at 03:34:19 UTC, FoxyBrown wrote: Knowing that every time I upgrade to the latest "official" D compiler I run in to trouble: I recompiled gtkD with the new compiler, same result. My code was working before the upgrade just fine and I did not change anything. I've

Re: Implementing interfaces using alias this

2017-06-16 Thread Jesse Phillips via Digitalmars-d-learn
On Friday, 16 June 2017 at 08:34:21 UTC, Biotronic wrote: On Thursday, 15 June 2017 at 18:49:58 UTC, Jesse Phillips wrote: wrap!IDuck Ah, so it does exist in Phobos. I thought it should be there, but didn't find it. Thanks! -- Biotronic Yeah, when Andrei introduced the wrap function I

Re: Implementing interfaces using alias this

2017-06-15 Thread Jesse Phillips via Digitalmars-d-learn
On Wednesday, 14 June 2017 at 09:34:27 UTC, Balagopal Komarath wrote: Why doesn't this work? The Test!Duck type has a void quack() method but the compiler says it is not implemented. You question was answered, but you can do this: -- interface IDuck { void

  1   2   >