I posted a request for a Freebase API C# .Net example a few months ago. But there appears to be a bug in the client library and I don’t see if being fixed in the near future. You can see the original post here. Google Freebase Api C# .Net Example
And the bug report here. http://code.google.com/p/google-api-dotnet-client/issues/detail?id=193
My question is there another way to get a .Net service to connect and pull information from Freebase? If so can someone point me in the right direction, An example of some kind would really help. There is very little information out there on using the .Net Google Freebase API.
Thanks for the help.
Isn't it simplier just to use HttpWebRequest and parse the answer as JSON?
I ended with choosing this option when I developed my app, and it took about several hours to write a liveable adapter.
I don't know if it solves your particular problem, but Microsoft recently released their own Freebase API for .NET that you could try out. They also published a number of usage samples. The folks at FSharpx even wrapped it up into a NuGet package.
Of course, you'll need to use F#, because C# and VB don't have the features this API is based on. But that's an added bonus when you consider how much nicer F# is.
I coped with the same problem. And decidd to write my own client as i did not see any good enough that could fit my requirements. You can get it here:
https://freebase4net.codeplex.com/
or
Execute this line "Install-Package Freebase4net" in Package Manager Console
Code sample of usage:
var readService = FreebaseServices.CreateMqlReadService();
dynamic thepolice = new ExpandoObject();
thepolice.type = "/music/artist";
thepolice.name = FreebaseHelpers.Operators.CreateLikeOperator("^The Sco*$"); // Regex search
MqlReadServiceResponse result = await readService.ReadAsync(thepolice);
//Process result
var content = result.ResultAsString;
//get status
var status = result.Status;
More advanced samples of usage you can find here:
https://freebase4net.codeplex.com/documentation
Related
I would like get query execution time in response. I'm using OrientDB 3.0 with official driver https://github.com/orientechnologies/OrientDB-NET.binary for .NET.
How can I do that?
c# together with .net core is not supported, they stopped.
When I studied the project, I was happy. When I looked for support and saw all the issues, wrong links, scattered groups... I decided to go for neo4j.
I think OrientDb is good, but the documentation and links sucks.
I downloaded https://github.com/orientechnologies/OrientDB.Net and it works except I had to change something. I could connect but if you look at:
throw new NotImplementedException(); then my pants went off.
In OrientDBBinaryConnectionStream replace
if (ConnectionMetaData.ProtocolVersion < 27)
ConnectionMetaData.UseTokenBasedSession = false;
with
ConnectionMetaData.UseTokenBasedSession = true
Success with this unfinished business and keep me informed
I am specifically trying to replicate a few lines of code, but cannot seem to find the equivalent in .net core. Any help in replacing would be appreciated, or at least some direction in where to look. I did try looking into Kerberos.NET but it didn't seem to have this kind of functionality.
System.IdentityModel.Tokens.KerberosRequestorSecurityToken Ticket = null;
try
{
Ticket = new System.IdentityModel.Tokens.KerberosRequestorSecurityToken(UserSPN);
}
So, I came across a blog post published the day I posted this question and I've been messing around with it. It does effectively replace the System.IdentityModel.Tokens.KerberosRequestorSecurityToken class. The blog is from Harmj0y, who effectively wrote PowerView and helped write Sharphound. My next step is trying to replace the interop features, since the .dll files referenced won't be available on *nix type systems. That may end up being another question. The blogs link is below.
http://www.harmj0y.net/blog/redteaming/kerberoasting-revisited/
I am currently building an application in C# that makes use of the AWS SDK for uploading files to S3.
However, I have some users who are getting the "Request time too skewed" error when the application tries to upload a file.
I understand the problem is that the user's clock is out of sync, however, it is difficult to expect a user to change this, so I was wondering, is there any way to get this error not to occur (any .NET functionality to get accurate time with NTP or the alike?)
Below the current code I am using to upload files.
var _s3Config = new AmazonS3Config { ServiceURL = "https://s3-eu-west-1.amazonaws.com" };
var _awsCredentials = new SessionAWSCredentials(credentials.AccessKeyId, credentials.SecretAccessKey, credentials.SessionToken);
var s3Client = new AmazonS3Client(_awsCredentials, _s3Config);
var putRequest = new PutObjectRequest
{
BucketName = "my.bucket.name",
Key = "/path/to/file.txt",
FilePath = "/path/to/local/file.txt"
};
putRequest.StreamTransferProgress += OnUploadProgress;
var response = await s3Client.PutObjectAsync(putRequest);
Getting the time from a timeserver is actually the easier part of your challenge. There is no built-in C# functionality that I'm aware of to get an accurate time from a time server, but a quick search yields plenty of sample code for NTP clients. I found a good comprehensive sample at dotnet-snippets.com (probably overkill for your case), and a very streamlined version on Stack Overflow in a page titled "How to Query an NTP Server using C#?". The latter looks like it might be effective in your case, since all you need is a reasonably accurate idea of the current time.
Now on to the real challenge: using that time with Amazon S3. First, some background, as it's important to understand why this is happening. The time skew restriction is intended to protect against replay attacks, as noted here:
http://docs.aws.amazon.com/AmazonS3/latest/API/sig-v4-authenticating-requests.html
Because of this, Amazon built the current timestamp into the authentication signature used in the AWS SDK when constructing the HTTP(S) request. However, the SDK always uses the current time (there's no way to override it in the SDK methods):
https://github.com/aws/aws-sdk-net/blob/master/AWSSDK_DotNet35/Amazon.Runtime/Internal/Auth/AWS3Signer.cs#L119
Note that in all cases, the SDK uses AWSSDKUtils.FormattedCurrentTimestampRFC822 as the timestamp, and there's no way for the caller to pass a different value into the method.
So this leaves you with two options that I can see:
Bypass the Amazon SDK and construct your own HTTP requests using the time you retrieve from an NTP server. This is doable but not easy. Amazon discourages this approach because the SDK provides a lot of helpful wrappers to ensure that you're using the API as a whole correctly, handling a lot of the tedious message processing that you have to do yourself if you go straight HTTP. It also helps with a lot of the error handling and ensuring that things get cleaned up properly if a transfer is interrupted.
Clone the Amazon SDK git repository and create your own fork with a modification to allow you to pass in the current time. This would also be difficult, as you'd have to work out a way to pass the time down through several layers of API objects. And you'd lose the benefit of being able to easily update to a new SDK when one is available.
Sorry there's no easy answer for you, but I hope this helps.
If you're asking this question you have probably taken AWS as far as you can go with the provided code sample.
I have found most of the async upload functionality provided by AWS to be more theoretical, or better suited for limited use cases, instead of being production ready for the mainstream- especially end users with all those browsers and operating systems:)
I would recommend rethinking the design of your program: create your own C# upload turnstile and keep the AWS SDK upload functions running as a background process (or sysadmin function) so that AWS servers are handling only your server's time.
Okay guys, here's the deal. I'm a total C# beginner but I've been advised to learn it. I'm desperate to get a working Bitcoin value grabber going - so that I can record the values to a text file. Another thing is that the value must be from MtGox, either their API or their homepage.
I've spent a while dealing with HTTP requests and JSON decoding (grrr...) but I don't see the point in me spending so much time on my learning code when I'm sure there is someone else out there who can just help me to write it.
Does anyone think they might be able to help with this? Just a couple of lines to pull the last Bitcoin value from MtGox.
Any contributions are much appreciated.
Will.
EDIT:
var json = WebClient.DownloadString("http://data.mtgox.com/api/2/BTCUSD/money/ticker_fast");
string valueOriginal = Convert.ToString(json);
That is all I needed to write. Wow. Thanks for the help though, Oliver.
This is a Q&A site, so don't expect other's to write your code for you.
You can access their API using any language that supports HTTP calls.
Here's a great document to get you started:
MtGOX api docs
This is a judgement call, but it sounds like you're new to programming in general. Don't commit yourself to a language. Always use the best tool for the job. I'd suggest using something a bit more "web friendly" for this sort of work. NodeJS would make this much easier for you as it understands the JSON returned from their API nativly, without using all sorts of wrappers and instances of the WebClient class or HttpResponseMessages as you do in .NET. Also consider the purpose of writing the data to a text file. What is going to consume that data? It's possible that you can skip the file and just interact with the down-level consumer directally.
What format needs to be in the data file? If you can save it in JSON, you could do this in C#
using System.Net;
//...
WebClient Client = new WebClient ();
Client.DownloadFile("https://mtgox.com/api/1/BTCUSD/ticker", #"C:\folder\results.json");
What is the best way to read entries programatically from Blogger using .NET/C#?
GData has a Blogger API. There is a C# library that can be downloaded. This is an official library from Google. I've used it in the past (though in PHP). The documentation is a bit light, but the code works very well.
The documentation is absolutely atrocious. It literally has zero pertinent information for anything valuable. Your best bet is to get your FeedQuery and then step through in debugger. Once in the debugger you can see all entities and pick out the ones you want. If you have any questions, post em here, I've been working with this API for the last two weeks.