advertisementData contains:
Advertisement data {
kCBAdvDataIsConnectable = 1;
kCBAdvDataLocalName = "Ali \n";
kCBAdvDataServiceUUIDs = (
"43200-B827-EB74-0E24-192168001107"
);
}
if(advertisementData[#"kCBAdvDataServiceUUIDs"] hasPrefix:#"432"){
NSLog("It contains this string");
}
When i execute the code it gives me error:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[CBUUID hasPrefix:]: unrecognized selector sent to instance 0x170034260'.
kCBAdvDataServiceUUIDs is a CBUUID. Use uuidString to get the string.
Related
I need to set value for an embed field in Podio, and this is my code:
$field_id='pdf-property-information';
$options=$item->fields[$field_id]->values;
if(empty($options))
$item->fields[$field_id] = new PodioEmbedItemField($field_id);
// Create embed
$embed = PodioEmbed::create(array('url' => $pdf_property_information));
// Set using object
$item->fields[$field_id]->values = $embed;
// Set using associative array
$item->fields[$field_id]->values = array('embed_id' => $embed->embed_id);
And this is the error I get:
Fatal error: Uncaught PodioBadRequestError: "Must specify either
'embed' or 'url'" Request URL: http://api.podio.com/item/826141668
Stack Trace: #0
/home/apibind/public_html/mail_chimp/podio-php-4.3.0/lib/Podio.php(355):
Podio::request('PUT', '/item/826141668', Array) #1
/home/apibind/public_html/mail_chimp/podio-php-4.3.0/models/PodioItem.php(183):
Podio::put('/item/826141668', Array) #2
/home/apibind/public_html/mail_chimp/podio-php-4.3.0/models/PodioItem.php(66):
PodioItem::update(826141668, Array, Array) #3
/home/apibind/public_html/sourcingplatform/trunk/add.php(403):
PodioItem->save() #4 {main} thrown in /podio-php-4.3.0/lib/Podio.php
on line 289
You have to pass the embed_id with array key "embed". Here your final line will be like,
// Set using associative array
$item->fields[$field_id]->values = array('embed' => $embed->embed_id);
Fatal error: Uncaught Error: Call to undefined function mysqli_result() in /home/prasanth/projects/ishen1/index.php:49 Stack trace: #0 {main} thrown
how to slove this
according to this answer https://stackoverflow.com/a/17707384/8284461 that function is inefficient, you can use mysqli_fetch_assoc() instead. for example:
while($row = mysqli_fetch_assoc($result)) {
$id = $row['ID'];
$name = $row['name'];
etc..
}
I am upgrading from Mule 3.4 to 3.7. I have applications that handle exceptions by alerting administrators by email. In 3.4, I used to have the mule expression #[exception.getSummaryMessage()] for printing and emailing the information. It used to provide me the complete exception message with the exception stack as below:
Message : groovy.lang.MissingPropertyException: No such property: z for class: Script1 (javax.script.ScriptException)
Type : org.mule.api.transformer.TransformerException
Code : MULE_ERROR--2
JavaDoc : http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/transformer/TransformerException.html
Transformer : ScriptTransformer{this=11810917, name='ScriptTransformer', ignoreBadInput=false, returnClass=SimpleDataType{type=java.lang.Object, mimeType='/', encoding='null'}, sourceTypes=[]}
Exception stack is:
1. No such property: z for class: Script1 (groovy.lang.MissingPropertyException)
org.codehaus.groovy.runtime.ScriptBytecodeAdapter:53 (null)
2. groovy.lang.MissingPropertyException: No such property: z for class: Script1 (javax.script.ScriptException)
org.codehaus.groovy.jsr223.GroovyScriptEngineImpl:326 (http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/script/ScriptException.html)
3. groovy.lang.MissingPropertyException: No such property: z for class: Script1 (javax.script.ScriptException) (org.mule.api.transformer.TransformerException)
org.mule.module.scripting.transformer.ScriptTransformer:56 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/transformer/TransformerException.html)
In 3.7, the same expression only gives me the exception message as below:
groovy.lang.MissingPropertyException: No such property: z for class: Script1 (javax.script.ScriptException). Message payload is of type: NullPayload (org.mule.api.transformer.TransformerMessagingException). Message payload is of type: NullPayload
Could someone guide me as to how I can retrieve the exception in the previous format or how this can be achieved with Mule 3.7?
I had to do something similar so I wrote a piece of Groovy code to extract the error message from the exception object:
def log = LogFactory.getLog(logCategory)
def cleanRootErrorMessage = null
// no matter what, we don't want Exceptions getting out of here!
try {
log.debug("Extracting exception root cause...")
def tmpException = exception
while (tmpException.cause != null && (tmpException.cause instanceof NullPointerException) == false) {
tmpException = tmpException.cause
}
cleanRootErrorMessage = tmpException.message
log.debug("Root cause: [$cleanRootErrorMessage]")
if (cleanRootErrorMessage ==~/^.*(Exception: |Error: )(.*)$/) {
cleanRootErrorMessage = (cleanRootErrorMessage =~/^.*(Exception: |Error: )(.*)$/).replaceAll('$2')
}
if(cleanRootErrorMessage == null) {
log.debug("Capturing exception.message...")
cleanRootErrorMessage = exception.message
}
log.debug("Filtered root cause: [$cleanRootErrorMessage]")
} catch (Exception e) {
log.error("Exception thrown ***inside*** the Root Error Message extraction code...", e)
cleanRootErrorMessage = 'Unknown Error'
}
return cleanRootErrorMessage
I hope it helps, if you want further help, feel free to find me on my twitter account from my profile.
Can you try #[exception.cause.message]
<?php
include('connect.php');
$date = $_POST['date'];
$student_ID = $_POST['student_ID'];
$full_name = $_POST['full_name'];
$year_section = $_POST['year_section'];
$payment_description = $_POST['payment_description'];
$amount = $_POST['amount'];
$received_by = $_POST['received_by'];
// query
$sql = "INSERT INTO transaction (date,student_ID,full_name,year_section,payment_description,amount,received_by) VALUES (:sas,:asas,:asafs,:offff,:statttt,:dot,:rd,:ft)";
$q = $db->prepare($sql);
$q>execute(array(':sas'=>$date,':asas'=>$student_ID,':asafs'=>$full_name,':offff'=>$year_section,':statttt'=>$payment_description,':dot'=>$amount,':rd'=>$received_by));
header("location: index.php");
?>
I get the following error:
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY093]: Invalid parameter number: number of bound variables
does not match number of tokens' in
C:\xampp\htdocs\recordmanagement\main\reg.php:15 Stack trace: #0
C:\xampp\htdocs\recordmanagement\main\reg.php(15):
PDOStatement->execute(Array) #1 {main} thrown in
C:\xampp\htdocs\recordmanagement\main\reg.php on line 15
In the code I am also unsure about the meaning of these values:
(:sas,:asas,:asafs,:offff,:statttt,:dot,:rd,:ft);
I downloaded it from sourcecode, so it was not written by me.
There seems to be a field to much in the query. This:
$sql = "INSERT INTO transaction
(date,student_ID,full_name,year_section,payment_description,amount,received_by)
VALUES (:sas,:asas,:asafs,:offff,:statttt,:dot,:rd,:ft)";
should probably be:
$sql = "INSERT INTO transaction
(date,student_ID,full_name,year_section,payment_description,amount,received_by)
VALUES (:sas,:asas,:asafs,:offff,:statttt,:dot,:rd)";
as there is no matching value for the :ft field.
Whether this is because your missing an item in the values or if it's not needed I can't say.
I am using coredata and often my app crashes because one of the properties of a managed object turn out null. For example when i set text of a UILabel to a text property of the managed object it displays NULL
To find the problem I overrode the setter which assigns the NSManagedObject to a instance variable. In the setter I use NSLog to print the object:
NSLog(#"TSC: setting segment: %#", segment);
its output:
2012-11-05 21:01:56.758 JetLagged[4505:907] TSC: setting segment: <Segment: 0x1d0ab790> (entity: Segment; id: 0x1d0a7f60 <x-coredata://BF6F2D98-0658-4005-8BEF-9FE6B398AF86/Segment/p8> ; data: {
arrivalDate = "2012-11-11 05:00:17 +0000";
arrivalLeg = "0x1d0abba0 <x-coredata://BF6F2D98-0658-4005-8BEF-9FE6B398AF86/IteneryLeg/p11>";
departureDate = "2012-11-10 19:00:17 +0000";
departureLeg = "0x1d0abba0 <x-coredata://BF6F2D98-0658-4005-8BEF-9FE6B398AF86/IteneryLeg/p11>";
iteneryLegs = (
"0x1d0abba0 <x-coredata://BF6F2D98-0658-4005-8BEF-9FE6B398AF86/IteneryLeg/p11>"
);
trip = "0x1c58add0 <x-coredata://BF6F2D98-0658-4005-8BEF-9FE6B398AF86/Trip/p5>";
})
All looks fine, however app still displayes null in some places or crashes. I catch the problem I added some NSAsserts and when I ran the code below in the same run as the output above it failed the assertion. Here is the assert code (segmentToCheck is segment from above).
NSSet *legs = [segmentToCheck valueForKey:#"iteneryLegs"];
NSAssert([legs count] != 0, #"Error: nolegs %#", legs);
its output:
2012-11-05 21:01:56.763 JetLagged[4505:907] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Error: nolegs (null)'
When i run the app again (without any data modification) it works fine. Any idea what it might be?
Looks like a typo: #"itineryLegs" instead of #"iteneryLegs".