By this :
http://msdn.microsoft.com/en-us/library/dd489442.aspx
but the only diffenet that I make the workflow using a XAML file.
I have a qution: i need to pass the value that I got from the user to another activity.
I tried to make a variable (output for example )and assiged the value, but the another activity see it like empty. may its dead or reset to the default value after the current activity finishs.
I tried to use OutArgument, but it make runtime error at app.run as the following
"The following errors were encountered while processing the workflow tree:
'workflow1': The private implementation of activity '1: workflow1' has the following validation error: Value for a required activity argument 'Out_arg' was not supplied."
And also didn't see it in the next activity like the first case.
[RequiredArgument]
public OutArgument<string> Out_arg { get; set; }
void OnBookmarkCallback(NativeActivityContext context, Bookmark bookmark, object val)
{
Console.WriteLine("im in resume ");
Console.WriteLine("bookmark1 Name is {0}", (string)val);
// for the first option that i tried
output = (string)val;
//then i tried
Out_arg.Set(context, (string)val);
the xmal file:
False
270,2.5
60,75
300,77.5 300,107.5 300,129.5
194.5,129.5
211,61
300,190.5 300,220.5 300,279
200,279
200,22
300,301 300,331 280,331 280,389.5
174.5,389.5
211,61
_ReferenceID0
_ReferenceID1
__ReferenceID2
Can u help me?
Did you create variable in you workflow and assign the Out_arg to it?
Related
Is there any environment variable or something how to change the maxVarCharLength like tablePrefix in JobRepositoryFactoryBean.java?
I couldn't find any config class where this setter method is called
public void setMaxVarCharLength(int maxVarCharLength) {
this.maxVarCharLength = maxVarCharLength;
}
It is up to you to call this method in order to set the maxVarCharLength property. The JobRepositoryFactoryBean will then use the value you set to create the JobRepository. You can find an example here: https://docs.spring.io/spring-batch/4.0.x/reference/html/job.html#configuringJobRepository
I want to store an initial value when an object is loaded in a private property. If I change the value later on I want to be able to compare the initial and the current value. I can't find a suitable event for capturing the initial value. Should be just after loading the object... OnAfterCreate does not do the trick..
I could propably also use the PropertyChanged event but I am not sure how to implement it..
It was OnAfterReadRecord indeed. Thanks Simon!
protected void OnAfterReadRecord(System.Data.IDataReader reader,
CodeFluent.Runtime.CodeFluentReloadOptions options)
{
_initialActive = CodeFluentPersistence.GetReaderValue(reader, "CwObject_Active",
((bool)(false)));
}
I am new to Laravel.
I have a controller method which retrieves data from request, creates a model instance
and saves it to database.
It then redirects to controller with a value (user name)
return redirect()->action('SignupController#confirm' , $username);
Route for confirm is :
Route::get('confirm/{user}' , 'SignupController#confirm');
In 'confirm' method i retrieved value from variable and passed it to view
public function confirm($username)
{
return view('auth.confirm')->with('username' , $username);
}
Confirm view present a form to confirm account and upon succesful submission post to route :
Route::post('confirm' , 'SignupController#confirmCode');
In 'confirmCode' i want to access that value which i actully fetched from user input
and passed down the line.
But i am unable to do it , i even tried post route with a wild card
Route::post('confirm/{user}' , 'SignupController#confirmCode');
and tried to access it similarly as before , but it is not passed along when form submits as i get nothing when i
tried to look for it using var_dump($username).
Error is :
Missing argument 1 for App\Http\Controllers\SignupController::confirmCode()
By the way, temporarily i am using hidden field to do the job which is not a good idea obviously.
I know i am missing something. Looking forward for some advice. Thanks in advance.
You can simply use Session::flash or if it's more than one redirect then you can use Session::put.
use Session; // at the top between class and namespace
public function confirm($username)
{
Session::flash('username', $username);
// Session::put('username',$username);
return view('auth.confirm')->with('username' , $username);
}
public function confirmCode() {
dd(Session::get('username'));
}
I am new to WF 4.5.
The "GenerateResult" activity will generate a string in the Result property.
I want to assign the Result to the varExternal in the following Assign activity.
How to?
The GeneratedResult activity is defined as below.
public sealed class GenerateResult<TResult> : NativeActivity<TResult>
{
protected override void Execute(NativeActivityContext context)
{
this.Result.Set(context, "Hello, world!");
}
}
Just like you'd do it when programming. You have to hold the result within a variable, then reference that variable elsewhere.
I'm assuming you want to use the result in the WriteLine activity, so you would create a variable within the workflow (look at the bottom of the designer), bind it to the Result property of your GenerateResult activity (it's in the Property grid, so right-click and hit Properties). Then you can reference that variable in the WriteLine activity.
I'm trying to do this with mongodbauthmanager. I'm follow step by step in Usage section but finally i'm getting PHP warning: Illegal offset type. I had posted this question at Yii Extension before clone to SO:
Please tell me what is wrong?
1// Config
'authManager'=>array(
'class' =>'CMongoDbAuthManager',
'showErrors' => true,
),
2// Create auth items in db
$auth = new CMongoDbAuthManager();
$bizRule = 'return Yii::app()->user->id==$params["User"]->_id;';
$auth->createTask('updateSelf', 'update own information', $bizRule);
//I had tried with $auth->createOperation() but they has the same error
$role = $auth->createRole('user');
$role->addChild('updateSelf');
$auth->save();
and here is result in db
result in db http://i.minus.com/iIpXoBlDxaEfo.png
**3// Checking access in controller ** - UPDATE CODE AND ERROR
public function actionUpdate($id)
{
$model=$this->loadModel($id);
$params = array('User'=>$model);
if (!Yii::app()->user->checkAccess('updateSelf', Yii::app()->user->id,$params) )
{
throw new CHttpException(403, 'You are not authorized to perform this action');
}
//another statement ...
}
4// Getting error:
Fatal error : Cannot use object of type MongoId as array in F:\Data\03. Lab\www\yii\framework\web\auth\CAuthManager.php(150) : eval()'d code on line 1
RESOLVED PROBLEM
Base-on the answer of #Willem Renzema, I resolve my problem. Now, I update here and hope it useful for someone have this error.
0// First, config authManager with defaultRoles
'authManager'=>array(
'class'=>'CMongoDbAuthManager',
'showErrors' => true,
'defaultRoles'=> array('user'),//important, this line help we don't need assign role for every user manually
),
1// Fix save id in UserIdentity class
class UserIdentity extends CUserIdentity
{
private $_id;
//...
public function authenticate()
{
//...
$this->_id = (string)$user->_id;//force $this save _id by string, not MongoId object
//...
}
//...
}
2// Fix $bizrule in authe items
($bizrule will run by eval() in checkAccess)
//use _id as string, not MongoId object
$bizRule = 'return Yii::app()->user->id==(string)$params["User"]->_id;';
3// And user checkAccess to authorization
public function actionUpdate($id){
/**
* #var User $model
*/
$model=$this->loadModel($id);
$params = array('User'=>$model);
if (!Yii::app()->user->checkAccess('updateSelf', $params) )
{
throw new CHttpException(403, 'You are not authorized to perform this action');
}
//...
}
4// Done, now we can use checkAccess :D
First off, your original use of checkAccess was correct. Using Yii::app()->user->checkAccess() you are using the following definition:
http://www.yiiframework.com/doc/api/1.1/CWebUser#checkAccess-detail
Now, CWebUser's implementation of checkAccess calls CPHPAuthManager's implementation, which is where you encountered your problem with an illegal offset type.
http://www.yiiframework.com/doc/api/1.1/CPhpAuthManager#checkAccess-detail
An Illegal offset type means you are attempting to access an array element by specifying its key (also known as: offset) with a value that doesn't work as a key. This could be another array, an object, null, or possibly something else.
Your stack trace posted on the extensions page reveals that the following line gives the problem:
if(isset($this->_assignments[$userId][$itemName]))
So we have two possibilities for the illegal offset: $userId and $itemName.
Since $itemName is clearly a string, the problem must be with $userId.
(As a side note, the fact that your stack trace revealed surrounding code of this error also revealed that, at least for CPHPAuthManager, you are using a version of Yii that is prior to 1.1.11. Observe that lines 73 and 74 of https://github.com/yiisoft/yii/blob/1.1.11/framework/web/auth/CPhpAuthManager.php do not exist in your file's code.)
At this point I would have guessed that the problem is that the specified user is not logged in, and so Yii::app()->user->id is returning null. However, the new error you encountered when placing Yii::app()->user->id as the 2nd parameter of checkAccess reveals something else.
Since the 2nd parameter is in fact what should be the $params array that appears in your bizRule. Based on the error message, this means that Yii::app()->user->id is returning a mondoId type object.
I was unfamiliar with this type of object, so looked it up:
http://php.net/manual/en/class.mongoid.php
Long story short, you need to force Yii::app()->user->id to return the string value equivalent of this mondoId object. This likely set in your UserIdentity class in the components folder. To force it to be a string, simply place (string) to force a type conversion.
Example:
$this->_id = (string)$User->_id;
Your exact code will vary, based on what is in your UserIdentity class.
Then, restore your checkAccess to the signature you had before, and it should eliminate the Illegal offset error you encountered originally.
Note however that I have not used this extension, and while performing the following actions should fix this issue, it may cause new issues if the extension relies on the fact that Yii::app()->user->id is a mondoId object, and not a string.