PostBackUrl And SmartNavigation Bug?

I have a page with SmartNav, that contains a linkbutton with a

I have found that the page that is the target of the PostBackUrl will
have it’s postback property fired 2 times, and unfortunately, the 2nd
time it is fired the “PreviousPage” is set to Nothing.

I have posted a few places to see if someone from MS can confirm this is a bug, but  I am betting they are going to tell me to not use smartnav.


SQL Server Merge Replication

One of the challenges in doing merge replication in SQL Server is dealing with IDENTITY columns.

One of the tricks you can use is “automatic identity range management”. 

Basically you tell DB 1 to start at seed 1 and DB 2 to seed at 20,000, and when DB 1 reaches 16,000 or DB 2 reaches 36,000 it will reset those seeds to 40,000 and 60,000.

It appears to work well.

Getting IE To Print Backgrounds And Cell Colors

I was having a small problem getting some reports to print the way I wanted.

I turns out that to get the table cells colored backgrounds to print, click on the browser’s Tools menu. Select Internet Options, then click on the Advanced tab. Scroll down to find the Printing heading and check the box called Print Background Colors and Images. This setting affects both page backgrounds and table cell backgrounds.

Using XSD.exe

.Net has a tool called the XML Schema Definition Tool (XSD.EXE) which can turn XSD schemas into classes.  Also, it will try to make it so those classes will conform to the schema when serialized as XML.

xsd.exe pathToXSD.xsd /classes /language:VB /outputdir:C:output

You can then serialize and deserialize the object into/from XML.



Is The Date On The Weekend

This function will figure out if the given date lands on a weekend.

    Public Shared Function IsWeekend(ByVal dateOfInterest As DateTime) As Boolean
Dim d, m, y, w As Integer
d = dateOfInterest.Day
m = dateOfInterest.Month
y = dateOfInterest.Year

If m = 1 Or m = 2 Then
m += 12
y -= 1
End If

w = CInt((d + 2 * m + 3 * (m + 1) / 5 + y + y / 4 - y / 100 + y / 400) Mod 7)
If w <> 6 And w <> 7 Then
Return False
Return True
End If
End Function

Another function to do the weekend check could be this:

    Private Const ERR_INVALID_DATE = 20000
Private Const ERR_INVALID_DATE_MSG = "Date Required"

Public Function IsWeekend(ByVal DateValue As Object) As Boolean

Dim dDateValue As Date

If Not IsDate(DateValue) Then
Exit Function
End If

dDateValue = CDate(DateValue)
IsWeekend = (Weekday(dDateValue) Mod 6 = 1)

End Function

Using Postbacks in ASP.NET From showModalDialog pages.

If you have an ASP.NET page (.aspx) opened with the JavaScript showModalDialog() function and inside that page there is a form doing PostBack, when the PostBack is being done the page loads in another (popup) window. The easiest way to prevent this is to add the following tag inside the <HEAD></HEAD> tags of the ASP.NET page:

<base target=”_self”>


Databinding "Bind()" in ASP.NET

If you used the developemt tools to create a datagrid in ASP.NET 2.0, it will show something like:

NavigateUrl=’<%# Bind(“EmployeeId”) %>

But what if you wanted to do something more complicated that just ge the EmployeeId into the field, like for example if you wanted to run a JS function.  Then you have to do away with Bind and use the more verbose DataBinder method like this: 

NavigateUrl=’<%# “javascript:UseThisJobIndex(” & DataBinder.Eval(Container.DataItem,”JobIndex”) & “)” %>

That’s all there is to it.


My Very Educated Mother Just Said Uh-oh No Pluto!!

I wish I coudl take credit for that line, but it was from Colbert.

So now Pluto is going to be a Drawf Planet, along with UB313 (Xena) and Ceres.

To see the full image you might need to expand your window or use the scrollbar at the bottom of this article.

UB313 is larger than Pluto, and farther out in orbit.

I kinda liked the idea of calling Pluto and Charon a “dual planet,” as Charon is so large that it was somewhat unfair to say that it orbits Pluto, but they aren’t going to do that.

Ceres is the largest asteroid in the Asteroid Belt but because it hasn’t swept the area clear of other asteroids (and I guess it never will b/c of its close proximity to Jupiter) it will never meet the new definition of a planet:

“a celestial body that is in orbit around the sun, has sufficient mass for its self-gravity to overcome rigid body forces so that it assumes a nearly round shape, and has cleared the neighborhood around its orbit.”

Backup/Restore Cisco Pix Configuration

To do this you

  1. Need a TFTP server running (solarwinds)
  2. Need to telnet into the device
  3. Need to be in enable mode

First to make the backup:

write net

where the IP is the IP of your TFTPserver

Then to restore it later, you need to enter config terminal mode first and then restore the file:

config term
configure net

and there you have it…

The changes will take immediate effect, but you will still need to write them into the non volatile memory, or the changes will be lost when you reboot the device.