Monday, July 07, 2014

Passport Error with Google: Error: invalid_client

Nodejs module passport allows loggin into your app with OAuth2 for Google. But I kept getting an error of "invalid_client".

Google eror message screen
The solution was rather simple: check for typo in clientID in the passport.use(new GoogleStrategy({

In my app there was an extra number at the start of the clientID string.

Thursday, July 03, 2014

Great-Uncle and Great-Aunt Landing Pages

Great-Uncle.com and Great-Aunt.com are a shared family birthday calendar and contact manager app.
  • Help your family stay in touch with the latest contact info, even for second cousins
  • Everyone in your family can share the app, birthdays and addresses
  • Never miss a birthday with email notices before any family birthday
The landing pages for the app are now live at http://great-aunt.com and http://great-uncle.com. Sign up there to get on the daly-apps newsletter so you can find out when the app is available for beta.

The alpha testing is going well. Both software bugs and usability bugs have been discovered. The alpha group will be expanding this month.

Tuesday, July 01, 2014

Bypass Amazon-Hachette Bookmarklet

The Hachette-Amazon feud makes it hard to buy some books from Amazon. Or you may want to not buy any books at Amazon for a while. This bookmarklet helps.

This lets you browse Amazon for books, click on the bookmarklet and then see other sellers of the same book. This is done using directtextbook.com with whom I have no connection. If you have suggestions for other portals, I'm open.

How to use this:

1. Drag and drop this link to your Bookmark Toolbar: ByPassAmazonHackette
2. Visit Amazon.com
3. Click on the ByPassAmazonHachette bookmarklet in your toolbar to see other options for buying the book.


Wednesday, May 28, 2014

Style Guides and Guardian Local Storage - CSSConf 2014 Part One

CSSConf 2014 had very good presentations. The presenters were international which emphasized the requirement to design for the world, not just North America. This post looks at two of the eleven presentations.

Patrick Hamonn (@patrickhamann) of the Guardian showed the need to have a news article display within one second. Because of network latency there is only 400 milliseconds for the browser for rendering. For reasons explained in his slides (CSS and the Critical Path) this means every critical piece must be sent on the first request. The result is an HTML file with inline minimal CSS. Everything else is deferred. He makes an excellent case. In a later post I'll compare this to USA Today's redesign presentation at a Modev meetup.

The Guardian also makes use of local storage, but I think this is controversial. There is a growing movement for "offline first" development which uses local storage and other resources for offline content. The Guardian uses local storage for CSS and other page needs instead of content. USA Today does not use local storage for content. The new mobile site for The Washington Post no longer uses local storage for content. This will be an interesting area to watch.

Nicole Sullivan (@stubbornella) argued convincingly for Style Guide Driven Development. She cited an example where a relatively simple media block component reduced HTML size by 50% as well as reducing CSS file size. A Style Guide can also reduce technical debt and make a site less fragile. It just makes business sense to implement and maintain one. She recommended Trulia's open source Hologram for creating a style guide. This reminded me that she also talked last year at JSConf on Ceating Living Style Guide that becomes part of every project deployment. There is more and more evidence that a living style guide is a best practice for any non-hobby site.

Look for more about CSSConf presentations in future posts. I'll also update this post with links to the videos when they are available.

Thursday, April 03, 2014

An Apology to Brendan Eich

Brendan, I’m sorry I did not get this out earlier. I had written much of which follows on April 1st and because of internet tradition of April Fools, I delayed posting this. You are a hero.

I support Brendan Eich. It saddens me to see the Mozilla community so divided. I am disappointed that Brendan stepped down.

This is personal for many. People have spoken of their pain. Many have acted on their feelings and beliefs. I don’t mean to lessen either.

I’m not from California and was not involved in the Prop. 8 campaign. I’m an older, straight, married, white male, so I do not have the perspective of being a minority. But, I have promoted “Diversity for better solutions” in public and private ways. Diversity is important.

Brendan Eich is a hero. He risked his career to fight oppression by co-founding Mozilla. At that time internet jobs were not so plentiful or lucrative as they are today. It was a big risk. Microsoft nearly succeed in monopolizing and stifling the internet. Firefox saved us from a tyranny.

Microsoft also nearly derailed JavaScript, a foundation technology of the internet and the disruption, startup world we currently enjoy. When Microsoft released JScript as part of Internet Explorer, it took nearly 10 years for the JavaScript community to recover. I know this personally.

As the creator of JavaScript, Brendan Eich could have turned his back on Microsoft. Surprisingly, many times over the years he reached out to Microsoft and started a dialog. Microsoft is now a supportive member of the JavaScript community.

Mozilla and JavaScript are primary reasons "software is eating the world”. They are the reason we have these new careers like Front End Developer. They are the reason we have new ways of telling the news with JavaScript Journalism. Mozilla and JavaScript moved the ball. They changed the world.

This is my perspective, perhaps a historical view. I’ve been active with JavaScript since 1995. I started the first software store in the world in 1979. I’ve seen how Microsoft damaged people’s lives. I’ve seen how Mozilla made a better world.

As an active member of the JavaScript community, in my view Brendan Eich has represented Mozilla very well for many, many years. He would have been a great leader of Mozilla.

Brendan is a friend. I first meet him at the Ajax Experience in 2006. We’ve hung out together at JSConfs. He’s offered to help me. It is an honor to know him.

I was surprised when I heard from a friend that Brendan had supported Prop 8. I am glad she talked to him about it. I disagree with Brendan on this as well. This does not mean we are not friends. I have friends that are Republicans. I have friends who don’t believe in climate change. I have a friend who believes man never landed on the moon and some evil conspiracy theories. 

It is ironic that a law meant to protect us from corporate influence has resulted in this outrage against a man who has successfully fought one of the biggest monopolies we’ve ever seen. Unintended consequences.

I am disappointed the Brendan stepped down as CEO of Mozilla. He has done wonderful work and think he had the vision to lead Mozilla into the future.

Best of luck to a good man.

Wednesday, March 26, 2014

Interview on Hoodie Blog

Lena Reinhard from Hoodie interviewed me for their blog to discuss Hoodie and Offline First. I'm very pleased the interview.

"Offline is a fact of phone apps. In a rural area or in a big city, a phone is going to lose connectivity."
"He wrote a great tutorial on how to get started with Hoodie."

Wednesday, March 19, 2014

The Washington Post Gains 10m Members

By offering free digital access to subscribers to other newspapers, The Washington Post just picked up 10m members. Paywalls change the business model of newspapers from subscribing readers to adding members. When Jeff Bezos bought The Washington Post he purchased $175 million in membership. Having the credit card number of each digital reader (i.e., member) is of great value.

Nieman Journalism Lab and others wrote about The Washington Post offering free digital access to other newspapers. There is no such thing as a free lunch. So what does The Post gain by offering free digital access to local newspapers around the United States? Members in Texas, Honolulu, Ohio, Minnesota, Wisconsin and Pennsylvania. According to The Financial Times, 10m members. This expands the audience for offers to members with credit cards on file. Steve Hills, president of The Washington Post suggested that it could be expanded to “any company that sells premium subscriptions.” This is the new membership business model.
dddd
As a membership business, The Post will next follow the lead of associations, loyalty programs, unions and others. These organization make substantial money from the “member benefit” offerings. There is a whole industry that sells to these organizations and I’m certain they are calling on newspapers everyday. Expect to see The Post offer more than just a wine club. Credit cards, travel deals, insurance and more. And add staff to support this. “It pays to read The Post."

Thursday, March 13, 2014

Getting Started with Hood.ie


As a fanboy of couchdb, I’ve kept an eye on the hoodie project. Hoodie is an architecture that helps with offline operation and handles login/registration. So I wanted to write a step-by-step tutorial on Getting Started with Hoodie. This tutorial will modify the demo todo app.


Step One - Installing Hoodie
The hood.ie website walks you the installation. The steps should be pretty familiar to most developers. For Mac, it uses home-brew and npm
http://hood.ie/#installation



Step Two - Create Hoodie Project
You’ll need a folder for your project. Hoodie command line interface does this and populates it with the required files and folders.

In my case, in my dalyapps folder I typed:
hoodie new hoodietut

You’ll be prompted for an admin password.


Step Three - Start Your App and Test It
From the command line type
hoodie start
and it opened up a browser tab at
 http://127.0.0.1: 6004
You should see a hoodie app in your browser with a subtitle of ‘hoodie playground’. This ‘test’ shows that hoodie is working.

The command line output also shows you this information which you’ll use later:
CouchDB started: http://127.0.0.1:6006
Admin: http://127.0.0.1:6005



Step Four - Play with the App
The demo todo app shows off what you can do with hoodie. You will probably notice that it looks like a bootstrap app. Though the app uses bootstrap, hoodie has no dependency on bootstrap and any CSS framework can be used.

In the upper right, there is a drop down for Sign Up. Click on it and created an account with username and password. Now you should login because only then will data be saved.

Type in a few todos like “learn hoodie” and “steps 5, 6, 7 and 8”. You should see your todos displayed.

Nice to see a hoodie demo after just three steps!


Step Five - Tabs for CouchDB and Admin
The hood.ie demo app is already opened in your browser. Start two more tabs for CouchDB and admin. For CouchDB I wanted to see the Futon app, so these where the two urls I used:
http://127.0.0.1:6006/_utils
http://127.0.0.1:6005
While I did not use the admin (:6005) yet, it was good to know it was there. You don’t need Couchdb except for monitoring the hoodie magic.


Part Two: Make Hoodie Your Own: Go Nuts

In the next several steps the todo app will be modified to give todos a priority of 1, 2 or 3. The list of todos will be sorted on priority.


Step Six - Open your text editor
At this point the hood.ie site tells you to “go nuts”.  There are a few more steps you need to take before you can write your own hoodie app.

In my case, I started sublime text with a new project for /dalyapps/hoodietut. This was the folder created by hoodie in Step Two.

You should see folders of data, node_modules and www. Hoodie command line has set up files for both hoodie and the demo todo app.

We are going to be working in assets folder of www.


Step Seven - Edit your first hoodie files
To start creating you own App there are two files you’ll want to copy. In /hoodietut/www/ copy index.html and name the copy new.html. In /www/assets/assets/ copy main.js and rename the copy to new.js.

In sublime (your text editor) open new.html. On the last line you’ll see

<script src="“assets/main.js”"></script> 
Change that line from main.js to new.js

<script src="“assets/new.js”"></script>

Open a new tab in the browser and go to

http://127.0.0.1:6004/new.html 
This displays the file you just copied.

In the start of the body you’ll see the line “hoodie playground”. Modify that to read “my first hoodie app”. When you reload the browser you should see your first modification to a a hoodie app.


Step Eight - Button Please
The demo todo app lets you type in a new todo. It saves it when you hit the Return key. This works fine for a single input. But more because priority will be a new input, a submit button would be a more appropriate.

First, add a button to the new.html file. Look for the text input - search for “todoinput”. In the line after that add a button with an id. I used:
<button id=“addBut”>Add</button>


Second, change new.js so the addTodo is triggered when the button is clicked instead of on keypress. Replace the six lines of code after //handle creating a new task with

// handle creating a new vendor
$('#addBut').on('click', function() {
  hoodie.store.add('todo', {title: $("#todoinput").val()});
  $("#todoinput").val('');
});

The first line here looks for a click on our button. When the button is clicked second line adds a new task into hoodie using the hoodie.store.add method. This method takes two parameters: type and a data object where the task is defined. The third line clears the input.

Save these files and run your modified app at:

http://127.0.0.1:6004/new.html
Enter a new task. You should see it displayed when clicking on the “Add” button.

Step Nine - Understanding Type
Type is an important convention to understand when working with Hoodie or Couchdb. Type is a convention to deal with the lack of schemas in Couchdb.

In Couchdb the same database can contain a wide variety of different records. For example, you might have records on people and records on location. Type is used to distinguish one record from another. So the people records would have fields like fist name, last name, etc and a record called “type” with a value of “people”. The location record would have fields like street, country, etc and a record called “type” with a value of “location”

Hoodie uses type the same way. It is a way to store different ‘types’ of records in the same database. In this demo only the “todo” type is used.

So while type is not critical for this application, more complex application will have several types.


Step Ten - Adding Priority
Adding a priority requires an new input field, adding it to the display and modifying the add method we just worked with.

In new.html add a select input before the button we added above:


<select id="priorityinput" class="form-control">
  <option>1</option>
  <option selected="selected">2</option>
  <option>3</option>
</select>
<button id="addBut">Add</button>

Then in new.js modify the addBut handle to store the priority.

// handle creating a new vendor
$('#addBut').on('click', function() {
  hoodie.store.add('todo', {
  title: $("#todoinput").val(),
  priority: $("#priorityinput").val()
  });
  $("#todoinput").val('');
});
Also in new js modify the addTodo function to show the priority.

function addTodo( todo ) {
  $('#todolist').append('<li>'+todo.priority+' '+todo.title+'</li>');
}

At this point you should start seeing each task listed prefaced by a priority. Hoodie makes it pretty simple to add new fields to a store.


Step Eleven - Sort By Priority
Out todo list would look a lot nicer if they were listed by priority. So lets change the sort in new.js.


function sortByCreatedAt(a, b) {
  return a.priority > b.priority;
}

Now your number one priorities show first.


Conclusion: Give It a Try

Hoodie is very easy framework to start using. It builds on a developer’s knowledge of jQuery. It can use Bootstrap, Foundation, Enyo or any other front end framework. With very little JavaScript code you get authentication (login) and data storage. It’s offline ability is hard to beat.

Hoodie is a work in progress. There are more features to come. But don’t let that deter you from trying Hoodie. I think you’ll be please by what you find.

Tuesday, December 31, 2013

My 18 months working at The Washington Post

December 19, 2013.

Yesterday was my last day as an employee of The Washington Post. I completely enjoyed working for a great institution. I've dedicated nearly the last 20 years to two foundations of democracy: newspapers and public education. The last 18 months at The Washington Post were great.

I’m very proud of the work I did on the mobile web version of The Washington Post. You can see it when you go to http://m.washingtonpost.com on your phone. On a desktop browser you can see it by going to http://m.washingtonpost.com/settings and setting mobile version. I came in late to the project and the initial development work was done by David Young and Thad Cox. I learned a lot from both of them. We were part of a great team. No other paper’s mobile web application supports offline reading as well as The Washington Post and has the performance this feature provides.

Live sports scores and other content like Post Pulse and Topicly are displayed in this version using wpwidgets. This is a technology that I developed and expect it will be used as long as the current platform is supported. It was one of my better accomplishments.

I am very proud of the implementation of comments on mobile web. I love the performance and the clean display using Joey Marburger’s design and Sean Soper’s excellent Argus platform. I came away believing adopting graph database technology to comments will revolutionize web comments especially with paywalls. That is for the future.

Another accomplishment was the 2012 Election Night coverage that was designed specifically for mobile. I had the privilege of working with the very talented Katie Park on this project. Nodejs was used on the backend to convert the Associated Press election results API into SVG maps. These were then converted into PNG maps on Amazon Web Services for mobile. Various techniques were used to take advantage of cache but still provide the latest results. One take away was that no news organization can report on elections without JavaScript.

Duncan Graham became a good friend at The Post. We worked together to host The Washington Post JavaScript Users Group. It was out of these meetings that I developed the concept of JavaScript Journalism and hoped that it could be a common vision for the newsroom and IT.

The final item I want to mention is the concept app called PostDeck. I’ll write up more details in a separate post. I completely enjoyed developing this design and tablet vision of a large newspaper. The feedback from my fellow developers was appreciated.

The Washington Post is very innovative and the entire industry has huge opportunities ahead. I wish my former colleagues the best. Thanks to all the staff, not just the ones mentioned above, for a great 18 months. I’ll miss working with you and look forward to seeing your great work for years to come.

I will be moving on to develop my own apps at http://daly-apps.com. I'll post more about these web apps separately. 

Tuesday, August 06, 2013

Bezos Getting $175 Million Membership Value in The Washington Post

With the purchase of The Washington Post by Jeff Bezos, he is acquiring a 'membership' alone that has a value of $175 million. He is also purchasing many other assets for his $250 million.

For the last year at The Washington Post, I've argued internally that paywalls turn readers into members of The Washington Post. Paywalls turn newspapers into membership organizations. In other words, the subscriber database transforms into a very valuable digital membership database. For many internet companies this is their primary value. The membership profile of a Washington Post reader is richer and thus much more valuable than most internet memberships.

While paywall revenue is certainly valuable, the real value in a paywall is acquiring a credit card number for each member. Having a credit card on file for readers completely transforms the newspaper business model.

Paywalls turn newspapers into e-commerce operations. 

This is easily understood in looking at how digital ads will change. Any ad can now have a 'buy me now' button with a credit card on file. This substantially reduces the 'friction' in converting an ad viewer into a customer. The staff selling ads now has a much different job selling a product into a 'news app store'.

In a print newspaper you read the same ads as everyone else. When reading a newspaper online the ads (or products) are targeted based on your profile. The better the profile, the better the targeting and the value of the ad. With a credit are on file the profile is even richer. The depth of a newspaper membership is a marketer's dream.

The online profile also allows The Washington Post to be competitive in some markets again. For example, many believe that newspapers have lost the classified ad business to Craigslist. The Post's membership profile is stronger that Craigslist leading to several opportunities.

The value of a credit card on file can be approximated. In the tablet marketplace revenue comes not only from the hardware sale but from app store sales. When HP launched their ill-fated tablet, having a credit card on file was so valuable that they gave away $50 in merchandise just for putting a credit card on file in their app store. When Android was launched, Google received a lot of criticism because of the low number of customers with credit cards on file for their app store. Amazon was able to instantly create an app store because they had credit cards on file. This is ample evidence of the value of having a online profile with a credit card on file.

How did the $175 million figure come from? I believe that The Washington Post can easily get credit cards on file for one million members. This is based completely on extrapolating publicly available circulation numbers and online traffic. This is not based on any internal numbers. (In fact I have very limited access to any numbers at all in my job.) The number of subscribers and revenue from Apple's app store are available. These rough numbers suggest an estimated contribution of $175 per member to Apple's valuation. So I used this figure to value The Washington Post membership. While the $175 figure may be high, the member estimate is probably low. 


I think Bezos purchase of The Washington Post will accelerate the transformation of the newspaper business model that I think was inevitable. The biggest personnel impact will be in expanding IT department because of the importance to build the online profile. Next, as I explained above, will be a change in advertising sales.

My work at The Washington Post is coding primarily for mobile web. You see my work when you visit washingtonpost.com with your phone's browser. I've took this job just over a year ago. The views here are my own.

Personally, I'm excited to see the newspaper transformation from the inside. The Washington Post is known to foster innovation. Many people will now be interested in working here and I'm already here.