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

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 about h

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 m

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 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 often have

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

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

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 unit

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

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

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 set

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!

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

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 infor

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

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

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: 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 use for this? Derelict

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 woul

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

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 som

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

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

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

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: 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") > 1.days) {

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: 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) { com

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

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.

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

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: 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 an error at

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

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: 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: 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":{ "versions": "~master",

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

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 bo

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

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 fo

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 int

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

Question about mysql-d Object

2015-12-07 Thread Martin Tschierschke via Digitalmars-d-learn
When I do the following: auto mysql = new Mysql("localhost", 3306, "mt", "", "verwaltung"); auto rows = mysql.query("select field from my_table limit 50"); foreach(row;rows){ writeln(row["field"]);} // second time same loop foreach(row;rows){ writeln(row["field"]);} I only get the output of

Re: Question about mysql-d Object

2015-12-08 Thread Martin Tschierschke via Digitalmars-d-learn
On Monday, 7 December 2015 at 16:11:19 UTC, Daniel Kozak wrote: On Monday, 7 December 2015 at 14:40:12 UTC, Martin Tschierschke wrote: When I do the following: auto mysql = new Mysql("localhost", 3306, "mt", "", "verwaltung"); auto rows = mysql.query("select field from my_table limit 50"); f

Re: Question about mysql-d Object

2015-12-08 Thread Martin Tschierschke via Digitalmars-d-learn
On Tuesday, 8 December 2015 at 15:14:06 UTC, Daniel Kozak wrote: [...] >> A nested loop, did not worked either: >> >> foreach(row;rows){ >> foreach(field;row){ >> writeln(field);} >> } [...] Now I took a work around, getting the field names in a separate mysql-request, but they should be avai

Re: Deit variable referencing

2016-01-03 Thread Martin Tschierschke via Digitalmars-d-learn
On Saturday, 2 January 2016 at 00:15:32 UTC, Jason Jeffory wrote: Ok, So Deit allows D code inside html... looks great. But how do external variables work? If I create a variable in the server(such as a class), can an html file access it easily? (not having to jump through hoops) doctype ht

Re: Deit Editor

2016-01-03 Thread Martin Tschierschke via Digitalmars-d-learn
On Friday, 1 January 2016 at 00:14:08 UTC, Jason Jeffory wrote: Vibe.d uses deit files for html generation. Seems nice but haven't dived into it(just removes a but of nonsense and allows code integration for dynamic generation... sounds great!!). But what about visual editing? It's nice to be

Size of Compiled Program

2016-01-04 Thread Martin Tschierschke via Digitalmars-d-learn
When I was writing a small speed test - D versus Ruby, calculating the first n prime numbers, I realized, that for small n Ruby may be faster, than compiling and executing with D. But for n = 1,000,000 D outperforms Ruby by app. 10x. Looking at the size of my prime executable, it was around 800

Re: Size of Compiled Program

2016-01-04 Thread Martin Tschierschke via Digitalmars-d-learn
On Monday, 4 January 2016 at 14:16:54 UTC, Marc Schütz wrote: On Monday, 4 January 2016 at 13:49:03 UTC, Martin Tschierschke wrote: When I was writing a small speed test - D versus Ruby, calculating the first n prime numbers, I realized, that for small n Ruby may be faster, than compiling and

Re: Size of Compiled Program

2016-01-04 Thread Martin Tschierschke via Digitalmars-d-learn
On Monday, 4 January 2016 at 14:51:59 UTC, Adam D. Ruppe wrote: On Monday, 4 January 2016 at 13:49:03 UTC, Martin Tschierschke wrote: When I was writing a small speed test - D versus Ruby The smallest possible ruby program has about ~5 MB of dependencies, outside the operating system (the rub

Re: Size of Compiled Program

2016-01-04 Thread Martin Tschierschke via Digitalmars-d-learn
On Monday, 4 January 2016 at 14:01:18 UTC, Basile B. wrote: On Monday, 4 January 2016 at 13:49:03 UTC, Martin Tschierschke wrote: [...] - if debug info are generated this increases the size. - if bounds checking is turned off there is some code generated for each array operation - if contracts

Error in DUB Package Page - how to notify the Editor?

2016-01-22 Thread Martin Tschierschke via Digitalmars-d-learn
What about the idea to allow discussion entries/threads to be linked to dub package entries? So they appear in DUB and in a additional section of this forum? So vibe.d for example comes with his own forum that is good, but a solution for all would be nicer? So coming back to my first questi

Re: Speed up `dub`.

2016-03-07 Thread Martin Tschierschke via Digitalmars-d-learn
On Monday, 7 March 2016 at 09:18:37 UTC, ciechowoj wrote: I'm using `dub` to build project. And every time I run `dub` it seems to check if dependencies are up to date, which takes some time. Is there a way to switch of that checking? Or any other way to speed up building process? It really slo

Re: Memory Efficient HashSet

2016-03-10 Thread Martin Tschierschke via Digitalmars-d-learn
On Wednesday, 9 March 2016 at 22:31:50 UTC, Nordlöw wrote: [...] foreach (const i; iota(0, n)) { x[i] = true; // indicate that it's stored } import std.stdio : writeln, readln; writeln("Press return: "); readln; } consumes 842.m MiB on my Ubuntu. The consumption

parsing HTML for a web robot (crawler) like application

2016-03-23 Thread Martin Tschierschke via Digitalmars-d-learn
Hello! I want to set up a web robot to detect changes on certain web pages or sites. Any hint to similar projects or libraries at dub or git to look at, before starting to develop my own RegExp for parsing? Best regards mt.

Re: parsing HTML for a web robot (crawler) like application

2016-03-23 Thread Martin Tschierschke via Digitalmars-d-learn
On Wednesday, 23 March 2016 at 09:06:37 UTC, Rene Zwanenburg wrote: [...] Adam's dom.d will get you pretty far. I believe it can also handle documents that aren't completely well-formed. https://github.com/adamdruppe/arsd/blob/master/dom.d Thank you! This forum has an incredible fast auto r

Best way to convert Apachelog Datetime 01/Jan/2016:02:25:10 -> 2016-01-01 02:25:10 MySQL-Datetime Format

2016-06-08 Thread Martin Tschierschke via Digitalmars-d-learn
I know there are easy ways to handle this, anyone with a code snippet for me? I would use two regex first to make 01,02,03... from Jan,Feb,.. and second to split the result. best regards mt.

Re: Best way to convert Apachelog Datetime 01/Jan/2016:02:25:10 -> 2016-01-01 02:25:10 MySQL-Datetime Format

2016-06-08 Thread Martin Tschierschke via Digitalmars-d-learn
On Wednesday, 8 June 2016 at 10:42:19 UTC, Martin Tschierschke wrote: I know there are easy ways to handle this, anyone with a code snippet for me? I found this solution, letting the MySQL engine do the work: SELECT STR_TO_DATE('26/Apr/2011:13:21:58', '%d/%b/%Y:%H:%i:%S'); https://www.expert

Re: full path to source file __FILE__

2016-07-23 Thread Martin Tschierschke via Digitalmars-d-learn
On Thursday, 21 July 2016 at 19:54:34 UTC, Jonathan Marler wrote: Is there a way to get the full path of the current source file? Something like: __FILE_FULL_PATH__ I'm asking because I'm rewriting a batch script in D, meant to be ran with rdmd. However, the script needs to know it's own pa

Re: C binding with D function

2016-08-04 Thread Martin Tschierschke via Digitalmars-d-learn
On Thursday, 4 August 2016 at 12:14:48 UTC, Adam D. Ruppe wrote: On Thursday, 4 August 2016 at 10:36:05 UTC, llaine wrote: Any idea how can I call them ? Just like any other function. Consider this: [...] Compile [...] hi from D, Ruby user! Thank you a lot!!! I want to use some vibe.d r

Re: Can vibe d leverage existing web technologies?

2016-09-15 Thread Martin Tschierschke via Digitalmars-d-learn
On Tuesday, 13 September 2016 at 23:45:18 UTC, Intersteller wrote: vibe.d does not have much lateral support as the most commons web technologies do. Can vibe.d leverage pre-existing techs such as php, ruby/rails, etc? Starting from scratch and having to build a robust and secure framework is

Re: vibe.d PaaS

2016-09-16 Thread Martin Tschierschke via Digitalmars-d-learn
On Wednesday, 14 September 2016 at 09:01:11 UTC, Guillaume Piolat wrote: Is there vibe.d hosting sold anywhere? I am using this one: https://www.menkisys.de/ in the moment vibe.d only for tests. But with an Rails web service, using a small parser for email with attached pdf, written in D, it

Re: Can vibe d leverage existing web technologies?

2016-09-16 Thread Martin Tschierschke via Digitalmars-d-learn
On Thursday, 15 September 2016 at 20:56:19 UTC, Intersteller wrote: On Thursday, 15 September 2016 at 14:31:28 UTC, Martin Tschierschke wrote: On Tuesday, 13 September 2016 at 23:45:18 UTC, Intersteller wrote: vibe.d does not have much lateral support as the most commons web technologies do. C

Re: Vibe.d help

2016-09-22 Thread Martin Tschierschke via Digitalmars-d-learn
On Thursday, 22 September 2016 at 01:38:12 UTC, Gestalt Theory wrote: 1. I get this error when trying to run a project in VS. dub doesn't give the error. First-chance exception: core.exception.AssertError free() called with null array. at vibe-d-0.7.26\source\vibe\utils\memory.d(110) It con

Re: Vibe.d help

2016-09-26 Thread Martin Tschierschke via Digitalmars-d-learn
On Friday, 23 September 2016 at 21:32:59 UTC, Gestalt Theory wrote: On Thursday, 22 September 2016 at 09:14:46 UTC, Martin Tschierschke wrote: On Thursday, 22 September 2016 at 01:38:12 UTC, Gestalt Theory wrote: 3. How to serve static files properly? sendFile(req, res, Path(req.path)); D

Getting nice print of struct for debugging

2017-02-20 Thread Martin Tschierschke via Digitalmars-d-learn
Hello, I have a little program where I am filling a struct with values from an regex match. Now I want to display the content of the struct for debugging purpose. If struct is named MyStruct I can print a list of the field names with: foreach(fieldname;FieldNameTuple!MyStruct){writef("%s ",

Re: Getting nice print of struct for debugging

2017-02-20 Thread Martin Tschierschke via Digitalmars-d-learn
On Monday, 20 February 2017 at 16:18:58 UTC, Paul Backus wrote: On Monday, 20 February 2017 at 16:04:17 UTC, Martin Tschierschke wrote: Hello, I have a little program where I am filling a struct with values from an regex match. Now I want to display the content of the struct for debugging purp

Re: Getting nice print of struct for debugging

2017-02-22 Thread Martin Tschierschke via Digitalmars-d-learn
On Tuesday, 21 February 2017 at 14:02:54 UTC, Jacob Carlborg wrote: [...] Yes, this works, I would say this is the simplest: MyStruct s; foreach (index, name ; FieldNameTuple!MyStruct) writefln("%s: %s", name, s.tupleof[index]); If you want something more close to "send" in Ruby, you need

Re: Getting nice print of struct for debugging

2017-02-27 Thread Martin Tschierschke via Digitalmars-d-learn
On Saturday, 25 February 2017 at 01:30:09 UTC, Minty Fresh wrote: On Saturday, 25 February 2017 at 01:27:09 UTC, Minty Fresh wrote: On Wednesday, 22 February 2017 at 11:18:15 UTC, Martin Tschierschke wrote: [...] Since structs are Plain-old Data and don't do inheritance, the best option is a

CTFE using of replaceAll from std.regex posible?

2017-04-12 Thread Martin Tschierschke via Digitalmars-d-learn
Hello, when trying to process an string at compile time with ... auto reg = ctRegex!`as\ [a-z]+`; enum replaced = replaceAll(call,reg,""); I get: /usr/include/dmd/phobos/std/regex/package.d(708,34): Error: malloc cannot be interpreted at compile time, because it has no available source code

Re: ndslice summary please

2017-04-13 Thread Martin Tschierschke via Digitalmars-d-learn
On Thursday, 13 April 2017 at 08:47:16 UTC, Ali Çehreli wrote: I haven't played with ndslice nor followed its deprecation discussions. Could someone summarize it for us please. Also, is it still used outside Phobos or is Ilya or someone else rewriting it? Ali We should additionally mention

Playing arround with mixin - alias?

2017-04-21 Thread Martin Tschierschke via Digitalmars-d-learn
Is it possible to define an alias for something like mixin(import("local_function_file.d")); to write only use_local_function; which will be translated to: mixin(import("local_function_file.d")); (this additionally needs the file local_function_file.d in source/ + -J./source as paramete

Re: Playing arround with mixin - alias?

2017-04-21 Thread Martin Tschierschke via Digitalmars-d-learn
On Friday, 21 April 2017 at 10:31:46 UTC, ketmar wrote: biozic wrote: On Friday, 21 April 2017 at 09:42:33 UTC, ketmar wrote: Martin Tschierschke wrote: Is it possible to define an alias for something like mixin(import("local_function_file.d")); to write only use_local_function; whic

Re: Playing arround with mixin - alias?

2017-04-21 Thread Martin Tschierschke via Digitalmars-d-learn
On Friday, 21 April 2017 at 11:58:13 UTC, Martin Tschierschke wrote: On Friday, 21 April 2017 at 10:31:46 UTC, ketmar wrote: biozic wrote: I thought way to complicated: Just define the string at top: enum exho="auto mixinter(string x)(){return mixin(interp!x);} auto exho(string x)(){return m

Operator Overloading + / ~

2017-06-19 Thread Martin Tschierschke via Digitalmars-d-learn
Just a thought it might be useful for cut-n-paste when porting code: Would it be possible to define an operator overloading for '+'-Operator for strings to work as append? (like ~). I understand, that '~' is in general a better choice than '+', so this is of more theoretical interest. It is cl

Re: Operator Overloading + / ~

2017-06-19 Thread Martin Tschierschke via Digitalmars-d-learn
On Monday, 19 June 2017 at 12:22:43 UTC, ketmar wrote: Martin Tschierschke wrote: Just a thought it might be useful for cut-n-paste when porting code: Would it be possible to define an operator overloading for '+'-Operator for strings to work as append? (like ~). I understand, that '~' is in

Re: How to add class in DIET template

2017-06-23 Thread Martin Tschierschke via Digitalmars-d-learn
On Friday, 23 June 2017 at 06:59:22 UTC, Suliman wrote: I need to get external variable and make class by it's value - string mystr = "lng-" ~ language; - foreach(i, line; arrayOfLines ) li code.mystr #{line} I need to get HTML code like this: some D code But class n

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

2017-06-30 Thread Martin Tschierschke via Digitalmars-d-learn
What do I have to do, to make this work? iota(number).each!...command_x(a...);command_y(b...);command_z(c..)) ^? how to write the lambda? Similar to the ruby (1..number).each{ commands...} Don't want to write the following, because the index i is not used inside the loop

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