Oh Canada, our home and....

You tell 'em Danny!

Google is king

If you open a browser on any of the 6 computers (including an IPAQ)  in my house, you will see www.Google.ca. It's safe to say Google is the official search engine of the Lloyd household. One of them actually defaults to French.

The other day my 10 year old son asked me if I knew that Google could help you shop on the internet.

I said “Yeah it's called Froogle.” "That's it", he said "Can you show me?" So I did.

While we were there I showed him a bunch of other cool features. He was amazed. So I thought maybe I should Blog some of my favorite Google Features.

If you know of others I don't mentioned please tell me. I love a good Google feature.

  1. Spelling: I'm sure people know about this feature. Those of us who can't spell sure do. If you type in something Google doesn't recognize Google will suggest a spelling correction to you. I get a lot of use out of this feature.
  2. Calculator: Did you know you can type a calculation into Google and it will give you an answer. Try typing this into Google: 5 * 5 and hit search. 
  3. More Google Calculator: The coolest thing the calculator does is conversions. If you want to know how many kilometers are in a mile just type into Google km in a mile and hit search, try ounces in a cup or cubits in a meter. Is that cool or what?      More about the Google Calculator.
  4. Define: Google is a dictionary. You can type define: someword and Google will return all the definitions it can find for that word. For fun type in define: Google
  5. Google Sets: I love this, but have not thought of a really useful application for it. Go to Google Sets  and type in a different related word in each textbox then click one of the set buttons below. Google goes out and finds other related items. Try this, enter Ross, Phoebe, Monica and see what you get. Now try DataSet and DataTable. This is really part of Google labs, see below.

There are others I would like to take advantage of but only seem to work in the US like Local search, phone book, maps.  Here is a complete list of Google search features .

Google Labs:

If you go to labs.Google.com you will find other google ideas that are not quite ready for main stream yet. They are ideas in progress.

  1. Personalized Web Search - Get personalized search results based on your interests
  2. Web Alerts - Find out about new web pages on a topic of interest  ( I subscribe to this. Any time ObjectSharp is mentioned on the web I get an email)
  3. Web Quotes - View search results with quotes about them from other sites
  4. Voice Search -Search on Google by voice with a simple telephone call
  5. Google Compute - Donate your computer's idle time to help scientific research
  6. Froogle Wireless - Search for products from your cell phone using Froogle
  7. Google Groups - Create and join searchable discussion groups and mailing lists

Did you notice not an add anywhere. :)

Happy Goggling

Open With... the editor of your choice.

I'm on an VS IDE high lately. So to continue in this arena. Here is another tip my students and audiences seem to like.

I'm sure there is someone out there who has an XML file with a non standard extension, and they want to be able to use the XML editor in Visual Studio. But when you open the file there is no colour coding or any of the other XML editor features. This is because you are not in the XML editor. This is a nice little trick, I hope someone finds it useful.

I found this the first time I set up a Visual Studio project to hold all my NANT Scripts. NANT creates XML files with a .build extension. When you edit these XML files in Visual Studio they are not colour coded by default, because Visual Studio does not know it's an XML file.

Here is how to rectify the situation. When you open the file in Visual Studio (File->Open->File...). You will notice a drop down arrow on the open button.


Click the drop down arrow and select Open With... You should get this dialog.


Select the type of editor you want to open the file with. While you are here click on the Set as Default button. From now on whenever you open a file with that extension it will be opened in the editor you selected. In my example files with a .build selection always open in the XML editor now.

 

FTP Software

For years I have been trying to find FTP software that was good. I mean easy to use, reliable with a nice GUI. I have used all kinds over the years. I won't mention all the bad ones I used, so as not to offend anyone. None of them were very nice to use.

I asked Dan what he used for FTP. He told me the kids today use FileZilla. You have to listen to the kids, they know.

So I went to SourceForge and downloaded FileZilla. this is the best FTP software I have ever used.

It's intuitive and friendly, and so far completely reliable.

I love it, and I don't care who knows it.

Incremental Search

Barry found this and showed me some time ago. I had forgot about it and stumbled across it today. I keep forgetting it's there. I'm hoping by Blogging it I will remember.

When you are editing code in Visual Studio hit CTRL-I. You will see this little icon appear,  this is Incremental Search.

Once in this mode you can just start typing and it will find text that matches what you are typing as you type.

If you have typed the whole word but search has not found the one you want, hit F3 to jump to the next occurrence.

 

How does dynamic help work?

Did you ever wonder how dynamic help works? The Visual Studio IDE continuously emits keywords and attributes depending on what you are doing in the IDE. Lets start by turning on debugging in Visual Studio. I don't mean the kind of debugging you do to your code. It's easier if I just show you. Follow these steps. Don't worry it's harmless.

  1. Close Visual Studio .NET if it is not already closed.
  2. Open the Windows Registry Editor (RegEdit).
  3. Go to the following key:
    HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\7.0\Dynamic Help
  4. Add a new string value of "Display Debug Output in Retail" with a value of "YES."
  5. Start Visual Studio .NET.
  6. Open the Dynamic Help

Now open a solution and start working, watch the dynamic help window you will see the keywords displayed in the Dynamic help window as you manipulate your code in Visual Studio.

For example if I were to click on a windows form in VB.NET I would see the following in my Dynamic help window.

--- Keywords - priority: 500 ---
(F1 Kwd) Keyword=Designer_System.Windows.Forms.Design.FormDocumentDesigner
(Kwd) Keyword=System.Windows.Forms.Form
--- Keywords - priority: 100 ---
(Kwd) KEYWORD=VS.Ambient
--- Attributes ---
Devlang=VB
Item=Project
Item=vb
Product=VB
Product=VS
Project=Exe
ProjType=LocalProj
Selection=None
ShellMode=Design
Solution=Any
Solution=Multiple
SourceControl=FALSE
SubType=Form
UniqueFiles=resx
UniqueFiles=vb

What you are seeing are the keywords and attributes emitted by Visual Studio. This is how Dynamic help works. You can add your own custom help that displays different help links based on keywords emitted from the IDE.

Ok, so now that I know how to get the keywords, how do I add my own custom help? This is a Blog not an article so I'll give you the abridged version, you can look up the rest yourself.

Create a file called CustomHelp.xml and place it in C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\IDE\HTML\XMLLinks\1033

Here is what a sample CustomHelp.xml file could look like. Some nodes to take note of:

  • LinkGroup defines a heading in the help to group the links
  • Keywords/Kitem define which keywords trigger this help to display
  • Links/Litem the URL for the help file, the link group it belongs under, and the text to display

The above CustomHelp.xml file will generate dynamic help that looks like this. Well the last group called ObjectSharp Coding Standards

The keyword I used in the sample above (Ambient) is a special keyword. It is always present. Therefore if you want a help file to always be accessible use the keyword ambient in your CustomHelp.xml.

As I'm sure you can tell I have only scratched the surface on this subject. There is plenty more information in the MSDN library.

Tech Ed Bloggers

There are a bunch of ObjectSharp people and Friends of ObjectSharp at Tech Ed this week. Their Blogs are making good reading. I feel like I'm there. If you wish you had gone to Tech Ed or wonder what you are missing. Check out the Blogs below.

ObjectSharp People

Friends of ObjectSharp

Everyone else

The Immediate Window

I notice a lot of developers do not use the Immediate window. If you are one of those users,  do yourself a favour and check it out. It's terribly useful. For those of you who are not familiar with it here are some highlights to get you started.

The window I'm talking about in VS 2003 is the Command Window. This window can be used to either issue commands or to debug and evaluate expressions in Visual Studio .net. To open this window, press CTRL+ALT+A, or click on the menu View->OtherWindows->Command Window

For the record I believe I heard these two windows will be seperated in Whidbey.

Below is a quick description of the two modes.

Mode

Title Bar Displays Description
Command Mode Command Window Allows the developer to perform any command available in Visual Studio via a command line interface.
Immediate Mode Command Window - Immediate Used when debugging an application for evaluating expressions, print variable values, or execute statements. It can also be used to change the value of a variable during debug or even to execute a function or statement.

How to switch between the two modes?

  • When you are in command mode you can enter the command >immed to switch to immediate mode.
  • When you are in Immediate mode you can switch to command mode by typing >cmd
  • If you wanted to execute one command in immediate mode prefix it with a > ie: >alias

Immediate Window:

This is the mode I use most. It's like a command line quickwatch, but it has intellisense. To evaluate an expression you must prefix it with a ?

  • ?this.Order.OrderTable(0).itemarray
  • ?this.Order.OrderTable(0).CustomerId
  • ?this.Order.OrderTable.count

In previous versions of the Immediate window the UP and DOWN ARROW keys move the cursor to previous commands. In VS .Net they allow you to scroll through previously issued commands. If you scroll to a command highlight it and hit enter it will be copied as the next command to be executed.
Once in a project, the Command window can be opened in Immediate mode by pressing CTRL+ALT+I, or click on the menu Debug->Windows->Immediate.

One more quick tip. You can copy your command from the immediate window into the watch window. So in other words get it right with the help of intellisence then paste it into the watch window so you can see it permanently.

The Command Window:

Just to give fair time to both modes. The Command Window makes full use of intellisense to help you find and execute a command within VS.

You can also create your own alias for any command for example: You can type the following to save all the files in your solution.

 

However, if you used this command a lot you could create a shorter alias of this command like fs.
To create an alias enter the following into the command window.

>

From now on you can just type fs to perform a file.Saveall

To see a complete list of aliased commands just type alias in the Command Window and it will list all the aliased commands.

 

Golf should be 12 holes.

I'm looking for investors!

This idea will change golf forever. I think I can at least double this industry's revenue with one small inexpensive change.

I want to open a golf course where a round of golf is 12 holes. Don't go, hear me out.

I golf occasionally. I would golf more but it takes too damn long. I don't have 4-5 hours in a day to spend golfing. Not to mention the time spent at the 19th hole.

Inevitably every time I golf I get to about the 14th hole and I spend the rest of the game wishing it was over.

12 holes just makes sense. Here are some reasons why.

  1. You could play 6 holes in the morning before work without having to go to an executive course.
  2. However over lunch you could easily play a 6 hole executive course.
  3. All the courses out there now don't have to change anything but the numbers at each hole. Every 18 hole golf course just has 3 6's.
  4. They can get more people golfing starting 3 at a time like they do on 27 hole courses now.
  5. If a round is just over 2 hours instead of 4. More people can golf in a day.
  6. It will be easier to get a tee off time.
  7. More people would golf because they wouldn't be saying “I wish this was over” on the 14th hole.
  8. More people would golf because it would be less expensive.
  9. Yet the courses would make more due to the increase in volume and staggered tee offs.
  10. For the avid golfer who wants to spend more time on the course. They can still do 18 by golfing 12 and then the  front 6 again.
  11. Some people even say they want to golf two full rounds or 36 holes. No problem, for 36 holes you would get in 3 rounds that day.

Now there are people who don't like change. These people will say golf has always been 18 holes and that it's a tradition. This is not true. Please read the article below. ( I could have just typed this in but it's much more effective this way, don't you think)

OK, so who wants to be in on the ground floor of this.

Maybe you don't want in? But if you have more reasons why golf should be 12 holes please share them with me.

So you think you know Pointers?

This might be a bit of fun for the old C programmers out there like me.

A long time ago I used to teach C programming. This was before C++ and Windows. When we used to have to write whole applications that fit into 250K of Ram because the rest of the 640K was used up by various hardware drivers, and DOS, and you had to use tools like Quarterdeck QEMM to move drivers into memory locations above 640K. These were the days when hardware was expensive and developers had to really worry about memory usage and pointers and stacks..... Oh sorry I got a little carried away there, that is not what this Blog is about.

Where was I? Oh yeah I used to teach C, at the end of every test I used to have bonus questions for my students. I found one the other day and thought I would put it on my Blog for fun. This particular bonus question was meant to test their understanding of the pointer operators ( * & ), amoung other things.

Now to use pointers in C#, I had to make the code unsafe.  With todays compilers and editors, it would be easy to see what this little method does. So see if you can figure it out just by looking at the code right here in my Blog.

Can you tell me what i will equal, and therefore what will be written to the console.

unsafe static void Foo()
{
      int i, k=5;     /* Declare some Integers */
      int *j;           /* Declare a pointer */

      j = &k;        /* Assign a Value */
      i = 10/*j;     /* Do the Math */;

      Console.WriteLine( i.ToString() );
}

If you are thinking this is too easy, and the answer is 2. Try again.