IntegerColumn not available in GWT? - gwt

I am new to GWT and I am trying to make a simple table in GWT.
The table has string and integer types.
However, GWT has only TextColumns which returns only Strings.
But there is no "IntegerColumns" which returns Integers, so what's the easiest way to design it ?
Right now I convert Integers to Strings but this solution is not suitable for sorting the columns.

Why don't you use Grid? Grid is able to store objects as rows;
For example you want to have a look Grid
And maybe you'd like to see GXT samples

Related

Adding custom comparator for integer sorting in Nattable

I tried sorting header layers, which is working fine for Text but not for Integers and dates - so I want to create a custom comparator for that.
First a comment on your issue. Sorting of Numbers and Dates is working pretty fine in NatTable. In fact the sorting of all Comparable data types is working fine with the DefaultComparator applied by the DefaultSortConfiguration. But to make it work correctly, you need to register the according data type converters as shown in various NatTable examples. Without the converter all data in NatTable is treated as String, which results in "incorrect" sorting.
Second to your question. You can register a custom comparator like this:
configRegistry.registerConfigAttribute(
SortConfigAttributes.SORT_COMPARATOR,
new MyCustomComparator(),
DisplayMode.NORMAL,
CUSTOM_COMPARATOR_LABEL);
So you need to register a Comparator for the configuration attribute SortConfigAttributes.SORT_COMPARATOR and an according label.
But if you do not have a matching type converter, you will need to compare Strings. So IMHO you need to register a DisplayConverter and sorting works as intended without the need for a custom comparator.

PostgreSQL: Is there a way to have an integer column always output in hexadecimal?

I'd like to store integers in a table in such a way that selection from that table always output those integers in hexadecimal, without having to call to_hex. I tried creating a domain with a cast, only to learn that casts of domains are noops. I suppose this could be done with a view, but do I have any other options?
No, there is no facility to do that. A view sounds like a good solution.

Convert single row to multiple rows in tableau based on some delimiter

I had a column with data as => a,b,c,d,e
I need to display(in worksheet) as
a
b
c
d
e
Note: need to be split based on ','
Do I need to to use calculation field or any other approach is there???
Went through split function but is used to generate new columns, I want to store in a single column.
is this something that could work? (you said it's just a matter of visualization without altering data, right?)
I just created a CF like this:
REPLACE(value,",","
")
EDIT: since it seems that your need involves a data manipulation (you want multiple row instead of one) I think that the best way is using the split function even though, as you noticed, it will create new columns.
Otherwise if it's just a visualization need, you could use the solution posted before which shows your data ("a,b,c,d,e") in the same cell with the same horizontal alignment, just replacing commas with CR

Scala: wrapper for Breeze DenseMatrix for column and row referencing

I am new to Scala. Looking at it as an alternative to MATLAB for some applications.
I would like to program in Scala a wrapping class in order to be able to assign column names ("QuantityQ" && "QuantityP" -> Range) and row names (dates -> Range) to Breeze DenseMatrices (http://www.scalanlp.org/) in order to reference columns and rows.
The usage should resemble Python Pandas or Scala Saddle (http://saddle.github.io).
Saddle is very interesting but its usage is limited to 2D matrices. A huge limitation.
My Ideas:
Columns:
I thought a Map would do the job for colums but that may not be the best implementation.
Rows:
For rows, I could maintain a separate Breeze vector with timestamps and provide methods that convert dates into timestamps, doing the numbercruncing through Breeze. This comes with a loss of generality as a user may want to give whatever string names to rows.
Concerning dates I use nscala-time (a scala wrapper for joda)?
What are the drawbacks of my implementation?
Would you design the data structure differently?
Thank you for your help.

iOS : Storing a table of rows and columns

Am just mulling over what's the best way i.e. data structure to store a data that has several rows and columns. Shoudl I store it as :
1. an array of arrays?
2. NSDictionary?
or is there any grid-like data structure in iOS where I can easily fetch any row/column with ease from the data structure? For example, I must be able to fetch the value in 3rd column in row 5. Currently, say, I store each row as an array and the store these arrays in another array (so an array of arrays, say), then to fetch the value in column 3 in row 5, I need to fetch the 5th row in the array of arrays, and then in the resulting array, I need to fetch the 3rd object. Is there a better way to do this? Thoughts please?
then to fetch the value in column 3 in row 5, I need to fetch the 5th
row in the array of arrays, and then in the resulting array, I need to
fetch the 3rd object. Is there a better way to do this?
An array of arrays is fine for the implementation, and the collection subscripting that was recently added to Objective-C makes this easier -- you can use an expression like
NSString *s = myData[m][n];
to get the string at the nth column of the mth row.
That said, it may still be a good idea to create a separate class for your data structure, so that the rest of your code is protected from needing to know about how the data is stored. That would also simplify the process of changing the implementation from, say, an array of arrays to a SQLite table or something else.
Your data storage class doesn't need to be fancy or complicated. Here's a first pass:
#interface DataTable
- (id)objectAtRow:(NSInteger)row column:(NSInteger)column;
- (void)setObjectAtRow:(NSInteger)row column:(NSInteger)column;
#end
I'm sure you can see how to implement those in terms of an array of arrays. You'll have to do a little work to add rows and/or columns when the caller tries to set a value outside the current bounds. You might also want to add support for things like fast enumeration and writing to and reading from property lists, but that can come later.
There are other ways of doing it, but there's nothing wrong with the method you are using. You could use an NSDictionary with a key of type NSIndexPath, for example, or even a string key of the form "row,col", but I don't see any advantage in those except for sparse matrices.
You can either use an array of arrays, as you're doing, or an array of dictionaries. Either is fine, and I don't think there's any preference for one over the other. It all depends on which way is most convenient for you to set up the data structure in the first place. Accessing the data for the table view is equally easy using either method.