IWebExplorer2 Navigate fails with Error reading characters of string - facebook

IWebExplorer2::Navigate(..) (or Navigate2) is failing to navigate some urls. Like while navigating following url: *https://www.facebook.com/dialog/oauth/?api_key=<MyKey>&redirect_uri=<MyUri>&state=NONE* , I am getting the error **Error reading characters of string** in **DISPID_NAVIGATEERROR**.
......
wchar_t ws[MAX_PATH];
TCharToWide(url,ws,MAX_PATH);
VARIANT v; v.vt=VT_I4; v.lVal=0; //v.lVal=navNoHistory;
ibrowser->Navigate(ws,&v,NULL,NULL,NULL);
......
void TCharToWide(const wchar_t *src,wchar_t *dst,int dst_size_in_wchars){wcscpy(dst,src);}
Please could any one tell me what I am missing?
Thanks in advance.

Following Navigate2 method URL Type is Variant, and for Navigate method url type is BSTR; If you have ATL support you can use CComVariant with Navigate2, or CComBSTR with Navigate;
NavToURL( L"www.google.com", FALSE);
BOOL NavToURL(const wchar_t* url, BOOL isnewtab){
CComVariant vEmpty;
CComVariant vURL(url);
CComVariant flag=isnewtab ? 0x0800 : vEmpty;
ibrowser->Navigate2(&vURL, &flag, &vEmpty, &vEmpty, &vEmpty);
return TRUE;
}

Related

Decode utc8 character from string Flutter

I'm unable to decode the utc8 characters from string.
Below line getting from API
replace the cable if a fault is found รข for example
actual string
replace the cable if a fault is found - for example
Can any one help me how to fix this ?
Thanks!!!
You can use the Charset Detector Flutter Charset Detector Package to convert it to the correct encoding.
I already used it, and it works perfectly. You just have to convert the body of the response to the desired encoding.
You pass the bodyBytes field to the package autoDecode method.
Uint8List bodyBytes = response.bodyBytes;
DecodingResult decoded = (await CharsetDetector.autoDecode(bodyBytes));
String charset = decoded.charset;
String bodyInRightEncodage = decoded.string;
The response field is a http response object.
Below line is working fine
jsonDecode(utf8.decode(response.bodyBytes, allowMalformed: true));

FIXT.1.1:135->PSE, error> (Rejecting invalid message: quickfix.IncorrectTagValue: Value is incorrect (out of range) for this tag, field=528 field=528

We get the 528 tag error,
FIXT.1.1:135->PSE, error> (Rejecting invalid message: quickfix.IncorrectTagValue: Value is incorrect (out of range) for this tag, field=528 field=528:
FIXT.1.1:135->PSE, error> (Reject sent for Message 183: Value is incorrect (out of range) for this tag, field=528:528)
this is my configuration quickFix- BeginString=FIXT.1.1 DefaultApplVerID=9 StartTime=09:00:00 Asia/Manila EndTime=16:30:01 Asia/Manila HeartBtInt=30 ReconnectInterval=30 ResetOnLogon=Y ResetOnLogout=Y ResetOnDisconnect=Y CheckLatency=N MaxLatency=120**
when i'm getting incoming request from PSE, got the 528=L which is not exist in QuickFix class- public static final int FIELD = 528;public static final char AGENCY = 'A';public static final char PROPRIETARY = 'G';public static final char INDIVIDUAL = 'I';public static final char PRINCIPAL = 'P';public static final char RISKLESS_PRINCIPAL = 'R';public static final char AGENT_FOR_OTHER_MEMBER = 'W';
only these are the fields used in QuickFix class how can handle "L" Please help me. Thanks!
Obviously, your counterparty has added some custom values to the 528 enum.
You need to customize your DataDictionary xml file to match your counterparty's expectations. Ask them if they have an xml file they can give you, or else you'll need to use their interface spec as a guide and create your own.

How can I get the corresponding error string from an FT_Error code?

Given an FT_Error, is there a macro/function to return the corresponding error message string?
The answer is No, as far as I know.
You should create your own macro or function,
using macros defined in fterrors.h.
For example, the following code will work:
#include <ft2build.h>
#include FT_FREETYPE_H
const char* getErrorMessage(FT_Error err)
{
#undef FTERRORS_H_
#define FT_ERRORDEF( e, v, s ) case e: return s;
#define FT_ERROR_START_LIST switch (err) {
#define FT_ERROR_END_LIST }
#include FT_ERRORS_H
return "(Unknown error)";
}
Read fterrors.h (found in /usr/local/include/freetype2/ in my environment) for more detail and another example.
In case anyone else stumbles upon this question, FT_Error_String was introduced in FreeType2 version 2.10.1 to retrieve the error string of an FT_Error code.
FT_Error error = ...
if (error != 0)
{
puts(FT_Error_String(error), stderr);
}
Important: You must define FT_CONFIG_OPTION_ERROR_STRINGS when compiling FreeType otherwise the function will return NULL.

Firebreath plugin, how to read <param > values

I want to read the <param> values of custom plugin
I could not find answer on the internet, what I found was:
https://github.com/firebreath/FireBreath/blob/master/src/NpapiCore/NpapiPlugin.cpp#L76
I see params are stored in pluginMain->setParams(paramList);
Can you point how can I access this paramList later? or pluginMain
Is there pluginMain->getParams()? I could not find reference
Nor I could locate the source for setParams().
The question is, how do I get that parameters from PluginWindowXXX or FB::NpapiPluginXXX ?
I exported m_npHost to PluginWindowXXX, set breakpoint in it with gdb but still no success.
All I can think of was:
(gdb) p ((FB::Npapi::NpapiBrowserHost)this->m_npHost)->GetValue
$17 = {NPError (const FB::Npapi::NpapiBrowserHost * const, NPNVariable, void *)} 0x7fe435adeff8 <FB::Npapi::NpapiBrowserHost::GetValue(NPNVariable, void*) const>
Obviously what I do is wrong but I am stuck,
I am passing this host from NpapiPluginX11.cpp
pluginWin->setHost(m_npHost);
taxilian's answer is the most correct one as always but I'll give a try. I'm reading params in my MyPluginAPI constructor.
MyPluginAPI::MyPluginAPI(const MyPluginPtr& plugin, const FB::BrowserHostPtr& host) : m_plugin(plugin), m_host(host)
{
string settings; //<param name="settings" value="{'foo':'bar'}">
settings = plugin->getParam("settings");
}
Inside your PluginCore-derived class, you can use either the getParam method or the getParamVariant method.
From the FireBreath Source:
boost::optional<std::string> PluginCore::getParam(const std::string& key) {
boost::optional<std::string> rval;
FB::VariantMap::const_iterator fnd = m_params.find(key.c_str());
if (fnd != m_params.end())
rval.reset(fnd->second.convert_cast<std::string>());
return rval;
}
FB::variant FB::PluginCore::getParamVariant( const std::string& key )
{
FB::VariantMap::const_iterator fnd = m_params.find(key.c_str());
if (fnd != m_params.end())
return fnd->second;
return FB::variant();
}
So if it's for sure a string (which it pretty much is, unless it starts with on, in which case it might have been converted to a referenced function), you can use:
boost::optional<std::string> mystr = getParam("mystr");
if (mystr) {
call_fn_with_string(*mystr);
}
Alternately, you can get it as a variant and convert it:
FB::variant mystrVal = getParamVariant("mystr");
try {
call_fn_with_string(mystrVal.convert_cast<std::string>());
} catch (FB::bad_variant_cast &err) {
// What to do if the cast to string fails
}

pass value through url

I have a question.
my URL is some thing like this
http://www.google.com?to=shishir&from=friend
and I have 2 textfields from where I`m getting value of to and from.
I need to set those values of 2 textfields into the URL
to="values from textfield" from="value from textfield"
to create a somewhat called a dynamic URL.
how can i do it
quick reply is always appreciated
regards
shishir
You can use NSString's +stringWithFormat method to create your string:
NSString* urlString = [NSString stringWithFormat:#"http://www.google.com?to=%#&from=%#", field1.text, field2.text];
Quick and dirty could be:
get the text into 2 arrays.
sprintf to the final string variable.
char* from;
char* to;
char* url; // string of the final URL
sprintf(url, "http://www.google.com?from=%s&to=%s", from, to);
This should do the trick as needed, obviously you may need to do the magic to get the content of the from and to strings in the pointers and allocate memory to url, but other than that I guess, this takes care of the issue.