Archives for November 2006
Displaying the Column Headers of a GridView
The GridView of ASP.NET 2.0 will not display column headers if there is no data. The following is a workaround, assuming that you have added two BoundField columns to your GridView:
[C#]
DataTable dt = new DataTable();
dt.Columns.Add(”Description”);
dt.Columns.Add(”Amount”);
dt.Rows.Add(dt.NewRow());
GridView1.DataSource = dt;
GridView1.DataBind();
GridView1.Rows[0].Cells.Clear();
GridView1.Rows[0].Cells.Add(new TableCell());
GridView1.Rows[0].Cells[0].ColumnSpan
= GridView1.Columns.Count;
The last two lines are not strictly necessary; I have included them so that the resulting HTML […]
Simple Calendar Widget
Anthony Garrett has made available his beautifully written, easily customised, LGPL, zero-price, Javascript, cross-browser Simple Calendar Widget. I’ve hacked it to make it accept and display long month names and I’ve also added a “close” button at the bottom.
Updated: I’ve moved today’s date to the top left and the close button to the top right.
PHP 32-bit Left Shift Function
function leftshift32($number, $steps)
{
// convert to binary (string)
$binary = decbin($number);
// left-pad with 0’s if necessary
$binary = str_pad($binary, 32, “0″, STR_PAD_LEFT);
// left shift manually
$binary = $binary.str_repeat(”0″, $steps);
// get the last 32 bits
$binary = substr($binary, strlen($binary) - 32);
// if it’s a negative number return the 2’s complement
// otherwise just return the number
if ($binary{0} == “1″)
{
return -(pow(2, 31) - […]
Adventures in 64-bit PHP: 32-bit Left Shift on a 64-bit Machine
My team member was looking for source code that can parse Excel files and found PHP-ExcelReader. It worked fine on her computer, so she ported it to production. After running it for a few times the server became totally unresponsive.
I went over to take a look at the server and the mouse pointer […]
ASP.NET 2.0: “Failed to initialize the AppDomain”
If you get a “Failed to initialize the AppDomain” error in the system event log when trying to run an ASP.NET application on .NET Framework 2.0 and Windows Server 2003, try giving IIS_WPG and ASPNET read and execute permissions to your directory.