How to automate testing in weka? - c#

My C# program generates both training and testing data. I need to use Back Propagation Neural Network/ Multilayer perceptron in Weka GUI for classification & testing. Currently I'm supplying the testing data manually.
As my C# program generates test data, this has to be supplied automatically to the Multilayer perceptron in the weka. This is a Kinect application written in C#.
Is there a solution for automatic testing of data using weka?.
So that my application works without my manual intervention.
Thanks in advance.

Weka has a Java API that that can be used to access the majority of the features exposed in the GUI. Plenty of documentation is available on their website. A good starting point is this guide to using WEKA in Java Code.

The problem here is to link C# code with Weka(Java). For this, I found CSharpJavaMerger. But we need to get the source code of Weka which is in Java, use the merger software for converting and thus link it to C# code.

Related

How to compare two images by pixel using selenium C#

I have two screenshots. One is expected, another one is actual. I was looking for a good way to compare those screenshots using C# for my automated selenium tests. I found a few decisions to do that in java but C# doesn't provide a lot. I'd appreciate any help
You can use ImageMagick a 3rd party application. It supports command line calls to do image comparison. The following link discusses how to use the command line call:
http://techblog.hotwire.com/2016/05/19/image-comparison-in-automated-testing/
You can also use the nuget package for ImageMagick. This would allow you to embed C# calls to the nuget library in your .NET application. The following stack overflow answer discusses it:
https://stackoverflow.com/a/14235661/2683997
Both of these links assumes that you have been able to do the image capture part already.
You can do this by sikuli with selenium web driver

Running several python scripts from C#

I am hoping that someone might be able to help me out here. I am relatively new to C# and am trying to execute some Python code I wrote from within a C# winform app.
What I would like to do is input a name from a text box within the winform and have it process through the python scripts and return a result in another textbox on the winform.
I have found several good examples of how to execute a single script within C#, but I am having some trouble understanding how I can reference multiple scripts.
As an example, I have one python script that references two other scripts within code
from FindTelephone import *
from FindAddress import *
def createPerson(name)
telephone = FindTelephone(name)
address = FindAddress(name)
....
Is there a way to have C# point to a reference of my other python scripts before running my main script?
Thanks in advance for the help.
Marshall
Like in these posts?:
Call Python function from c# (.NET),
run a python script from c#?
Or
You might want to look into pythonnet.
Or
If you want an easyer way of doing this then I recommend using Iron Python in place of normal Python. IronPython is an open-source implementation of the Python programming language which is tightly integrated with the .NET Framework. Means that it is much easyer to use with C# and Windows Forms and looks almost just like normal Python.
Or
For in case you are using Visual Studio, VS has some Python tools that might help you in your quest. Link. You can find more documentation Here This last link is provided by Jedediah from comments so vote his comment up if you liked this last link.
Other handy link: Integrating Python With Other Languages

Using Visualization Toolkit with IronPython

In my application, I have provision to run Python scripts through IronPython. In one of the requirement, the data from my C# application should be displayed in 3D using Visualization Toolkit. When I try to use VTK in a script and execute it, I get "ImportError: No module named vtk" error. I have searched for file named vtkCommonPython.pyd but cannot find it on my computer. Should Python be installed even after installing IronPython? What is the correct way to use VTK from IronPython?
In most cases, IronPython does not work with native/CPython modules like what vtkCommonPython.pyd seems to be. You will probably want to look at .NET bindings for VTK in order to use it from your IronPython scripts.
ActiViz.NET might be what you should be using. Wiki/Documentation, Download
Other modules containing only pure python should typically work fine. It's 'just' the native extensions that do not work as there is no easy (and built-in) way to make native code callable from .NET/IronPython using the same conventions as in CPython.
For additional info see the FAQ ('Compatibility') and the issue tracker.
You might also want to keep an eye on the recent effort to revive and port ironclad to IronPython 2.7. This project aims to provide the marshalling layer required to invoke CPython modules.

PHP (HTML5) based Windows Software

Is it possible to make from a HTML5-APP (PHP,SQLITE,HTML,CSS,JS) a installable Windows Software in c#?
The software must start PHP (5.4), and must just load the document-root in the webbrowser object.
In theory it should work without problems. But what about protecting this code? Is it possible to protect at least the PHP part? Will ioncube or zend-guard work on PHP 5.4's embeded server? And is it possible to hide the shell window, which will open everytime, when i start the PHP Webserver via cmd?
Or do you know an alternate, how i can make a software from a HTML-5 (with PHP) App?
Your choosing the wrong language. PHP, HTML, JS, CSS and SQLLite are separate technologies.
I'd suggest writing the app in another language capable of producing an executable like C / C++ (and one that can plug into to SQLITE fairly easy).
If you want to create a installer out of HTML5-APP (PHP,SQLITE,HTML,CSS,JS) , take a look at bitnami package, it may solve your problem, if you have any explicit reason to use C#, and then you have see its library or namespace which may give you installer capability. However your question is unclear, can be be more clear?
You can embed a Chrome browser in C# using the CefSharp project. You would also need to embed some webserver (php built-in webserver might work, but it's single threaded so it might be an issue).
If it doesn't necessarily need to be C#, then take a look at the PHP Desktop project that is using C++ to embed a Chrome engine, a multithreaded webserver Mongoose and a PHP interpreter. Sources can be protected using many available php encoders, see the KnowledgeBase wiki page on the project site for details.

Using Mapnik in .net environment

Has anybody used Mapnik for rendering Maps from .net c# environment? I would like to use it to render maps in a desktop application developed under .net4. I found it the best open source map renderer tool, much more better, than the well known sharpmap, dotspatial (...). The 'only' problem is that it was written in C++ and Python and does not have a trivial way to use it from C#.
Do you know any .net Mapnik wrappers? Do you know any sample code?
I've just published my attempts in C# bindings.
They are available at: http://sourceforge.net/projects/mapniknet/
Some good new about Mapnik-.Net integration:
"Another thing that will help Windows developers is a way to use Mapnik from .Net languages. Although a full .Net wrapper is too much work besides all the other issues, hopefully I can make a meaningful start and open the door for .Net developers to leverage Mapnik in their applications."
Source: Mapnik homepage http://mapnik.org/news/2011/jun/09/gsoc_2011_windows_build_system_introduction/
NET-Mapnik
You might want to give this a try. Its pretty recent and has a simple example with options to create vector tiles.
https://github.com/kernelsanders/NET-Mapnik
So, finally I hacked it. Not a nice solution, but it works at least. In nutshell it operates in the following way:
developed a python script, which takes parameters as command line arguments. (using python api of mapnik)
call this python script by shell fom c# code (Process)
after map image has been generated, I show it in SharpMap as a background layer
In case of any map refresh (zoom, pan) I regenerate 'mapnik map layer'. I have also some kind of cache, in which I can store generated maps, so I can make tricks by using earlier generated map images or pre-generate them (e.g. generate maps for the next zoom level when user uses zoom tool). I also use some asynchron calls to do this, so I can create 1-3 map images paralelly.
The weak part of this solution is the communication between python and c# modules. I could not find better than command line arguments + shell.
My solution works, mapnik is fast, can genarate my maps less than a sec.
If you have any advice on .net - python communication (NO ironpython, it is not suitable for manik api), pls write it here. Thx.
Do you know about TAO Project?
It is a .Net project that takes unmanaged opengle library to .Net Managed Form by calling DllIMport() in C#.
You must do it for Mapnik, simaliar to TAOFramework.net

Categories

Resources