Monday 29 July 2013

VB.NET - How to truncate seconds from DateTime (round down)


Watch On YouTube:
Examle how to remove seconds from date in VB.NET


        Dim dtOriginal, dtRounded As DateTime
        dtOriginal = Now
        dtRounded = dtOriginal.AddSeconds(-dtOriginal.Second)
        Response.Write(dtOriginal.ToString())
        Response.Write("<br />")
        Response.Write(dtRounded.ToString())


Wednesday 24 July 2013

Double Take Console - How to fix error Credentials are required












Errors

 
Errors: Credentials are required
The target management service cannot communicate with the target engine service
The target management service cannot communicate with the target source management service.

To fix it:
click key icon
and enter credentials


Restart Double Take services on both source and target servers.

Sunday 21 July 2013

MVC 4 - Simple example how to read parameters

1. Create view with one index method

    public class TestParametersController : Controller
    {

        public string Index(string name, int age = 0)
        {
            return HttpUtility.HtmlEncode("hello " + name + ", your age is " + age);
        }

    }

2. Run the program and go to
http://localhost:53274/TestParameters?name=frank&age=20

3. The following message will be displayed
hello frank, your age is 20