BitcoinLib usage in c# - c#

So this is maybe dumb but I am using BitcoinLib for c# and I am trying to get to work this line:
IBitcoinService BitcoinService = new BitcoinService("https://localhost:5051/", "aaa" ,"aaa","vvvv", 5);
What I dont know: What to input there. I tried watching videos or documentation but theres anywhere said what website/password/acc and all to input. Then When I know what to input, how can I mine and then send bitcoins to my wallet? I know this is stupid but I really dont understand how to programate it...
What I tried: I have tried reading a documentation, I have tried watching some videos, downloading demo of app and nothing helped me. Either I am dumb or it's complicated.
Btw: I know how mining and bitcoin works (basics)

Configure your Bitcoin Core wallet properly in bitcoin.conf:
rpcuser = MyRpcUsername
rpcpassword = MyRpcPassword
server=1
txindex=1
Then you can just initiate the BitcoinService like that:
IBitcoinService BitcoinService = new BitcoinService();
and it will work; you don't need to explicitly define them inside the code. If you need to change these parameters in runtime you can do so by calling:
(IBitcoinService).Parameters

Related

Cannot Get Windows MR Controllers Unity Input

I tried using the following code from the official Windows documentation but I couldn't get the inputs from the controller.
if (Input.GetButton("Button 14 "))
{
// ...
}
How can I get the inputs from the Mixed Reality controllers?
https://developer.microsoft.com/en-us/windows/mixed-reality/gestures_and_motion_controllers_in_unity details that to get a key but its qualified name you use
if (Input.GetKey("name")) { ... }
For button14 you would use "joystick button 14".
Else try "button 14" since the documentation isn't clear which one will work.
I just googled and had a little research since I don't personally own this set of hardware to test, so I hope it works (otherwise I'll delete answer).

vmware .net api help vmware.vim.dll problems

Vmware's .net api reference is somewhat confusing and hard to follow. I have been able to connect to my vcenter host then get a list of esxi hosts. Then I have been able get all the running modules on the host using HostKernelModuleSystem, and probe the properties on the variable "mod"... but I am not able to figure out how to get license info, I tried creating an object lic below, trying all different kinds of "types" from vmware with the word license in the type. but, it never works it has a problem converting the line with LicenseManagerLicenseInfo lic = .... I always get the following:
"Cannot convert type 'Vmware.Vim.Viewbase' to
'Vmware.Vim.LicenseManagerLicenseInfo'"
but the declaration above it for "mod" works fine.
I have also tried:
HostLicenseConnectInfo
LicenseAssignmentManagerLicenseAssignment
LicenseManager
I am hoping someone who has worked with vmware .net api can shed some light on what i am doing wrong? I am new to C# about 1 year :) but these VMware APIs are somewhat confusing to me.
esxList = client.FindEntityViews(typeof(HostSystem), null, null, null);
foreach (HostSystem host in esxList)
{
HostKernelModuleSystem mod = (HostKernelModuleSystem)client.GetView(host.ConfigManager.KernelModuleSystem, null);
LicenseManagerLicenseInfo lic = (LicenseManagerLicenseInfo)client.GetView(host.ConfigManager.LicenseManager, null);
string name = lic.Name;
}
I'll have to go to work tomorrow to look at this ( don't have ESX and VMWare SDK for .NET at home ) but I've done a bit of this work.
I wrote a generics method that wraps FindEntityViews and takes a filter as an argument. That makes it easy to search for anything. Also I've noticed that searches come back as ManagedObjectReferences and can't be cast to the subclasses. You have to construct them passing the ManagedObjectReference as an argument.
Also I find searching for PowerCLI examples and watching the classes in the immeadiate window very help in navigating this API. It's a fairly decent SDK but they put all of the classes in a single namespace and there's lots of little style inconsistencies ( Device instead of Devices and properties that take strings instead of enums when an enum exists ).
i figured out how to do it :) , by using http://vcenter_hostname/mob I was able to walk through api better. here is what I did, plus instead of of using "host" which was type HostSystem I jused my instance of my vCenter host "client"
VMware.Vim.LicenseManager lic_manager = (VMware.Vim.LicenseManager)client.GetView(client.ServiceContent.LicenseManager, null);
LicenseManagerLicenseInfo[] lic_found = lic_manager.Licenses;
foreach (LicenseManagerLicenseInfo lic in lic_found)
{
string test = lic.Name.ToString();
string test2 = lic.LicenseKey.ToString();
}

How to "embed" YouTube videos when publishing to Fan Page Wall

I'm working on a c# service that publishes updates to a Fan Page using the c# SDK. I have it publishing updates just fine, but some of these are YouTube videos that when publish "manually" would be "embedded" and viewable on the Fan Page itself.
The main part is very straightfoward code that I found here at Stackoverflow:
dynamic messagePost = new System.Dynamic.ExpandoObject();
messagePost.access_token = [access_token];
messagePost.picture = "http://img.youtube.com/vi/abc123/default.jpg";
messagePost.link = "http://www.youtube.com/watch?v=abc123";
messagePost.name = "Test Name";
messagePost.caption = "{*actor*} " + "This is just a test...";
messagePost.description = "This is a test post description.";
All works fine except it is a link to the video instead of it being "embedded". Any guidance? I've searched for several hours now, tried different combinations, all to no avail.
Thanks!
Just goes to show that when the question seems simple, it probably is. So, in case someone else ever needs the answer to this one, I found it once I resumed searching.
Only use the .link and .name attributes. If you don't fill the remainder then the video appears "inline" on FB.
Great resource, sorry to have posted too early.

P4.NET - How to list user's workspaces?

I am not an expert in P4.NET plugin, but I would like to show the existing workspaces for a user in a combo box, so that I can set the p4.Client to the selected workspace.
using (var p4 = new P4Connection())
{
p4.Connect();
???
}
How do I get the list of existing workspaces?
I think the command line to achieve this would be
p4 clients -m 100 -u username
If P4.Net behaves similar to the official Perforce APIs, then you would likely want to run:
p4.Run("clients", "-m 100 -u username")
or similar. Inspired by the P4Ruby documentation.
Ok I have no choice than answering my own question, because the code would be too much to insert as comments to jhwist answer. Sorry jhwist. I had no choice.
#appinger, I hope you find this answer helpful. Took me hours to figure out this api working. :)
cmbBoxPerforceWorkspaceLocation is just your combobox for your workspaces. I am using Winforms by the way.
I need to extract a shortname from the windows username. Windows username starts usually with xxxx\\username. In my code I extract the username out of the longname and save it as shortname. If your network is set differently this code might have to change accordingly.
Let me know if it worked for you.
using (var p4 = new P4Connection())
{
p4.Connect();
var longName = WindowsIdentity.GetCurrent().Name;
var shortname = longName.Substring(longName.IndexOf("\\") + 1);
var records = p4.Run("clients", "-u", shortname);
cmbBoxPerforceWorkspaceLocation.Items.Clear();
foreach (P4Record record in records.Records)
{
cmbBoxPerforceWorkspaceLocation.Items.Add(record["client"]);
}
}
P4.Net is designed to be similar to the scripting APIs, which in turn are designed around the command line interface. It definitely does not have a intuitive object-oriented interface... which is off putting at first. But if you start from the command-line (esp -ztag flag) and piece together all data/actions your app needs, you will find it pretty easy to use P4.Net. And since it's similar to all the scripting APIs, you'll find it natural to pickup Python or Ruby if you wish :-)

How do I get back results running a VB Script from C#?

I want to be able to call VB scripts from C#, which is easy enough, but I need to be able to get back the results from these scripts at times. Should I use the method referenced with something to read back, or should I use a different method? I've found a method to getting data back from powershell scripts using Runspaces and Pipelines, but I don't know enough about this technology to know if it will work with VB scripts as well. Ideally, I'd like to do something similar to the powershell method where I can just pass in the contents of the script without needing to reference an external file and get back the results. Can anyone tell me how to do this? Thanks.
Here's a pretty simple way to do it by listening to an event:
Process vbsProcess = new Process();
vbsProcess.StartInfo.FileName = "yourscript.vbs";
vbsProcess.StartInfo.UseShellExecute = false;
vbsProcess.StartInfo.RedirectStandardOutput = true;
vbsProcess.OutputDataReceived += new DataReceivedEventHandler(YourOutputHandler);
vbsProcess.Start();
vbsProcess.WaitForExit();

Categories