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]  | 
Tuesday, June 21, 2005

Besides blowing up fireworks and drinking a lot of Canadian made beer, what is something I can do on Canada day that is patriotic/helps out my country?

Tuesday, June 21, 2005 6:55:18 PM (GMT Standard Time, UTC+00:00)  #    Comments [2]  | 

I updated my blogroll on the right hand side today with sites that I read daily. Since a lot of people don't have time to individually go to each one I thought I would explain each one here and if you like them you can go look for yourself. Please let me know in the comments what websites you read every day. Maybe there are some cool ones that I have missed that I would be interested in.

 

“Caution” a lot of them are stuff only a developer/geek would enjoy.

 .NET Rocks!

 .NET Rocks! Full WMA Downloads

.Net Rocks is a internet audio talk show that has a new guest on each week to talk about .NET

 Alberta.ca News

Press releases from the government of Alberta. This site has been getting tons of updates on the recent flooding here in Alberta.

 Ars Technica

A technology news site that I think has the best unbiased coverage.

 Book Club

Ken's blog more than the book club. I was in a virtual computert book club that Ken was kind enough to put on. It is now ended but I am sure we will all stay in touch.

 Bug Bash

A cool technology comic strip that comes out every Monday.

 Carl Franklin

The host of .Net rocks.

 Catherine Jane

My girlfriend's blog "blush"

 CodeBetter.Com

An aggregate of a bunch of passionate developers who like to help other developers "code better". I like a lot of the topics these people post about.

 ComputerZen.com - Scott Hanselman's Weblog

Probably my favorite blog I read. Scott put out a Ultimate Tools list for your computer that will never be matched. He is also one of the developers that works on DasBlog. The weblog engine that powers my blog.

 Engadget

This is the best technology website/coverage out there hands down.

 ESPN.com - NHL

ESPN/NHL news feed.

 Geekswithblogs.net

The title explains it all. I have a blog on here but so far the post count is 0.

 Google Blog - Live

Pretty much just marketing bullshit from google. I don't know why I still read it.

 hack a day

These guys post cool projects that I like to attempt and then never finish.

 Joel on Software

Joel is probably the most influential software blogger out there.

 Joystiq

Video game news site.

 Ken Lefebrve

Ken's blog from the book club. One of the nicest people you will ever meet virtually haha.

 LiquidTrout

My cousin Chris' production company. I design and maintain the site.

 Luke Hutteman's Weblog

Luke is the creator of my RSS aggregator SharpReader. He never posts though.

 MAKE: Blog

Make also has cool projects that I like to start and then never finish.

 Mark's Sysinternals Blog

Sysinternals is a really cool tool to use that shows a lot of detailed information. Mark usually posts cool little investigations he has done into processes running on his computer.

 Marquee de Sells: Chris's insight outlet

Chris Sells is a funny/smart developer whose opinion I hold in high regard.

 Microsoft Forums: Visual C# General

 Microsoft Forums: Visual C# Language

Mostly just beginners post here but your question is always answer in record time.

 Microsoft PressPass - Press Releases

Pretty much just marketing bullshit from Microsoft. I don't know why I still read it.

 Microsoft Watch from Mary Jo Foley

Mary Jo has the latest information on upcoming Microsoft products and what is going on with the company in general.

 Microsoft WebBlogs

This is an aggregation of Microsoft employees blogs. My favorites are Larry Osterman's blog and Heather Leigh's blog.

 Most Recent KBs for Microsoft .NET Framework 1.1

Believe it or not even Microsoft writes code with bugs in it. This is the newest articles from Microsoft support.

 MSDN Canada Presents Community Radio

Radio from the MSDN Canada team.

 MSDN Just Published

 MSDN: Coding4Fun

 MSDN: Visual C#

New articles posted on the Microsoft developer network. Coding4Fun is actually a lot of fun.

 Neopoleon.com

Rory Blyth's blog. Rory is a former developer turned Microsoft employee but you don't necessarily have to be a developer to read his blog. He is a liquid out your nose funny guy. Probably my 2nd favorite blog.

 Pluralsight Blogs

Pluralsight trains Microsoft employees, enough said.

 Podcasts

Pretty crappy name that I should probably change but this is the Engadget podcast where they talk about the latest news to come out of the world of technology.

 Richard Campbell Blogs Too

Richard is the cohost of .Net Rocks and he is Canadian so that doesn't hurt.

 Rockford Lhotka

Rocky is the man when it comes to business objects and writing object oriented code. He is very very smart.

 Scobleizer: Microsoft Geek Blogger

 Scripting News

If you read Scoble and scripting news you are on the cutting edge of what is happening with blogs and rss.

 shahine.com/omar/

Omar is another developer who works on DasBlog.

 Steven Rockarts

Steven is a developer from Edmonton who seems to have the same name as this website.

 The Daily WTF: The Daily WTF

Funny things that people code that make you say WTF!

 The Mountain of Worthless Information

Because I want to stay in touch with my Java roots I read Ted Neward's blog.

 TheServerSide.NET: Your Enterprise .NET Community

They post news and articles about software and the software industry.

 U2 Exit :: Sound and Vision

 U2log.com // weblog and magazine

U2log is my favorite U2 news site. U2 Exit posts audio.

 Vending Machine: RecentCheckins

A project we were going to work on in the book club that died out. I should probably delete it.

 Wired

The magazine's rss feed.
Tuesday, June 21, 2005 6:40:29 PM (GMT Standard Time, UTC+00:00)  #    Comments [0]  | 
Sunday, June 19, 2005

Today I spent most of the day inside. It is pretty nice outside and I will probably go outside and read for a bit.

I watched Mr & Mrs. Smith with Catherine and Daisy. I thought the movie started out ok but it ended with a whimper. Saturday we watched Batman Begins which was pretty good compared to the last couple Batmans. I still think the first one with Micheal Keaton was the best.

I started reading a reverse engineering book that seems pretty interesting. You can find it here: http://www.acm.uiuc.edu/sigmil/RevEng I am mostly just linking to it so I can find it another day. I started building a new virtual machine for a new development environment since I hosed my host environment by installing the .NET Framework 2.0. From now on i think I am going to have a VM for development and keep my host environment seperate. I am planning on trying to fix a bug in the http://www.liquidtrout.net website once I get it up and running.

I ended up finding the U2 concerts from Vancouver. I am curious to see what the sound quality is like. I brought my bootlegging gear with me to Vancouver but decided against bootlegging the concert so I could actually enjoy the concert experience without worrying about my gear. Kudos to the person that bootlegged the concerts for sacrificing the show so I could relive the experience.

 

Sunday, June 19, 2005 10:11:19 PM (GMT Standard Time, UTC+00:00)  #    Comments [0]  | 
Monday, June 13, 2005

I finished the website for my cousin's play/production company on Sunday. They have a play in the 2005 Edmonton Fringe Festival and they are entertaining me on the site already. We had a bit of a bug with caching but I should be able to take care of it.

I wish them the best of luck and would like to do a shameless plug for them: www.liquidtrout.net

Monday, June 13, 2005 6:06:30 PM (GMT Standard Time, UTC+00:00)  #    Comments [0]  | 
Sunday, June 12, 2005
 Summer is a time for mosquito bites. I can't resist the urge to scratch the bites because it feels so good and I end up scratching them a little too much causing myself pain later. If you want to trick yourself into thinking that you have scratched the bite and soothed the itch, scratch the same spot on the opposite side of your body and the itch will go away! Try it, it works.
Fun
Sunday, June 12, 2005 8:15:31 PM (GMT Standard Time, UTC+00:00)  #    Comments [0]  | 
Friday, June 10, 2005

This week I ordered the parts to make Mousey the Junkbot. I have been getting really sore arms/wrists/hands from typing too much lately so doing a project with hardware instead of software is a welcome change.

Friday, June 10, 2005 6:57:09 PM (GMT Standard Time, UTC+00:00)  #    Comments [0]  | 

Tomorrow I am giving blood again for my second time. Hopefully it goes better than the first time. I thought that when giving blood you should fast like when you go for blood tests. Unfortunately that was not the case and I got really pale and “was on the verge of passing out” even though I felt fine.

So tomorrow I am going to have a huge lunch before I go. I am a little wary because last time they said I had really good veins for giving blood and that my veins would be the “training veins for the new nurses” the next time I came in. To me that just doesn't seem like a very good thing to tell a person if you want them to give blood again.

Friday, June 10, 2005 6:54:53 PM (GMT Standard Time, UTC+00:00)  #    Comments [2]  | 
Saturday, June 04, 2005

Catherine put a bunch of pictures of our Vancouver trip and the dog on her blog. Here is a sample:

Saturday, June 04, 2005 5:27:27 PM (GMT Standard Time, UTC+00:00)  #    Comments [0]  | 

U2's City of Blinding Lights Video is up over at U2.com. There is 2 versions of it up, one is for the general public and the other is for U2.com subscribers.

In the video that is open to general public,  if you look real close you can see the back of my head when the lights go up and the very beginning of the song.

The other version for U2.com subscribers is a mix of live video and the actual shoot but there isn't much Steve in it.

Saturday, June 04, 2005 4:21:50 PM (GMT Standard Time, UTC+00:00)  #    Comments [0]  | 
Friday, June 03, 2005

So far I am happy with my new hockey team that I am playing for this summer. We had 3 games this week!! We lost the first one 4-3. We should have tied but the ref called back the tieing goal with 2 minutes left!!!

Wednesday we won 9-6. But we should have beat them by more they were a very poor team but we let them get back into the game. We can't do that against a good team or we will get burnt.

Last night we ended up winning 12-5. Once again we let them back into the game but then we picked it up and just kept scoring. I scored a hat trick for my Mom for her birthday ;)

So far in 3 games I have 7 points 5 goals and 2 assists. We will see how hard it will be to defend my scoring title from last year when they post the first round of stats next week.

 

Friday, June 03, 2005 6:37:45 PM (GMT Standard Time, UTC+00:00)  #    Comments [0]  | 

I think a really cool feature to have in Microsoft LiveMeeting would be the ability to turn your recorded meetings into an RSS feed with enclosures so that you can download your recorded meetings as Podcasts. You can already record the meetings but this extra little bit would make LiveMeeting a killer app.

The reason I want this functionality is because I belong to an online virtual book club and not everyone can make the meetings at the designated time also everyone doesn't have the time to watch the live meeting replay of the meeting. It would be awesome if they could download the meetings automatically and listen to them on the way to work.

I think it would have other good uses as well. Imagine a bunch of offsite meetings held with clients where requirements for a project are discussed. The developer could listen to the meetings on his MP3 player while coding the requirements ensuring that the right requirements from the client are put into the application they are developing.

Let me know if this is a good idea or if anyone knows if it already exists.

Friday, June 03, 2005 6:27:39 PM (GMT Standard Time, UTC+00:00)  #    Comments [0]  | 

Theme design by Jelle Druyts

Pick a theme: