Re: Can't understand how to do server response with vibed

2015-11-28 Thread Suliman via Digitalmars-d-learn
On Saturday, 28 November 2015 at 23:21:21 UTC, Sebastiaan Koppe wrote: On Saturday, 28 November 2015 at 19:05:59 UTC, Suliman wrote: And also I can't understand difference between HTTPClientRequest and HTTPServerRequest If the application (vibe.d) makes a request, it is the client. If the req

Re: Getting GtkD to work on OSX

2015-11-28 Thread Mike McKee via Digitalmars-d-learn
On Saturday, 28 November 2015 at 13:44:04 UTC, Gerald wrote: https://github.com/gtkd-developers/GtkD/wiki/Mac-OS-X-Notes That seemed really, really confusing to me. I don't even know where to begin.

Re: Multithreaded HTTP Download

2015-11-28 Thread Mike McKee via Digitalmars-d-learn
After weighing options, I'll use a CDN to get the faster download, and stick with curl rather than recoding it in D.

Re: Drawing Native OSX Windows with D

2015-11-28 Thread Mike McKee via Digitalmars-d-learn
On Saturday, 28 November 2015 at 14:05:37 UTC, Jacob Carlborg wrote: If you can't/don't want to go with the App Store then why not the second option? I'm coding an antivirus application for the Mac, using a third-party antivirus engine, in Qt/C++. It needs some things to run under high privil

Re: Freeing ENetPacket

2015-11-28 Thread Kyle via Digitalmars-d-learn
On Sunday, 29 November 2015 at 01:57:25 UTC, Adam D. Ruppe wrote: .. Are you compiling it as a 64 bit or a 32 bit program? 64 bit. You're probably right, I will take out the explicit destroy and look for a memory leak elsewhere, and adjust for your other suggestions. Thanks for the advice!

Re: Freeing ENetPacket

2015-11-28 Thread Adam D. Ruppe via Digitalmars-d-learn
On Sunday, 29 November 2015 at 01:30:14 UTC, Kyle wrote: void sendUbytes(ENetPeer* dest, ref ubyte[] data) { //create packet ENetPacket* packet = enet_packet_create(cast(ubyte*)data, data.length * ubyte.sizeof, ENET_PACKET_FLAG_RELIABLE); So I'm not familiar with this library, but a no

Locale package?

2015-11-28 Thread Chris Wright via Digitalmars-d-learn
Is there a package for locale data? I'm looking for things like month names and days of the week and default date and time formats, specifically.

Freeing ENetPacket

2015-11-28 Thread Kyle via Digitalmars-d-learn
Hi, I have a function using the derelict-enet library: void sendUbytes(ENetPeer* dest, ref ubyte[] data) { //create packet ENetPacket* packet = enet_packet_create(cast(ubyte*)data, data.length * ubyte.sizeof, ENET_PACKET_FLAG_RELIABLE); //send packet to peer over channel id 0

Re: Can't understand how to do server response with vibed

2015-11-28 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Saturday, 28 November 2015 at 19:05:59 UTC, Suliman wrote: And also I can't understand difference between HTTPClientRequest and HTTPServerRequest If the application (vibe.d) makes a request, it is the client. If the request is made to your application, it is the server. In your case your

Re: Can't understand how to do server response with vibed

2015-11-28 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Saturday, 28 November 2015 at 19:10:17 UTC, Suliman wrote: void action(HTTPServerRequest req, HTTPServerResponse res) { } Here is function what have two call-backs. When it's get request it's work as server, when it's send response it's work like client or I have wrong logic? Wrong logic

Re: Can't understand how to do server response with vibed

2015-11-28 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Saturday, 28 November 2015 at 18:51:57 UTC, Suliman wrote: Eghm, sorry. Not req, but res, but again errr: void action(HTTPServerRequest req, HTTPServerResponse res) { writeln(req.writeJsonBody); } What you want is `req.json`. Make sure that the call from angular sets the Content-Type h

Re: taskPool.reduce() help

2015-11-28 Thread Ali Çehreli via Digitalmars-d-learn
On 11/28/2015 01:57 PM, Ish wrote: The following code does not compile (with gdc) but if the line containing taskPool.reduce is reduce it does compile. Any pointers will be appreciated. import std.stdio; import std.math; import std.algorithm; import std.parallelism; // does not work!! import cor

taskPool.reduce() help

2015-11-28 Thread Ish via Digitalmars-d-learn
The following code does not compile (with gdc) but if the line containing taskPool.reduce is reduce it does compile. Any pointers will be appreciated. import std.stdio; import std.math; import std.algorithm; import std.parallelism; // does not work!! import core.thread; double aCalculation(dou

Re: Retrieving call expression of a function

2015-11-28 Thread Quentin Ladeveze via Digitalmars-d-learn
On Saturday, 28 November 2015 at 17:19:40 UTC, tcak wrote: On Saturday, 28 November 2015 at 15:41:59 UTC, Quentin Ladeveze wrote: [...] mixin template could solve this problem as well I guess. It would, instead of calling a function, directly inject the code into where you call it. So, remov

Re: Formatting dates

2015-11-28 Thread Jonathan M Davis via Digitalmars-d-learn
On Saturday, November 28, 2015 18:10:49 Chris Wright via Digitalmars-d-learn wrote: > Is there a way to format a DateTime struct similar to strftime(3)? None > is documented, and none is immediately obvious in the source code. > > Or is the recommended way to convert a DateTime to a Unix timestamp

Re: Can't understand how to do server response with vibed

2015-11-28 Thread Suliman via Digitalmars-d-learn
void action(HTTPServerRequest req, HTTPServerResponse res) { } Here is function what have two call-backs. When it's get request it's work as server, when it's send response it's work like client or I have wrong logic?

Re: Can't understand how to do server response with vibed

2015-11-28 Thread Suliman via Digitalmars-d-learn
And also I can't understand difference between HTTPClientRequest and HTTPServerRequest For example if I am getting request from web-browser what I should use? And why?

Re: Can't understand how to do server response with vibed

2015-11-28 Thread Suliman via Digitalmars-d-learn
On Saturday, 28 November 2015 at 18:57:53 UTC, anonymous wrote: On 28.11.2015 19:51, Suliman wrote: Eghm, sorry. Not req, but res, but again errr: void action(HTTPServerRequest req, HTTPServerResponse res) { writeln(req.writeJsonBody); } Error: no property 'writeJsonBody' for type 'vibe.h

Re: Can't understand how to do server response with vibed

2015-11-28 Thread anonymous via Digitalmars-d-learn
On 28.11.2015 19:51, Suliman wrote: Eghm, sorry. Not req, but res, but again errr: void action(HTTPServerRequest req, HTTPServerResponse res) { writeln(req.writeJsonBody); } Error: no property 'writeJsonBody' for type 'vibe.http.server.HTTPServerRequest' But this method are present in doc

Re: Can't understand how to do server response with vibed

2015-11-28 Thread anonymous via Digitalmars-d-learn
On 28.11.2015 19:46, Suliman wrote: And the second question. Why I am getting next error after attempt to write to console JSON request: Error: cannot resolve type for res.writeJsonBody(T)(T data int status = HTTPStatus.OK, string content_type = "application/json; charset=UF-8", bool allow_chunk

Re: Multidimensional AA question

2015-11-28 Thread André via Digitalmars-d-learn
On Friday, 27 November 2015 at 04:21:41 UTC, Nicholas Wilson wrote: AA are weird in that AFAIK you need to "initialise" them before you try to look suff up in them else they crash. i.e. int[string] foo; // auto e = "1" in foo; // crash AA not initialised foo[ "blah"] = 0; foo.remove("blah"); aut

Re: Can't understand how to do server response with vibed

2015-11-28 Thread Suliman via Digitalmars-d-learn
On Saturday, 28 November 2015 at 18:46:05 UTC, Suliman wrote: And the second question. Why I am getting next error after attempt to write to console JSON request: Error: cannot resolve type for res.writeJsonBody(T)(T data int status = HTTPStatus.OK, string content_type = "application/json; ch

Re: Can't understand how to do server response with vibed

2015-11-28 Thread Suliman via Digitalmars-d-learn
And the second question. Why I am getting next error after attempt to write to console JSON request: Error: cannot resolve type for res.writeJsonBody(T)(T data int status = HTTPStatus.OK, string content_type = "application/json; charset=UF-8", bool allow_chunked = false) void action(HTTPServ

Re: Multidimensional AA question

2015-11-28 Thread André via Digitalmars-d-learn
On Friday, 27 November 2015 at 08:53:18 UTC, Jack Applegame wrote: On Thursday, 26 November 2015 at 17:27:34 UTC, André wrote: My question now is: is there some more elegant solution to achieve this? Something like in C++ when you have std::map's of std::map's and just access the elements and t

Formatting dates

2015-11-28 Thread Chris Wright via Digitalmars-d-learn
Is there a way to format a DateTime struct similar to strftime(3)? None is documented, and none is immediately obvious in the source code. Or is the recommended way to convert a DateTime to a Unix timestamp and then use strftime?

Can't understand how to do server response with vibed

2015-11-28 Thread Suliman via Digitalmars-d-learn
Could anybody help me to understand how to complete HTTP response with vibed. I am sending POST request from AngularJS: $.post("http://127.0.0.1:8080/my";, total_result); where total_result is JSON string: [{"QID":3,"AID":3}, {"SubAID":[4]}, {"MinArea":"10","MaxArea":"90"}] Handler is look l

Re: Retrieving call expression of a function

2015-11-28 Thread tcak via Digitalmars-d-learn
On Saturday, 28 November 2015 at 15:41:59 UTC, Quentin Ladeveze wrote: On Saturday, 28 November 2015 at 15:22:51 UTC, tcak wrote: On Saturday, 28 November 2015 at 15:02:32 UTC, Quentin Ladeveze wrote: Hi, Is it possible to retrieve the calling expression of a function ? Something like that

Re: Retrieving call expression of a function

2015-11-28 Thread Quentin Ladeveze via Digitalmars-d-learn
On Saturday, 28 November 2015 at 15:22:51 UTC, tcak wrote: On Saturday, 28 November 2015 at 15:02:32 UTC, Quentin Ladeveze wrote: Hi, Is it possible to retrieve the calling expression of a function ? Something like that --- import std.stdio; void funcTest(int x, float y) { writefln(get_ca

Re: Retrieving call expression of a function

2015-11-28 Thread tcak via Digitalmars-d-learn
On Saturday, 28 November 2015 at 15:02:32 UTC, Quentin Ladeveze wrote: Hi, Is it possible to retrieve the calling expression of a function ? Something like that --- import std.stdio; void funcTest(int x, float y) { writefln(get_call()); } void main() { float x = 0.2; funcTest(1+2, x+2

Retrieving call expression of a function

2015-11-28 Thread Quentin Ladeveze via Digitalmars-d-learn
Hi, Is it possible to retrieve the calling expression of a function ? Something like that --- import std.stdio; void funcTest(int x, float y) { writefln(get_call()); } void main() { float x = 0.2; funcTest(1+2, x+2); } --- output expected : " funcTest(1+2, x+2) " Thanks

Re: Drawing Native OSX Windows with D

2015-11-28 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-11-28 11:40, Mike McKee wrote: Does anyone have a demo that shows how I can call the native OSX API to draw a basic window that's minimizable and can be closed? I was thinking of making an installer for the Mac, you see. So for instance, people would download a very thin .app file and ru

Re: [VisualD] Crashing after several build processes

2015-11-28 Thread Jack via Digitalmars-d-learn
On Saturday, 28 November 2015 at 13:03:23 UTC, Jack wrote: Greetings. I've been using VS2010 with VisualD for my project and have encountered an unusual problem with it. So every once in a while, when I try to fix bugs in whatever it is I'm doing, VS2010 would freeze at "Build Started" and w

Re: Getting GtkD to work on OSX

2015-11-28 Thread Gerald via Digitalmars-d-learn
On Saturday, 28 November 2015 at 10:26:58 UTC, Mike McKee wrote: I have GtkD working just fine on Ubuntu Linux. Now I'm trying to get it to work on my Mac with the same hello.d codebase and hello.glade file. (Demo here: http://stackoverflow.com/a/32535987/105539) What's the procedure to gettin

[VisualD] Crashing after several build processes

2015-11-28 Thread Jack via Digitalmars-d-learn
Greetings. I've been using VS2010 with VisualD for my project and have encountered an unusual problem with it. So every once in a while, when I try to fix bugs in whatever it is I'm doing, VS2010 would freeze at "Build Started" and will go unresponsive for a couple of minutes and crash soon

Re: Multithreaded HTTP Download

2015-11-28 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Saturday, 28 November 2015 at 06:40:49 UTC, Mike McKee wrote: How could I achieve something like that in D? (Note, I'm using OSX.) I did it with vibe.d and http byte ranges. In general I'm trying to see if I can make a command line zip file downloader that downloads faster than Curl for my

Re: Multithreaded HTTP Download

2015-11-28 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Saturday, 28 November 2015 at 10:46:11 UTC, tcak wrote: The only case that would make sense is if the server limits the upload speed of each TCP socket. Unless you are in this position, I do not expect to see any difference by opening multiple sockets and requesting different parts of same f

Re: Drawing Native OSX Windows with D

2015-11-28 Thread Guillaume Piolat via Digitalmars-d-learn
On Saturday, 28 November 2015 at 10:40:19 UTC, Mike McKee wrote: Does anyone have a demo that shows how I can call the native OSX API to draw a basic window that's minimizable and can be closed? I was thinking of making an installer for the Mac, you see. So for instance, people would download

Re: [Dtiled] Unfamiliar terms and trouble using it for Dgame

2015-11-28 Thread Jack via Digitalmars-d-learn
On Saturday, 28 November 2015 at 11:03:37 UTC, Namespace wrote: Well to start, I just copied the code for loading the map and tried to build it, substituting the variables like Rect and others. Then it went crazy all of a sudden: http://dpaste.com/2D59A2B The whole thing went mad, and I was

Re: [Dtiled] Unfamiliar terms and trouble using it for Dgame

2015-11-28 Thread Namespace via Digitalmars-d-learn
Well to start, I just copied the code for loading the map and tried to build it, substituting the variables like Rect and others. Then it went crazy all of a sudden: http://dpaste.com/2D59A2B The whole thing went mad, and I was sure I had my imports correct: import dtiled.data; import dtil

Re: Multithreaded HTTP Download

2015-11-28 Thread tcak via Digitalmars-d-learn
On Saturday, 28 November 2015 at 07:05:55 UTC, Mike McKee wrote: Hey guys, as it turns out, someone on stackoverflow.com pointed out in a Perl version of this question that the Bash example that was given is really buggy and doesn't make sense. They say that trying to download a single file usi

Drawing Native OSX Windows with D

2015-11-28 Thread Mike McKee via Digitalmars-d-learn
Does anyone have a demo that shows how I can call the native OSX API to draw a basic window that's minimizable and can be closed? I was thinking of making an installer for the Mac, you see. So for instance, people would download a very thin .app file and run that. Because it only uses native w

Getting GtkD to work on OSX

2015-11-28 Thread Mike McKee via Digitalmars-d-learn
I have GtkD working just fine on Ubuntu Linux. Now I'm trying to get it to work on my Mac with the same hello.d codebase and hello.glade file. (Demo here: http://stackoverflow.com/a/32535987/105539) What's the procedure to getting GtkD installed on OSX?