Archives
-
Working with the JavaScript “this” Keyword
JavaScript's "this" keyword can be a bit tricky to work with depending on the context in which it's used. When it's used with patterns such as the Prototype or Revealing Prototype patterns working with "this" can be challenging in some cases. Unlike languages such as C# or Java, "this" can change context. For example, if a Calculator object named calc calls an add() function then "this" represents the Calculator object which means you can easily access any variables defined in the object such as a variable named tax by simply using this.tax.
-
Using the JavaScript Prototype Property to Structure and Extend Code
There are several different patterns that can be used in JavaScript to structure code and make it more re-useable, more maintainable, and less subject to naming collisions. Patterns like the Revealing Module Pattern, Prototype Pattern, Revealing Prototype Pattern, and others can be used to structure code and avoid what I call “function spaghetti code”. One of my favorite features offered by both the Prototype and the Revealing Prototype patterns is the extensibility they provide. They’re quite flexible especially compared to the Module or Revealing Module patterns out there.
-
New Pluralsight Course - Structuring JavaScript Code in HTML5 Applications
-
Silverlight 5 Released with a lot of Great New Features
-
Reducing JavaScript Code Using jsRender Templates in HTML5 Applications
Back in November of 2010 I wrote a post titled Reducing Code using jQuery Templates that demonstrated how jQuery Templates could be used to reduce significant amounts of JavaScript code. Although the topics and code discussed in that post are still valid and relevant in today’s applications, things have a changed some when it comes to the future of jQuery Templates. I’ve had questions come up in the jQuery classes that we offer, at conferences, and online about the future of jQuery Templates so I thought I’d put a post together that provides updated information.
-
A Few of My Favorite HTML5 and CSS3 Online Tools
I really enjoy coding up HTML5, CSS3, and JavaScript applications but there are some things that I’m better off writing with the help of a development tool. For example, CSS3 gradients aren’t exactly the most fun thing to write by hand and the same could be said for animations, transforms, or styles that require various vendor extensions. There are a lot of online tools that can simplify building HTML5/CSS3 sites and increase productivity in the process so I thought I’d put together a post on a few of my favorites tools.
-
New Pluralsight Course: Introduction to Building Windows 8 Metro Applications
-
HTML5, JavaScript, and Windows 8 Metro Talk Slides from DevConnections Las Vegas
-
Video: HTML5 and JavaScript Tips
I had the opportunity to present at the HTML5 Web Camp event in Phoenix, Arizona last month with Michael Palermo (one of my favorite speakers) and the recording of the event is now available online. Thanks to Scott Cate and the EventDay staff for taking time to record, index, and publish the event – they did an awesome job.
-
Techniques, Strategies and Patterns for Structuring JavaScript Code
JavaScript has come a long way since the mid-90s when I first started working with it in Netscape 3 and Internet Explorer 3. Back in the day I thought JavaScript was a painful to use but over the years I’ve learned to love it and appreciate what it offers as a language. JavaScript is quite flexible and can perform a wide variety of tasks on both the client-side and server-side. In fact, I used to prefer it to VBScript on the server-side when writing classic ASP applications and today we have server-side frameworks such as Node.js that are JavaScript based. With the rise of HTML5 and new features such as the Canvas API and SVG JavaScript is more important than ever when building applications. As applications use more JavaScript it’s important that the code is structured in a way that’s easy work with and maintain.
-
The Tablet Show - “Resist the Drama”
I had an opportunity to talk with Carl Franklin and Richard Campbell (the .NET Rocks guys) on their new show called The Tablet Show. It’s always fun talking with them since there’s never a boring moment or lull in the conversation. In this episode we talk about the new WinRT framework used to build Metro apps in Windows 8, the future of Silverlight, the drama some developers seem to love, and a bunch of other topics related to development including why Microsoft is moving toward the Start Screen that you see in Windows 8. Give the show a listen by clicking the image below.
-
New Line of Business Features in Silverlight 5 – Using pInvoke
This is the fourth post in a series covering new line of business features in Silverlight 5.
-
Call for Abstracts for Spring 2012 ClientDev Connections Conference
John Papa and I just sent out a call for abstracts for the upcoming Spring 2012 DevConnections conference to be held in Las Vegas, NV. If you’re interested in presenting on client-side development topics such as HTML5, CSS3, JavaScript, jQuery (or another JavaScript library), Silverlight 5, Windows 8 Metro style app development, or other related topics please submit session ideas. If you know someone else who may be interested, please forward the information. Here’s the official announcement that was sent out.
-
New Line of Business Features in Silverlight 5–Debugging Bindings in XAML
This is the third post in a series covering new line of business features in Silverlight 5.
-
New Line of Business Features in Silverlight 5–Ancestor RelativeSource Binding
This is the second post in a series covering new line of business features in Silverlight 5.
-
New Line of Business Features in Silverlight 5 – Implicit Data Templates
Silverlight 5 has a a lot of new features that are attractive to marketing and media application developers as well as Line of Business (LOB) developers. My company focuses on building LOB applications for customers so some of the new features related to that area of development really stood out to me. Over the next few weeks I’ll blog about a few of my personal favorites including:
-
Using Entity Framework Code First with Stored Procedures that have Output Parameters
I’m working with a team on a new customer project that uses Entity Framework Code First on the backend for CRUD operations. It’s been a nice ORM to work with since it really simplifies the process of mapping relational objects to CLR objects and lets you do it through fluent mappings. Working with Plain Old CLR Objects (POCOs) is something I’ve always liked since they keep the code base super clean and shiny. I can’t say that I really miss the .edmx files that I used previously with the database first or model first approaches.
-
Why I’m Excited About Windows 8
I don’t consider myself a “fanboy” of any particular company even though my consulting and training business focuses on Microsoft technologies. A "fanboy" is someone that sides with a particular company regardless of how good or bad something is. I go with what I feel is best regardless of company. The .NET framework is my preference for developing Web and desktop applications and Visual Studio is untouchable as an integrated development environment in my opinion. iPad is my preference for a tablet, iPod for a music player, and Android for a phone (although I’d love to replace my Android device with a Windows Phone 7 device since I love the WP7 interface - Sprint still doesn’t have any WP7 devices that I like unfortunately).
-
Creating Multiple JavaScript Objects when using the Revealing Module Pattern
In my previous series on Techniques, Strategies and Patterns for Structuring JavaScript Code I discussed the Revealing Module Pattern and explained how it provides a great way to structure JavaScript code while allowing members of an object to be made public or private. After the post went live an excellent question was asked in the comments section that I thought I’d address with a follow-up post:
-
Silverlight and HTML5 Sessions Coming to DevConnections, Vegas
-
T4 Metadata and Data Annotations Template
Awhile back I was working on an ASP.NET MVC 3 project that required a lot of “standard” validation to be performed (required fields, validate lengths, some regular expression validation here and there, data type checks, etc.). Due to the number of classes involved I decided to go with the data annotations approach to keep things nice and tidy (some people love this, some people hate it – such is life :-)). As I dug more into the project I realized it was a fairly monumental task to create a metadata class for each of my model classes so I ended up investing one night to create a Visual Studio T4 template that could generate all of the metadata classes automatically based on an Entity Framework 4 model. I published the project up on CodePlex to make it easy for other devs to get to but realized I never blogged about it. Here’s an overview of what the T4 metadata and data annotations template does.
-
Building the Account at a Glance HTML5/jQuery Application
As Web technologies continue to evolve developers are required to learn new technologies in order to build successful web-based applications that stand above the crowd. This can be a challenging proposition especially for developers moving from desktop or Rich Internet Application (RIA) development frameworks. To help developers learn the latest HTML5, CSS3 and JavaScript technologies, we built a sample application for demonstration at Microsoft’s MIX 11 conference called “Account at a Glance” (download the app below) which we’re now able to (finally) release. The application takes advantage of key web technologies and uses them to display brokerage account information to consumers.
-
Revealing Prototype Pattern - Techniques, Strategies and Patterns for Structuring JavaScript Code
This is the 4th post in a series on techniques, strategies and patterns for writing JavaScript code. In my previous post I discussed the Revealing Module Pattern – one of my favorite JavaScript patterns. If you like the features offered by the Revealing Module Pattern but want to take advantage of JavaScript’s prototype functionality and the benefits it offers, the Revealing Prototype Pattern may be what you need. It offers the benefits of the Revealing Module Pattern but also provides a way to share function implementations across object instances through prototyping. The pattern is a combination of the Prototype Pattern and Revealing Module Pattern.
-
Revealing Module Pattern - Techniques, Strategies and Patterns for Structuring JavaScript Code
This is the 3rd post in a series on techniques, strategies and patterns for writing JavaScript code.The Prototype Pattern shown in an earlier post works well and is quite efficient, but it’s not the only game in town. One of my favorite overall JavaScript patterns is the Revealing Module Pattern since it’s cleaner with less usage of the “this” keyword. I also like the fact that it doesn’t separate code into constructor and prototype sections. Although it doesn’t offer the benefit of sharing functions implementations across objects through JavaScript’s prototype feature, it’s definitely a viable option.
-
The Prototype Pattern - Techniques, Strategies and Patterns for Structuring JavaScript Code
This is the 2nd post in a series on techniques, strategies and patterns for writing JavaScript code. In my previous post I introduced what I call “function spaghetti code” and explained some of the problems it introduces. I also talked about the impact of global variables and how closures add a much needed solution. In this post I’ll introduce the Prototype Pattern and show how it relies on built-in functionality in the JavaScript language.
-
Getting Started Using HTML5 Boilerplate
Whether we like it or not, HTML5 is all the rage now days. With the recent news on “code name” Windows 8’s upcoming support for HTML5 and JavaScript that hype has intensified even more. I’m personally in favor of what HTML5 brings to the table although I do worry about browser compatibility issues that will naturally crop up. Compatibility issues are something that Web developers have been dealing with since the days of Netscape 4 (layers) and IE4 (divs) though so it’s really nothing new; it’s just intensified with all of the new functionality that the various HTML5 specs define. Fortunately, there are several options available that can help reduce cross-browser issues.
-
Creating a Line Chart using the HTML 5 Canvas
The HTML 5 canvas is capable of rendering lines, shapes, images, text and more without relying on a plugin. Although the canvas element isn’t supported by older browsers, the latest version of all major browsers (IE, Safari, Chrome, Firefox and Opera) now support the canvas making it an option for rendering charts, graphs and other types of visual data. In cases where a browser doesn’t support the canvas, a fallback can be provided that renders data using Silverlight, Flash or another type of plugin.
-
Using IIS Express to Secure Silverlight and WCF Applications
I’ve been using IIS Express lately with Silverlight and WCF services and have learned to appreciate the “real-world” advantage it gives you versus the built-in Visual Studio “Cassini” server. Although I’ve always preferred to use IIS whenever possible, sometimes that’s not an option when you’re first starting a project and working on a machine that doesn’t have IIS installed. By using IIS Express you can identify security, configuration and other issues that may occur as you move an application to a real IIS 7+ server upfront rather than finding out about the issues after you move an application to a dev/staging server. In this post I’ll walk-through some of the lessons learned and walls encountered when I started working with authentication in IIS Express. It’s easy to work with once you know a few fundamentals. If you don’t already have IIS Express installed (it comes with Visual Studio 2010 SP1) you can get it through the Web Platform Installer or here.
-
Integrating Security Roles into Silverlight Applications–TechEd 2011 Talk
-
Getting Started with the HTML 5 Canvas
Rendering complex graphs or designs to the Web has always been a challenge that has typically been solved by using images, server-side processes or plugins such as Silverlight or Flash. Although drawing charts with straight lines has never been a problem (with some creative CSS), rendering different types of shapes and gradients in the browser such as ellipses, bezier curves and other custom shapes has always been a problem. With the addition of the HTML 5 canvas in the latest version of all major browsers, a lot can be done with only JavaScript and HTML tags now.
-
Working with User Names and Roles in Silverlight Applications
Security is a key component of applications and something that developers often struggle with to get right. How do you authenticate a user? How do you integrate roles and use them to show or hide different parts of a screen? These and other questions commonly come up as I talk with developers working on ASP.NET and Silverlight applications.
-
DevConnections Orlando Code and Slides
Thanks to everyone who attended my sessions at DevConnections Orlando. I say it every conference, but it really is a lot of fun to talk with people and hear about what they’re working on. The download below contains the code for my “Getting Started with Silverlight” and “Building Architecturally Sound Silverlight Applications with MVVM” sessions.
-
Getting Started with ASP.NET MVC 3 and Razor
I had a chance to give a talk on ASP.NET MVC 3, Razor and jQuery today at a company and wanted to post the slides and demos from the talk. The focus was on getting started with ASP.NET MVC 3 projects and .cshtml files including creating pages using the new Razor syntax (which I personally love….never going back to the Web Forms View Engine) as well as working with jQuery. Topics covered in the demos (download below) include:
-
Breaking up the Workday– Overcoming the Workaholic Syndrome
Hi, my name’s Dan Wahlin and I’m a workaholic – I admit it. It’s good from the standpoint that I get a lot done but it also has a lot of cons associated with it as well that I’m not proud of. I literally can’t watch TV without feeling like I should be doing something more productive (although I have no problem going to see movies at a theater or watching sporting events – that’s my escape I guess). On vacation it’s sometimes difficult the first few days to just “let go” of work and enjoy the time with my family. I always feel like I should be checking email and following up with different business projects. Fortunately, my wife knows me really well after 17 years of marriage and “gently” restricts my usage of laptops and other gadgets while we’re out. She also reminds me that constantly burying my face in gadgets just isn’t cool and shows a distinct lack of self control.
-
Syncing Data with a Server using Silverlight and HTTP Polling Duplex
Many applications have the need to stay in-sync with data provided by a service. Although web applications typically rely on standard polling techniques to check if data has changed, Silverlight provides several interesting options for keeping an application in-sync that rely on server “push” technologies. A few years back I wrote several blog posts covering different “push” technologies available in Silverlight that rely on sockets or HTTP Polling Duplex. We recently had a project that looked like it could benefit from pushing data from a server to one or more clients so I thought I’d revisit the subject and provide some updates to the original code posted.
-
Migrating a Silverlight Application to Windows Phone 7–Part II
In this post I'm going to walk through additional features that have been added to the album viewer application that I wrote about in a previous post. Topics that I’ll cover include using the Pivot control, navigating between screens using the NavigationService class and leveraging data binding along with the Model-View-ViewModel (MVVM) pattern. The image below shows the application discussed in my last post on the topic. The user can search for albums by artist and view a carousel containing album covers. From there they can move the carousel right or left using the arrow buttons and select an album to view more information.
-
Demystifying Silverlight Dependency Properties
I have the opportunity to teach a lot of people about Silverlight (among other technologies) and one of the topics that definitely confuses people initially is the concept of dependency properties. I confess that when I first heard about them my initial thought was “Why do we need a specialized type of property?” While you can certainly use standard CLR properties in Silverlight applications, Silverlight relies heavily on dependency properties for just about everything it does behind the scenes. In fact, dependency properties are an essential part of the data binding, template, style and animation functionality available in Silverlight. They simply back standard CLR properties. In this post I wanted to put together a (hopefully) simple explanation of dependency properties and why you should care about them if you’re currently working with Silverlight or looking to move to it.
-
Top 10 Posts in 2010
Blogging’s a lot of fun and a great way to share what you’ve learned. It’s also a great way to learn based upon comments people leave that help you see things in an entirely new way in some cases. Since we’ve now moved on to 2011 (Happy New Year’s!) I wanted to list the Top 10 posts from my blog during 2010 based on individual views. Thanks to everyone who follows my blog and adds comments from time to time. Here’s wishing everyone a great 2011!