Get console output in Mercurial.Net - c#

I am trying to do commit and push using Mercurial.Net library:
var repo = new Repository(repositoryPath);
var branchCommand = new BranchCommand { Name = branch };
repo.Branch(branchCommand);
var commitCommand = new CommitCommand { Message = commitMessage, OverrideAuthor = author };
repo.Commit(commitCommand);
var pushCommand = new PushCommand { AllowCreatingNewBranch = true, Force = true, };
repo.Push(pushCommand);
On repo.Push(pushCommand) it throws an exception Mercurial.MercurialExecutionException with message 'abort: Access is denied'.
The question is: Is there any way in Mercurial.Net to get the output of mercurial console?

The message you're receiving appears to be a message the remote is printing. It looks like you haven't set up auth properly — or you've authenticated correctly, but on the remote side you haven't got correct access rights.

Related

HL7 Validator PlanDefinition failed:

I had to upgrade Hl7.Fhir.STU3 and Hl7.Fhir.Specification.STU3 library and now I am getting error message that it can't resolution PlanDefinition profile.
I can see within the debugger that the specification.zip is being Extracted
Extracted to 'C:\Users\dev\AppData\Local\Temp\FhirArtifactCache-1.2.1-Hl7.Fhir.STU3.Specification\specification'}
Why will this not finding PlanDefinition?
{"Overall result: FAILURE (1 errors and 0 warnings)\r\n\r\n[ERROR] Resolution of profile at 'http://hl7.org/fhir/StructureDefinition/PlanDefinition' failed: Cannot prepare ZipSource: file 'D:\\Users\\mcdevitt\\Documents\\Visual Studio 2015\\FHIRValidatorFile\\FHIRValidatorFile\\FHIRValidatorFile\\bin\\Debug\\CustomProfiles' was not found (at PlanDefinition)"}
var HL7obj = new FhirXmlParser().Parse<PlanDefinition>(HL7FileData);
var coreSource = ZipSource.CreateValidationSource();
var cachedResolver = new CachedResolver(
new DirectorySource(CustomProfilesPath, includeSubdirectories: true));
var combinedSource = new MultiResolver(cachedResolver, coreSource);
var ctx = new ValidationSettings()
{
ResourceResolver = combinedSource,
GenerateSnapshot = true,
Trace = false,
EnableXsdValidation = true,
ResolveExteralReferences = false
};
var HL7validator = new Validator(ctx);
var result = HL7validator.Validate(HL7obj);
This error comes from the ZipSource not being able to find a zipped file at the listed path. Instead of the path to a folder, please indicate the zipfile that you want to use as source.
From the 'coreSource' name, I assume that you want to point to the base FHIR specification. Instead of supplying your own zipfile for that, you can change it to this line:
var coreSource = ZipSource.CreateValidationSource();
The library will locate the specification.zip that comes with it, and will then be able to use it for validation against the core spec.

VMware vCenter API with C# - InitiateFileTransferToGuest fails

I'm trying to use the InitiateFileTransferToGuest method to send a file to a VM. Unfortunately, I'm getting stuck. Here's the related code where VClient is the VimClient with an already successfull connection:
GuestOperationsManager VMOpsManager = new GuestOperationsManager(VClient, VClient.ServiceContent.GuestOperationsManager);
GuestFileManager VMFileManager = new GuestFileManager(VClient, VClient.ServiceContent.FileManager);
GuestAuthManager VMAuthManager = new GuestAuthManager(VClient, VClient.ServiceContent.AuthorizationManager);
NamePasswordAuthentication Auth = new NamePasswordAuthentication()
{
Username = "username",
Password = "password",
InteractiveSession = false
};
VMAuthManager.ValidateCredentialsInGuest(CurrentVM.MoRef, Auth);
System.IO.FileInfo FileToTransfer = new System.IO.FileInfo("C:\\userlist.txt");
GuestFileAttributes GFA = new GuestFileAttributes()
{
AccessTime = FileToTransfer.LastAccessTimeUtc,
ModificationTime = FileToTransfer.LastWriteTimeUtc
};
string TransferOutput = VMFileManager.InitiateFileTransferToGuest(CurrentVM.MoRef, Auth, "C:\\userlist.txt", GFA, FileToTransfer.Length, false);
First error shows up when getting to the ValidateCredentialsInGuest method. I get this message:
An unhandled exception of type 'VMware.Vim.VimException' occurred in VMware.Vim.dll Additional information: The request refers to an unexpected or unknown type.
If I remove that validation, I get the same error when trying to run InitiateFileTransferToGuest. I've been browsing the API documentation, and threads in VMware forums and a lot of places to be honest. The only pieces of code I've seen posted where it works were in Java and Perl, but the API implementation is a little different than C#. Any idea where to look?
Thank you!
I made it work after testing and making up stuff. I guessed the MoRef for both AuthManager and FileManager doing the following:
ManagedObjectReference MoRefFileManager = new ManagedObjectReference("guestOperationsFileManager");
GuestFileManager VMFileManager = new GuestFileManager(VClient, MoRefFileManager);
ManagedObjectReference MoRefAuthManager = new ManagedObjectReference("guestOperationsAuthManager");
GuestAuthManager VMAuthManager = new GuestAuthManager(VClient, MoRefAuthManager);
Now it's working, and I have no idea how.

Connect to affiliatewindow

I try to connect to affiliatewindow, (http://v3.core.com.productserve.com/ProductServeService.wsdl) to get categories but when i try to connect i get this: "Additional information: Authentication Failed"
I have this:
var A = new ApiService
{
UserAuthenticationValue = new UserAuthentication {sApiKey = "xxxxx"}
};
var r = new getCategoryTree {iCategoryId = 0};
var result = A.getCategoryTree(r);
But when i contact the affiliatewindow support, they tell me that they dont know how to do in .NET. They say something about API_USERNAME, API_PASSWORD and API_KEY. But where should i put this?
So, how can i connect to affiliatewindow?
UPDATE: I used the wrong APiKey.

AWS Elastic Transcoder Endpoint cannot be resolved

I'm working on a project that requires video to be transcoded and thumbnails extracted through use of AWS Elastic Transcoder. I have followed the api to the best of my abilities and have what seems to me correct code. However, I still get an error with NameResolutionFailure thrown and an inner exception saying that The remote name could not be resolved: 'elastictranscoder.us-west-2.amazonaws.com'My code is:
var transcoder =
new AmazonElasticTranscoderClient(Constants.AmazonS3AccessKey,
Constants.AmazonS3SecretKey, RegionEndpoint.USWest2);
var ji = new JobInput
{
AspectRatio = "auto",
Container = "mov",
FrameRate = "auto",
Interlaced = "auto",
Resolution = "auto",
Key = filename
};
var output = new CreateJobOutput
{
ThumbnailPattern = filename + "_{count}",
Rotate = "auto",
PresetId = "1351620000001-000010",
Key = filename + "_enc.mp4"
};
var createJob = new CreateJobRequest
{
Input = ji,
Output = output,
PipelineId = "1413517673900-39qstm"
};
transcoder.CreateJob(createJob);
I have my s3 buckets configure in Oregon and added policies to make the files public.
Apparently my virtual machine was not connecting to the internet, which is why the nameresolutionfailure was thrown. Everything is fine now.

Exception thrown when uploading image ads to AdWords

I have the following code, whose point is to try to interface with Google AdWords. I want to upload some image ads to Adwords.
var operations = new List<AdGroupAdOperation>();
foreach (var generatedAd in generatedAds)
{
// create a new image to put in the imageAd
var image = new Image
{
data = generatedAd.Image.FileData,
type = MediaMediaType.IMAGE
};
// create a new image ad
var imageAd = new ImageAd
{
image = image,
name = generatedAd.Image.FileName,
displayUrl = Config.Get("DisplayURL"),
url = generatedAd.Ad.Url
};
var imageAdGroupAd = new AdGroupAd
{
ad = imageAd,
adGroupId = (long)generatedAd.Ad.AdwordsAdGroupId,
};
// prepare to add the new image ad to the ad words group
var operation = new AdGroupAdOperation
{
#operator = Operator.ADD,
operand = imageAdGroupAd
};
operations.Add(operation);
}
try
{
((AdGroupAdService)user.GetService(AdWordsService.v201406.AdGroupAdService))
.mutate(operations.ToArray());
}
However, running this code results in an exception being thrown. The main exception message is 'The underlying connection was closed: An unexpected error occurred on a send.', and the inner exception message is 'An existing connection was forcibly closed by the remote host.'. Have these errors come up before in AdWords? Is there a particular way to handle them?
Can anyone suggest anything at all? I have Googled and come up with some general addvice for these issues but nothing that seems to work for my particular case.
Thanks,
Conor

Categories