Re: Are there any D scripting engines for use with D?

2016-01-04 Thread yawniek via Digitalmars-d-learn
On Monday, 4 January 2016 at 19:04:48 UTC, Max Klyga wrote: On 2016-01-04 18:40:03 +, Jason Jeffory said: The fastest one would probably be Lua - http://code.dlang.org/search?q=lua But there are other options: Python - http://code.dlang.org/packages/pyd Javascript -

Re: DUB problems

2015-12-31 Thread yawniek via Digitalmars-d-learn
On Thursday, 31 December 2015 at 08:51:42 UTC, Daniel Kozak wrote: I try to build vibe-d Hello world app with dub, but I have many problems with dub, nothing works at all Error: Output file 'client.o' for module 'vibe.http.client' collides with previous module 'vibe.db.mongo.client'. See the

regex format string problem

2015-11-22 Thread yawniek via Digitalmars-d-learn
hi! how can i format a string with captures from a regular expression? basically make this pass: https://gist.github.com/f17647fb2f8ff2261d42 context: i'm trying to write a implementation for https://github.com/ua-parser where the regular expression as well as the format strings are

failing regex

2015-11-23 Thread yawniek via Digitalmars-d-learn
regex from https://github.com/ua-parser/uap-core/blob/master/regexes.yaml#L38 seems to work in other languages, not so in D: auto r2 = r"(?:\/[A-Za-z0-9\.]+)? *([A-Za-z0-9 _\!\[\]:]*(?:[Aa]rchiver|[Ii]ndexer|[Ss]craper|[Bb]ot|[Ss]pider|[Cc]rawl[a-z]*)) (\d+)(?:\.(\d+)(?:\.(\d+))?)?".regex();

Re: regex format string problem

2015-11-23 Thread yawniek via Digitalmars-d-learn
Hi Rikki, On Monday, 23 November 2015 at 03:57:06 UTC, Rikki Cattermole wrote: I take it that browscap[0] does it not do what you want? I have an generator at [1]. Feel free to steal. This looks interesting, thanks for the hint. However it might be a bit limited, i have 15M+ different User

Building the Docs with checked out code downoads old dmd

2015-11-21 Thread yawniek via Digitalmars-d-learn
i'm trying to build the docs as per http://wiki.dlang.org/Building_DMD#Building_the_Docs i have a working setup to build the latest dmd/druntime/phobos but somehow the makefile tries to download an old dmd version and my bandwith currently is a bit restricted and i want an offline version.

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

2016-08-16 Thread yawniek via Digitalmars-d-learn
On Tuesday, 16 August 2016 at 10:06:05 UTC, ikod wrote: On Tuesday, 16 August 2016 at 09:16:40 UTC, yawniek wrote: There is common http message parser that used in nginx and nodejs. I think it can be ported from C to D. that is pico, see: https://github.com/nodejs/http-parser/pull/200

Re: Persistent key-value-store for D?

2017-04-28 Thread yawniek via Digitalmars-d-learn
On Wednesday, 26 April 2017 at 17:06:52 UTC, krylon wrote: I looked at the DUB package registry and asked Google quite a bit now, but I did not found such a package for D. So my first question is - did I not look hard enough? I found a reimplentation of QDBM [1] (the spiritual ancestor of

dynamically compile and load glue logic

2018-03-30 Thread yawniek via Digitalmars-d-learn
in how far is it or would the following be possible: dynamically compile and execute some glue logic that is also written in D under linux? and what happens if that code uses phobos or other dub libs that are available in the host binary? especially the 2nd point is important as i would

Re: Search Engine

2014-10-06 Thread yawniek via Digitalmars-d-learn
On Monday, 6 October 2014 at 17:11:51 UTC, ANtlord wrote: Good day! I recenlty have tried create typical project on vibe.d. The web framework is not bad. And I can say, that it is better that something another web frameworks. But I have met a problem. I can't find search engine. I use xapian

return types of std.functional functions

2014-10-12 Thread yawniek via Digitalmars-d-learn
i found two snippets from the functional docs that do not work (anymore?) http://dlang.org/phobos/std_functional.html assert(compose!(map!(to!(int)), split)(1 2 3) == [1, 2, 3]); and int[] a = pipe!(readText, split, map!(to!(int)))(file.txt); throwing a std.array.array into the mix works

thrift and dub

2014-11-27 Thread yawniek via Digitalmars-d-learn
hi, i'm trying to get a thrift example working within a dub project. it seems that the thrift.d in the dub repo is not whats actually needed but i should link against libthriftd.a that comes from the official thrift distro. what i tried is add the following to dub.json: libs:

Re: thrift and dub

2014-11-28 Thread yawniek via Digitalmars-d-learn
got it to work by using the thrift code from the fbthrift repo (minus the tests).

Re: vibed: how to use pure HTML instead of template engine?

2015-05-07 Thread yawniek via Digitalmars-d-learn
On Thursday, 7 May 2015 at 18:59:13 UTC, Suliman wrote: 1. Do I need write ./public/ ? In examples often simply public/ will work too. even public it goes trough Path struct, see: https://github.com/rejectedsoftware/vibe.d/blob/11578aa956a9b3b0e305d655f9668a867fdd89bd/source/vibe/inet/path.d

Re: vibed: how to use pure HTML instead of template engine?

2015-05-07 Thread yawniek via Digitalmars-d-learn
On Thursday, 7 May 2015 at 18:59:13 UTC, Suliman wrote: shared static this() { auto router = new URLRouter; router.get(/, root); auto settings = new HTTPServerSettings; settings.port = 8080; listenHTTP(settings, router); } void root(HTTPServerRequest req,

Re: problem with gc?

2015-05-28 Thread yawniek via Digitalmars-d-learn
On Thursday, 28 May 2015 at 10:11:38 UTC, zhmt wrote: On Thursday, 28 May 2015 at 02:00:57 UTC, zhmt wrote: the throughput is steady now: if buffer size is set to 1, throughput is about 20K response/second; when buffer size is big enough ,the throughput is about 60K response/second.

Re: std.net.curl

2015-08-17 Thread yawniek via Digitalmars-d-learn
On Monday, 17 August 2015 at 13:04:31 UTC, tired_eyes wrote: On Monday, 17 August 2015 at 12:58:54 UTC, Adam D. Ruppe wrote: On Monday, 17 August 2015 at 12:52:37 UTC, tired_eyes wrote: Hovewer, dmd app.d spits a whole bunch of strange error messages: try dmd -lcurl app.d and see if that

Re: most elegant functional way to make a histogram

2015-08-24 Thread yawniek via Digitalmars-d-learn
On Friday, 21 August 2015 at 21:08:25 UTC, Laeeth Isharc wrote: I guess this kind of thing will do: upRangeHighs.each!((ref a)=(++histogram[a][0])); int[] arr = [5,1,2,2,3,4,5,5,5]; int[int] histo; arr.each!( a = ++histo[a] ); writeln(histo); this works

Re: extern(C) with function returning user type

2015-07-29 Thread yawniek via Digitalmars-d-learn
On Wednesday, 29 July 2015 at 17:59:26 UTC, Kyoji Klyden wrote: How would I use a C function that's returning a struct? auto doesn't work here, and from what I can tell D can't import C headers. (If it really can't then, that would be a very welcome feature) I do have the required libs but I

Re: Typed Message Passing between D Processes

2015-07-29 Thread yawniek via Digitalmars-d-learn
On Wednesday, 29 July 2015 at 16:36:41 UTC, Atila Neves wrote: LDC: Cerealed: 970 ms, 482 μs, and 6 hnsecs MsgPack: 896 ms, 591 μs, and 2 hnsecs Not too shabby! Atila cool. what are the advantages of cereald over msgpack? can you stream in packets with cereald too? cool thing about

zlib performance

2015-08-07 Thread yawniek via Digitalmars-d-learn
hi, unpacking files is kinda slow, probably i'm doing something wrong. below code is about half the speed of gnu zcat on my os x machine. why? why do i need to .dup the buffer? can i get rid of the casts? the chunk size has only a marginal influence. https://github.com/yannick/zcatd import

Re: zlib performance

2015-08-07 Thread yawniek via Digitalmars-d-learn
On Friday, 7 August 2015 at 08:50:11 UTC, Daniel Kozák wrote: ldc[2] -O -release -boundscheck=off -singleobj app.d ldc 0.15.2 beta2 2.86s user 0.55s system 77% cpu 4.392 total v2.068-devel-8f81ffc 2.86s user 0.67s system 78% cpu 4.476 total v2.067 2.88s user 0.67s system 78% cpu 4.529

Re: zlib performance

2015-08-07 Thread yawniek via Digitalmars-d-learn
On Friday, 7 August 2015 at 07:29:15 UTC, Daniel Kozák wrote: Which compiler and version. There has been some performance problem with IO on OSX, it should be fixed in 2.068 release i'm on master. v2.068-devel-8f81ffc also changed file read mode to rb. i don't understand why the program

Re: zlib performance

2015-08-07 Thread yawniek via Digitalmars-d-learn
On Friday, 7 August 2015 at 07:43:25 UTC, Daniel Kozák wrote: i don't understand why the program crashes when i do not do the .dup This is weird. I would say it should not crash exactely. but try it yourself. the fastest version i could come up so far is below. std.conv slows it down. going

Re: zlib performance

2015-08-07 Thread yawniek via Digitalmars-d-learn
On Friday, 7 August 2015 at 07:48:25 UTC, yawniek wrote: On Friday, 7 August 2015 at 07:43:25 UTC, Daniel Kozák wrote: the fastest version i could come up so far is below. std.conv slows it down. going from a 4kb to a 4mb buffer helped. now i'm within 30% of gzcat's performance. ok maybe not,

Re: zlib performance

2015-08-07 Thread yawniek via Digitalmars-d-learn
On Friday, 7 August 2015 at 08:05:01 UTC, Daniel Kozák wrote: import std.zlib, std.file, std.stdio, std.conv; void main(string[] args) { auto f = File(args[1], rb); auto uncompressor = new UnCompress(HeaderFormat.gzip); foreach (buffer; f.byChunk(4096)) { auto

Re: zlib performance

2015-08-07 Thread yawniek via Digitalmars-d-learn
On Friday, 7 August 2015 at 08:24:11 UTC, Daniel Kozák wrote: can you try it with ldc? ldc[2] -O -release -boundscheck=off -singleobj app.d ldc 0.15.2 beta2 2.86s user 0.55s system 77% cpu 4.392 total v2.068-devel-8f81ffc 2.86s user 0.67s system 78% cpu 4.476 total v2.067 2.88s user

Re: zlib performance

2015-08-07 Thread yawniek via Digitalmars-d-learn
On Friday, 7 August 2015 at 11:45:00 UTC, Daniel Kozak wrote: On Friday, 7 August 2015 at 09:12:32 UTC, yawniek wrote: [...] Can you try it without write operation (comment out all write)? And than try it without uncompression? // without compression: void main(string[] args) { auto f

dub and subpackages

2015-08-14 Thread yawniek via Digitalmars-d-learn
i'm trying to have my own versions of my dependencies as git submodules. problem: i include a local version of vibe.d and then i add other local versions of packages that themselves include vibe.d somehow my version of vibe isn't picked up by the other dependencies and it results in an

Re: dub and subpackages

2015-08-14 Thread yawniek via Digitalmars-d-learn
On Friday, 14 August 2015 at 08:09:18 UTC, Edwin van Leeuwen wrote: On Friday, 14 August 2015 at 08:06:15 UTC, yawniek wrote: dub add-local allows you to add local copy of a package. This will be system wide though, not only for the current package. i actually tried this, somehow did't work

format of trace.log

2015-08-10 Thread yawniek via Digitalmars-d-learn
is there a reason the trace log is a bit weirdly formatted? a) different tables within one file b) column separation is something like (fill with space until it exceeds 7 digits could this be improved to use a standard format (e.g. tsv) or are there some legacy reasons? also it would be

C bindings: typedef struct conflicts with method

2015-07-20 Thread yawniek via Digitalmars-d-learn
i tried to automagically create bindings for librdkafka (https://github.com/edenhill/librdkafka) with dstep. now the code contains typedefs structs with the same name as methods: ``` typedef struct rd_kafka_metadata { int broker_cnt; /* Number of brokers in 'brokers' */

Re: C bindings: typedef struct conflicts with method

2015-07-21 Thread yawniek via Digitalmars-d-learn
On Tuesday, 21 July 2015 at 06:12:53 UTC, Jacob Carlborg wrote: what the correct way to bind these? Please report an issue for this. In this case rd_kafka_metadata_t should be used for the struct name. done, https://github.com/jacob-carlborg/dstep/issues/40 i was under the impression that

idiom for C error strings

2015-07-21 Thread yawniek via Digitalmars-d-learn
whats the proper way to use/wrap C functions that expect a error string buffer e.g.: somefun(T param1, char* errstr, size_t errstr_size) in D ?

LuaD: creating a flexible data filter system

2015-10-16 Thread yawniek via Digitalmars-d-learn
hi, i'm reading in a stream of data that is deserialized into individual frames. a frame is either of: a) a specific D datastructure ( struct with a few ulong,string,string[string] etc members), known at compile time b) json (preferably stdx.data.json) i now want to implement something

Re: LuaD: creating a flexible data filter system

2015-10-17 Thread yawniek via Digitalmars-d-learn
many thanks for the valuable insights. so far i made a simple prototype with LuaD and classes, works nicely for when my niput what so far is not 100% clear is if there is a way to have a parsed msgpack or json documents being exposed in my lua code in a way so it behaves like a lua object.

how does vibe's PrivateAccessProxy work

2015-08-30 Thread yawniek via Digitalmars-d-learn
can someone explain a bit how the @before hooks works in detail, i mainly have problems understanding why ensureAuth in belows example refers to SampleService. as an instance:

Re: AWS API Dlang, hmac sha256 function.

2015-10-03 Thread yawniek via Digitalmars-d-learn
On Saturday, 3 October 2015 at 03:11:06 UTC, holo wrote: Hello I'm trying to contact AWS API with D according to documentation: [...] check https://github.com/yannick/vibe-aws it has v4 implemented

Re: "if sting in string"

2015-09-18 Thread yawniek via Digitalmars-d-learn
On Friday, 18 September 2015 at 09:42:05 UTC, smadus wrote: Ok i have rewrite :) Now: http://dpaste.dzfl.pl/cf8bb54b1390 The Problem is: http://www.directupload.net/file/d/4114/9zryku49_png.htm but i dont understand this, because, the exception should be "Something wrong" ?!? But, thanks

interfacing with C: strings and byte vectors

2016-06-11 Thread yawniek via Digitalmars-d-learn
my C library works a lot with strings defined in C as: struct vec_t { char *base; size_t len; } is there a easy way to feed regular D strings to functions that accept vec_t* without creating a vec_t every time or do i write wrappers for these functions and if so, what is the most

Re: Benchmark Dlang vs Node vs Ruby

2016-05-28 Thread yawniek via Digitalmars-d-learn
On Friday, 27 May 2016 at 16:47:19 UTC, Daniel Kozak wrote: Why not to use distribute oprion? Dne 27. 5. 2016 17:35 napsal uživatel "yawniek via Digitalmars-d-learn" < digitalmars-d-learn@puremagic.com>: it its a flawed strategy. what you should do is let the kernel handl

Re: interfacing with C: strings and byte vectors

2016-06-11 Thread yawniek via Digitalmars-d-learn
On Saturday, 11 June 2016 at 10:26:17 UTC, Mike Parker wrote: On Saturday, 11 June 2016 at 09:32:54 UTC, yawniek wrote: thanks mike for the in depth answer. i forgot to add a few important points: - the strings in vec_t are not c strings - vec_t might contain other data than strings the

Re: Benchmark Dlang vs Node vs Ruby

2016-05-27 Thread yawniek via Digitalmars-d-learn
On Friday, 27 May 2016 at 13:45:23 UTC, llaine wrote: Hi guys, In my journey of learning about D I tried to benchmark D with Vibe.d vs node with express and Ruby with Sinatra. And the results are pretty surprising. I have to admit that I though D was more faster than that. How is this even

Re: Linux and htod

2016-06-16 Thread yawniek via Digitalmars-d-learn
On Thursday, 16 June 2016 at 19:04:38 UTC, bachmeier wrote: On Thursday, 16 June 2016 at 12:23:09 UTC, fbmac wrote: How people use it on Linux, if htod is required to import C libraries and windows only?f Just to clarify, so as to prevent confusion by someone that randomly stumbles across

Re: Getting the body of a HTTP Request

2016-01-28 Thread yawniek via Digitalmars-d-learn
On Wednesday, 27 January 2016 at 23:42:54 UTC, brian wrote: Anyone able to shed some light on what the structure of the response is, and how I can read/output it all? Regards Brian its unlikely that vibe client misses something. for debugging i would try to go trough all requests with curl

Re: Alternate databases

2016-02-20 Thread yawniek via Digitalmars-d-learn
On Saturday, 20 February 2016 at 13:09:53 UTC, Andrew Edwards wrote: I'm searching for client drivers for the following databases. Are the any available? https://rethinkdb.com/docs/install-drivers/ http://docs.basho.com/riak/latest/dev/references/client-implementation/ Thanks, Andrew none

BitArray: count the number of bits set

2016-03-01 Thread yawniek via Digitalmars-d-learn
i figured i can count the number of bits set for a BitArray with std.algorithm : count: BitArray([0,0,1]).bitsSet.count() but this seems not very optimal, is there a faster way directly accessible trough phobos? ideally something that is optimized by the compiler.

Re: how to parse a string into a phobos datatype with additional logic

2016-04-07 Thread yawniek via Digitalmars-d-learn
On Thursday, 7 April 2016 at 08:03:34 UTC, Edwin van Leeuwen wrote: You can try this library: https://code.dlang.org/packages/dateparser nope this will not work and the question is broader: i want to have a standard datatype parsed in a specific way and so that i can use other std library

Re: VibeCustomMain not working

2016-04-07 Thread yawniek via Digitalmars-d-learn
On Thursday, 7 April 2016 at 13:40:17 UTC, Rene Zwanenburg wrote: On Thursday, 7 April 2016 at 13:25:29 UTC, Jerry wrote: I generated a visuald project and tried that. Now suddenly it is working as expected. So I guess it's a bug in dub. That's possible of course, but I'd expect something so

Re: how to parse a string into a phobos datatype with additional logic

2016-04-07 Thread yawniek via Digitalmars-d-learn
On Thursday, 7 April 2016 at 18:29:19 UTC, Jonathan M Davis wrote: On Thursday, April 07, 2016 07:45:06 yawniek via Digitalmars-d-learn wrote: So, while I understand your frustration, I just don't see any other sane way to approach this problem than what you've done. Putting it all

how to parse a string into a phobos datatype with additional logic

2016-04-07 Thread yawniek via Digitalmars-d-learn
what is the way one is supposed to parse e.g. a double of unixtime (as delived by nginx logs) into a SysTime? currently i'm creating a wrapper struct around SysTime with alias this as: https://gist.github.com/yannick/6caf5a5184beea0c24f35d9d4a4c7783 really ugly imho. is there a better way

Re: BitArray: count the number of bits set

2016-03-01 Thread yawniek via Digitalmars-d-learn
On Tuesday, 1 March 2016 at 09:32:20 UTC, Andrea Fontana wrote: Maybe you should look for "hamming weight" :) maybe. and here is a snowman for you: ☃ the question was if it exists for BitArray in phobos. https://issues.dlang.org/show_bug.cgi?id=10239 so apparently its really missing in

Re: vibe.d is blocking threads

2016-04-27 Thread yawniek via Digitalmars-d-learn
On Wednesday, 27 April 2016 at 13:00:29 UTC, RuZzz wrote: Code: import std.concurrency; import core.thread; //import vibe.http.client; // If uncommented this line, the thread "worker" does not start void worker() { foreach (i; 0 .. 5) {

Re: Async or event library

2016-05-12 Thread yawniek via Digitalmars-d-learn
On Tuesday, 10 May 2016 at 13:34:36 UTC, chmike wrote: vibed uses libevent, a C library. The discussion is regarding a possible pure D equivalent of libevent. libasync is an interesting proposal but it is apparently slower than libevent. I don't know the current status because vibed improved

Re: JSON Serialization with runtime filtering.

2016-07-23 Thread yawniek via Digitalmars-d-learn
On Friday, 22 July 2016 at 12:36:31 UTC, Alexander Milushev wrote: I there any json serialization library which allow to make decision about ignoring fields in runtime? I trying to write rest client but server accept either 'cmd' or 'args' field for example and I need to find solution. can

Re: How to get current time as long or ulong?

2016-07-06 Thread yawniek via Digitalmars-d-learn
On Tuesday, 5 July 2016 at 18:16:31 UTC, Charles Hixson wrote: What I'm looking for is the opposite of the "FromUnixTime" function. i often use long toNsUnixTime(SysTime t) { return (t.stdTime - 621_355_968_000_000_000L)*100; } as a helper. any chance that something like this can be put

Re: Singleton Pattern

2016-07-10 Thread yawniek via Digitalmars-d-learn
On Thursday, 5 January 2012 at 22:15:32 UTC, asm wrote: how can i implementing the singleton pattern in D? https://p0nce.github.io/d-idioms/#Leveraging-TLS-for-a-fast-thread-safe-singleton

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

2016-08-16 Thread yawniek via Digitalmars-d-learn
imo things should be modularized. so there should be (fast) protocol parsers first, something like https://github.com/h2o/picohttpparser or https://github.com/seanmonstar/httparse then a very simple eventloop that has abstractions and range based interfaces for reading/writing data into