Concrete form bean for html select - struts

I have used <html:select> in one of my jsp pages with multiple selection. What varibles, for storing the selection, should i have in the form bean associated with this list?

Straight from the documentation:
This tag operates in two modes, depending upon the state of the
multiple attribute, which affects the data type of the associated
property you should use:
multiple="true" IS NOT selected - The corresponding property should be a scalar value of any supported data type.
multiple="true" IS selected - The corresponding property should be an array of any supported data type.
(emphasis mine)

Related

can i omit atom:link in odata feed with null or empty relation

Am i correct in reading that if an element is null or a collection empty and the request did not specify to inline ("m:inline") the attached property that it is then acceptable to omit the atom:link entry entirely?
I am one of the two core developers on the POData project over at https://github.com/algo-web/POData and we'd appreciate a third party checking our understanding of the OData specification. The specific extracts are as follows
2.2.6.2.2 Entity Type (as an Atom Entry Element)
In OData 3.0, responses to retrieve requests, as specified in
RetrieveEntity Request (section 2.2.7.2.2), MAY represent the URI that
identifies the association between the entity represented by the
response payload and a related entity (or collection of entities) as
an atom:link element that is a child element of the atom:entry
element. If present, each atom:link element MUST contain a rel
attribute with the value defined by the relAssociationlLinkURI rule
shown in the grammar defined in the listing that follows. The element
MUST also contain an href attribute with a value equal to the URI that
identifies the association represented by the atom:link element (that
is, the NavigationProperty on the EntityType).
and
2.2.6.2.6.1 Inline Representation
If NavigationProperty represents an EntityType instance and that
instance is null, an empty m:inline element MUST appear under the
atom:link element that represents NavigationProperty. If
NavigationProperty represents a collection of entities and the
collection is empty, an m:inline element with a nested atom:Feed
element with no atom:Entry subelements MUST appear under the atom:link
element that represents NavigationProperty. In both cases, the
presence of the m:inline element indicates that NavigationProperty has
been expanded but that no content was associated with it.
Both sections from "2.2.6.2 AtomPub Format"
Am I correct in reading that if an element is null (or a collection is empty) and the request did not specifically request that the attached property be inlined, then it's acceptable to leave the atom:link entry for that specific property out completely?
In other words, if an element is null/empty and not specifically requested (by asking that it be inlined), then I can simplly leave its corresponding link out?

How to add text to the _content field in a Solr index for a Sitecore implementation?

This is for a Sitecore 7.5 - Solr 4.7 implementation. I would like to be able to modify the text that is stored in the _content field in Solr. I believe that somehow that Sitecore aggregates all of the content fields for an item in the _content field in the index. (I think that is correct) At index time I would like to be able to write my own code that could potentially modify the text that is stored in the _content field in Solr. Is this possible? Any ideas how I would go about this?
_content is a computed field, which means the value is resolved at the point that the item is crawled. You'll see the computed field is defined in your config:
<field fieldName="_content" returnType="string" type="Sitecore.ContentSearch.ComputedFields.MediaItemContentExtractor,Sitecore.ContentSearch">
<mediaIndexing ref="contentSearch/indexConfigurations/defaultSolrIndexConfiguration/mediaIndexing"/>
</field>
I recommend decompiling the class specified in the type attribute to see what it does. Then you can create your own computed field class (or inherit from that one), and replace the type attribute.
Computed fields are really quite simple to work with. They implement IComputedIndexField which requires a ComputeFieldValue method. The method accepts an argument of type IIndexable (in most cases the concrete class is an Item) and is called every time an item is crawled.
So in the ComputeFieldValue method you could cast the Iindexable to an Item, then return a concatenated string of all the field values you want to include from that item.
See here for more on computed fields:
http://www.sitecore.net/learn/blogs/technical-blogs/john-west-sitecore-blog/posts/2013/03/sitecore-7-computed-index-fields.aspx
From what I understand, you can add another (separate) _content field with your own IComputedIndexField implementation. The resulting values from all added fields with the same name are aggragated.
See also: https://kamsar.net/index.php/2014/05/indexing-subcontent/ and https://andrewwburns.com/2015/09/03/appending-to-the-_content-field-in-sitecore-search-7-2-and-7-5/

EA Script for Defined Tag Types

I would like to create an EA Script to configure (add/edit/delete) the Defined Tag Types (Settings > UML Types > Tagged Value Types) similar to what is done manually here.
I did not found any useful information about the object storing the Defined Tag Types. Any help?
This configuration is not available in EA's API. If you want to make changes to it programmatically, you'll have to manipulate the project database directly.
The "Tagged Value Types" are stored in the t_propertytypes table. Please note that tagged value types defined in an MDG Technology are not listed here, this table only contains those that are shown in the "UML Types" dialog.
Looks like that you can programmatically only read the Tagged Values and change their value. Apparently you cannot add/remove Tagged Values.
Here is a part of the corresponding API. To add/remove a tagged value, you have to go directly to the DB.
TaggedValue Methods:
Method
Type
Notes
GetAttribute(string propName)
String
Returns the text of a single named property within a structured Tagged Value.
Parameters:
· propName: String - the name of the property for which the text is being returned
GetLastError()
String
Returns a string value describing the most recent error that occurred in relation to this object.
HasAttributes()
Boolean
Returns true if the Tagged Value is a structured Tagged Value with one or more properties.
SetAttribute(
string propName,
string propValue)
Boolean
Sets the text of a single named property within a structured Tagged Value.
Parameters:
· propName: String - - the name of the property for which the text is being set
· propValue: the value of the property
Update()
Boolean
Updates the current TaggedValue object after modification or appending a new item.
If false is returned, check the GetLastError function for more information.

How to use GtkTreeView correctly

I am using a TreeView with a ListStore as model. When the user clicks on a row I want to take some action but not using the values in the cells, but using the data I created the row from...
Currently I have the TreeView, the TreeModel (ListStore) and my own data (which I ironically call model)..
So the Questions are:
Is it "right" to have a model - an object representation of the data I want to display and fill a ListStore with that data to display in a TreeView, or would it be better to implement an own version of TreeModel (wrapping my data-model) to display the data?
And also:
If someone double-clicks in a row I can get the RowActivated event (using C#/Gtk#) which provides a Path to the activated row. With that I can get a TreeIter and using that I can get the value of a cell. But what is the best practice to find the data object from which the row was constructed in the first place?\
(Somehow this question got me to the first one - by thinking would getting the data object more easy if I tried to implement my own TreeModel...)
It's quite awkward/difficult to implement TreeModel, so most people simply synch the data from their "real" model into a TreeStore or ListStore.
The columns in the store do not have to match the columns in the view in any way. For example, you can have a column that contains your real managed data objects.
When you add a cellrenderer to a TreeView (visual) column, you can add mappings between its properties and the columns of the store. For example, you could map one store column to the font of a text cellrenderer, and another store column to the text property of the same cellrenderer. Each time the cellrenderer is used to render a particular cell, the mappings will be used to retrieve the values from the store and apply them to the properties of the renderer before it renders.
Here's an example of a mapping:
treeView.AppendColumn ("Title", renderer, "text", 0, "editable", 4);
This maps store column 0 to the renderer's text GTK property and maps store column 4 to the editable property. For GTK property names you can check the GTK docs. Note that the example above uses a convenience method that adds a column, adds a renderer to it and add an arbitrary number of mapping via params. To add mappings directly to a column, for example a column with multiple renderers, pack the renderers into the column then use TreeViewColumn.AddAttribute or TreeViewColumn.SetAttributes.
You can also set up a custom data function that will be used instead of mappings. This allows you to set the properties of the renderer directly, given a TreeIter and the store - so, if all the data you want to display is trivially derived from your real data objects, you could even have your store only contain a single column of these objects, and use data funcs for all the view columns.
Here's an example of a data func that does exactly what the mapping example above does:
treeColumn.SetCellDataFunc (renderer, delegate (TreeViewColumn col,
CellRenderer cell, TreeModel model, TreeIter iter)
{
var textCell = (CellRendererText) cell;
textCell.Text = (string) model.GetValue (iter, 0);
textCell.Editable = (bool) model.GetValue (iter, 4);
});
Obviously data functions are much more powerful because they enable you not only to use properties of more complex GTK objects, but also to implement more complex display logic - for example, lazily processing derived values only when the cell is actually rendered.

property Access strategies in nhibernate

What are the access strategies that I can use in the attribute access of the nhibernate xml?
Can someone point me the possible values to be used in it?
A nice tutorial would be very appreciated.
Thanks
Property Access strategies are described in the reference documentation under 5.1.9. Property.
The access attribute lets you control how NHibernate will access the value of the property at runtime. The value of the access attribute should be text formatted as access-strategy.naming-strategy. The .naming-strategy is not always required.
Access strategy can be one of:
property The default implementation. NHibernate uses the get/set accessors of the property. No naming strategy should be used with this access strategy because the value of the name attribute is the name of the property.
field NHibernate will access the field directly. NHibernate uses the value of the name attribute as the name of the field. If you want the name of the property and not the field to be what the consumers of your API use with HQL, then a naming strategy is needed.
nosetter NHibernate will access the field directly when setting the value and will use the Property when getting the value. A naming strategy is required because NHibernate uses the value of the name attribute as the property name and needs to be told what the name of the field is.
ClassName If NHibernate's built in access strategies are not what is needed for your situation then you can build your own by implementing the interface NHibernate.Property.IPropertyAccessor. The value of the access attribute should be an assembly-qualified name that can be loaded with Activator.CreateInstance(string assemblyQualifiedName).
Naming strategy can be one of:
camelcase The name attribute is converted to camel case to find the field.
camelcase-underscore The name attribute is converted to camel case and prefixed with an underscore to find the field.
lowercase The name attribute is converted to lower case to find the Field.
lowercase-underscore The name attribute is converted to lower case and prefixed with an underscore to find the Field.
pascalcase-underscore The name attribute is prefixed with an underscore to find the field.
pascalcase-m The name attribute is prefixed with the character m to find the field
pascalcase-m-underscore The name attribute is prefixed with the character m and an underscore to find the field.