bots, JavaScript

Build Your First Smart Bot For Google Home

In the past few months, I heard someone smart saying that “the future is artificial intelligence first”.

Artificial intelligence, is making computers “smart” so they can think on their own and be even more helpful for us. It’s clear that Google, has been investing heavily in the areas of:

  • Machine learning – Teaching computers how to see patterns in data and act on it.
  • Speech recognition and Language understanding – Meaning, being able to understand you when you are talking with all the little differences and nuance.

These days we can see it all come together in the Google Assistant. It allows you to have a conversation with Google and be more productive. In this post, we will see how it’s all working by building a new Action for Google home. In the same time, we will have a nice bot that in the future we will integrate with many apps. Cool? Continue reading

Standard
Chrome, JavaScript, webdev

Online Editors For Web Developers

One of the most powerful aspects of the web is the ability to share your ideas and work with others quickly.

Over the years, I tried several options to share code and do demos. It’s true that you can always start your own server and serve your site, but in many cases, you want to focus on your demo and not do administrative work again and again. Here are some tools that I enjoyed using and I still find myself returning to check them from time to time. In most of them you got a nice ability to move (even) faster and to use GitHub for your code. Continue reading

Standard
Chrome, JavaScript, webdev

Protect Your Website With HTTPS

TL;DR

  1. Create (for free) an SSL certificate.
    One resource for that is letsencrypt.org
  2. Install it on your website’s server: letsencrypt.org/docs/client-options/ – You just quickly choose the client that will match your server environment or do everything in your browser.
  3. Change all your website’s links from HTTP to HTTPS so that search engines are notified and users will get the HTTPS version.
  4. Go have a drink.

Why?

You should always protect all of your websites with HTTPS, even if they don’t handle sensitive communications. HTTPS helps prevent intruders from tampering with the communications between your websites and your users’ browsers. It might be a malicious attacker or legitimate (but intrusive) companies, such as ISPs or hotels that inject ads into pages. Your users will think that your site is ugly or worst because they can’t tell who is doing what to the pages.
If you care about your users, always protect them and serve them with HTTPS. It will also prevents intruders from being able to passively listen in on the communications between your website and your users. Another benefit we gain from HTTPS is the ability to work with new powerful web platform features: Continue reading

Standard
Chrome, JavaScript, webdev

Progressive Web Apps Event At Campus TLV

Progressive Web Apps are experiences that combine the best of the web and the best of apps. They load quickly, even on flaky networks, can re-engage with users by sending web push notifications, have an icon on the home screen and load as top-level, full screen experiences.

Here are the slides from the keynote I gave today at Campus TLV.

If you want to see it in action, click on the image below.

noter-1 PWA in Nexus 6

Standard
Chrome, HTML5, JavaScript, webdev

How To Build A Progressive Web App?

noter-1

Why?

Progressive Web Apps are all about an amazing experience. You PWA should combine the best of the web and the best of apps. In the example above (yep, the ‘Noter web app‘) you can see that it is useful from the very first visit in a browser tab, to the launch from a home screen. As the user progressively builds a relationship with the App over time, it becomes more and more powerful. It loads quickly, even on flaky networks, it persistent and your notes are always there. It got an icon on the home screen and loads as a top-level, full screen experience. If you wish to add push notifications (which are great way to re-engage with your users) – pay attention to the tips in the image below.
What push notification be for your web app

How?

  • First step: I strongly recommend trying out the PWA code lab so you understand how the approach to this type of app may be similar (or not) from what you’re used to do.
  • Tech: Evaluate whether you’re going to just use vanilla JS for your app or a library/framework. See here for barebones PWA config or try Web Starter Kit for a starting point with a build process (=Gulp). Your PWA should supports the application shell architecture for faster first-paint and persistent.
    • Offline support: There are few libraries  for helping you with Service Worker pre-caching (sw-precache) and runtime caching (sw-toolbox). You can check this code lab for building your first offline web app as a starting point.
    • User Interface: Like anything on the web, there are lots of options for your UI. Some of the example PWAs take advantage of Material Design and there are libraries for using it available for vanilla JS, Polymer Paper elements, Angular Material and community efforts like Material UI for React.
    • Icons: I find both iconfinder.com and realfavicongenerator to be good resources. If you have the budget, it’s always great to get something polish from a designer.
    • Performance: Please follow the RAIL performance model:
      • Cable:
        • First load (network-bound), First paint at 1s or sooner, Speed Index of 1,000 or less, <100ms for response, <16ms for each frame.
        • Second load: first paint at 300ms or sooner, Speed Index of 1,000 or less.
      • 3G:
        • First load (network-bound), 3G (normal, as defined by WPT): First paint at 2s or sooner (including TLS handshake), Speed Index of 3,000 or less.
        • Second load (disk-bound because SW): First paint at 300ms or sooner, Speed Index of 1,000 or less.
      • Test your work with WebPageTest and Chrome DevTools.
  • Examples
    • Smaller Pictures – A great web app that will help you shrink photos.
    • Air Horner – The ‘must have’ web app for the olympics in the summer.
    • Voice Memos – Very useful when you have conversations with your spouse.
    • Offline Wikipedia – If you need to read something on the plane.
    • Guitar Tuner – For the ones that needs to tune their guitar.
    • Zuperkulblog – Good if you thinking on a PWA for publishers.
    • Snapdrop – an Apple Airdrop in HTML.
    • More on this pwa-list.
The main features for progressive web app

The main features for progressive web app

Misc

 Be strong and build something amazing!

Standard
Chrome, JavaScript, mobile, webdev

Progressive Web Apps – Noter

noter-1Progressive web apps are the future, and here is a demo that I built in order to feel the current challenges.
How about a little tool that let you take notes?
Yes, not too original, but still useful.

It is currently can be found with 2 versions:

  1. Basic version – It contain service worker for offline, manifest and a simple text area. All the basic functionality, that allow you to take notes the are saved automatically with or without connection. I used jQuery and bootstrap to keep it simple and to make it easy to extended it in the future.
  2. Full version with Firebase – Similar to the basic version, but this time, I added the ability to save the notes in the cloud (=firebase). You can add notes, edit current ones and (of course) delete the ones that you don’t really like. The text area was upgrades to a markdown editor. A simple one, but still something that will give you the ability to get a preview of the note in a markdown.
    You can use:
    User –  demo@demo.com
    Password – demo

See below how it will look like after you login.
Noter - full version with firebase

It’s still “work in progress” and you can see at the current TODOs at the bottom of the code repository.

Challenges and Tips

You can see the main tips that I got from working on this demo in the image below.
The most important checkbox is “force update on page load” – It will make sure you are getting your new version and not the one that the service worker already cached.
Another good way to see what is going inside your service worker is to click on the link ‘sw.js’ above this checkbox.

noter sw ip

 

So to wrap-up, the code for this demo can be found at Noter on github and the live demo.
Please try it on your Android and let me know if you find something that is broken or can be better.

Happy note taking and may you always write good and productive ones.

Standard
Chrome, JavaScript, mobile, webdev

Building a Progressive Web App

I think the web platform is awesome.
Moreover, it got some impressive APIs that make it even more powerful. The web
 platform is easy to access (very low friction), no installs, easy distribution (without walled gardens), immediate redeployments and no single organization own it. Let’s see what do we mean when we are talking on progressive web apps.

Progressive Web Apps

  • Fast loading – Because we know users love speed and for every delay we are lossing a smile (and a user).
  • One click away from accessing content – You should have an icon on the screen and with one click you could get to your content (or task) and smile.
  • Smooth animations and navigations – Good UX comes with these aspects.
  • Re-engages with push notifications – In many cases, we wish to be able to notify users even when the browser is not open in-front of them. We can!
  • Good experience on flaky network connections – Our web app is offline first, so we can deliver our content (just the deltas) on flaky networks much better/faster.
  • Consistent experience across browsers – After all, we are talking on the web here. You can’t control from which device users will come to your work. So make sure, you serve them all.

PWAs are about the experience, no the tech: these apps _feel_ better and more app-like. The technology behind Progressive Web Apps is called “Service Worker”; it’s available only since mid 2015 and is seeing large, growing adoption. PWA is expected to be for mobile what AJAX meant for the desktop web.

Enabling app-like capabilities

At the foundational level, there are two core pieces of technology that enable PWAs: Continue reading

Standard