Re: Proper generic way to get the hash of something?

2016-12-11 Thread Seb via Digitalmars-d-learn
On Sunday, 4 December 2016 at 07:50:26 UTC, Tofu Ninja wrote: Well for now I am going to revert back to 2.071.2, 2.072 seems broke as fuck. For the record: it has been reverted: https://github.com/dlang/druntime/pull/1707 and thus should be part of the next point release.

Re: drepl fails because of missing lib linenoise

2016-12-08 Thread Seb via Digitalmars-d-learn
On Thursday, 8 December 2016 at 13:03:10 UTC, Edwin van Leeuwen wrote: On Thursday, 8 December 2016 at 12:31:01 UTC, Nordlöw wrote: drepl fails to build as https://github.com/drepl/drepl/issues/58 Any ideas why? Looks like you don't have liblinenoise installed. ... and for the record I jus

Re: dub command line in config?

2016-10-10 Thread Seb via Digitalmars-d-learn
On Sunday, 9 October 2016 at 20:03:58 UTC, WhatMeWorry wrote: On Sunday, 9 October 2016 at 19:11:52 UTC, Jinx wrote: On Sunday, 9 October 2016 at 08:52:55 UTC, rikki cattermole wrote: On 09/10/2016 9:17 PM, Jinx wrote: [...] That is enough. Mike Parker has presented a workaround that you can

Re: Your connection is not private

2016-10-01 Thread Seb via Digitalmars-d-learn
On Saturday, 1 October 2016 at 11:12:16 UTC, wobbles wrote: On Saturday, 1 October 2016 at 03:21:05 UTC, rikki cattermole wrote: On 01/10/2016 11:51 AM, Joel wrote: I get this when I click Learn at the top of the screen in dlang. This is on Chrome Mac (Sierra 10.12). Yup, you need to be on h

Re: Forum for new programmers in spanish.

2016-09-19 Thread Seb via Digitalmars-d-learn
On Monday, 19 September 2016 at 05:56:04 UTC, Geert wrote: Hi all! I'm a PHP programmer, and i've been searching for new languages to learn. I think D it's the best of the newest languages, due its good documentation, clean sintaxis (or less verbose), and the applications developed in D run f

Re: Meaning of DMD flag -transition=safe

2016-09-15 Thread Seb via Digitalmars-d-learn
On Thursday, 15 September 2016 at 21:36:07 UTC, Nordlöw wrote: What's the meaning of the DMD flag -transition=safe ? Is it new? I haven't seen it before. https://github.com/dlang/dmd/pull/6097

Re: Compiling vibe.d application for Amazon ec2 instance

2016-09-14 Thread Seb via Digitalmars-d-learn
On Monday, 12 September 2016 at 02:14:08 UTC, Jonathan M Davis wrote: On Sunday, September 11, 2016 23:12:15 crimaniak via Digitalmars-d-learn wrote: [...] I've never used EC2, so I don't know what it would take to be able to build in the same environment locally (though I would certainly th

Re: Debug prints in @nogc

2016-08-31 Thread Seb via Digitalmars-d-learn
On Tuesday, 30 August 2016 at 19:03:06 UTC, Nordlöw wrote: On Tuesday, 30 August 2016 at 17:11:48 UTC, Johannes Pfau wrote: Nice! Here's a slightly modified version: https://dpaste.dzfl.pl/8c5ec90c5b39 This version does not need an additional delegate. It can be used like this: assumeNogc!w

Re: Debug prints in @nogc

2016-08-30 Thread Seb via Digitalmars-d-learn
On Tuesday, 30 August 2016 at 10:26:28 UTC, Nordlöw wrote: I'm struggling with debug printing in my @nogc-containers. The alternatives: assert(false, "Fixed message with no parameters"); is not enough for my needs debug writeln("Fixed"); doesn't bypass @nogc checking. Why? And tempo

Re: Fast multidimensional Arrays

2016-08-29 Thread Seb via Digitalmars-d-learn
On Monday, 29 August 2016 at 14:43:08 UTC, Steinhagelvoll wrote: It is quite surprising that there is this much of a difference, even when all run sequential. I believe this might be specific to this small problem. You should definitely have a look at this benchmark for matrix multiplication

Re: nested enum

2016-08-25 Thread Seb via Digitalmars-d-learn
On Thursday, 25 August 2016 at 11:09:43 UTC, Cauterite wrote: On Thursday, 25 August 2016 at 10:36:21 UTC, Daniel Kozak wrote: Btw, tehre is no need for extra semicolon (`;`) after enum and struct definition Thanks. This forum insists on reminding me every time I write code here. Warning ab

Re: Hosting a vibe.d website

2016-08-24 Thread Seb via Digitalmars-d-learn
On Wednesday, 24 August 2016 at 19:19:33 UTC, Karabuta wrote: Hello community, I usually host PHP websites for clients using shared hosting services but I'm not familiar with hosting compiled programming language websites. What processes are involved hosting a vibe.d website developed locally

Re: How to avoid ctRegex (solved)

2016-08-24 Thread Seb via Digitalmars-d-learn
On Wednesday, 24 August 2016 at 05:29:57 UTC, ag0aep6g wrote: On 08/24/2016 03:07 AM, cy wrote: Then what's ctRegex in there for at all...? Optimization. ctRegex requires that the pattern is available as a compile time constant. It uses that property to "generate optimized native machine co

Re: Is it's possible to install DMD/LDC/GDC on CoreOS?

2016-08-21 Thread Seb via Digitalmars-d-learn
On Sunday, 21 August 2016 at 15:25:59 UTC, David Nadlinger wrote: On Sunday, 21 August 2016 at 14:57:15 UTC, Seb wrote: An alternative would be to compile your application locally, then copy it over to your container. I don't know how similar CoreOs to a typical Linux distribution is, but if it

Re: Is it's possible to install DMD/LDC/GDC on CoreOS?

2016-08-21 Thread Seb via Digitalmars-d-learn
On Sunday, 21 August 2016 at 11:38:09 UTC, Suliman wrote: I would like to create small VPS instance with Linux distrib on VPS. Can I use CoreOS as image? Would it possible to install dlang there? An alternative would be to compile your application locally, then copy it over to your container.

Re: MurmurHash3 behaviour

2016-08-20 Thread Seb via Digitalmars-d-learn
On Friday, 19 August 2016 at 21:29:43 UTC, Cauterite wrote: On Friday, 19 August 2016 at 21:03:22 UTC, Seb wrote: http://dlang.org/phobos-prerelease/std_digest_murmurhash.html Ah great, I just finished writing my own murmurhash digest module ( https://github.com/Cauterite/phobos/blob/murmur/

Re: MurmurHash3 behaviour

2016-08-19 Thread Seb via Digitalmars-d-learn
On Friday, 19 August 2016 at 20:28:13 UTC, Cauterite wrote: Regarding the MurmurHash3 implementation in core.internal.hash, it is my understanding that: // assuming a and b are uints bytesHash([a, b], 0) == bytesHash([b], bytesHash([a], 0)) Is this correct? I'm just not quite certain of

Re: Command Line Utility Library

2016-08-16 Thread Seb via Digitalmars-d-learn
On Tuesday, 16 August 2016 at 13:52:19 UTC, Edwin van Leeuwen wrote: On Tuesday, 16 August 2016 at 13:32:26 UTC, Jacob Carlborg wrote: On 2016-08-16 11:37, Seb wrote: Manual work? O_o Just open code.dlang.org and either hit CTRL-F or use the search bar (Martin added elastic search two months

Re: Command Line Utility Library

2016-08-16 Thread Seb via Digitalmars-d-learn
On Tuesday, 16 August 2016 at 06:27:12 UTC, Jacob Carlborg wrote: On 2016-08-16 04:29, Jonathan Marler wrote: Seb how in the heck do you know about all these libraries, geeze. Currently Dub has so few libraries that it's possible to manually scan the list. Manual work? O_o Just open code.d

Re: Command Line Utility Library

2016-08-15 Thread Seb via Digitalmars-d-learn
On Tuesday, 16 August 2016 at 01:23:16 UTC, UDW wrote: On Monday, 15 August 2016 at 10:48:11 UTC, Seb wrote: [...] Thanks for the suggestions Seb, https://blog.thecybershadow.net/2014/08/05/ae-utils-funopt/ looks very nice :). I just thought there would be a standard library, stdclib, phobo

Re: new XML and JSON libs and replacement of std.net.curl

2016-08-15 Thread Seb via Digitalmars-d-learn
On Monday, 15 August 2016 at 15:25:22 UTC, rikki cattermole wrote: On 16/08/2016 3:20 AM, Seb wrote: On Monday, 15 August 2016 at 15:04:29 UTC, rikki cattermole wrote: On 16/08/2016 3:01 AM, Oleg B wrote: As replacement of std.net.curl I found https://github.com/ikod/dlang-requests. Who know's

Re: new XML and JSON libs and replacement of std.net.curl

2016-08-15 Thread Seb via Digitalmars-d-learn
On Monday, 15 August 2016 at 15:04:29 UTC, rikki cattermole wrote: On 16/08/2016 3:01 AM, Oleg B wrote: As replacement of std.net.curl I found https://github.com/ikod/dlang-requests. Who know's about this lib? Is this good replacement of std.net.curl? Nope, not a replacement. Why? I like i

Re: Virus detected

2016-08-15 Thread Seb via Digitalmars-d-learn
On Monday, 15 August 2016 at 06:20:55 UTC, Joel wrote: I can't install DMD, because Windows defender says the install file has a virus and wipes it off. I'm using a Windows 10 pro OS. DMD 2.071.1 this seems to be a recent issue & at least you aren't alone with this problem: http://forum.dl

Re: Command Line Utility Library

2016-08-15 Thread Seb via Digitalmars-d-learn
On Monday, 15 August 2016 at 09:26:21 UTC, Jacob Carlborg wrote: On 2016-08-15 09:29, UDW wrote: Hi, I would like some options for a library, preferably json configurable, that helps with command line tool development. Doesn't have to be in D specifically. Currently I am using using std.ge

Re: DUB saying my Linux exe file is "not an executable file" even though DUB built it

2016-08-13 Thread Seb via Digitalmars-d-learn
On Saturday, 13 August 2016 at 21:56:49 UTC, WhatMeWorry wrote: $ sudo chmod -v 777 * mode of 'HelloWindow' changed from 0644 (rw-r--r--) to 0777 (rwxrwxrwx) $ ls -al total 3016 drwxr-xr-x 2 generic generic4096 Aug 13 16:48 . drwxr-xr-x 7 generic generic4096 Aug 12 23:14 .. -rw-r--r--

Re: Specifying content-type for a POST request using std.net.curl

2016-08-09 Thread Seb via Digitalmars-d-learn
On Tuesday, 9 August 2016 at 14:07:48 UTC, Joseph Rushton Wakeling wrote: Hello all, I'm currently writing a little client app whose job is to make a POST request to a vibe.d webserver and output the response. However, vibe.d is picky about the content-type of the request body, and so far as

Re: string mixup problem with stdin.byLine

2016-08-08 Thread Seb via Digitalmars-d-learn
On Monday, 8 August 2016 at 07:09:55 UTC, torea wrote: On Monday, 8 August 2016 at 05:17:24 UTC, Dave Akers wrote: I do believe your problem is with the line... On Monday, 8 August 2016 at 02:44:20 UTC, torea wrote: string cleanLine = strip( cast(string)line ); It's casting a char[] to

Re: DMD on ARM/Linux (for controlling EV3 Lego Mindstorm)?

2016-08-02 Thread Seb via Digitalmars-d-learn
On Tuesday, 2 August 2016 at 16:31:30 UTC, Sai wrote: I see that there are ports of go compiler on ev3dev (ARM, debian based) for controlling the EV3 lego mindstorm robot. (http://www.ev3dev.org/docs/libraries/) Is there a port of a D compiler for ARM? How about libraries? I need a basic file

Re: FP magic in std.math.pow

2016-08-01 Thread Seb via Digitalmars-d-learn
On Sunday, 31 July 2016 at 22:45:16 UTC, Stefan Koch wrote: On Sunday, 31 July 2016 at 22:38:59 UTC, Seb wrote: Consider this short program: void main() { alias S = float; S s1 = 0x1.24c92ep+5; S s2 = -0x1.1c71c8p+0; [...] It's an anoying feature. The reason this is not implement

Re: Question regarding Base64 decoding

2016-08-01 Thread Seb via Digitalmars-d-learn
On Monday, 1 August 2016 at 08:53:30 UTC, Kagamin wrote: A bug. ... which should be filled at Bugzilla and/or fixed. Thanks! :)

FP magic in std.math.pow

2016-07-31 Thread Seb via Digitalmars-d-learn
Consider this short program: void main() { alias S = float; S s1 = 0x1.24c92ep+5; S s2 = -0x1.1c71c8p+0; import std.math : std_pow = pow; import core.stdc.stdio : printf; import core.stdc.math: powf; printf("std: %a\n", std_pow(s1, s2)); printf("pow: %a\n", s1 ^^

Re: Converting int to dchar?

2016-07-31 Thread Seb via Digitalmars-d-learn
On Sunday, 31 July 2016 at 21:31:52 UTC, Darren wrote: Hey, all. I'm pretty much a programming novice, so I hope you can bear with me. Does anyone know how I can change an int into a char equivalent? e.g. int i = 5; dchar value; ? assert(value == '5'); If I try and cast it to dchar, I

Re: Empty LST files?

2016-07-31 Thread Seb via Digitalmars-d-learn
On Sunday, 31 July 2016 at 16:55:52 UTC, Seb wrote: On Sunday, 31 July 2016 at 16:48:52 UTC, Thalamus wrote: On Sunday, 31 July 2016 at 16:08:49 UTC, Seb wrote: On Sunday, 31 July 2016 at 15:30:46 UTC, Thalamus wrote: [...] How about setting the source path directly? With a recent enough dm

Re: Empty LST files?

2016-07-31 Thread Seb via Digitalmars-d-learn
On Sunday, 31 July 2016 at 16:48:52 UTC, Thalamus wrote: On Sunday, 31 July 2016 at 16:08:49 UTC, Seb wrote: On Sunday, 31 July 2016 at 15:30:46 UTC, Thalamus wrote: On Sunday, 31 July 2016 at 14:03:49 UTC, Thalamus wrote: [...] After a couple more hours today, I found a couple of solutions

Re: Empty LST files?

2016-07-31 Thread Seb via Digitalmars-d-learn
On Sunday, 31 July 2016 at 15:30:46 UTC, Thalamus wrote: On Sunday, 31 July 2016 at 14:03:49 UTC, Thalamus wrote: [...] After a couple more hours today, I found a couple of solutions. Neither is satisfactory. [...] How about setting the source path directly? With a recent enough dmd vers

Re: null as parametr

2016-07-30 Thread Seb via Digitalmars-d-learn
On Sunday, 31 July 2016 at 05:22:40 UTC, AntonSotov wrote: import std.stdio; void myFunc(T)(in T val) { static if(is(T == string)) { writeln("string: ", val); } static if(is(T : long)) { writeln("long: ", val); } static if // WHAT HERE

Re: [OT] Re: Why D isn't the next "big thing" already

2016-07-30 Thread Seb via Digitalmars-d-learn
On Saturday, 30 July 2016 at 23:33:27 UTC, LaTeigne wrote: On Saturday, 30 July 2016 at 23:11:23 UTC, Seb wrote: On Saturday, 30 July 2016 at 22:52:23 UTC, bachmeier wrote: On Saturday, 30 July 2016 at 12:30:55 UTC, LaTeigne wrote: On Saturday, 30 July 2016 at 12:24:55 UTC, ketmar wrote: On S

[OT] Re: Why D isn't the next "big thing" already

2016-07-30 Thread Seb via Digitalmars-d-learn
On Saturday, 30 July 2016 at 22:52:23 UTC, bachmeier wrote: On Saturday, 30 July 2016 at 12:30:55 UTC, LaTeigne wrote: On Saturday, 30 July 2016 at 12:24:55 UTC, ketmar wrote: On Saturday, 30 July 2016 at 12:18:08 UTC, LaTeigne wrote: it you think that you know the things better than somebody

Re: Transform/Compile to C/CPP as a target

2016-07-28 Thread Seb via Digitalmars-d-learn
On Saturday, 23 July 2016 at 12:27:24 UTC, ParticlePeter wrote: Is there any kind of project or workflow that converts D (subset) to C/CPP ? Just FYI there is a project that does the reverse. Calypso creates a bridge between DMD/LDC and Clang, both at the AST level (DMD <=> Clang's AST, Sema,

Re: Autodecode in the wild and An Awful Hack to std.regex

2016-07-28 Thread Seb via Digitalmars-d-learn
On Thursday, 28 July 2016 at 09:10:33 UTC, Kagamin wrote: Create an RFE? Given that regex returns results as slices of the input string, using the replacement character doesn't introduce data corruption. We call them DIP (D Improvement Proposals) and I think it's a lot more productive way to

Re: Why D isn't the next "big thing" already

2016-07-27 Thread Seb via Digitalmars-d-learn
On Tuesday, 26 July 2016 at 15:11:00 UTC, llaine wrote: Hi guys, I'm using D since a few month now and I was wondering why people don't jump onto it that much and why it isn't the "big thing" already. Everybody is into javascript nowadays, but IMO even for doing web I found Vibe.d more inte

Re: Expression template

2016-07-23 Thread Seb via Digitalmars-d-learn
On Saturday, 23 July 2016 at 12:09:18 UTC, Etranger wrote: On Saturday, 23 July 2016 at 11:19:34 UTC, rikki cattermole wrote: On 23/07/2016 11:05 PM, Etranger wrote: [snip] [...] My goodness that code is awful. I have a fair idea what you are attempting to do here. So I'm going to point you

Re: cant run unittests

2016-07-16 Thread Seb via Digitalmars-d-learn
On Thursday, 14 July 2016 at 10:13:38 UTC, dom wrote: On Thursday, 14 July 2016 at 00:33:50 UTC, ethgeh wrote: On Wednesday, 13 July 2016 at 19:41:53 UTC, dom wrote: how can i run my unittests for a dynamic library? some weird conflict is reported between main functions, my project doesnt cont

Re: Type constructor with new size

2016-07-16 Thread Seb via Digitalmars-d-learn
On Friday, 15 July 2016 at 01:10:09 UTC, Eppason wrote: How can I create a new type NT from type T that such that NT is compatible with T when reduced to the size of T, but has size n? Another way to see it is that I would like to construct a type at compile time that has the same layout as an

Re: Problems with -fPIC, libraries and exceptions (in linux?)

2016-07-16 Thread Seb via Digitalmars-d-learn
On Friday, 15 July 2016 at 08:40:02 UTC, Arafel wrote: Just as a follow-up, I think it's looking more and more like a compiler bug. It works properly both with gdc and ldmd2. Should I make a bug report about that? Yes please.

Re: unittests not being run

2016-07-16 Thread Seb via Digitalmars-d-learn
On Friday, 15 July 2016 at 11:59:51 UTC, Bahman Movaqar wrote: On 07/15/2016 04:16 PM, Jerry wrote: Unittests have to be inside a module to be run on DMD atleast. So putting module foo at top should fix it. Strange. Still not getting picked up. $ dmd --version DMD64 D Compiler v2.071

Re: to auto or not to auto ( in foreach )

2016-07-16 Thread Seb via Digitalmars-d-learn
On Saturday, 16 July 2016 at 20:00:39 UTC, Seb wrote: On Saturday, 16 July 2016 at 14:11:34 UTC, cym13 wrote: [...] It's not arbitrary. It keeps the language simple and easy to read. After all the entire auto keyword is just there, because the compiler needs a keyword and in loops it's clear

Re: to auto or not to auto ( in foreach )

2016-07-16 Thread Seb via Digitalmars-d-learn
On Saturday, 16 July 2016 at 14:11:34 UTC, cym13 wrote: On Saturday, 16 July 2016 at 14:00:56 UTC, dom wrote: foreach(auto v; msg) writeln(v); gives an error that a basic type is expected foreach(v; msg) writeln(v); works .. but why? Arbitrary limitation. If you want to say how surpris

Re: how to mark an extern function @nogc?

2016-07-13 Thread Seb via Digitalmars-d-learn
On Wednesday, 13 July 2016 at 02:20:58 UTC, anonymous wrote: On Tuesday, 12 July 2016 at 14:04:55 UTC, Seb wrote: D is entirely driven by highly motivated volunteers. (this will change soon with the new D foundation) With the fundation, volunteers wont be highly motivated anymore. Fundations

Re: Where does one post a proposal for a language change?

2016-07-13 Thread Seb via Digitalmars-d-learn
On Tuesday, 12 July 2016 at 16:47:26 UTC, Mathias Lang wrote: On Tuesday, 12 July 2016 at 16:45:18 UTC, DLearner wrote: General/Issues/or... P.R. to this repository: https://github.com/dlang/DIPs If you aren't sure about your change, a discussion at General might help to see the current op

Re: [OT] Re: how to mark an extern function @nogc?

2016-07-12 Thread Seb via Digitalmars-d-learn
On Tuesday, 12 July 2016 at 14:42:23 UTC, ag0aep6g wrote: On 07/12/2016 04:04 PM, Seb wrote: D is entirely driven by highly motivated volunteers. (this will change soon with the new D foundation) Does the foundation have plans to hire programmers? That's news to me. At the DConf16 Andrei

Re: how to mark an extern function @nogc?

2016-07-12 Thread Seb via Digitalmars-d-learn
On Tuesday, 12 July 2016 at 00:17:32 UTC, Adam Sansier wrote: On Monday, 11 July 2016 at 15:54:02 UTC, Seb wrote: On Monday, 11 July 2016 at 01:59:51 UTC, Adam Sansier wrote: On Monday, 11 July 2016 at 01:58:23 UTC, Adam Sansier wrote: I'm using some win functions that don't use the gc and are

Re: how to mark an extern function @nogc?

2016-07-11 Thread Seb via Digitalmars-d-learn
On Monday, 11 July 2016 at 01:59:51 UTC, Adam Sansier wrote: On Monday, 11 July 2016 at 01:58:23 UTC, Adam Sansier wrote: I'm using some win functions that don't use the gc and are not marked, specifically CLSIDFromString that I imported myself(it's not marked nogc in objbase). I went ahead a

Re: blog.dlang.org

2016-06-21 Thread Seb via Digitalmars-d-learn
On Tuesday, 21 June 2016 at 23:36:41 UTC, Leandro Motta Barros wrote: Try http://dlang.org/blog/ But, indeed, I would expect blog.dlang.org to work... Cheers, LMB On Tue, Jun 21, 2016 at 6:47 PM, Christian Köstlin < digitalmars-d-learn@puremagic.com> wrote: I just wanted to have a look at

Re: Can anybody install DDT on Eclipse Neon or Mars?

2016-06-18 Thread Seb via Digitalmars-d-learn
On Saturday, 18 June 2016 at 16:46:26 UTC, Mark wrote: I've spent may hours trying to do this in OSX. Everything goes fine from the marketplace window...until I restart Eclipse and find no files have been added? Any words of consolation or advice will be greatly appreciated. Desperately, Mar

Re: Why don't we write configuration files in D instead of JSON?

2016-06-16 Thread Seb via Digitalmars-d-learn
On Thursday, 16 June 2016 at 13:20:06 UTC, Guido wrote: On Thursday, 16 June 2016 at 06:07:55 UTC, Seb wrote: On Thursday, 16 June 2016 at 05:31:26 UTC, Guido wrote: It would seem that by running the file through mixin, you can simply create the vars you want in scope. The drawback being rando

Re: Why don't we write configuration files in D instead of JSON?

2016-06-15 Thread Seb via Digitalmars-d-learn
On Thursday, 16 June 2016 at 05:31:26 UTC, Guido wrote: It would seem that by running the file through mixin, you can simply create the vars you want in scope. The drawback being random code execution. Is there any way to sanitize mixin code from user-configurable file? Well it's a configurat

Re: get number of columns and rows in an ndarray.

2016-06-15 Thread Seb via Digitalmars-d-learn
On Wednesday, 15 June 2016 at 21:51:25 UTC, learner wrote: Hi, How can i get the number of cols and rows in and ndarray that has already been created? learner how about `shape`? http://dlang.org/phobos/std_experimental_ndslice_slice.html#.Slice.shape

Re: ndslice: convert a sliced object to T[]

2016-06-15 Thread Seb via Digitalmars-d-learn
On Wednesday, 15 June 2016 at 13:13:05 UTC, data pulverizer wrote: On Wednesday, 15 June 2016 at 12:10:32 UTC, Seb wrote: As said you can avoid the copy (see below). I also profiled it a bit and it was interesting to see that 50% of the runtime are spent on generating the random matrix. On my m

Re: ndslice: convert a sliced object to T[]

2016-06-15 Thread Seb via Digitalmars-d-learn
On Wednesday, 15 June 2016 at 11:19:20 UTC, data pulverizer wrote: On Wednesday, 15 June 2016 at 09:32:21 UTC, Andrea Fontana wrote: Then I think the slice.byElement.array is the right solution. The problem with that is that it slows down the code. I compared matrix multiplication between R a

Re: ndslice: convert a sliced object to T[]

2016-06-14 Thread Seb via Digitalmars-d-learn
On Wednesday, 15 June 2016 at 03:11:23 UTC, data pulverizer wrote: in that case: import std.array : array; int[] x = slice.byElement.array; Are you sure you want to create a _copy_ of your data? In most cases you don't need that ;-) thanks, now I can go to bed! You are welcome. Sleep tig

Re: ndslice: convert a sliced object to T[]

2016-06-14 Thread Seb via Digitalmars-d-learn
On Wednesday, 15 June 2016 at 02:43:37 UTC, data pulverizer wrote: How do I unravel a sliced item T[].sliced(...) to an array T[]? For instance: import std.experimental.ndslice; auto slice = new int[12].sliced(3, 4); int[] x = ??; Thanks A slice is just a _view_ on your memory, the easiest w

Re: What's up with GDC?

2016-06-10 Thread Seb via Digitalmars-d-learn
On Friday, 10 June 2016 at 20:30:36 UTC, Joerg Joergonson wrote: On Friday, 10 June 2016 at 19:51:19 UTC, Johan Engelen wrote: [...] Well, the post was a bit incoherent because getting all this stuff working is. I was searching for ldc and ran across some web site that had only the sources

Re: How to cast ASCII value to char?

2016-06-10 Thread Seb via Digitalmars-d-learn
On Friday, 10 June 2016 at 14:20:16 UTC, TheDGuy wrote: Is it possible to cast an ascii value to char? Sure! char A = cast(char) 65; // A char a = cast(char) 97; // a and back again: ubyte b = cast(ubyte) a; // 65 In general there's also an entire module (https://dlang.org/phobos/std_ascii

Re: Where are the solutions for the exercises of the dlang tour???

2016-06-10 Thread Seb via Digitalmars-d-learn
On Friday, 10 June 2016 at 05:31:18 UTC, Richter wrote: I've been trying to solve the exercise of the caesar encryption for practicing with arrays with no luck. I'm new to D Thanks for your help. :D 1) First of all - sorry that you couldn't find the solution. The tour is still heavily worked

Re: dlang.org using apache?

2016-06-08 Thread Seb via Digitalmars-d-learn
On Wednesday, 8 June 2016 at 17:59:29 UTC, Ola Fosheim Grøstad wrote: On Wednesday, 8 June 2016 at 17:43:23 UTC, dewitt wrote: vibes website doesn't use a proxy. Yes, but more people visit dlang.org, and it makes it more official if it is showcased here as a visible part of the website (one

Re: dlang.org using apache?

2016-06-08 Thread Seb via Digitalmars-d-learn
On Wednesday, 8 June 2016 at 17:34:25 UTC, Ola Fosheim Grøstad wrote: On Wednesday, 8 June 2016 at 17:17:37 UTC, Adam D. Ruppe wrote: bother with a proper setup. There's a reason ALL the other major languages and frameworks use Apache/nginx/IIS on their websites. It's the recommended way to do

Re: dlang.org using apache?

2016-06-08 Thread Seb via Digitalmars-d-learn
On Wednesday, 8 June 2016 at 17:05:42 UTC, Jonathan Marler wrote: On Wednesday, 8 June 2016 at 15:51:58 UTC, Adam D. Ruppe wrote: On Wednesday, 8 June 2016 at 15:05:54 UTC, Ola Fosheim Grøstad wrote: The forum-index http header report: Server:nginx/1.4.6 (Ubuntu) People check out stuff like t

Re: dlang.org using apache?

2016-06-08 Thread Seb via Digitalmars-d-learn
On Wednesday, 8 June 2016 at 13:32:00 UTC, Mike Parker wrote: On Wednesday, 8 June 2016 at 13:13:07 UTC, Jonathan Marler wrote: I've decided to write a web application using vibe and was shocked to see that dlang.org was using apache. Should I be scared that even after this long, the official

Re: How to enable feedback for AssertError?

2016-06-06 Thread Seb via Digitalmars-d-learn
On Tuesday, 7 June 2016 at 01:40:01 UTC, your_name wrote: On Monday, 6 June 2016 at 00:09:15 UTC, Ali Çehreli wrote: [...] Hello Ali, The behavior you described is what I'd expect, however, it's not what I get. The way I traced the problem, ironically ;), was to catch Error and print it t

Re: Preferred method of creating objects, structs, and arrays with deterministic memory management

2016-06-01 Thread Seb via Digitalmars-d-learn
On Wednesday, 1 June 2016 at 07:59:50 UTC, Anthony Monterrosa wrote: I've recently been trying to convince a friend of mine that D has at least the functionality of C++, and have been learning the language over C++ for a few months. Memory management is pretty important to him, and a subject I'

Re: String compare in words?

2016-05-29 Thread Seb via Digitalmars-d-learn
On Sunday, 29 May 2016 at 20:40:52 UTC, qznc wrote: On Sunday, 29 May 2016 at 18:15:16 UTC, qznc wrote: [...] Ok, to answer my own question, this looks good: bool string_cmp_opt(immutable(ubyte)[] x, immutable(ubyte)[] y) { pragma(inline, false); if (x.length != y.length) return fal

Re: How to hash any type to an integer?

2016-05-29 Thread Seb via Digitalmars-d-learn
On Sunday, 29 May 2016 at 11:05:21 UTC, Gary Willoughby wrote: I'm currently implementing a hash map as an exercise and wondered if there is a built-in function I could use to hash keys effectively? What I'm looking for is a function that hashes any variable (of any type) to an integer. I've

Re: I wrote a function that accepts input ranges, and I get compile errors when passing an array

2016-05-28 Thread Seb via Digitalmars-d-learn
On Saturday, 28 May 2016 at 20:43:00 UTC, pineapple wrote: On Saturday, 28 May 2016 at 16:25:02 UTC, Seb wrote: If you are interested how it works under the hood - it's pretty simple & elegant: I checked up on the phobos implementation and found that arrays are mutated when iterated over as r

Re: I wrote a function that accepts input ranges, and I get compile errors when passing an array

2016-05-28 Thread Seb via Digitalmars-d-learn
On Friday, 27 May 2016 at 14:59:25 UTC, Adam D. Ruppe wrote: On Friday, 27 May 2016 at 14:54:30 UTC, pineapple wrote: I've encountered one remarkable difference: The phobos function accepts arrays and mine does not. add `import std.array;` i think to your module and it should make arrays rang

Re: Newbie to D, first impressions and feedback on the 5 (and more) first minutes.

2016-05-25 Thread Seb via Digitalmars-d-learn
On Wednesday, 25 May 2016 at 11:24:44 UTC, Russel Winder wrote: […] [...] I thought DMD and Phobos were separate. Given proper versioning (which I think we have) there should be no problem. The problem are parts like std.math which contain compiler-specific optimizations. That being said I

Re: OpenGL with D tutorials

2016-05-25 Thread Seb via Digitalmars-d-learn
On Wednesday, 25 May 2016 at 03:09:02 UTC, dvrein wrote: On Sunday, 22 May 2016 at 21:21:33 UTC, Rishub Nagpal wrote: On Sunday, 22 May 2016 at 12:13:07 UTC, ixid wrote: What is the best OpenGL tutorial with D to use? I've tried to use d-gamedev-intro and opengl-tutorials and seem to get error

Re: Newbie to D, first impressions and feedback on the 5 (and more) first minutes.

2016-05-24 Thread Seb via Digitalmars-d-learn
On Tuesday, 24 May 2016 at 18:03:17 UTC, cy wrote: https://p0nce.github.io/d-idioms/ I wanted to mention as well, if you like idioms. That guy has some good ideas. On Tuesday, 24 May 2016 at 17:36:45 UTC, Ali Çehreli wrote: Yes, a link from that page points to a book that *can* be bought but i

Re: Proper way to write benchmark code...

2016-05-23 Thread Seb via Digitalmars-d-learn
On Monday, 23 May 2016 at 04:11:31 UTC, Era Scarecrow wrote: Is there a good article written for this? Preferably for D specifically... [...] you might want to use __gshared data to avoid it being optimized away. Is it better to collect all the tests and output the results all at once?

Re: Is there a way to clear an OutBuffer?

2016-05-23 Thread Seb via Digitalmars-d-learn
On Monday, 23 May 2016 at 03:03:12 UTC, Jon Degenhardt wrote: On Sunday, 22 May 2016 at 23:01:07 UTC, Ali Çehreli wrote: On 05/22/2016 11:59 AM, Jon Degenhardt wrote: [...] Currently not possible. Enhancement request perhaps? Looking at the implementation, setting its 'offset' member seems

Re: Is there a 128-bit integer in D?

2016-05-23 Thread Seb via Digitalmars-d-learn
On Sunday, 22 May 2016 at 12:03:16 UTC, Guillaume Piolat wrote: On Sunday, 22 May 2016 at 09:47:54 UTC, Era Scarecrow wrote: On Sunday, 22 May 2016 at 09:39:45 UTC, Saurabh Das wrote: On Sunday, 22 May 2016 at 09:07:32 UTC, Guillaume Piolat wrote: https://github.com/d-gamedev-team/gfm/blob/mas

Re: Use Requests to send data to webpage - how?

2016-05-19 Thread Seb via Digitalmars-d-learn
On Thursday, 19 May 2016 at 19:28:46 UTC, TheDGuy wrote: Hi, i was sucessfull in installing requests and getting data from a webpage like this: Request rq = Request(); Response rs = rq.exec!"GET"("http://somewebpage.org/SQL.php";, ["action":"getTemp"]); But i am not able to send data to the

Re: Compile Tango for DMD2 - Any instructions how to do it?

2016-05-18 Thread Seb via Digitalmars-d-learn
On Wednesday, 18 May 2016 at 14:59:52 UTC, TheDGuy wrote: On Wednesday, 18 May 2016 at 14:19:48 UTC, Jacob Carlborg wrote: [1] https://github.com/SiegeLord/Tango-D2/blob/d2port/dub.json#L32 How can i get that line working? May I ask why you need to get tango working? It has been deprecated

Re: How to make a logger (possible bug)

2016-05-17 Thread Seb via Digitalmars-d-learn
On Tuesday, 17 May 2016 at 18:59:31 UTC, Rishub Nagpal wrote: https://dlang.org/phobos/std_experimental_logger_filelogger.html import std.experimental.logger; void main() { auto l1 = new FileLogger("logFile", "loggerName"); } throws an error: Error: none of the overloads of '__ctor' a

Re: Why doesn't this chain of ndslices work?

2016-05-14 Thread Seb via Digitalmars-d-learn
On Saturday, 14 May 2016 at 21:59:48 UTC, Stiff wrote: Here's the code that doesn't compile: import std.stdio, std.experimental.ndslice, std.range, std.algorithm; void main() { auto alloslice = [1, 2, 3, 4].sliced(1,4); auto sandwich = chain(alloslice, (0).repe

Re: What is up with building DMD (et al.) on Windows?

2016-05-10 Thread Seb via Digitalmars-d-learn
On Tuesday, 10 May 2016 at 04:48:23 UTC, Jeremy DeHaan wrote: I went to build DMD on Windows for the first time tonight and I have to say that it was a terrible experience when compared with Linux. First issue I ran into was having HOST_DC not being set. I'm not sure if the DMD installer is s

Re: Lazy Generation of Random Sequence

2016-04-26 Thread Seb via Digitalmars-d-learn
On Tuesday, 26 April 2016 at 17:38:33 UTC, Nordlöw wrote: On Tuesday, 26 April 2016 at 11:09:42 UTC, Seb wrote: Btw if you do random generation at the moment, you should always be aware that it's super-easy to do an implicit copy if you pass around the rndGen So should I pass it by ref or con

Re: Lazy Generation of Random Sequence

2016-04-26 Thread Seb via Digitalmars-d-learn
On Tuesday, 26 April 2016 at 10:50:27 UTC, Nordlöw wrote: On Tuesday, 26 April 2016 at 10:31:22 UTC, Nordlöw wrote: How do I lazily generate a sequence of random instances of type `T` as an `InputRange`? Ahh, I found it: import std.range : generate, take; import std.random : u

Re: How to escape control characters?

2016-03-30 Thread Seb via Digitalmars-d-learn
On Thursday, 31 March 2016 at 03:15:49 UTC, cy wrote: This might be a dumb question. How do I format a string so that all the newlines print as \n and all the tabs as \t and such? http://dlang.org/spec/lex.html#WysiwygString r"ab\n" or `ab\n`

Re: Speed up `dub`.

2016-03-07 Thread Seb 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: std.range: Lockstep vs. Zip

2016-03-04 Thread Seb via Digitalmars-d-learn
On Thursday, 3 March 2016 at 15:00:10 UTC, Alex Parrill wrote: On Wednesday, 2 March 2016 at 08:51:07 UTC, Manuel Maier wrote: Hi there, I was wondering why I should ever prefer std.range.lockstep over std.range.zip. In my (very limited) tests std.range.zip offered the same functionality as s

Re: Why is there no combination of popFront and front to pop? (aka Python `next`)

2016-02-18 Thread Seb via Digitalmars-d-learn
On Thursday, 18 February 2016 at 13:04:09 UTC, Seb wrote: Anyways I will try my best to submit a PR and we can continue to discuss pros/cons there - imho it's an excellent learning task :) Update: Yeah I submitted my first PR to phobos: https://github.com/D-Programming-Language/phobos/pull/40

Re: Why is there no combination of popFront and front to pop? (aka Python `next`)

2016-02-18 Thread Seb via Digitalmars-d-learn
On Wednesday, 17 February 2016 at 11:30:40 UTC, Jonathan M Davis wrote: Feel free to create a pull request to add next. I don't know if it would be accepted or not. I suspect that it mainly comes down to whether such a simple function would be deemed worth adding. On some level, it is a usabili

Why is there no combination of popFront and front to pop? (aka Python `next`)

2016-02-16 Thread Seb via Digitalmars-d-learn
I am still in the process of learning D - it's a fantastic language. Thanks so much! However there is one thing that I came by which I think is a bit annoying and could be easily solved - there seems to be no way to combine `front` and `popFront` in one call even tough this use case seems quite

<    1   2   3   4