Chris Pietschmann

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

NAVIGATION - SEARCH

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]

Adding a DotNetKicks Image/Badge via jQuery

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]

Building JavaScript / HTML based Applications using Adobe Air for FREE

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]

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]

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]

JavaScript Function Tips and Tricks

First, What is a JavaScript Function? As defined by W3Schools.com a JavaScript Function is: "A function is a reusable code-block that will be executed by an event, or when the function is called." - http://www.w3schools.com/js/js_functions.asp 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]

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.

LINQ to JavaScript: Update Release v1.01 With More Functionality

Today, I put out v1.01 update release to the LINQ to JavaScript (JSLINQ) Project. This update adds even more LINQ functionality; to view a list of what't been added go here. I'm currently working on adding some cool things to JSLINQ that will make their way into the next couple releases. Among these are a small JSLINQ Interactive SDK that will make its way into the next release, and some performance enhancements that Brennan Stehling suggested. If you have any suggestions for th... [More]

LINQ to JavaScript (JSLINQ) Open Source Project Launched!

I know LINQ is still rather fresh to everyone yet, and you may not have really used it much, but I just started a new Open Source project called "LINQ to JavaScript". Or, JSLINQ for short. This project brings the ease of querying data collections down to the JavaScript world. Here are some simple examples of using LINQ to JavaScript: var myList = [{FirstName:"Chris",LastName:"Pearson"},{FirstName:"Kate",LastName:"Johnson"},{FirstName:"Josh",LastName:"Sutherland"},{FirstName:"John",LastName:... [More]

JavaScript int.TryParse Equivalent

One of the most handy methods in .NET is the int.TryParse method. It makes it really convenient when evaluating a string value as an integer. But, JavaScript has no equivalent so you need to do your own evaluation every time. Here's a simple JavaScript method I wrote that takes the work out of evaluating a string to an integer: function TryParseInt(str,defaultValue) { var retValue = defaultValue; if(str !== null) { if(str.length > 0) { if (!isNaN(str)) { ... [More]

Safari 3 for Windows: Enable JavaScript Debugging

As you probably know, Safari 3 doesn't allow you to turn on the debug menu within any settings dialogs. It also doesn't come with a JavaScript Debugger either. This makes it almost impossible to do any JavaScript development for Safari. Luckily you can turn on the debug menu, and there is a debugger you can download. Turn on the Debug menu Step 1: Open up the Preferences.plist file in notepad. In Windows XP:C:\Documents and Settings\USERNAME\Application Data\Apple Computer\Safari\Preferences.... [More]

Cryptographic Extensions for Microsoft AJAX Extensions Framework

The Extensions for Microsoft AJAX Framework project over at CodePlex provides cryptographic services including secure encoding and decoding of data, as well as hashing and random number generation, and new methods for JavaScript native objects. This project is pretty cool, and could really grow into a huge library offering us what Microsoft isn't putting into the AJAX Extensions themselves. And, now we have an object oriented, JavaScript way of doing MD5, SHA1, HMAC and AES! Go check it out: ht... [More]

JavaScript: Add Search Engine Keyword Highlight Support to your site with ease

When looking at the source code for the BlogEngine.NET project, I noticed that they are implementing some javascript to highlight search engine keywords. What happens is when a user searches (using Google, Yahoo, MSN, etc.) and then clicks through to your site, this javascript then highlights any words on the page that match the keywords they are search for. This isn't critical functionality to add to a site, but it sure helps in making your site much more user friendly by allowing them to more ... [More]

ASP.NET AJAX: Extensions to standard JavaScript base types

Working with JavaScript can be a challenge at times, and there are a number of helpful things that the ASP.NET AJAX Extensions are bringing to the table. One of the things it does is extend some of the standard JavaScript base types with additional functionality. This is actually rather neat, and is something that you may not find unless you dig through the ASP.NET AJAX documentation like I did. Array There are a number of extensions made to the Array base type, including "add", "remove" and ... [More]

LunchTimeCoder.AutoSlideShow v1.05 - some small enhancements

Today I spent a small amount of time enhancing the LunchTimeCoder.AutoSlideShow javascript component. Modifications Made: Added image caching so there's no flicker when changing images Added Start, Stop and Previous methods to allow user/programmatic control of the slideshow Converted to using the DOM to add the Image tag that is used rather than the div.innerHTML property; just because that's the correct way to do it There we have it, one more day and another lunch time (partially)&nbs... [More]

Creating Namespaces in JavaScript is actually rather simple...

Creating Namespaces in JavaScript is rather simple due to the fact that JavaScript is a very flexible language. As far as I know all the popular Ajax frameworks do this (including the ASP.NET AJAX Extensions). Being a .NET programmer (I'm assuming Java programmers would feel the same way), having classes devided up into namespaces makes code alot easier to manage. Here's some code that wraps up the ability to add namespaces into a namespace of it's own: ... [More]

ASP.NET Atlas is full of JavaScript goodness

I was looking through the JavaScript code for Atlas and I noticed there is some pretty neat stuff in there. It is really a very large enhancement to JavaScript. One of the things I noticed is they are adding support for the XMLHttpRequest object if the browser doesn't natively support it. In the past I've traditionally just created a function named similarly to 'CreateXMLHttpRequestObject' and I make that function support multiple browsers. The technique that's used in Atlas is they are adding ... [More]