Re: is it std.datetime bug?

2015-04-02 Thread drug via Digitalmars-d-learn
On 02.04.2015 09:19, Jonathan M Davis via Digitalmars-d-learn wrote: On Tuesday, March 31, 2015 12:47:34 anonymous via Digitalmars-d-learn wrote: On Tuesday, 31 March 2015 at 11:51:26 UTC, drug wrote: import std.datetime; import std.stdio; void main() {

Re: Speed of horizontal flip

2015-04-02 Thread Rikki Cattermole via Digitalmars-d-learn
On 2/04/2015 2:52 a.m., tchaloupka wrote: Hi, I have a bunch of square r16 and png images which I need to flip horizontally. My flip method looks like this: void hFlip(T)(T[] data, int w) { import std.datetime : StopWatch; StopWatch sw; sw.start(); foreach(int i; 0..w) {

How to POST data with net.curl

2015-04-02 Thread Suliman via Digitalmars-d-learn
I have next request, that work fine with curl: curl -X POST -F upload=@wgs84_latlon.zip http://ogre.adc4gis.com/convert I wrote next code: void main() { auto binfile = cast(ubyte[]) read(`D:\Apps\curl\wgs84_latlon.zip`); auto http = HTTP(http://ogre.adc4gis.com/convert;);

Re: is it std.datetime bug?

2015-04-02 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, March 31, 2015 12:47:34 anonymous via Digitalmars-d-learn wrote: On Tuesday, 31 March 2015 at 11:51:26 UTC, drug wrote: import std.datetime; import std.stdio; void main() { long.max.SysTime.toISOExtString.writeln; } dmd 2.065 (dpaste.dzfl.pl):

Re: USB Controller

2015-04-02 Thread Laeeth Isharc via Digitalmars-d-learn
On Thursday, 2 April 2015 at 17:38:17 UTC, Josh Phillips wrote: Hey Guys! I've started using Arduino, specifically with Processing. I'm using it essentially as a usb controller. Is there a good way to translate this to D? There doesn't seem to be any standard library for usb usage. Are

Re: Speed of horizontal flip

2015-04-02 Thread Dominikus Dittes Scherkl via Digitalmars-d-learn
On Wednesday, 1 April 2015 at 14:00:52 UTC, bearophile wrote: If you have to perform performance benchmarks then use ldc or gdc. Also disable bound tests with your compilation switches. Add the usual pure/nothrow/@nogc/@safe annotations where you can (they don't increase speed much,

Re: lambda code

2015-04-02 Thread John Colvin via Digitalmars-d-learn
On Wednesday, 1 April 2015 at 23:29:00 UTC, Vlad Levenfeld wrote: On Tuesday, 31 March 2015 at 13:25:47 UTC, John Colvin wrote: On Tuesday, 31 March 2015 at 12:49:36 UTC, Vlad Levenfeld wrote: Is there any way (or could there be any way, in the future) of getting the code from lambda

Re: Structs as template parameters: weird error message

2015-04-02 Thread Nicholas Wilson via Digitalmars-d-learn
On Thursday, 2 April 2015 at 23:12:25 UTC, biozic wrote: The code below doesn't compile. Why this error message? --- struct Item { int i; } struct Params { Item* item; this(int i) { item = new Item(i); // line 9 } } struct Foo(Params params) {} enum foo =

Re: Speed of horizontal flip

2015-04-02 Thread Rikki Cattermole via Digitalmars-d-learn
On 3/04/2015 4:27 a.m., John Colvin wrote: On Thursday, 2 April 2015 at 11:49:44 UTC, Rikki Cattermole wrote: On 3/04/2015 12:29 a.m., John Colvin wrote: On Thursday, 2 April 2015 at 09:55:15 UTC, Rikki Cattermole wrote: On 2/04/2015 10:47 p.m., Rikki Cattermole wrote: On 2/04/2015 2:52

Re: How to POST data with net.curl

2015-04-02 Thread Pierre Krafft via Digitalmars-d-learn
On Thursday, 2 April 2015 at 07:45:16 UTC, Suliman wrote: I have next request, that work fine with curl: curl -X POST -F upload=@wgs84_latlon.zip http://ogre.adc4gis.com/convert I wrote next code: void main() { auto binfile = cast(ubyte[]) read(`D:\Apps\curl\wgs84_latlon.zip`);

Structs as template parameters: weird error message

2015-04-02 Thread biozic via Digitalmars-d-learn
The code below doesn't compile. Why this error message? --- struct Item { int i; } struct Params { Item* item; this(int i) { item = new Item(i); // line 9 } } struct Foo(Params params) {} enum foo = Foo!(Params(1)); --- test.d(9): Error: Item(1) is not an lvalue

Re: Speed of horizontal flip

2015-04-02 Thread John Colvin via Digitalmars-d-learn
On Thursday, 2 April 2015 at 09:55:15 UTC, Rikki Cattermole wrote: On 2/04/2015 10:47 p.m., Rikki Cattermole wrote: On 2/04/2015 2:52 a.m., tchaloupka wrote: Hi, I have a bunch of square r16 and png images which I need to flip horizontally. My flip method looks like this: void hFlip(T)(T[]

Re: Speed of horizontal flip

2015-04-02 Thread Rikki Cattermole via Digitalmars-d-learn
On 3/04/2015 12:29 a.m., John Colvin wrote: On Thursday, 2 April 2015 at 09:55:15 UTC, Rikki Cattermole wrote: On 2/04/2015 10:47 p.m., Rikki Cattermole wrote: On 2/04/2015 2:52 a.m., tchaloupka wrote: Hi, I have a bunch of square r16 and png images which I need to flip horizontally. My flip

Re: Speed of horizontal flip

2015-04-02 Thread Rikki Cattermole via Digitalmars-d-learn
On 2/04/2015 10:47 p.m., Rikki Cattermole wrote: On 2/04/2015 2:52 a.m., tchaloupka wrote: Hi, I have a bunch of square r16 and png images which I need to flip horizontally. My flip method looks like this: void hFlip(T)(T[] data, int w) { import std.datetime : StopWatch; StopWatch sw;

Re: C++ to D

2015-04-02 Thread Dennis Ritchie via Digitalmars-d-learn
On Wednesday, 1 April 2015 at 17:51:40 UTC, John Colvin wrote: Don't really see the point. Here's a neat thing that's definitely cheating because although it stores the results in the type system, the arithmetic is done in constant-folding: struct Integer(int a){} template Value(T) {

Re: Speed of horizontal flip

2015-04-02 Thread John Colvin via Digitalmars-d-learn
On Thursday, 2 April 2015 at 05:21:08 UTC, thedeemon wrote: std.algorithm.reverse uses ranges, and shamefully DMD is really bad at optimizing away range-induced costs. The specialisation of reverse selected for slices does not use the range interface, it's all just indexing. The only

Re: Speed of horizontal flip

2015-04-02 Thread John Colvin via Digitalmars-d-learn
On Thursday, 2 April 2015 at 11:49:44 UTC, Rikki Cattermole wrote: On 3/04/2015 12:29 a.m., John Colvin wrote: On Thursday, 2 April 2015 at 09:55:15 UTC, Rikki Cattermole wrote: On 2/04/2015 10:47 p.m., Rikki Cattermole wrote: On 2/04/2015 2:52 a.m., tchaloupka wrote: Hi, I have a bunch of

USB Controller

2015-04-02 Thread Josh Phillips via Digitalmars-d-learn
Hey Guys! I've started using Arduino, specifically with Processing. I'm using it essentially as a usb controller. Is there a good way to translate this to D? There doesn't seem to be any standard library for usb usage. Are there pre-built libraries or is there C libraries I should use?