Sunday, May 18, 2008

Upload large files using ASP.NET

I have a need to implement a web application which allow various size file to be uploaded. When doing basic research on using FileUpload control, come across a useful blog http://weblogs.asp.net/jgalloway/archive/2008/01/08/large-file-uploads-in-asp-net.aspx, which describes this problem in greater detail and also contains links to other useful information.

Sunday, November 11, 2007

Image Object Concepts

Start to learn about object based image analysis using Definien Developer software, hereafter referred to as DD.

Within DD, images are represented by scenes. Images are loaded as scenes and can have one or more image layers. During analysis, the scene is split into image objects, which is a group of connected pixels in a scene.

All the image objects within a scene are organized by image object levels. DD user's guide shows the image object levels as

image

Image object level are the internal working area of image analysis in DD, which is different from the traditional per-pixel image analysis, where pixels are the internal working objects.

Another import concept in DD analysis is Feature.

A feature is an attribute that represents certain information concerning objects of interest, for example measurements, attached data or values.

Two types of features are used: image object feature and global features.

Saturday, November 3, 2007

Basic usage of DataGridView Control

The DataGridView control is a new control in Windows Forms 2.0 and it replaces the DataGrid control in Windows Forms 1.0. It is a very powerful and versatile control suitable for displaying tabular data from various data sources. Because of its flexibility, using it efficiently sometimes may not be as simple as it looks like.
One of the big advantage of DataGridView is that it can bind to various different data sources including Array, DataTable, and even custom objects.
There is one simple gotcha when using Array as the data source for a datagridview. By default, DataGridView control display the first public property of the object in the array. For example, if a string array is used as data source for a datagridview, only the length of the string object will be displayed, but not the actually string object. To actually display the string, a user defined object can be used to wrap the string as a public property.
I found a very detailed and useful summary at http://windowsclient.net/samples//Go To market/DataGridView/DataGridView FAQ.doc

Percentile with SQL

In summarizing some of my data, I need to use the median instead of mean. Then I start to look for implementation of median with just SQL statement.
In the process of exploring features for median calculation, a generic solution to solve for percentile seems to be more flexible.
Using the CASE statement from SQL Server, it is straight forward to find out the percentile value for a given value. To demonstrate,

declare @test table(id int, anum int)

declare @idx int
set @idx = 1
while (@idx <=10) begin
insert into
@test values (@idx, @idx)
set @idx = @idx+1
end

select sum(case when anum <=3 then 1 else 0 end)*1.0/count(*) as percentile from @test

However, the implementation has one big drawback: when there are only a few data value to consider, the above implementation for percentile will unlikely to give the answer useful. For example, if there are only two values to consider: 1 and 10, then a value of 8 will get a percentile value of 0.5. Therefore, the actual percentile interpretation has to consider the underlying data model. If the data is considered to be linear, an interpretation between the minimum and maximum value has to be considered.

Data