I'm trying to use the Stanford NLP tools ported to IKVM, but it gives me unhandeled exception.
here's the code I'm using
`string StanfordModelsDirectory = "englishPCFG.ser.gz";
try
{
LexicalizedParser LP = LexicalizedParser.loadModel(StanfordModelsDirectory);
TreebankLanguagePack tlp = new PennTreebankLanguagePack();
GrammaticalStructureFactory gsf = tlp.grammaticalStructureFactory();
Tree parse = LP.apply("what's the largest city in canada?");
parse.pennPrint();
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}`
I've referenced IKVM.OpenJDK.Core and stanford-parser, but the message
"Could not load file or assembly 'IKVM.OpenJDK.Core, Version=7.1.4532.2, Culture=neutral, PublicKeyToken=13235d27fcbfff58' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)" appears.
I'm using windows 8 (visual studio 2012, .NET 4.5)
IKVM is compiled for .NET 2.0. You need to add a config file to your application to map to a different .NET version like 4.5.
IKVM 7.2.x contains such config file for ikvm.exe, ikvmc.exe, .....
Related
I have NOT used newtonsoft.json in our Blazor PWA WASM project.
I recently updated to .Net7 from .Net6 and I now notice in the NuGet-manager that there is a "System.Text.Json" package available for inclusion in my VS-2022 project.
The existing code shows json is part of these using-statements in the client-side REST-API-services that are part of the repository-pattern in this PWA project:
using System.Net.Http;
using System.Net.Http.Json;
My questions are...Q1 - "should I" download this NuGet package?
Q2 - How will I reference it in my using-statements and POST/PUT/GET service-code.
Your answers and comments are welcome. Thanks...John D.
This following code is typical for the CRUD C# code used in the client-project.
public async Task<Vehicle> AddVehicle(Vehicle pVehicle) {
// Insert the new record.
HttpResponseMessage response = await httpClient.PostAsJsonAsync<Vehicle>($"/api/vehicle", pVehicle);
return await response.Content.ReadFromJsonAsync<Vehicle>();
}
I am working to run/execute SSIS package from my application developed in MVC 5.
The package is developed using Visual studio 2017 data tools.
I have written the following code to run the package
try
{
Application app = new Application();
Package package = null;
package = app.LoadPackage(#"C:\Users\EMISDb\Desktop\NEOC\EOC data need\NEOC_ETL\NEOC_ETL\99_Dash_WHO.dtsx", null);
//Excute Package
Microsoft.SqlServer.Dts.Runtime.DTSExecResult results = package.Execute();
if (results == Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure)
{
foreach (Microsoft.SqlServer.Dts.Runtime.DtsError local_DtsError in package.Errors)
{
Console.WriteLine("Package Execution results: {0}", local_DtsError.Description.ToString());
Console.WriteLine();
}
}
}
catch (DtsException ex)
{
throw;
}
but when i run, it gives the following error message. I tried to find 64 bit but could not find to install. Any help please.
**Retrieving the COM class factory for component with CLSID {4F0FC44B-C99C-441D-B86A-D60D7E22143D} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).**
and
**An Integration Services class cannot be found. Make sure that Integration Services is correctly installed on the computer that is running the application. Also, make sure that the 64-bit version of Integration Services is installed if you are running a 64-bit application.** '
I am trying to set up an ASP.Net Core application to read in configuration settings from a json file. I am using VS2015 and .NetCore 1.0 (with .Net Core Tools preview 2). I am having problems getting a simple piece of boiler plate code to compile.
I am using the following code, which was published at
http://asp.net-hacker.rocks/2016/03/21/configure-aspnetcore.html
public Startup(IHostingEnvironment env)
{
// Set up configuration sources.
var builder = new ConfigurationBuilder()
.AddJsonFile("appsettings.json")
.AddEnvironmentVariables();
if (env.IsDevelopment())
{
// This will push telemetry data through Application Insights
// pipeline faster, allowing you to view results immediately.
builder.AddApplicationInsightsSettings(developerMode: true);
}
Configuration = builder.Build();
}
However, the IDE/compiler complains that 'the name "Configuration" does not exist in the current context' (last line of code). The only suggestion from the IDE is to include Microsoft.Extensions.Configuration. However this is a namespace which does not contain an object or property named "Configuration".
In addition 'AddApplicationInsightsSettings' fails with does IConfigurationBuilder not contain a definition for AddApplicationInsightsSettings and no extension method AddApplicationInsightsSettings accepting a first argument of type IConfigurationBuilder could be found
Any suggestions please ?
Thanks
Simply add Configuration property to your Startup class, tutorial has missed this 'step':
public IConfigurationRoot Configuration { get; set; }
ConfigurationBuilder.Build() method just returns instance of IConfigurationRoot, that you should save, if need to get settings further in Startup class (in ConfigureServices method for example).
Regarding second error, looks like you didn't add the Application Insights dependency:
{
"dependencies": {
"Microsoft.ApplicationInsights.AspNetCore": "1.0.0"
}
}
i want to retrieve tweets from twitter using specific hashtags.
i am using tweetinvi for this purpose.but i am getting an error
outer exception:
The type initializer for 'Tweetinvi.TwitterCredentials' threw an exception.
Inner exception:
{"Could not load file or assembly 'System.Core, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes' or one of its dependencies. The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047)":"System.Core, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes"}
i am using autofac 3.4.
kindly point out what am i doing wrong?
TwitterCredentials.SetCredentials("useraccesstoken",
"useraccessecret",
"consumerKey",
"consumerSecret");
var searchParameterSearch.GenerateTweetSearchParameter("#pakvsSA");
searchParameter.SetGeoCode(-122.398720, 37.781157, 1,DistanceMeasure.Miles);
searchParameter.Lang = Language.English;
searchParameter.SearchType = SearchResultType.Popular;
searchParameter.MaximumNumberOfResults = 100;
searchParameter.Until = new DateTime(2015, 12, 3);
searchParameter.SinceId = 399616835892781056;
searchParameter.MaxId = 405001488843284480;
var tweets = Search.SearchTweets(searchParameter);
So it looks like there are some .dll required by Tweetinvi (Sytem.Core) that are missing.
I would strongly advise using nuget to install Tweetinvi as a package as it will automatically install and reference all required dll.
https://www.nuget.org/packages/TweetinviAPI/
I'm trying to implement a database in my Windows 8.1 Modern UI application.
I made this for a Windows Phone 8.1 app successfully, but it doesn't work in a new Windows 8.1 app.
I got a SQLiteException with message Could not open database file: MyAppBase.db (CannotOpen) when i instanciate SQLiteConnection
public static DatabaseHelper Instance
{
get
{
if (_instance == null)
{
_instance = new DatabaseHelper();
}
return _instance;
}
}
public DatabaseHelper()
{
_connection = new SQLiteConnection(DATABASE_NAME);
_connection.CreateTable<UserEntity>();
}
I follow this steps :
Added 'sqlite-net' to Nuget reference, Checked 'SQLite for Windows Runtime (Windows 8.1)' and 'Microsoft Visual C++ 2013 Runtime Package for Windows' on project references, Targetted build to x86.
How can i get this working ?
SQLite needs a path to create a DB not just a db name
try something like this
string path = Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path, DATABASE_NAME);
_connection = new SQLite.SQLiteConnection(path)
Hope this helps
Use
string path = Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path, databasePath);