Archive for the ‘C#’ Tag

GridView Paging in ASP.NET 2.0

I am posting this on a well covered topic, because the examples I saw online were stupidly complex for this simple task. Now, I don’t mean to say that this is the most efficient method, but for smaller sets of data (we have less than 1000 records returned from this query) it is fast and easy.

Obviously, make sure you have the GridView set to allow paging. You will need to add an event handler for the GridViewPageIndexChanging (Not “Changed”). There is a private property for the class, ds which is a custom DataSet we have in our application. Any DataSet or DataTable (binding source?) will (should) work.

protected void gvUsers_PageIndexChanging(object sender,
GridViewPageEventArgs e)
{
DataTable dt = ds.GetUsers;
gvUsers.DataSource = dt;
gvUsers.PageIndex = e.NewPageIndex;
gvUsers .DataSource = dt;
gvUsers .DataBind();
}

WinZip vs 7zip: First round – Misc Textual Documents

So, I was a lot closer to having this “mostly” working than I thought. After some trial and error with 7zips command line arguments I got a few good test runs in. I need to work with some different data to further confirm, but so far, it seems that 7zip is pure win!

winzip-vs-7zip

See the text results below:

Starting WinZip…
WinZip finished… reporting…

Start Ticks: 633616615839494087
End ticks: 633616615845744327
Time to completion (ticks): 6250240
Time to completion (ms): 625.024

Starting 7Zip…
7Zip finished… reporting…

Start Ticks: 633616615846681863
End ticks: 633616615859338599
Time to completion (ticks): 12656736
Time to completion (ms): 1265.6736

Press esc or enter key too continue…

Starting 7Zip…
7Zip finished… reporting…

Start Ticks: 633616617982545127
End ticks: 633616618061454407
Time to completion (ticks): 78909280
Time to completion (ms): 7890.928

a 7zip with max compression?

Starting 7Zip…
7Zip finished… reporting…

Start Ticks: 633616621970019726
End ticks: 633616622006270886
Time to completion (ticks): 36251160
Time to completion (ms): 3625.116

Testing Windows file Compression Utilities

So, after recalling a debate about which file compression utility was the best (WinRar vs 7zip, I think it was) I have decided to test this in the most accurate way I can think of. I am going to write an application that will run WinZip, WinRar, and 7zip on the same set of files, with the same settings (if possible, I haven’t looked at WinRar yet, but WinZip’s CLI is pretty sparse).

A few pages I found for reference:

It seems that if I use the same files, run each from the command line through a .NET application and time it from start to finish, I think we can get some pretty accurate results. Check back in a little while and we’ll see what I come up with.