Anchor how to unpack account data with trdelnik - anchor

In Anchor with a trdelnik test I am trying to unpack a retrieved account and check with an eq! if account state is updated accordingly. Can anyone help me with achieving this?
let account_state = fixture
.client
.get_account(fixture.auction_account.pubkey())
.await?
.unwrap();

A way of doing it in an unchecked way.
let account_state = solana_sdk::borsh::try_from_slice_unchecked::<Auction>(account_state.data.borrow());

Related

Display the name of a user using Firebase

What I want to do is to make a top header in the app with the name of the user displayed in a label. I know everything to do this except how to reference their name. To give more clarity this is what I want (even though this doesn't work in the newest version of xcode);
let userName = Auth.auth().currentUser.name
// so this is the string of the users name
I know this seems really simple and there is probably an easy way to do it that I'm not sure of. Thanks for the help!
This is how I access my firebase realtime database and read from it:
let ref = Database.database().reference()
ref.child("Username").observeSingleEvent(of: .value) {(snapshot:DataSnapshot) in
let userName = snapshot.value as? String
Print(userName)
}
Instead of where I put "Username", you can replace this with the name of the node under which the value you want to output is stored. And if this node is the child node of another, you can continue to add .child("XXX") to the line of code.
e.g.
ref.child("Account").child("Username").observeSingleEvent(of: .value) {(snapshot:DataSnapshot) in
It's tucked away a little, in providerData, which is an instance of UserInfo...
let user = Auth.auth().currentUser
let userName = user.providerData.displayName

Process Maker default tables

I am new to process maker.while I am exploring the process maker I got an employee on boarding process.while understanding the process I understood the dynaforms but I faced problem with trigger forms. In trigger forms they mentioned tables to get data but i didn't find the tables in my work space. Please let me know if anyone know the answer.
Thanks.
##hrUser = ##USER_LOGGED;
//Get image
$sqlSdocument = "SELECT *
FROM APP_DOCUMENT D, CONTENT C
WHERE APP_UID = '".##APPLICATION."'
AND D.APP_DOC_UID = C.CON_ID
AND C.CON_CATEGORY = 'APP_DOC_FILENAME'
ORDER BY APP_DOC_CREATE_DATE DESC";
$resSdocument = executeQuery($sqlSdocument);
$dirDocument = $resSdocument[1]['APP_DOC_UID'];
$httpServer = (isset($_SERVER['HTTPS'])) ? 'https://' : 'http://';
##linkImage =
$httpServer.$_SERVER['HTTP_HOST']."/sys".SYS_SYS."/".SYS_LANG."/".SYS_SKIN."
/cases/cases_ShowDocument?a=".$dirDocument;
Judging by the your code, you want to query the uploaded file but base on the commend, you want to get the image?
Well if employee onboarding is what you want, I am guessing that you uploaded the picture on the first dynaform and you want it to be shown. Well this is your luck because ProcessMaker Documentation already have that
If you want a code that let you see the image immediately after upload, you might want to signup for a enterprise trial and test their Employee Onboarding.

Documentdb ReadDocumentAsync doesn't work

I have the following F# code attempting to get a user document from my documentdb database and it doesn't work. Is anyone else experiencing problems using the ReadDocumentAsync method? I am able to successfully to query my user documents with the CreateDocumentQuery method. Any help is greatly appreciated. I use my database and collection ids in place of the empty strings in the code snippet
let getUserDatabaseModel (documentClient : DocumentClient) originiatorId =
async {
let databaseId = ""
let collectionId = ""
let documentUri = UriFactory.CreateDocumentUri(databaseId, collectionId, originiatorId)
let! userDatabaseModel =
documentClient.ReadDocumentAsync(documentUri)
|> Async.AwaitTask
return userDatabaseModel
}
|> Async.RunSynchronously
Update
If I use the _rid instead of the id I get the data back. To clarify the ReadDocumentAsync seems to work using the _rid but throws the error below when using the id.
mscorlib: Exception has been thrown by the target of an invocation.
FSharp.Core: One or more errors occurred. Microsoft.Azure.Documents.Client:
The value 'left blank intentionally' specified for
query '$resolveFor' is invalid
I posted a while back on the documentdb github issues page, problems I was having with ReplaceDocumentAsync.
https://github.com/Azure/azure-documentdb-dotnet/issues/113
I wasn't too concerned about the fix because there was UpsertDocumentAsync. This issue seems to be related, or maybe their relation is just me! not being able to figure out what I'm doing wrong.
CreateDocumentUri needs consistent ids, either all ids or all _rids for the database, collection, and document

databaseRef Firebase withoud childByAutoID()

Guten Tag,
i'm uploading some text to firebase through my iOS Application, but i can't find a code, where i can give the App User not a random ID, but maybe the email for the id to upload or Name. I hope you understand what i mean.
Current Code:
let logininit : [String : AnyObject] = ["text4" : text4!, "text5" : text5!, "text6" : text6!]
let databaseRef = FIRDatabase.database().reference()
databaseRef.child("Logins").childByAutoId().setValue(logininit)
Now i want to remove this childByAutoID, and set it to, how i said, email or name of the user.
Firebase Database
EDIT
Resolved this Problem: databaseRef.child("Logins").child(The Email That You Want Here).setValue(logininit)
I think I understood what you meant, but I don't see reasons for you to do that. Usually when you have a new entry on some entity, you usually gives it a unique ID (UUID). So, I think if you use child(The Email That You Want Here), should work as you want:
databaseRef.child("Logins").child(The Email That You Want Here).setValue(logininit)

Not able to add test cases to type of IRequirementTestSuite

I have created a test case workitem using TFS API.When i am trying to the test case to IStaticTestSuite it was successfull.
if (firstMatchingSuite.TestSuiteType == TestSuiteType.StaticTestSuite)
((IStaticTestSuite)firstMatchingSuite).Entries.Add(testCase);
But i am not able to add a test case to IRequirementTestSuite using the below code.I get "Cannot add or remove test cases" error.
if (firstMatchingSuite.TestSuiteType == TestSuiteType.RequirementTestSuite)
((IRequirementTestSuite)firstMatchingSuite).TestCases.Add(testCase);
Any suggestions ?
Yes.
The only way I found is via the TFS API as such (Using only what you wrote you have):
var store = ((IRequirementTestSuite)firstMatchingSuite).Project.WitProject.Store;
var tfsRequirement = store.GetWorkItem(((IRequirementTestSuite)firstMatchingSuite).RequirementId);
tfsRequirement.Links.Add(new RelatedLink(store.WorkItemLinkTypes.LinkTypeEnds["Tested By"], testCase.WorkItem.Id));
tfsRequirement.Save();
((IRequirementTestSuite)firstMatchingSuite).Repopulate();
It works, I checked!
Enjoy :)

Resources