From my UI, I pass some object attributes to the server.
So I pass an object say 'filter' as below;
{
attr1: 'val1',
attr2: 'val2',
attr3: ['val1','val2'],
}
My question is while I get this simplistic view of what gets passed on the client-side (using Firebug/Chrome Developer tools), I am looking at a similar thing in the Eclipse Debug View.
I have tried using Watch/Inspect in the Debug view, but it seems to be displaying a lot of additional info which I do not need.
So it displays HashMap as 'table', then says before, after, etc OR in short, I have to keep expanding lot of stuff just to see simple data !!
My question is how do I get to see just the attributes like attr1, attr2, attr3, etc
You can use Display view in eclipse. there you can write and evaluate any expression.
This you can enable from Windows-> Show View -> Other -> Search for Display.
Hope this help
You can use Expressions view of Eclipse while debugging. In Expressions view you can get the value of all your attributes directly e.g. mayMap.getValue("attr1")
Related
First of all I must say I'm new to both Android dev and Java.
I'm trying to find a list of the tags that are used for logging in Android studio.
The examples I've been researching include using:
Log.i(tag:"Info","message");
Log.i(tag:"Values","another message");
Log.i(tag:"Seekbar changed", "and another message");
I tried for the past couple of hours to find a document online, that has a table to describe the reserved tags for View objects, any help will be appreciated.
There is no fixed list of "reserved tags" one can use for logging in Android. You decide for yourself which tags you want to use and what additional information about the state of your objects or primitive types you want to display.
The Log class has six different log levels (debug, error, info, verbose, warn and wtf [What a Terrible Failure]) and corresponding (static) methods (Log.d, Log.e, Log.i, Log.v, Log.w and Log.wtf) each of which you call with two string parameters, one string parameter and one Throwable or two string parameters and one Throwable.
The most commonly used is probably the variant with two string parameters, one parameter for a tag (chosen by you) and one parameter for a message (also chosen by you). See this post for information about which level to choose.
During debugging I often use commands like this one:
Log.e(String.valueOf(myIntVariable), String.valueOf(myOtherVariable));
Let me explain the reason for using the Log class like this. I use the error level because it will give you red entries in the LogCat output (inside an IDE, e.g. Android Studio), and the same IDE will also let you filter out all logs below the error level. However, this is for debugging only; make sure to get rid of those log commands before your app enters production.
Instead of using logs in the way I do, you can also use breakpoints in the debug mode. I guess it is mainly a question of taste if you prefer one or the other. Toasts would be third option (with more boilerplate though).
If you use logs a lot in your code, it makes sense to use real tags. Either you define a string called TAG (or something else) in your class, or you put the name of the containing method as the first parameter. This will give you a sense of the order by which your methods are being called. You can also use other tags as well, and it doesn't have to follow a specific convention either (though you should have a system for it to make sense of it).
I am debugging a program, and once I step in an instruction, I get a list of variables in the Variables view, or if I hold the mouse on the variable, the its value is shown.
Now, I have an object that could possibly have many references to other objects, which, in turn, have their own attributes that contain other objects and so on. The search space could become very large. I would like to find where these values could be by searching the object attributes by value. Eclipse already searches these objects by attribute.
I tried EVars plugin, but it doesn't seem to be still compatible with Eclipse 4.4. Any other tools or recommendations on how to do it?
Thank you very much!
While debugging you can use the "Display" window where you can write pieces of code and "execute" them with inspect (highlight the code -> right click -> inspect).
In that window you have access to all variables of the breakpoint's context.
You could use some java 8 streams snippets to filter your objects.
https://help.eclipse.org/neon/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2Freference%2Fviews%2Fdisplay%2Fref-display_view.htm
https://help.eclipse.org/neon/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2Ftasks%2Ftask-evaluating_expressions.htm
I'm looking for a simple example of how to use GWT editor framework for editing a simple form. While there are examples out there, like this, they emit any UI related parts, such as showing how everything fits together, how form validation errors could be displayed, etc.
Lets say I wanted to create a simple form for editing a Person, with textboxes for first name, last name, and email, and validation rules to make sure all fields were filled in, showing errors in case of validation errors. How can this be done with GWT editors?
Not a complete example but have you looked at http://www.gwtproject.org/javadoc/latest/com/google/gwt/editor/ui/client/ValueBoxEditorDecorator.html for showing the error?
I think we found it hard to extends so copy and pasted it, shame and us, and changed for our needs.
It is a nice pattern though, we also encapsulated the HTML for labels, mandatory indicators, help text etc in a similar way.
I have restricted some pages like admin pages from not getting visible in search results.Using the below code
map.put("group.1_group.1_property","**jcr:content/cq:template**");
map.put("group.1_group.1_property.1_value","**/apps/MyApp/templates/SampleTemplate**");
map.put("group.1_group.1_property.and","true");
map.put("group.1_group.1_property.operation","unequals");
final Query finalQuery = builder.createQuery(PredicateGroup.create(map),
session);
which means it is template specific search filtration,means that Im telling the query builder not to display those pages having the above specified template .However the drawback is that, in future if we want to restrict more pages, those pages also must be mapped to the above template. So instead of specifying the template in the map, can we put any other property in the map, so that search restriction is not template specific.
Thanks,
Balaji
What other properties do your pages have available (specifically, the admin pages)? For example, if you have a specific property that you add to your admin pages, or other pages that you could sort on, that could work. On one site I worked on, we had a property we put into certain content items called hideInNav. So along those lines, this is how I would do it:
map.put("group.1_group.1_property","jcr:content/hideInNav");
map.put("group.1_group.1_property.1_value","/content/somepath/you/want");
map.put("group.1_group.1_property.and","true");
map.put("group.1_group.1_property.operation","unequals");
I hope that helps to make sense of it. Am I understanding it correctly? If not, please clarify and I'll try to help more.
---------------EDIT-----------------------
If you don't have a custom property, but you know the path these pages are located, and maybe a default property they all have in common (like a jcr:title), you could try doing that instead. Like this:
map.put(1_group.0_path","/content/yoursite");
map.put(2_group.0_type","cq:Page");
map.put(3_group.fulltext","test text");
map.put(3_group.fulltext.relPath","jcr:content/#jcr:title");
You can see how this would run on a local query debugger when you have CQ running:
http://localhost:4502/libs/cq/search/content/querydebug.html?_charset_=UTF-8&query=http%3A%2F%2Flocalhost%3A4502%2Fcontent%2Fsalesportal%2Fen%2Fmobile%2Fresources.assets.get.json%3Fp.limit%3D7%0D%0A1_group.0_path%3D%2Fcontent%2Fyoursite%0D%0A2_group.0_type%3Dcq%3APage%0D%0A3_group.fulltext%3Dtest+text%0D%0A3_group.fulltext.relPath%3Djcr%3Acontent%2F%40jcr%3Atitle
Hopefully that's more helpful.
EDIT #2
This is a summary of both my answers, and will hopefully answer your last comment as well.
In order to more fully answer your question (since you're still not quite getting what you want), I dug a little deeper to find the information you need. Just as a reference, any time you're doing XPath querying, this is a great tool to look at: JCR Query Usecases - jboss
Anyway, you said that you were getting results that didn't include items that were missing the 'hideInNav' property. Here is how you can get those results, specifically:
map.put("1_group.0_path","/content/yoursite");
map.put("2_group.0_type","cq:Page");
map.put("3_group.1_property","jcr:content/hideInNav");
map.put("3_group.1_property.1_value","not");
map.put("3_group.1_property.operation","not");
This way, you're searching in the path you want, getting the type of result you want (cq:Page, if that is what you're actually looking for), and you're getting the results that DO NOT HAVE the property 'hideInNav'.
In Visual Studio, there is a feature to add a custom visualizer to the IDE. This allows you to write your own dialog showing the contents of complex objects at run-time (i.e. it might take a Person record and show the forename, surname and date of birth).
I can't find this feature in Eclipse/Java, but was wondering if it might be called something different?
Thanks,
Rich
The Feature is called Detail Formatter in Eclipse: Details
I don't know about a special dialog, but in general a custom implementation of .toString() do the trick.
The closest thing that you can get in Eclipse is Variables View and Expressions. view. You can also Add a Watch Expression in variables view to track any particular object.