Microsoft Most Valuable Professional

Chris Pietschmann

An MVP From Wisconsin

Can you do 100? Pushups that is.

Today, I was introduced to hundredpushups.com, via a Tweet by Scott Hanselman. In short, the One Hundred Pushups training program is a simple program that requires about 30 minutes a week of exercise doing pushups, with the goal of working up to being able to do 100 consecutive pushups at the end of the 6 weeks program. This is such a simple program, it's free, and there isn't much easier than doing pushups.

 

What is the hundred pushup program?

Here's a quote from the website:

If you're serious about increasing your strength, follow this six week training program and you'll soon be on your way to completing 100 consecutive push ups!

Think there's no way you could do this? I think you can! All you need is a good plan, plenty of discipline and about 30 minutes a week to achive this goal!

No doubt some of you can already do 50 consecutive push ups, but let's face it, you're in a big minority. Most of you reading this won't even be able to manage 20 pushups. Actually, I'm sure many of you can't even do 10.

However, it really doesn't matter which group you fall into. If you follow the progressive push ups training program, I'm positive you'll soon be able to do 100 push ups!

 

My Initial Test

I did the initial test today and was able to do 30 pushups. As I remember, I haven't been able to do many more consecutive pushups than this, even in high school when I did some light weight lifting for a little while. I started some other light weight lifting today as well, and I am planning to do other regular exercise (like walking, biking, etc.) and eat a little better as well. I actually went on my first 5 mile bike ride in 2 years the other day. I had to pump the tires up on my bike first of course.

I'll post my results of the One Hundred Pushups program here to keep you updated, and possibly help remind you to do it too.

So... How many pushups can you do? I encourage you to take the challenge.

Currently rated 2.7 by 3 people

  • Currently 2.666667/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Categories: health
Posted by crpietschmann on Thursday, July 31, 2008 7:02 PM
Permalink | Comments (1) | Post RSSRSS comment feed


Why wait for Windows 7? Dell XT has Multi-Touch already

Really the only feature that Microsoft has promised for the next version of Windows after Windows Vista, is Multi-Touch. We're all becoming familiar with the idea of multi-touch displays thanks to the iPhone and iPod Touch, but it's about time for this capability to come to the PC (or rather Laptop / Tablet). I haven't owned a Table PC yet, but I've had my sights on getting one for a while. I just found out that the Dell XT (Dell's version of the convertable laptop / tablet) not only has touch capability, but through it's capacitive digitizing hardware is capable of Multi-Touch as well!

Below is a video on YouTube demonstrating the Dell XT's Multi-Touch capability enabled by the new "firmware" that is supposed to be out now.

Video Link: http://www.youtube.com/watch?v=arrkdO_SDm8

Here's another demo of the XT's Multi-Touch: http://www.youtube.com/watch?v=pmOBETxIyfk

Also, if you are interested in learning more about the Multi-Touch functionality coming in Windows 7, you may be interested in checking out the below links:


Being a developer, one of my initial thoughts about the Dell XT is to wonder if there is a programming API for the Multi-Touch capabilities to be able to take advantage of it within my own applications. There doesn't seem to be an API in the works, but there is a request for one over at ideastorm.com, so go vote for it and get Dell to implement one.

http://www.ideastorm.com/article/show/10079800/Offer_tablets_with_capacitive_multitouch_and_a_publicly_available_API

Also, another related idea, I wonder when Dell or anyone else will start to come out with LCD displays with this same Multi-Touch capable technology?

Now if only I could justify purchasing one of these for myself...

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:
Categories: General
Posted by crpietschmann on Wednesday, July 30, 2008 9:07 PM
Permalink | Comments (3) | Post RSSRSS comment feed


C#: Generate WebPage Thumbmail Screenshot Image

There are a few services out there that serve up screenshots of any webpage for you to display on your website. One popular one is Kwiboo; this is the one that DotNetKicks uses. For some time now I've wondered what the easiest way to do this in .NET was, and today I stumbled upon the undocumented WebBrowser.DrawToBitmap method that makes this extremely easy to do.

By the way, I stumbled upon the WebBrowser.DrawToBitmap while taking a look at the source code for the WebPreview tool over at SmallSharpTools.com.

Here's a sample method that returns a Bitmap representation of a webpage:

public Bitmap GenerateScreenshot(string url)
{
    // This method gets a screenshot of the webpage
    // rendered at its full size (height and width)
    return GenerateScreenshot(url, -1, -1);
}

public Bitmap GenerateScreenshot(string url, int width, int height)
{
    // Load the webpage into a WebBrowser control
    WebBrowser wb = new WebBrowser();
    wb.ScrollBarsEnabled = false;
    wb.ScriptErrorsSuppressed = true;
    wb.Navigate(url);
    while (wb.ReadyState != WebBrowserReadyState.Complete) { Application.DoEvents(); }


    // Set the size of the WebBrowser control
    wb.Width = width;
    wb.Height = height;

    if (width == -1)
    {
        // Take Screenshot of the web pages full width
        wb.Width = wb.Document.Body.ScrollRectangle.Width;
    }

    if (height == -1)
    {
        // Take Screenshot of the web pages full height
        wb.Height = wb.Document.Body.ScrollRectangle.Height;
    }

    // Get a Bitmap representation of the webpage as it's rendered in the WebBrowser control
    Bitmap bitmap = new Bitmap(wb.Width, wb.Height);
    wb.DrawToBitmap(bitmap, new Rectangle(0, 0, wb.Width, wb.Height));
    wb.Dispose();

    return bitmap;
}

Here are some example usages of the above method:

// Generate thumbnail of a webpage at 1024x768 resolution
Bitmap thumbnail = GenerateScreenshot("http://pietschsoft.com", 1024, 768);

// Generate thumbnail of a webpage at the webpage's full size (height and width)
thumbnail = GenerateScreenshot("http://pietschsoft.com");

// Display Thumbnail in PictureBox control
pictureBox1.Image = thumbnail;

/*
// Save Thumbnail to a File
thumbnail.Save("thumbnail.png", System.Drawing.Imaging.ImageFormat.Png);
*/

Currently rated 5.0 by 4 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Categories: asp.net | General
Posted by crpietschmann on Wednesday, July 23, 2008 9:43 PM
Permalink | Comments (12) | Post RSSRSS comment feed


Free Vista SP1 Support through March 18, 2009

Microsoft is offering Free technical support for Windows Vista SP1.

Free, unlimited installation and compatibility support is now available for all worldwide customers using Windows Vista SP1. Telephone support is available worldwide. Some countries also offer Chat and Email support.

This is effective from now until March 18, 2009.

Find out more information and access the service here: http://support.microsoft.com/common/international.aspx?rdpath=1&prid=11274&gprid=500921

I just thought I'd post this in case anyone isn't aware of this yet, and would like to take advantage of it.

Currently rated 4.0 by 1 people

  • Currently 4/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:
Categories: General
Posted by crpietschmann on Wednesday, July 16, 2008 9:30 PM
Permalink | Comments (0) | Post RSSRSS comment feed

dotNetExt - .NET Extension Method Library - v0.1 Beta Released

This is the first release of a small, new project I created. This is just the first release of the project, and I'll keep adding more functionality to it if there is enough interest by me or others in the project. So, please post any comments you have in the project discussion area.

dotNetExt - .NET Extension Method Library

dotNetExt is a small Extension Method Library for .NET 3.5 that extends the BCL Types with helper methods that make simple tasks simpler. So far there are extensions for the Object, Array and String BCL Types. The library is flexible so you can Import All Extension Methods or just the Extension Methods for the BCL Type you want.

Download Here: http://codeplex.com/dotNetExt

Library Usage

You can include the entire library of Extension Methods by Importing the dotNetExt namespace. Alternatively you can Import just the Extension Methods you want (grouped by Base Class Library Type) by including that specific extension collections namespace.

// Include All Extension Methods
using dotNetExt;

// Include Only The Array Extension Methods
using dotNetExt.Array;

// Include Only The Object Extension Methods
using dotNetExt.Object;

// Include Only The String Extension Methods
using dotNetExt.String;

Extension Methods

dotNetExt namespace

Importing this namespace you will import all the Extension Methods from the below namespaces.

dotNetExt.Array namespace

This namespace includes Extension Methods for the System.Array Type only.

  • IsEmpty() - Returns a Boolean indicating whether the Array is Empty (is Null or has a length of zero).

dotNetExt.Object namespace

This namespace includes Extension Methods for the System.Object Type only.

  • IsType() - Returns a Boolean value indicating whether a variable is of the indicated Type
  • IsArray() - Returns a Boolean value indicating whether a variable points to a System.Array.
  • IsDate() - Returns a Boolean value indicating whether a variable points to a DateTime object.
  • IsDBNull() - Returns a Boolean value indicating whether an expression evaluates to the DBNull class.

dotNetExt.String namespace

This namespace includes Extension Methods for the System.String Type only.

  • Left() - Returns a string containing a specified number of characters from the left side of a string.
  • Right() - Returns a string containing a specified number of characters from the right side of a string.
  • EncodeHtml() - Returns the String HtmlEncoded.
  • DecodeHtml() - Returns the String HtmlDecoded.
  • EncodeUrl() - Returns the String UrlEncoded.
  • DecodeUrl() - Returns the String UrlDecoded.
  • EncodeBase64() - Returns the String Base64 Encoded.
  • DecodeBase64() - Returns the String Base64 Decoded.
  • ToByteArray() - Returns a Byte Array of the String.

Currently rated 4.5 by 2 people

  • Currently 4.5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Categories: General
Posted by crpietschmann on Wednesday, July 16, 2008 6:50 PM
Permalink | Comments (0) | Post RSSRSS comment feed

C#: Enhance Enums using Extension Methods

Extension Methods are one of the coolest features that have been added in .NET 3.5. I've heard arguments that there is no reason to use them, and the only reason Microsoft added them is to enable the ability to buid LINQ. Well, I do not entirely agree with that statement; in fact, I have found a cool way to use Extension Methods to enhance the System.Enum object since it cannot be inherited. Even though Enum can not be inherited, it can be extended using Extension Methods.

Here's some example code for a simple Enum that has a DescriptionAttribute applied to each of it's values:

public enum LocalizationMarket
{
    [Description("en-US")]
    English = 1,
    [Description("en-ES")]
    Spanish = 2
}

And here's the code to an Extension Method that extends the LocalizationMarket Enum with the ToDescriptionString() method that returns the DescriptionAttributes value:

public static class LocalizationMarketExtensions
{
    public static string ToDescriptionString(this LocalizationMarket val)
    {
        DescriptionAttribute[] attributes = (DescriptionAttribute[])val.GetType().GetField(val.ToString()).GetCustomAttributes(typeof(DescriptionAttribute), false);
        return attributes.Length > 0 ? attributes[0].Description : string.Empty;
    }
}

The usage of this new method is really simple:

LocalizationMarket myLocal = LocalizationMarket.English;
MessageBox.Show( myLocal.ToDescriptionString() ); // this will show "en-US" in the MessageBox that's shown

Now one thing you must remember with using Extension Methods is you may not want to extend the System.Enum Type, but instead just extend the Enums you create only.

Currently rated 4.8 by 4 people

  • Currently 4.75/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Categories: General
Posted by crpietschmann on Tuesday, July 15, 2008 4:38 PM
Permalink | Comments (12) | Post RSSRSS comment feed

Virtual Earth: Polygon Search - Is Point Within Polygon?

Today, I found an article on MSDN that covers how to perform a polygon search to determine if a given Lat/Long point is within a given Polygon.

I copied the logic for searching within the Polygon and made it more reusable than what is posted in the MSDN article, so I thought I'd post it here.

if (GeoHelper == undefined)
    var GeoHelper = {};

GeoHelper.IsInPolygon=function(points,latlong)
{
    // This code adapted from the following URL:
    // http://msdn.microsoft.com/en-us/library/cc451895.aspx
    var i;
    var j=points.length-1;
    var inPoly=false;
    var lat = latlong.Latitude;
    var lon = latlong.Longitude;
    for (i=0; i<points.length; i++)
    {
        if (points[i].Longitude<lon && points[j].Longitude>=lon ||  points[j].Longitude<lon && points[i].Longitude>=lon)
        {
            if (points[i].Latitude+(lon-points[i].Longitude)/(points[j].Longitude-points[i].Longitude)*(points[j].Latitude-points[i].Latitude)<lat)
            {
                inPoly=!inPoly;
            }
        }
        j=i;
    }
    return inPoly;
};

The usage of the IsInPolygon method is fairly simple, the first parameter is an array of VELatLong point objects that make up the Polygon, and the second is the VELatLong point object you want to test to see if it is located within the Polygon. Then the method simply returns True if it's within the Polygon, and False if it's not.

Also, this code would be very easily converted to C# or VB.NET if you need to perform the search within your server-side code.

Here's a full code sample demonstrating this. This sample allows you to click on the map, and when you click it checks to see if the point you clicked is within the polygon, and it displays an alert box telling you if it is or not.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type="text/javascript" src="http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.1"></script>
<script type="text/javascript">
    var map = null;
    var polygon = null;

    function GetMap()
    {
        map = new VEMap('myMap');
        map.LoadMap();

        //Plot Polygon
        var points = new Array(new VELatLong(43.64486433588385, -79.3791389465332),
            new VELatLong(43.64508171979899, -79.3930435180664),
            new VELatLong(43.63682057801007, -79.38437461853027),
            new VELatLong(43.63946054004705, -79.36819553375244),
            new VELatLong(43.652720712083266, -79.37201499938965),
            new VELatLong(43.65793702655821, -79.39111232757568),
            new VELatLong(43.64927396999741, -79.37222957611084),
            new VELatLong(43.64486433588385, -79.3791389465332));

        polygon = new VEShape(VEShapeType.Polygon, points);
        polygon.HideIcon();
        map.AddShape(polygon);
        map.SetMapView(points);

        //Add onclick handler
        map.AttachEvent("onclick", map_click);
    }

    function map_click(eventArgs)
    {
        var latlong = map.PixelToLatLong(new VEPixel(eventArgs.mapX, eventArgs.mapY));
        alert("Is Point Within Polyline:\n" + GeoHelper.IsInPolygon(polygon.GetPoints(), latlong));
    }


    if (GeoHelper == undefined)
        var GeoHelper = {};

    GeoHelper.IsInPolygon=function(points,latlong)
    {
        // This code adapted from the following URL:
        // http://msdn.microsoft.com/en-us/library/cc451895.aspx

        var i;
        var j=points.length-1;
        var inPoly=false;
        var lat = latlong.Latitude;
        var lon = latlong.Longitude;

        for (i=0; i<points.length; i++)
        {
            if (points[i].Longitude<lon && points[j].Longitude>=lon ||  points[j].Longitude<lon && points[i].Longitude>=lon)
            {
                if (points[i].Latitude+(lon-points[i].Longitude)/(points[j].Longitude-points[i].Longitude)*(points[j].Latitude-points[i].Latitude)<lat)
                {
                    inPoly=!inPoly;
                }
            }
            j=i;
        }

        return inPoly;
    };
</script>
</head>
<body onload="GetMap();">
  <div id='myMap' style="position: relative; width: 600px; height: 400px;"></div>
</body>
</html>

You can find the original MSDN article here:
http://msdn.microsoft.com/en-us/library/cc451895.aspx

Currently rated 4.0 by 1 people

  • Currently 4/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Posted by crpietschmann on Wednesday, July 02, 2008 11:42 PM
Permalink | Comments (1) | Post RSSRSS comment feed

About the author

I'm Chris Pietschmann, go to the About Me page to learn more about me.

Search

Sponsors

Web.Maps.VE - ASP.NET AJAX Virtual Earth Mapping Server Control

Recent comments

Disclaimer


This work is licensed under a Creative Commons Attribution 3.0 United States License, unless explicitly stated otherwise within the posted content.
© Copyright 2004 - 2008 Chris Pietschmann