One Week with the Apple Watch

watch_logo_large_2x

A friend from London brought me an Watch 12 days ago. I’ve been using it since day one and I have to admit I like it more than I expected.

I’m not gonna do a full review of the device, but rather I’d like to comment on some details that surprised me.

Model

It’s been a while since I last wore a watch and I was afraid it would be too big for me. So I’m using the 38mm sport model (the smallest one) with a blue band.

s38si-sbbl-sel_GEO_US

Truth to be said, it looks way smaller than I thought! In the pictures it looks really thick, but the rounded borders makes it look really thinner on the wrist.

I was also worried about the rubber band, which seemed cheap on the photos. What a big surprise! It has a very soft texture and it feels great even when it’s a hot day or when doing exercise.

The first days I wore it tight, thinking the heart monitoring sensors would work better. Later I realized you can wear it a bit loose and it still works fine.

The only flaw on the design is the huge space between the glass and the display. It reminds me to an older iPhone. Anyway, it’s a small issue. I’m sure Apple is preparing a thinner design for the next iteration.

Interface and Usability

Although the watch runs a special version of iOS, the interaction has little to do with the iPhone.

First thing you notice is it’s designed for quick actions. The few times I used it for more than one minute my arm complained.

It’s pretty fast, and everything works great… as expected from Apple :).

Input devices

Scrolling with the digital crown is fast and precise, and I really like the vibration feedback when you reach the end of the scroll.

Also, I like how the Force Touch makes sense here. It’s the quickest way to display extra options in a small screen. I cannot wait to see this on the iPhone :).

Navigation

I use the main screen most of the time. From there you can:

  • Check the time (action by default)
  • Swipe down for notifications
  • Swipe up for glances (weather, heart monitor, activity…)

IMG_4363

You can use the digital crown as a Home button to display the app menu, but most of the time I get there is by mistake. So, no, I don’t use many apps.

You can also press the digital crown to speak with Siri. I have never used siri on the phone, but I use it a lot on the Watch. First, is faster than the phone (it’s already on your wrist); second, it works really great even in a noisy place. Only downside: You need a good internet connection, or Siri will take ages to process your voice.

Messaging

There’s another button you can use to display a people menu. You can call and text your favourite contacts from there. Is nice, but It’s a bit useless for me: I don’t call people, I don’t use iMessage, and no one else has an Watch I can draw pennises to.

IMG_4364

IMG_4365

From that menu you can doodle things and send it to other Watch users. It’s funny, and makes sense as it’s the quickest way to communicate with someone from the watch. But I think it’s too specific for this device, so I don’t think we’ll see this feature in other devices.

Dependency on the phone

Right now, all third party apps runs on the phone. And you notice it because it takes some time for them to refresh.

By ’runs on the phone’, I mean:

  • The app UI is installed on the watch.
  • Every time you press a button the watch, it notifies the phone.
  • Then, the phone decides what to do and updates the watch screen accordingly.
  • You can see a loading wheel meanwhile.

Almost everything depends on the phone. ¡You need an iPhone to activate the Watch!

Battery

This is one of the greatest surprises I found.

I usually go to sleep with 50-60% of battery. I have to charge the watch every night but I’m not worried to run out of battery during the day.

Also, I haven’t noticed any change on the battery duration on the phone.

Activity

Another thing I love is the activity tracking app.

By default, the watch tracks how much you move, how much you exercise and how much you walk.

IMG_4366

You set a daily goal of movement, and you review that goal every week.

If you move, walk and do exercise you are constantly cheered up by the watch.

If you sit for too long, the watch will ask you to move a bit.

It’s pretty silly, and not as disrupting as it sounds. Many times I’ve ignored the notifications and haven’t felt bad for being so lazy.

But then you can check how many activity you get on a regular day, and how many you get on a lazy day… And you realize there’s a big difference!

So it’s a good way to keep some control over yourself, understand how lazy you are, and start doing something about it.

Notifications

You can choose what notifications you get on the watch from the phone.

I found WhatsApp and Telegram ones rather annoying. You cannot answer messages from them (you can on Slack and iMessage ones), so I end up checking the phone anyway.

Other notifications are fine, not as disturbing as the phone and easier to ignore.

Ghost vibration

You know when you feel a vibration on your leg, and you go check the phone on your pocket just to find there’s no new notifications, and the phone wasn’t even in your pocket.

I stopped having ghost notifications long ago, when I disabled vibration on my phone.

Now I’m having ghost vibrations on the wrist :).

Nose as finger

As I said before, notifications are easier to ignore on the wrist.

Well, one thing that helps here is the nose. I found myself dismissing notifications with the nose when I had my other hand busy, or I was too lazy to move it. Hehe.

Security

Someone asked me: “Isn’t the watch too easy to steal with that band?”

Took a look, and yes, it’s really easy to steal an Watch.

Then the second question is… Why would you?

You need to enter a passcode every time you take it off and on.

Without the passcode, you can only check the time. No glances, no apps, no notifications, nothing. And of course, no re-pairing to a new phone.

The watch is tightly coupled to your phone and your passcode, so a stolen watch it’s rather useless.

Conclusion

I’m happier with the Apple Watch than I expected. I use it everyday, and I have the feeling it makes my life better.

I think the activity tracking is the best feature of all. No other device or app made me understand how many time I spend seated, motionless.

In general, I feel it’s a great device that has the potential to make everyone wear a watch again.

Update: Turns out a stolen watch can be erased, as commented here

Web Frameworks

Java is a great language, but if you have ever tested any scripting language like PHP, Ruby, node.js, you know Java is… Over Engineered.

You have to write lots of code for anything. Big configuration files, use of application servers, too many classes to perform simple tasks, no support for Collections literals, etc…

Because of that, and before I knew the world beyond java, I started Blaapps (Bery Lol AAplication Server). A very lightweight application server minded for speed up development of web apps.

After I presented it as my final year project I stopped developing new features, but recently I had to do some web stuff on java and I remembered how painful it is.

If you start doing a web project with java, you feel naked. Standard tools are bare minimum. That’s why there’s a lot of web frameworks for JavaEE.

But most of them follow the java over engineering philosophy. Let’s see some examples…

Installation

Let’s see what is needed to develop with some of the main web technologies:

Technology Base Testing server Dependency Management
Java EE Java Runtime + IDE Application Server maven, not included
Play Framework Java Runtime + Play Embedded server included commands
PHP PHP Embedded server pear – Included
Ruby On Rails Ruby + Rails Embedded server Ruby Gems, not included
Node.js Node.js Embedded server npm – Included

So, if you want to develop a Java EE web app, you will have to download the JRE, an application server, and the Java framework you want to use. Also, you will need an IDE, as the Java language requires you to write lots of code, and compiling processes aren’t simple.

So, if you want to develop a Java EE web app, you will have to download about 500MB. ¡WTF!

Node.js download is 7,7MB.

Hello world

Let’s see how to write a Hello World app in different platforms:

Java EE

You need the following files:

  • index.jsp
  • WEB-INF/web.xml

The WEB-INF/web.xml would be like this:

<?xml version="1.0" encoding="UTF-8"?>
 
<web-app
        version="3.0"
        xmlns="http://java.sun.com/xml/ns/javaee"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
  <display-name>Hello World</display-name>
  <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
</web-app>

And the index.jsp:

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<html>
  <head><title>Hello World</title></head>
  <body><h1>Hello World</h1></body>
</html>

Zip them on a file named helloworld.war and copy them to the application server… ¡Super easy!

Play Framework

First, create the play project:

 $ play new helloworld

This creates lots of files.

Then, edit the main route helloworld/app/controllers/Application.java (configurable):

package controllers;

import play.*;
import play.mvc.*;

import views.html.*;

public class Application extends Controller {
  
  public static Result index() {
    return ok("Hello World!");
  }
  
}

Run:

 $ play
 [helloworld] $ run

And you will see the app on localhost:9000

PHP

Write an index.php:

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<html>
  <head><title>Hello World</title></head>
  <body><h1>Hello World</h1></body>
</html>

and run:

 $ php -S localhost:8000

Your app is on localhost:8000

Ruby on rails

Like play, we have to create a project first:

 $ rails new helloworld
 $ cd helloworld
 $ rails server

That will start the new project and a server on localhost:3000

To edit the index, remove the default index and create a route:

 $ rm public/index.html
 $ rails generate controller home index

Edit config/routes.rb to add:

root :to => "home#index"

Edit app/views/home/index.html.erb to be:

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<html>
  <head><title>Hello World</title></head>
  <body><h1>Hello World</h1></body>
</html>

And that's all! Almost easier than Java!

Node.js

write a new file named app.js:

var http = require('http');
var requestListener = function (req, res) {
  res.writeHead(200);
  res.end('Hello, World!\n');
};

var server = http.createServer(requestListener);
server.listen(8080, "127.0.0.1");

run:

 $ node app.js

And you are ready! Your app will be on localhost:8080.

Conclusion

There are lots of Web frameworks out there, and Java is not the only way of doing things.

Choose your framework thinking in what's important for you. For me it's:

  1. Fast Development
  2. Fast Deployment
  3. Huge community

I want to start developing fast. One way of reading it is the lack of need for an IDE. If you need an IDE to help you, it's not simple enough.

Also the lack of a framework is important. With Java EE you will need to add a framework, it's another layer of complexity. The more layers, the more things that can go wrong.

Ruby on rails is a framework by itself, but hey! You need commands to create correctly new files. There's too much dark magic in ruby on rails…

Make it simpler!

Same could be applied to deployment. If I can't just copy the files to the server, it's not simple enough.

Also, a huge community ensures you that you'll have lots of plugins and libraries ready.

Of course, my option right now is Node.js.

Arrays en PHP

Me encantan los arrays en php, son un saco en el que cabe de todo:

    $datos = array(
        'nombre' => 'Víctor',
        'apellidos' => 'Jiménez',
        'Cero',
        '0' => 'Otro Cero',
        1 => 'uno',
        'dos',
        '1' => 'UUUUNO'
    );

    foreach ($datos as $key => $value) {    ?>
        print "$key : $value \n";
    }

Es curioso cómo se pueden mezclar claves escalares y asociativas en un mismo objeto. Y más curioso es ver cómo convierte ‘0’ a 0. El código anterior muestra:

  nombre: Víctor
  apellidos: Jiménez
  0: Otro Cero
  1: UUUUNO
  2: dos

(25) playing with bash autocompletion

Updated: as Blaxter notes, it’s necessary to open a new terminal after editing the bashrc file for the changes to take effect. Also, I’ve replaced the tail -n+2 with the -ss option. Thanks Baron Schwartz!

One of the things I’ve been doing lately is doing some cleanup on my laptop.

There are two things I’m constantly using on the shell:

  • Open a project folder
  • Connect to a MySQL Database

Bash Functions

I first made a bash function to help me with the projects paths:

function cdp {
case $1 in
  "foo")
    cd /Users/golo/devel/svn/foo/src ;;
  "bar")
    cd /Users/golo/devel/svn/bar/src ;;
  *)
    echo "Options:"
    echo ""
    echo "  foo"
    echo "  bar"
esac
}

I placed that on my /etc/bashrc , so I write:

$ cdp foo

And it takes me to the foo project folder.

But, as I have lot of open projects, I have to remember «foo» and «bar», or worse… ¡¡Write «foo» or «bar»!!

Bash Autocompletion

My Lazyness made me learn how to create bash autocompletions. This case is easy as executing «cdp» without parameters you get a list with all possible values. It’s easy to parse ;).

The autocompletor should be placed on the file /etc/bash_completion.d/cdp with this content:

_cdp_show()
{
        local cur opts

        cur="${COMP_WORDS[COMP_CWORD]}"
        opts=$(cdp | tail -n+2)
        COMPREPLY=( $(compgen -W "${opts}" ${cur}) )
}
complete -F _cdp_show cdp

opts stores all possible options (line per option), and cur stores the text to be autocompleted (not sure). compgen is a helper to create the autocompletion options, and complete is the command that does the autocompletion reading the COMPREPLY variable.

Now I get the following behavior:

$ cdp <tab><tab>
foo    bar
$ cdp f<tab>
$ cdp foo

Oh! Amazin!

MySQL Bash Autocompletion

¿What can be more awesome than that? Let me guess… ¡Autocompletion for mysql command!

The goal is to get autocompletion for the mysql databases. No more writing…

$ mysql information_schema

For that, we need a list of all databases on a parseable format, let’s try with SHOW DATABASES:

$ mysql -e "SHOW DATABASES"
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
+--------------------+
$ # Let's put this on a better format:
$ mysql -B -e "SHOW DATABASES"
Database
information_schema
mysql
performance_schema
$ # That's better, let's delete the table header:
$ mysql -B -ss -e "SHOW DATABASES"
information_schema
mysql
performance_schema
$ # We are ready! :D

Disclaimer: I tried mysqlshow but doesn’t accepts the Batch format, also I have the user and password on my /etc/my.cnf so this trick is not suitable for production environments.

Let’s create an autocompletor mixing this command with what we already know. The result is the file /etc/bash_completion.d/mysql:

_mysql_show()
{
        local cur opts

        cur="${COMP_WORDS[COMP_CWORD]}"
        opts=$(mysql -B -ss -e "SHOW DATABASES;" )
        COMPREPLY=( $(compgen -W "${opts}" ${cur}) )
}
complete -F _mysql_show mysql

Now you can use <tab>:

$ mysql i<tab>
$ mysql information_schema

Hope it helps! Improvements are welcomed 😉

(6) Bautizo

Una de las cosas más complicadas de empezar un proyecto es bautizarlo.

Parece mentira, pero empiezas a añadir condiciones, y luego es difícil encontrar un nombre:

  • Que tenga varios dominios libres
  • Que no se confunda con algo que ya exista
  • (corolario) Que tenga pocos resultados en google
  • Que tenga nombre libre en twitter
  • Que sea fácil de pronunciar / recordar
  • Que tenga algo de relación con el proyecto

Después de estar todo el día buscando nombres, al final ¡¡¡¡lo he encontrado!!!!

Bora Board

Ahora sólo falta hacer el proyecto… 😛