How do I get the system proxy using Qt? - c++

I have the following code that I am trying to extract the systems proxy settings from:
QList<QNetworkProxy> listOfProxies = QNetworkProxyFactory::systemProxyForQuery();
foreach ( QNetworkProxy loopItem, listOfProxies ) {
qDebug() << "proxyUsed:" << loopItem.hostName();
}
I only get one item back and with a blank host name. Any ideas what I am missing?

By putting:
QNetworkProxyQuery npq(QUrl("http://www.google.com"));
QList<QNetworkProxy> listOfProxies = QNetworkProxyFactory::systemProxyForQuery(npq);
I appear get the proxy out.

QNetworkProxyQuery npq(QUrl(QLatin1String("http://www.google.com")));
Don't forget to use QLatin1String :)

Related

Single store on multiple domains - Opencart

I would like to know how to setup a store to run on multiple domains.
Posible Scenario :
The main store is "store.de" and i would like to make it to use
diffrent domains such as "store.com ; store.fr ..etc" but the
store is the same as theme , products , users , etc .
The only thing I would like to change is when someone gets an a
language specific domain such as ".fr ; .de " to be able to
set automatic the store language to that specific zone , because
opencart only detects the browser language ( I'm not really sure about
that )
Thanks for the help.
I am assuming your main store is store.com and you have already pointed your main store to all other domains. Now you can make a small vqmod or ocmod (OC v.2) which can be appended in catalog/controller/common/header.php For example:
Append these:
$tld = substr($_SERVER['SERVER_NAME'],strrpos($_SERVER['SERVER_NAME'],'.')+1);
if ( !isset($this->session->data['lang_detect']) && $tld! = 'com') {
$this->session->data['language'] = $tld;
$this->session->data['lang_detect'] = true;
}
Before:
$this->data['base'] = $server;

Bukkit.getIp() in player.sendMessage - Possible solution?

I'm making a plugin for my staff that can help them with some basic information.
I'm trying to add a /ip for the server that will show the server ip, instead of the dns that they connect to.
I'm trying something like this
var InfoIP = Bukkit.getIp();
player.sendMessage("Server Ip: " + InfoIP);
Apparently it does work with Bukkit.getPort(); but it doesnt work with the ip.
Is there another way to fix this?
I'm not looking for anything like this
var myip = "0.0.0.0";
player.sendMessage("Server Ip:" + myip);
I want the myip to be filled by the getIp instead of manually filling it.
Hopefully someone has a solution for this :)
tnx.
In order to use the getIP method you must define it in your server properties.
there should be a line called server ip.
once you have defined your ip in the properties it will return the ip.
when you use the getIP method.
Or you could use:
player.sendMessage(getServer().getAddress() + ":" + getServer().getPort());
hope this helped
~~
AceStudios
Or this:
if (!getServer().getPort() == "25565") {
player.sendMessage(getServer().getAddress() + ":" + getServer().getPort());
}
else {
player.sendMessage(getServer.getAddress());
Instead of using Bukkit.getIP(); try using Bukkit.getServer().getAddress();

apache and cgicc - differentiate between post and get variables

In PHP it is very simple to check, if a variable has been transmitted via GET or POST. With the cgicc library they all look the same. Is there another possibility to read only GET or only POST variables?
My Code:
cgicc:Cgicc cgiobj;
std::cout << "Both, post or get: " << cgiobj("variablename") << std::endl;
I had the same question so I looked for a solution in the cgicc documentation.
Class CgiEnvironment provides getRequestMethod() which returns "GET" or "POST" accordingly to your request.
eg.
cgicc::Cgicc cgi;
cgicc::CgiEnvironment env = cgi.getEnvironment();
std::string requestMethod = env.getRequestMethod();
I have not tested it, though.

SBL-ODU-01007 The HTTP request did not contain a valid SOAPAction header

I am hoping someone can help get me in the right direction...
I am using Powerbuilder 12 Classic and trying to consume a Oracle CRM OnDemand web service.
Using Msxml2.XMLHTTP.4.0 commands, I have been able to connect using https and retrieve the session id, which I need to send back when I invoke the method.
When I run the code below, I get the SBL-ODU-01007 The HTTP request did not contain a valid SOAPAction header error message. I am not sure what I am missing??
OleObject loo_xmlhttp
ls_get_url = "https://secure-ausomxxxx.crmondemand.com/Services/Integration?command=login"
try
loo_xmlhttp = CREATE oleobject
loo_xmlhttp.ConnectToNewObject("Msxml2.XMLHTTP.4.0")
loo_xmlhttp.open ("GET",ls_get_url, false)
loo_xmlhttp.setRequestHeader("UserName", "xxxxxxx")
loo_xmlhttp.setRequestHeader("Password", "xxxxxxx")
loo_xmlhttp.send()
cookie = loo_xmlhttp.getResponseHeader("Set-Cookie")
sesId = mid(cookie, pos(cookie,"=", 1)+1, pos(cookie,";", 1)-(pos(cookie,"=", 1)+1))
ls_post_url = "https://secure-ausomxxxx.crmondemand.com/Services/Integration/Activity;"
ls_response_text = "jsessionid=" + sesId + ";"
ls_post_url = ls_post_url + ls_response_text
loo_xmlhttp.open ("POST",ls_post_url, false)
loo_xmlhttp.setRequestHeader("COOKIE", left(cookie,pos(cookie,";",1)-1) )
loo_xmlhttp.setRequestHeader("COOKIE", left(cookie,pos(cookie,";",1)-1) )
ls_post_url2 = "document/urn:crmondemand/ws/activity/10/2004:Activity_QueryPage"
loo_xmlhttp.setRequestHeader("SOAPAction", ls_post_url2)
loo_xmlhttp.send()
ls_get_url = "https://secure-ausomxxxx.crmondemand.com/Services/Integration?command=logoff"
loo_xmlhttp.open ("POST",ls_get_url, false)
loo_xmlhttp.send()
catch (RuntimeError rte)
MessageBox("Error", "RuntimeError - " + rte.getMessage())
end try
I believe you are using incorrect URL for Login and Logoff;
Here is the sample:
https://secure-ausomxxxx.crmondemand.com/Services/Integration?command=login
https://secure-ausomxxxx.crmondemand.com/Services/Integration?command=logoff
Rest of the code looks OK to me.
I have run into similar issues in PB with msxml through ole. Adding this may help:
loo_xmlhttp.setRequestHeader("Content-Type", "text/xml")
you need to make sure that the your value for ls_post_url2 is one of the values that is found in the wsdl file. Just search for "soap:operation soapAction" in the wsdl file to see the valid values for SOAPAction.

Why is php_template_preprocess_page function not called in Drupal 6x?

From another forum I found the following example:
"I was looking for a way to pull node data via ajax and came up with the following solution for Drupal 6. After implementing the changes below, if you add ajax=1 in the URL (e.g. mysite.com/node/1?ajax=1), you'll get just the content and no page layout.
in the template.php file for your theme:
function phptemplate_preprocess_page(&$vars) {
if ( isset($_GET['ajax']) && $_GET['ajax'] == 1 ) {
$vars['template_file'] = 'page-ajax';
}
}
then create page-ajax.tpl.php in your theme directory with this content:
<?php print $content; ?>
"
This seems like the logical way to do it and I did this, but the phptemplate_preprocess_page function is never called ... any suggestions?
I figured it out for myself from a Drupal Support Theme Development page:
"Maybe this helps
leahcim.2707 - May 29, 2008 - 05:40
I was trying to get the same thing done and for me this works, but I'm not sure if it is the correct way as I'm still new to Drupal:
in "template.php" I added the following function:
function phptemplate_preprocess_page(&$vars)
{
$css = $vars['css'];
unset($css['all']['module']['modules/system/system.css']);
unset($css['all']['module']['modules/system/defaults.css']);
$vars['styles'] = drupal_get_css($css);
}
I think after adding the function you need to go to /admin/build/themes so that Drupal recognises the function."
The part in bold is what did the trick ... you have to re-save the configuration so it recognizes that you've added a new function to the template.