String index error in Grails Google Charts plugin - mysql

I have some strings that are in array form in a MySQL database that I want to use in the Grails Google Charts plugin, but I’m having trouble getting the plugin to accept them.
My strings look like [['string', 'Month'], ['number', 'Stories']] and [['April', 0], ['May', 0], ['June', 0], ['July', '12152']], which is the correct format, but I’m getting a "string index out of range error" that I'm trying to resolve.
I’m using g:set to set the variables and then passing them to gvisualization:
<g:each in="${groupsInstance.charts}" var="c">
<g:set var="chartColumns" value="${c.chartColumns}" />
<g:set var="chartData" value="${c.chartData}" />
<g:set var="chartType" value="${c.chartType}" />
<g:set var="chartDisplayKey" value="${chartType.chartKey}" />
<g:if test="${c.id == 1}">
<gvisualization:columnCoreChart elementId="${chartDisplayKey}"
width="${225}"
height="${225}"
legend="none"
columns="${chartColumns}"
data="${chartData}" />
</g:if>
</g:each>
When I try to do it this way, I get the following error in the app:
Error 500: Internal Server Error
URI: /appDash/groups/show/1
Class: java.lang.StringIndexOutOfBoundsException
Message: String index out of range: 2
And the console:
Error |
2014-08-12 12:36:51,717 [http-bio-8080-exec-6] ERROR errors.GrailsExceptionResolver - StringIndexOutOfBoundsException occurred when processing request: [GET] /app/groups/show/1
String index out of range: 2. Stacktrace follows:
Message: Error processing GroovyPageView: Error executing tag <gvisualization:columnCoreChart>: String index out of range: 2
If I initialize variables at the top of the page and use those instead, it works fine; the error occurs when I try to pull the strings out of the database. I’ve tried to find examples of the plugin being used this way without much success.

Related

ExpoAppAuth + Instagram Error: ExpoAppAuth.Get Auth: JSON deserialization error

just trying to receive access token from instagram api. I am using expo app-auth and running on android. My usage is straight from demo https://docs.expo.io/versions/latest/sdk/app-auth/#usage
Of course I changed config to:
let config = {
issuer: 'https://api.instagram.com/oauth/authorize',
scopes: ['user_profile', 'user_media'],
clientId: '33562202******'
};
And received that kind of error:
[Unhandled promise rejection: Error: ExpoAppAuth.Get Auth: JSON deserialization error]
- node_modules\react-native\Libraries\BatchedBridge\NativeModules.js:99:50 in fn
- node_modules\#unimodules\react-native-adapter\build\NativeModulesProxy.js:15:41 in moduleName.methodInfo.name
- ... 9 more stack frames from framework internals
Any tips how to manage with that kind of error? I guess that maybe instagram returns data in format different than JSON but have no green idea how to read that data, because of throwing error.

Postman: More descriptive tv4 validation error message

I'm using postman to validate the schema of json data returned from an api.
I have a test that runs through basic http validation, then ends with:
if (tv4.error){
console.log("Validation failed: ", tv4.error);
}
The error I get back is difficult to fathom.
Validation failed: 12:22:41.316
Object:{}
message:"Invalid type:
number (expected string)"
name:"ValidationError"
type:"Error"
But I need to know which field the validation failed on. How can I get this info? The npm page for tv4 suggests that the error message should be more descriptive.
According to the documentation of tv4, you can print the path of the error location using console.log(tv4.error.dataPath), I have no idea why this attribute is not logged in the console.
Documentation is here.
The relevant section in the documentation is:
If validation returns false, then an explanation of why validation failed can be found in tv4.error.
The error object will look something like:
{
"code": 0,
"message": "Invalid type: string",
"dataPath": "/intKey",
"schemaPath": "/properties/intKey/type"
}

Pass a url query string containing double quotes to API Gateway ? encodeURI not working

I am making an http request to an API gateway wrapping a lambda.
I have a query string parameter which is like this :
LG - 50" Class (49.5" Diag.) - LED - 2160p - Smart - 4K Ultra HD TV - Black
I tried to encodeURIComponent and pass it to my http request call. I get this error
body: '{"message": "Could not parse request body into json: Unexpected character (\\\'C\\\' (code 67)): was expecting comma to separate OBJECT entries\\n at [Source: [B#5ebb26a9; line: 1, column: 28]"}' }
If I remove the double quotes it works fine.
The error message is thrown while your Lambda function tries to parse it. Can you check API Gateway's CloudWatch logs (easy to check in test invoke console) to make sure that the "Endpoint request body after transformations" is as your Lambda function expects?

Amazon Cloudwatch log filtering - JSON syntax

I have an AWS Lambda function which is logging errors. Errors are logged as such:
console.error(err);
I'm trying to create a Cloudwatch filter which uses their JSON log filtering syntax:
{ $.errorType = "ValidationException" }
I can see the error in the log
2015-11-24T20:26:02.852Z 76800706-2d78-45ed-9068-46ccccafe6af
{
"errorMessage": "1 validation error detected: Value '[]' at 'xxxxxx' failed to satisfy constraint: Member must have length greater than or equal to 1",
"errorType": "ValidationException",
"stackTrace": [
...etc...
]
}
Is there some sort of special setup or manual logging into CloudWatch required to support the JSON filter syntax? I cannot find any info in the CloudWatch docs.
Docs:
http://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-model-logging.html
http://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/FilterAndPatternSyntax.html#d0e19372
Seems like when you log from Lambda it turns everything in to a string. May have something to do with adding the Request time and ID to each item.

Drupal 7 Solr Indexing Error showing "EntityMalformedException: Missing bundle property on entity of type taxonomy_term"

In Drupal 7.14, when i Index my Whole Site, Solr is showing following error:
AJAX HTTP error occurred. HTTP Result Code: 500 Debugging information follows.
Path: /batch?id=1938&op=do StatusText: Service unavailable (with message)
ResponseText: EntityMalformedException: Missing bundle property on entity of type taxonomy_term. in entity_extract_ids() (line 7539 of /project/path/includes/common.inc).
So when i look into the lines in /includes/common.inc (around lines: 7537):
// Explicitly fail for malformed entities missing the bundle property.
if (!isset($entity->{$info['entity keys']['bundle']}) || $entity->{$info['entity keys']['bundle']} === '') {
throw new EntityMalformedException(t('Missing bundle property on entity of type #entity_type.', array('#entity_type' => $entity_type)));
}
What is that chunk of code (in common.inc) is doing actually please?
How can i overcome that error?
Please, try this module https://drupal.org/project/taxonomy_orphanage it will delete all empty bundles.