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: 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: Do users need to install VS runtime redistributable if linking with Microsoft linker?

2015-09-29 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Tuesday, 29 September 2015 at 09:15:29 UTC, ponce wrote: On Monday, 28 September 2015 at 16:01:54 UTC, Sebastiaan Koppe wrote: I could not find out which redistributable I had to install (what version of VS did you have installed / on what version of windows are you?). I decided to install t

Re: Do users need to install VS runtime redistributable if linking with Microsoft linker?

2015-09-28 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Monday, 28 September 2015 at 15:10:25 UTC, ponce wrote: On Tuesday, 22 September 2015 at 09:38:12 UTC, thedeemon wrote: On Monday, 21 September 2015 at 15:00:24 UTC, ponce wrote: All in the title. DMD 64-bit links with the VS linker. Do users need to install the VS redistributable libraries

Re: Dub package with C code

2015-09-25 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Friday, 25 September 2015 at 06:04:09 UTC, Laeeth Isharc wrote: Blog platform - I guess nothing wrong with wordpress etc. I am between platforms right now. I just don't want to deal with wordpress any more, and haven't yet picked something I like better. Something like Nikola and dicebot'

Re: Dub package with C code

2015-09-24 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Friday, 25 September 2015 at 01:36:11 UTC, Atila Neves wrote: On Thursday, 24 September 2015 at 11:38:08 UTC, Sebastiaan Koppe wrote: Or can reggae also pull packages from there? Yes. That is nice. I look at reggae once or twice. It looked like a lot of bootstrapping vs. `dub init && du

Re: Dub package with C code

2015-09-24 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Thursday, 24 September 2015 at 18:19:49 UTC, Laeeth Isharc wrote: nice work! To be honest it took me 2 hours, starting from git clone worth a little blog post on the experience so others can be inspired by and benefit from yours? I would be happy to write something. Any particular blog

Re: Dub package with C code

2015-09-24 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Thursday, 24 September 2015 at 12:55:12 UTC, Adam D. Ruppe wrote: On Thursday, 24 September 2015 at 06:21:02 UTC, Sebastiaan Koppe wrote: Because I want to focus on the product I am building right now, not on side-projects. We should write a C to D converter. We have htod but I'm talking t

Re: Maximum number of threads

2015-09-24 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Thursday, 24 September 2015 at 08:55:25 UTC, Alex wrote: - on my mac I can have 2048 threads spawned at the same time - on my linux machine the maximum number is 32192. The numbers are quite fixed, however there were some small fluctuations on the linux machine. I only know of `cat /proc/sy

Re: Dub package with C code

2015-09-24 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Thursday, 24 September 2015 at 08:35:40 UTC, Edwin van Leeuwen wrote: Alternatively you could use reggea to build both. I want to use dub. Simply because of code.dlang.org. Or can reggae also pull packages from there? You could try including the c source in your repo and add preBuildCom

Re: Dub package with C code

2015-09-23 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Thursday, 24 September 2015 at 06:00:50 UTC, Rikki Cattermole wrote: On 24/09/15 5:51 PM, Sebastiaan Koppe wrote: On Thursday, 24 September 2015 at 04:17:14 UTC, Rikki Cattermole wrote: Is libxlsxwriter available in the systems package manager? Pacman says no. Let e.g. Windows users figu

Re: Dub package with C code

2015-09-23 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Thursday, 24 September 2015 at 04:17:14 UTC, Rikki Cattermole wrote: Is libxlsxwriter available in the systems package manager? Pacman says no. Let e.g. Windows users figure theirs out. libxlsxwriter is not supported on windows. Which is kind-of funny.

Dub package with C code

2015-09-23 Thread Sebastiaan Koppe via Digitalmars-d-learn
I have just created bindings for libxlsxwriter, an c library for creating excel files. Used the htod tool to do most of the work, and only had to adjust some things - mainly because libxlsxwriter uses data structures written in macro's. Right now I am making a dub package and I would like to

Re: Adjacent Pairs Range

2015-09-15 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Monday, 14 September 2015 at 10:45:52 UTC, Per Nordlöw wrote: On Monday, 14 September 2015 at 05:37:05 UTC, Sebastiaan Koppe wrote: What about using zip and a slice? Slicing requires a RandomAccessRange (Array). This is too restrictive. We want to change operations such as adjacentTuples

Re: Adjacent Pairs Range

2015-09-13 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Saturday, 12 September 2015 at 10:17:19 UTC, Nordlöw wrote: How do I most elegantly iterate all the adjacent pairs in an `InputRange` using Phobos? Something like [1,2,3,4] => [(1,2), (2,3), (3,4)] What about using zip and a slice? ``` void main() { auto a = [1,2,3,4];

Re: using std.algorithm to find intersection of DateTime[][] arg

2015-09-09 Thread Sebastiaan Koppe via Digitalmars-d-learn
Couldn't you use setIntersection together with reduce? Doesn't seem like the most efficient solution, but its less typing and most likely will have no bugs.

Re: What is "FilterResult" type?

2015-09-09 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Wednesday, 9 September 2015 at 07:19:06 UTC, Bahman Movaqar wrote: The only way to make it work is `.array.idup` the output of `filter`. For example: auto result = reduce!( (acc, num) => acc.filter!( fb => (fb.x < num && fb.y < num) && (fb.x * fb.y > num) ).array.idu

Re: Regression?

2015-09-08 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Tuesday, 8 September 2015 at 07:12:52 UTC, FreeSlave wrote: On Tuesday, 8 September 2015 at 04:04:16 UTC, Sebastiaan Koppe wrote: Fixed it by changing into: ``` import std.conv : text; string json = File("../languages.json","r").byLineCopy().joiner.text; auto ls = json.par

Re: Regression?

2015-09-07 Thread Sebastiaan Koppe via Digitalmars-d-learn
Fixed it by changing into: ``` import std.conv : text; string json = File("../languages.json","r").byLineCopy().joiner.text; auto ls = json.parseJSON(); ```

Re: Regression?

2015-09-06 Thread Sebastiaan Koppe via Digitalmars-d-learn
Dammit, i am on windows, DMD32 D Compiler v2.068.0

Regression?

2015-09-06 Thread Sebastiaan Koppe via Digitalmars-d-learn
This used to work in older compiler (might have been v2.067 or v2.066, not older). ``` #!rdmd import std.stdio; import std.json; import std.algorithm; void main() { auto ls = File("../languages.json","r").byLineCopy().joiner.parseJSON(); } ``` Error: c:\D\dmd2\windows\bin\..\..\src\phobos\

Re: static array is no range?

2015-09-05 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Sunday, 6 September 2015 at 00:25:10 UTC, cym13 wrote: Yes, static arrays aren't ranges. The main reason is that static arrays are value type (ie: you copy them arround when passing them to functions which usually has a huge cost) where ranges are reference type (no copy, lighter, not always

static array is no range?

2015-09-05 Thread Sebastiaan Koppe via Digitalmars-d-learn
``` import std.algorithm; char[1024] buffer; buffer.find("LOCATION: "); // get error about how all the different versions of find don't match ``` ``` import std.algorithm; char[1024] buffer; buffer[0..$].find("LOCATION: "); // works as expected ``` Before trying the slice I manually pragma(msg

Vibe.d json to csv

2015-04-04 Thread Sebastiaan Koppe via Digitalmars-d-learn
So I am using vibe.d json module to parse some array data with homogeneous objects, and I want to convert it to CSV. Aside from encoding double-qoutes, this is want I came up with to generate the header: ``` void csvHeader(const Json jsonObject) { return keys(jsonObject.get!(Json[string])).s

<    1   2