Shawn Wildermuth

Stories

Tagged with Javascript


Choose Your Own Adventure with Node.js View Engines

javascriptAs some of you know, I’ve been delving into Node.js for a new Pluralsight course that is coming out soon. One of the interesting aspects to me is the idea of server-side view engines. As an ASP.NET (and ASP before that) guy, I’ve been using server-side view engines for a long time…not that we always called them that.

Most Node.js templates out there (including the Express.js application template that ships with the Node.js Tools for Visual Studio) includes the Jade View Engine.

Jade (NPM Package Name: jade) is interesting to some because it’s very terse and (in theory is quicker to write). It’s also similar to the default view engine (AFAIK) for Ruby on Rails so that is going to make it pretty popular. Here is the syntax:

Read...


Node.js and Visual Studio? Sure!

nodejsI’ve been working on a new course for Pluralsight on “Node.js for .NET Developers”. It’s been a fun course to write and one of the aspects of the course that I find interesting is that the open source Node.js Tools for Visual Studio plugin actually works really well.

What I particular like is that it doesn’t change the way you use Node.js – it can live side-by-side with command-line tooling like NPM, Bower, or even node.exe. It doesn’t try to do more than it should.

Once you install the tooling, it’s as easy as creating a new project (empty or a boilerplate with Express.js). It even has a project type for an existing node.js project:

Read...


Why is DOM-Centric JavaScript Hard to Test?

A lens from microscope used in medical laboratoryWhile producing my recent course on Large Scale JavaScript, I was digging into the testability of JavaScript. So much of the JavaScript I see out there continues to be jQuery driven, DOM-centric JavaScript.

Sure, many of my readers are moving towards AngularJS, Ember and other client-side libraries that encourage modularization, testability, and separation of concerns, but not all web developers are. Ultimately we need to test our JavaScript no matter what the nature of it is.

In this video excerpt from my course, I discuss why DOM-Centric JavaScript is so difficult to test:

Read...


Why Should You Care About NodeJS?

javascriptI know that many of my readers are .NET guys and a core constituency actively hate JavaScript so bear with me and let’s talk about NodeJS for a minute.

Just to be clear, I am not advocating anything by this post. What I think is important is that as you mature as a developer that you look at whatever is happening in the community and be open to why something is new  and what new ideas are being proffered by the new technology. My hope is that this post will show some of that.

Simply put, NodeJS is a runtime for JavaScript that encourages non-blocking I/O and fast networking. NodeJS itself isn’t written in JavaScript but it executes JavaScript using Chrome’s V8 engine. It is the engine that powers a lot of cool tools these days (e.g. Bower, GruntJS, etc.) but is primarily used as simple web server platform.

Read...


Bootstrap 3 Grid System Explained

Are you starting to work with Bootstrap 3? If so, maybe I can help. I’ve recently released a Bootstrap 3 course on Pluralsight that covers many of the new features including how to migrate from Bootstrap 2 to 3.

Here is an excerpt from the course where I explain how the new grid system works in Bootstrap 3:

Read...


JavaScript Function Scopes

As some of you know, I authored a Pluralsight course on JavaScript for C# Developers. We’ve released an excerpt from that course covering how JavaScript function scopes work.

If you’re just getting started learning JavaScript, it can be easy to bring your C# biases to the language since they both have curly braces. Hopefully this excerpt will help:

Read...


Getting Ready for AngularJS 1.2

AngularJS is going through their release cycle now and that means that AngularJS 1.2 is going to be released soon with some specific changes that you'll need to address. I'll be updating my Pluralsight Course with the 1.2 changes as soon as the new version ships.

The biggest change for most people is the routing support is now packaged separately. To use routing you'll need to do two things:

Include the new angular-route.js:

Read...


Need LINQ but Writing JavaScript?

sketchArchOne of the tasks that I found cumbersome when writing JavaScript is simple collection manipulation. I have gotten spoiled in C# with LINQ. Sorting, filtering, shaping and more is easy with LINQ but what about in JavaScript? Underscore.js to the rescue.

Underscore.js is a small utility library that can help in collection manipulation (as well as other great features). I first started using Underscore.js to replace jQuery's (and AngularJS's) for-each implementations. I find underscore's simple and quick. Like much of JavaScript, the magic is happening in a callback function (think Lambda):

 

Read...


My New Web Development Course is Live

Are you getting ready to build a new website? Are you interested in shortening your development by using Bootstrap, AngularJS, Azure and ASP.NET? If so, my new course might be just for you.

In this new course I build a new web site from scratch. I start out with a Bootstrap template (since my design skills suck) and move through creating content, building a database, exposing a REST-ful API and building a Single Page Application. I wrap it up by publishing the site to Azure Web Sites showing you how to not only get your application up an running in the cloud, but also how to monitor it and handle standard tasks like using your own domain in Azure.

You will see every line of code (with one small exception) that I write. This isn't slide-ware…it's show-n-tell. I use a range of technologies including:

Read...


My AngularJS Talk at Atlanta .NET UG

Thanks to all who showed up to see me talk about AngularJS at the recent Atlanta .NET User's Group. At the talk, I wrote the client-side code for an AngularJS app by hand. The slides are pretty thin, but the code includes all the functionality I showed. I promised the slides and code so here they are!

If you have questions about any of this, feel free to comment and I'll help as much as I can!

Read...


JavaScript Promises

pinky-promiseNo I am not talking the promise that JavaScript will fix everything if you use it. I don't even believe that ;) I am talking about the concept of a promise object that several JavaScript libraries use (including AngularJS, jQuery, Dojo and WinJS).

A promise is a pattern for handling asynchronous operations. The problem is that essentially when you start an asynchronous operation, you need to execute some code as the operation is completed. Asynchronous code is so common that most libraries have found a solution for passing in callbacks. But there is little commonality to how each libraries does this. Let's take jQuery as an example:

Read...


Building Atlanta Code Camp Website

I recently helped the Atlanta Code Camp effort by building them a new website. You can see it here: Atlanta Code Camp.  I am pretty proud of what I was able to accomplish in the scant number of hours I had to build it. It's not done as we need to improve it when we have the speakers chosen and set up the schedule, but so far I am pretty happy with it.

I had a number of goals for the project:

My first thought was to start with a Mobile-First template and just build the site but as #4 was going to stymie that as PluralSight would really like me to finish my courses ;) So I started with a Bootstrap template (that I got from https://wrapbootstrap.com). This provided a good basis for the shell of the website. Before I did real color skinning of the site, I needed to wait for our logo. Dennis Estanislao did an amazing job on the logo. With that I was able to use the color scheme to change the template to match the logo and overall theme. But that was just the HTML part of the story.

Read...


Debugging PhoneGap with the Android Console

facepalm4If you build PhoneGap apps and test with the browser, moving to phones sometimes causes a boatload of problems. Because there isn't a great debugging story, being able to see the console window would be of great help.

My particular problem was that my JavaScript and CSS links weren't cased correctly. And it seems that the Android implementation is case sensitive (like most Linux implementations) but I couldn't even see what was wrong. Unfortunately the PhoneGap Build tools let's you use the console and interrogate the DOM but console log messages are lost. So I simply dropped down to the Android SDK.

I don't use the Android SDK for development of my PhoneGap apps. I have it installed because I did some early investigation into Android back about two years ago and it was still there. One great thing to say about Eclipse and the Android SDK is that they are simply file-based so when I pave, it still works (still on that drive taking up space). For me this was a lucky break as I needed it to access the console. So how does it work?

Read...


My Practical PhoneGap Course is now Live!

If you're interested in cross-platform mobile apps, I like the solution that PhoneGap has. It uses HTML5/CSS/JS as the UI stack and I find it compelling to build apps for iOS, Android, Kindle, Windows Phone and Windows 8 Store. I've just released a new course on PhoneGap that attempts to fill in some of the holes in building apps.  The course includes:

Hope you enjoy the course. You can view it here:

http://pluralsight.com/Courses/practical-phonegap

Read...


PhoneGap and Windows 8

Traffic accident and to drivers fightingI've created a new example of a PhoneGap app for my talk at the Atlanta Windows Apps meeting. The talk I did tonight didn't go all that well, but I got it working and the result is something you can download and see how to use a minimum of WinJS to build your Windows 8 apps.

The example PhoneGap app sourcecode can be found on GitHub:

Additionally, you can see the Win8 version by downloading the project I built during the talk:

Read...


Building Cross-Platform Apps with HTML: Part 1 of 4

mobiledevices_clipOne of the things that I’ve been spending a lot of time working with lately is the ability to be able to build cross-platform apps. While I spend a lot of time in the Microsoft space (especially Windows 8 and Windows Phone 8), I need to be able to create and deploy apps to iOS and Android platforms. I've decided to do a series on building one of these using Single Page Application for the web, then deploying it to devices via PhoneGap:

There are a number of solutions for cross platform apps (e.g. MonoTouch/Droid, et al.)  The types of apps I am building are just consuming or displaying information from a standard web back-end (e.g. REST services).  Because I typically need to build a responsive website for the solution as well, using a solution that could share some or all of it’s code with the website is a good match.

Using HTML5/JS/CSS to build apps isn’t perfect. Not all apps are a good candidate for this type of cross-device development, but I like to think that for many v1 apps, this is a laudable solution. In many cases, these apps are plenty functional for the life of the app, and in other cases it provides a fast-to-market solution so that a full native experience can be built after the app is initially launched and validates that it fills a market need (classic Minimum Viable Product strategy).

Read...


Clarifying Windows Phone 8 HTML5 Apps

If you made it to build or spent much time watching the videos one of the stories many heard from Microsoft revolved about creating HTML5/JS applications for the Windows Phone 8. Unfortunately the story confused a lot of people (at least by the questions I've been getting lately.

Let me be clear...you *can* create HTML5/JS/CSS applications for Windows Phone 8. Yup. In fact, you could do it with Windows Phone 7 and 7.5. This is how PhoneGap works. The XAML page simply hosts a WebBrowser control and loads all of the assets locally in the XAP. What you can't do is create WinJS application. Let's step back a little and explain that better.

Windows 8 and Windows Phone 8 were both highly publicized releases this last week. One of the things that is not all that obvious to the casual observer is that the biggest change to Windows Phone 8 is that the underlying operating system now uses the same core as Windows RT (e.g. Windows 8 for ARM). In fact, the new phone SDK supports DirectX, C++ and creating WinRT components.  All very cool.

Read...


ReMIX South 2012

_0012_Logo-Yellow-onWhiteI had a great time at ReMIX South this year! It's been great to meet developers and designers and learn how they are using design tools of all sorts.

If you attended my "Modern Web Development" workshop, here is where you can get the slides and code. If you have questions about the workshop, please just add a comment and i'll respond as soon as I can:

Thanks again to all who attended the session!

Read...


JavaScript for C# Developers Live!

If you're in the Atlanta, I am holding a one-day JavaScript for the C# Developer course. The course will cover:

This is the perfect course for existing .NET developers who are trying to get up to speed with JavaScript for web development or Windows 8 App development. The course will take place on November 14th and costs $299.99. You can register for the event here:

The complete outline can be seen on the course page on my Wilder Minds site here:

Read...


TypeScript (or the obligatory post about it)

Like many of you, I've been itching to see what Anders had up his sleeve and I wasn't disappointed yesterday when they announced TypeScript. After teaching all day, I took a quick look at TypeScript (and I do mean quick).

There was a lot of buzz yesterday and the response seemed to be in one of two camps (for the most part):

I think I am in the middle of this. TypeScript reminds me a lot of LESS. What I mean by that is that I think the smart thing they did was make all JavaScript valid TypeScript. In case that isn't clear, TypeScript is a superset of JavaScript. This means that they're adding some features to JavaScript to help with large, enterprise sized codebases including:

Read...


When to Not Use Observable in KnockoutJS

javascriptI've been really busy lately and my list of things to blog on has been getting backed up. One thing that occurred to me while building my new JavaScript course was about how KnockoutJS and Observables actually work. Here's the deal.

KnockoutJS supports the idea of an observable object. This is similar to WPF/XAML concept of INotifyPropertyChanged interface. Most KnockoutJS dev's I've talked with use KnockoutJS's observable everywhere. But there are cases when you don't need it.

The biggest problem I see is that some people think that to get two-way binding you need observable.  For example, here is a JSFiddle with a typical (but simple) KnockoutJS example:

Read...


My New Course: JavaScript for C# Devs

If you are a C# developer who is ready to take on JavaScript, I have the course for you. The goal of the new course is to help C# developers understand the nature of JavaScript so you can write JavaScript like a native speaker. This is for developers who need JavaScript for any of the popular places to use JavaScript including:

The course aims to map C# features directly to JavaScript features so you can understand many key topics including:

This course is not platform focused but language focused so no matter where you're going to use JavaScript, I hope this course can help you ramp up quickly to the language! See it here:

Read...


aspConf was fun!

I had a good time doing a couple of talks today. If you joined me online, thanks for coming. For those who missed my talks, they will be posting the videos on Channel 9. As promised you can get the slides and examples here for my talks:

I hope you enjoyed the talks!

Read...


New Pluralsight Course on Debugging Web Sites

After a long gestation, I finally completed my Web Debugging course for Pluralsight. This new course covers the details of using the tools in the browsers to debug layout, JavaScript, CSS and networking. While the course shows you how to find the tools in all the major browsers, the focus is using Firefox and Firebug. Though the techniques shown in Firebug apply pretty seamlessly to all the browser tools. This course is not .NET specific, but should be useful to any web developers.

The course is broken up into four sections:

You can see the course here:

Read...


JavaScript for the C# Guy: The confusion about 'this'

As a C# guy I am comfortable with the idea of 'this' in the scope of a class (or 'Me' for your VB'ers). It's a relatively simple idea that allows you to access the instance of the class that you're a part of to call members.

In JavaScript that have a similar idea but because of the nature of JavaScript it can cause some odd behavior. Let's look at the standard behavior first.

If we have global code (outside objects or functions) and check the 'this' object, it usually returns the "Window" object in the DOM:

Read...