[Rails 3.2.8 & ExecJS 1.4.0]Getting syntax errors, but how can I debug - execjs

For example I have the following code:
function f(p) {
for(var i=0;i<1;i++)
{
p=unescape(p);
}
return p;
}
var c='something';
When I past it in the firebug console it returns undefined. That's fine by now
When I try to run it with ExecJS. ExecJS returns:
ExecJS::RuntimeError: SyntaxError: Unexpected token var
I can't get a clue where to start searching for the problem. Does anyone has an idea?

Related

Can get script compiled with CSharpScript (Roslyn)

I'm trying to get a script compiled with Roslyn but whatever I do it keeps complaining about this, at this moment I tried almost everything and have no idea what to try next.
This is the error I get :
'(11,7): error CS0246: The type or namespace name '' could not be found (are you missing a using directive or an assembly reference?)'
It is complaining that the namespace can't be found
I already added the references to the file and even added the assemblies to the InteractiveAssemblyLoader but still no luck.
try
{
#if (DEBUG)
var metadataReferences = ApplicationSettings.Instance.GetValuesAsStringList("Script editor", "MetadataReferences_VOP");
#else
var metadataReferences = ApplicationSettings.Instance.GetValuesAsStringList("Script editor", "MetadataReferences");
#endif
var scriptOptions = ScriptOptions.Default.WithEmitDebugInformation(true);
scriptOptions.AddReferences(metadataReferences);
using var assemblyLoader = new InteractiveAssemblyLoader();
foreach(var reference in metadataReferences)
assemblyLoader.RegisterDependency(Assembly.Load(File.ReadAllBytes(reference)));
scriptRunner = CSharpScript
.Create<string>(script, scriptOptions, typeof(MainGlobals), assemblyLoader)
.ContinueWith("new NewEmail().Main(Email)")
.CreateDelegate();
exception = null;
return true;
}
catch (Exception e)
{
exception = e;
scriptRunner = null;
return false;
}
Is there somebody that has an idea about what to try next?
It seems that the AddReferences returns a new scriptOptions object that is the one with the added references :-)
So the solution was easy, just do this
scriptOptions = scriptOptions.AddReferences(metadataReferences);

VivoxCore for Unreal Engine 4

Has anyone used VivoxCore for unreal engine 4 and know what this error means? I'm not able to really understand what this means. I've tried reading through the source code for vivox, as well as the documentation and that error code (1105) is mentioned nowhere. Also, the company which makes this does not respond to emails, and their public forum is not active. I've tried calling them, emailing them, using the public forum, reading online for answers, and I've found nothing, so stackoverflow is my last option. I hope someone here can help me.
LogVivoxVoiceChat: Warning: onConnectFailed server:https://vdx5.www.vivox.com/api2 error:SIP Backend Required (1105)
Here is my code:
VoiceChat = (FVivoxVoiceChat*)FVivoxVoiceChat::Get();
if (!VoiceChat->IsInitialized())
{
GLog->Log("Is not initialized, trying to initialize.");
VoiceChat->Initialize();
return;
}
if (!VoiceChat->IsConnected())
{
GLog->Log("Is not connected, trying to connect.");
VoiceChat->Connect(FOnVoiceChatConnectCompleteDelegate::CreateLambda([](const FVoiceChatResult& Result)
{
}));
return;
}
FString PlayerName = PlayerState->GetPlayerName();
FString LoginToken = VoiceChat->InsecureGetLoginToken(PlayerName);
if (!VoiceChat->IsLoggedIn())
{
GLog->Log("Is not logged in, trying to login.");
VoiceChat->Login(0, PlayerName, LoginToken, FOnVoiceChatLoginCompleteDelegate::CreateLambda([](const FString& LoggedInPlayerName, const FVoiceChatResult& Result)
{
}));
return;
}
FString ChannelName = "TestChannel";
EVoiceChatChannelType ChannelType = EVoiceChatChannelType::Echo; // Echo for testing.
TOptional<FVoiceChatChannel3dProperties> Channel3dProperties;
FString JoinToken = VoiceChat->InsecureGetJoinToken(ChannelName, ChannelType, Channel3dProperties);
VoiceChat->JoinChannel(ChannelName, JoinToken, ChannelType, FOnVoiceChatChannelJoinCompleteDelegate::CreateLambda([](const FString& JoinedChannelName, const FVoiceChatResult& Result)
{
GLog->Log("JOin Channel successful");
}), Channel3dProperties);
VoiceChat->TransmitToSpecificChannel(ChannelName);
This error means that you have an outdated SDK. The SDK included in UE4 is outdated: it is using backend version 4, but the actual version is 5.
Try disabling the Vivox Interface plugin if it's enabled.

Regular Expression - how do I loop through exec results

In the following code the results are getting logged as expected.
I now want to loop through the individual items of the match in a loop but need help. match.split fails because of a null error TIA
var match;
var precedents=[];
while((match=exp.exec(text))) {
Logger.log(match[0]);
}
var matchArray=match.split();
if(matchArray.length>0){
for(i==0; i<matchArray.length;i++){
Logger.log(i);
precedents[i].push(matchArray[i]);
Logger.log(precedents[i]);
}
}

Script compilation failed at line 19 in procedure 'BusComp_PreWriteRecord':

I am getting the following error, when tries to save the following script.
"Script compilation failed at line 19 in procedure 'BusComp_PreWriteRecord':
Syntax error at Line 31 position 59:Expected ')'
(SBL-SCR-00128)"
function BusComp_PreWriteRecord ()
{
var obj = TheApplication().GetBusObject("Service Request");
var optybc = obj.GetBusComp("Service Request");
optybc.ActivateField("SR Type");
//optybc.ActivateField(“Typeâ€);
optybc.SetViewMode(3);
optybc.ClearToQuery();
optybc.SetSearchSpec("SR Type",this.GetFieldV alue("SR Type"));
//optybc.SetSearchSpec(“Typeâ€,this.GetFieldV alue(“Typeâ€));
optybc.ExecuteQuery(ForwardOnly);
if(optybc.FirstRecord())
{
TheApplication().RaiseErrorText("Duplicate Records");
}
}
Does anyone knows the reason for the above error?
It might be that you are missing brackets in code that is "above" PreWriteRecord()
for example these methods
Siebel compiles all event code as one large code, so missing parentheses in other places will create issue in subsequent events.

Odd ColdFusion Behavior--Abort Not Honored

Using ColdFusion 9.01, occasionally, we have observed an issue where an error may be occurring within a CFC function and when we attempt to add writeDump(foo); and abort; calls to debug the error ColdFusion does not honor those calls.
Example:
private void function index(Event)
{
var rc = Event.getCollection();
var prc = Event.getCollection(private=true);
/** NOT HONORED! **/
writeDump(var=rc);
abort;
prc.JSON = {};
prc.JSON.show = variables.APIProxy.call(
handler = 'shows'
,action = 'read'
,event = arguments.Event
/** THE ERROR IS OCCURING HERE **/
,params = { language=lcase(rc.language.getLanguage_Medium()), show=rc.show_name }
);
prc.JSON.showEpisodes = variables.APIProxy.call(
handler = 'episodes'
,action = 'index'
,event = arguments.Event
,params = { language=lcase(rc.language.getLanguage_Medium()), show=rc.show_name, detail=true }
);
prc.JSON.products = variables.APIProxy.call(
handler = 'products'
,action = 'index'
,event = arguments.Event
,params = { language=lcase(rc.language.getLanguage_Medium()), detail=true }
);
Event.addAssets(
'model/product.js
,model/show.js
,collection/product_mobile.js
,collection/show_mobile.js
,view/product_mobile.js
,view/productList.js
,view/show_mobile.js
,view/showList.js
,model/episode.js
,view/episode_mobile.js
,view/episodeList.js
,collection/episode_mobile.js
,collection/product_mobile.js
,mobile/episodeObject.css
,mobile/show.js
,mobile/show.css
,mobile/category.css
');
Event.setLayout('layout.mobile');
Event.setView("show/index_mobile");
return;
}
I believe we have successfully eliminated caching. I am curious if anyone else has encountered this.
Thank you.
Aaron
I'm guessing that the error is a parse error, not a true runtime error, so it gets thrown before the function actually executes. It's not actually skipping over your abort, it just fails to parse (or execute) the entire thing.
I'm not sure why you're getting a parse error there, but I do know the CF code that handles struct literals is somewhat flaky.
The issue was with the struct literals declared within the argument calls to a function.
i'm going to go out on a limb here and say that your issue might have something to do with this bug:
http://cfbugs.adobe.com/cfbugreport/flexbugui/cfbugtracker/main.html#bugId=86960
is there anything in your app that executes in the onRequestEnd() method?
it would be helpful to tell us what exactly is happening and/or the output you're getting when the issue happens.