Here's my script for building Programmatically
BuildPlayerOptions szBuildResult = new BuildPlayerOptions();
szBuildResult.scenes = scenes;
szBuildResult.locationPathName = m_szapkFileName;
szBuildResult.target = BuildTarget.StandaloneWindows;
szBuildResult.options = BuildOptions.None;
BuildPipeline.BuildPlayer(szBuildResult);
Now I tried to do something like this
string result = BuildPipeline.BuildPlayer(szBuildResult);
But it's returning me an error saying
Cannot convert type UnityEditor.Build.Reporting.BuildReport to string
How can i check if the build is successful or not?
I'm using Unity 2018.2
BuildPipeline.BuildPlayer will reutrn BuildReport object. so use BuildReport instead of string
BuildReport result = BuildPipeline.BuildPlayer(szBuildResult);
Related
I tried to use Matlab function from my .net project
function [HR] = getHR(signal)
Fs = 200;
index = pan_tompkin(signal,Fs);
index = index(2:end-1);
idx_dur = (index(end) - index(1))/Fs;
idx_cnt = length(index)-1;
idx_int = idx_dur/idx_cnt;
HR = round(60/idx_int);
end
This is my Matlab code
MLApp.MLApp matlab = new MLApp.MLApp();
matlab.Execute(#"cd C:\Users\User\Desktop");
object result = null;
matlab.Feval("getHR", 1, out result,input_Data);
object[] res = result as object[];
tmp_HR = Convert.ToInt32(res[0]);
And this is part of my .net code where calling Matlab function
input_Data is 2000x1 double array
When I run this program, error is occur that "Undefined function 'getHR' for input arguments of type 'double'." on Matlab.Feval line
Someone advised me to 'varargin' to solve this problem, but I can not find the answer(I don't think it is necessary)
How can I revise my code to fix this problem?
I can not use the way to use Matlab compiler SDK or Matlab coder
maybe have to use only MLApp to solve this problem
I try to make Visual Studio Extension. It will be extension for debug. It will work at debug mode. I need get object instance from debugged application in my extension. And I do not know how to do it.
I have follow code:
var dte = (DTE)_serviceProvider.GetService(typeof(DTE));
var debugger = dte?.Debugger;
var currentMode = debugger?.CurrentMode;
if (currentMode != dbgDebugMode.dbgBreakMode) return;
var expression = debugger.GetExpression(myExpression);
myExpression contains expression for retrieve some object, for example IDbConnection.
How can I get IDbConnection in my extension-code? expression.Value has string-value.
Is that even possible?
I have a Running Python code doing simple logistic regression. I create a pb file using the following statement in Python
tf.train.write_graph(sess.graph_def, '.','logistic-sigmoid-cpm-model.pb', False)
I then load it from C# using Tensorflowsharp.
var model = File.ReadAllBytes("logistic-sigmoid-cpm-model.pb");
graph.Import(model, "");
using (var session = new TFSession(graph))
{
var x = LoadCsv("dataX.csv", 1);
var y = LoadCsv("dataY1.csv", 0);
var runner = session.GetRunner();
runner.AddInput(graph["x"][0], x).AddInput(graph["y"][0], y).Fetch(graph["pred"][0]);
var output = runner.Run();
I got the following Error message
TensorFlow.TFException
HResult=0x80131500
Message=Attempting to use uninitialized value Variable
[[Node: Variable/read = Identity[T=DT_FLOAT, _class=["loc:#Variable"], _device="/job:localhost/replica:0/task:0/device:CPU:0"](Variable)]]
Source=TensorFlowSharp
StackTrace:
at TensorFlow.TFStatus.CheckMaybeRaise(TFStatus incomingStatus, Boolean last)
at TensorFlow.TFSession.Run(TFOutput[] inputs, TFTensor[] inputValues, TFOutput[] outputs, TFOperation[] targetOpers, TFBuffer runMetadata, TFBuffer runOptions, TFStatus status)
at TensorFlow.TFSession.Runner.Run(TFStatus status)
at ConsoleApp2.Program.Main(String[] args) in C:\Users\Shuo-jen\source\repos\ConsoleApp2\ConsoleApp2\Program.cs:line 35
Is the model missing something? Or I need to add some code?
I have a bootstrap script which runs with my EMR job.
I need to pass a parameter to this script so I can configure a path for different environments
The following line in my script needs to use it
path=OVA/{EnvironmentName}/Scripts/UniqueUsers
I am using C# to invoke a streaming EMR job. how do I pass this argument while I create the job?
HadoopJarStepConfig config = new StreamingStep()
.WithInputs(input)
.WithOutput(output)
.WithMapper(configMapperLocation)
.WithReducer(configReducerLocation)
.ToHadoopJarStepConfig();
string configName = string.Format("Unique_Users_config_{0}", outputFolder);
StepConfig uniqueUsersDaily = new StepConfig()
.WithName(configName)
.WithActionOnFailure("TERMINATE_JOB_FLOW")
.WithHadoopJarStep(config);
ScriptBootstrapActionConfig bootstrapActionScript = new ScriptBootstrapActionConfig()
.WithPath(configBootStrapScriptLocation);
BootstrapActionConfig bootstrapAction = new BootstrapActionConfig()
.WithName("CustomAction")
.WithScriptBootstrapAction(bootstrapActionScript);
string jobName = string.Format("Unique_User_DailyJob_{0}", outputFolder);
RunJobFlowRequest jobRequest = new RunJobFlowRequest()
.WithName(jobName)
.WithBootstrapActions(bootstrapAction)
.WithSteps(uniqueUsersDaily)
.WithLogUri(configHadoopLogLocation)
.WithInstances(new JobFlowInstancesConfig()
.WithHadoopVersion(configHadoopVersion)
.WithInstanceCount(2)
.WithKeepJobFlowAliveWhenNoSteps(false)
.WithMasterInstanceType(configMasterInstanceType)
.WithSlaveInstanceType(configSlaveInstanceType));
You can use withArgs() of ScriptBootstrapActionConfig, in Java you can do as follows, I am sure there is a similar method for C#:
ScriptBootstrapActionConfig bootstrapActionScript = new ScriptBootstrapActionConfig()
.WithPath(configBootStrapScriptLocation)
.WithArgs(List<String> args);
I have this working:
Microsoft.JScript.Vsa.VsaEngine engine = Microsoft.JScript.Vsa.VsaEngine.CreateEngine();
string js = "15+10";
var result = Microsoft.JScript.Eval.JScriptEvaluate(js, engine);
Now I want to pass some objects from C#. Is it possible?
Any help appreciated.