Chris Pietschmann

husband, father, hacker, entrepreneur, futurist, innovator, autodidact


Simple JavaScript Object Reflection API (.NET Style)

I was thinking about how JavaScript JSON serializers go about serializing objects. But how does the serializer know about each of the objects properties? I figured JavaScript must have some method of object reflection (similar to .NET Reflection) and it does. Here's a simple Reflection namespace that allows you to more easily reflect through an objects methods and properties: [code:js] if (typeof PietschSoft == "undefined") var PietschSoft = {}; if (typeof Pietsc... [More]

JavaScript ForEach Equivalent

One thing with the For Loop in JavaScript is it doesn't seem to be very well documented that you can use it to do an equivalent of a ForEach loop. Here's a short example of doing the ForEach loop equivalent in JavaScript: var names = ["Chris", "Kate", "Steve"]; for(var i in names) { alert(names[i]); } In the above code, the variable "i" is our iterator and by using the "in" keyword the "for" loop actually loops through all elements in the Array for us. Using this you no longer have to worry ... [More]

.NET 3.5: JSON Serialization using the DataContractJsonSerializer

In ASP.NET AJAX Extensions v1.0 for ASP.NET 2.0 there is the JavaScriptSerializer class that provides JSON serialization and deserialization functionality. However, in .NET 3.5 the JavaScriptSerializer has been marked obsolete. The new object to use for JSON serialization in .NET 3.5 is the DataContractJsonSerliaizer object. I'm still new to the DataContractJsonSerializer, but here's a summary of what I've learned so far... Object to Serialize Here's a simple Person object with First Name and La... [More]

.NET: Why aren't Private Abstract methods allowed?

Sometimes when creating base objects you want to create methods that are overridable by object that inherit the base object, but keep the methods from being public. However, the compiler throws an exceptions when you try to define a method as "Private Abstract". Why doesn't the compiler like "Private Abstract" methods? The reason for this is Private methods can not be overriden. So, essentially the Abstract is useless if the method is Private. How can I create a "Private" method that's a... [More]

JavaScript Function Tips and Tricks

First, What is a JavaScript Function? As defined by a JavaScript Function is: "A function is a reusable code-block that will be executed by an event, or when the function is called." - You're probably thinking, "Well, Yeah. I knew that." But, how much do you really know about JavaScript Functions? JavaScript Function uses you already know Here's the most basic ways of using functions to get things done that most web developers are fa... [More]

The Purina Diet {Joke}

I don't know who originally wrote this, but I received it in an email the other day. I thought it funny enough to share. When someone asks you a dumb question wouldn't you like to respond like this?..... Yesterday I was buying a large bag of Purina dog chow for Athena the wonder dog at Wal-Mart and was about to check out. A woman behind me asked if I had a dog. What did she think I had, an elephant? So since I'm retired, with little to do, on impulse, I told her that no, ... [More]

Search Keyword Highlighter BlogEngine.NET v1.3 Extension

In my previous blog, I used the se_hilite.js file from Scott Yang to hightlight the search keywords people used to search for my site when they are referred to my site via the search engines. This is functionality that I want to maintain, and I couldn't find an existing extension. So, I decided to write one. This is a really simple extension, and a neat feature to have. Here it is... [More]

I just finished migrating to BlogEngine.NET...

I just finished migrating my blog over to use BlogEngine.NET. The process was very painless. I only had to do two things: 1) write a sql script to import my posts/comments/tags from my old blog into BlogEngine, and 2) setup some redirect pages to redirect traffic to the new urls. Now, I just need to find or create a better theme to use.

Bing Maps: Draw a Circle Radius Around a Lat/Long Point

I get requests on how to draw radius' around points on the map. And, up until now, I never needed to do it myself, so I didn't have a code snippet to do it. I did a search and quickly found an example over at viavirtualearth on how to do it in an older version of Virtual Earth. Other than being coded for an older version of Virtual Earth (and incompatible with VE6); it's coded to only handle drawing a radius in Kilometers. So, I decided to upgrade the code example to support VE6, and support bo... [More]

Virtual Earth Plus ASP.NET AJAX Breaks In Safari!

Update 5/17/2008: This issue has since been fixed with the release of the Virtual Earth v6.1 release. There is still a small issue related to the CalendarExtender and Virtual Earth that only occurs in Safari. You can read more about it here.   I do alot of development with ASP.NET AJAX and Virtual Earth, and each of them work fine by themselves in Safari 3 on Windows. However, if you use them both on the same page, it will cause ASP.NET AJAX to break and stop working in Safari. This... [More]

Virtual Earth v2 Being Depricated March 31st

I'm not sure how many apps out there are still on Virtual Earth v2, but Microsoft has announced that Virtual Earth v2 will be depricated on March 31st. So, if your app is still on VE v2, you better get working to upgrade it to VE v6 before v2 is turned off. Also, it's worth noting that there are a few breaking differences between v2 and v6, so it may take a little while to upgrade your app.

Virtual Earth: Calculate Distance of User-Drawn Polyline

A couple days ago I posted some code to "Calculate Distance Between Geocodes in C# and JavaScript", so today I decided to post a small sample program that shows a more "real world" example of puting that code to use. Here's a small program I wrote (in pure HTML and JavaScript) that allows the user to draw a polyline, and it automatically calculates the total distance between the points being plotted. Download the Distance Calculator Program Here A Web.M... [More]

Calculate Distance Between Geocodes in C# and JavaScript

There are times when I need code to calculate the distance between two geocodes (Lat/Long points). I don't need it very often and until now I didn't have a code snippet that I could jus copy and paste. I was searching and found Rob Conery's LINQ and Geocoding post. It's an interesting post and he includes a sample of how to use Lambda expressions in C# 3.0 to calculate the distance between two geocodes in Miles. I decided to copy his code snippet and make sure it works in .NET 2.0 and also conv... [More]

LINQ to JavaScript Interactive SDK Now Available!

I just put out another (yes, another) update to JSLINQ. This v1.02 release doesn't include any new LINQ functionality over the previous release, but it doesn't contain less bugs thanks to the New JSLINQ Interactive SDK and Unit Tests. View the JSLINQ Interactive SDK Download JSLINQ plus code for Interactive SDK I have also verified that the project is compatible with IE7, FireFox2, and Safari 3 for Windows.