Friday, January 30, 2009

LogMeIn to the rescue!

Have you ever been at work and realized you needed something from your home computer?  Have you tried calling to someone at home to send you what ever file you needed by email?  Worst yet, have you had to drive home due to the fact you wanted a file from your home computer?

Well, that very situation happens to me on a somewhat regular basis.  No, I'm not an air head, but I do work from home and the office, so sometimes, the latest version of my work is at home.  This has bugged me to no end.  I don't want to setup an FTP server at home just so I can access those files since then it becomes a management nightmare.  I want to be able to remotely control my machine from wherever I am (office, vacation, remote site) without having to install a bulky app.

I did some research and found LogMeIn.  Now this is a Remote Desktop software that works through the web browser.  It's encrypted, password protected and fast!  It's so good, that it's the unofficial remote desktop software that my co-worker use to work from home!  I use it to have access to both my computers at home and to troubleshoot computers of friends and family.  The great thing is there's an version that is free!  You read right, free!  If you can live without remote printing, sound & file moving, then you can use the LogMeIn Free edition.  If not, they have LogMeIn Pro for a small monthly fee.  For what I use it for, I use the free edition.  Simply go to http://www.logmein.com and create yourself an account, you'll be glad you did!

Wednesday, January 28, 2009

Visual Studio Google Gadget - Revisited

Since my last post on Google Gadgets, I have used my Visual Studio Recent Projects gadget on a daily basis.  It quickly occurred to me that there are enhancements to this gadget that would be useful immediately and not just to me, but to the general public.

Here's a quick rundown of the enhancements that I thought would greatly benefit my Google gadget:
  1. Change the blue underline (anchor link) to something more pleasant
  2. Highlight the item that you're over in a different color to see which one you're selecting
  3. Remove file extensions to the items listed
  4. Ability to see more than just the first 6 projects/solutions
The first 2 items is pretty self explanatory: it's ugly the way it is.  It's functional, but it detracts the eye and is esthetically unpleasant.  So I went in the code and changed it to be an off white color with no underline.  I then added code to change that color to a soft yellow when the mouse hovers over the item.

The 3rd item is simple to fix but then brings up a new issue: how do you tell the difference between a solution (.sln) and a C# project (.csproj) in the list?  My thoughts on this at the moment are:
  • add a tooltip to the items that would add the full path & filename and, to add a little bit more information, when was this item last opened.
  • add an icon in front of each item that would differentiate each item based on their extension.
I changed the code to remove all extensions, and added an icon based on the first 3 letters of the extension.
The 4th item is easy in concept: have pages of x items show up and a way to move between pages.  The implementation wasn't as easy.  It wasn't complex, but wasn't complying very well either.  Basically, I figured out how many items I wanted to display on a page (which is 7), then I used math and constants to figure out on which page the user is on to display the proper items out of all possible ones.  I gave the user 2 arrow buttons to allow the user to navigate forward and backwards in the pages.  The list is not sorted, just the same order that it is in the MRU registry.  I guess that could be a future enhancement.

The end result looks something like this:


As you can see, it looks much better than the 1st iteration of the gadget.  With all this, what's left to add you ask?  Where if you remember, I mention that a tooltip would be useful.  A tooltip with the full path of the item would be useful in cases where there multiple versions of the same project  How do you tell them apart?
 
If you have any suggestions as to what other enhancements this gadget could use, please leave a comment and I'll definitely consider it.

As always, you can download the most recent version of the gadget (Visual Studio Recent Projects-Sebastien Limoges.gg) and you can read up on what people have to say about it by going to it's Google page.

Until next time,

Sebastien Limoges

Monday, January 26, 2009

Holidays, sickness and work

Hello all and happy 2009!

I'm sorry there's been such a gap between this post and last post. With the holidays, work and me being sick, there hasn't been much time for me to post. I'm hoping to get back on track and keep you posted on my progress (or lack thereof) on my GPS Golf project.

In the spirit of this project, I went out and tried my hand at a round of golf this past Saturday and have played what is probably my worst round EVER since I've been married and moved down to Florida. I posted a 118, with at least 3 holes of 10 strokes! The other big change was that I also posted many 3 putts, which is a rarity for me usually. What is the cause of this abomination? My tempo was off, I could barely breath (breathing through my mouth, except when swinging, which raised my blood pressure I'm sure) and the fact that I'm following a friend's suggestion and changed golf balls from Nike Distance to Bridgestone e6+. Golf balls don't mess your game you say? I disagree... especially if they add about 20 yards to your distance and have enough spin to stop (or backspin) once they hit the green. Try to figure out during all this disarray which club to hit to reach the center of the green which is 156 yards away... oh and don't forget that your normal 7 iron won't do now that it's 170 yards and not 150 yards! Anywho, I have work to do. I have to work on my tempo, keep strenghtening my fingers and get better health wise. The only worthy shots to note are a 60 yards chip in the hole and a 42 foot down side hill put to save par.

With all that said, you have a good week!

Sebastien

Thursday, December 18, 2008

Visual Studio Google Gadget

I was curious as to how Google Gadgets worked, and for that matter, how they were built. I set out to Google's site and looked up Google Gadget. Found the API, downloaded the SDK and I was off to a good start. My project: list recent Visual Studio projects. One step further than that, I want to be able to select which Visual Studio version I wanted to list the projects for.

After a bit of research of how to access the registry through javascript, I was off to a good start. I created the basic form, which was basically just a shell, no real content. On the load event, it would call a method that would 1) find out which version of Visual Studio to look at 2) look under the proper Visual Studio folder and see what recent projects are in the MRU. For each project found, it parses the string path and keeps the solution name and sticks it in a label on the form. If no projects are found, it creates a label that says "No Projects".

I then proceeded to create the Options page, which basically is just 3 mutually exclusive checkboxes for the 3 Visual Studio versions in question (2003, 2005 & 2008). Based on what is selected here, this will affect what is displayed on the main form.

Finally, I worked on the information displayed in the About page. I created the package (*.gg file) and tested it out thoroughly. It works like a charm!

If you're interested, here is the code (VisualStudioProjects.zip) and the gadget (Visual Studio Recent Projects-Sebastien Limoges.gg).

Tuesday, December 9, 2008

Google Maps vs Virtual Earth

I started looking at the details of Google Maps (GM) and noticed that they ignore everything after the 6th decimal. Normally, I'd say that's good enough, but in the case of GPS locations, that is very limiting. I then looked at Virtual Earth (VE) and noticed they didn't have that limitation. The other advantage of VE vs GM is that there's a higher threshold for requests per day and no need to register to receive a special key.

So I set out to test the flexibility of this Virtual Earth and quickly notice that it's using HTML and JavaScript inside a browser. This might be troublesome later when I try to stick this on the Window Mobile 6 (WM6) platform, but I'll deal with that later. For now, I just want to see if I can do what I want in a quick prototype fashion.

I start looking at the Virtual Earth SDK (http://msdn.microsoft.com/en-us/library/aa905677.aspx) and looking at the live demo (http://dev.live.com/virtualearth/sdk/) I see all I could possibly want for this project: type of map (Road, Satellite, hybrid), I can add pushpins (which are Shapes in VE) and I can grab coordinates by responding to mouse events.

After a few hours of testing and messing around with the different possibilities and permutations, I came up with a finished product that quickly demos the ability of VE for this project. You can get the code for this example at the bottom of this entry.

For the purpose of this prototype, I went back again to my good old blue hole #1 at NAS Jacksonville. I first set the "center" of the hole to get the appropriate map. I then set tentative 100, 150 & 200 yds markers and I set another one to simulate where I'd be on the tee box. I add event handlers for the mouse clicks. I set different functionality for both left click and right click. Left Click gets the coordinates of where I clicked on the map both in pixels & in latitude and longitude. It also tells me the distance (yds & ft) from where I clicked to where I'm currently at. Right Click sets my new current location, which would be handled by the GPS data normally. I also added two buttons, a plus and a minus to assist with zooming in and out (if you don't have a scroll button on your mouse). You can see below a screen shot of what it looks like in IE6.

All and all, I'm very happy with this prototype. The next step will be to figure out how to stick this inside the WM6 environment.

Until next time,

Sebastien Limoges

Monday, December 1, 2008

Upcoming MSDN Tiki Hut Roadshow related to my project efforts

I found out that there will be an MSDN Tiki Roadshow this Wednesday, December 3rd @ the FCCJ North Campus and one of the sessions relate to GPS programming. I'm going to make my best effort to be there to see if there's any aspect of data analysis that I'm forgetting and to see how they put a solution together.

For more info, go to the event's site: https://msevents.microsoft.com/CUI/EventDetail.aspx?EventID=1032389331&culture=en-US

Saturday, November 22, 2008

It all starts with the math...

Okay, maybe not, but I thought that for this project, this would be a major part of the functionality: calculating the distance between two points. How exactly do you calculate the distance between to coordinates? Well, you can use some basic math to figure it out... if the earth was flat. Then there is the spherical formula, which would be nice, if the earth was a perfect sphere. What we end up with is a spheroid (sphere flattened at the poles), and the best formula to use for this (as per my Google research) is the Haversine formula.

To use the Haversine formula, you have to make sure your coordinates are in radians, not degrees. That's simple: radians = PI / 180 * degrees. How do you go from 30° 13' 4.07" N to something the formula can use : 30.21779722222222? You parse the string. Everything is related to 1 hour. So 30 / 1 + 13 / 60 + 4.07 / 3600 gives you the 30.21779722222222 and the N gives you the sign (+). If it was South or West, it would have been negative. The formula returns miles, so if I want yards, I multiply the result by 1760 and if I want feet, I multiply by 5280.

Now that I had figured out the formulas, I set out to create a class that would handle this work. I create a class called Haversine (after the formula used) and create a Distance method that returns a double and takes in 3 parameters: Position 1, Position 2 & Distance Type. Positions are a structure containing 2 double values for latitude and longitude. I also create a method that converts degrees into radians and vice versa. The last method is parseReg which takes a string. Basically it converts a value (30° 13' 4.07" N) that is degrees, minutes, seconds & direction into a double (30.21779722222222).

To test this puppy out, I use coordinates from my favorite golf hole at NAS, Red Hole # 1. I take the coordinates of the center of the green and the coordinates of the 200 yard marker. So the center of the green's coordinates are 30 13 4.07N latitude by 81 40 58.55W longitude. The 200 yard marker's coordinates are 30 12 58.18N latitude by 81 40 57.89W longitude. Plug those in the class and I get a result of 199.951410648 yards. For golf application, I'm willing to take this as pretty accurate, especially since the coordinates for the hole were captured off of Google Earth's site, not physical reading on the course.

Well, I'm very happy with the progress made today. I have a class that can handle all the math behind calculating the distance between to points in either yards or feet. The next hard part will be to use actual satellite pictures (probably from Google Earth's site), get coordinates from all 4 corners of the picture and then be able to use those coordinates to be figure out the distance between a point on that picture and the current GPS device location. To explain, let's say I'm looking at a bird's eye view of the hole I'm on. I'm on the tee box and I want to know how far is it to reach that creek on the left. I click on the screen where I see the end of the creek on the left and based on my current coordinates and the coordinates of where I clicked, it tells me that it's 187 yards out. That's the next goal.

Until next time,

Sebastien Limoges

The code of the Haversine class is available for download below.