Experimental Project

I was working on a project to pitch and due to some things that have happened recently I decided to switch my focus.  I don’t think it’s a failure, it’s something that we will have to come back to in the IoT world.

The project itself was about crowd sourcing data (thanks to Sakina’s brilliant insight) and filtering incoming data for the end user to a more manageable chunk.  The main reason I wanted to work on it was that I wanted to lower the backend traffic to the web of personal data.  With all these IoT devices sending stuff to the cloud, I thought perhaps bandwidth will become an issue.  I was also worried about the front end and overloading the end user with information that they might not understand at that point in time and find out only later, “Aw, if I had only known…”  Amy Lee had pitched that portion of the idea.

I ended up doing some research along with Amy and we found that there was a team called Syncmetrics that ended up disbanding.  We talked to Cas who was leading the team, and there were several points in regards to why they abandoned the project.  His project was about synchronizing data points across various fitness devices.  ie A scale he bought, and a different food logging system he was using and a fitbit or something to that effect.  He saw it as a need for himself and ended up growing the project to 20k people with only 4 people working part time on it.

  1. scalability was an issue.  With all sorts of devices of fitness devices that various companies are putting it, it was hard to scale 4 people part time on it.  They were adding APIs almost every week.  To give you an idea, FatSecret, CalorieCounter, My NetDiary, MyFitnessPal, LoseIt, … and much more are all Food Calorie Counter websites/mobile Apps that people use.  (This is one of the major concerns I have for Project Link)  Not all APIs have notifications.
  2. Data is hoarded.  Data is pretty important and some of the things that allow people to make great insights is by looking at trends in data.  Even though they dropped the project, they are still working with Universities and such with the data they have.
  3. They had to be careful around Healthcare and make sure that they weren’t giving recommendations; that they were only showing data analysis.  They did this by showing graph comparisons of what people wanted to achieve as a goal such as weight loss/gain versus how much people exercised and how much calories were taken in.
  4. Error Handling : whether it’s an API error on the other side that needed to get fixed versus user input of people mistaking pounds for kgs or vice versa and then later on realizing that they were inputting it in wrong.  This caused data to be off sometimes.

If you want to read my notes, you can find them here : https://public.etherpad-mozilla.org/p/syncmetric_questions  Following this, I wanted to create a prototype for a presentation that we were going to pitch.

Part of this prototype was to pull data from the fitbit.  After tinkering, doing research and such, I was able to use https://github.com/orcasgit/python-fitbit and created my own branch to pull data.  You can take a look at the sloppy code here : https://github.com/nhirata/python-fitbit/commits/heartrate  [I admit to being a Python noob/intermediate; I was concentrating on just making something that worked.  Not being pretty or thinking about the architecture since it was a prototype.  As an afterthought, I probably should have thought of things a bit better].

I changed the authentication measure so that you can log in with just having your Client ID and Client Secret in a config file, and it would handle the session token in a different json file.  You would get the Client ID and Secret from the dev.fitbit.com and creating an app there.

Specifically if you cloned my repo, you would have to do those things and then :

git clone https://github.com/nhirata/python-fitbit.git -b heartrate
cd python-fitbit
sudo pip install -r requirements/base.txt
sudo pip install cherrypy

Create config.ini
[Login Parameters]
CLIENT_ID:<client id>
CLIENT_SECRET:<client secret>

run : python gather_keys_oauth2.py
authenticate on the web browser to fitbit
run : python heartrate.py

I couldn’t figure out a way not to use a web browser, and it also mentions in the web api that browserless authentication is not allowed.  So in order to the initial connection going you have to run the gather_keys_oauth2.py first, use a web browser to authenticate.  There’s methods inside the python-fitbit for refreshing the authentication so you don’t need to worry about that.  From running this you can get information on your current heartrate for the whole day in json format.  I also pulled out data for the alarms in a json format that was set on the fitbit as well.

The data looks like this :

Screen Shot 2016-03-22 at 8.23.27 AM

What was I going to do with this data?

  1. Store it in a database and get some crowd sourcing data going as a prototype
  2. Interact with other objects.

I haven’t started on the store as database portion yet, I was going to do that more so after playing around more with the API later this week.  Having said that, I’m halting that notion as I stated due to some recent events.

The second part was what I was currently tinkering with.

On the raspberry pi, I got cron gui installed thanks to some info on the Pi site.

sudo apt-get install gnome-schedule
You can then launch the program Scheduled Tasks from the main menu -> System Tools.

I then could potentially run the script for polling data from the fitbit and have it do stuff based on certain activity.

The second part was to setup all sorts of stuff, here is my setup:

Screen Shot 2016-03-22 at 8.33.21 AM

Weight Guru and Smart Lid do already interact with the FitBit.  My concern is whether or not they go to FitBit and their own cloud.  I haven’t monitored the traffic there.

I’m not also sure whether WeMo or the Hue send packets of data to their respective clouds.  Those are still some areas to look into in terms of privacy and data collection that companies are doing behind the scenes.  I had set up this subnetwork in side my home and connected the Scale from WeightGuru, the SmartLid from Thermos and Fitbit together.

I also got Hue connected to FoxBox.  I’m using Fabrice’s builds :

installing fabrice’s build :
1. on rpi 2 : download a build from  https://people.mozilla.org/~fdesre/foxbox/
2. extract it
3. run ./foxbox

While trying to get things working, I ended up talking to NoJun and we ended up finding that you can change the color of the light using foxbox and some of the troubleshooting tips I have are documented in the Tips and tricks I created for the Connected Devices :


So authentication and all that stuff is a pain, I took the time to make some Hue_Scripts to interact with the Raspberry Pi 2, I have setup: https://github.com/nhirata/hue_scripts  [again, was trying to get stuff up and running.  I can refactor a lot… ]

I could have 64 bit encrypted in the script, but this time I didn’t feel like having plain text in a config.ini.   The code inside has it commented out, if you want to store your username and password as plain text in the config file.

You would need to run the login.py and I don’t have a mechanism to refresh the token as of yet so it requires you to run login.py when the token expires beofre you run any other script.

I think the README explains most of the scripts.  Here are some examples:


So if you fit the pieces together, you could potentially use the cronjob to poll from the fitbit, gather health data that is crowdsource, and also interact with devices real time (ie pulsing light to your heartrate or have the light turned on when you wake or changed color based on your heartrate.  Later on I was going to mess with having hot water using the wemo when I wake up.  That way I can have coffee (I french press my coffee) and oatmeal in the morning.  I haven’t gotten to that point yet.  This was a prototype, and the filtering of the data might still be useful both in the backend and the front end.  I think though, it might be a little too early for it’s time?  I’m not sure if people see what I see yet.

I’m shifting gears and I’m going to be concentrating my time on Vaani and on my spare time WebVR.  In case anyone wants to tinker with the stuff I was doing, I just wanted to put it out there.

Posted in Uncategorized | Leave a comment


  1. to start trying to lower bars and improve usability (in tools/processes) for contributors.
  2. to start coding more.

Those are my new year resolutions.  Let’s see what happens next year!



Posted in Uncategorized | Leave a comment

Exploratory testing, UA, State Diagrams, etc.

I’ve utilized a semi State Diagram based on UI to help explain exploratory testing.

I found out that User Experience staff utilizes a UA : User interface Architecture to show all the UI and flows.

Anyways, you can see the concept here :


The positive test cases are outlined, and from there the negative test cases can be tested and if you want to document exploratory testing, you can branch out from the diamonds.

Posted in Uncategorized | Leave a comment

The difference between amateur and pro…

The amount of energy expended on doing a something within the realms of the task…

ie. A black belt isn’t going to exert more energy to block or dodge than an amateur is in any martial arts.

That energy is reserved for other purposes.

This can be applied to any profession.  The only way to get to become pro at something is exposure, experience and practice.  The “fake it til you make it” Ted Talk ( http://www.ted.com/talks/amy_cuddy_your_body_language_shapes_who_you_are )  is basically encouraging those that self doubt themselves and those that try hard.

She talks about body posture; there’s an underlying message that people who are very critical of themselves will end up self doubting their own abilities.

First day you’re going to suck, but at the same time the more you get exposed, the experience you take in and practice as long as you are continually learning, you will become a professional. Becoming a professional does not come over night.

Posted in Uncategorized | Leave a comment

Japanese Proverb.


Posted in Uncategorized | Leave a comment

Blob free now on task cluster

Bug 1175934 [B2G] Add support to build blobfree images

has landed and is now available on task cluster :


What is Blob free?  see https://developer.mozilla.org/en-US/Firefox_OS/Building#Building_a_blob_free_full_system_zip

That’s right.  if you follow Bug 1166276 (b2g-addon) [meta] Getting a B2G Installer Addon, you will see that there’s an addon to the desktop firefox version that will allow you to flash your device, and these blobfree images are to be available to the public.

\o/ Dev team!

Posted in B2G, Gaia, mobile, Planet, QA, QMO | Tagged , , , , , | 1 Comment

Modifying multiple bugs in a search query in bugzilla:

[2:51pm] nhirata_: swilkes: you mentioned you can do bulk edits to bugzilla bugs?  how do you do that?
[2:51pm] nhirata_: ( I would like to edit the priority field to a bunch of bugs I created 0
[2:51pm] nhirata_: )
[2:52pm] swilkes: let me take a look
[2:52pm] swilkes: doliver showed me how but I haven’t done it in a while
[2:52pm] swilkes: one sec
[2:53pm] nhirata_: ok thanks
[2:53pm] swilkes: ah nhirata_
[2:54pm] swilkes: so – get a bug list together somehow – search, etc. at the bottom you should see (just to the rightof the Long Format and XML buttons)
[2:54pm] drs: yeah
[2:54pm] swilkes: a “Change many bugs at once”
[2:54pm] swilkes: sorry, several bugs at once
[2:55pm] nhirata_: ah sweet.
[2:55pm] nhirata_: thanks
[2:55pm] swilkes: and then you’ll enter a checkbox UI
[2:55pm] swilkes: check them and then allllll the fields you could want are at the bottom
[2:59pm] nhirata_: awesome!  thanks swilkes!
[2:59pm] swilkes: happy to
[2:59pm] nhirata_: same query worked since I was looking for non P1/P2
[2:59pm] swilkes: it’s a lifesaver
[2:59pm] nhirata_: saved a lot of time
[2:59pm] swilkes: truly

Posted in Uncategorized | Leave a comment

Possible script to standup an linux box with b2g… still need to work out some parts:

# Ubuntu 12.04 64 bit OS: B2G installer

# the following will get your machine all updated
sudo apt-get update
sudo apt-get upgrade

# add repos
sudo apt-add-repository ppa:chris-lea/node.js
sudo add-apt-repository ppa:ubuntu-toolchain-r/test

sudo apt-get update
sudo apt-get install python-software-properties

sudo apt-get install libxml2-utils
sudo apt-get install autoconf2.13 bison bzip2 ccache curl flex gawk gcc g++ g++-multilib git ia32-libs lib32ncurses5-dev lib32z1-dev libgl1-mesa-dev libx11-dev make zip

sudo apt-get install openjdk-7-jdk

# [ if that does not work or if you want oracle’s jdk :
# sudo add-apt-repository ppa:webupd8team/java
# sudo apt-get update
# sudo apt-get install oracle-java7-installer
# sudo update-java-alternatives -s java-7-oracle ]

# download studio : http://developer.android.com/sdk/index.html
# run studio.sh
# go to the sdk directory
# run tools/android update sdk –no-ui

# vi ~/.bashrc ( or profile or whatever)
# add : PATH=$PATH:<android sdk location>/tools:<android sdk location>/platform-tools

ccache –max-size 3GB

sudo vi /etc/udev/rules.d/android.rules
# get file from github.com/nhirata/android_rules instead of vi

sudo chmod a+r /etc/udev/rules.d/android.rules
sudo service udev restart

sudo apt-get install mercurial

# option
# backing up a device:
# adb pull /system -backup target dir=/system
# adb pull /data -backup target dir=/data
# adb pull /vendor -backup target dir=/vendor
# adb pull /boot -backup target dir=/boot

git clone git://github.com/mozilla-b2g/B2G.git
cd B2G
BRANCH=master ./config.sh flame-kk

sudo apt-get install gcc-4.7 g++-4.7
sudo rm /usr/bin/gcc
sudo ln -s /usr/bin/gcc-4.7 /usr/bin/gcc
sudo rm /usr/bin/g++
sudo ln -s /usr/bin/g++-4.7 /usr/bin/g++

sudo apt-add-repository ppa:chris-lea/node.js-legacy
sudo apt-get update
sudo apt-get install nodejs-legacy
sudo apt-get install nodejs

# option : changing gecko paths
# vi .userconfig:
# export GECKO_PATH=/path/to/mozilla-central
# export GECKO_OBJDIR=/path/to/mozilla-central/objdir-gonk
# back up device
# ANDROIDFS_DIR=<absolute path to parent dir of system dir> ./config.sh <target>

# copy b2g tree
# rsync -a source/ dest/

# option : adding locales
# Adding locales
# cd gaia/locales/
# hg clone https://hg.mozilla.org/releases/gaia-l10n/v1_2/es
# export LOCALE_BASEDIR=$PWD/locales
# export LOCALES_FILE=$PWD/locales/languages_dev.json
# HOST_CXX := g++-4.6

# Marionette install:
wget –no-check-certificate https://bootstrap.pypa.io/ez_setup.py
sudo python ez_setup.py –insecure

# GECKO_DIR= B2G_Gecko
cd $GECKO_DIR/testing/marionette/client
sudo python setup.py develop
# not sure why you have to run it twice
sudo python setup.py develop
sudo apt-get install python-pip
sudo pip install virtualenv

virtualenv $MARIONETTE_ENV
cd $GECKO_DIR/testing/marionette/client
$MARIONETTE_ENV/bin/python setup.py develop

# verify install:
# $MARIONETTE_ENV/bin/python
#  >>> from marionette import Marionette
# On device run
# adb forward tcp:2828 tcp:2828
# cd $GECKO_DIR/testing/marionette/client/marionette
# python runtests.py –address localhost:2828 –type=b2g tests/unit/unit-tests.ini

Posted in Uncategorized | Leave a comment

From the desk of Mark Surman,

Hi there,

We’re reaching out to you now because three sections of the PATRIOT Act expire soon, which gives us a rare opportunity to push for reforms that will protect our privacy while also keeping us safe.

Congress is going to decide whether to reauthorize sections of the PATRIOT Act used by the National Security Administration (NSA) to collect the phone records of millions of people who have never been suspected of any involvement in terrorism.

At Mozilla, we believe keeping us safe shouldn’t have to cost us our privacy. Individuals’ security and privacy on the Internet are fundamental and must not be treated as optional.

We have a chance to rein in mass surveillance. Sign this important petition asking Congress to stop the bulk collection of private information.  ( https://sendto.mozilla.org/page/m/29b5e0b4/6aa39c3e/15ff8999/5c5c5c95/581847190/VEsE/ )

This is only the beginning. Mozilla is working on multiple fronts to improve user security, privacy, and trust online — things like ensuring strong encryption and better oversight and accountability. The decisions coming up about sections of the PATRIOT Act are a big chance to begin scaling back some of the most egregious invasions of our privacy.

Congress is negotiating whether to reauthorize these mass surveillance programs right now. Please tell your elected officials to stand up for our privacy. ( https://sendto.mozilla.org/page/m/29b5e0b4/6aa39c3e/15ff8999/5c5c5c6f/581847190/VEsF/ )

If we come together now, we can take a major step toward the reforms that we need to protect the free and open Web.

Thanks for speaking out right now, at this critical moment, and for all you do to fight for the open Web.


Mark Surman
Executive Director

P.S. You might wonder why Mozilla cares about bulk collection of phone calls — and what that has to do with protecting the free and open Web. Here’s why: While the provisions in question allow for the bulk collection of telephone records, this same provision also might be used to conduct mass surveillance of Internet data. Because of a lack of transparency, it’s hard to know how broad the net is being cast. Reform of these sections of the PATRIOT Act will help set a major precedent, one we can leverage to rein in overly broad surveillance on the free and open Web, so we have to join together to speak out now ( https://sendto.mozilla.org/page/m/29b5e0b4/6aa39c3e/15ff8999/5c5c5c79/581847190/VEsC/ )

Posted in Uncategorized | Leave a comment

Considering the chipsets of the mobile products are starting to get more and more powerful…

I get the feeling that chipsets in mobile will get to a point where it’s just as powerful as the desktop machines.

What if… we make a computer cluster of mobile devices + desktop devices whether through web or through OS…


If it’s an easy setup…  you could end up having a pretty powerful machine.

Posted in Uncategorized | Leave a comment