All posts by Peter Fitzgibbons

An ADHD Adventure

I have been on an ADHD adventure nearly my whole life. My first diagnosis was somewhere in my mid-late single digits (5-7ish). Back then it was ADD, and the only possible relief was Ritalin – as far as “we” know anyway.

A lot has changed in the nearly 50 years since then. I have been officially/unofficially diagnosed with ADHD for at least 20 years. Wellbutrin has been the Medical MD “solution”, which I’ve taken on and off. Only this past month, after 20 years, did a life coach ask me if I was on an ADHD med, with the focus of our coaching to handle my ongoing symptoms of lack of focus, trouble with organization/prioritization, and trouble with focus. Life coach says : Anyone on ADHD med should be having a much different experience with these issues.

So, a Psych MD consult and a new ADHD med starting today.

Do I feel different?
Maybe? It’s only been 4 hours. Seriously. I think I do sense better “presence”. I’ll follow up this post in a month or so.

Rails + Webpack + Webpack-Manifest + React + Babel 7 + HMR – [chunkHash]

I’m writing this quick one up so you can save the 1.5 hours that I spent debugging this.

Terms :
HMR – HotModelReload – webpack-dev-server option to trigger browser-auto-refresh when webpack detects filechange (and re-compiles)

Here’s what I’m using :

  • Rails 5.2
  • Webpack-Manifest Gem
  • Yarn
    • Webpack (-cli)
    • Webpack-dev-server
    • @babel/core
    • @babel/preset-react

The issue : When running webpack-dev-server with --hot option (enable HotModelReloading, webpack compile fails with :

ERROR in chunk hello_react [entry]
js/[name]-[contenthash].js
Cannot use [chunkhash] or [contenthash] for chunk in 'js/[name]-[contenthash].js' (use [hash] instead)

Context : With Rails + Webpack-Manifest gem, webpack config is being used from ./config/webpack/environment.js (and it’s named siblings).

This SO discussed the problem and solution
https://stackoverflow.com/questions/50217480/cannot-use-chunkhash-or-contenthash-for-chunk-in-name-chunkhash-js-us
It does not unfortunately tell you very well what to do with

// 4th SO andswer of SO:50217480
output: {
    filename: process.env.production ? `bundle-[chunkHash].js` : `bundle-[hash].js`
}

Luckly, this SO includes a complete webpack.config.js (still not quite where we’re at with webpack-manifest… close.
We’ll notice that output.filename is part of the main config.
I validated this by adding console.log("webpack env", environment) to ./config/webpack/development.js and verifying that, apart from output of virtual-object names, :outputis indeed on the base config object.

SO (THE ANSWER) : edit ./config/webpack/development.js and add : config.output.filename = "js/[name]-[hash].js".

// ./config/webpack/developer.js - at least for my app

process.env.NODE_ENV = process.env.NODE_ENV || 'development'

const environment = require('./environment')

const config = environment.toWebpackConfig();
config.devServer = {
  contentBase: '.',
  host: "localhost",
  port: 3035,
  publicPath: 'http://localhost:3035/',
  historyApiFallback: true,
  proxy: {
    '/packs': { // string to look for proxying requests to api
      target: 'http://localhost:3035', // Path of your rails api server
    },
  },
}
config.output.filename = "js/[name]-[hash].js"

module.exports = config;

Enjoy!

Building an App – EKG

In this series, I’ll build an app in step-by-step posts that will produce an EKG (heart monitor) display.

The inspiration is the Phillips IntelliVue MP50 (found at my local hospital):

Tools we’ll use

Pretty much the whole point of this series… to learn some new tools and techniques:

  • Rail 6 – coming from a Rails 4/5 background, I’ll point out specifically “new to me” details.
  • SvelteJS – both introductory how-to and deep-dive into charting and real-time data streams.
  • Real-time data streams – although our sample data comes in CSV form, we’ll build some benchtesting harness to present this data to our front-end in “real-time”

Assumptions I’ll make

This tutorial makes many assumptions about you, the reader. Hopefully you can find what you need in the EKG – Resources page.

  • You know what Terminal is (or Cmd and PowerShell). You know what $ means in script examples
  • You know Ruby, and maybe Rails (not necessarily version 6)
  • You know some basic database operations, at least enough to understand Sqlite db

Project Details

I’ll be working through the following details over the series:

  • EKG sample data / downloads
  • Streaming real-time data to client (websockets)
  • SvelteJS
  • ChartJS (as a SvelteJS component)
  • ChartJS real-time update
  • Display layout
  • Automated downloads of sample data (web scraping the EKG sample-data site)
  • Creating a desktop app (ElectronJs + SvelteJS)
  • “VCR” controls over display – a design addition leveraging our desktop/mouse/keyboard oriented implementation

Let’s get started!

BlazorWasm template for Visual Studio 2019

As of Dotnet Core 3.1 Preview1 (3.1.0-preview1.19506.1), the blazorwasm template is missing from the default manifest.

If you’re following FreeCodeCamp – How to create a SPA with Razor pages and Blazor then this is a problem for you! As well, the New Project UI has changed and does not follow the VS 2017 flow.

The solution is found here. Use the dotnet CLI to add the blazorwasm template and then to create the demo project.

dotnet new -i Microsoft.AspNetCore.Blazor.Templates::3.1.0-preview1.19508.20

Now dotnet new -l will show blazorwasm as a template option.

dotnet new -l

Templates                 Short Name    Language     Tags
----------------------------------------------------------------------------------------------------------------------------------
Blazor Server App       blazorserver    [C#]         Web/Blazor
Blazor WebAssembly App  blazorwasm      [C#]         Web/Blazor
                                                     /WebAssembly

And now, create the demo Solution :

dotnet new blazorwasm --hosted -o BlazorSPA

This creates the 3-project solution (--hosted) under the new folder blazorwasm (-o blazorwasm).

Update Oct 21, 2019 – Found “Get Started w/ ASP.NET Core Blazor” page, including Dotnet Core 3.1 compatible template.

Write Better Software : Embrace your Humanity

This is a bit of a stream-of-conciousness post about thought processes-vs-time.

As a software developer, I invariably encounter new challenging problems, algebraic, database, mathematical. I spend time working through these problems, and the larger more complex ones take significant time, hours, many-hours, days. The day problems are the frame of reference that is interesting here.

 
How do we solve our problems? How much subconcious thought is involved in brainstorming solutions, testing them against the constraints and requirements of the problem-set, and ultimately encountering a solution that fits?

 
I believe every human, in and out of technology work, encounters a situation to “sleep on it”. In the developer community, I have discussed with many many colleagues about problems and how a colleague solved it while eating breakfast, in the shower, in their dreams, etc. I have solved computing problems in every one of these ways, and I’m sure many more. I recall solving a problem while watching the sunrise once… and computing was not on my mind in the moment.

 
The fact is that every living moment of our life colours the work that we do in technology. These complex computing environments that we are implementing in technology today easily defy our abilities to immediately grasp the full-breadth of the design, the implications of design decisions, and the constraints, requirements, and responsibilities of components of the design at various levels of abstraction. Every time we are introduced to a new application design, it takes time to fully absorb that information and be able to make new hypotheses, suppositions, corrections, enhancements, and improvements upon that design. Our brain, though, is not as compartmentalized as we belive (or sometimes wish!). All those moments “off-hours”, spending time with family or friends, eating a meal, watching TV, reading a book, sleeping, dreaming… change the connections in our vast computational grey-matter. Those changes then directly affect the way we consider and imagine the technological problem-set that is also at hand over the time of days.

 
Our humanity colours everything we do and think about as computer scientists. It is extremely important that we embrace this aspect of our humanity, and embrace our colleauges humanity as well. Take time and give our wet-ware the computational time it takes to gain our insights and understandings of our common problem-sets.

“Sleeping on it” could be the best thing for your career you could do.

It has done wonders for my career!

Heroku ! Fingerprint already exists when key-comment does not match account email

I recently registered on heroku with my work email address : peter@fitzgibbons.info (obsfuscated)
My ssh id_dsa though is signed with my personal email address : peter.fitzgibbons@gmail.com.

Heroku doesn’t like this one bit.
Following this advice, I created id_heroku_rsa wtih my work-email comment.

Still no-joy.  But, this StackOverflow thread left a clue… using the ssh debugging output, I can see that ssh is still trying to send id_rsa or id_dsa.
The answer, included on that post is to ‘ssh-add’ the special key created.

Voila, now my push succeeds.

STOP SOPA

From Wikipedia on STOP SOPA DAY

Imagine a World
Without Free Knowledge

For over a decade, we have spent millions of hours building the largest encyclopedia in human history. Right now, the U.S. Congress is considering legislation that could fatally damage the free and open Internet. For 24 hours, to raise awareness, we are blacking out Wikipedia. Learn more.

BDD/TDD test cycle for beginners

I sent this message to a RailsMentor Protege of mine :

A couple notes on BDD testing :

1. Never test “the glue”. “Glue” means anything that Ruby or Rails should be doing “automatically”. That means, database querying, sending values from controller to view, etc. So, in a view test, you should be able to adequately test your views using the isolated view tests. This is where you could test that your table-building code is working right as you expect. Your controller tests should be able to be tested without database requests (mocking model instances), see #2.

2. Skinny Controllers, Skinny Views. Make your controller code, and your view usage as absolutely minimal as possible.
The ideal controller method looks like :
def show
respond_with @some_record
end

Yes, THAT SMALL. Rails framework provides a HEAP of assistive methods to accomplish that. #before_filter, #after_filter, #respond_to

Views should contain very little Ruby code. #render :partial and generous use of Helpers allows your view code to be very small (and subsequently, very testable). Repeatable elements like table-rows should be in partials, where they are easily testable.

3. Cucumber-level testing : Are you using Cucumber (http://cukes.info)? Cucumber scripts should really be reserved for “business owner specification”. A business owner would not usually be concerned with error handling or the exact placement (or even widget-type) of elements on the forms. The Business owner instead is interested in knowing that Page A => Page B => Page C works… or for instance, “If I buy product “Widget Sharpener”, then my shopping cart counter increases to 1 ”

There is a general BDD/TDD work cycle :

Create cucumber feature
Code supporting Cucumber step
Cucumber-RED : Cucumber execution fails because step causes failure in model/view/controller
Match expected functionality in model/controller/view RSpec
RSpec-RED : Rspec execution fails because functionality is not implemented
Modify model/view/controller with added functionality
RSpec-GREEN : Rspec now succeeds
Cucumber-GREEN : Cucumber now succeeds

You will often find steps 5-7 (Rspec Red/Green cycle) will repeat several times between Cucumber Red/Green cycles. This is our minute-to-minute Ruby-programmer’s work experience.

I’m looking forward to hearing more from you of your experience learning Ruby and Rails.

Brown Shoes Introduction

I will be writing about lessons-learned as I move through
the implementation of Shoes on Jruby.. known as Brown Shoes.

Repo – What’s what where

The Brown Shoes Repo is at : https://github.com/shoes/shoes/tree/brown_shoes – a branch on Shoooes Github project.

Right now there are two parallel implementations within
the brown_shoes branch.

At ./lib/shoes is the Eclipse SWT Library implementation.
This is using the expected event-loop main-display and
native SWT widgets.

At ./lib/brown_shoes is the Java/Swing implementation.
JFrame, JPanel, and a bit of AWT as necessary.

There are some issues found on the Pivotal Tracker for
Brown Shoes https://www.pivotaltracker.com/projects/444909

We need your help!

There are details about running SWT or Swing apps that
completely befuddle the newbie in this Jruby/Shoes
business. (namely.. ME!)

If you are a seasoned Jruby, Java/SWT, Java/Swing… or
maybe just JAVA developer, and have interest and a few
hours to spare, your expertise would be GREATLY
appreciated.

Who’s up for a fun challenge that will help Kids learn
Ruby – Hackety Hack runs on … Shoooes!

How to find what you’re looking for – a Google adventure.

So, I have been searching for a long time to re-discover the correct location of my children’s original orphanage in Carrefour, Haiti, “Heart of God Ministries, Haiti”.

We have repeatedly found the nearby “Auberge du Quebec” Hotel, which is where we stayed on several trips to Haiti to see our future adoptees and “check things out”.

What my wife and I had lost since those stressful times (adoption is almost always a nerve-wracking experience), was a memory of the exact location (and eventually, even the name!) of that orphanage.

So, here are the steps I took to re-discover this point in time and space.

A Viscinity

A map of the “general area” was my starting point.  This was easy at first, “Carrefour, Haiti” gains a direct hit, and immediate link to the “geographic center” on Google Maps.  Unfortunately, the default view is about 5 square miles of land, and I simply could not find the Auberge du Quebec on that space.  I knew it was “near”, though.

So I searched for several variations of “auberge du quebec map”, without successful links.  Then it hit me (early in the morning, after a fitful night), search “auberge du quebec carrefour lat long”.  Bingo.  A forum posting specifying the lat/long of our repeated resting quarters.  This happened to be a posting shortly after the Jan 20, 2011 earthquake.  If only I could figure out how to publicly post that location with a name…

Onward.

A Name

Now I needed a name to find the orphanage.  What was it now?  “Something du something”.  Bah.  I seem to recall the name had something to do with the owner’s name “Heart of God”.  Google Translate to the rescue, pick “Haitian Creole” as the target translation (I am personally amazed that Translate can do Haitian Creole)… and “ke bondye”.  Ahh… yes, starting to come back to me now.

So next I Google “kè bondye, carrefour, haiti”.  First hit : Orphanages recognized by the IBESR.  Bingo again!  Even though this is a pay-for-paper service, reference-looks are free, which is all I needed.  So now I have the “actual” address of “Krèch Kè BondyeHAITI”.

A Place

Now to find it?   Google Maps has painfully unmarked maps for Haiti in general.  So, Google Web again, and again this was a hunting expedition.  I eventually started reading the whole result list for “carrefour, haiti map”.  Last on the first page was a linke for MapQuest.  Oh, my “old’ favorite, circa 1998, until this newfangled web company named “Google” came around with a tightly integrated mapping system that actually seemed to “just know” what I was searching for.

Well, MapQuest has been doing their homework!  Carrefour, Haiti is a completely mapped region, ALL street names marked.  And lo, right next to Auberge du Quebec on the MapQuest streets are the first of several “Mahoutiere”.  A quick visual search revealed the block-corner that once contained our children’s orphanage.

A final destination

Although my wife and I cannot clearly identify “which” building on that grainy sattelite view was the actual orphanage, we know a location.

And thanks to the internet, the endless and thorough implementation of several public-service webistes, we now have a destination that we *could* return to one day, on a trip to Haiti.  Who knows, maybe someone on that block will excuse our poorly worded pidgin-creole, and tell us “Oh YES, Krèch Kè Bondye was *right there*.”

Observations

Being an information research practitioner has been made very easy by the likes of Google and MapQuest.  What has not been automated is the human intuition.  I cannot write in Google Search “The orphanage next to Auberge Quebec in Carrefour, Haiti” and achieve a useful result. (Nor ANY result).  This seems to be most a disconnect and deficiency in internet-intellect.  There are not enough computers (or interested parties) to have “right at hand” the information required to be indexed and presented as results to the english-language request.

As we can tell, the answer required human-language-translation, cartographic indexing (lat/long), several tangential searches, and several protected-document views.

So this may be a problem for information-processing specialists to tackle.  Until then, we need our intuition, and our information researchers to keep doing their jobs, and helping us find the revealing information about the world around us.

Heart of God Ministries (Krèch Kè Bondye-HAITI)
Mahotière 75 #5
Zone Simalo, Carrefour
Port-au-Prince, Haïti