Haxe + real-time network - networking

i try to find a good combination of libraries for managing a real-time communication (client/server) using Haxe (only Haxe, not openfl or other framework base on Haxe) targeting flash (swf) for the client and no preference for the server except don't use neko.
The goal is to make a simple tchat and put a display representation of all clients on an aera. Each client can move his representation in this area, and the other sees the movement.
I find some Lib to make this :
https://github.com/soywiz/haxe-ws
https://github.com/MattTuttle/hxnet
haxe-js-kit
But I'm not sure of the best way to adopt.
Do you have any suggestion/remarks/tips to choose the better way ?

Disclaimer: I wrote the library that I am sharing here.
My somewhat new library mphx may be able to help you. It can manage 'rooms' of connections, allows client to server and server to client messaging in the form of events, and best of all, is cross platform. It also works in the web with websockets.
It was originally an extention of HxNet, however I wanted it to be easier to use. Connecting and sending a 'message' with data just takes a few lines.
I have a few examples in the github repository, the simplest being the 'basic' example. One of your requests you have is that it doesn't rely on one of the big libraries (open fl, etc) and mphx doesn't. The basic example proves that, and only runs in terminal. That being said, it can be used with haxeflixel, for that you can see the other examples.
It sounds like your main goal is to have simple, graphic multiplayer. For that you can look at the 'movement' haxeflixel example.
Documentation is still a little skim, and the code is alpha, so it might change or break. That can probably be said for most of the library's you listed though. The best way to install it is like this
haxelib git mphx https://github.com/5Mixer/mphx.git
That will not install the examples though. To run them, either download the repository as a zip, or just git clone it, and go into the examples folder.
Library: https://github.com/5Mixer/mphx
Old video's I made. A little outdated, most likely.
Video 1: https://www.youtube.com/watch?v=07J0wLXwH0g
Video 2: https://www.youtube.com/watch?v=MUx2CUtsnTU

Related

Run R script and hide the actual code from user

I have created an R code script that:
Reads some data from a database
Makes some transformations and..
exports into a csv the modified table.
This code needs to run in a client's machine, but we need to "hide" the actual code from the user.
Is there any useful suggestions on how we can achieve that?
Up front
... it will be nearly impossible to deploy an R <something> to another computer in a way that prevents curious users from accessing the source code.
From a mailing list conversation in 2011, in response to "I would not like anyone to be able to read the code.",
R is an open source project, so providing ways for you to do this is not
one of our goals.
Duncan Murdoch https://stat.ethz.ch/pipermail/r-help/2011-July/282755.html
(Prof Murdoch was on the R Core Team and R Foundation for many years.)
Background
Several (many?) programming languages provide the ability to compile a script or program into an executable, the .exe you reference. For example, python has tools like py2exe and PyInstaller. The tools range from merely compactifying the script into a zip-ball, perhaps obfuscating the script; ... to actually creating a exe with the script either tightly embedded or such. (This part could use some more citations/research.)
This is usually good enough for many people, by keeping the honest out. I say it that way because all you need to do is google phrases like decompile py2exe and you'll find tools, howtos, tutorials, etc, whose intent might be honestly trying to help somebody recover lost code. Regardless of the intentions, they will only slow curious users.
Unfortunately, there are no tools that do this easily for R.
There are tools with the intent of making it easy for non-R-users to use R-based tools. For instance, RInno and DesktopDeployR are two tools with the intent of creating Windows (no mac/linux) installers that support R or R/shiny tools. But the intent of tools like this is to facilitate the IT tasks involved with getting a user/client to install and maintain R on their computer, not with protecting the code that it runs.
Constrain R.exe?
There have been questions (elsewhere?) that ask if they can modify the R interpreter itself so that it does not do everything it is intended to do. For instance, one could redefine base::print in such a way that functions' contents cannot be dumped, and debug doesn't show the code it's about to execute, and perhaps several other protective steps.
There are a few problems with this approach:
There is always another way to get at a function's contents. Even if you stop print.default and the debugger from doing this, there are others ways to get to the functions (body(.), for one). How many of these rabbit holes do you feel you will accurately traverse, get them all ... with no adverse effect on normal R code?
Even if you feel you can get to them all, are you encrypting the source .R files that contain your proprietary content? Okay, encrypting is good, except you need to decrypt the contents somehow. Many tools that have encrypted contents do so to thwart reverse-engineering, so they also embed (obfuscatedly, of course) the decryption key in the application itself. Just give it time, somebody will find and extract it.
You might think that you can download the key on start-up (not stored within the app), so that the code is decrypted in real-time. Sorry, network sniffers will get the key. Even if you retrieve it over https://, tools such as https://mitmproxy.org/ will render this step much less effective.
Let's say you have recompiled R to mask print and such, have a way to distribute source code encrypted, and are able to decrypt it in a way that does not easily reveal the key (for full decryption of the source code files). While it takes a dedicated user to wade through everything above to get to the source code, none of the above steps are required: they may legally compel you to release your changes to the R interpreter itself (that you put in place to prevent printing function contents). This doesn't reveal your source code, but it will reveal many of your methods, which might be sufficient. (Or just the risk of legal costs.)
R is GPL, and that means that anything that links to it is also "tainted" with the GPL. This means that anything compiled with Rcpp, for instance, will also be constrained/liberated (your choice) by the GPL. This includes thoughts of using RInside: it is also GPL (>= 2).
To do it without touching the GPL, you'd need to write your interpreter (relatively from scratch, likely) without code from the R project.
Alternatives
Ultimately, if you want to release R-based utilities/apps/functionality to clients, the only sure-fire way to allow them to use your code without seeing it is to ... control the computers on which R will run (and source code will reside). I'll add more links supporting this claim as I find them, but a small start:
https://stat.ethz.ch/pipermail/r-help/2011-July/282717.html
https://www.researchgate.net/post/How_to_make_invisible_the_R_code
Options include anything that keeps the R code and R interpreter completely under your control. Simple examples:
Shiny apps, self-hosted (or on shinyapps.io if you trust their security); servers include Shiny Server (both free and commercial versions), RStudio Connect (commercial only), and ShinyProxy. (The list is not known to be exclusive.)
Rplumber is an API server, not a shiny server. The intent is for single HTTP(s) endpoint calls, possibly authenticated, supporting whatever HTTP supports (post, get, etc). This can be served in various ways, see its hosting page for options.
Rserve. I know less about this, but from what I've experienced with it, I've not had as much luck integrating with enterprise systems (where, e.g., authentication and fine-control over authorization is important). This does allow near-raw access to R, so it might not be what you want (especially when the intent is to give to clients who may not be strong R users themselves).
OpenCPU should be discussed, but not as a viable candidate for "protect your code". It is very similar to rplumber in that it provides HTTP endpoints, but it supports endpoints for every exported function in every package installed in its R library. This includes the base package, so it is not at all difficult to get the source code of any function that you could get on the R console. I believe this is a design feature, even if it is perfectly at odds with your intent to protect your code.
Anything that can call R or Rscript. This might be PHP or mod_python or similar. Any web-page serving language that can exec("/usr/bin/Rscript",...) can take its output and turn it around to the calling agent. (It might also be possible, for example, for a PHP front-end to call an opencpu endpoint that only permits connections from the PHP-serving host.)

Alternative Java applet network drive access

Chrome is on the verge of definitly break compatability with NPAPI, and IE breaking with ActiveX the future of Java Applets is dark. Currenty we actively use a secure applet for out client organizations that enables their users to upload a bunch of files from their file system to our servers with the click of a button. The applet has full access to any configured drive, including network drives.
With the imminent death of the applet this functionality is going to be lost if we don't find an alternative. I have already tried to explore different solutions, including the chrome FileSystem API but that is currently only available for Chrome (http://caniuse.com/#feat=filesystem) and has limited access.
Does anybody know about an alternative to keep supporting the much appreciated functionality? Unfortunately we are obligated to support all browser down to IE8.
I've written a post about this here.
Once Google Chrome was the first to announce that they won’t be supporting NPAPI anymore, they were also the first to provide a new architecture in order to rewrite your code to work on their browser. You can take a look on Native Messaging, which “can exchange messages with native applications using an API that is similar to the other message passing APIs”. The problem is that this approach only works on Chrome, is not something that you can adapt to other browsers.
A more useful approach is FireBreath, a browser plugin in a post NPAPI world. Check the words below from one buddy of the project:
“FireBreath 2 will allow you to write a plugin that works in NPAPI, ActiveX, or through Native Messaging; it’s getting close to ready to go into beta. It doesn’t have any kind of real drawing support, but would work for what you describe. The install process is a bit of a pain, but it works. The FireWyrm protocol that the native messaging component uses could be used with any connection that allows passing text data; it should be possible to make it work with js-ctypes on firefox or plausibly WEB-RTC or even CORS AJAX in some way. For now the only thing we needed to solve was Chrome, but we did it in a way that should be pretty portable to other technologies.”
In light of the answer provided by Uly Marins I have researched the options suggested. Unfortunately these options weren't viable for our application, because the mayority of our users do not have sufficient rights to install third party plugins. Additionally the API is still in Beta which won't do any good in a stable production environment.
The main problem we wanted to solve was the abbility to delete files from the accessed folders. It seemed like one of the mayor goals of the removal of the NPAPI support was exactly to prevent this kind of possibility. Therefore we needed to reduce our goals to a simple solution that was still acceptable for our users, with the additional training on how to clear the selected folder manually (because most of our users are almost computer illiterate and needed to access network folders).
Long answer short. The requested solution is just not possible anymore and had to be replaced by a simpler solution and additional training.

Distributed source control for VisualWorks Smalltalk

One of the annoying things about Smalltalk is that it (usually) requires its own VCS, due to the way that it manages its source code. Squeak and Gemstone (at least in its GLASS version) have a DVCS called Monticello that works passably well. As near as I can tell, VisualWorks' main VCS, StORE, only works in old-fashioned centralized mode. Is there a system similar to Monticello available for VisualWorks? Alternatively, am I misunderstanding the right way to use StORE?
While Store is not structured to be a distributed tool, it can be used that way. Most of the engineers working on VisualWorks and ObjectStudio use a local repository (in their office; most of the team is geographically distributed). There are merging and replication tools that allows them to synch up their local work with the "repository of record" as required/desired.
Having said that, there's a port of Monticello for VW (and thus, for ObjectStudio as well). The only real issue with it is that after publishing, it doesn't "talk" to the tools (browser) about the publish status. That's because it's mostly use to maintain the Seaside port, and not as a mainline versioning tool for VW.

Simulating a TWAIN Device

Our company is using some software that ONLY accepts input from an "Imaging Device" i.e. a TWAIN device (e.g. scanner).
The problem is that we are receiving our files digitally, so using an actual scanner would require us to print, scan, and shred documents that we already have on the computer, but not in the software.
I was curious if anybody has any idea of how we might be able to work around this problem in the meantime. My first thought was to find some way to trick the program into thinking we're using a scanner, via some new 'imaging device' that would just read in the file, and spit it out to the software, but I don't even know where to begin with that.
We put in a feature request, seeing as how this problem should obviously be addressed in the software itself, but the company is notorious for lagging pretty hard when it comes to updates.
The system used by scanners is called TWAIN, so you'd be looking for some sort of virtual twain driver.
A quick google search will produce several hits, I don't have any experience with the software myself so can't advise any further.
Two such providers I found via experts exchange:
http://www.twaintools.de
http://www.scanpoint-usa.com
OK, months late... but in case you are interested, I have a TWAIN driver framework/toolkit that might let you build this fairly easily, depending on just what your scanning app expects, and how hard it is to read images from your digital documents. It's a Microsoft Visual C++ project. No charge but you'd need our permission to redistribute a driver based on it: GenDS
The TWAIN Working Group also has a sample/skeleton driver, I think it's straight C - and used to have some rather bad bugs (Why I wrote mine ;-) but, it might have got better.
Look for the "sample data source and application" on their download page.
And of course I have a 'commercial' version of GenDS that I use to write TWAIN drivers on contract.

What is a good method for sharing source code among 3-4 developers that does NOT require it to be Open Source?

I'm a newbie developers and building an application with 3 other remote developers. I've only worked alone until now, and now I need a way to share my source code with the other developers on the project. All of the project sites out there (SourceForge, Codeplex, Google, etc) seem to be aimed at Open Source development I'm not interested in making our code available to the world, I'm just looking for a method of sharing the code among the four of us. What is the best known method...or how is this usually accomplished?
Set up a Subversion repository (can be accessed across http).
There is an excellent online free book detailing pretty much everything you need to know about Version Control with Subversion
Yep, you need a version control repository which is remotely accessible. Subversion is excellent and very widely used; Git is another good option.
You could set up your own repository - you'll need a server which all devs can access via ssh, or via Apache/WebDAV - or use a hosted service, like Beanstalk, Project Locker, Unfuddle, SVNsite, etc.
http://beanstalkapp.com/
Set up a Subvserion repository (http://subversion.tigris.org/). You can control who may view your data through accounts, plus it gives you document versioning. When paired with a Http server, you can even view the source directly in a browser.
Subversion has all sorts of plugins for Eclipse and even Visual Studio, I believe. Tortise SVN is a stand-alone SVN client you may like, although I recommend an IDE-integrated plugin.
Subversion also goes well with a continuous integration server, such as Continuum.
Hosted: http://wush.net is another Subversion hosting platform.
Or, if you can host your own server, check out the VERY easy to use and VERY free VisualSVN Server: http://www.visualsvn.com/server/
You don't say what computing resources you have available, but the easy choice is to use a central server with say SVN to which you all have ssh access using a public key. You can probably rent such a service for around $10 per month.
If you don't like central servers, you can try Mercurial or git and ssh back and forth between your personal development machines.
If ssh is problematic, git actually enables you to send patches to each other by email (probably Mercurial does too). Ben Lynn's Git Magic tutorial explains.
You can use an online source control (like SVN or Git), and share it only with your team members. You should look into Unfuddle, it's a free source control/project hosting, complete with bug tracking system. I use it for my personal projects and it's awesome.
I think the best solution is Subversion. Subversion is a free source control system that is ideal for your requirement.
You can use many other support tools like Tortoise SVN to make the things more easier.
Here is one of the cheat sheets that describes commands of SVN.
Most of the Web hosting providers support easy one click installation of SVN on their servers. ex : Dreamhost So you can get a setup done very easily.
CVS is another Source control system that are used widely but I haven't seen any providers that support easy installation of CVS but there should be. You can have support tools for CVS such as Tortoise CVS as well.
I don't think you are interested in visual source safe (Microsoft Proprietary and not over Web) so I am not going to add information about it here. :)
You need to set up a source control repository. It's a pretty big topic, I'm really not sure where the best place to start reading about it would be. I'm sure the Wikipedia article on Revision Control will at least give you a bit of an overview.
This seems like a decent introductory series as well: Source Control HOWTO
Subversion works just fine over http/https. It is an open source project, but you can use it for whatever purposes you want.
http://subversion.tigris.org/
Most modern source control systems work well. Subversion is a common one. Which operating system will the developers be running?
If you just want to get up and running quickly with something, check out a hosted subversion system like www.beanstalk.com or www.unfuddle.com.
Subversion is open source, and I know you don't need it, but there are a lot of options here. If on Windows, check out Tortoise SVN. If on a Mac and you don't want a command line client, check out Versions.
You can actually setup google code to only allow viewing/editing by registered members. And I don't think they force any licenses either.
We currently use VSS but are in the process of migrating everything over to Source Gear Vault because VSS makes jumping out of our third story windows a common thought...
Here is a free solution with premium options available... https://freepository.com I have not tried this one.
Try github. It will cost you $12/month though.
Just use devunity.com. upload your code via zip or import it from svn and thats it. lets you collaborate around code instantly.

Resources