Why is GetRequestToken not working? - c#

I have the following little snippet that won't compile:
using TweetSharp.Twitter.Fluent;
//...
var twitter = FluentTwitter.CreateRequest();
twitter.Authentication.GetRequestToken("...", "...");
...and it gives me the following error:
Main.cs(12,12): Error CS1061: Type `TweetSharp.Twitter.Fluent.
IFluentTwitterAuthentication' does not contain a definition for `GetRequestToken'
and no extension method `GetRequestToken' of type TweetSharp.Twitter.Fluent.
IFluentTwitterAuthentication' could be found (are you missing a using directive
or an assembly reference?) (CS1061) (StackBot)
Which is strange because according to TweetSharp's website, that's supposed to be valid code.
Am I forgetting something or is there some other assembly I need to reference?
I'm using Mono 2.4 on Ubuntu 10.10 64-bit.
I may have found a clue here. Using the assembly browser, I have discovered that IFluentTwitterAuthentication has the following definition:
public abstract interface IFluentTwitterAuthentication : IFluentAuthentication
{
// Properties
public abstract IFluentTwitter Root { get; }
}
...which leads me to believe that something is not quite right with the assembly.

Their code seems to be:
var twitter = FluentTwitter.CreateRequest ()
.Authentication.GetRequestToken("...", "...");
which is quite different than yours:
var twitter = FluentTwitter.CreateRequest();
twitter.Authentication.GetRequestToken("...", "...");

Your USING statements may be missing...Try this:
using TweetSharp.Twitter.Fluent;
using TweetSharp.Twitter.Model;
using TweetSharp.Twitter.Extensions;
//...
var twitter = FluentTwitter.CreateRequest();
twitter.Authentication.GetRequestToken("...", "...");

Related

In C#, I am getting an error when requesting permission for speech recognition Xamarin Android

So I am using the Plugin.SpeechRecognition Nuget Package and following the exact code on line and its not working.
I have tried adding the "Plugin.Permissions" Nuget Package and that hasn't helped and i have tried googling the problem but there isn't anyone getting this issue and it seems to work fine for everyone. I have also tried removing the "await" keyword and it just says
Operator '==' cannot be applied to operands of type 'IObservable' and 'bool'
Here is my code:
private async void GetSpeechPermission()
{
var granted = await CrossSpeechRecognition.Current.RequestPermission();
if (granted == true)
{
// go!
}
}
so what should happen is there is no error what so ever and the code should run fine but the line of code
await CrossSpeechRecognition.Current.RequestPermission();
has a red underline saying
IObservable' does not contain a definition for 'GetAwaiter' and no extension method 'GetAwaiter' accepting a first argument of type 'IObservable' could be found (are you missing a using directive or an assembly reference?)
when I am using the EXACT code provided by the creator of the plugin from here https://github.com/aritchie/speechrecognition
Any help is MUCH appreciated!!
The Solution to this was to add
using System.Reactive.Linq
in the using section of the code and instead of using a bool value as the code example for the plugin suggests, instead, in the if statement, convert the "granted" variable to a string and then check for "Available", Code:
private async void GetSpeechPermission()
{
var granted = await CrossSpeechRecognition.Current.RequestPermission();
if (granted.ToString() == "Available")
{
//GO
}
}
Hope this helps some one! :D

Error "The type or namespace name 'IUCompositionService' could not be found..." while using Catel.Extensions.Prizm

I try to use Catel.Extensions.Prism in my WPF MVVM Catel application developed in MS VS 2015 Professional. But when I use IUCompositionService interface then the following error has place: "The type or namespace name 'IUCompositionService' could not be found (are you missing a using directive or an assembly reference?)". I've installed the last stable version of Catel.Extensions.Prism via NuGet in my project and add to MainWindowViewModel class the following code:
using Catel.Extensions.Prism;
// This is command method realizing switch to specified View.
private void ShowCalibrationViewExecute()
{
var ViewModel = new CalibrationViewModel(); // ViewModel for specified View.
var dependencyResolver = this.GetDependencyResolver();
var uiCompositionService = dependencyResolver.Resolve<IUCompositionService>(); // Error!
. . . . . . .
}
And in the line
var uiCompositionService = dependencyResolver.Resolve<IUCompositionService>();
I have the error: "The type or namespace name 'IUCompositionService' could not be found (are you missing a using directive or an assembly reference?)". Why this error has place? What I've done wrong? Please help me to correct this error.
It's IUICompositionService (you are missing an I after the U).

Nopcommerce inherit code from de nop core controller

I'm trying to develop a plugin in nopcommerce. To do this I want to replace some of the core code out of nopcommerce.
I tried to inherit it via:
public class TryingNewProjectController : BasePluginController, Nop.Web.Controllers.CatalogController
{
///// CODE /////
}
Can someone tell me what I'm doing wrong ?
Error:
The type or namespace name 'Controllers' does not exist in the namespace 'Nop.Web' (are you missing an assembly reference?
It really does mean you are actually missing a reference to be able to use Nop.Web.Controllers.
And as you found out it was Web.Controllers.CatalogController.
So Nop.Web.Controllers was itself expecting the reference.

How to use fizzler external lib under Monodevelop

I got a compile error using Fizzler lib (http://code.google.com/p/fizzler/) in Monodevelop IDE under Ubuntu 10.
I added .Net Assembly References and autocompletion works file, but error during the compilation occurred.
Code here:
using System;
using Fizzler.Systems.HtmlAgilityPack;
using HtmlAgilityPack;
using System.Collections.Generic;
namespace test
{
class MainClass
{
public static void Main (string[] args)
{
HtmlAgilityPack.HtmlDocument html = new HtmlAgilityPack.HtmlDocument();
html.LoadHtml(#"some html");
HtmlAgilityPack.HtmlNode document = html.DocumentNode;
document.QuerySelector("a");
}
}
}
Error CS1061: Type HtmlAgilityPack.HtmlNode' does not contain a definition forQuerySelector' and no extension method QuerySelector' of typeHtmlAgilityPack.HtmlNode' could be found (are you missing a using directive or an assembly reference?) (CS1061) (test)
Are your HtmlAgilityPack.HtmlNode has that definition provided? Check again the API documentation. Please the error is clear by itself.
You may have found the answer to this question by now but I will post one anyway, since people may come across this page while looking for an answer.
Replace:
using Fizzler.Systems.HtmlAgilityPack;
with:
using myFizzler= Fizzler.Systems.HtmlAgilityPack.HtmlNodeSelection;
and call it like this in your project:
HtmlNode h2 = myFizzler.QuerySelector(document, "#fbTimelineHeadline h2");
I hope this helps.

missing a using directive or an assembly reference?

I am getting this error Error 4 The type or namespace name 'Sample' could not be found (are you missing a using directive or an assembly reference?) F:\oadmin\sea\Controls\Dlg.cs 11 7 Controls
here i added Samplein reference section,,,then i used it as Using Sample,,i dont know why i am getting this error
this is the class
namespace sample
{
public class Server
{
public class client
{
Bool sent = true
}
}
}
Can i share exe,,this Sample is an exe
Perhaps because your namespace is sample and not Sample?
So if your Dlg namespace is different it needs to have a using sample line not using Sample.
Or perhaps your class is in another project within your solution and you need to include the hierarchy of namespaces?
Your namespace "sample" is lowercase, but you are referring to it in uppercase "Sample" ...
EDIT: You Bool sent is internal, it cannot be accessed from outside of the assembly

Categories

Resources