Cake php 2.1 form error - cakephp

I am using cakephp 2.1 when i am creating add function in controller and view add.ctp
i am getting this error:
Parse error: syntax error, unexpected T_OBJECT_OPERATOR, expecting ',' or ';' in C:\wamp\www\rohitchoudhary\caketoodoo\app\View\tasks\add.ctp on line 5
Please help me

this is not a cake but a php question.
and not even that.
just make sure you use a decent PHP IDE which would give parsing errors.
then you would find out that you probably placed an invalid char somewhere.
either way you should be able to debug such a parse error yourself.
such error messages are always descriptive enough to get it done on your own.

Related

What is the reason of Parsing error:Unexpected token, in codesandbox project

I have
Parsing erros: Unexpected token, expected ","
in the project I code in codesandbox.io. I have just connected codesandbox project into github repository and it throws such error which I cannot figure-out.
Can You please suggest what is wrong and how to fix it?
Please don't post screenshots of code. It's usually actually faster to just copy-paste in your code, and you can use three backticks both above and below the code to format it correctly.
Trust your error messages to point you in the right direction: it's telling you that your exclamation mark is invalid. The ! is a non-null assertion operator, it doesn't belong there because you're not accessing a property that TS might think is null. The parser thinks you meant to do something like (rootElement, !someOtherThing), hence the error saying it expected a comma.

TypeScript: Can not retrieve the type of property of another type

I am using create-react-app and its typescript template, but when trying to retrieve the type of the property 'pending' in 'GenericAsyncThunk' like in redux-toolkit docs like this:
type PendingAction = ReturnType<GenericAsyncThunk["pending"]>;
I get an error: Parsing error: Unexpected token, expected "]"
Edit: looks like the errors only shows up on my machine and works in CodeSandbox. The error appears when the project is ran with the command npm start. Here is the full output:
Any suggestions on how to tackle this?
Probably the actual parse error is a bit earlier in the file and the line it reports on is not the line with the error, but rather the line at which it has to give up, since it can't make any further sense of the file.
Try removing elements before this structure, or move this structure further up the page to see if you can prove the theory.

How to debug delete() in CakePHP

how to debug delete() in CakePHP? When I do:
debug($this->Sessions->delete($s));
I get this error:
{
"message": "SQLSTATE[42S22]: Column not found: 1054 Unknown column \u0027session_id\u0027 in \u0027where clause\u0027",
"url": "\/api\/sessions\/delete\/2856",
"code": 500,
"file": "\/var\/www\/vendor\/cakephp\/cakephp\/src\/Database\/Statement\/MysqlStatement.php",
"line": 39
}
EDIT: Figured out my problem, I had called the session_id column "sessions_id" in the table by mistake. I updated this, and it solved my problem. However I'd really like to know how to debug delete() and find() properly. I noticed there is a debugging console bin/cake console. Then help to debug stuff, but I dont know how to use it, and cant seem to find any documentation on this. Can anyone help out? Thanks.
The error message stems directly from the DBMS, not from CakePHP, and it tells you pretty much all you need to know about why the query failed, there's not really a way to get more info on that.
Unless you're talking about the line where the exception is being thrown, pointing to a specific line would be rather complicated, as in this case there isn't an exact line causing a problem, the CakePHP side is working perfectly fine, you just mis-configured/named things, which led to a non-working SQL query being generated.
I would suggest to use a proper IDE and a debugger like XDebug that can halt on exceptions, then you have your stacktrace and a bunch of contextual information right at hand, and you can easily step through the code. A plain stacktrace can also be found in the logs (/logs/*.log).

toDerInputStream rejects tag type 123

I am trying to run the Get started with Datastore example at https://developers.google.com/datastore/docs/getstarted/start_java/ trying it both from the command line and from Eclipse.
In both environments, it is not able to connect to datastore and gives an I/O error message 'toDerInputStream rejects tag type 123'.
Looking around, this may be because the private key file is in json format and perhaps it should the p12 - other than that the error message draws a blank.
Could anyone point to something that would help me past this?
You need to use PKCS#12 format, as you said, p12. There's a few other people with similar errors (although they're trying to accomplish different things). I hope this helps, let us know if it resolves the issue.
Push Notification in Java expect p12 file
toDerInputSteam rejects tag 66

IE error with rallyGrid

I'm getting an error with an SDK2.0 app using a rally custom grid:
It only errors with IE (current), and it does not error if I run it locally, only when I install it in Rally and run it.
I don't know if its a Rally issue, or a EXTJS issue.
SCRIPT5007: Unable to get value of the property 'modelField': object is null or undefined
sdk.js, line 4 character 1276692
The code that failed:
if(e.modelField&&e.modelField.hidden)
Context around that error:
{xtype:"rallytextfield",allowBlank:false,removeNameAttribute:true}}},PortfolioItem:function(){return{hidden:true}},AttributeType:function(b){return a.apply(Rally.ui.grid.FieldColumnFactory.defaultRenderer(b),{sortable:false})}})})();(function(){var a=window.Ext4||window.Ext;var b=function(g,e){var d=g.text;var c=e.text;if(d>c){return 1}if(d<c){return -1}return 0};a.define("Rally.ui.grid.ColumnBuilder",{requires:["Ext.Array","Ext.util.Format","Rally.ui.grid.FieldColumnFactory"],constructor:function(){this.defaultColumns=[];this.autoAddAllModelFieldsAsColumns=true},withDefaultColumns:function(c){if(a.isArray(c)){this.defaultColumns=this.defaultColumns.concat(c)}return this},withSortableColumns:function(c){this.sortable=c;return this},shouldAutoAddAllModelFieldsAsColumns:function(c){this.autoAddAllModelFieldsAsColumns=c;return this},build:function(d){var e=a.Array.map(this.defaultColumns,function(g){if(a.isString(g)){return Rally.ui.grid.FieldColumnFactory.getColumnConfigFromField(d.getField(g),this.sortable)}return g},this);if(this.autoAddAllModelFieldsAsColumns){var c=this._buildModelColumns(d,this.defaultColumns,e);e=e.concat(c)}this._removeHiddenColumns(e);return this._stripTagsFromColumnText(e)},_removeHiddenColumns:function(d){for(var c=d.length-1;c>0;c--){var e=d[c];if(e.modelField&&e.modelField.hidden){a.Array.erase(d,c,1)}}}
Not sure what other guidance I can provide to help locate this issue.
The code was a bit large, so I started to do some divide and conquer before I posted it and I found the cause in my code, though probably not the root cause:
In my columnCfgs when adding the rallygrid, I had a trailing ',' on the last entry.
The really annoying thing is this works in all browsers locally, but only fails in IE on Rally with a super obscure error, so its really hard to chase down...even my JavaScript syntax highlighter did not warn me...
I suspect this is actually a problem in either Rally or EXT-JS code where IE is just really finicky...

Resources