Saturday, December 3, 2016

Who to notify when you move

Here's a list of people and companies to notify when you change your address.  Did I miss any?
  • Family and Friends
  • Current Employer
  • The Post office
  • Your bank
  • Your credit card companies
  • Department of Motor Vehicles
  • Magazine subscriptions
  • Newspaper
  • Clubs or organizations
  • Child’s school
  • Child’s doctors 
  • Babysitter
  • Alumni schools
  • Veterinarian 
  • Kennel
  • Auto lease company
  • Auto insurance company
  • Rental or home insurance company
  • Life insurance company
  • Health insurance company
  • Doctors, dentist, optometrist, etc.
  • Cell phone provider
  • House phone/internet provider
  • Utility companies (gas, water, electric)
  • The IRS 

Orecchiette with cime di rapa (broccoli rabe)

Delicious; Orecchiette with cime di rapa (broccoli rabe). I was going to cook it cause the recipe is from where my great grandparents are from (Puglia/Foggia)... but my car battery died while I was getting more stuff... so Patti cooked it while I worked on fixing the car. It was awesome! And so is Patti!

Orecchiette with cime di rapa (broccoli rabe)


 And here is the recipe:

  • 1 Pound Dried Orecchiette
  • 1 Bunch Trimmed/Chopped Broccoli Rabe 
  • 3 Sliced Garlic Gloves
  • 1/3 cup extra-virgin olive oil
  • 1/2 cup grated Pecorino Romano
  • 4 Slices Baton-chopped Pancetta  
  • 1 teaspoon Red Pepper Flakes  
  • Sea Salt & Pepper  
  • Parsley (optional)

1a. Bring salted water to a boil and add the orecchiette and broccoli rabe.  Remove from heat and drain after orecchiette is properly cooked.

1b. Heat the olive oil in a pan and add the garlic, pancetta and pepper flakes, salt and pepper.

2. Combine the orecchiette and broccoli rabe into the pan ingredients and mix around.

3. Add grated pecorino romano and optionally parsley.

4.  Serve and enjoy



Orecchiette with cime di rapa (broccoli rabe)- half eaten

Tuesday, November 29, 2016

D3 Introductions on YouTube

Here is a YouTube representation of the D3 basic tutorial as well as a video of the Three Little Circles tutorial (by Mike Bostock).


D3 Introduction

 



Three Little Circles by Mike Bostock




D3 Demonstration



Monday, November 28, 2016

Undefeated boxers face off; Garcia vs Thurman

Garcia vs Thurman!

On March 4th, 2017, two undefeated boxers will face off:

Both boxers started there careers in 2007 and have both of them have never lost a match.

Here is a quick-look of there match-up, followed by snapshots of their individual accomplishments.


Danny Garcia Category Keith Thurman
5′ 8½″ Height 5′ 7½″
68½″ Reach 69″
58% KOs 79%
33 Bouts 28
206 Rounds 124
Orthodox Stance Orthodox


Danny Garcia Snapshot

Danny Garcia has won most of his fights by TKO and unanimous decisions.




Keith Thurman Snapshot

Keith Thurman has won most of this fights by knockouts (TKO and KOs).



So who do you think will win and why? Add your comments below.

Saturday, November 26, 2016

Rolling a Dice with JShell - JDK9

Oh JShell, where have you been!  Introduced, in JDK9, JShell is a wonderful tool to test things out quickly.

In this short blog post, I demonstrate how to roll a dice in a few steps using JShell.  First a quick video showing the steps, and then the key steps slightly detailed.


Step 1: Start JShell

  • From C:\Program Files\Java\jdk1.8.0_111\bin\jshell.exe
  • From NetBeans (Tools -> Open Java Platform Shell)

Step 2: Load pre-existing source (e.g., randomNumberGenerator.jsh)

jshell> /open /code/randomNumberGenerator.jsh

// Generate random integer between Min and Max Value
Integer generateRandomInteger(int minValue, int maxValue) {
  Random aRandom = new Random();
  if (minValue > maxValue) {
    throw new IllegalArgumentException("The minimum value cannot exceed the maximum value.");
  }
  long range = (long) maxValue - (long) minValue + 1;
  long fraction = (long) (range * aRandom.nextDouble());
  int randomNumber = (int) (fraction + minValue);
  return randomNumber;
}


Step 3: Define a method with JShell:

jshell> void rollDice () {printf("Your dice value: " + generateRandomInteger(1,6));}



Step 3 Load pre-existing source (e.g., randomNumberGenerator.jsh)

Roll your dice with JShell:

jshell> rollDice()
Your dice value: 6 <- example output

jshell example
 


Friday, November 25, 2016

Reading in Data with D3 - CSV, JSON, TSV and Custom

The following code, creates the same pie chart from four different file types; JSON, TSV, CSV and custom.


Source Code

<!DOCTYPE html>
<head>
    <title>Parsing files with D3 | Gliesians</title>
    <script src="http://d3js.org/d3.v3.min.js"></script>
    <script src="http://dimplejs.org/dist/dimple.v2.1.6.min.js"></script>
</head>
<body>
    <h2>JSON Parse</h2>
    <div id="json-read"></div>
    <script type="text/javascript">
        var svg1 = dimple.newSvg("#json-read", 800, 600);
        d3.json("/data/mdlp-k23b-a819872.json", function (data) {
            var myChart1 = new dimple.chart(svg1, data);
            myChart1.setBounds(20, 20, 460, 360);
            myChart1.addMeasureAxis("p", "Percent");
            myChart1.addSeries("Population", dimple.plot.pie);
            myChart1.addLegend(500, 20, 90, 300, "left");
            myChart1.draw();
        });
    </script> 

    <h2>TSV Parse</h2>

    <div id="tsv-read"></div>
    <script type="text/javascript">
        var svg2 = dimple.newSvg("#tsv-read", 800, 600);
        d3.tsv("/data/mdlp-k23b-a819872.tsv", function (data) {
            var myChart2 = new dimple.chart(svg2, data);
            myChart2.setBounds(20, 20, 460, 360);
            myChart2.addMeasureAxis("p", "Percent");
            myChart2.addSeries("Population", dimple.plot.pie);
            myChart2.addLegend(500, 20, 90, 300, "left");
            myChart2.draw();
        });
    </script>

    <h2>CSV Parse</h2>

    <div id="csv-read"></div>
    <script type="text/javascript">
        var svg3 = dimple.newSvg("#csv-read", 800, 600);
        d3.csv("/data/mdlp-k23b-a819872.csv", function (data) {
            var myChart3 = new dimple.chart(svg3, data);
            myChart3.setBounds(20, 20, 460, 360);
            myChart3.addMeasureAxis("p", "Percent");
            myChart3.addSeries("Population", dimple.plot.pie);
            myChart3.addLegend(500, 20, 90, 300, "left");
            myChart3.draw();
        });
    </script>

    <h2>Custom Delimeter Parse</h2>

    <div id="pipe-read"></div>
    <script type="text/javascript">
        var svg4 = dimple.newSvg("#pipe-read", 800, 600);
        var psv = d3.dsv("|", "text/plain");
        psv("/data/mdlp-k23b-a819872.txt", function (data) {
            var myChart4 = new dimple.chart(svg4, data);
            myChart4.setBounds(20, 20, 460, 360);
            myChart4.addMeasureAxis("p", "Percent");
            myChart4.addSeries("Population", dimple.plot.pie);
            myChart4.addLegend(500, 20, 90, 300, "left");
            myChart4.draw();
        });
    </script>
</body>

Data Files

CSV File (mdlp-k23b-a819872.csv)

Population,Percent
Ancestral_Altaic,1.42
South_Central_Asian,9.59
Caucasian,29.11
European_Early_Farmers,29.72
Near_East,5.76
North_African,4.80
Paleo_Siberian,.23
European_Hunters_Gatherer,18.58

TSV File (mdlp-k23b-a819872.tsv)

Population    Percent
Ancestral_Altaic    1.42
South_Central_Asian    9.59
Caucasian    29.11
European_Early_Farmers    29.72
Near_East    5.76
North_African    4.80
Paleo_Siberian    .23
European_Hunters_Gatherer    18.58

TXT File (mdlp-k23b-a819872.txt)

Population|Percent
Ancestral_Altaic|1.42
South_Central_Asian|9.59
Caucasian|29.11
European_Early_Farmers|29.72
Near_East|5.76
North_African|4.80
Paleo_Siberian|.23
European_Hunters_Gatherer|18.58

JSON File (mdlp-k23b-a819872.json)

[
    {
        "Population": "Ancestral_Altaic",
        "Percent": "1.42"
    },
    {
        "Population": "South_Central_Asian",
        "Percent": "9.59"
    },
    {
        "Population": "Caucasian",
        "Percent": "29.11"
    },
    {
        "Population": "European_Early_Farmers",
        "Percent": "29.72"
    },
    {
        "Population": "Near_East",
        "Percent": "5.76"
    },
    {
        "Population": "North_African",
        "Percent": "4.80"
    },
    {
        "Population": "Paleo_Siberian",
        "Percent": ".23"
    },
    {
        "Population": "European_Hunters_Gatherer",
        "Percent": "18.58"
    }
]

Time Series Graphs - Javascript libraries built on D3

We are going to take a look at a few time series graphs.  These will be from Javascript libraries built on top of D3.

"A time series is a series of data points indexed (or listed or graphed) in time order." -- wikipedia



Many Javascript APIs provide time series support, however only a few specialize in time series components such as Cubism.js, Rickshaw and MetricsGraphics.js.


Time Series
Javascript API
Activity License Maintainer
Cubism.js GitHub Apache License 2.0 Square, Inc.
Rickshaw GitHub Shutterstock Images, LLC Shutterstock, Inc.
MetricsGraphics.jsGitHub Mozilla Public License  Ali AlmossawiHamilton Ulmer
Epoch GitHub The MIT License (MIT) Fastly, Inc.
Plotly GitHub The MIT License (MIT) Plotly
Ember ... Apache License 2.0 Addepar
xCharts GitHub Apache License 2.0 tenXer, Inc.
D4 GitHub The MIT License (MIT) Mark Daggett


Here is a MetricsGraphics example of a time series chart, along with the associated source





 <!DOCTYPE html>
<head>
    <title>Metric Graphics Time Series | Gliesians</title>
</head>
<body>
    <div id="floyd"></div>
    <script src="https://d3js.org/d3.v4.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/metrics-graphics/2.10.1/metricsgraphics.min.js"></script>
    <link  href="https://cdnjs.cloudflare.com/ajax/libs/metrics-graphics/2.10.1/metricsgraphics.min.css" rel="stylesheet" type="text/css">

    <script type="text/javascript">
        d3.json('/data/floyds-wins.json', function (data) {
            MG.data_graphic({
                title: "Floyd Mayweather Wins Per Year",
                description: "Floyd Mayweather Professional Wins",
                data: data,
                width: 650,
                height: 150,
                target: '#floyd',
                x_accessor: 'year',
                y_accessor: 'wins',
                markers: [{'year': 1998, 'label': '"WBC World Title'}]
            });
        });
    </script>
</body>


The associated JSON is here.