Current home automation products make your environment dumb

I think projects like this one are cool hacks, but nothing more. It’s making two trending devices to talk to each other. Google’s Glass may become a revolutionary piece of technology, but I think that using them to control every smart device of the internet of things is useless. We should use them to interact with our environment.

There is something broken in current trends of home automation. It’s the urge to make every piece of technology to be smart in itself.

Most domotic appliances that have become popular in recent years are smart devices connected to the internet with their own web interface and embedded OS.

  • Lockitron is a door lock with Wifi and Bluetooth
  • Nest is a thermostat with Wifi and leaning capabilities
  • Hue is a multi-color light bulb connected to the internet
  • LIFX is a multi-color light bulb with Wifi

The worst are those that need to be be connected to the manufacturer’s servers. Some have open APIs or can be programmed directly on the device, but they still are complex pieces of technology for simple on/off (e.g.: a door lock) or gradated (e.g.: adjustment of light or temperature) tasks.

When every component of your environment is smart, it’s the environment itself that becomes dumber. For the environment to be smart, it must be composed of multiple simple elements of 3 kinds: interfaces, controllers and sensors. These elements must:

  • do one thing and to it well
  • be ubiquitous and hidden in the environment
  • use simple components
  • use open protocols
  • be centrally controlled, ideally by a central server in the home without every components that communicate directly to the manufacturer server via the internet

If a device use simple enough electronics to only do what it need to do and all the logic is performed by a central controller, these appliances can be produced cheaply and then really be ubiquitous.

These devices must get out of the way and let the environment react to various input collected from everywhere instead of configuring each device to react to their own sensors.

Still, I hardly imagine how the home automation field can gain more consumer adoption without plug&play devices like those. We need to build on those trendy inventions and to fast forward to the next step of home automation and smart environment.

Some updates

I’ve started this new blog in november 2012, posted 7 texts in the first month and nothing until february. The fact is that it’s easier to have ideas than to execute them. I’m up to 6 unpublished posts. Some just got forgotten and the others are already outdated. I’ll need to focus my thinking on executable goals and be proactive about them.

Why’s that? Because I’m starting a new company with three partners. It’s a Design/Communication/Web agency called Agence Podium (yeah, we’re kind of “cordonnier mal chaussé" for now).

What this got me in the last months:

  • Updating myself on frontend technologies and development techniques
  • Learning how it’s a hell of a job to make fully responsive Websites
  • Wanting to optimise my tooling and workflow (I even made a dotfiles repo!)
  • Finding out how to launch my PaaS and what market to target

What I want to do in the next months:

  • Discover and develop tools to optimise my workflow
  • Work on cool projects for Agence Podium
  • Actually launch the damn PaaS

That imply to focus on getting shit done and to clone myself for the success of all my projects. At least, 2013 will be a hell of a challenge!

Updated way of including gists on Tumblr

I had to update my method of including gists on my blog.

First, Github mades great changes to their gists, so I made a simple adjustment to my code. The url of the CSS now contains a hash and your username is in the url of the gist itself (but, old urls redirect to the new one even in jsonp calls).

Second, Tumblr mades some changes in their editor and broke some things like:

  • the cursor may become out of sync with the editor in HTML view
  • we can’t navigate between characters in link insertion
  • they strip data attribute which I used for parsing gists’ links
  • there probably a lot more bugs…

It’s now done with 36 lines of code.

A dynamic CDN for Modernizr?

Lately, the PaaS developer that I am has been building more web sites than usual.

I’m becoming passionate about CDN and static or generated web sites. In the last year, I’ve been deploying all my static assets on static storage. Including fonts. I mean, on my own CDN.

It’s just last month that I realized how wise it is to use Google Fonts:

As the Google Web Fonts API becomes widely used, your visitors will be likely to already have the font you’re using in their browser cache when they visit your page.

Excellent, what about Modernizr now?

The point of using Modernizr isn’t browser detection but features detection. So the idea is not to serve polyfills directly by checking user-agent, but to send the compressed version of Modernizr for the requested tests.

And step 2, send the compressed version of the polyfills in one request.

There is more!

I’m also a fan of non-blocking IO and progressive enhancement. I think serving compressed and cached versions of commons scripts is great, but giving the opportunity for the developer to load them asynchronously is better.

For example, we could load Modernizr with :

This code inspired by Google Analytics snipet

But, hey! If it ‘s async, we need callbacks!

We could use something like:

var _modernizr = [[‘history’, function(){/* ‘history’ is present or polyfill loaded */}], function(){/* last callback: all features present or polyfills loaded */}];

What now?

  • Does something like this already exists?
  • Is it a good idea?
  • Someone wants to give a hand?

I’ve a lot of projects to ship until the end of February and it’s the Web à Québec this week, so I’ll let the idea mature a little and maybe start working on it in March. Feel free to contact me or steal the idea in the meantime :)

Try to build an ecosystem and drop your other ideas

Ideas are cheap and renewable resources. You can find countless blog posts about interesting ideas that people had without having time to invest in these. If you want to start a business and you have no project idea, this may be a good place to start looking. But a better way to start could be to learn having ideas if it’s even possible… in this case, this blog post doesn’t concern you.

I’ve used my 3 years in cegep to wander from an idea to another and to improve my understanding of the Web before deciding what would be xpensia. The short answer has been a PaaS, but the long one is in fact an ecosystem of tools to ease the development of Web applications for the cloud.

Ecosystems are often seen as jails like what does Apple with iOS, OSX and iTunes. But an ecosystem is also a way to sell a more granular product from which users can pick only what’s more relevant for them. That way, they can select a product that will supplement the competitor they may have already chosen or go full stack with xpensia.

To have defined the business model (which is also my guideline for development) doesn’t mean to stop having ideas. This forces to ask how the new stuff can fit in the ecosystem and how it can supplement other components. Personally, I maintain a list of ideas ordered by how well they fit in the ecosystem. The firsts in the list should be the ideas I’m currently working on because of their proven value, the following are those who have good potential and the lasts will be improved or discarded.

Every building block of the core product would be usable as is. In other words, my PaaS offering is not a black box. I’m selling a factory that allow to select the best box for your project. And I’m looking for funding.

Async loading of Github’s gists without jQuery (31 LoC)

This week-end, I wanted to write a blog post with some code in it. So I thought to use Github’s gists.

The problem: the code that Github gives to embed gists is a script tag with ugly document.writes and Tumblr simply doesn’t allow script tags in posts.

There are existing solutions but they all try to catch document.write or they at least need jQuery. If you don’t already use jQuery, you don’t need it for something that won’t necessarily be called on every pages.

The trick is to fetch the gists in json format: https://gist.github.com/4138162.json

That way, you get all information about the gist and you’re free to insert the HTML where you want. The url also support the file parameter to get only the code for a particular file in the gist. To do that, we will use jsonp with the callback parameter.

This is how I do it:

Async load of Github’s gists without jquery in 31 lines of code

You use it by adding a placeholder tag with the attributes class=”gist” and data-id=”{gist ID}”. You can also add data-file=”{file name in the gist}” to only show a specific file. It is a good idea to use a link as your placeholder tag so your viewers can still click on the link if their browser doesn’t support getElementsByClassName.

Can we do better? Yes. If you don’t use Tumblr or another platform that strip unknown tags, you can support old browsers (IE6-8) by using getElementsByTagName and the trick for using HTML5 elements.

First, add document.createElement(“gist”) in the head of your document and make the tag inline in your CSS : gist {display: inline;}. Now you can add this new script at the end of your document:

Async load of Github’s gists without jquery in 31 lines of code

This gist can now be embedded with: <gist data-id=”4138162” data-file=”gists2.js”><a href=”https://gist.github.com/4138162#file_gists2.js”>Gist</a></gist>

Sure there is ways to support old IEs on Tumblr but I wanted a lightweight solution and I expect people reading my code to use a proper browser.

In fact, the core of this solution is the jsonp call. From that we could do more fancy stuff like a custom Disqus library to replace strings like #4138162:gists.js in comments to let you share code.

Now, stop reading blog posts and go write code!

Embedding SSL inside HTTP @ 5 am

This weekend I’m doing the Startup Weekend in Quebec City, the city where I do most of my Foursquare checkins

Saturday has been ruff on me because I’m an good backend developer who has no clue on how to use jQuery mobile (OH, I hate to make sliders inside a hell of javascript-resized and absolute-positioned DIVs). And the truth is that the backend is no so important for creating a proof of concept in 48h. So what’s better to change my mind than coding some crazy things at 5 am?

As I wrote in my last post, there is no reason not to use a PaaS to deploy your apps. Even when your protocol need full duplex TCP. I hadn’t tested it yet, but I was sure we could use HTTP Upgrade to embed any TPC protocol inside HTTP and deploy this on nodejitsu.

I was right ⇒ my test case on Github

It’s a simple echo server that use SSL to encrypt the stream after a HTTP handshake in cleartext. The funny thing is that nodejitsu’s proxy will close the connection if the client asks for a different protocol than “websocket”. Just fake it and send whatever data you want. Advice: send a X-Upgrade header, so your server will know what’s going on

TODO:

  • Battle test it
  • Watch out for timed out connection
  • Don’t test on a shitty university’s wifi
  • Send me a pull request for a README ;)
  • Don’t write blog post in english at 5:30 am when your primary language is french
If you’re not buiding a PaaS, you should deploy on a PaaS

This recently became a motto in my day-to-day practice. As the root project of my own company is a PaaS, I’m also working for Aranatha where I have to deploy web apps.

I’ve started my quest as a developer by pushing (well, f*ck# FTP-ing) code on shared hosts and later discovered the power of working with VPS servers. These days are long gone, but these kind of service providers are still there and there is no reason to use them!

Some use cases:

  • Small static Website ⇒ Amazon S3 (Free tier)
  • Generated static Website ⇒ GitHub Pages (free, custom domain)
  • Site with blog ⇒ Tumblr (free, custom domain, 100% editable design)
  • Dynamic Website ⇒ Heroku (free for low traffic, git deploy)
  • Anything that can run on linux and use HTTP for front-end ⇒ Heroku
  • Anything that needs HTTP Upgrade or WebSockets ⇒ Develop in Node.js and deploy on Nodejitsu
  • Anything that needs TCP ⇒ Think about wrapping your stream in HTTP Upgrade
  • Anything that needs to run on Windows ⇒ I respectfully think you’re an idiot or unlucky but there are solutions for that
  • Desktop application ⇒ you’re wrong and it should be Web based
  • Must deploy on your company private network ⇒ Install CloudFoundry on your hardware
  • More complex challenge ⇒ I’m interested in your use case, we can make your project and xpensia’s PaaS work together

Sure, you can’t necessarily deploy and expect an existing app to work like in a single instance environment. You have to design for PaaS deployment in mind

The road so far…

oh no, you’re right. The title is a damn reference.

  • 1991 : birth, but the merit is not for me
  • 2005 : started coding some useless PHP
  • 2008 : going to college to get a diploma
  • 2009 : Nodejs exists and I don’t know it yet
  • Somewhere in 2011 : I finally know what is nodejs
  • Summer of 2011 : got the diploma
  • August 2011 : started working for Aranatha
  • Autumn of 2011 : going to university to go to university
  • Oct.-Nov. 2011 : participate to two hackathon about open data
  • End of 2011 : started to work on my projects @ L’Abri.co
  • January 2012 : we won the second edition of Coveo Blitz
  • Mid-February 2012 : I’m fixed on the fact that Cloud Foundry is total crap
  • End of February 2012 : I won’t continue university
  • March 2012 : xpensia inc. is now incorporated

2012 have been mostly about learning what’s really a startup and what isn’t. For that the answer is: a lot isn’t and few things are.

For sure, the end of this year will be about making choices.