Tuesday, November 12, 2013

Create Graphs with Ruby, CSS and HTML

My high schooler had a homework lab assignment that required creating graphs.

She asked if I could help her by creating a nice looking graph to put in her composition lab book.

I thought, why not? ...and why not use some Ruby, CSS and HTML to make it happen?

Here's one of the graphs

CM
RAIN
TEMP
°C
36 36
34 32
32 28
30 24
28 20
26 16
24 12
22 8
20 4
18 0
16 -4
14 -8
12 -12
10 -16
8 -20
6 -24
4 -28
2 -32
0 -36


























Since I prefer to save trees I decided to fit 4 per page (see Final Results below).

Next year, when my soon-to-be high schooler asks me for help with the same lab, I'll refer her to this post :-)

Perhaps, it will help somebody else... The source can easily be modified to create a lot similar kinds of graphs.

Enjoy!

Ruby code for calculating labels

 ary2 = 36.downto(0).select{|n| 0 == n % 2 }  
 ary4 = 36.downto(-36).select{|n| 0 == n % 4 }  
 (0..ary2.size - 1).each {|i| puts "<tr> <td>#{ary2[i]}</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td>#{ary4[i]}</td> </tr>"}  

HTML Source

This is one time that it was just easier to copy and paste...
 <html>  
 <head>  
   <style type="text/css">  
    table,th, td  
    {  
      border: 1px solid black;  
      margin: 0;  
      padding: 0;  
    }  
    table {  
      border-spacing: 0;  
      border-collapse: collapse;  
      border: 0px;  
    }  
    tr {  
      height: 20px;  
    }  
    td {  
      width: 10px;  
      text-align: right;  
      padding-right: 10px;  
    }  
    .first-col {  
      width: 70px;  
      text-align: right;  
      border: 0px;  
      padding-right: 20px;  
    }  
    .last-col {  
      border: 0px;  
    }  
    #header-row td {  
      border: 0px;  
    }  
    #header-row .label {  
      position: relative;  
      left: 4px;  
    }  
    #row1-col1 {  
      float: left;  
      margin-bottom: 40px;  
    }  
    #row1-col2 {  
      float: left;  
      margin-bottom: 40px;  
    }  
    #row2-col1 {  
      float: left  
    }  
    #row2-col2 {  
      float: left  
    }  
   </style>  
 </head>  
 <body>  
   
   
 <div id="row1-col1">  
   <table>  
    <tr id="header-row">  
      <td>CM<br>RAIN</td> <td colspan="12"></td> <td class="label">TEMP<br>&deg;C</td>  
    </tr>  
    <tr> <td class="first-col">36</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td class="last-col">36</td> </tr>  
    <tr> <td class="first-col">34</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td class="last-col">32</td> </tr>  
    <tr> <td class="first-col">32</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td class="last-col">28</td> </tr>  
    <tr> <td class="first-col">30</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td class="last-col">24</td> </tr>  
    <tr> <td class="first-col">28</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td class="last-col">20</td> </tr>  
    <tr> <td class="first-col">26</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td class="last-col">16</td> </tr>  
    <tr> <td class="first-col">24</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td class="last-col">12</td> </tr>  
    <tr> <td class="first-col">22</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td class="last-col">8</td> </tr>  
    <tr> <td class="first-col">20</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td class="last-col">4</td> </tr>  
    <tr> <td class="first-col">18</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td class="last-col">0</td> </tr>  
    <tr> <td class="first-col">16</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td class="last-col">-4</td> </tr>  
    <tr> <td class="first-col">14</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td class="last-col">-8</td> </tr>  
    <tr> <td class="first-col">12</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td class="last-col">-12</td> </tr>  
    <tr> <td class="first-col">10</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td class="last-col">-16</td> </tr>  
    <tr> <td class="first-col">8</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td class="last-col">-20</td> </tr>  
    <tr> <td class="first-col">6</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td class="last-col">-24</td> </tr>  
    <tr> <td class="first-col">4</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td class="last-col">-28</td> </tr>  
    <tr> <td class="first-col">2</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td class="last-col">-32</td> </tr>  
    <tr> <td class="first-col">0</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td class="last-col">-36</td> </tr>  
   </table>  
 </div>  
   
   
 <div id="row1-col2">  
   <table>  
    <tr id="header-row">  
      <td>CM<br>RAIN</td> <td colspan="12"></td> <td class="label">TEMP<br>&deg;C</td>  
    </tr>  
    <tr> <td class="first-col">36</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td class="last-col">36</td> </tr>  
    <tr> <td class="first-col">34</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td class="last-col">32</td> </tr>  
    <tr> <td class="first-col">32</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td class="last-col">28</td> </tr>  
    <tr> <td class="first-col">30</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td class="last-col">24</td> </tr>  
    <tr> <td class="first-col">28</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td class="last-col">20</td> </tr>  
    <tr> <td class="first-col">26</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td class="last-col">16</td> </tr>  
    <tr> <td class="first-col">24</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td class="last-col">12</td> </tr>  
    <tr> <td class="first-col">22</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td class="last-col">8</td> </tr>  
    <tr> <td class="first-col">20</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td class="last-col">4</td> </tr>  
    <tr> <td class="first-col">18</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td class="last-col">0</td> </tr>  
    <tr> <td class="first-col">16</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td class="last-col">-4</td> </tr>  
    <tr> <td class="first-col">14</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td class="last-col">-8</td> </tr>  
    <tr> <td class="first-col">12</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td class="last-col">-12</td> </tr>  
    <tr> <td class="first-col">10</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td class="last-col">-16</td> </tr>  
    <tr> <td class="first-col">8</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td class="last-col">-20</td> </tr>  
    <tr> <td class="first-col">6</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td class="last-col">-24</td> </tr>  
    <tr> <td class="first-col">4</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td class="last-col">-28</td> </tr>  
    <tr> <td class="first-col">2</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td class="last-col">-32</td> </tr>  
    <tr> <td class="first-col">0</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td class="last-col">-36</td> </tr>  
   </table>  
 </div>  
   
 <br>  
 <div id="row2-col1">  
   <table>  
    <tr id="header-row">  
      <td>CM<br>RAIN</td> <td colspan="12"></td> <td class="label">TEMP<br>&deg;C</td>  
    </tr>  
    <tr> <td class="first-col">36</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td class="last-col">36</td> </tr>  
    <tr> <td class="first-col">34</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td class="last-col">32</td> </tr>  
    <tr> <td class="first-col">32</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td class="last-col">28</td> </tr>  
    <tr> <td class="first-col">30</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td class="last-col">24</td> </tr>  
    <tr> <td class="first-col">28</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td class="last-col">20</td> </tr>  
    <tr> <td class="first-col">26</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td class="last-col">16</td> </tr>  
    <tr> <td class="first-col">24</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td class="last-col">12</td> </tr>  
    <tr> <td class="first-col">22</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td class="last-col">8</td> </tr>  
    <tr> <td class="first-col">20</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td class="last-col">4</td> </tr>  
    <tr> <td class="first-col">18</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td class="last-col">0</td> </tr>  
    <tr> <td class="first-col">16</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td class="last-col">-4</td> </tr>  
    <tr> <td class="first-col">14</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td class="last-col">-8</td> </tr>  
    <tr> <td class="first-col">12</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td class="last-col">-12</td> </tr>  
    <tr> <td class="first-col">10</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td class="last-col">-16</td> </tr>  
    <tr> <td class="first-col">8</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td class="last-col">-20</td> </tr>  
    <tr> <td class="first-col">6</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td class="last-col">-24</td> </tr>  
    <tr> <td class="first-col">4</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td class="last-col">-28</td> </tr>  
    <tr> <td class="first-col">2</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td class="last-col">-32</td> </tr>  
    <tr> <td class="first-col">0</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td class="last-col">-36</td> </tr>  
   </table>  
 </div>  
   
   
 <div id="row2-col2">  
   <table>  
    <tr id="header-row">  
      <td>CM<br>RAIN</td> <td colspan="12"></td> <td class="label">TEMP<br>&deg;C</td>  
    </tr>  
    <tr> <td class="first-col">36</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td class="last-col">36</td> </tr>  
    <tr> <td class="first-col">34</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td class="last-col">32</td> </tr>  
    <tr> <td class="first-col">32</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td class="last-col">28</td> </tr>  
    <tr> <td class="first-col">30</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td class="last-col">24</td> </tr>  
    <tr> <td class="first-col">28</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td class="last-col">20</td> </tr>  
    <tr> <td class="first-col">26</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td class="last-col">16</td> </tr>  
    <tr> <td class="first-col">24</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td class="last-col">12</td> </tr>  
    <tr> <td class="first-col">22</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td class="last-col">8</td> </tr>  
    <tr> <td class="first-col">20</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td class="last-col">4</td> </tr>  
    <tr> <td class="first-col">18</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td class="last-col">0</td> </tr>  
    <tr> <td class="first-col">16</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td class="last-col">-4</td> </tr>  
    <tr> <td class="first-col">14</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td class="last-col">-8</td> </tr>  
    <tr> <td class="first-col">12</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td class="last-col">-12</td> </tr>  
    <tr> <td class="first-col">10</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td class="last-col">-16</td> </tr>  
    <tr> <td class="first-col">8</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td class="last-col">-20</td> </tr>  
    <tr> <td class="first-col">6</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td class="last-col">-24</td> </tr>  
    <tr> <td class="first-col">4</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td class="last-col">-28</td> </tr>  
    <tr> <td class="first-col">2</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td class="last-col">-32</td> </tr>  
    <tr> <td class="first-col">0</td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td class="last-col">-36</td> </tr>  
   </table>  
 </div>  
   
   
 </body>  
 </html>  

Final Result

Wednesday, October 23, 2013

IBM Demos Some of My Work on Youtube.com

I just noticed that IBM published a demo of some of the work I did on the IBM Network Protection NextGen IPS - Management Dashboard.

Screen shot of Dashboard



What is this thing?

This is the management dashboard for a Next Generation Intrusion Protection Device.

The NextGen IPS device like a fancy firewall that understands the content in corporate IP traffic which allows corporate management to monitor and control traffic by user (or contrived) groups, application type and more.

Here are some examples of what this device can do (and what you can manage via this dashboard):
  • A manager could allow all employees to view Facebook, but not allow the Finance group to use Facebook Chat application.
  • A manager could view which applications are hogging the corporate bandwidth
  • A manager could see who's trying to send credit card or SSN information across the network

References

http://www.youtube.com/watch?v=NB6Wea3xMGg
http://www-03.ibm.com/software/products/us/en/network-ips/
http://hackmageddon.com/tag/web-application-firewall/
http://lexsheehan.blogspot.com/2013/10/mavericks-osx-109-upgrade.html

Mavericks (OSX 10.9) Upgrade

I just upgraded one of my computers to OSX 10.9.

I'll post issues related to this upgrade that pop up as time permits...

Caution

I'd recommend your making a full backup before upgrading.

Expectations

Expect the installation to
  • take longer than advertised
  • require reinstall of your Java runtime
  • replace SecondBar functionality (if you have multiple monitors)

Install Java Runtime

If you get an error message like, "you need a java se 6 runtime" when opening your mac apps, just install a Java Runtime from: http://support.apple.com/kb/DL1572?viewlocale=en_US


Install Nokogiri

Error when installing nokogiri gem


Installing nokogiri (1.5.4)
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

        /Users/lex/.rbenv/versions/1.9.3-p448/bin/ruby extconf.rb
checking for libxml/parser.h... no
-----
libxml2 is missing.  please visit http://nokogiri.org/tutorials/installing_nokogiri.html for help with installing dependencies.
-----
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
	--with-opt-dir
	--without-opt-dir
	--with-opt-include
	--without-opt-include=${opt-dir}/include
	--with-opt-lib
	--without-opt-lib=${opt-dir}/lib
	--with-make-prog
	--without-make-prog
	--srcdir=.
	--curdir
	--ruby=/Users/lex/.rbenv/versions/1.9.3-p448/bin/ruby
	--with-zlib-dir
	--without-zlib-dir
	--with-zlib-include
	--without-zlib-include=${zlib-dir}/include
	--with-zlib-lib
	--without-zlib-lib=${zlib-dir}/lib
	--with-iconv-dir
	--without-iconv-dir
	--with-iconv-include
	--without-iconv-include=${iconv-dir}/include
	--with-iconv-lib
	--without-iconv-lib=${iconv-dir}/lib
	--with-xml2-dir
	--without-xml2-dir
	--with-xml2-include
	--without-xml2-include=${xml2-dir}/include
	--with-xml2-lib
	--without-xml2-lib=${xml2-dir}/lib
	--with-xslt-dir
	--without-xslt-dir
	--with-xslt-include
	--without-xslt-include=${xslt-dir}/include
	--with-xslt-lib
	--without-xslt-lib=${xslt-dir}/lib
	--with-libxslt-config
	--without-libxslt-config
	--with-pkg-config
	--without-pkg-config
	--with-libxml-2.0-config
	--without-libxml-2.0-config
	--with-libiconv-config
	--without-libiconv-config


Gem files will remain installed in /Users/lex/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/nokogiri-1.5.4 for inspection.
Results logged to /Users/lex/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/nokogiri-1.5.4/ext/nokogiri/gem_make.out

An error occurred while installing nokogiri (1.5.4), and Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.5.4'` succeeds before bundling.
You can try upgrading homebrew ...

$ brew update
$ brew upgrade
...and you may feel good your progress, and try to reinstall nokogiri and it's dependencies...

brew install libxml2 libxslt
brew link libxml2 libxslt
gem install nokogiri
But you'll probably get the following message: Warning: No developer tools installed. You should install the Command Line Tools. Run `xcode-select --install` to install them. But you'll probably still have probably still get the following error:

clang: error: invalid arch name '-arch -D_REENTRANT=1'
error: command 'clang' failed with exit status 1
Finally, when you install nokogiri with xcode dependencies using the following you may profit:

$ gem install nokogiri -- --with-xml2-include=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/libxml2

Update Gemfile

Be sure to reference the proper version of nokogiri in your Gemfile.

gem 'nokogiri', '~> 1.6'


New Features

Here are a few new features to checkout
  • Upgrade existing apps (Calendar, Finder, Mail/gmail archiving, Notifications)
  • New apps (iBooks, Maps, iCloud Keychain)
  • Power Saving Functionality (Timer Coalescing, Compressed Memory, App Nap)
See the full list here: https://developer.apple.com/osx/whats-new/

Activity Monitor

I'm a fan of the new graphics in the new Activity Monitor's Network graphic...


...largely, because Apple uses the same design that I originally implemented in the IBM Network Protection NextGen IPS (NextGen) - Management Dashboard.

It's easy to see spikes in traffic and the load coming across the wire.

IBM NextGen dashboard traffic widget

The current IBM NextGen dashboard traffic widget implementation is more like what Apple used in pre-10.9 Activity Montior Network graphs:


For a short demo of the BM Network Protection NextGen IPS (NextGen) - Management Dashboard see http://www.youtube.com/watch?v=NB6Wea3xMGg

Fine Grained Control of Which Apps Get Accessibility Features

Unlike previous versions of OS X, which used a universal checkbox in an “all or nothing” approach, the new functionality in Mavericks allows users to individually choose which apps can gain control of the system.

If you use an application like CheatSheets or SizeUp, just add the app in the OSX System Preferences > Security & Privacy > Privacy > Accessibility dialog.

Thoughts

I ran into the nokogiri problem mentioned above, which is not bad and was easy to fix.

Given that this is a FREE upgrade and the tendency of Apple to not support legacy systems for long, upgrading is a no brainer.

References

http://lexsheehan.blogspot.com/2013/10/ibm-demos-some-of-my-work-on-youtubecom.html
http://www.tekrevue.com/2013/06/25/how-to-enable-access-for-assistive-devices-in-os-x-mavericks/
http://www.macrumors.com/roundup/os-x/

Thursday, October 17, 2013

Convert Spaces to Tabs in one whack

Working with CoffeeScript is a pleasure.

It is easy to create beautiful CoffeeScript code since blocks are determined by indentation.

However, that can be a two edged sword.

If you mix your SPACES with TABs, which can be easy to do in a team development environment, you are in for a world of hurt.

Fortunately, there are techniques for dealing with this TAB/SPACE issue.

Here are a few things I configure in my IDE for working with CoffeeScript files:
  • Use TAB characters instead of SPACES
  • 3 characters per TAB
  • Show Whitespaces

For non CoffeeScript files

For all other file types (not CoffeeScript) I use SPACES
  • Use SPACES for TABs
  • 3 characters (spaces) per TAB
  • Do not show Whitespaces

The reason for using SPACEs, e.g., for Ruby files, is because when copy/pasting from IDE to console you'll often get errors when using TABs.

Bash script used by find command

When I have a number of files that have spaces in them, here's how a convert the lot of them from SPACES to TABs:

unexpand_cmd


FILENAME=$1
CURRENT_PROCESS_NAME=$$
TMP_FILENAME="/tmp/$(basename $0).$CURRENT_PROCESS_NAME.tmp"
if [ -z $FILENAME ]; then
 echo "Usage:  unexpand_cmd "
 exit 1
fi
unexpand -t 3 $FILENAME > $TMP_FILENAME && cat $TMP_FILENAME > $FILENAME && rm $TMP_FILENAME

Word of caution

This assumes that the source files use units of 3 spaces for indentation.

If your source files use other units, you should replace the "3" with what ever unit your files use.

Set the execute bit


$ chmod +x ./unexpand_cmd

p.s. You'll want to save this file in a directory that's on your path.
p.s.s. Since this modifies your source files, please make a full backup before running this.

Run find command and execute unexpand_cmd on each


$ find app/assets/javascripts -name "*js.coffee" -type f -exec unexpand_cmd {} \;

Notes

When you see "Soft Tabs" in your IDE preferences, that means "Use 3 spaces instead of 1 tab character", assuming you have set your tab to 3 spaces.

Tuesday, October 15, 2013

Install Textmate Bundle for CoffeeScript

Here's all you need to do to get the CoffeeScript bundle installed for TextMate (version 1.5.11)

Example


$ cd /Applications/TextMate.app/Contents/SharedSupport/Bundle
$ git clone git://github.com/jashkenas/coffee-script-tmbundle CoffeeScriptBundle.tmbundle

Tuesday, September 17, 2013

Highlighting Lines of Code in Github

Ever needed to share some code with somebody and point them to the lines of interest?

Here's how to do that if the code is in github:

Summary

Just add
#L[STARTING_LINE_NO]-[ENDING_LINE_NO]
to the end of the original url.

Example


https://github.com/angular/angular.js/blob/master/test/ApiSpecs.js#L6-16

Monday, September 2, 2013

21 CFR Part 11 and the SDLC

In this posting, I will attempt to address the challenges posed by the FDA 21 CFR Part 11, which is a law aimed at ensuring that companies implement good business practices, in their developing software efforts to meet said requirements.

Background Definitions

21 CFR Part 11

Title 21 is the portion of the Code of Federal Regulations (CFR) that governs food and drugs within the United States for the Food and Drug Administration (FDA), the Drug Enforcement Administration (DEA), and the Office of National Drug Control Policy (ONDCP).

21 CFR Part 11 addresses Standard Operating Procedures (SOPs), Medical Device Quality Standards Regulation (QSR), Good Clinical Practices and Good Manufacturing Practices.

SDLC

The systems life cycle (SLC) is a methodology used to describe the process for building information systems.

The Systems development life cycle (SDLC) is a process used by a systems analyst to develop an information system, training, and user (stakeholder) ownership. The SDLC aims to produce a high quality system that meets or exceeds customer expectations, reaches completion within times and cost estimates, works effectively and efficiently in the current and planned Information Technology infrastructure, and is inexpensive to maintain and cost-effective to enhance.

Following a SLDC in order to develop a 21 CFR Part 11 regulated software application is essential because its very intent is to provide a very deliberate, structured and methodical way, reiterating each stage of the life cycle. The SDLC describes the different stages involved in the software development project from the drawing board/planning, implementation, testing, deployment, through the completion of the project.

Project managers benefit from the process, tools and project artifacts generated as a result of following an SDLC. The project life cycle integrates the project management and SDLC cycles with the activities directly associated with system deployment and operation.

The Hurtle

The FDA recommends that application development teams take an integrated approach to their software development lifecycle (SDLC), which combines risk management strategies with principles for software validation.

But developing software for medical devices that complies with the FDA's Quality System regulation is necessary hurtle for companies that want to compete in the medical/FDA-regulated industry.

This hurtle is not near as "complicated" as some make it seem.

It basically means that your software needs to be engineered properly with complete access control and audit capabilities.

Experience Matters

Since I have well over 10 years of enterprise application security software development experience and have worked with some of the most talented software engineers in the world, these requirements seem easy/natural to me.

I enjoyed over 10 years of hard core software application development prior to joining IBM.

In my first project at IBM, I researched and developed security components for SmartCard LifeCycle Management System using IBM's flagship e-business security software, Tivoli Policy Director (TPD), which allows organizations to create secure relationships among customers, partners, suppliers and employees.

I focused on enterprise-security-related software application development projects, such as:
  • Software Engineer I architected and implemented various design patterns for Web Identity (formerly IBM Registration) is the standard service for IBM external applications that register, authenticate, or profile external web-based customers, business partners, suppliers, and other users of ibm.com. WI performs Single Sign On, Global Session Persistence, and User Identity and Profiling and Access Control functions.
  • Security Consultant Implemented IBM.COM Single Sign On (SSO) prototype for IBM’s BT/CIO office and the Tivoli PDT.
  • Security Architect & Lead Developer Designed and implemented Voice over IP (VoIP) security architecture for a fortune 5 telecommunications company. System components (order entry, billing and account management ) were presented to users (customer facing and a customer service rep (CSR)) via web based portal application. Designed corporate messaging infrastructure to manage application entitlements (user creation and role management).
  • Lead Security Application Developer Performed analysis, design and implementation phase of enterprise Authentication and Authorization infrastructure replacement project for fortune 5 financial corporation.
  • SOA Security Architect Produced detailed SOA Security Architecture deliverable for Service Oriented Architecture Methodology (SOMA) engagement focused on contract, pricing and rebate functionality for a distributor of medical products, equipment, billing services and pharmaceuticals.

I later transferred from IBM Global Business Services to the IBM Software group to help develop the administrative UI for the IBM Next Generation Intrusion Protection Appliance.

Software Development Methodologies


Waterfall Methodology

Early in my programming career, I worked for several fortune 500 companies that followed the Waterfall software development methodology:

What always happened on those projects was the business analysts would take in inordinate amount of time to fully define everything about the system, even though none of them had any relevant software development experience, and produced a tome of a design document, which was supposed to serve as a reference for developers' requirements.

At that point, the project was always behind schedule and my team took over.

I would spend a day or two reading through that wordy tome and make my own (useful) design documents.

Next, I would find the subject matter experts (SMEs) to validate my designs and begin a series of design/implement/evaluate sessions, very much like the Agile process, but light on testing. (The need for testing, especially in a team environment that uses a constant integration (CI) server is a topic for another day :-)

The fact was that the project management office would be freaking out as the customer began to tighten the rope of leniency as they began to get concerned that the project was falling behind since they had not "seen" anything.

Process and methodology at that moment was always thrown out the door as the project manager (PM) would scream, "Just get 'er done."



Rational Unified Process

Prior to joining IBM I worked at an internet consulting company iXL where we followed the Rational Unified Process (RUP) of software development.

The purpose of following RUP software engineering methodology is to provide a disciplined approach to assigning tasks and responsibilities within a development organization. Its goal is to ensure the production of high-quality software that meets the needs of its end-users, within a predictable schedule and budget. RUP is “use-case driven, architecture-centric, and incremental and iterative”.

RUP Phases

Here's a high level view of what the RUP phases:

Here's what a typical RUP plan would look like:

Objectives

  • Improve the integrity of the commitments made by SDLC by defining the business process by which decisions are made.
  • Minimize product changes (churn) once the decision is made to initiate a project.
  • Define a common framework for communicating project status in terms of business commitments
  • Enforce appropriate minimum standards on entry and exit criteria for each applicable project lifecycle phase.
  • Define milestones for project process metrics: Cycle Time & Quality


RUP was a big improvement over the Waterfall methodology, but many software development projects would still fall behind schedule, leaving PM's standing in the lurch. Then, along came Agile...

Agile software development

In 2001, the Agile software development methodology became popular, which is based on the Agile Manifesto:
We are uncovering better ways of developing software by doing it and 
helping others do it. Through this work we have come to value:

Individuals and interactions over processes and tools
Working software over comprehensive documentation
Customer collaboration over contract negotiation
Responding to change over following a plan

That is, while there is value in the items on the right, 
we value the items on the left more.
Agile software development is a group of software development methods based on iterative and incremental development, where requirements and solutions evolve through collaboration between self-organizing, cross-functional teams.

Agile provides well-defined planning events and a "time-boxed", iterative approach to development that project managers like.

The trouble with many Agile projects is that the focus is on cranking out stories (aka Use Cases in RUP parlance) and their associated features with less emphasis on code quality.

However, the 21 CFR Part 11 and the FDA, in general, is all about quality...

... and that's a problem.

Some Software requirements for 21 CFR Part 11

  • System validation to make sure performance of the system is accurate and reliable.
  • System should be able to produce accurate/complete record copies that are readable both in human and electronic forms.
  • Record protection to ensure they are accurate and able to be retrieved easily.
  • System access should have strong controls to prevent unauthorized access.
  • Must have time stamped audit trails.
  • Operational system checks must be in place to ensure proper sequencing of steps and events.
  • Authority checks must be in place to make sure that only the authorized personnel can get into the system.
  • Proper controls on system documentation
  • Complete and accurate record retention practices
  • Written policies must be produced that hold everyone accountable for any actions via their electronic signature.

Other Systems Impacted By 21 CFR Part 11 Requirements

  • Employee Training
  • Document Management
  • Change Control

Out of Compliance

If you get audited and found wanting, you will get a 483 (FDA violation) citation.

A 483 is issued when investigators observe any significant objectionable conditions. FDA investigators are trained to ensure that each observation noted on the 483 is clear, specific and significant. The observations are cited when in an investigator’s judgment these conditions or practices observed indicate that an FDA-regulated target is in violation of FDA’s requirements.

Example 483 violations

http://www.fda.gov/Food/RecallsOutbreaksEmergencies/Outbreaks/ucm224855.htm
http://www.fda.gov/AboutFDA/CentersOffices/OfficeofGlobalRegulatoryOperationsandPolicy/ORA/ORAElectronicReadingRoom/ucm061813.htm
http://www.fda.gov/downloads/ICECI/EnforcementActions/WarningLetters/1999/UCM067262.pdf
http://www.fda.gov/ICECI/EnforcementActions/WarningLetters/2005/ucm075385.htm

I think it's safe to say that no business owner would ever want to receive one of those.

Summary

All projects need to be performed and delivered under certain constraints. Traditionally, these constraints have been listed as "scope," "time," and "cost". These are also referred to as the "Project Management Triangle". You cannot change any one constraint without affecting the other two.

These three constraints are often competing constraints: increased scope typically means increased time and increased cost, a tight time constraint could mean increased costs and reduced scope, and a tight budget could mean increased time and reduced scope.


Quality is of utmost importance in projects that intend to meet 21 CFR Part 11 requirements.

Therefore, unless the technical resources that implement the application care a lot about the quality of their code, are seasoned enough to understand what good code means, and are willing to enforce coding standards and stand up to PM's that are always pushing to "get 'er done", the risk of delivering software that complies with FDA regulations will always exceed an acceptable level, regardless of the chosen software development methodology (and some form of agile is the way to go).