Trying to create VB.Net Integration for EdgeJS - asp.net

I have created this project, which is basically an attempted clone of this project but converted from C# to VB using SharpDevelop 4.4 and then built using VS 2015
My issue can be found on GitHub here, but here's the error I'm getting when I run my NodeJS project:
My bit of code in my NodeJS project that isn't working:
var WriteCrapVB = edge.func('vb', function () {
/*
Function(input)
Console.WriteLine("Hello from .NET")
Return Nothing
End Function
*/
});
var hello = WriteCrapVB(null);
hello(null); // prints out "Hello from .NET"
When running this C# it does work:
var WriteCrapCS = edge.func('cs', function () {
/*
async (input) =>
{
return (Func<object,Task<object>>)(async (i) => {
Console.WriteLine("Hello from .NET");
return null;
});
}
*/
});
var hello = WriteCrapCS(null, true);
hello(null, true); // prints out "Hello from .NET"
I have basically tried to use this guide to create this project.
I've tried various things to fix this bug, each as unhelpful as the previous one. I'm hoping someone with greater .NET knowledge than I can point out a glaringly obvious mistake!
Please help this poor soul from going bald from hair tearing!

facepalm
Root namespace must be blank.

Related

ZXing crash in MaterDetailPage

I have a Xamarin Forms project with a lateral menu using the MasterDetailPage. In iOS all works OK, but in Android the app crash when I push the ZXingScanner. However, when I use it from a 'Main Page' works ok too.
ZXingScannerPage pagina = new ZXingScannerPage();
pagina.OnScanResult += (result) =>
{
try {
pagina.IsScanning = false;
Device.BeginInvokeOnMainThread(async() =>
{
var code = result.Text;
await App.Current.MainPage.Navigation.PopModalAsync();
await App.Current.MainPage.DisplayAlert("Scanned", code, "OK);
});
} catch (Exception ex) {
Debug.WriteLine("Error " + ex.Message);
}
};
await App.Current.MainPage.Navigation.PushAsync(pagina);
Is there any way to fix this?
The same issue happened to me. Please check this
link. Make sure that there are no unwanted NuGet packages installed in your solution. Also make sure that you are using the stable version of packages. If the issue is persisting even after this, I suggest you to create the same project from the scratch. It solved my issue.

RDotNet function to add two user defined inputs giving errors

I wrote the following controller function in an ASP.NET MVC5 application to return the sum of 2 user defined inputs using the R function sum(). This compiles successfully but does not give any output.
It is giving 500 (Internal Server Error) since the ajax function is failing.
Can anyone please tell me where I am making mistake?
public JsonResult Sum(int? Text1,int? Text2)
{
REngine.SetEnvironmentVariables(); //
REngine engine = REngine.GetInstance();
return Json(engine.Evaluate("function(Text1,Text2)
{sum(Text1,Text2)}").AsFunction(), JsonRequestBehavior.AllowGet);
}
I have solved the problem myself. The correct code snippet for the controller function is as follows:
var mySum = engine.Evaluate("function(x,y){return (x+y)}").AsFunction();
var v = engine.CreateInteger(Text1);
var u = engine.CreateInteger(Text2);
var sum1 = mySum.Invoke(new SymbolicExpression[] { u, v }).AsInteger();
return Json(sum1, JsonRequestBehavior.AllowGet); }
Since many of you messaged me asking for a sample code for the rdotnet application, I have published an example code with explanation on my blog:
wordpress.com/post/pheonix116s.wordpress.com/169
I hope you all may find it useful.

load fixtures phpunit test for a dummy

thanks to take a look here. I am starting get involved in a project and I need to create the tests for the code I've written. I have not too much experience with tests.
I've written this file:
tests/fixtures/visitante_boletin.yml
1:
id_localizacion: 60
email: emailconfirmado#server.net
estado_confirmacion: 1
fecha_creacion: 2013-02-03 12:01:49
fecha_confirmacion: 2013-02-03 12:01:49
fecha_cancelacion:
token: 343fbb5f15709935470ba3b7524068af8544776d924b0bd45c2558a7eb5c8082f0bef31402b773fa
and this test:
tests/libraries/com/arteinformado/service/front/SuscribeServiceTest.php
...
const SINCONFIRMAR = 0;
const CONFIRMADO = 1;
const CANCELADO = 2;
...
public function testShouldGetAllSuscriptionsWithStateCONFIRMADO() {
$suscriptors = $this->_suscribeService->getAllSuscriptionsWithState(self::CONFIRMADO);
$this->assertNotEmpty($suscriptors);
$this->assertEquals(1, count($suscriptors));
}
...
When I run the test I get an error at the assertNotEmpty, so I don't know if fixture data are being loaded or what's going on, since the method it is testing it is quite simple and should be ok.
public function getAllSuscriptionsWithState($estado_confirmacion) {
$suscriptors = array();
$query = $this->db->get_where('visitante_boletin', array('estado_confirmacion' => $estado_confirmacion));
foreach ($query->result() as $row) {
$suscriptor = $this->_dbRowToVisitanteBoletin($row);
array_push($suscriptors, $suscriptor);
}
return $suscriptors;
}
Any help guide will be really appreciate.
Thanks in advance. Cheers,
ยท_-
The PHPUnit-documentation is your friend.
You didn't mention it, but have you:
installed the DbUnit-extension
let your test-classes extend PHPUnit_Extensions_Database_TestCase
provided your test-classes with a getConnection()- and getDataSet()-method
That definitely is working for me.

JSHint and "Tolerate Variable Shadowing"

Does anybody know why this code does not produce errors in JSHint?
I think it should give me a variable shadowing warning but I'm not getting one.
I have "Tolerate Variable shadowing" as false am using the visual studio plugin.
RES.test = function () {
var test, f;
f = function () {
var test;
window.alert(test);
};
};
Thanks.
I just stumbled onto this too. Apparently JSHint developers' definition of "shadowing" is not what you expect. For them, hiding a variable name coming from a closure is not shadowing. And yes, I find it strange too :-)
If you look at their test suite, they mean something like "redefinition", where you do
var a = 1;
...
var a = 2;
look at their test case: https://github.com/jshint/jshint/blob/master/tests/stable/unit/fixtures/redef.js

Is it possible to find the function and/or line number that caused an error in ActionScript 3.0 without using debug mode?

I'm currently trying to implement an automated bug reporter for a Flex application, and would like to return error messages to a server along with the function/line number that caused the error. Essentially, I'm trying to get the getStackTrace() information without going into debug mode, because most users of the app aren't likely to have the debug version of flash player.
My current method is using the UncaughtErrorEvent handler to catch errors that occur within the app, but the error message only returns the type of error that has occurred, and not the location (which means it's useless). I have tried implementing getStackTrace() myself using a function name-grabber such as
private function getFunctionName (callee:Function, parent:Object):String {
for each ( var m:XML in describeType(parent)..method) {
if ( this[m.#name] == callee) return m.#name;
}
return "private function!";
}
but that will only work because of arguments.callee, and so won't go through multiple levels of function calls (it would never get above my error event listener).
So! Anyone have any ideas on how to get informative error messages through the global
error event handler?
EDIT: There seems to be some misunderstanding. I'm explicitly avoiding getStackTrace() because it returns 'null' when not in debug mode. Any solution that uses this function is what I'm specifically trying to avoid.
Just noticed the part about "I don't want to use debug." Well, that's not an option, as the non-debug version of Flash does not have any concept of a stack trace at all. Sucks, don't it?
Not relevant but still cool.
The rest is just for with the debug player.
This is part of my personal debug class (strangely enough, it is added to every single project I work on). It returns a String which represents the index in the stack passed -- class and method name. Once you have those, line number is trivial.
/**
* Returns the function name of whatever called this function (and whatever called that)...
*/
public static function getCaller( index:int = 0 ):String
{
try
{
throw new Error('pass');
}
catch (e:Error)
{
var arr:Array = String(e.getStackTrace()).split("\t");
var value:String = arr[3 + index];
// This pattern matches a standard function.
var re:RegExp = /^at (.*?)\/(.*?)\(\)/ ;
var owner:Array = re.exec(value);
try
{
var cref:Array = owner[1].split('::');
return cref[ 1 ] + "." + owner[2];
}
catch( e:Error )
{
try
{
re = /^at (.*?)\(\)/; // constructor.
owner = re.exec(value);
var tmp:Array = owner[1].split('::');
var cName:String = tmp.join('.');
return cName;
}
catch( error:Error )
{
}
}
}
return "No caller could be found.";
}
As a side note: this is not set up properly to handle an event model -- sometimes events present themselves as either not having callers or as some very weird alternate syntax.
You don't have to throw an error to get the stack trace.
var myError:Error = new Error();
var theStack:String = myError.getStackTrace();
good reference on the Error class
[EDIT]
Nope after reading my own reference getStackTrace() is only available in debug versions of the flash player.
So it looks like you are stuck with what you are doing now.

Resources