Eleven Fifty Academy

Last week I was fortunate enough to join with the two Daves from getfretless and help them to teach a group of developers the core concepts of angular.js and node.js.

This was a full five-day course where most students stayed and learned for more than 8 hours per day at the campus of the Eleven Fifty Academy.

I had a wonderful time helping students create a real application with a Node.js REST API, and well constructed angular front-end. I will be continuing to teach courses like this in the future at Eleven Fifty and hope to have many more classes that were as receptive and eager to learn JavaScript as this one. Thanks to the class for a great week.

Introduction To React - Officially Published!

It has been a while since I posted that I was writing a second book, Introduction to React. Today it is officially available in both ebook and paperback formats. I hope you enjoy reading the book and the introduction to React as much as I enjoyed writing it.

_Introduction to React_ teaches you React, the JavaScript framework created by developers at Facebook, to solve the problem of building complex user interfaces in a consistent and maintainable way. React.js shrugs away common front-end conventions in an effort to make things more efficient – use Introduction to React to learn about this framework and more today.

You will learn what React is, and why it was created to solve the problems it does. You will get to know the React API, and be introduced to React’s specific JavaScript extension, JSX, which makes authoring React components easier and maintainable. You will also learn how you can test your React applications and the tools you can use while building. Once you understand these core concepts, you can build applications with React. This will help you cement the ideas and fundamentals of React and prepare you to utilize React in your own use case.

What you’ll learn

How to use React to maintain complex user interfaces in an efficient way
How to integrate existing user interfaces and move forward with React
How to manage application architecture using Flux
How to easily utilize JSX, React’s JavaScript extension

Who this book is for

Introduction to React is for a web developer who is comfortable writing JavaScript and CSS. You will apply JavaScript to build web pages that utilize the paradigm shifting React framework. Introduction to React will provide you with the tools to create maintainable complex user interfaces.

Trying to Run React Native Android on Windows

React Native for Android was released yesterday. As soon as I spotted the release I wanted to give it a whirl on my work PC. I did the npm install and got started right away, only to find that the init command was failing. I expected this because officially React Native isn’t supported on windows but there is this master tracking issue for this in Github => https://github.com/facebook/react-native/issues/2693 … anyway.. so I got an error:

events.js:141      throw er; // Unhandled 'error' event      ^Error: spawn npm ENOENT    at exports._errnoException (util.js:837:11)    at Process.ChildProcess._handle.onexit (internal/child_process.js:178:32)    at onErrorNT (internal/child_process.js:344:16)    at doNTCallback2 (node.js:429:9)    at process._tickCallback (node.js:343:17)    at Function.Module.runMain (module.js:477:11)    at startup (node.js:117:18)    at node.js:951:3

Not being one to give up right away I wanted to fix it. I noticed from the error message that the spawn of npm using (‘child_process’).spawn was causing the error. Luckily, npm contains several modules that can be a drop-in replacement for this and I just grabbed the module cross-spawn. I needed to fix this inside the react-native-cli/index.js file.

This fixed this first error. Next, I encountered an error where the script could not find my Android SDK. This is pretty much expected because on my machine I’m running Android Studio so it is the only place that knows about the SDK. The quick fix here is to find the path to the Android SDK and add that to a new environment variable ANDROID_HOME. I also needed to make sure that my JAVA_HOME environment variable was correct so that the build process would be able to find it.

Awesome, now I’m nearly there. I started my JS Server to watch for changes, I’m using Console 2 and Git Bash here

$ react-native start

Then in another console tab I run:

$ react-native run-android

Result:
It works, but not really.


First it seems to think that I’m not running my JS server, but then it kicks in to fetch the file changes.
This gets my hopes up. but then goes back to the red screen of fail. Why did it do this?!!? Well it seems that there may be an underlying issue with the way that the packager works on Windows based on the error that the packager spits out. I’m guessing that there is a simple thing to get this to work, but for now I’m moving back to OSX to do React Native.

Introduction to React

A few months ago I was approached by my editor from Node.js Recipes to discuss the possiblity of writing another book. This coincided with a time where I had been spending time working with React for side projects, and it just so happened that the title which I would be writing is Introduction To React.

intro_to_react

So I decided to write the book and spent the next 11 weeks writing it. I am currently finishing up the edits and the book is due to be published in September. I’ll be sure to update as the publication date approaches.

dev.Objective()

Every time I attend a conference or get bogged down following all the new tools and frameworks that are coming out in the front-end development world (which seems to happen daily) - I decide that I want to write a talk about how we as developers can optimize our front-ends without rewriting everything from scratch. I finally was able to get an abstract for a talk that will address such things written a month or so ago. I then decided to submit this talk to DevObjective, a conference happening in Minnesota in May. I feel that this talk might hit well with the audience as one of the things that stood out for me from the conference site was the following sentence:

Cutting edge stuff is awesome, but most people are more concerned about getting their jobs done now

I feel that this hits home with me, as I love to just be able to get my job done now. I’m not saying that we can’t enjoy the advances made by new and modern frameworks, even if we are working on a years/or decades old project, but we can make smart choices to modernize our applications. Luckily my talk was accepted and I’ll be speaking about “Front-end Modernization for Mortals” in May at Dev Objective.

I’m excited to be joining a group of speakers who will be discussing a wide variety of topics from which any developer should be able to gain some valuable knowledge for their daily jobs. If these sound like something you would be interested in, you should join me at the conference in May!

At the time of this writing, there is still time for the early bird pricing if you click the banner below:

Firefox Developer Edition

In my most recent talk at jQuery Chicago, I spoke about the promising future of debugging that involved the Firefox Tools Adapter which is a brilliant step forward in the world of remote debugging.

This was under the radar until the day before my talk when it was announced on the Mozilla Hacks blog. So it suddenly became a bit more mainstream.

Yesterday Mozilla has teased a developer focused version of Firefox they have codenamed #fx10 in a theatrical-like trailer. I for one am excited to see what sort of product arrives with this new browser.

So it turns out that this Firefox Developer Edition will be a replacement for the current Aurora Channel. What it will bring is a separate profile so it can run alongside the stable version of Firefox without having to mess with custom profiles. It will have easy access to developer tools, and looks as though the Firefox Tools Adapter will be built in to the product directly. This is a great advancement for those looking to use the cutting edge developer tools from Firefox on the web

jQuery Mobile

I have been fortunate enough to have the opportunity to speak at several jQuery Conferences in the past two years.
The focus of most of my talks, and most of my day-to-day work actually, is based around building mobile web applications
with jQuery Mobile and Cordova, two wonderful open source projects. During these conferences I was able to meet
and get to know many new friends and fellow developers, including many of the folks on the jQuery team. Eventually,
while in Vienna at jQuery Europe I was talking with Alex, the lead of jQuery Mobile and he suggested that I start
contributing to the project.

I have been fortunate enough to have an employer who is generous enough to allow my some time to donate to the project
and I have been contributing through bug-triage, pull requests, and generally just trying not to get in the way since
March of this year. I have already learned a ton and am always encouraged by the support of the jQuery team and the
advice they give.

Yesterday - 6 October 2014 - I was officially made a member of the jQuery Team. I am honored to have this opportunity
and am excited to join the team of people whom I have come to know over the past two years. I am also pretty excited about the opportunity to continue to do what I have been doing all this year, just now I have access to the GitHub repositories.

Node.js Recipes Screencast Edition

Last year, I wrote Node.js Recipes in a relatively short time span. It was accomplished in something like 120 days, or about 10 days per chapter. This was exhausting and I vowed to my wife that I would not write another book at that pace again.

Then I was tempted. My publisher asked me if I had interest in several titles, and man did I, but after a couple days of deliberating over each one - I could not commit to the time frame.

Then came an introduction from someone within the publisher’s organization that proposed I create a screencast series based upon the book which I had already written. This was something I could get on board with because the material was already written (right?).

So I created a sample video for evaluation and we decided to move forward with another aggressive schedule to record ~6 hours of screencast based upon material in my book.

It turns out this was a pretty agressive and time consuming undertaking as well. Sure the material was already written, but it needed to be reworked into a standard Powerpoint format and of course I would need to be coding most of the stuff I’d already written again. All of this (with the exception of creating some of the powerpoints) was a great time and I enjoyed being able to revisit my book from an angle of a user or reader, rather than an author.

In the end I recorded nearly 12 hours of raw footage for the video which is being post-processed currently and should see release in the near future (no official date that I know of yet - stay tuned for that). The team at Apress has done a fantastic job with the final editing and composition, from what I have seen and I look forward to everyone getting the opportunity to check out the finished product when it is available.

jQuery Conference Talks

This winter I was fortunate enough to be able to speak at two jQuery events - First in jQuery Conference in San Diego, then in Vienna for jQuery Europe.  The traveling is always great, and these events were top notch as far as organization, content, and attendees. I have finally added links to the slides and the video here on my blog.

While I always enjoy attending conferences, these two seemed to be extra engaging in that the attendees I talked with all brought a great deal of encouragement and excitement to continue to share what they know and learn.

I was also able to spend more time with a few of the folks I have met from the jQuery team and really see the vision of where some of the projects are headed. From this, I have even started to spend some time trying to triage and/or fix issues on the jQuery Mobile project.

Getting Started With Hapi

If I were to alter the content of my book Node.js Recipes I would add more great examples of web frameworks. I’ve recently targeted several which I would love to use in upcoming projects. The first one I want to talk about is Hapi.

Hapi is a Node.js web framework that was developed by WalmartLabs/Spumko.

First you need to create a package.json file - npm init can help with this if you do not wish to configure your own.

$> npm init

you will then be walked through the process to generate your package.json file.

 {
   "name": "myHapiApp",
   "version": "0.0.0",
   "description": "Hapi",
   "main": "index.js",
   "scripts": {
         "test": ""
   },
   "author": "Cory Gackenheimer <c@cgack.com>",
   "license": "MIT"
 }

Is this ok? (yes)

next you’ll need it get Hapi this is done with the command:

npm install hapi --save

Now you have hapi in your node_modules directory. You now need to create your server.

var Hapi = require('hapi');

var server = Hapi.createServer('localhost', 8080);

server.start();

If you are to start this server node . or node index.js and navigate to http://localhost:8080 at this point you would get {"statusCode":404,"error":"Not Found"} because you have not set up any routing in your server. To add routes you need to use the server.route method. Here I’ll add a route we could use to simulate an API GET request, and the we’ll also see serving files from a static directory.

var Hapi = require('hapi');

var server = Hapi.createServer('localhost', 8080);

server.route({
  method: 'GET',
  path: '/api/{path*}',
  handler: function(request, reply) {
      reply('API request ' + request.url.path);
  }
 }); 

 server.route({
      method: 'GET',
      path: '/{path*}',
      handler: {
          directory: {
              path: './static',
              index: true
          }
      }
 });

 server.start();

Now if you navigate to http://localhost:8080/api/foo you will get a response with that path. If you instead try to hit a static page, i.e. http://localhsot:8080/ -> ./static/index.html you have set up in your local ./static directory you will get that file returned to your web browser .

That is the quick getting started for Hapi if you want to use it to build a web server. I have enjoyed using it and the freedom it allows me to build my applications. I look forward to utilizing it more in future projects.