05 June 2013

main.vb

main.vb

Imports worker Imports worker.functions

Module main

Sub Main(ByVal args() As String)

End Sub

End Module

15 January 2013

Opening URL for request

A collegue required me to run a sheduled task on a our company IIS webserver to
open an URL which sends emails to our customers.

I googled and most solutions where created using MSDOS batch or VBScript.

The problem is that it is harder to control the page (close) after the request has been done and the page will show on desktop...

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System.IO;
using System.Net;
using System.Text.RegularExpressions;

namespace openurl
{
    class Program
    {
        static void Main(string[] args)
        {

            foreach (string s in args)
            {

                Match m = Regex.Match(s, @"^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$");

                if (m.Success)
                {

                    try
                    {

                    Console.WriteLine("Opening " + s);

                    WebRequest rq = WebRequest.Create(s);
                    WebResponse rs = rq.GetResponse();

                    rq = null;
                    rs = null;

                    }
                    catch (Exception ex)
                    {

                        Console.WriteLine(ex.Message);
                        Console.ReadLine();

                    }

                }
                else
                {
                    Console.WriteLine(s + "is not a valid URL");
                    Console.ReadLine();
                }

            }

        }
    }
}
+++ download project +++

* credit for regex goes to net.tutsplus.com

11 January 2013

Pi (not for eating)

I'm very interested in the Raspberry Pi, are you?

Preferred casing: http://pibow.com/

Doing some research, check back here for updates...or follow me on twitter @criticalstanny