I'm updating my Twilio to use the newer library (5.x)
I create a phone call using the new API. I want to check the status of the call.
Dim CallStatus = MyTwilioCall.Status
If CallStatus.Equals(CallResource.StatusEnum.Queued) Then '// Success
This does not work, it evaluates to false, although when i debug and inspect it shows that callstatus has a value of {queued}.
If i try:
If CallStatus = CallResource.StatusEnum.Ringing Then '// Success
I get an exception that Operator of '=' is not defined for CallResource.StatusEnum. For fun, i tried using the is operator as well with no success. I supposed i could .tostring() and then compare, but that seems silly. Am i doing something wrong, or is this just the way twilio client is built?
Twilio Developer Educator here. You did indeed find a bug that we have since fixed in v5.1.1 of the library. If you use NuGet to upgrade to v5.1.1 or later, that should solve the problem for you.
https://www.nuget.org/packages/Twilio/5.1.1
Related
I am using Savon 2.11.1 as a Ruby SOAP client.
Savon uses Nori to translate the SOAP response XML to a Hash. Nori supports the option convert_dashes_to_underscores which by default converts all dashes in SOAP response to underscores.
I tried to use this option in the client's constructor but I got the following error message
Savon::UnknownOptionError: Unknown global option: :convert_dashes_to_underscores.
Why is this option not supported for Savon? Any workaround?
Thanks
M
I don't know why it isn't supported. I guess because nobody needed it up until now. I propose you extend the code, create the unit tests, upload the sources to github and send a pull request to the main project. Simple as that.
You can also look into the documentation where you'll find that the following symbols are available to control conversion
:camelcase
:lower_camelcase
:upcase
:none
http://savonrb.com/version2/globals.html
After about 3 hours I found out that in universal Windows Phone 8.1 apps the AuthenticateAsync-method has been deprecated.
When using it in Visual studio, at first, it is silent. When you try to run it, it says:
AuthenticateAsync is unavailable for releases beginning with Windows
Phone 8.1. Instead, use AuthenticateAndContinue or
AuthenticateSilentlyAsync.
After another 2 hours, how hard I try, I cannot find a way to implement the example of the Single-sign on, it simply doesn't work.
AuthenticateAndContinue fails because the "remote procedure call failed"
SilentlyAsync returns the error, that the parameters are incorrect, but that is logical.
Do any of you guys know of a way to sign in, without using AuthenticateAsync?
Edit: When running anyway, it throws a not implemented Exception
I assumed "deprecated: was just a compiler warning saying "we suggest you shouldn't use this API anymore".
I was wrong - it's apparently a hard error with the OP's Windows Phone SDK. The new SDK doesn't support the old call; I doubt the Facebook SDK supports the new call.
SUGGESTED WORKAROUNDS:
1) Try using an older Windows Phone SDK (or, if possible, target your compile for an older version of the runtime).
2) Wrap your call in Dispatcher.RunAsync
WebAuthenticationBroken.AuthenticateAsync - NotImplementException
http://www.asp.net/web-api/overview/web-api-clients/calling-a-web-api-from-a-net-client
I am using RestSharp to access a RubyOnRails API.
As you might know, RoR likes when the parameters names are in the form model_name[property]. RestSharp, on the other hand, does not like it.
Fiddler says I send this to the server :
user%5Bemail%5D=user%40email.com&user%5Bpassword%5D=test
It looks like R# encodes both the parameters and values when it sends the data (unlike Curl, which looks like it encodes selectively).
While that's fine most of the time I guess, in this particular case, it makes the API return a 401 because it doesn't understand the parameters.
Is it possible to ask R# to not encode the request's parameters ?
Thank you !
Edit
Ok, in the R# sources, I found the method RestClient.EncodeParameters, so it looks like the parameter's name is always encoded. I guess I will have to fork it :(
Since RestSharp version 106.4.0 you can just use ParameterType.QueryStringWithoutEncode in request.AddParameter() function:
request.AddParameter("user_id", #"45454545%6565%65", ParameterType.QueryStringWithoutEncode);
I know this has already been answered, but I wanted to add this answer since it worked for me. There is an (albeit hacky) solution to this. Build your own uri for parameters that should not be encoded.
var uri = string.Concat("/path/to/your/api", "?paramThatShouldNotBeEncoded=", DateTime.Now.Date.AddDays(1).ToString("O"));
var restRequest = new RestRequest(uri, Method.GET);
In the RestSharp sources I found out that the parameters are always encoded (both the name and the value), so I guess that I will have to fork it if I want to add an additional parameter.
See this PR from the project site:
https://github.com/restsharp/RestSharp/pull/1157
However, as far as I can tell, it's not yet in a release on NuGet.
Update: probably doesn't work in most cases from comments.
I found an interesting solution... Just decode the parameters you want to pass in and restsharp will encode back to what it should be. For example, I have an api key that uses %7 in it and RestSharper further encodes it. I decoded the api key and passed that into RestSharp and it seems to work!
This solution worked for me
request.AddQueryParameter("sendEndDate", "string:data,something-else", false);
This is the function in the metadata of RestSharp.IRestRequest:
IRestRequest AddQueryParameter(string name, string value, bool encode);
I have been getting
Selenium::WebDriver::Element#value is deprecated, please use Selenium::WebDriver::Element#attribute('value') warning.
I am getting this warning message only for
page.find(:xpath, "//select").value.should == "general".
Can any one tell me how to use attribute('value') instead?
I suspect you use capybara?
Got the same message myself, but capybara currently still accesses the value directly as seen in https://github.com/jnicklas/capybara/blob/master/lib/capybara/selenium/node.rb#L16
I will send them a fix. Should be done in future versions hopefully
I wrote this code to hook API functions by changing the address in the IAT and EAT: http://pastebin.com/7d9N1J2c
This works just fine when I want to hook "recv" or "connect". However for some unknown reason when trying to hook "gethostbyname", my hook function is never called.
I tried to find "gethostbyname" in a debugger by taking the base address of the wsock32.dll module + 0x375e, which is what the ordinal 52 of my wsock32.dll is showing as offset. But that just makes me end up in some random asm code, not at the beginning of a function.
The same method however works fine for trying to find the "recv" entry point.
Does anyone see what I might be doing wrong?
I recommend this tool:
http://www.moduleanalyzer.com/
They do exactly the same and show the url that was connected with that API.
The problem is that there are more than one API to translate an url to an address. The application you are hooking may be using another version of the API that you're not intercepting.
Run some disassembler like IDA and attach to your process after you hook this functions, ida get apply changes on attaching and play process and check what is wrong.
In other way you have many libraries to do hooks with trampolines like Microsoft Detours, NCodeHook etc.