Thursday, October 28, 2010

Really Cheap Cell Phones

I have been running around trying to find a cheap phone to double up as my support lines. I hate it when ppl start calling me for support with my primary line. Have been thinking of a cheap motorolla phone. My previous motorolla phone have lasted me for like past 8 years and it is still working!!  I cannot believe it. Anyway, I bump into this http://www.cheap-electronic-store.com/deptCellPhones.asp which sells some really neat stuff.  I am quite interested with the Android phones. There is 1 that's pretty cheap!  maybe I can now start to afford these stuff. While I'm at it, maybe learn up Android programming as well! *lol*  Too bad they don't carry those nifty Made in China iPhones. It would be nice, but then again, not sure of the legality of that. Anyway, I like some the dual sim phones over there too.

Monday, October 18, 2010

SQL ERROR: Cannot create new transaction because capacity was exceeded

PROBLEM:
I get this error: Cannot create new transaction because capacity was exceeded. when I do an ADODB BeginTrans.

SOLUTION:
I do not understand why, but apparently, it is because the cursor adUseServer doesn't seems to support it. I have to switch to adUseClient for the purpose of the BeginTrans/Commit; and later switch back to adUseServer for regular statements.

ENVIRONMENT:
I uses MDAC 2.8 on Microsoft SQL Server 2008 and ASPX. I notice this happens after I apply some patch on the Windows 2008 Web Edition.

Friday, October 1, 2010

Global Constants in ASP.NET

Problem
I'm trying to emulate classic ASP constant in ASP.NET. There are a few possibilities, but I find this to be the neatest.

Answer
Create a CLASS file (example: globalConstants.vb) into your project:

Public Class globalConstants
Public Const prsHelloString As String = "Hello"
Public Const priOne As Integer = 1

Public Shared Function fnoReturnNothing() As Object
Return Nothing
End Function

Public Shared Function fnsReturnEmptyString() As String
Return ""
End Function
End Class

Now, in your default.apsx files, you just need to:

Imports globalConstants
Partial Class _default
Inherits System.Web.UI.Page

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
if  globalConstants.prsHelloString = "Hello" then
'Do Nothing
end if
End Sub
End Class

You will notice that you DO NOT need to create an instance of globalConstants. No need to Dim voConsts as NEW globalConstants.  This is pretty neat.  This also works for the functions. If your class does not need to store variables, this is a great method.