How to use GWT 2.1 Data Presentation Widgets

Google I/O 2010 – GWT’s UI overhaul javadocs package com.google.gwt.cell.client in 2.1 Eclipse update site for milestone 2 While the code is in bikeshed, add this line to your gwt.xml file: <inherits name=”com.google.gwt.requestfactory.RequestFactory”/> The following examples follow: CellList of TextCells with PageSizePager CellList of TextCells with a SimplePager CellList of TextCells with a SimplePager and … Read more

How to do page navigation for many, many pages? Logarithmic page navigation

Here’s my solution – use “Logarithmic Page Navigation”: This can be achieved by having page numbers distributed logarithmically, according to distance from either the endpoints or the current page. Here’s an example of what I mean: 1 2 3 4 5 6 . 10 . 20 . 30 . 40 . 50 .. 100 .. … Read more

Paging SQL Server 2005 Results

You can use the Row_Number() function. Its used as follows: SELECT Row_Number() OVER(ORDER BY UserName) As RowID, UserFirstName, UserLastName FROM Users From which it will yield a result set with a RowID field which you can use to page between. SELECT * FROM ( SELECT Row_Number() OVER(ORDER BY UserName) As RowID, UserFirstName, UserLastName FROM Users … Read more

How to get distinct results in hibernate with joins and row-based limiting (paging)?

You can achieve the desired result by requesting a list of distinct ids instead of a list of distinct hydrated objects. Simply add this to your criteria: criteria.setProjection(Projections.distinct(Projections.property(“id”))); Now you’ll get the correct number of results according to your row-based limiting. The reason this works is because the projection will perform the distinctness check as … Read more

sorting and paging with gridview asp.net

Save your sorting order in a ViewState. private const string ASCENDING = ” ASC”; private const string DESCENDING = ” DESC”; public SortDirection GridViewSortDirection { get { if (ViewState[“sortDirection”] == null) ViewState[“sortDirection”] = SortDirection.Ascending; return (SortDirection) ViewState[“sortDirection”]; } set { ViewState[“sortDirection”] = value; } } protected void GridView_Sorting(object sender, GridViewSortEventArgs e) { string sortExpression = … Read more

MongoDB – paging

Using skip+limit is not a good way to do paging when performance is an issue, or with large collections; it will get slower and slower as you increase the page number. Using skip requires the server to walk though all the documents (or index values) from 0 to the offset (skip) value. It is much … Read more

Paging with LINQ for objects

You’re looking for the Skip and Take extension methods. Skip moves past the first N elements in the result, returning the remainder; Take returns the first N elements in the result, dropping any remaining elements. See MSDN for more information on how to use these methods: http://msdn.microsoft.com/en-us/library/bb386988.aspx Assuming you are already taking into account that … Read more

tech