Apr
13
2012

JavaScript RegEx Pattern for URLs

Here is a simple JavaScript RegEx pattern for extracting any URL that begins with http:

<script type="text/javascript">

// example string, looks like a tweet to me :)
var str="Awesome resources for HTML5! http://bit.ly/palermo4html5 #HTML5";

// UPDATED 2012-07 thanks to ArthurDent69!
// could also be written as:
// var regexUrl = new RegExp("https?:[^\s]+", "gi");
var regexUrl=/https?:[^\s]+/gi;

// if a match is found, the return type is an array of matches
document.write(str.match(regexUrl));

// output of above line of code:
// http://bit.ly/palermo4html5

</script>
    Copyright © Microsoft Corporation. All rights reserved.
    The code provided in this post is licensed under the Microsoft Public License (Ms-PL).
Apr
11
2012

HTML5 Delta Reference

Curious about the changes in HTML5?  The W3C recently published an online reference to easily define the deltas. 
This reference has been added to the popular HTML5 resources on this site Smile 

HTML5Deltas

    Copyright © Microsoft Corporation. All rights reserved.
    The code provided in this post is licensed under the Microsoft Public License (Ms-PL).
Mar
29
2012

Unable to Activate Windows Metro Style Application

If you receive the following error in Visual Studio…

“Unable to activate Windows Metro style application”

… or a similar error in Blend…

“Unable to activate application --- on the Local Machine”

… the quickest fix is to delete the contents of the bin directory and rebuild the project.

    Copyright © Microsoft Corporation. All rights reserved.
    The code provided in this post is licensed under the Microsoft Public License (Ms-PL).
Mar
22
2012

Sneak Peek at CSS3 Course

Here is a sneak peek of my latest course at Pluralsight regarding CSS3:

[click here for a listing of all my courses at Pluralsight]

    Copyright © Microsoft Corporation. All rights reserved.
    The code provided in this post is licensed under the Microsoft Public License (Ms-PL).
Mar
22
2012

AZ MVPs of the Year

Congratulations to all the Microsoft MVPs of the Year!

Two of the MVPs are based right here in Arizona.

Joseph Guadagno was awarded MVP of the Year for C#.  Joe has been an ongoing contributor to the community through is efforts with the Southeast Valley DotNet User Groug (SEVDNUG), Desert Code Camp, AZGiveCamp, and as President of INETA North America (just to name a few).

Joe works full time (like most of us) and still manages to contribute so much to the community.  Congratulations to Joe for being recognized by Microsoft and by his peers a “leader by example” among MVPs.

 

scottcate

Scott Cate was awarded MVP of the Year for ASP.NET.  Scott is well known in the Arizona community.  Scott is a long-time user group leader, and is the founder of AZGroups.org, a site dedicated to listing all the technical user groups (regardless of platform) in Arizona as a service to developers.  Last year, Scott was awarded the title – Microsoft Regional Director.  Scott has been quite active in the southwest region of the USA promoting the Windows Phone Unleashed events.  He is a regular speaker at many technical events locally, nationally, even internationally.

Despite his busy schedule, Scott is devoted family man – always beaming with pride over his children.  Kudos to Scott for being recognized with such a high honor (though no surprise for those who know him).

If you have benefited from the hard work of either of these gentlemen, please enter your comment below!

    Copyright © Microsoft Corporation. All rights reserved.
    The code provided in this post is licensed under the Microsoft Public License (Ms-PL).
Mar
19
2012

The Hunger Games–Capitol Tour

The most anticipated movie of the year hits theaters this Friday, March 23rd – The Hunger Games.  If you have read the book (or trilogy), you are probably giddy with excitement to see your favorite characters come to life on screen in a somewhat morbid view of a fictional world of the future.

If you are a fan, you are invited to take the Capitol Tour!  Sign in today to see which district you belong to.  Myself?  Of course I was assigned to District 4.

image_dip

    Copyright © Microsoft Corporation. All rights reserved.
    The code provided in this post is licensed under the Microsoft Public License (Ms-PL).
    Copyright © Microsoft Corporation. All rights reserved.
    The code provided in this post is licensed under the Microsoft Public License (Ms-PL).
Feb
17
2012

Windows 8, You Look Great!

I love the new logo for Windows 8!  Learn more at the Windows Team Blog.

    Copyright © Microsoft Corporation. All rights reserved.
    The code provided in this post is licensed under the Microsoft Public License (Ms-PL).
Feb
14
2012

A .NET Love Story

Originally posted in 2005

I have a managed heap of memories regarding you - none of which are IDisposable. Therefore I am compiling my references, and persisting them to you in this file, which is ISerializable and will last for generations (at most 3).

I remember how I met you... heartbroken over java (how slow that old relationship was). When I first heard of you, I heard you were COOL. Then I found out how diverse you were in so many languages. You marshalled right over to my world. How easy it was for you to communicate over so many platforms! You understood my profile, and now I could see sharp-ly into your IIdentity.

You took me to your visual studio - it was RAD. So many views and hidden regions! You were so organized with your task list. I love how everything was color coded. It was in that environment when I broke down and stated: "You auto-complete me..."

We had our bugs to work out - we were not the exception. One time you thought we had a break-point. But we would continue to try. Nothing went unhanlded. We caught everything, and finally we come to this moment.

How do you do it? You stay true to so many standards, yet manifest so much. You have such class! There is no other type like you. As I reflect about you, I see that you have many methods - some very internal, some private, and some very protected. Some of your ways are too abstract to know. But what is public about you, anyone can see why you encapsulate so much inside. From what I derive, we can override anything (unless we sealed it).

Let's not box ourselves into the typical cast. We should look to the future - is it generic? I don't know - I may be partial. I will have to iterate over this until I yield.

How long will we survive?

while (this!=null) { continue; }

    Copyright © Microsoft Corporation. All rights reserved.
    The code provided in this post is licensed under the Microsoft Public License (Ms-PL).
Feb
13
2012

Adventures in Excel–Array Formulas

This NBA season, I decided to create a Fantasy Basketball League.  I had no idea how seriously involved I was going to be.  Within the first two weeks, I created an Excel spreadsheet to help me analyze my team.  As a result, I learned some cool tips & tricks in Excel.

Array formulas helped me to accomplish the following scenario:

fbb_excelcount

Look at the GREM (games remaining) column.  It looks at the content on the same row that includes columns MON through SUN.  At the beginning of a new week (which begins on Monday), I want to see how many games the player has yet to play.  If a number appears in the column (as seen in the case with LeBron James), that means that game has been played, so only count the remaining games in the week.

Although not shown in the screen capture above, should the word “bench” appear in any column referencing a day in the week, I do not want that counted in the GREM column.

How did I make it work?  Here is the formula:

{=COUNT(IF(ISNUMBER(VALUE(AN9:AT9)),"",IF(AN9:AT9="bench","",1)))}

Do you see the curly braces surrounding the formula?  This is accomplished by pressing [CTRL] [SHIFT] [ENTER] when the formula inside is complete (do not manually add the curly braces).  This syntax is known as an array formula.  In the example above, column AN is Monday, and column AT is Sunday.  Row 9 is referring to the line of data for LeBron James.

Now here is what is awesome about array formulas.  Notice how I am evaluating AN9:AT9 as if it were a single value?  For the developer nerd in you, consider this like a FOR EACH statement.  It is basically evaluating each cell in that range to determine if it meets the criteria.

If you have complex business rules that require per cell criteria evaluation, array formulas will be one of your most powerful Excel allies!

    Copyright © Microsoft Corporation. All rights reserved.
    The code provided in this post is licensed under the Microsoft Public License (Ms-PL).

Resources

Archives

Team Blogs

Download OPML file OPML