Concrete5.8 how to make tranlsation of the database values? - translation

In Concrete5.8 how to make translation of the database values? For say i have table types.. and my site is in 2 languages now the values of the types field i need the translation in both language so how is this possible in here? As in old 5.6 version package was available for this which was working fine for db translation but what for new version ?
For example i have bycycle which types are dynamic for example say "sports" which will be diff. for dif. language and types is to be dynamic so i have to manage it with database.. So how can i get diff. translations for it
Can anyone please help me

Related

Non-unicode columns using Entity Framework 4

I am very new to EF so my descriptions may not make sense. Please ask me to clarify anything and I'll do my best to find the answer. In an existing application we are using EF4. 95% of our string columns in our db are varchar, but we do have 5% being nvarchar. In the edmx file, I see the columns have the proper Unicode property set to true or false. Then we use .tt file to generate our entity classes. The problem is that the generated queries are trying to convert everything to unicode which is obviously slowing down all of our queries.
I found the following answers here but I don't believe they will help me. The first is using ColumnAttribute but from what I can see, this was not available until v4.1. The second seems like it overrides on a global level (although I don't understand where). Because we do have some nvarchar columns, I don't think this will work either. I've also seen use of AsNonUnicode() method. I have not fully researched if this is available in v4 because that seems like it needs to be used specifically every time we send a query. This is a large application so this would be a huge undertaking. Are these my only options here? Am I missing something? Any advice is appreciated.
Entity Framework Data Annotations Set StringLength VarChar
EF Code First - Globally set varchar mapping over nvarchar

Parsing field name using Crystal Reports

I have a customer who really wants to keep a very long naming convention during a migration to a new database. The new database uses Crystal Reports for reporting. I have gotten an ok to shorten the naming convention somewhat to "shortened name-date" with all of the other pertinent information parsed out into new fields.
However, one of the users who does a lot of the reporting has now said that one of the most tedious parts of her job was parsing out the old names so she could have a simple, high level, parent name for executive reports. With the new naming convention, she will still need to parse the field to get just the shortened name as her executive-level parent name. If I can't manage to get the ok to drop the date from this field, can Crystal reports be used to parse the field at the "-" similar to parsing the data using Excel? What I'm looking for is that her reports would have a formula that generates the executive-level short name behind the scenes so she doesn't have to think about it.
The date already exists in a date field, so parsing out the date from the name would not change other report functionality. Ideally, I would want to enter the data already separated out and concatenate fields per each user's particular needs, but I may not be able to do. Any info would be much appreciated.
Thank you.
I think you are looking for this...
Split({fieldname},"-")[1]

Should I use a rails integer id for an imported public data table that uses fixed length strings for id?

I need to use a public government data table, imported via csv as a table in my rails application (using postgresql). The table in question uses a fixed length 12 digit numeric string (often with at least one leading zero) as its primary key. I feel as if I have three choices here:
Add a rails-generated integer primary key upon import
Ask rails to interpret the string as an integer and use that as my primary key.
Force rails to use a string as the primary key (and then, subsequently as the foreign key in other associated tables as well)
I'm worried about doing choice 1 because I will likely need to re-import this government data wholesale at least yearly as it gets updated in order to keep my database current. It seems like it would be really complicated to ensure that the rails primary keys stay with the correct record after a re-import if records have been added and deleted
Choice 2 seems like the way to go, (it would solve the re-import problem) but I'm not clear how to go about it. Is it as simple as telling rails to import that column as an integer?
Choice 3 seems doable, but in posts I've read elsewhere, it's not a very "railsy" way to go about it.
I'd welcome any advice or out and out solutions on this.
Update
I ended up using choice 1, and it was the right choice. That's becauseI am new to rails, and had thought I'd be doing some direct, bulk import (on the back end, directly into Postgresql) would leave me with the problem I described above. However, I looked through Railscast 369 which explains how to build csv import capabilities into your application as an end-user function. It's remarkably easy and that's what I did. As a result of doing things this way, the application does a row-by-row import, and can thus have the appropriate checks built in at that level.

How to sort by JSF label in sortable datatable

I am showing a (language specific) label for values in a column. The column is sortable and the JSF label is different from the database value. I am using a primefaces datatable with pagination.
How can I sort by label and not by the database value? Is there any kind of translation possible so my JPA criteria knows about the different value?
Sorting it in-memory is not an option since the dataset might be huge and I only want to display a subset (pagination size is e.g. 10 items per page)
I believe it is not possible to achieve what you are looking for.
Your database cannot sort unless it knows what the value is. You can translate the label and sort after loading from database, but you dont want in-memory sort due to resource constraints.
The best solution would be to implement localization solution in database. Then your db could look up the translation for each label and apply sorting. Personally I believe this is the way to go when localizing any application as it allows for easy translations by end-users. You could even write Java resource bundle provider that does db lookups instead of referring to filesystem bundles.
There's an example of lazyload here:
Part 4 – Lazy Loading and Pagination with JSF 2.1 / Primefaces 3.5 DataTable and Form validation.
You can write a custom sort following the method from that link.

User-adjustable data structures

assume a data structure Person used for a contact database. The fields of the structure should be configurable, so that users can add user defined fields to the structure and even change existing fields. So basically there should be a configuration file like
FieldNo FieldName DataType DefaultValue
0 Name String ""
1 Age Integer "0"
...
The program should then load this file, manage the dynamic data structure (dynamic not in a "change during runtime" way, but in a "user can change via configuration file" way) and allow easy and type-safe access to the data fields.
I have already implemented this, storing information about each data field in a static array and storing only the changed values in the objects.
My question: Is there any pattern describing that situation? I guess that I'm not the first one running into the problem of creating a user-adjustable class?
Thanks in advance. Tell me if the question is not clear enough.
I've had a quick look through "Patterns of Enterprise Application Architecture" by Martin Folwer and the Metadata Mapping pattern describes (at quick glance) what you are describing.
An excerpt...
"A Metadata Mapping allows developers to define the mappings in a simple tabular form, which can then be processed bygeneric code to carry out the details of reading, inserting and updating the data."
HTH
I suggest looking at the various Object-Relational pattern in Martin Fowler's Patterns of Enterprise Application Architecture available here. This is a list of patterns it covers here.
The best fit to your problem appears to be metadata mapping here. There are other patterns, Mapper, etc.
The normal way to handle this is for the class to have a list of user-defined records, each of which consists of list of user-defined fields. The configuration information forc this can easily be stored in a database table containing the a type id, field type etc, The actual data is then stored in a simple table with the data represented only as (objectid + field index)/string pairs - you convert the strings to and from the real type when you read or write the database.

Resources