Re: structs inheriting from and implementing interfaces

2018-01-02 Thread flamencofantasy via Digitalmars-d-learn
On Saturday, 30 December 2017 at 16:23:05 UTC, Steven Schveighoffer wrote: On 12/29/17 7:03 AM, Mike Franklin wrote: Is that simply because it hasn't been implemented or suggested yet for D, or was there a deliberate design decision? It was deliberate, but nothing says it can't actually be

Re: Why is there no std.stream anymore?

2017-12-11 Thread flamencofantasy via Digitalmars-d-learn
On Monday, 11 December 2017 at 20:51:41 UTC, Jordi Gutiérrez Hermoso wrote: I'd like to read from a file, one byte at a time, without loading the whole file in memory. I was hoping I could do something like auto f = File("somefile"); foreach(c; f.byChar) { process(c); } but

Re: std.algorithm

2017-11-30 Thread flamencofantasy via Digitalmars-d-learn
On Thursday, 30 November 2017 at 21:49:56 UTC, Meta wrote: On Thursday, 30 November 2017 at 20:49:36 UTC, flamencofantasy wrote: [...] This *almost* works: [...] That's what I needed, thanks!

std.algorithm

2017-11-30 Thread flamencofantasy via Digitalmars-d-learn
Hello, I have the following csv text; auto input = "Start Date,End Date,Subject,All day event,Categories,Show time as 1/1/2018,1/1/2018,New Year's Day,TRUE,Holiday,3 1/15/2018,1/15/2018,\"Martin Luther King, Jr. Day\",TRUE,Holiday,3 2/19/2018,2/19/2018,President's Day,TRUE,Holiday,3

Re: testing if data is allocated on the stack or heap

2017-10-18 Thread flamencofantasy via Digitalmars-d-learn
On Tuesday, 17 October 2017 at 23:59:19 UTC, Steven Schveighoffer wrote: On 10/17/17 7:32 PM, flamencofantasy wrote: On Tuesday, 17 October 2017 at 17:27:17 UTC, Biotronic wrote: On Tuesday, 17 October 2017 at 15:33:02 UTC, drug wrote: [...] I have very little knowledge about sbrk, so

Re: testing if data is allocated on the stack or heap

2017-10-17 Thread flamencofantasy via Digitalmars-d-learn
On Tuesday, 17 October 2017 at 17:27:17 UTC, Biotronic wrote: On Tuesday, 17 October 2017 at 15:33:02 UTC, drug wrote: [...] I have very little knowledge about sbrk, so here's my solution. Tested on win32 and win64. [...] Try this; unittest { int[5*1024] n; int* p = new int;

using joyent manta public cloud storage service

2017-04-13 Thread flamencofantasy via Digitalmars-d-learn
hello, I'm trying to use the joyent manta storage service via their REST api. https://apidocs.joyent.com/manta/api.html For that i need to implement http signature over TLS. Here is a shell function that does that; function manta { local alg=rsa-sha256 local

Re: Phobos function to check if files are identical?

2017-03-14 Thread flamencofantasy via Digitalmars-d-learn
On Tuesday, 14 March 2017 at 08:31:20 UTC, XavierAP wrote: On Tuesday, 14 March 2017 at 08:12:16 UTC, Andrea Fontana wrote: First I would check if the files have different size or if they are the same file (same path, symlink, etc). Good idea. Good reason to have it in std.file. There might

Re: code folding

2017-03-14 Thread flamencofantasy via Digitalmars-d-learn
On Tuesday, 14 March 2017 at 16:58:21 UTC, Inquie wrote: On Tuesday, 14 March 2017 at 16:29:15 UTC, Mike Parker wrote: [...] It's not that I feel strongly about, I simply would like the best useable solution. Like usually what happens, my original post was taken completely out of context:

Re: vsprintf or printf variable arguments

2016-08-05 Thread flamencofantasy via Digitalmars-d-learn
On Friday, 5 August 2016 at 19:21:38 UTC, Mark "J" Twain wrote: On Friday, 5 August 2016 at 08:32:42 UTC, kink wrote: On Thursday, 4 August 2016 at 21:03:52 UTC, Mark "J" Twain [...] This has absolutely nothing to do with D as these are C functions, so you'd be better off asking this in

Re: Some asm help for the 'thiscall' calling convention?

2016-07-13 Thread flamencofantasy via Digitalmars-d-learn
On Wednesday, 13 July 2016 at 22:30:51 UTC, Adam Sansier wrote: On Wednesday, 13 July 2016 at 22:09:05 UTC, flamencofantasy wrote: On Wednesday, 13 July 2016 at 20:39:00 UTC, Adam Sansier wrote: On Sunday, 24 April 2011 at 22:09:24 UTC, Kagamin wrote: Andrej Mitrovic Wrote: But trying to use

Re: Some asm help for the 'thiscall' calling convention?

2016-07-13 Thread flamencofantasy via Digitalmars-d-learn
On Wednesday, 13 July 2016 at 20:39:00 UTC, Adam Sansier wrote: On Sunday, 24 April 2011 at 22:09:24 UTC, Kagamin wrote: Andrej Mitrovic Wrote: But trying to use functions which take parameters will fail with an access violation, probably because D uses stdcall for COM methods, while these

Re: I'm getting NAN out of nowhere

2015-07-11 Thread flamencofantasy via Digitalmars-d-learn
On Thursday, 9 July 2015 at 15:14:43 UTC, Binarydepth wrote: This is my code : import std.stdio : writeln, readf; void main() { int[3] nums; float prom; foreach(nem; 0..2) { writeln(input a number : ); readf( %d, nums[nem]);

Re: How to avoid multiple spelling `import`

2015-06-16 Thread flamencofantasy via Digitalmars-d-learn
On Tuesday, 16 June 2015 at 16:40:39 UTC, tired_eyes wrote: On Tuesday, 16 June 2015 at 15:42:02 UTC, Dennis Ritchie wrote: On Tuesday, 16 June 2015 at 12:41:14 UTC, Daniel Kozák wrote: [...] Thanks. Maybe I'll use this code in your own programs. I still believe that this design deserves

std.parallelism curious results

2014-10-05 Thread flamencofantasy via Digitalmars-d-learn
Hello, I am summing up the first 1 billion integers in parallel and in a single thread and I'm observing some curious results; parallel sum : 45, elapsed 102833 ms single thread sum : 45, elapsed 1667 ms The parallel version is 60+ times slower on my i7-3770K

Re: std.parallelism curious results

2014-10-05 Thread flamencofantasy via Digitalmars-d-learn
Thanks everyone for the replies. I wasn't sure how std.parallel operated but I thought it would launch at most a number of threads equal to the number of cores on the machine, just as Ali confirmed and similar to what Windows' thread pool does.

Re: Fibers

2014-09-17 Thread Flamencofantasy via Digitalmars-d-learn
if (++count = fibs.length)... On Wednesday, 17 September 2014 at 10:00:49 UTC, Andrew Edwards wrote: The script below is borrowed form a unit test in core.thread and modified slightly. If fails with segmentation fault: 11 but I'm not sure why. Basically what I'm trying to do is to transact

Re: Why does this not work?

2014-09-17 Thread flamencofantasy via Digitalmars-d-learn
the result of ubyte + ubyte is int I believe. Try; void func( int c ) { ubyte a; a = cast(ubyte)(cast(ubyte)c + cast(ubyte)c); }

Re: Why does this not work?

2014-09-17 Thread flamencofantasy via Digitalmars-d-learn
Because of overflow. On Wednesday, 17 September 2014 at 13:36:42 UTC, Shachar Shemesh wrote: On 17/09/14 16:32, ketmar via Digitalmars-d-learn wrote: On Wed, 17 Sep 2014 13:20:13 + Shachar via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: From http://dlang.org/type,

Re: Why does this not work?

2014-09-17 Thread flamencofantasy via Digitalmars-d-learn
http://www.drdobbs.com/tools/value-range-propagation/229300211

Re: Any chance to avoid monitor field in my class?

2014-05-09 Thread flamencofantasy via Digitalmars-d-learn
One thing I hate about C# (which is what I use professionally) is the sync block index in every single class instance. Why not have the developer decide when he needs a Monitor and manually use it?! I am disappointed D took the same route.

Re: Improving IO Speed

2014-05-09 Thread flamencofantasy via Digitalmars-d-learn
Try this; import std.mmfile; scope mmFile = new MmFile(T201212A.IDX); TaqIdx* arr = cast(TaqIdx*)mmFile[0..mmFile.length].ptr; for (ulong i = 0; i mmFile.length/TaqIdx.sizeof; ++i) { // do something... writeln(arr[i].symbol); } On Friday, 14 March 2014 at 18:00:58 UTC, TJB wrote: I