Re: D equivalent of C++ bind ?

2016-05-10 Thread André via Digitalmars-d-learn
e(int error) cb) { . . . while cb(0) . . . } You could just adapt a call to it using a lambda function: async_task( (error) => myCb(error, count) ); D makes sure the enclosing stack is copied to the heap and count is reachable. Maybe this helps... Regards, André

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: 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 el

Multidimensional AA question

2015-11-26 Thread André via Digitalmars-d-learn
t is created if it didn't exist before. I know I could create a function for that but I am looking for a standard approach that already exists. Thanks! André

Re: expand variadic template parameters

2015-03-10 Thread André
too many trees in front of my eyes. Thanks for the answers. Kind regards André On Tuesday, 10 March 2015 at 19:16:23 UTC, Adam D. Ruppe wrote: On Tuesday, 10 March 2015 at 19:11:22 UTC, André wrote: Is there a simple way to get it working? The simplest: just write `bar(args);` - the

expand variadic template parameters

2015-03-10 Thread André
pe '(int, string)' I understand args is a TypeTuple and therefore expand is not working. Is there a simple way to get it working? Kind regards André

Re: InvalidMemoryOperationError@(0)

2014-11-17 Thread André
Thanks a lot. I will forward this recommendation (DGUI BitBucket). Kind regards André On Monday, 17 November 2014 at 16:40:18 UTC, ketmar via Digitalmars-d-learn wrote: On Mon, 17 Nov 2014 15:41:25 + Andre via Digitalmars-d-learn wrote: ~this

Re: Learning asynchronous sockets in D (well actually C...)

2012-06-24 Thread Jarl André
On Sunday, 24 June 2012 at 23:04:14 UTC, Sean Kelly wrote: On Jun 24, 2012, at 11:40 AM, "Jarl André" "@puremagic.com wrote: Is it wrong to badge myself with asynchronous sockets? :) Nope. It's pretty weird stuff if you've never done event-based programming befo

Re: Learning asynchronous sockets in D (well actually C...)

2012-06-24 Thread Jarl André
On Sunday, 24 June 2012 at 19:10:55 UTC, Tobias Pankrath wrote: * add -g and -debug=splat (or any other keywords) to the build command You don't need a keyword -debug is sufficient. To make the binary work with a debugger you does not even need -debug, only -g. -debug only includes code that

Re: Learning asynchronous sockets in D (well actually C...)

2012-06-24 Thread Jarl André
I have now completely and totally replaced the inner contents of my server library with modified Splat code. It ran so much faster that I was actually afraid I had got it wrong. It seemed not be any wrong with it, so adding Splat actually made it super kidding me fast. I have now learned a few

Learning asynchronous sockets in D (well actually C...)

2012-06-23 Thread Jarl André
The learning curve has been from like zero to "something". I am still grasping for some fundamental knowledge that I need to fully "get" whats going on. Had to read documentation for sockets in C to understand anything at all. That says a lot. Coming from BufferedReader hell in Java and did nev

Re: Does D have high-performance sockets

2012-06-13 Thread Jarl André
On Wednesday, 13 June 2012 at 10:24:58 UTC, Dmitry Olshansky wrote: On 13.06.2012 1:29, D Day wrote: Are there any implementations of this anywhere for D? I really only care about the windows platform - and have considered writing this myself with IOCP and std.socket, but I figure someone els

Segmentation fault hell in D

2012-06-08 Thread Jarl André
Evry single time I encounter them I yawn. It means using the next frickin hour to comment away code, add more log statements and try to eleminate whats creating the hell of bugz, segmantation fault. Why can't the compiler tell me anything else than the fact that i have referenced data that does

Re: Simplified socket creation and handling

2012-06-05 Thread Jarl André
Thank you for the Windows compatibility. I will try it out ASAP. I have now added some subtle changes to the server and example echo server. I have added an example for how byte streams can be passed to the server by converting them to base64. In my example the base64 encoded data is appended

Re: Simplified socket creation and handling

2012-06-02 Thread Jarl André
Now the similarity to the original quickserver library in java is so ripped off that I had an email sent over to the author asking for permission to continue on the api clone or alternatively change the api. Comments or suggestions? sucks totally or worth a penny?

Re: Socket identification key

2012-05-31 Thread Jarl André
I don't know why but for some reason this did not come to my mind. LOL Its a bit embarassing really because I work with Java every day and memory reference is a core feature. But I think the SocketSet buzzed my brain making me think that it gave me different objects or something. But anyway

Re: Socket identification key

2012-05-31 Thread Jarl André
On Thursday, 31 May 2012 at 14:46:42 UTC, Alex Rønne Petersen wrote: On 31-05-2012 16:44, "Jarl André" " wrote: Hi I have searched high and low to figure this one out. There does not seems to be a an accessible way of getting a unique key for a socket. I have learned that por

Socket identification key

2012-05-31 Thread Jarl André
Hi I have searched high and low to figure this one out. There does not seems to be a an accessible way of getting a unique key for a socket. I have learned that port numbers count a great deal but really shouldn't there be some internal numbering or representation of each socket that the deve

Re: Simplified socket creation and handling

2012-05-30 Thread Jarl André
On Wednesday, 30 May 2012 at 20:09:43 UTC, Jarl André wrote: On Monday, 21 May 2012 at 19:06:24 UTC, Nathan M. Swan wrote: On Monday, 21 May 2012 at 17:54:56 UTC, Adam D. Ruppe wrote: On Saturday, 19 May 2012 at 20:33:49 UTC, Nathan M. Swan wrote: It has some pitfalls (e.g. I can't find a

Re: Simplified socket creation and handling

2012-05-30 Thread Jarl André
On Monday, 21 May 2012 at 19:06:24 UTC, Nathan M. Swan wrote: On Monday, 21 May 2012 at 17:54:56 UTC, Adam D. Ruppe wrote: On Saturday, 19 May 2012 at 20:33:49 UTC, Nathan M. Swan wrote: It has some pitfalls (e.g. I can't find a good way to stop the server) When I use it, I just leave it open

Re: Simplified socket creation and handling

2012-05-30 Thread Jarl André
On Wednesday, 30 May 2012 at 08:40:48 UTC, Dejan Lekic wrote: On Friday, 18 May 2012 at 06:35:59 UTC, Jarl André wrote: I am a Java developer who is tired of java.nio and similar complex socket libraries. In Java you got QuickServer, the ultimate protocol creation centered socket library

Re: Simplified socket creation and handling

2012-05-30 Thread Jarl André
On Wednesday, 30 May 2012 at 08:40:48 UTC, Dejan Lekic wrote: On Friday, 18 May 2012 at 06:35:59 UTC, Jarl André wrote: I am a Java developer who is tired of java.nio and similar complex socket libraries. In Java you got QuickServer, the ultimate protocol creation centered socket library

Re: Converting from string to enum by name

2012-05-29 Thread Jarl André
On Monday, 28 May 2012 at 18:53:50 UTC, Ali Çehreli wrote: On 05/28/2012 11:50 AM, "Jarl André" " wrote: > 1. Is there a way to convert from string "INFO" to LogLevel.INFO, by name? conv.to can do that: import std.conv; enum LogLevel { ALL, INFO, WARNING } v

Converting from string to enum by name

2012-05-28 Thread Jarl André
Hi I have a project on github, https://github.com/jarlah/d2-simple-socket-server, where I have added very custom logger library. In this logger library I have an enum LogLevel that looks like enum LogLevel { ALL, INFO, WARNING etc } Questions: 1. Is there a way to convert from string "INFO

Re: Simplified socket creation and handling

2012-05-27 Thread Jarl André
Sorry for the typo: I do NOT understand it completely. Thanks for the feedback! Well, for me I am a Java enterprise developer working with Java on Unix, but, I have worked with .NET in the past giving me a tiny portion of mercy to those that enjoys Visual Studio :) Its actually a blazing fast

Re: Simplified socket creation and handling

2012-05-27 Thread Jarl André
On Friday, 25 May 2012 at 20:55:12 UTC, Donald Duvall wrote: On Friday, 25 May 2012 at 20:50:25 UTC, Donald Duvall wrote: On Wednesday, 23 May 2012 at 19:24:53 UTC, Jarl André wrote: On Wednesday, 23 May 2012 at 13:39:09 UTC, Jarl André wrote: On Saturday, 19 May 2012 at 20:33:49 UTC, Nathan M

Re: Simplified socket creation and handling

2012-05-23 Thread Jarl André
On Wednesday, 23 May 2012 at 13:39:09 UTC, Jarl André wrote: On Saturday, 19 May 2012 at 20:33:49 UTC, Nathan M. Swan wrote: On Friday, 18 May 2012 at 06:35:59 UTC, Jarl André wrote: I am a Java developer who is tired of java.nio and similar complex socket libraries. In Java you got

Re: Simplified socket creation and handling

2012-05-23 Thread Jarl André
On Saturday, 19 May 2012 at 20:33:49 UTC, Nathan M. Swan wrote: On Friday, 18 May 2012 at 06:35:59 UTC, Jarl André wrote: I am a Java developer who is tired of java.nio and similar complex socket libraries. In Java you got QuickServer, the ultimate protocol creation centered socket library

Simplified socket creation and handling

2012-05-17 Thread Jarl André
I am a Java developer who is tired of java.nio and similar complex socket libraries. In Java you got QuickServer, the ultimate protocol creation centered socket library. You don't have to write any channels and readers and what not. You just instantiate a server, configures the handlers (fill

Re: parse json-string - operator overload error

2012-05-17 Thread Jarl André
On Wednesday, 1 December 2010 at 08:17:37 UTC, zusta wrote: Hey guys, I'm trying to read a JSON-formated file. The parsing of the file seems to be correct, but I always get the following error: "Error: no [] operator overload for type JSONValue". For testing purposes, I also tried the code o

Re: std.json

2012-05-17 Thread Jarl André
On Thursday, 17 May 2012 at 18:36:22 UTC, Jarl André wrote: On Thursday, 17 May 2012 at 14:08:27 UTC, Vincent wrote: On Sunday, 25 March 2012 at 17:50:45 UTC, Andrea Fontana wrote: Hope it's clear... Nope, it's something like chess and have nothing common with simplicity of the

Re: std.json

2012-05-17 Thread Jarl André
On Thursday, 17 May 2012 at 14:08:27 UTC, Vincent wrote: On Sunday, 25 March 2012 at 17:50:45 UTC, Andrea Fontana wrote: Hope it's clear... Nope, it's something like chess and have nothing common with simplicity of the real JSON usage! This is example from C#: var p = JsonConvert.Deserializ

Range returned by iota and const

2012-04-17 Thread André Stein
opSlice of iota.Result doesn't seem to mutate the range so is there any special reason why it isn't declared as such? (the same holds for opSlice). Regards, André

Re: Multiple definition of .../std/regex.d.912_ModuleInfoZ

2012-03-05 Thread André
Am 04.03.2012 16:27, schrieb Dmitry Olshansky: On 04.03.2012 14:49, André wrote: Hi, I have a project compiled as libary and a seccond example project using this library. The library is compiled without errors. As it's a linker error I'd recommend checking that phobos and library

Multiple definition of .../std/regex.d.912_ModuleInfoZ

2012-03-04 Thread André
. If comment one of the two import statements, then it is working. I know there is no error in /std/regex.d. I do not even use this module. But how to find out the root cause of this issue? Kind regards André dmd -c "main.d" -of"..proj_dir../F/FExample/FExample/obj/Debug/main.o"

Re: Trouble with -lib in linux "undefined reference to `_Dmain'"

2012-02-29 Thread André
you are right, that was the error. Thanks. Kind regards André Am 29.02.2012 18:27, schrieb Kevin Cox: I think you need the -lib in the linker command (too?). On Feb 29, 2012 12:25 PM, "André" mailto:an...@s-e-a-p.de>> wrote: Hi, I use Mono-D and have a hello wor

Trouble with -lib in linux "undefined reference to `_Dmain'"

2012-02-29 Thread André
.o" Do I miss an additional linux option or is the order of the commands wrong? Kind regards André

Function overload with template alias error

2011-12-24 Thread André Stein
ce of code where I tried to write an templated overload to std.variant.Algebraic. Thanks, André