Application Setting in VB and C#

Application setting can be user-scoped or application-scoped. The user scoped one can be read and write at runtime.For example, assign value Variabl1 to a user-scoped application setting will be like the following

VB:

My.Settings.Sample=Variable1

C#:

Properties.Settings.Default.Sample=Variable1;
Properties.Settings.Default.Upgrade();
Properties.Settings.Default.Save();

The user.config file will be stored against the logged in user,

Windows XP:
C:\Documents and Settings\username\Local Settings\Application Data\companyname\Applicationname\application.exe$%^&*1.1.0.0

Vista:
C:\Users\username\AppData\Local\ApplicationName\application.exe@#$%^\1.1.0.0

Web Service, the beginning

Web service in asp.net consists of a file with the .asmx extension, so you’ll have something like this
<%@ WebService language="VB" codebehind="Service1.asmx.vb" class="Service1" %>
Imports System.Web.Services
Public Class Service1
Inherits System.Web.Services.WebService
<WebMethod()>_
Public Function HelloWorld(Byval name As String) As String
Return "Hello World " + name
End Function
End Class

To test this, browser http://localhost/WebService1/Service1.asmx and a simple interface with a list of methods show up.

Click on any one, and put in values for all parameters, click ‘Invoke’ to see the result, it’s not as hard as I thought it would be…

DateTime.Now vs. DateTime.UtcNow

I was modifying customer support site today, and one of the change is to have NZ time displayed with sun/moon image. This may seem to be a useless thing to do since anyone has the browser would have the time showing on the right bottom corner of their screen (or right top if using mac). But if you have SMS linked to support site, you definitely don’t want to receive message in the middle of the night.

Anyway, I never realize there’s a UtcNow function, basically it’s the standard international time that all time zones are expressed as offsets of, it’s not offset to daylight saving. There’s also a getutcdate() in SQL Server verses getdate()

world time zone