# Chris Pietschmann

## HTML5 Day 1: New tags work in older browsers? Awesome!

I recently decided to really dig into HTML5 to see what it’s all about. After all, the web (err... tubes) is full of talk about how the new HTML5 Canvas element will bring an end to both Silverlight and Flash. In reality HTML5 is much more than just the Canvas element. In fact, HTML5 brings with it a large list of enhancements, including 28 new elements and form controls that do client-side data validation for you! Specification Doc or Book? Instead of reading the enormous HTML5 Specificat... [More]

## Bing Maps JS: Calculate Area of Circle and Draw Circle on Map

Something that can be usefull at times in being able to calculate the total Area of a circle, especially when plotting it on a map. So, I decided to slightly modify my "Draw a Circle Radius Around Lat/Lng Point" to make it also calculate the Area of the circles and display that value within the TItle of the Circle Shapes Pushpin. Remember, back in Trig class, it's fairly simple to calculate the area of a circle. You just Multiply Pi by the Radius Squared. Area = Pi * (radius * radius) Anyway,... [More]

## MvcMaps Preview 1 – A Unified Bing/Google Maps API for ASP.NET MVC

I spent some time lately working on bringing some of the concepts of Web.Maps.VE to ASP.NET MVC. The concepts I’m referring to are Simplicity and Ease of Development in making the implementation of mapping within ASP.NET MVC applications as simple as possible along with the Flexibility and Customizability of the Base Mapping API itself. Then I thought, Since I’m building an abstraction layer to simplify Bing Maps development, why not implement it in a flexible manor as to be able to ... [More]

## Easily Convert Between HTML and RGB Colors using JavaScript

To make things easier for converting between HTML Colors and RGB Colors using JavaScript I wrote the below “ColorConverter” object. This object has 2 methods that easily allow you to convert between HTML Colors (ex: #FF33C2) and RGB Colors (ex: 255, 0, 233). There isn’t anything built into JavaScript for doing this, and it can come in very handing when working with the Bing Maps VEColor object. Usage Examples: var rgb = ColorConverter.toRGB("#FF000A"); // returns {r:255, g:0, b... [More]

## Simplovation Web.Maps.VE v3.0 Now With FREE Edition!

Today, I just posted the latest Web.Maps.VE v3.0 release. The coolest thing about this new version is that is has a FREE Edition for non-commercial use! Download Web.Maps.VE v3.0 FREE Edition! There are a few new things in this latest release, but the most significant are the following performance updates: Microsoft CDN (Content Delivery Network) Support Added. This helps improve the Bing Maps content delivery speed by up to 82% JavaScript Performance Optimizations. All the JavaScript cod... [More]

## jHtmlArea – Adding Custom Toolbar Buttons

I’ve gotten a couple questions lately about extending the jHtmlArea WYSIWYG editor, so I thought I’d post a little bit about how to add your own custom toolbar buttons to it. There is one example that is included with the component, but that doesn’t cover inserting some html into the editor, so I’m going to cover that here. You can download the jHtmlArea Editor here: http://jhtmlarea.codeplex.com/Release/ProjectReleases.aspx This article was written with jHtmlArea v0.6.0 ... [More]

## A Simple ScriptManager for ASP.NET MVC

The ASP.NET AJAX ScriptManager makes it really easy to include JavaScript references and register JavaScript blocks into the rendered Page output of an ASP.NET WebForms application. However nice the ScriptManager control is, it’s still just a WebForms control for use with ASP.NET AJAX; thus it’s use isn’t really supported with ASP.NET MVC. Also, to make things just a little more difficult, ASP.NET MVC doesn’t have it’s own “ScriptManager” implementation.... [More]

## OpenStreetMap: Get FREE Web Mapping with Road Maps for your Applications

OpenStreetMap has been around for awhile and provides free geographic data that can be used by anyone. The data is all community created/contributed and that’s why it’s free to use. Other mapping services such as Bing Maps for Enterprise and Google Maps license their geographic data from some other third party and that’s why they cost thousands of dollars per year to use within commercial applications. Using OpenStreetMap with JavaScript The screenshot on the left is showing ... [More]

## JavaScript: Easily "Extend" an Object/Element

If you use jQuery then you may be familiar with its "jQuery.extend" method. The "jQuery.extend" method allows you to easily extend one object with one or more others. This is something that can really come in handy, especially when dealing with passing in "options" to a method, and needing to have them "default" to certain values. For Example: [code:js] // "Default" to showing both Toolbar and Footervar defaultOptions = { showToolbar: true, showFooter: true }; function MyObject = function(op... [More]

## jHtmlArea 0.6.0 Update with Improved Functionality

I just posted a pretty good update the the jHtmlArea project that includes quite a few more toolbar buttons and a new Color Picker Menu extension/plugin (jHtmlAreaColorPickerMenu) that adds a nice, simple color picker when using the "forecolor" toolbar button. jHtmlArea is a simple, light weight, extensible WYSIWYG HTML Editor built on top of jQuery. This component allows you to easily display a WYSIWYG HTML Editor in place of any TextArea DOM Elements on the page. The minified script alone is ... [More]

## jHtmlArea - The all NEW HTML WYSIWYG Editor for jQuery

The last couple days I spent time working on a new simple, lightweight, extensible HTML WYSIWYG editor that's built on top of jQuery. I know there are a ton of existing editors, but I couldn't seem to find any with a truely simple, lightweight design that allowed for really easy extensibility, and that's built on top of jQuery to take advantage of the cross-platform capabilities that jQuery has to offer. I feel that I've come up with a really nice HTML editor component that has some pretty usefu... [More]

A while ago Jon Galloway posted a short article titled "Adding a DotNetKicks image via JavaScript" which contains the small amount of JavaScript code necessary to add a DotNetKicks.com Image / Badge to your web pages. The DotNetKicks Badge is essentially a link that allows users to go to DotNetKicks.com to vote for you web page, and the badge also displays the total number of "kicks" that your page has received. Since jQuery has become insanely popular since Jon originally posted his JavaScript ... [More]

## Creating Ruby-like "Extensions" in JavaScript

I've been spending a little time here and there learning Ruby. I haven't dug much into Rails yet, but have mostly been just focusing on the Ruby language and what it has to offer. Ruby has some nice "helper" methods attached to it's base data types that make iterations and other simple operations even simpler. I've ported a couple of these methods over to JavaScript so I could play around with using some of these "Ruby-isms" with my favorite web-based, dynamic programming language. Below are so... [More]

## Managed JScript on the DLR from Microsoft is DEAD!! WHY?!??

I’ve been questioning here and there as to what happened to Managed JScript on the Dynamic Language Runtime. The most recent preview release is really old, and it has since been taken out of any further preview releases of the DLR, where as IronRuby and IronPython continue on. No More Managed JScript on the DLR? For some time I never really got any good answers. Well, it’s really sad to hear that apparently Microsoft decided to drop it completely. According the this link, a member on the DLR ... [More]

As a web developer I use JavaScript, HTML and CSS a lot. I do however build desktop applications too, but can’t use those same tools/languages to build them. So, for quite some time now I’ve wanted to be able to build Desktop Applications using the same JavaScript, HTML and CSS that I use to build Web Applications. Now with the help of Adobe AIR it can finally be done with ease, and even have multi-platform support. In this post I’m going to discuss the basics of creating a Ja... [More]

## Bing Maps Shapes (VEShape) to WKT (Well-Known-Text) and Back using JavaScript

One of the standard methods of representing geometric shapes is by using the WKT (Well-Known-Text) standard. This is a human readable standard method of representing geometric shapes that can be used to easily pass spatial data between applications. I know GML or GeoRSS may be a little more applicable since they are based on XML, but WKT can work just fine in some cases. If you don’t know what WKT is here are a couple links for reference: http://geoapi.sourceforge.net/2.0/javadoc/org/ope... [More]

## Prototype of VEToolkit + ASP.NET MVC 1.0 Component Checked In

I just checked in an initial prototype of a reusable Virtual Earth component for ASP.NET MVC. The “VEToolkit.Web.MVC.Map” component is written as an Extension to the ASP.NET MVC AjaxHelper class, and allows for a simpler experience when implementing Virtual Earth mapping within ASP.NET MVC applications. This is an early prototype of what the component will be; it’s not a final release; but you are free to use it. Download the latest Change Set of VEToolkit The code is subject to change at any ... [More]

## Bing Maps: Modify the Opacity of an Existing Custom Tile Layer

One of the features that the Custom Tile Layer functionality of the Virtual Earth JavaScript control is the ability to modify the Tile Layers Opacity after it's been added to the Map. It does include HideTileLayer and ShowTileLayer methods to dynamically toggle the display of Custom Tile Layers, but sometimes that's just not enough customization. However, I do have some good news, there is a small technique that you can use to modify the Tile Layer Opacity as necessary. How to Change Custom Til... [More]

## ASP.NET AJAX: Create a JavaScript Component with Events

In the spirit of my "Mixing OOP and Event Driving Programming" article I posted a couple days ago; this article discusses how to implement the same thing using the ASP.NET AJAX JavaScript Library. Using inheritence (the ASP.NET AJAX way) it is even easier to implement a little Event Driven Model into your client-side, JavaScript classes/components. Event Driven Basics First we'll start by creating a Person class that inherits from the Sys.Component class. Now remember, sin... [More]

## JavaScript: Mixing OOP and Event Driven Programming

To expand on my previous article on how to create Objects in JavaScript using Prototypal Inheritence, this article will show you how to implement Event Driven Programming with those objects. Implementing Event Driven Programming in JavaScript sounds difficult, but it's actually rather simpel to implement. To keep with the Prototypal Inheritence theme, we'll create an "EventObject" class that will have the plumbing necessary for implementing Events, and then we'll inher... [More]

## JavaScript: Null Coalesce using the || Operator

I recently purchased "JavaScript: The Good Parts" by Douglas Crockford, and I found this little gem on page 21, although he listed in in the section Objects - Retrieval. It is possible to use Null Coalescing in JavaScript by using the || operator!
// Note: only this code example is quoted from the book var middle = stooge["middle-name"] || "(none)"; var status = flight.status || "unknown";
Since JavaScript retur... [More]

## JavaScript Prototypal Inheritence Explained in Simple Terms

Recently, I started working on a new open source project (you'll have to wait until the first release to find out what it is), and the goal of it is to play nicely with any JavaScript Library you want to use. That means it needs to work nicely with jQuery, prototype, ASP.NET AJAX and the such. This means that I need to grow all my own code for registering namespaces and using inheritence. One major JavaScript feature that I needed a refresher on, and ultimately get figured out, is Proto... [More]

## Virtual Earth 6.2 (Bing Maps) JavaScript Intellisense Helper Released

Today, "We" released a new updated version of the Virtual Earth JavaScript Intellisense Helper that is updated to support the brand new Virtual Earth v6.2. You can learn more about what's new in Virtual Earth v6.2 here: http://blogs.msdn.com/virtualearth/archive/2008/09/24/announcing-the-virtual-earth-web-service-and-virtual-earth-map-control-6-2.aspx It appears that Mark beat me to blogging this release (which makes sense since he's the one that posted the final ZIP of the release): http://blo... [More]

## Bing Maps: 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... [More]

## Silverlight and JavaScript Interop Basics

I've been looking into Silverlight in my spare time a bit, to see what it has to offer, and the JavaScript "Interop" is actually pretty neat and simple to use. About three months ago I wrote a post titled "Working with HTML DOM in Silverlight using the Bridge Pattern"; so I think this time I'll go over some of the basics involved with communicating back and forth between Silverlight and JavaScript. This article is written by referencing Silverlight 2 Beta 2, but should still ... [More]