How do I debug work of 2sxc if Visual Query works perfectly during debug, but cshtml code can't access data? - debugging

I've edited some existing visual queries of Blog 4.0 application and when I was debugging it - it worked perfectly. But then on page it stopped working. Any attempt to use key with Data like Data["Posts"] raises System.Collections.Generic.KeyNotFoundException. App.Query["Blog Posts List"]["Posts"] returns something, but any attempt to access its fields raises another exception (don't remember the name, but it said that there's no such member inside that object).
I didn't rename queries, I didn't change application settings. I just edited logic of 2 queries. I renamed 1 wiring endpoint name across 3 queries in whole chain.
How do I debug it? How can I see what does cshtml receive from database so I don't guess and put my crystal ball away?

In general, App.Query["Name of Query"] will get you the streams of data. You usually need to convert it using AsDynamic() or AsList() to something you can work with.
This should help some; What is Data?

If you're just running into problems with field names, you probably forgot the AsList or AsDynamic, just like #accuraty-jeremy mentioned.
For real debugging, go to insights, you'll see what happens - but in your case it probably won't help, because your working with an object that's not dynamic (so doesn't support .FirstName) until you AsList/AsDynamic it.

My bad: I confused two different files - _List.cshtml and _List Paging.cshtml. So I was searching for an error in the code of wrong file.

Related

ClaimCenter Web PCF files UI Labels

I’m trying to automate building of a mapping document between claimcenter gui through to dB. I’ve made some success in this space using the data dictionary however I’ve become a bit stumped when it gets to getting labels for the UI fields
I’ve been looking at the web pcf files and I can see where labels are mentioned for UI fields, for example
label="DisplayKey.get(" VehicleIncident.Audatex.AudatexLV.AudatexReference ")"
I assume this is making a call someplace to get the description and populate it?
Would anyone know where this might be and perhaps where I should look to next?
In properly configured guidewire studio, those should be properly resolved on CRTL+left mouse button on the label in the DisplayKey.get function call.
If they are not then it is resolving them to
modules\configuration\config\locale\display_en_US.properties
If your locale is different then en_US might be something else.

Issues with Swashbuckle

I have a WebAPI service, written in ASP.NET (not Core), for which I am trying to generate documentation, in order to allow other devs to use it. I found Swashbuckle, and installed it. Then, since I also use OData for some of my services, I added Swashbuckle.OData. Then, I modified the CustomProvider setting in SwaggerConfig to use the ODataSwaggerProvider. I also set ResolveConflictingActions(apiDescriptions => apiDescriptions.First()) because I had a few Actions with the same URL path, differing only by query string (I'll need to address that later). So far so good.
Then, I tested it. I started my web app, then added "/swagger/" to then end. I got a message stating that it was loading the resource info. However, after several minutes, I got a browser error debug popup, stating "Error: Not enough storage is available to complete this operation." It asks if I want to debug, and if I do, it takes me to the debugger in IE (the browser I'm using). The only code in the stack is either from jquery-1-8-0-min-js or swagger-ui-min-js (this part confuses me, as there is no "swagger-ui-min-js" file in my project; I'm assuming it's embedded in the dll). There is no part of the stack trace that floats back up to my code, and all the code there is minified, so it's very difficult to debug.
However, I do know that it is at least partially working, as three of the controllers do show up in the resulting page after you close the error popup. You can navigate through them, and all the GETs, POSTs, PUTs, and DELETEs seem to be there, and you can test them.
Is it the case that whenever you navigate to the "/swagger/" url, Swagger hits all the URLs in the service, in order to generate the documentation? I'm wondering if maybe it is hitting an action that is taking a particularly long time to run, or possibly its generated documentation is taking too much disk space (I have plenty of space on my disk, but maybe it is referring to RAM?).
Anyway, even if that were not an issue, how can I get it to generate something, some kind of document file, that I can send off to someone? I see no new files added to my folders, so it would seem that it re-does the whole process every time you navigate to the swagger URL.
When I tried the Chrome browser, I no longer had the issue (I was using IE11 before). Not sure what the problem was, but this was the workaround.

Why does a "on a non-object" error occurs with this extension in Magento?

I'm having an Issue with a blog extension in Magento CE 1.6.2.0.
I installed this extension: Neotheme_nBlog.
I created an entry in the administrator.
Then I went to http://www.example.com/index.php/blog/ to see the recently created entry.
What I saw was an error like this:
Fatal error: Call to a member function getName() on a non-object
in /home/example.com/public_html/app/design/frontend/default/caramel/template/magicat/left.phtml
I searched in google the terms: "template/magicat/left.phtml" getName and what I only found is sites having this issue, but no support at all.
Please note: I know what does that error mean in PHP ("unfortunately" I'm not new at that). What I don't understand is what's happening with such [NON/null] object and how to fix it without killing a dozen of kittens.
Question: What can I do to solve it? What is the nature of the error, regarding Magento?(again: not PHP).
Notes: The Magento site (http://magento.stackexchange.com) is somewhat poor and strict to bring support of such nature, so asking there is not an option.
Edit (as answer to comment, and to clarify):
Neotheme is still not responding the request.
Don't know what should I look on such file (instances are not initialized there, but only accessed).
I'm using the default theme (caramel), which has esthetical changes (does not have layout changes).
It's hard to say without seeing your system specifically, but on this
template/magicat/left.phtml
It looks like you've added a template named magicat/left.phtml to your system -- either via an extension or custom development. Somewhere in this file PHP's called getName on a non-object. There's a variety of reasons this could be happening, and without seeing the specific line of code PHP's complaining about in your system, it's hard to say. It'd also be helpful to know if magicat is part of the extension or something else.
The most common reason for this error in a template is code that relies on a block being there that's been removed by another extension (eitehr via layout XML or observer methods)
$this->getLayout()->getBlock('some_block')->getName();
The next most common is people using the registry to communicate between templates and views, but a registry key not being set
Mage::registry('some_item')->getName();
Without knowing the variable and context, it's doubtful anyone will be able to help you.

How to trace CakePHP's inner workflow

Short description
I'm getting used to CakePHP right now and am wondering about how to get more debug-information about what is happening inside the framework.
Let me please explain my situation a little more detailed
As you know CakePHP does a lot for you without putting you into the need to write additional code. One example is the handling of models.
I just created a model User and added validation-rules (no other methods). As described in the API methods like save will just work.
After that I created the needed controller and view to add a new user. When I try to add a user from the view I just receive the flash-message The user could not be created. Please, try again. No validation-violations are flashed.
I also did set the debug-level to 2: Configure::write('debug', 2); but do not receive any errors. The error.log inside \tmp\logs is also empty.
I really do want to learn how to solve those issues in the future.
So what else can I do to debug / display inner processes of cake?
Thank you very much for your help!
DebugKit is an official plugin that gives you lots of information on the request, queries and variables produced by Cake:
https://github.com/cakephp/debug_kit
You can also use trace() and other methods in the Debugger to show what is being executed in the background:
http://book.cakephp.org/2.0/en/development/debugging.html
Use a PHP IDE with an integrated debugger. That will allow you to follow execution line by line as it is executed and even inspect variable values as you go. Netbeans is a free one.

Core Data Migration error message "'Model does not contain configuration 'XYZ'.'"

I have a Managed Object Context to which I add two different SQLite stores. I use Configurations in the Mananged Object Model to assign certain entities to one store and other entities to the other. The Configurations are called "UserDB" and "MainDB".
Everything works okay until I try to use automatic migration. After creating a new Managed Object Model version, and adding a new attribute to one of the entities in the UserDB Configuration, I get an exception when adding the old version store (for the UserDB related store) to the store coordinator: 'Model does not contain configuration 'UserDB'.' I can find no hits for this error on Google. Anyone out there using multiple stores with Configurations? Anyone have an idea what I might be doing wrong?
The stack looks like this:
objc_exception_throw
-[NSManagedObjectModel isConfiguration:compatibleWithStoreMetadata:]
-[NSStoreMigrationPolicy sourceModelForStoreAtURL:metadata:error:]
-[NSStoreMigrationPolicy(InternalMethods) _gatherDataAndPerformMigration:]
-[NSPersistentStoreCoordinator addPersistentStoreWithType:configuration:URL:options:error:]
-[MyAppDelegate persistentStoreCoordinator]
This looks like a bug with migration+configurations. I was able to work around the problem by going through the same motions and passing nil for configuration when calling addPersistentStoreWithType. The migration happens, and then I can make a new persistent store coordinator and add the stores again with the proper Configuration string arguments.
This is the second configuration related bug I've run into. Not a well tested feature apparently.
I had the same problem. The fact pattern was identical and the error message the same. It turned out, however, to be the result of my own mistake.
Let's say the old model was Blah.xcdatamodel and the new Blah 2.xcdatamodel. I had started making changes to Blah before realising my mistake and creating Blah 2. I then used my version control system (Git) to revert to the old Blah and then recreated Blah 2. Everything looked right. But I must have done something wrong in the reversion process, because when I thought to double check that Blah.xcdatamodel in my current project folder was really the same as Blah.xcdatamodel in the project folder I used to build the previous version of the app (fortunately I always keep a zipped archive of the project folder for each released version as I don't fully trust version control systems), I found that they were in fact different, albeit that they looked identical in XCode. The file size was different, for instance.
I substituted the old Blah into my current project folder, and lo and behold it all went perfectly, without any need for the workaround described by Ken.
I am not saying that Ken had necessarily made a similar mistake, but if you do encounter this message it is at least worth confirming that the model you are migrating from is REALLY the model that was used to create the data in question.

Resources