Using Wordcram on server side - processing

The only WordCram constructor uses PApplet. Does it mean there is no server-side use?
Is any example available for server side exporting png file?
Regards,

I make WordCram. I get this question a lot.
There's no way to make Processing sketches run without an applet, and that means no WordCrams, either.

Related

How to create Ruby repl in the browser

Hi thanks for taking a look at my question. I'm trying to create a site with a Sinatra server that will allow users to run ruby code in the browser similar to what you see with repl.it, code academy, etc.
Is there a gem/library or anything out there can can handle the interpreter? If I need to create one myself, how can I do this without evaluating the code in the server? (seems dangerous)
Any advice is helpful, thanks!
You can use repl.it's API https://repl.it/api
Should be very easy to use
You can use Kernel#eval to run code from the string (user's input). Remember that it is not safe to execute some random code directly in your production environment.

Any way to use MvcMiniProfiler on windows application? Or is there a sister application?

So I've started using MvcMiniProfiler on our websites and quite like it. We have a Windows Application component/framework that is leveraged by the website and I was wondering if it was possible to use the profiler on that. I'm assuming not, but maybe there is a subcomponent of the code that could be used? I see that there is a way to configure where the results are stored (i.e. Sql Server) so maybe it is close to possible?
We have the following flow:
Website submits job to 'broker' then returns a 'come back later' page.
Broker runs and eventually data in the websites database gets updated by the broker.
Website displays the results.
I'd be great if there was a way I could get the entire workflow profiled. If there is no way/no intentions from the developers to make MvcMiniProfiler available to Windows applications, any recommendations for similar styled profilers?
You could get this working by using SqlServerStorage, there is very little in the code base that heavily depends on ASP.NET, in fact the SQL interceptor is generalized and so it the stack used to capture the traces.
I imagine that a few changes internally need to be made, eg: use Thread.SetData as opposed to HttpContext but they are pretty superficial.
The way you would get this going is by passing the "profiling identity" into the App and then continuing tracking there. Eventually when the user hits the site after it happens, it would show up as little "chiclets" on the left side.
A patch is totally welcome here but it is not something it does in its current version.
(note to future readers, this is probably going to be out of date at some point, if it is please suggest an edit)
Yes, there's a Windows porting of MiniProfiler: http://nootn.github.io/MiniProfiler.Windows/

AJAX optimization - instead of checking every 2 ms?

Heylo guys
i am writing an experimental AJAX page that checks the data of a txt file every 2 ms and if there is a change, post the change to the page
problem is that this is very inefficient bandwidth wise and computation-wise. Is there another way to do this? I have heard of websockets (not familiar though)
thx!
You can use COMET
http://en.wikipedia.org/wiki/Comet_%28programming%29
AJAX Push (Comet server) is exactly what you need. This is a very powerful tookit/engine: http://www.ape-project.org/
Instead of comparing the data, you could only compare the file size/last modified date on your server side script and return a 0/1 depending on if it didn't change or did.
Apart from that you'll have to tell us more about which language you're using on the server for us to be able to tell you what to do. You can use Long Polling or Comet, but it really depends on your server side language how good those would be. With PHP for example, I've found these to not be possible unless I installed stuff on the server, which in shared hosting for example is not possible.
Checking a text file 500 times per second is a bad idea, IMHO.
My suggestion is to have your server-side script check the modified date and "push" a notification to your AJAX listeners. Node.js and Faye would be good for this.
A good screencast on Node can be found here ($12):
http://peepcode.com/products/nodejs-i
That screencast also covers Faye (http://faye.jcoglan.com/node.html). Faye simplifies the whole Comet/polling process.

Is there a good DNS server library in ruby?

I want to create a test DNS server in ruby, but could not find anything suitable. I found pnet-dns(http://rubyforge.org/projects/pnet-dns/). This project is incomplete and buggy. Is there any alternative?
A language-agnostic alternative is to use PowerDNS pipe backend. Because it communicates with a name server across a simple pipe, it can be written in any language, including Ruby. (The simple example in the documentation uses Perl but it should be easy to translate.)
RubyDNS is what you're looking for.
Checkout an another approach of DNS server in ruby using celluloid: https://github.com/celluloid/celluloid-dns
The original celluloid-dns is horribly incomplete (v0.0.1). Recently, RubyDNS is being copied into celluloid-dns (I'm doing this as we speak). RubyDNS will be modified to work with the updated celluloid-dns since all core functions will be moved from RubyDNS to celluloid-dns.
If you want something that works right now, use RubyDNS. However, in the future, if you just want the low level APIs, use celluloid-dns.
Have you looked at Dnsruby?
It aims to be fully RFC compliant, although it focuses primarily on the client side. It is, however, possible to write your own server - use Dnsruby::Message#decode to decode incoming packets, and a zone of RRSets holding your test records. You can then encode your packets to send back to the client.

Can you send dynamic data to a processing applet?

I have an ajax page which pulls data from a database. I'd like to add a processing applet to visualize the data but i can't figure out how to update the visualization as the data changes. The idea is to be able to push new data into the visualization.
I'm not tied to the processing technology, anything will work. Processing just seems to be the easiest way to make it look nice. Thanks for the advice.
The easiest way is to construct your own XML structure (base64 encode binary data if you need) and add a timer in your applet to retrieve updates from the server (through HTTP requests). How to prepare and process the XML is up to you.
Applets are a bit heavy-weight for visualization, so if the same thing can be done in Flash, I'd recommend using that instead. Flash also got support for HTTP requests (or you can let javascript handle it).
I'm not sure of how you could facilitate communication between the two, but as a possible alternative you could look at processing.js, which is processing implemented in javascript.
applets run in their own sandbox. Look at the java.net.URL and java.net.HttpURLConnection classes.
You could make http requests from the java applet. I don't know anything about processing applets though.

Resources