What are the current choices for non-blocking servers available for D? Currently I have found two solutions: vide.d and mango servelets, but I'm not satisfied with the choices available. What have others used besides these two implementations of web servers?
Maybe this might be helpfull? https://github.com/csauls/zeal.d
What is it that you miss with vibe.d for example. i am happily using it and it simply works. i am also writing an article series about exactly that and my experience with vibe.d: http://www.extrawurst.org/blog11/2014/01/stack4-and-the-d-programming-language-part1/
I've not used it myself and therefore can't vouch for it at all, but I just saw this:
https://github.com/DannyArends/DaNode
You can using hunt-http to build a webserver:
import hunt.http;
void main()
{
auto server = HttpServer.builder().setListener(8080, "0.0.0.0").setHandler((RoutingContext context) {
context.write("Hello World!");
context.end();
}).build();
server.start();
}
Related
I'm just kinda curious if there is a way to use the mocker driver alongside or instead of the docker one? How does fn even decide which one to use if there is more than one? The reason would be that if it's possible I might try to implement another real driver for another container engine.
So far I managed mocker to show up as a driver but still haven't found out how to get fn to use that instead of docker.
There is an example for building an fn with extensions located here: https://github.com/fnproject/fn/blob/master/examples/extensions/main.go#L16 -- for building with a custom driver, at the moment it requires using that same process (i.e. there's no way to configure another driver at runtime from fn core's binary without extending it).
In order to build with an alternative driver such as mocker, a user would use the agent.WithDockerDriver option to specify a driver when creating the agent, documented here https://godoc.org/github.com/fnproject/fn/api/agent#AgentOption and sample follows:
func main() {
mocker := mock.New()
// configure logstore, mq
da := agent.NewDirectCallDataAccess(logstore, mq)
magent := agent.New(da, agent.WithDockerDriver(mocker))
fns := server.New(server.WithAgent(magent), /*other options*/)
fns.Start(context.Background())
}
we need to tidy up the agent interface to make them easier to create (data access stuff is convoluted), but is not too bad. most of this can be stolen from this file https://github.com/fnproject/fn/blob/master/api/server/server.go -- we need to name it to WithDriver as well :)
assuming you're looking at using something like rkt or a more robust driver on the backend, it's possible to hook this up by implementing the driver interface and in the past we have tried it but we are not maintaining it at present since it was not a viable option (performance issues, perhaps improved since). would be cool to see if you manage to get rkt working, gladly take a PR for it and figure out where to put it :)
I would like to make an application simmilar to CodeFights in that a user is given a set of excercises for which he has to code solutions. I figured out how to take a users JavaScript code and run it on a Node.js server using for example the Function constructor:
try {
var solver = new Function('arg1', 'arg2', bodyAsString);
} catch(e) {
console.log('Function cannot be parsed');
}
Good thing about this approach is that the solver(...,...) function now has access to global scope only and not the scope it was made in. Even better one could also combine this with a sandbox module.
But what is the best approach if I want to use multiple languages - let's say JavaScript, Python and C++. How do I go about solving this problem if I want to give the user a choice of language? Do I write his solution to a file and try to execute it via command line also in some kind of a sandbox mode? Can this even be done if I use Node.js as backend?
Is there any C# client anyone know about that we can use to run queries against SumoLogic? I see they have a Java Client but cannot find a corresponding C# client.
You can use SumoLogicMessageSender class.
You can find using this class here.
But, I don't recommend to use GetResult() like it writes in original code :
// this maintains synchronous behavior for single event scenarios.
this.SumoLogicMessageSender
.TrySend(bodyBuilder.ToString(), this.SourceName, this.SourceCategory, this.SourceHost)
.GetAwaiter()
.GetResult();
How does one use ramaze with eventmachine? i can't find any examples of a ramaze-enabled EM. For example something similar to async sinatra?
thanks
I'm using Frontier::Daemon to build a test library server for Robot Framework test automation framework. I got the test library server working for executing the code locally, but when it runs/executes over XML-RPC, that is when I run into problems. Part of the issue might also be because I'm using Perl reflection to execute test commands.
Maybe RPC::XML might be a better fit, but at the time I was developing the server, Frontier::Daemon seemed easier to start off with.
The Perl reflection code was borrowed from threads posted on this site as well as Wikipedia's page on code reflection (Perl section).
The code is hosted at Google Code, you can browse the code or check it out for review. The issue is described in more detail at the project site.
I was hoping the Perl developer community could give me some pointers on the source of the problem and how to fix it.
Thanks,
Dave
There are a couple things you are missing. First, Frontier::Daemon calls the "methods" you provide it as simple subroutine calls, but your two provided methods expect to be called as methods of your remote server object. Change your code to do this:
my $svr = Frontier::Daemon->new(
methods => {
get_keyword_names => sub { $self->get_keyword_names(#_) },
run_keyword => sub { $self->run_keyword(#_) },
},
...
to call your methods as they seem to expect.
Second, your get_keyword_names tries to return an array, but the interface you are using seems to only allow a single return value and is calling the methods in scalar context, causing get_keyword_names to return the count of elements in the array. I think you want to be returning a reference to the array instead:
return \#methods;