I've been searching for a few hours for a solution for my problems. But I've downloaded Cosmos (operating system) using visual studio 2015 community edition. At first I downloaded the userkit, then realized that I wanted the devkit (maybe). All the examples I see online are using this:
using Cosmos.Compiler.Builder;
But that isn't working for me. ( I did change the properties to use the 3.5 framework, i read that I must use that and now it's not finding Cosmos anywhere. Before when I was using framework 4.5 I could use cosmos, but only Cosmos.System and one other. Any ideas on what I'm doing wrong?
This is what I'm getting in Kernel.cs when I first start a cosmos project:
using System;
using System.Colletions.Generic;
using System.Text;
using Sys = Cosmos.System;
namespace CosmosKernel1
{
public class Kernel : Sys.Kernel
{
protected override void BeforeRun()
{
Console.WriteLine("Cosmos booted successfully. Type a line of text to get it echoed back.");
}
protected override void Run()
{
Console.Write("Input: ");
var input = Console.ReadLine();
Console.Write("Text type: ");
Console.WriteLine(input);
}
}
}
First make sure that you have a COSMOS PROJECT and not a typical c# console app or something.
Second, after confirming that, make sure you have cosmos.compiler and all the cosmos dlls in your references.
Tutorial: https://www.youtube.com/watch?v=oKW3BrclAUY
Related
I'm trying to establish connection to Azure DataExplorer cluster using C# ..
I referenced the C# in https://learn.microsoft.com/en-us/azure/kusto/api/netfx/about-kusto-data
and installed nuget package kusto.data in visual studio and copied the code and did dotnet run in cmd prompt, but it didn't work.
Below is my code-
using Microsoft.Azure.Management.Kusto;
using System;
namespace LensDashboradOptimization
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
//var clusterUrl = "https://masvaas.kusto.windows.net";
//var kcsb = new Kusto.Data.KustoConnectionStringBuilder(clusterUrl);
//Console.WriteLine(kcsb);
// Read the first row from reader -- it's 0'th column is the count of records in MyTable
// Don't forget to dispose of reader when done.
var client = Kusto.Data.Net.Client.KustoClientFactory.CreateCslQueryProvider("https://masvaas.windows.net/Samples;Fed=true");
var reader = client.ExecuteQuery("MyTable | count");
Console.WriteLine(reader);
}
}
}
I tried both fed=true and WithAadUserPromptAuthentication(); both didn't work. Am I missing something?
Hello and welcome to Stack Overflow!
I tried and faced a similar error when I was checking this out. But the issue turned out to be with the version of .Net Framework that I was running. The Kusto.Data package requires .Net Framework 4.6.2 as a dependency. When I had that installed, I was able to install and import the package, and also subsequently connect to the intended Kusto cluster and read data. This is the snippet that worked for me:
using System;
using Kusto.Data;
namespace hello_world
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
var client = Kusto.Data.Net.Client.KustoClientFactory.CreateCslQueryProvider("https://help.kusto.windows.net/Samples;Fed=true");
var reader = client.ExecuteQuery("StormEvents | sort by StartTime desc | take 10");
}
}
}
Please double check on the dependencies and let me know if you still run into issues. Hope this helps!
using Kusto.Data;
using Kusto.Data.Common;
using Kusto.Data.Net.Client;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
Only these using statement do the job that you are trying to. For that all you need to install SDK from nuget gallery .
Also, only install Microsoft.Azure.Kusto.Data and Microsoft.Azure.Management.Kusto from above. That is sufficient.
Hope this help.
Few more things you can look on as: 1) Static IP 2)VS 2019 community edition with Azure dev packages installed
WithAadUserPromptAuthentication, this method is not supported now as kusto database first need authentication for the user. and the console application is not able to open a prompt window. I recommend to use a web application.
I am trying to communicate with my chatbot via a Windows Form App (using C#). I have installed the SDK into Visual Studio, but I am having trouble using it. I have read through all the documentation, including on GitHub, however, because this is my first time using the SDK, I am quite confused about how to get it to work. At this point, I simply want to be able to send a "Message" and read the chatbot's response.
Which namespaces do I have to include (i.e. "using IBM.Watson...")? Because I have tried authenticating but am getting the error: "namespace AssistantService could not be found", as per the IAM authentication in dotnet guide on GitHub. Also, what is an "_assistant" object and how to I create one, the docs don't explain this so I keep getting the error "_assistant does not exist in the current context..."
This is the link that to the SDK I am following: https://github.com/watson-developer-cloud/dotnet-standard-sdk
I am trying to authenticate with the instructions at that link but am not succeeding. I am trying to use these instructions to call the Watson Assistant: https://github.com/watson-developer-cloud/dotnet-standard-sdk/tree/development/src/IBM.WatsonDeveloperCloud.Assistant.v1
****************UPDATE*****************
using System.Windows.Forms;
using IBM.WatsonDeveloperCloud.Assistant.v1.Model;
using IBM.WatsonDeveloperCloud.Assistant.v1;
using IBM.WatsonDeveloperCloud.Util;
namespace Watson_Assistant_Test
{
public partial class Form1 : Form
{
AssistantService _assistant;
string[] _questionArray = { "Hello there" };
public Form1()
{
TokenOptions iamAssistantTokenOptions = new TokenOptions()
{
IamApiKey = "Y....H",
IamUrl = "https://gateway-syd.watsonplatform.net/assistant/api"
};
_assistant = new AssistantService(iamAssistantTokenOptions, "2018-07-10");
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
MessageRequest messageRequest = new MessageRequest()
{
Input = new InputData()
{
Text = _questionArray[0]
}
};
var result = _assistant.Message("d...5", messageRequest);
label1.Text = result.ResponseJson.ToString();
}
}
}
I think I am still not creating the AssistantObject correctly. I am getting this error: ServiceResponseException: The API query failed with status code NotFound: Not Found.
Thanks, Harry
[I am not a C# developer and have not used that SDK, but... :)]
There is a small sample as part of the SDK that works with the car dashboard example. Because of the renaming of Watson Conversation to Watson Assistant it is still using the old object names (both work).
The code uses this namespace:
using IBM.WatsonDeveloperCloud.Assistant.v1.Model
Based on the code itself it checks for the following parts of TokenOptions:
IamApiKey
IamAccessToken
ServiceUrl
My guess is that you have to rename IamUrl to ServiceUrl in your code.
I am just getting started with EF Core and Net Core in general an ran into a problem I could not find any answers for.
I am working on a console application that uses a SQLite database for storage. I am testing things right now and working with the context works fine. My example program below runs fine. Note that I did use migrations to create the database initially.
Now eventually when I finish this App I want to make sure that the database exists. As read in other posts this should be done with ctx.Database.Migrate(). I cannot access this method yet however. So my question is what do I have to do to access it? Am I missing a package that adds an extension method? Do I need to configure more things?
Please excuse this very basic question but I could not find anything regarding this. So if I just don't know where to look I would also be glad about a reading recommendation.
using System;
using MyLog.NetCore.Models;
using MyLog.NetCore.DataAccess;
namespace MyLog.NetCore
{
internal class Program
{
#region Private Methods
private static void Main(string[] args)
{
using (var ctx = new MyLogContext())
{
ctx.Add(new PartialLogEntry { PartialLogEntryID = 1, StartDateTime = 1, Title = "Test" });
var count = ctx.SaveChanges();
Console.WriteLine($"{count} changes saved to database!");
Console.WriteLine();
Console.WriteLine("All partial lof entries in database:");
foreach (var entry in ctx.PartialLogEntries)
{
Console.WriteLine($"ID: {entry.PartialLogEntryID}\tStart: {entry.StartDateTime}\tTitle: {entry.Title}");
}
}
Console.ReadLine();
}
#endregion Private Methods
}
}
Many EF Core methods are implemented as extension methods. So to make them available, this first thing you need is:
using Microsoft.EntityFrameworkCore;
This particular method is defined in RelationalDatabaseFacadeExtensions residing in the Microsoft.EntityFrameworkCore.Relational assembly, so make sure you are referencing it.
I'm a beginner of C# and blockchain.
I'm studying blockchain with "Programming The Blockchain in C#".
I tried to run this source code following the book:
using NBitcoin;
using QBitNinja.Client;
using QBitNinja.Client.Models;
namespace NBitcoinTest1
{
class Program
{
static void Main(string[] args)
{
// Create a client
QBitNinjaClient client = new QBitNinjaClient(Network.Main);
// Parse transaction id to NBitcoin.uint256 so the client can eat it
var transactionId = uint256.Parse("f13dc48fb035bbf0a6e989a26b3ecb57b84f85e0836e777d6edf60d87a4a2d94");
// Query the transaction
GetTransactionResponse transactionResponse = client.GetTransaction(transactionId).Result;
}
}
}
But it doesn't work because of exception.
It says "Method 'System.Net.Logging.get_On' not found.", so I tried to find "System.Net.Logging", but I couldn't find any package named "System.Net.Logging" in nuget.org.
How can I solve this problem?
Environment: macOS Sierra 10.12.6, Visual Studio for Mac[Community] 7.2(Build 636)
Your problem relies in the conflicting types of NBitcoin dependencies, as you installed NBitcoin first then installed QBitNinja which is installed with NBitcoin also and to my surprise a more up to date version! So delete the first dependency version which was v3. Everything should work then, don't worry i've only started to read it yesterday myself :) It is a community built book so i can expect some errors.
So i have simple application, just a few lines:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Microsoft.DirectX.DirectInput;
namespace asdasd
{
public partial class Form1 : Form
{
public Device joystick;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
foreach (
DeviceInstance di in
Manager.GetDevices(
DeviceClass.GameControl,
EnumDevicesFlags.AttachedOnly))
{
joystick = new Device(di.InstanceGuid);
break;
}
if (joystick == null)
{
throw new Exception("No joystick found.");
}
}
}
}
and i try to get the active joystick on my computer, but i get error:
i have the assembly Microsoft.DirectX.DirectInput and i have directX SDK 2010 installed.
Can someone tell me where is the problem?
Try adding this to the config file:
http://devonenote.com/2010/08/mixed-mode-assembly-error-after-upgrading-to-dotnet-4-0/
(if configuration already exists, just merge these in)
And, maybe it's not the right place, but just take a look at XNA... Things are usually much easier with that.
I couldn't paste the XML directly here, it doesn't show up.
The DirectX assemblies are built against .NET v1.1 Microsoft stopped actively developing them before .NET v2.0 was released.
They cannot be used in projects targeting other than .NET v1.1. XNA is the "blessed" path forward for managed access to Direct X features. I don't know all if it's features, but SlimDX appears to give a more Direct X feeling API for C# than XNA, though I have not used it, I've heard a lot about it.
You might find better responses for chosing an upgrade path over at gamedev.stackexchange.com though.