Monday, July 11, 2005

Today we went golfing and for the first time in my life I broke 100 strokes! I shot a 95 and I attribute the great game to watching a Tiger Woods golf clinic on TV the day before. I didn't really learn anything different from watching the clinic but I think good Tiger vibes came through the TV and gave me super golfing powers. I would have shot a lot better but I shot a 10 on the last hole and lost by 1 stroke to Mike, talk about choking haha!!!

The golfing was relaxing but my blog will probably go quiet this week as I have a lot of work to do. I went to some in house training for work and despite being in training I was still assigned bugs and projects. It doesn't help that I have Friday off to go to the 1st annual West Edmonton Mall Grand Prix plus I have 2 important hockey games this week and I have to make a trip on the LRT to Rexall Place to pick up my Champ car tickets.

I might post something for my own reference about binding a Windows Form Datagrid to a Business Object because I spent too much time looking for it and it wasn't that intuitive but besides that it might be a week before I post again. But when I get back expect a lot of pictures of the race and the cars.

Monday, July 11, 2005 6:31:37 AM (GMT Standard Time, UTC+00:00)  #    Comments [0]  | 
Wednesday, July 06, 2005

I have performed the Alien Autopsy on my mouse. The project has been put off because RadioShack is out of breadboards and hookup wire and they seem to be having a hard time getting it in since they were bought out by Circuit City. I would just go somewhere else but its the closest place within walking distance that I can go on my lunch break.

I also figured out that I am in serious need of a dremel. 4 hours of driving to my dad's shop is a pain if you find you missed something when hollowing out the mouse. I haven't cut holes in the side for the motors and the top still needs some work, the mouse was quite different from the one in Make but I figured out that they list glue in the tools section for a reason <g>

 Anyway here is a picture of what I have done so far, I would have done more but I got distracted by my dad's plasma table.

Wednesday, July 06, 2005 3:12:59 AM (GMT Standard Time, UTC+00:00)  #    Comments [2]  | 

Wednesday, July 06, 2005 2:42:07 AM (GMT Standard Time, UTC+00:00)  #    Comments [0]  | 

I installed SharpDevelop on my USB stick today. Now I can have a portable development environment to take with me whereever I go. As long as the computer that you plug your USB stick into has the .NET Framework installed you can develop anywhere! I swear I find a new use for my USB stick everyday.

Wednesday, July 06, 2005 2:16:31 AM (GMT Standard Time, UTC+00:00)  #    Comments [0]  | 

This site is great http://www.howdtheyvote.ca it shows how your MP voted on recent bills in parliament.This could be great around election time.

Fun
Wednesday, July 06, 2005 1:17:07 AM (GMT Standard Time, UTC+00:00)  #    Comments [0]  | 
Tuesday, July 05, 2005

Mmmmm Pizza: http://www.billyreisinger.com/pizza.php

I will have to give this a good read. I still need to make a pizza with the pizza cookbook I got for my birthday.

Tuesday, July 05, 2005 6:18:09 PM (GMT Standard Time, UTC+00:00)  #    Comments [0]  | 
Friday, July 01, 2005

Happy Canada day to my fellow Canadians. I figure that we have it pretty good as Canadians and I think we should set an example for other countries to follow. So for Canada day I encourage anyone who reads this to do one of the following:

We are honoured to have Live 8 on Canada day:

Sign the list: http://www.live8live.com/list/

Upload your Photo: http://www.live8live.com/live8/imageHome.do

Visit the One Campaign website and subscribe to the One.org blog from the One Campaign and educate yourself:

http://www.one.org/

http://politicaltechnology.com/one/blogs/one_blog/

Sponsor a Child on WorldVision.ca:

I have sponsored a child from Mali

http://www.worldvision.ca

Or if sponsorship is not your thing give a one time gift:

http://www.worldvision.ca/home/give-a-gift/

Think of that CD you were going to buy this month, go download it and donate the money to a cause, you won't feel it, I guarentee it and I don't think Bono or Beyonce will mind.

Or instead of sitting through 20 ads before finally seeing the remake of the Longest Yard stay home and download it without the ads and sacrifice the $40 bucks to a just cause. 

Or you could find a free Canada day celebration and skip going to the bar. Booze doesn't make Canada a better country, it's the people that do.

Don't do it because you feel guilty, do it because these people work twice as hard as you and deserve to be treated as equals. Anyway that is my rant for Canada. I think that we would be a much better country if we let other companies play on the same playing field as us.

Canadian quotes:

“I just wish people would realize that anything's possible if you try. Dreams are made if people try.“ - Terry Fox

Leave the beaten track behind occasionaly and dive into the woods. Every time you do you will be certain to find something you have never seen before” - Alexander Graham Bell

“Never again.” - Romeo Dallaire

"My friends, watch out for the little fellow with an idea" - Tommy Douglas

"Integrity is not a conditional word. It doesn't blow in the wind or change with the weather. It is your inner image of yourself, and if you look in there and see a man who won't cheat, then you know he never will." John A. MacDonald

 

 

Friday, July 01, 2005 8:20:59 AM (GMT Standard Time, UTC+00:00)  #    Comments [0]  | 
Wednesday, June 29, 2005

I am off to the gym from work to meet. Catherine. I have been having a really active week. I went to the gym Monday, had hockey yesterday and now I am going to the gym today and playing hockey again tomorrow. I was slacking off in the staying active department but I have found my motivation again.

I am excited to go home and visit my parents for the Canada day weekend. I can't wait to see my Dad's new plasma table and try it out. I am also going to use his shop to finish my robot. I will post pics of it when I get back. 

Wednesday, June 29, 2005 10:00:34 PM (GMT Standard Time, UTC+00:00)  #    Comments [0]  | 
Monday, June 27, 2005

This is awesome to watch: 10 Utilities in 10 Minutes GrokTalk by Scott Hanselman.

He demos 10 utilities from his Ultimate Tools List. I have tried a couple of them, including Notepad2, Slickrun, the Sysinternals stuff and Windows Desktop Search. I really want to buy CodeRush but it is too expensive for me. They all look like amazing utilities though.

Monday, June 27, 2005 7:08:52 PM (GMT Standard Time, UTC+00:00)  #    Comments [0]  | 

Create and manipulate a Windows service.

Write code that is executed when a Windows service is started or stopped.

 

Looking at the “Skills Being Measured”  matrix section of the 70-320 exam website. The first topic is “Write code that is executed when a Windows service is started or stopped. This is the first article in a series that is going to help me study for the exam and maybe help out someone else who is studying for the exam.

 

 

A windows service is an application that runs in its own Windows session and does not have an interface. Some are automatically started when Windows boots and some can be manually started. Some good examples of programs that might be a candidate for a Windows service include workflow engines that need to run in the background, print spoolers, anti-virus programs or event logging applications. You may already know that the ASP.NET session state service is a service and without it session state in ASP.NET will not work.

 

There are a number of ways to view what Windows services you have running on your machine:

 

Ways to get to services:

 

- Start->Control Panel->Administrative Tools->Services

  

 

 

 

- Start->Run->Cmd->NET START

 cmdwindow

 

From the command line there are a number of ways to manipulate different services; the following is a list of NET commands and what they do:

 

2        >NET START

o Lists all services in the service control database.

3        >NET START [servicename]

o Attempts to start the service an example of this is: NET START EVENTLOG

o If the service name is two words or more the must be entered in quotation marks.

4        >NET STOP [servicename]

o Stops the specified service name. Stopping a service closes any connections that that service may be using, it also stops any other services that depend on it to be running. An example of this is: NET STOP IISADMIN.

5        >NET PAUSE [servicename]

o Pauses the specified service. The service must be able to pause for this to work. An example of this is: NET PAUSE IISADMIN

6        >NET CONTINUE [servicename]

o Reactivates a Windows service that has been paused. An example of this is: NET CONTINUE IISADMIN

 

Knowing this we can now create and manipulate a Windows Service.

 

1. Open Visual Studio and create a new C# project. Select Visual C# .NET Windows Service project and name it WindowsServiceLogger.

 

 

2. You should now see the design view of your Windows service, the first thing that we need to do to make a functional Windows service is to set the ServiceName property of the Windows service. To do this right click anywhere in the design Window of your service and change the ServiceName property to WindowsServiceLogger. Also while we are setting properties lets set the CanPauseAndContinue property to True.

 

 

3. Now we must override the OnStart and OnStop methods of the System.ServiceProcess.ServiceBase base class. When you create a project using the Windows service template this is automatically done for you:

 

protected override void OnStart(string[] args)
{
}

protected override void OnStop()
{
}


3. We must also change the Main() method of the Windows service from Service1 to our Windows service name:

static void Main()
{

System.ServiceProcess.ServiceBase[] ServicesToRun;
ServicesToRun = new System.ServiceProcess.ServiceBase[] { new WindowserviceLogger() };
System.ServiceProcess.ServiceBase.Run(ServicesToRun);

}

4. Since we set the CanPauseAndContinue poperty to True, we should override the OnPause() and OnContinue() methods of the System.ServiceProcess.ServiceBase. To see what code we need to implement, right click System.ServiceProcess.ServiceBase in the class definition and choose Go To Definition from the menu. This takes us to the object browser.If we click on the OnPause() and OnContinue() method in the members column we see the following at the bottom of the object browser:

 

protected virtual new void OnPause (  )

    Member of System.ServiceProcess.ServiceBase

 

Summary:

 When implemented in a derived class, executes when a Pause command is sent to the service by the Service Control Manager (SCM). Specifies actions to take when a service pauses. 

 

protected virtual new void OnContinue (  )

    Member of System.ServiceProcess.ServiceBase

 

Summary:

 When implemented in a derived class, System.ServiceProcess.ServiceBase.OnContinue runs when a Continue command is sent to the service by the Service Control Manager (SCM). Specifies actions to take when a service resumes normal functioning after being paused. 

 

From this we can see what the method signatures that we need to override need to be. Lets add it to our Windows service:

 protected override void OnPause()
{
}

protected override void OnContinue()
{
}

 

Even though we haven't really coded anything, we can see how a Windows service works. The AutoLog property of the Windows service is automatically set to True. This property automatically logs events to the Event Viewer that occur within our Windows service. Once our service is installed we will be able to see them by going to

 

            - Start->Control Panel->Administrative Tools->Event Viewer

 

Our entries will appear under the Application node.

 

 

 

To stay in scope of the this article. We have created a Windows service and now we need to write code that is executed when a services is started and when a service is stopped. Lets add code that writes to a file when the service is started and wehn the service is stopped

 

1: Add the following namespace using System.IO;

 

2: Add the following code to the OnStart() and OnStop() methods:

 protected override void OnStart(string[] args)
{

string path = @"c:\temp\WindowsServiceLogger.txt";

if (!File.Exists(path))
{
using (StreamWriter sw = File.CreateText(path))
{
sw.WriteLine("WindowsServiceLogger service started: "
+ DateTime.Now.ToString());
}

}
else
{

using (StreamWriter sw = File.AppendText(path))
{
sw.WriteLine("WindowsServiceLogger service started: "
+ DateTime.Now.ToString());

}

}

}

protected override void OnStop()
{

string path = @"c:\temp\WindowsServiceLogger.txt";

if (!File.Exists(path))
{

using (StreamWriter sw = File.CreateText(path))
{
sw.WriteLine("WindowsServiceLogger service stopped: "
+ DateTime.Now.ToString());
}

}
else
{

using (StreamWriter sw = File.AppendText(path))
{

sw.WriteLine("WindowsServiceLogger service stopped: "
+ DateTime.Now.ToString());

}

}

}

 

3. Build the project and the code will execute once we have installed our Windows service. We have now completed the first objective.

Monday, June 27, 2005 4:46:57 AM (GMT Standard Time, UTC+00:00)  #    Comments [1]  | 
Friday, June 24, 2005

Some of these are hilarious my favorites and ones that apply to me are:

“Your spouse is jealous of your laptop” (Does it count if she is jealous of you soon to be laptop?)

“Your family members learn about your life through your blog”

“You spend more on hardware than the car you drive”

 

Friday, June 24, 2005 4:51:39 PM (GMT Standard Time, UTC+00:00)  #    Comments [0]  | 
Thursday, June 23, 2005

I have been getting a call from 1800 numbers every day this month so I searched for a Canadian “Do Not Call List”. Well us Canadians don't have a federally mandated do not call list but the CMA says they will take you off their list: https://cornerstonewebmedia.com/cma/submit.asp

There is also a FAQ about Telemarketers at the CRTC: http://www.crtc.gc.ca/eng/INFO_SHT/t1022.htm

Hopefully if they bug you as much as they bug us this helps you out and gets you off of their lists.

Thursday, June 23, 2005 12:47:17 AM (GMT Standard Time, UTC+00:00)  #    Comments [1]  | 

Theme design by Jelle Druyts

Pick a theme: