I haven’t written on this blog for quite some time. Having a tight deadline hasn’t helped much. I’m currently writing the testing scripts for the QA lab team, it’s not NUnit, mind you, just an excel spreadsheet with all the steps they should do to double check the application with the different browsers and OS.
We finally decided to go for www.browsercam.com to test the web app over www.crossbrowsin.com. the main reason is the first one includes Mac OS on its remote desktops tests.
I know cross browser compatibility is going to be a pain, it’s always been.
Cross browser compatibility…ain’t it fun?
We are still on the testing period for the application and we found a real cool resource for testing cross-browser compatibility. Visit the website here
The cross-browsing tests are done via a Java-applet that shows a desktop with about 10 types of browsers, you can previously select the OS and screen resolution you want. All versions of Mozilla till Firefox, IE, Opera, and NN are there, Windows and Linux are among the OS to choose and they promise Mac OS in a near future.
I had used BrowswerCam in the past but only for the snaptshops the browser screens, which is good for designers but not very usefull for web developers. I got a reply on a list now that browsercam.com also offers the actual testing with browsers and even has Mac OS that crossbrowsing.com doesn’t. BrowserCam prices are a little higher though.
Okay, our app got an A+ in the tests with IE 5 and 6, all type of Mozilla to Firefox, but failed on NN and IE4, hrmmmmm, probably the JScript that Visual Studio.NET is generating is not the best ECMAScript subset…
I found these two usefull resources to understand the difference between JavaScript, JScript and what ECMAScript is:
Resource 1 at DevGuru
and the best encyclopedia on the net Wikipedia:
Resource 2 at Wikipedia, history of ECMAScript
Oh joy! Tomorrow we’ll spend the day finding out what’s going on, stay tuned!
Class access modifiers and DevPartner Studio suggestions
Finally today I started getting my hands on DevPartner Studio, I had planned to do that yesterday but life is so umpredictable, isn’t it? heh, a last minute bug can change the natural course of things.
Anyway, one of the most frequent warnings I get on the project from the DevPartner Studio is “Class member field with protected access” the suggestion is to make the access identifiar Private instead of Protected.
For a nice explanation on Class access modifiers in VB.NET see this article.
So, there I go looking for Protected fields on my classes and setting them Private, but guess what? The DataBinding of the forms just blows up with this…Weird, I’m accessing those fields inside the form and assigning them to Private web form controls, hrm, well, it doesn’t work, so I just rolled back my Replace All “Protected” by “Private” and the project’s working again. It looks like the UI controls can’t be defined Private instead of Protected if you are going to do a server side data binding or property assignment.
If anyone knows the exact, well defined cause of this, please post a comment…
DevPartner Studio and the art of optimizing code.
The company purchased CompuWare DevPartner Studio…
I spent Friday testing the recently finished ASP.NET application with the new tool. I had quite a lot of warnings and things to fix ASAP. Being this app part of legacy code, it has some long methods that need a major refactoring. So my plan for the day is to put in practice what I recently read/learned in Martin Fowler’s Refactoring, Improving the Design of Existing Code
and remove all those warnings for long methods, stinky code and refactoring needs. I should get my hands on NUnit for the first time (shame on me), and make sure the changes in the code won’t break the whole app. One extra thing though, the refactoring will have to be done manually, there’s no refactoring tool for VB.NET 1.1, there is one for 2.0, but we won’t be using 2.0 on production yet. So here is my formal complaint, the VB.NET community needs a VB.NET 1.1 refactoring tool!
PS. For those who read this post, Refactoring is not Optimizing code necesarily, Refactoring’s for humans to be able to maintain code easily, while some extra encapsulation might not be the most efficient way to have your code doing a task, it’s easier for us humans to maintain, and after all, we are the ones that charge per hour ;).
VBCommenter hell no more :)
VBCommenter hell
If anyone knows why VBCommenter won’t generate the proper XML files for documenting my VB project, please let me know.
I’ve always used C# as my favorite language, when I moved to work at IronSolutions the switch to VB.NET was a little burden I had to cope with. I was used to this third party Refactoring tool for C# (ReSharper from JetBrains) and the Commenter tool embedded in the VS.NET 2003. None of these features are available for VB.NET 2003 now, except this VBCommenter that won’t seem to work. The GotDotNet forum won’t offer many solutions, I already compiled the VBCommenter project twice with suggestions from the forum but no luck, so far.
Is Microsoft ever taking VB seriously? It looks like they’re adding a Refactoring tool for VB in 2005, but I can’t wait to the end of the year (2005) to migrate all the code to have it documented.
I also have the Ank tool for source control, hrmmm, probably VBCommenter and Ank won’t like each other…
finally, the app’s done, let’s test in the beta server…Whoa! What the heck?????
After a few months of work the app is done, it runs smoothly with your local MSSQL, all is good, all is good, let’s move it to the beta server and run a few tests before handling to QA.
@#@%#@ what the heck???? My local sql server had gotten the data from the beta server, it should all work the same…it doesn’t. Lemme see the SPROCs’ code, lemme check it again, it should work! Let’s roll back, let’s commit again, it should work??? Wait, is the data what it’s supposed to be?
…
The relief of the nightmare, here’s the medicine, gal: Tools for comparing and sync databases, the SQL Bundle
And the always sweet file/folder comparing tool, here’s the super Araxis Merge
…
There you have! Yo data!
testing postings on my blog from email
Cool! I’ve been working on getting emails from a mailbox to import into a database with php, and I’m really having a hard time with MS Outlook’s stationeries so I guess that blogger (my blogging engine) will successfully clean up this email and present it on my blog, I need that code, heh J
Cheers,
Lizet
Localization example, yes, here you have free code to play with…
I think I’m better off if you have a nice small example of how to use the SiteTextControl to wrap the ResourceManager features, so here it is…enjoy!
A Resource Manager Wrapper User Control, used on ASP.NET 1.1 for Globalization and Localization of apps
Here it is as promised, a user control that wraps the functionality of the ResourceManager class and save you lots of coding:
Imports System
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Resources
Imports System.Reflection
Imports System.Threading
Public Class SiteTextControl
Inherits System.Web.UI.UserControl
#Region ” Web Form Designer Generated Code “
‘This call is required by the Web Form Designer.
End Sub
‘NOTE: The following placeholder declaration is required by the Web Form Designer.
‘Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
‘CODEGEN: This method call is required by the Web Form Designer
‘Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Private _Name As String
Private lit As LiteralControl
Private res As ResourceManager
Private Shared _myCulture As String
Public Shared ReadOnly Property myCulture() As String
Get
Return Thread.CurrentThread.CurrentCulture.ToString
End Get
End Property
Public Property Name() As String
Get
Return _Name
End Get
Set(ByVal Value As String)
_Name = Value
End Set
End Property
Public WriteOnly Property Text() As String
Set(ByVal Value As String)
If Controls.Count > 0 Then
lit.Text = Value
End If
End Set
End Property
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
‘Put user code to initialize the page here
End Sub
Protected NotOverridable Overrides Sub CreateChildControls()
res = New ResourceManager(“machinelocator.Resource1”, [Assembly].GetExecutingAssembly())
Dim _Text As String = res.GetString(_Name, Thread.CurrentThread.CurrentCulture)
lit = New LiteralControl(_Text)
Controls.Add(lit)
lit.Dispose()
End Sub
Public Shared Function GetResourceContent(ByVal name As String) As String
Dim rm As ResourceManager = New ResourceManager(“machinelocator.Resource1”, [Assembly].GetExecutingAssembly())
Return rm.GetString(name)
End Function
End Class
On the Application events at the Global.asax your code should look like:
mports System.Web
Imports System.Web.SessionState
Imports System.Globalization
Imports System.Threading
Imports System.Resources
Imports System.Reflection
Imports System.Collections
Imports System.IO
Public Class Global
Inherits System.Web.HttpApplication
Private rm As ResourceManager
#Region ” Component Designer Generated Code “
Public Sub New()
MyBase.New()
‘This call is required by the Component Designer.
InitializeComponent()
‘Add any initialization after the InitializeComponent() call
End Sub
‘Required by the Component Designer
Private components As System.ComponentModel.IContainer
‘NOTE: The following procedure is required by the Component Designer
‘It can be modified using the Component Designer.
‘Do not modify it using the code editor.
components = New System.ComponentModel.Container
End Sub
#End Region
Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
‘ Fires when the application is started
End Sub
Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
‘ Fires when the session is started
End Sub
Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs)
‘ Fires at the beginning of each request
Dim culturePref As String = Nothing
Dim cultureSet As Boolean = False
Try
If Request.Cookies.Count <> 0 Then
If Request.Cookies(“CulturePref”).Value <> Nothing Then
culturePref = Request.Cookies(“CulturePref”).Value
cultureSet = True
End If
End If
Catch ex As Exception
‘nothing
End Try
If cultureSet Then
Try
Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(culturePref)
Catch
‘Set the default culture
Thread.CurrentThread.CurrentCulture = New CultureInfo(“en-US”)
End Try
End If
Thread.CurrentThread.CurrentUICulture = Thread.CurrentThread.CurrentCulture
End Sub
Sub Application_AuthenticateRequest(ByVal sender As Object, ByVal e As EventArgs)
‘ Fires upon attempting to authenticate the use
End Sub
Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
‘ Fires when an error occurs
End Sub
Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
‘ Fires when the session ends
End Sub
Sub Application_End(ByVal sender As Object, ByVal e As EventArgs)
‘ Fires when the application ends
End Sub
End Class
And finally for using this control you can either put it on your HTML or use it on your CodeBehind like:
strDetail =SiteTextControl.GetResourceContent(“AproxResource”)
Special thanks to Mark Kucera the original creator of the control, the above code have very few modifications.
