Chrome Extensions

Basics

!!! IMPORTANT !!!
It's just HTML, CSS, and JavaScript

Manifest

Interface Types

Content Scripts

  • Run a custom script on the page
  • Can access DOM elements
  • Cannot interact with JavaScript variables
    • Use "messages" to communicate back and forth

chrome.*

Hadoop

Big Data

  • Volume
  • Variety
  • Velocity

Hadoop storage

  • HDFS
    • Hadoop
    • Distributed
    • File
    • System
  • Designed to store very large files with
    • Streaming data access
    • clusters of commodity hardware
  • Not suitable for small files

Map Reduce

  • Programming model and an associated implementation for processing and generating large data sets with a
    • Parallel
    • Distributed Algorithm on a
    • Cluster (HDFS)
  • Single Reducer (multiple slows down the process with sorting and shuffling)

Map Reduce Example

  • map (InputKey, InputValue) => Set of (IntermediateKey, IntermediateValue)
  • ex) {0, "Twinkle Twinkle Little Star"} =>
    • {"Little", 1}
    • {"Star", 1}
    • {"Twinkle", (1,1)}
  • reduce (IntermediateKeys, IntermediateValues) => Set of (OutputKey, OutputValue)
  • ex)
    • {"Little", 1} => {"Little", 1}
    • {"Star", 1} => {"Star", 1}
    • {"Twinkle", (1,1)} => {"Twinkle", 2}

Resources

MeteorJS

R

What is it and why do I care?

  • R is an open source implementation of S
  • Great for numerical and graphical analysis
  • Is a language and an environment
  • Cross platform support
  • active development and large community
  • FREE!

Great! So now what?

  • Load up data from
    • File-based data
    • Web-based data
    • Databases (using RODBC extension)
    • ...the list goes on
  • Clean, transform, and merge data
  • Visualize it using R's comprehensive set of graphing utilities

How do I get started?

Clean Code

Based on a talk by Matthew Renze

Why write clean code?

  • Programmers spend 30% creating code, 70% maintaining code
  • Programmers spend 90% reading code, 10% writing code

What is clean code?

You know you are working on clean code when each routine you read turns out to be pretty much what you expected. - Ward Cunningham (WikiWikiWeb)

  • Good code is simple, readable, understandable, maintainable and testable.
  • Bad code can be measured by WTFs per minute.

How do you write clean code?

  • Write code for the reader, not for the author or the machine
  • Principle of Least Astonishment

Naming

Domains

Problem domain
public class Customer {};
public void AddAccount();
Solution domain
public class Factory {};
public void AddToJobQueue();
Use names from both domains
public class CustomerFactory {}
public void AddAccountToJobQueue();

Naming

Classes and Methods

Class Names
// Good - noun or noun phrase
public class Customer
// Bad - fuzzy names
public class EntityProcessor
Method Names
// Good - verb or verb phrase
public void AddCustomer()
// Bad - fuzzy names
public void Process()

Naming

Length of variable names

Length increases with scope
// Short range variables
for (int i = 0; i < 10; i++) {}
// Short method variable names
var balance = GetAccountBalance();
// Longer field variable names
private int _totalAccountBalance;
// Longer global variable names
public int totalBalanceInAllBankAccounts;

Naming

Length of method names

Length decreases with scope
// Short public method names
public void GetCustomers();
public void Save();
// Longer private method names
private string ParseHtmlFromFile()
private int GetIdFromAccountHolder()

Naming

Length of class names

Length decreases with scope
// Short public class name
public class Account
// Longer private class name
private class AccountNumberGenerator
// Longer derived class name
public abstract class Account
public class SavingsAccount : Account

Functions

  • Functions should be small -- less than 20 lines
  • Minimize the number of parameters
  • Avoid flag arguments in favor of two separate methods
  • Use smaller named functions, instead of one huge function

Comments

  • Comments represent a failure
  • Old comments are a *lie*
  • Explain yourself in code
  • Kill commented zombie code
  • TODO and summmary Documentation are necessary comments

OWIN w/ ASP vNext

ASP.NET + WebForms

Web API

The Promised Land

Pros

  • Lightweight, fast
  • Minimal dependencies

Cons

  • Process management and low-level APIs
  • Re-invent the wheel
    • Each framework had to build host support

OWIN

Open Web Interface for .NET

OWIN Basics

Environment Dictionary
IDictionary<string, object>
AppDelegate
Func<IDictionary<string, object>, Task>
That's all Folks!™

Step by Step

Step by Step

Step by Step

Step by Step

Step by Step

Step by Step

Internet of Things

What is IOT

  • The internet allows people to communicate with each other.
  • The internet of things is about giving things the ability to sense and communicate to other things.

Examples of existing products

  • Smart phones track our steps, our location, light in the room, among other things.
  • Activity bands track steps, activity and sleep.
  • Nest thermostat recognizes whether you are home or not. Tracks your patterns to save energy.
  • Wifi lightbulbs to dim lights and change color based on phone input.
  • Whistle is an activity monitor for your dog.

Do it yourself products

  • Arduino
  • Netduino
  • Raspberry Pi

Applications

  • Temperature and humidity monitor.
  • Light sensor.
  • Motion sensor.
  • Tweet out information.
  • Digital clock or Stopwatch.

Netduino

Netduino

Example code

public static void Main()
{
    OutputPort led = new OutputPort(Pins.ONBOARD_LED, false);
    while (true)
    {
        led.Write(true);
        Thread.sleep(500);
        led.Write(false);
        Thread.sleep(500);
    }
}