I am getting this error (colored in red):
"No source available for "QBasicAtomicInt_fetchAndAddOrdered() at 0xba49e3f0" - when I try to execute following line in debug mode:
item.mediaUrl = results.value("itemMediaUrl").toString();
where results is a QVariantMap (I manage to successfully read other values from results, e.g., other strings, ints, etc.) and item is just an object which has a variable of type QString, mediaUrl.
Any help?? Any suggestions?? Thanks
ps. It seems I fixed it in this way:
QUrl url = results.value("itemMediaUrl").toUrl();
item.mediaUrl = url.toString();
I think if you put the two lines in one (i.e., directly apply toString() after toUrl... it may still not work...
Related
I an trying to send Raw data to populate fields, the main one i need to populate is "additional info" but due to multiple variables being in additional info, im getting a syntax error
Below is what i have tried to do
Works fine if additional info is removed
{
"hostname":"TW_OF0048_CS01.thameswater.co.uk","severity":"1","description":" Interface GigabitEthernet1/0/8 - Gi1/0/8 for node TW_OF0048_CS01.thameswater.co.uk is Down.","icon":"Red","source":"SolarWinds"
}
gets syntax error
"additonal_info":{"hostname":"","networkNodeId":"1805","swEventId":"1274896","icon":"Red","netObjectId":"14592","NetObjectType":"I","eventType":"10"}
I need to pass both to ServiceNow.
I have tried various different ways to try and get it to work but always get some sort of error
{
"hostname":"TW_OF0048_CS01.thameswater.co.uk","severity":"1","description":" Interface GigabitEthernet1/0/8 - Gi1/0/8 for node TW_OF0048_CS01.thameswater.co.uk is Down.","icon":"Red","source":"SolarWinds"
}
gets syntax error
"additonal_info":{"hostname":"","networkNodeId":"1805","swEventId":"1274896","icon":"Red","netObjectId":"14592","NetObjectType":"I","eventType":"10"}
It should come into ServiceNow like the below
Doesn't seem like you are putting "additional_info" in as a proper json object. Try wrapping it in curly's. If that doesn't help what is the syntax error?
{
"additonal_info":{"hostname":"","networkNodeId":"1805","swEventId":"1274896","icon":"Red","netObjectId":"14592","NetObjectType":"I","eventType":"10"}
}
Currently, I'm working on compiling old .cpp classes under C++ Builder XE. Apart from many troubles, there is one which I have completely no idea how to solve.
My code:
String txt = "<Not so long sql query>";
int licz = some_function(txt, dzeFDS); //1
//assigning licz to somewhere
txt = "<much longer query>";
licz = some_function(txt, budFDS); //2
Problem is that during second call of some_function program is stopped and i have this alert:
First chance exception at $75A1C42D. Exception class EDatabaseError with message 'budFDS: Type mismatch for field 'Function', expecting: String actual: WideString'. Process Call.exe (1896)
It's strange form be, bacause first call of some_function works fine, but this second one (with arguments with the same type) doesn't.
some_function code:
int __fastcall some_function(String txt, TIBDataSet *firDS)
{
firDS->Close();
firDS->SelectSQL->Text = txt;
firDS->Open(); //during debugging, exception occurs in this line
int count = 0;
while(!firDS->Eof)
{ count++;
firDS->Next();
}
return count;
}
Any ideas what why it happens?
Thanks in advance
There is much pain in your future.
Anyway, the problem you're having is with the database connection. There's a field in your database called "Function" that holds a string. This field came across as a String with the ancient database driver that this program originally used. Your shiny, new database driver is telling VCL to expect such things as Unicode, and VCL doesn't like to shove such things into plain Strings, so it expects you to have a WideString ready in which to shove it.
Fortunately, there are ways of beating VCL into submission. What you want to do, since you surely don't want to rewrite half the application by changing TIBDataSet, is to tell the connection not to bother with Unicode. In order to do this, you have to set up the TSQLConnection object with UseUnicode=false, which I hope (I have no way of testing VCL code anymore) should look something like this:
connection->Params->Add("UseUnicode=false");
Where connection is the TSQLConnection object. I think you have to do this before connecting to the database.
If that doesn't work, see if you can configure the database driver to not use Unicode.
Problem solved - this one field Function has other type in C++ Builder design view - it was TStringField, and rest fields has TIBStringField...
I am trying to use the Google geocoder to do a reverse-geocoder lookup. I am running the exact same command on 8 values, and I am only having an error on two of them, which has me confused as one of the failing values is identical to one of the working values. (The 'working' values aren't really working- they still return a value of undefined from the 'formatted_address' field, but they aren't throwing errors). The command that I am running is as follows:
geocoder.geocode({latLng: new google.maps.LatLng(machineList[i].y, machineList[i].x)}, function(results, status) { address = results[0]; });
I am receiving a type error from Javascript, claiming that results is null. I'm not sure why this is happening. Any ideas?
Well, it turns out this was a timing issue. The geocode() command was taking longer to complete for certain locations than for others, which caused the value to show up as null. I ended up eliminating the problem by moving all the subsequent code into the callback function (I hadn't done this earlier because the whole thing is running inside of a loop, and I was having some difficulty getting it to pass in the iterator as a parameter). Now everything seems to be working well and the locations are showing up as they should.
Im trying to create ini file that will hold me the configuration data, I have singletone class
that setting the QSettings object like this :
... #DEFINE CONFIG_FILE_NAME "myconfig.ini"
m_pSettings = new QSettings(QDir::currentPath()+"/"+CONFIG_FILE_NAME,QSettings::IniFormat);
this is accourding the document, but when i look in my application dir, there is none myconfig.ini file created, what im doing wrong ?
I believe in order to force QSettings file to appear you would need to set at least one value in it and then call sync() method. See if an example below would work for you:
QSettings* settings = new QSettings(QDir::currentPath() + "/my_config_file.ini", QSettings::IniFormat);
settings->setValue("test", "value");
settings->sync();
hope this helps, regards
I dont think that "/"+CONFIG_FILE_NAME return the expected result. May be the cause of your problem..
Anyway operator +() is present in QString class so QDir::currentPath() + "/my_config_file.ini" must work fine.
I have set a file to be read-only (right click and check readonly). Now when I try to remove the file using the function bool QDir::remove(const QString & fileName) the file is not removed and false is returned.
How do I proceed with this? I have tried fiddling around by changing the permission of the file using QFile::setPermission, but that returns false too.
Can anybody advise an approach for the same?
file.setPermissions(QFile::ReadOther | QFile::WriteOther);
file.remove();
should work.
You can set file permissions with QFile
Of course this only for files you have user permission to do. The error may also be because the file is open in another app
First, have you checked QFile::error() to see why the file wasn't removed?
Second, in the event that you're still not getting a useful error message back, you could check the source to find out if you can get more information. Checking the source reveals the following, for example:
QFile::remove() uses the underlying file engine to do the removal. That file engine is platform specific and in qfsfileengine_win.cpp for windows. Line 830 shows that it's using DeleteFile to do the removal so you might be able to get more information by calling GetLastError, though I'd hope that Qt translates the error message appropriately.
QDir::remove() function is not a static function. so you can create QDir with parent file path and call then remove it:
QDir dir(parent's directory);
and then
dir.remove(fileName);
I think you should use this:
bool QFile::remove ( const QString & fileName ) [static]
instead of this:
QDir::remove ( const QString & fileName )
Have you tried to use bool QFile::remove(const QString &fileName)?