Re: Restrict type of function parameter to a defined list of types?

2021-12-12 Thread Martin B via Digitalmars-d-learn
On Sunday, 12 December 2021 at 14:11:48 UTC, Paul Backus wrote: You can use a [template constraint][1]: Hi Paul, yes! thats it, Thanks. I am facepalming me right now because have been on that webpage and missed that point.

Re: Restrict type of function parameter to a defined list of types?

2021-12-12 Thread Martin B via Digitalmars-d-learn
On Sunday, 12 December 2021 at 13:21:06 UTC, Adam D Ruppe wrote: On Sunday, 12 December 2021 at 13:11:58 UTC, Martin B wrote: Just add a forwarding overload: Hi Adam, i am wondering if there is another possibility without having to create overloads for each parameter type - something like

Restrict type of function parameter to a defined list of types?

2021-12-12 Thread Martin B via Digitalmars-d-learn
Hi everyone, lets say that required is a setter method: ``` Nullable!string str(Nullable!string setter) { return this._str = setter; } ``` The user should be able to: ``` auto a = new A(); a.str = "abc"; ``` As the setters parameter is defined to be of type `Nullable!string`, the compiler

Nice example for operator overload resulting in readable linear algebra expressions

2021-11-19 Thread Martin Tschierschke via Digitalmars-d-learn
I just want to share a view lines of code. The availability of operator overloading can result in very short and precise code for linear algebra. To test/explore it a little I just modified the alias this example: ``` #!/usr/bin/env rdmd struct Point { double[2] p; // Forward all undefi

Re: writeln the struct from the alis this Example from the home page

2021-11-19 Thread Martin Tschierschke via Digitalmars-d-learn
On Thursday, 18 November 2021 at 16:08:22 UTC, Paul Backus wrote: On Thursday, 18 November 2021 at 13:51:42 UTC, Martin Tschierschke wrote: [...] You can define a `toString` method, like this: ```d string toString() { import std.conv; return p.to!string; } ``` You can find more

writeln the struct from the alis this Example from the home page

2021-11-18 Thread Martin Tschierschke via Digitalmars-d-learn
Hello, if you take the example from the home page, with the additional last line: ```d struct Point { private double[2] p; // Forward all undefined symbols to p alias p this; double dot(Point rhs) { return p[0] * rhs.p[0] + p[1] * rhs.p[1]; } } void main() { i

Is unix time function in wrong module?

2021-05-19 Thread Martin via Digitalmars-d-learn
Hi, shouldn't the unix time functions be in std.datetime.Date and std.datetime.DateTime instead of std.datetime.SysTime? The documentation states: - "std.datetime.systime for a point in time with a timezone." - "std.datetime.date for points in time without timezones." Unix epoch is 00:00:00 U

Re: How do I create classes dynamically?

2021-04-15 Thread Martin via Digitalmars-d-learn
On Wednesday, 14 April 2021 at 20:38:16 UTC, Mario wrote: I wanted to find out if it is possible to create classes dynamically. out of curiosity: Why you would like to do this? I cannot think of a use case for this - this is why i ask.

null and initialized string comparisons

2021-02-17 Thread Martin via Digitalmars-d-learn
Hi, is this how it supposed to be? (https://run.dlang.io/is/7B4irm) --- string a = null; string t = ""; assert( ! a ); assert( t ); assert( t == a ); --- I have not expected assert(t == a) to be true - i would like to know the argument for why this is correct when at the same time assert(!a)

Tuple or struct as return type?

2021-02-06 Thread Martin via Digitalmars-d-learn
Hi, lets say i want to create a function that returns multiple values - e.g. Tuple!(string,string). Why/when i should prefer Tuple as a return type over returning a struct (or even string[2] in this case)? Thank you

Re: why is "hello".writeln considered bad?

2020-11-20 Thread Martin via Digitalmars-d-learn
On Friday, 20 November 2020 at 10:03:18 UTC, Daniel Kozak wrote: I remember days when I liked UFCS too . Unfortunately it is not so awesome when you use it with IDE. And I would like to add: if you use in a bigger team. It's annoying when every dev have a own taste.. And together with option

Re: magically a static member on init?

2020-11-15 Thread Martin via Digitalmars-d-learn
On Sunday, 15 November 2020 at 00:29:41 UTC, H. S. Teoh wrote: if you don't like the semantics, don't use it; always allocate the field in the class ctor instead. Hi, i neither like it nor dislike it - it just caught me by surprise because i was under the impression that if i create a new ins

Re: magically a static member on init?

2020-11-14 Thread Martin via Digitalmars-d-learn
On Saturday, 14 November 2020 at 23:30:58 UTC, Adam D. Ruppe wrote: On Saturday, 14 November 2020 at 23:20:55 UTC, Martin wrote: Is this intentional? [...] alright, thank you! :)

magically a static member on init?

2020-11-14 Thread Martin via Digitalmars-d-learn
Hi, i do no know if this is intended - but imo this is weird: https://run.dlang.io/is/eBje3A I expected that `c.a.str == ""` (just like `c.str` is). But instead `c.a.str` keeps the value of `b.a.str`. Is this intentional? IMO this feels not consistent and its weird when a reference leaks into

Re: vibe.d / experience / feedback

2020-10-03 Thread Martin via Digitalmars-d-learn
On Friday, 2 October 2020 at 09:46:09 UTC, Denis Feklushkin wrote: Because standard implementation worse? What do you mean with "worse"? In my experience std.json is a very thin implementation of the JSON spec - without/very low "magic". IMO this is what one wants in a std lib. Its a good sta

passing a parrameter read-only ref?

2020-09-13 Thread Martin via Digitalmars-d-learn
Hi, i would like to create a function which takes the first parameter as a reference to a struct - but assure the calle that the reference is read-only. Can this be done? If i am not mistaken, then the "in" Parameter Storage Class is what i want(?). But the documentation states that this feat

Re: How to compile Windows exe files from this source

2020-08-12 Thread Martin via Digitalmars-d-learn
On Sunday, 9 August 2020 at 19:04:07 UTC, Marc wrote: I don't know much more about D than creating a 'hello world' exe file with the DMD Compiler but I'm interested in using the eBay/tsv-utils binaries. Unfortunately, the author didn't create any MS Windows binaries: https://github.com/eBay/tsv-

Re: Factory pattern for classes

2020-08-10 Thread Martin via Digitalmars-d-learn
On Sunday, 9 August 2020 at 15:56:31 UTC, Ali Çehreli wrote: module deneme; import std.stdio; interface I { void methodName(); } ... I getClassById(uint id) { if (id == 0) { return cast(A)Object.factory("deneme.A"); } else if(id == 1) { return cast(B)Object.factory("de

Re: Idiomatic D code to avoid or detect devision by zero

2020-08-06 Thread Martin Tschierschke via Digitalmars-d-learn
On Monday, 3 August 2020 at 15:33:54 UTC, Dominikus Dittes Scherkl wrote: [...] For really long expressions you could also split it on multiple lines: c = (b_expression == 0) ? (d_longer_expression) : (a_expression/b_expression); +1 looks clean!

Re: Idiomatic D code to avoid or detect devision by zero

2020-08-03 Thread Martin Tschierschke via Digitalmars-d-learn
On Friday, 31 July 2020 at 14:18:15 UTC, Steven Schveighoffer wrote: On 7/31/20 9:55 AM, Martin Tschierschke wrote: What would be the idiomatic way to write a floating point division occuring inside a loop and handle the case of division by zero. c = a/b; // b might be zero sometimes, than

Re: Idiomatic D code to avoid or detect devision by zero

2020-08-03 Thread Martin Tschierschke via Digitalmars-d-learn
On Friday, 31 July 2020 at 15:19:25 UTC, Andrea Fontana wrote: On Friday, 31 July 2020 at 13:55:18 UTC, Martin Tschierschke wrote: What would be the idiomatic way to write a floating point division occuring inside a loop and handle the case of division by zero. c = a/b; // b might be zero

Idiomatic D code to avoid or detect devision by zero

2020-07-31 Thread Martin Tschierschke via Digitalmars-d-learn
What would be the idiomatic way to write a floating point division occuring inside a loop and handle the case of division by zero. c = a/b; // b might be zero sometimes, than set c to an other value (d). (In the moment I check the divisor being zero or not, with an if-than-else structure, bu

Re: Compare string with German umlauts

2020-05-19 Thread Martin Tschierschke via Digitalmars-d-learn
On Monday, 18 May 2020 at 14:28:33 UTC, Steven Schveighoffer wrote: What you need is to normalize the data for comparison: https://dlang.org/phobos/std_uni.html#normalize For more reference: https://en.wikipedia.org/wiki/Combining_character -Steve I checked it again but could not reprodu

Re: Compare string with German umlauts

2020-05-19 Thread Martin Tschierschke via Digitalmars-d-learn
On Monday, 18 May 2020 at 14:28:33 UTC, Steven Schveighoffer wrote: On 5/18/20 9:44 AM, Martin Tschierschke wrote: [...] using == on strings is going to compare the exact bits for equality. In unicode, things can be encoded differently to make the same grapheme. For example, ö is a code

Re: Compare string with German umlauts

2020-05-19 Thread Martin Tschierschke via Digitalmars-d-learn
On Monday, 18 May 2020 at 14:22:31 UTC, WebFreak001 wrote: [...] It solved the problem, but what is the right way to use umlauts (encode them) inside the program? Your code should have already worked like that, assuming your input file is a UTF-8 file. Check with an editor like Notepad++ or V

Compare string with German umlauts

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

Re: spawn a function with object as arg?

2020-03-05 Thread Martin Brezel via Digitalmars-d-learn
On Thursday, 5 March 2020 at 03:04:10 UTC, Adam D. Ruppe wrote: You can also not use `spawn` and instead give `new Thread` a try from core.thread. Thanks for the hint, I didn't notice core.thread at all. I will definitely try it out. Unfortunately the documentation page for core.thread is curr

spawn a function with object as arg?

2020-03-04 Thread Martin Brezel via Digitalmars-d-learn
I want to create a Client, which receives and handles received data in background while the Client can send via the same socket. My first idea was something like this: class Client { private Socket socket; private Tid receiverTid; this(Socket socket) {

Re: total newbie + IDE

2020-02-09 Thread Martin Brezel via Digitalmars-d-learn
On Sunday, 9 February 2020 at 13:22:56 UTC, solnce wrote: I was expecting D lang to have something similar,if not an RAD, then native IDE with all that basic functionality support. VisualStudioCode seems to be what you are looking for - except I do not fully understand what you mean by "nativ

Deprecation message from phobos compiling a vibe.d app.

2020-01-30 Thread Martin Tschierschke via Digitalmars-d-learn
When building my small vibe.d app I am getting this messages twice: /usr/include/dmd/phobos/std/range/primitives.d(174,38): Deprecation: alias byKeyValue this is deprecated - Iterate over .byKeyValue instead. /usr/include/dmd/phobos/std/range/primitives.d(176,27): Deprecation: alias byKeyValu

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

2020-01-11 Thread Martin Brezl via Digitalmars-d-learn
On Saturday, 11 January 2020 at 17:10:02 UTC, Martin Brezl wrote: Hi, i have a function like this: ``` [...] auto result = content.substitute(searches.front,replace); for(size_t i=1; i < searches.length; i++) { searches.popFront(); res

Problem with std.algorithm.iteration::substitute

2020-01-11 Thread Martin Brezl via Digitalmars-d-learn
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 result = content.substitute(searches.front,replace); for(size_t

Execute certain Tests?

2019-11-02 Thread Martin Brezel via Digitalmars-d-learn
Is there a trick to execute only the test, defined in one file? Or the Tests of a certain Module? Or in general: How to avoid to execute all the tests, when running "dub test"? It doesn't has to be dub, though.

Re: Meta question - what about moving the D - Learn Forum to a seperate StackExchange platform?

2019-10-18 Thread Martin Tschierschke via Digitalmars-d-learn
On Friday, 18 October 2019 at 13:38:11 UTC, Ron Tarrant wrote: On Friday, 18 October 2019 at 07:35:21 UTC, Martin Tschierschke wrote: I very often end with a solution found on one of the StackExchange forums like > StackOverflow or AskUbuntu etc. I have found that StackExchange does of

Re: Meta question - what about moving the D - Learn Forum to a seperate StackExchange platform?

2019-10-18 Thread Martin Tschierschke via Digitalmars-d-learn
On Friday, 18 October 2019 at 12:41:53 UTC, Paolo Invernizzi wrote: On Friday, 18 October 2019 at 11:45:33 UTC, Seb wrote: On Friday, 18 October 2019 at 10:55:59 UTC, Martin Tschierschke wrote: [...] In the state of the D survey, there were more people in favor of StackOverflow than D.learn

Re: Meta question - what about moving the D - Learn Forum to a seperate StackExchange platform?

2019-10-18 Thread Martin Tschierschke via Digitalmars-d-learn
On Friday, 18 October 2019 at 12:51:35 UTC, bachmeier wrote: On Friday, 18 October 2019 at 07:35:21 UTC, Martin Tschierschke wrote: If I search for what ever, not related to D, I very often end with a solution found on one of the StackExchange forums like StackOverflow or AskUbuntu etc. The

Re: Meta question - what about moving the D - Learn Forum to a seperate StackExchange platform?

2019-10-18 Thread Martin Tschierschke via Digitalmars-d-learn
On Friday, 18 October 2019 at 10:23:28 UTC, jmh530 wrote: On Friday, 18 October 2019 at 07:35:21 UTC, Martin Tschierschke wrote: [snip] I think this is something that's been proposed before, but most people are happy with just asking a question here and usually people are pretty good

Meta question - what about moving the D - Learn Forum to a seperate StackExchange platform?

2019-10-18 Thread Martin Tschierschke via Digitalmars-d-learn
If I search for what ever, not related to D, I very often end with a solution found on one of the StackExchange forums like StackOverflow or AskUbuntu etc. The main advantage is, that all answers can be classified (up/down voted, moderated etc.) This is much better than finding something in th

selective tests

2019-10-12 Thread Martin Brezeln via Digitalmars-d-learn
Is it possible to execute only certain modules or tests which are defined in certain directories? For example, in go one can run "go test ./XYZ" to execute ony tests in ./XYZ or "go test ./..." to execute all the tests in and under the current directory. Please don't get me wrong, i do not w

Howto create bindings?

2019-09-28 Thread Martin Brezeln via Digitalmars-d-learn
Hello everyone, i have a rather general question about how to approach the attempt to create a binding for a foreign system, for which bindings already exists for other languages than dlang. To be more concrete: There is this Database i am using in some recent projects: "Apache Cassandra" /

Re: problems with swig generated code

2019-09-03 Thread Martin DeMello via Digitalmars-d-learn
On Sunday, 1 September 2019 at 11:19:11 UTC, DanielG wrote: Do you know whether SWIG's D generator is even being maintained? I've searched for it on the forums in the past and got the impression that it's outdated. I didn't realise that :( It was included in the current release of swig, so I

problems with swig generated code

2019-08-28 Thread Martin DeMello via Digitalmars-d-learn
I'm trying to add a D binding to a C++ project that already has a swig definition file; you can see my attempt here: https://github.com/martindemello/quackle/tree/d/bindings but trying to run dmd over the generated file errors with: $ dmd quackle.d quackle.d(105): Error: undefined identifier S

Re: How do I display unicode characters in D on standard (english) Windows 10 console window?

2019-07-30 Thread Martin Krejcirik via Digitalmars-d-learn
On Monday, 29 July 2019 at 22:31:01 UTC, kinke wrote: Switching the console code page to UTF-8, and then restoring the original one before termination. See https://github.com/ldc-developers/ldc/pull/3086/commits/5915534530fa095e7e5d58bcfb4ad100d249bbca#diff-c59e7716a40a08ce42f141c738f2c311. You

Re: DUB and ddoc - howto?

2019-06-28 Thread Martin Tschierschke via Digitalmars-d-learn
On Friday, 28 June 2019 at 13:03:17 UTC, Daniel Kozak wrote: Did you try dub build --help? Oh, thank you! I just looked at dub --help | grep -i doc ... and several other places...

DUB and ddoc - howto?

2019-06-28 Thread Martin Tschierschke via Digitalmars-d-learn
A very simple question, is there an example how to generate documentation with dub? (like dmd -D) My internet search was not successful.

Re: How to debug long-lived D program memory usage?

2019-04-17 Thread Martin Krejcirik via Digitalmars-d-learn
On Wednesday, 17 April 2019 at 16:27:02 UTC, Adam D. Ruppe wrote: Each individual process eats ~30-100 MB, but that times 60 = trouble. They start off small, like 5 MB, and grow over weeks or months, so it isn't something I can easily isolate in a Do you run GC.minimize ?

Re: [vibe-d/dub] Lin

2018-09-09 Thread Martin Tschierschke via Digitalmars-d-learn
On Friday, 7 September 2018 at 16:37:18 UTC, MamoKupe wrote: On Friday, 7 September 2018 at 16:20:40 UTC, MamoKupe wrote: marcinan@marcinan-PC ~/Pulpit/d $ dub init bibe Package recipe format (sdl/json) [json]: d Invalid format, "d", enter either "sdl" or "json". Package recipe format (sdl/json)

Re: Determine if CTFE or RT

2018-06-25 Thread Martin Tschierschke via Digitalmars-d-learn
On Monday, 25 June 2018 at 08:05:53 UTC, Mr.Bingo wrote: On Monday, 25 June 2018 at 07:02:24 UTC, Jonathan M Davis wrote: On Monday, June 25, 2018 05:47:30 Mr.Bingo via Digitalmars-d-learn wrote: The problem then, if D can't arbitrarily use ctfe, means that there should be a way to force ctfe o

Re: Convert a huge SQL file to CSV

2018-06-01 Thread Martin Tschierschke via Digitalmars-d-learn
On Friday, 1 June 2018 at 09:49:23 UTC, biocyberman wrote: I need to convert a compressed 17GB SQL dump to CSV. A workable solution is to create a temporary mysql database, import the dump, query by python, and export. But i wonder if there is something someway in D to parse the SQL file direct

Re: Why The D Style constants are written in camelCase?

2018-05-15 Thread Martin Tschierschke via Digitalmars-d-learn
On Wednesday, 9 May 2018 at 11:52:11 UTC, Jonathan M Davis wrote: On Wednesday, May 09, 2018 09:38:14 BoQsc via Digitalmars-d-learn wrote: [...] Every language makes its own choices with regards to how it goes about things, some of which are purely subjective. [...] - Jonathan M Davis Jus

Re: Parse .eml files

2018-04-12 Thread Martin Tschierschke via Digitalmars-d-learn
On Thursday, 12 April 2018 at 00:00:04 UTC, bachmeier wrote: On Wednesday, 11 April 2018 at 15:20:08 UTC, Martin Tschierschke wrote: My question in the moment is, how do I invoke Thunderbird to display a certain single mail (or maildir) file? How do I use Thunderbird as the client, to show

Re: Parse .eml files

2018-04-11 Thread Martin Tschierschke via Digitalmars-d-learn
On Wednesday, 11 April 2018 at 02:37:39 UTC, bachmeier wrote: On Monday, 9 April 2018 at 19:17:20 UTC, Adam D. Ruppe wrote: [...] I had a chance to try this out and it worked without a problem. I did have to download color.d in addition to the other dependencies you listed. In the event that

Re: #import mapi.h

2018-03-23 Thread Martin Tschierschke via Digitalmars-d-learn
On Friday, 23 March 2018 at 01:12:58 UTC, Mike Parker wrote: On Thursday, 22 March 2018 at 21:45:40 UTC, Martin Tschierschke wrote: On Thursday, 22 March 2018 at 17:42:46 UTC, Paul Backus wrote: On Wednesday, 21 March 2018 at 16:22:45 UTC, Martin Tschierschke wrote: Is there an step by step

Re: #import mapi.h

2018-03-22 Thread Martin Tschierschke via Digitalmars-d-learn
On Thursday, 22 March 2018 at 17:42:46 UTC, Paul Backus wrote: On Wednesday, 21 March 2018 at 16:22:45 UTC, Martin Tschierschke wrote: Is there an step by step introduction how to convert a C header of an external lib into the right extern(C){} block? In addition to what others have said, I

Re: #import mapi.h

2018-03-22 Thread Martin Tschierschke via Digitalmars-d-learn
On Thursday, 22 March 2018 at 12:53:23 UTC, Martin Tschierschke wrote: On Wednesday, 21 March 2018 at 17:12:07 UTC, Timoses wrote: [...] I got it, my first mini test with C bindings! Important missing at first: (stderr) import core.stdc.stdio : stderr, FILE; and use of toStringz inside

Re: #import mapi.h

2018-03-22 Thread Martin Tschierschke via Digitalmars-d-learn
On Wednesday, 21 March 2018 at 17:12:07 UTC, Timoses wrote: On Wednesday, 21 March 2018 at 16:22:45 UTC, Martin Tschierschke wrote: Is there an step by step introduction how to convert a C header of an external lib into the right extern(C){} block? A blog post or tutorial, or chapter in a D

Re: #import mapi.h

2018-03-22 Thread Martin Tschierschke via Digitalmars-d-learn
On Wednesday, 21 March 2018 at 18:42:43 UTC, nkm1 wrote: On Wednesday, 21 March 2018 at 16:22:45 UTC, Martin Tschierschke wrote: [...] The easiest thing to do is to write a wrapper in C. The wrapper will include all necessary headers and provide some easy to use functions that you can call

#import mapi.h

2018-03-21 Thread Martin Tschierschke via Digitalmars-d-learn
Is there an step by step introduction how to convert a C header of an external lib into the right extern(C){} block? A blog post or tutorial, or chapter in a D book? (I have those from Packt Publishing) (Especially I am trying to get this used with D: Montetdb C-API https://www.monetdb.org/D

Re: What's the proper way to add a local file dependence to dub?

2018-03-12 Thread Martin Tschierschke via Digitalmars-d-learn
On Monday, 12 March 2018 at 09:38:41 UTC, Martin Tschierschke wrote: On Sunday, 4 March 2018 at 16:46:56 UTC, Marc wrote: [...] I did it this sway: the part of dub.json: "dependencies": { [...] "mylib":{

Re: What's the proper way to add a local file dependence to dub?

2018-03-12 Thread Martin Tschierschke via Digitalmars-d-learn
On Sunday, 4 March 2018 at 16:46:56 UTC, Marc wrote: then copy it to sources folder? let's say I have a small library folder at C:\mylibrary\D where I want to use dir.d from it. How do I add that file dependence to dub? But I do not want to that file be passed directly to dmd, I want to that

Re: Profiling after exit()

2018-03-06 Thread Martin Nowak via Digitalmars-d-learn
On Thursday, 27 July 2017 at 15:16:35 UTC, Eugene Wissner wrote: Are there profilers that work well with dmd? valgrind? OProfile? Yes, any sampling profiler works fine, e.g. perf on linux, Intel VTune/AMD CodeXL on Windows. Those directly monitor CPU performance counters and have a negligible

Re: dmd-2.078.2 problems with Ubuntu 17.10 32Bit

2018-02-17 Thread Martin Tschierschke via Digitalmars-d-learn
On Wednesday, 14 February 2018 at 11:23:48 UTC, Andrea Fontana wrote: On Wednesday, 14 February 2018 at 11:16:25 UTC, Martin Tschierschke wrote: Ok, good to know! I started with 16.04 and made the initial mistake to take the 32 Bit version, do you use 32 or 64 Bit? 64bit of course! Andrea

Re: rdmd main.d leads to Segmentation fault

2018-02-14 Thread Martin Tschierschke via Digitalmars-d-learn
On Wednesday, 14 February 2018 at 10:28:51 UTC, Kagamin wrote: On Tuesday, 13 February 2018 at 06:53:46 UTC, Martin Tschierschke wrote: I am unfamiliar with debugging (gdb etc.) so any hint would be appreciated! https://issues.dlang.org/show_bug.cgi?id=18350 - maybe adjust bug severity. I

Re: dmd-2.078.2 problems with Ubuntu 17.10 32Bit

2018-02-14 Thread Martin Tschierschke via Digitalmars-d-learn
On Wednesday, 14 February 2018 at 10:57:47 UTC, Andrea Fontana wrote: On Tuesday, 13 February 2018 at 22:21:18 UTC, Martin Tschierschke wrote: I will downgrade to 16.04., the dist-upgrade to 17.10 was a mistake, resulting in problems with startx and newer kernels so I have to use 4.10. In my

Re: dmd-2.078.2 problems with Ubuntu 17.10 32Bit

2018-02-13 Thread Martin Tschierschke via Digitalmars-d-learn
On Tuesday, 13 February 2018 at 21:25:44 UTC, Jordi Sayol wrote: El 13/02/18 a les 08:03, Martin Tschierschke via Digitalmars-d-learn ha escrit: On Monday, 12 February 2018 at 21:18:01 UTC, Jordi Sayol wrote: El 12/02/18 a les 21:56, Martin Tschierschke via Digitalmars-d-learn ha escrit: I

Re: dmd-2.078.2 problems with Ubuntu 17.10 32Bit

2018-02-12 Thread Martin Tschierschke via Digitalmars-d-learn
On Monday, 12 February 2018 at 21:18:01 UTC, Jordi Sayol wrote: El 12/02/18 a les 21:56, Martin Tschierschke via Digitalmars-d-learn ha escrit: I just started to play around with D again on my notebook at home and realized, that I have a broken installation. Even the minimal D "hello

Re: rdmd main.d leads to Segmentation fault

2018-02-12 Thread Martin Tschierschke via Digitalmars-d-learn
On Sunday, 4 February 2018 at 11:50:05 UTC, Timoses wrote: On Thursday, 1 February 2018 at 09:01:34 UTC, Kagamin wrote: On Wednesday, 31 January 2018 at 16:59:15 UTC, Timoses wrote: And I would need to do what about it? Sorry, I'm not familiar with assembly code stuff in detail. You can try

Re: dmd-2.078.2 problems with Ubuntu 17.10 32Bit

2018-02-12 Thread Martin Tschierschke via Digitalmars-d-learn
On Monday, 12 February 2018 at 21:08:30 UTC, Seb wrote: On Monday, 12 February 2018 at 20:56:11 UTC, Martin Tschierschke wrote: I just started to play around with D again on my notebook at home and realized, that I have a broken installation. Even the minimal D "hello world" throws a

dmd-2.078.2 problems with Ubuntu 17.10 32Bit

2018-02-12 Thread Martin Tschierschke via Digitalmars-d-learn
I just started to play around with D again on my notebook at home and realized, that I have a broken installation. Even the minimal D "hello world" throws an error at execution. Speicherzugriffsfehler (Speicherabzug geschrieben) aka. core dump Compiling with ldc2 still works. Any hint?

Re: How to proceed with learning to code Windows desktop applications?

2018-02-02 Thread Martin Tschierschke via Digitalmars-d-learn
On Thursday, 1 February 2018 at 09:18:30 UTC, I Lindström wrote: [...] And thank you all for your ideas and suggestions. I'll try some out and see what works. I found this useful: https://github.com/adamdruppe/arsd/blob/master/simpledisplay.d

Re: I want to transmit the class name and the member name in the method

2018-01-15 Thread Martin Nowak via Digitalmars-d-learn
On Monday, 15 January 2018 at 15:28:19 UTC, Martin Nowak wrote: More concise stuff is possible with heavy compile-time trickery (https://dpaste.dzfl.pl/cd375ac594cf) without incurring dreaded 1+N queries or even any unnecessary SELECT fields. foreach (u; db.select!User.where!"NOT can_ove

Re: Does it have an http2 server/client lib like in golang?

2018-01-15 Thread Martin Nowak via Digitalmars-d-learn
On Monday, 15 January 2018 at 18:07:24 UTC, Cergoo wrote: subj WIP but a bit stalled. https://github.com/vibe-d/vibe.d/tree/http2-botan-cleanup Unless you really need server-push of assets, HTTP/2 on a reverse proxy gets you the same performance benefits as well.

Re: I want to transmit the class name and the member name in the method

2018-01-15 Thread Martin Nowak via Digitalmars-d-learn
On Friday, 5 January 2018 at 07:40:14 UTC, Brian wrote: auto db = new ORM; auto users = db.select(User).where(email.like("*@hotmail.com")).limit(10); Expression templates are a dead-end for any non-trivial queries. You have to embrace SQL to properly use RDMS, at the cost of beginners having

Re: how to localize console and GUI apps in Windows

2018-01-03 Thread Martin Krejcirik via Digitalmars-d-learn
On Friday, 29 December 2017 at 11:14:39 UTC, zabruk70 wrote: AFAIK, Windows GUI have no ANSI/OEM problem. You can use Unicode. Be advised there are some problems with console UTF-8 input/output in Windows. The most usable is Win10 new console window but I recommend to use Windows API (WriteC

Re: Polymorphism? Passing arguments

2017-11-03 Thread Martin via Digitalmars-d-learn
ok, thanks you very much for the information.

Re: Polymorphism? Passing arguments

2017-11-03 Thread Martin via Digitalmars-d-learn
Thank you for the answer On Saturday, 4 November 2017 at 01:35:41 UTC, Adam D. Ruppe wrote: Why are these ref? Just taking ref away from both of those will likely fix your problems. because without it i get the error "Program exited with code -11" The thing is, somwhere deeper in `setRelatio

Polymorphism? Passing arguments

2017-11-03 Thread Martin via Digitalmars-d-learn
I have a interface `interface Node {...}` and some classes implementing Node: ``` class Text : Node {...} class Element : Node {...} ``` and a function like this: `public void setRelation(ref Node parent , ref Node child) {...}` if i do this it works: ``` Node root = new Element("root"); Node te

Re: Skynet 1M Fiber microbenchmark in D

2017-10-20 Thread Martin Nowak via Digitalmars-d-learn
On Wednesday, 18 October 2017 at 12:32:31 UTC, Nordlöw wrote: Further, are we forced to use the GC for Fiber allocation or can a sub-class of Fibers implement its own allocation strategy? You could use std.typecons.scoped!Fiber, though it'll easily overflow your stack. Unfortunately Scoped do

Re: Skynet 1M Fiber microbenchmark in D

2017-10-20 Thread Martin Nowak via Digitalmars-d-learn
On Wednesday, 18 October 2017 at 11:01:56 UTC, Per Nordlöw wrote: On Wednesday, 18 October 2017 at 09:01:30 UTC, Per Nordlöw wrote: Creates an actor (goroutine, whatever), which spawns 10 new actors, each of them spawns 10 more actors, etc. until one million actors are created on the final leve

Last post from me not displayed on web frontend?

2017-09-22 Thread Martin Tschierschke via Digitalmars-d-learn
This post is to try if it works now. But I got an answer from Adam... Thank you.

Parsing mbox file to display with vibe.d

2017-09-22 Thread Martin Tschierschke via Digitalmars-d-learn
Hello, Parsing mbox file (/var/spool/mail/... on a Ubuntu machine) and splitting to a range or array of mail objects. Has anyone done this with D? please give me hint. (DUB, git, this forum?) Or should I start with formail (-s) as a subprocess? (At first step, I want to run a vibe.d server t

Re: Most convenient way to write a loop with fixed length and no need for the index?

2017-09-09 Thread Martin Tschierschke via Digitalmars-d-learn
On Friday, 30 June 2017 at 08:19:07 UTC, Anton Fediushin wrote: On Friday, 30 June 2017 at 07:44:45 UTC, Martin Tschierschke wrote: What do I have to do, to make this work? iota(number).each!...command_x(a...);command_y(b...);command_z(c..)) You can use it like this: iota(10).each!((x

Re: Should `dub run` prints its output to STDERR?

2017-09-09 Thread Martin Tschierschke via Digitalmars-d-learn
On Saturday, 9 September 2017 at 05:58:59 UTC, Ali Çehreli wrote: On 09/08/2017 09:51 PM, Ky-Anh Huynh wrote: > When I execute a program thanks to dub, `dub` also prints its > information to STDOUT: Try dub's --quiet command line switch. Ali Can I configure this also in dub.json (dub.sdl)? Sp

Re: Compare times: file modification time

2017-08-02 Thread Martin Tschierschke via Digitalmars-d-learn
On Wednesday, 2 August 2017 at 13:32:46 UTC, Adam D. Ruppe wrote: On Wednesday, 2 August 2017 at 13:25:25 UTC, Martin Tschierschke wrote: I get a SysTime, how to check if it is older than an interval (1 day)? D/Phobos idiomatically? if(Clock.currTime - timeLastModified("aa.d"

Compare times: file modification time

2017-08-02 Thread Martin Tschierschke via Digitalmars-d-learn
With import std.file:timeLastModified; auto time = timeLastModified(source); I get a SysTime, how to check if it is older than an interval (1 day)? D/Phobos idiomatically? (Currently I am using (Clock.currTime().toUnixTime-time.toUnixTime)< 60*60*24)). Regards mt.

Re: Using lazy code to process large files

2017-08-02 Thread Martin Drašar via Digitalmars-d-learn
r the explanation. Just to clarify - what would be needed to avoid auto-decoding in this case? Process it all as an arrays, using byChunk to read it, etc? @kdevel: Thank you for your solution as well. Martin

Re: Using lazy code to process large files

2017-08-02 Thread Martin Drašar via Digitalmars-d-learn
input.filter!(a => a.startsWith("...")) > .map!(a=>a.splitter(",").map!(a=>a.stripLeft(' '))) > .map!(a=>a.joiner(",")); > writeln(result); > } Thanks a lot. That did the trick. Martin

Using lazy code to process large files

2017-08-02 Thread Martin Drašar via Digitalmars-d-learn
this does not compile. Basically, I don't know how to feed MapResults to splitter and then sensibly join it. Thank you for any hint. Martin

Re: Compile Time versus Run Time

2017-07-31 Thread Martin Tschierschke via Digitalmars-d-learn
On Monday, 31 July 2017 at 15:57:28 UTC, Anonymouse wrote: On Monday, 31 July 2017 at 15:46:47 UTC, inevzxui wrote: On Monday, 31 July 2017 at 15:43:21 UTC, Martin Tschierschke wrote: [...] But the parameters are not checked at compile-time unless you specifically pass the pattern string as a

Compile Time versus Run Time

2017-07-31 Thread Martin Tschierschke via Digitalmars-d-learn
As a rookie in D programming I try to understand the power of templated functions with compile time parameters. With DMD 2.074 a compile time format (auto output = format!("Print this %s")(var);) was introduced, now we all know that very many of this format strings are immutable, so wouldn't i

howto touch a file - setTimes

2017-07-24 Thread Martin Tschierschke via Digitalmars-d-learn
When I tried to set the atime and mtime of a file (f) via: import std.datetime; auto time = Clock.currTime(); setTimes(f,time,time); I get "Operation not permitted." This is caused on linux by the rule, that if you are not the owner of the file you may only set the mtime of a file to current

Re: how to harvest the results of tasks from a taskpool?

2017-07-05 Thread Martin Tschierschke via Digitalmars-d-learn
On Wednesday, 5 July 2017 at 13:55:22 UTC, Martin wrote: Hi, i have a coulpe of different machines with MySQL Servers running on it. Now, i want to execute queries for all Databases at the same time and collect the Result to process it. I am new to the parallelism - so maybe i understand

how to harvest the results of tasks from a taskpool?

2017-07-05 Thread Martin via Digitalmars-d-learn
Hi, i have a coulpe of different machines with MySQL Servers running on it. Now, i want to execute queries for all Databases at the same time and collect the Result to process it. I am new to the parallelism - so maybe i understand something totaly wrong. What i tring is something like this

Re: Need simple sound

2017-07-05 Thread Martin Tschierschke via Digitalmars-d-learn
On Wednesday, 5 July 2017 at 10:19:54 UTC, Sebastiaan Koppe wrote: On Wednesday, 5 July 2017 at 09:43:05 UTC, Martin Tschierschke wrote: On Wednesday, 5 July 2017 at 07:21:45 UTC, Sebastiaan Koppe wrote: On Wednesday, 5 July 2017 at 05:34:37 UTC, FoxyBrown wrote: On Tuesday, 4 July 2017 at 20

Re: Need simple sound

2017-07-05 Thread Martin Tschierschke via Digitalmars-d-learn
On Wednesday, 5 July 2017 at 07:21:45 UTC, Sebastiaan Koppe wrote: On Wednesday, 5 July 2017 at 05:34:37 UTC, FoxyBrown wrote: On Tuesday, 4 July 2017 at 20:37:44 UTC, Sebastiaan Koppe wrote: Portaudio is simple as well. And nice cross platform. are there any bindings? Sure, see http://code

Re: About Dub capabilities

2017-07-04 Thread Martin Nowak via Digitalmars-d-learn
On Tuesday, 4 July 2017 at 20:46:33 UTC, Dukc wrote: Not that I have any need for that right now, I am just interested. preGenerate-/preBuildCommands are your friends to compile C++ code using dub. You'd invoke make or sth. and add the generated libs/objects to dub's sourceFiles. http://code

Re: Need simple sound

2017-07-04 Thread Martin Tschierschke via Digitalmars-d-learn
On Tuesday, 4 July 2017 at 11:59:33 UTC, Vladimir Panteleev wrote: On Monday, 3 July 2017 at 10:40:03 UTC, Martin Tschierschke wrote: On Monday, 3 July 2017 at 09:24:35 UTC, Guillaume Piolat wrote: On Monday, 3 July 2017 at 08:55:20 UTC, Martin Tschierschke wrote: Hello for a simple game I

Re: Need simple sound

2017-07-03 Thread Martin Tschierschke via Digitalmars-d-learn
On Monday, 3 July 2017 at 09:24:35 UTC, Guillaume Piolat wrote: On Monday, 3 July 2017 at 08:55:20 UTC, Martin Tschierschke wrote: Hello for a simple game I would like to add some very simple sound, not much different than the beeps of "PAC Man". Is there anything I can us

Need simple sound

2017-07-03 Thread Martin Tschierschke via Digitalmars-d-learn
Hello for a simple game I would like to add some very simple sound, not much different than the beeps of "PAC Man". Is there anything I can use for this?

Re: mysql-native + vibe.d example

2017-06-30 Thread Martin Tschierschke via Digitalmars-d-learn
On Friday, 30 June 2017 at 00:52:28 UTC, crimaniak wrote: Hi! Moving my project from mysql-lited to mysql-native I faced the problem with null pointer error inside of mysql-native: [...] It seems I am doing something wrong so myself-native fails to detect it in isValid(). So I search for exa

  1   2   3   4   >