How to change function parameter and run it with near cli? - nearprotocol

Currently, I learn near with the project "helloworld-demo-assembly". I deploy and use contract successfully but when I add a new parameter to the function helloWorld and run it with near cli, it does not change.

I solve the problem. Whenever i change function, i need to call deploy.script again and it will apply the change.

When you send a parameter to function, this means it will change state. That's why you have to use call instead of view.
Use near call $CONTRACT helloWorld '{"name": "hehe"}'

Related

'NCD.L1.sample--Communite' couldn't addNewComplaint() due to invalid characters for account ID

The repo is here:
https://github.com/Learn-NEAR/NCD.L1.sample--Communite
As I was testing the app I was trying to add a complaint entry, but the --account-id seem to have a problem. I have also tried --account_id and --accountId but none of that worked so far.
Did I miss anything? Looking forward to your help.
Target contract you are trying to call is not specified in the command. Check the arguments:
❯ near call
near call <contractName> <methodName> [args]
schedule smart contract call which can modify state
first argument after call is the name of the contract you are trying to call,
second argument is the name of the method on that contract to be called,
third argument is the payload.
--accountId is used to specify the signer of the txs.
So basically, from the README on the screenshot you are missing the field <your deployed contract>.

Laravel - OutputStyle from jobs

I'm running into issues with allowing a Laravel job to interact with the console output.
At the moment I am passing in the OutputStyle from a Command to the Job constructor and assigning it.
I have seen the InteractsWithIO trait but if I use that by itself without assigning the OutputStyle from the command then it says it is null.
Call to a member function title() on null
I have also tried setting $this->output from the container using
$this->output = resolve(OutputStyle::class);
This fails with a
Target [Symfony\Component\Console\Input\InputInterface] is not instantiable while building [Illuminate\Console\OutputStyle].
I've also ran into issues with PHPUnit tests that run through this job. The output from the class is displayed in the test output.
.......................Processing element 1 for "Section"
.......
What's the best way to handle outputting to the console within Laravel that also works with PHPUnit?
Putting the following code in a Service Provider works:
$this->app->bind('console.output', function () {
return new OutputStyle(
new StringInput(''),
new StreamOutput(fopen('php://stdout', 'w'))
);
});
I am then able to say, in my Job,
$this->output = resolve('console.output');
Which gives access to all the methods such as title, section, and table.

Laravel: How to run a Library in background (Process component)

I'm trying to create a program which generates event dates for the whole year. The program works if the user select few events but if the user select 100+ events and assigned them every week it reaches the Maximum execution time error.
In order to fix this, my idea is to run the program in the background.
I'm using Laravel 5.4, running the script below will call the function
$process = new Process('php -f '.$path.' generate_evnt_prepared ' . $content['evntid']);
$process->run();
Function Script
namespace App\Library\shellexec;
use App\Model\V1\EvntPlanDtl;
use App\Model\V1\EvntPlanDtlPrePo;
use Carbon\Carbon;
class RoutePlan {
//put your code here
public function process($method = null, $param = 0)
{
$this->$method($param);
}
I'm pretty sure that the function is called as I'm getting an error in error_logs that the Models are not found
PHP Fatal error: Class 'App\Model\V1\EvntPlanDtl' not found in C:\xampp\htdocs\rdmsoffice\app\Library\shellexec\EventPlan.php on line 30
PHP Stack trace:
PHP 1. {main}() C:\xampp\htdocs\rdmsoffice\app\Library\shellexec\EventPlan.php:0
PHP 2. App\Library\shellexec\EventPlan->process() C:\xampp\htdocs\rdmsoffice\app\Library\shellexec\EventPlan.php:88
PHP 3. App\Library\shellexec\EventPlan->generate_evnt_prepared ()
Anyone knows how to fix this? I'm open to suggestions if this is the wrong way.
Big thanks!
Sounds like a more scalable way is to create a "chunked" version and fire them into a queue for processing. For example, based off some assumptions about the example you provided, I might suggest one firing one queued message for each Event the user selects.
That adds some overhead to manage, but honestly I've always found it's more effective to take some of that cost up front and do it right, rather than finding workarounds like increasing settings or (shudder) shelling out to sub processes.

adding arguments to a function call in llvm

After having a look at the API in llvm::CallInst , I don't see a
simple way to add any arguments to a function call that has already been generated.
Apart from creating a new function call , is there any other way to add
arguments ?
Thanks!

QTP Run Error:Type does not match

Here is a sniplet of the QTP code :
Call CreateResultFile("E:\2012MX\Result\test_d\")
And the error is:
The test run cannot continue due to unrecoverable error. Type does not
match:'CreateResultFile'
What am I doing wrong?
This is the error you would get if CreateResultFile wasn't defined, are you sure such a function exists?
1) Somewhere CreateResultFile is declared as an variable, array or as an class/object. It cann't be called, but has to be used as an object of that type.
-or-
2) You did not use Option Explicit in your script (An Unforgivable Sin: each time you run a script without option explicit, somewhere on Earth a puppy dies). QTP sees undefined functions automagically as undeclared variables and complains with "Type mismatch" as explained in 1.
It could be you did not associate the library (vbs or qfl file) with the CreateResultFile function as a resource to the action you are working in.

Resources