Be the Change

Donald Trump will be the next president of the United States.

There will be a lot of negativity in the coming days. A lot of finger pointing, name calling, blaming and possibly violence. Please don’t participate in the negativity.

When people succeed they tend to party but when they fail they tend to ponder. –Tony Robbins

This is an opportunity to listen to each other. A large part of our country spoke last night. They are tired of being ignored, they are in pain. They want what all of us want. To be loved and to provide for themselves and their families.

They feel that Donald Trump is the best chance they have to change a system that they feel is hurting them. A system that is hurting their families and communities.

As a nation, we now have the opportunity to listen to each other. To understand each other and do the best we can to move forward and make this country great for all of us.

If you’re like me and are scared about what this election means for our families and communities. If you’re scared of what it means for people of color, for women, for LGBTQ people, for Muslims and Jews. Take comfort in all the good in the world.

I think that many Trump supporters are kind, caring, thoughtful people. They are not the racist, misogynistic monsters portrayed by the news.

Don’t ask why is this happening to us. But what opportunities does this present for us all to be the change we want in the world?

When I was a boy and I would see scary things in the news, my mother would say to me, “Look for the helpers. You will always find people who are helping.” –Fred Rogers

Do not shut out your friends, family or neighbors who voted differently than you yesterday. Listen. Don’t lecture or try to convince. Just listen. We are more common than different.

Read Full Story

I’ve been noticing a weird trend across news sites recently. I start reading an article and after a paragraph or two the text fades away and I have a button asking me to “Read Full Story” or something like that. I click it and the button disappears and is replaced by the rest of the story. Here are some examples from Time, TechCrunch and The New York Times.

Why are sites doing this?

At first my thought was that it was for analytics, like a person who clicks that link is more engaged than someone just skimming headlines, there are less intrusive ways of doing this, for instance they can just record how far they scrolled down the page.

But then I thought, maybe it was for performance reasons? I do most of my news reading on my phone, and people are concerned with mobile performance. I fired up my laptop and navigated to the same articles. No buttons!

This seems really silly. I prefer the way the BBC does it. All the text content is there, but until I scroll to a part of the page, the images are just placeholders, replaced as I get to them.

I hope this trend stops soon, it’s really irritating to have to click through every time I want to read an article.

Jumping in with PHP 7

After reading Why we are requiring PHP 7 for our new packages I decided to make Stupid Simple Invoices (a side project) require PHP 7.

It’s a fairly small project right now and it took me a total of about 30 minutes to make sure everything was ready to go. I updated composer to require php >= 7.0.0 and I added declare(strict_types = 1); to all my files and added scalar type definitions and return type definitions.

I only had to make one little change, but it wasn’t that big of a deal. I had a method that would return an array or null and now instead of null it returns an empty array.

This logic will most likely be refactored away in a later version, but it’s perfectly acceptable right now.

It’s my goal to transition the two applications I work on at Pinpoint to be running on PHP 7 if possible for the speed improvements, but since they are much larger it will take some time to add type declarations to the codebase.

All of my side projects moving forward will be PHP 7 unless there is a really good reason for it not to be.

Getting started with Radar

I recently needed a quick tool to track and generate invoices for my small random freelance jobs. I thought this would be a good project to try out Radar, a PSR-7 compliant Action-Domain-Responder (ADR) system created by Paul M. Jones.

I like Radar and I’d like to document some of the things that I noticed while I built my app. This is not meant to be a replacement of the official docs which you should read first if you want to build an application using Radar. If you’d like to follow along, my project is Stupid Simple Invoices.

Great for Domain Driven Design (DDD)

In the documentation Paul leads with:

Radar concentrates exclusively the HTTP request/response cycle. This means that, for Radar to be useful, you need to build your Domain outside of, and probably in parallel with, your Radar wrapper around that Domain.

The best illustration of this was in Robert Martin’s talk Architecture the Lost Years in which he works his way through a UML diagram I recreated here for you.

Your application’s domain code should be framework agnostic and not depend on any logic related to the delivery mechanism or specific implementations (like databases).

Radar is the perfect tool for this style of design. If you look in my project you’ll see I split the code into two main folders under src folder. Application is for the Radar specific “delivery mechanism” code and Domain is for the meat and potato logic for my app.

Looking at my UML diagram there is no real Controller. It’s functionality is built into Radar. However, we have an Input class (I’m using the default RadarAdrInput) which is tasked with taking the PSR-7 Request and creating a domain specific Request model. In the case of the default Input class it just returns an array of the various available values merged together (More information).

The Interactor is what Radar calls the Action. It takes the Domain specific Request Model and returns a Domain specific Response Model. A good way to check yourself to make sure you’re doing it right is to ask “Would the request and response make sense if this app logic was being delivered via HTTP, CLI, Api, etc”. This is why we’re not passing in the PSR-7 Request, that’s specific only to an HTTP delivery mechanism.

In the default Radar example, Paul uses AuraPayloadPayload as the Response Model. I chose to not do so, because I felt it was making my domain depend on a third party class outside of my domain. If you like the Payload class (it’s actually very nice) and wanted to use it, I’d personally prefer copying it into my domain and moving forward using my fork of it. For simplicity and symmetry with the Input class, I chose to use an array as the Response Model.

The Responder in Radar corresponds to the Presenter in my diagram. The default Responder is RadarAdrResponderResponder which expects AuraPayloadPayload and outputs JSON. It’s ideal for a REST API. My app isn’t a REST API and I’m not returning a Payload object, so I needed to replace it.

Getting used to Aura.Di

Since Paul is also the brains behind Aura a collection of high quality components, it should be of no surprise that Radar uses Aura under the hood.

The two main components used are Aura.Router and Aura.Di.

My experience is with Symfony and Silex and the Aura.Router implementation made perfect sense to me and caused no friction.

Aura.Di (a dependency injection container) on the other hand kind of confused me before it clicked.

Here’s how I’d explain it:

With Pimple (the DI container with Silex) or Symfony DI pretty much everything is a service. With Pimple you’d do:

In Aura.Di not everything has to be a service which is the root of what confused me.

The previous example in Aura.Di could be:

In this example SessionStorage is never defined as a service, you’ve just configured it so if someone calls $di->lazyNew('SessionStorage') it will create a new one. If someone wants the service session they would do $di->get('session') which would continue to return the same Session object.

So you need to get the hang of Aura.Di in order to use Radar because this is where you’ll configure how to wire up your application.

My new Responder class

As I mentioned before, since I wasn’t using AuraPayloadPayload and I wasn’t responding with JSON I needed to create my own Responder class.

Looking at the default RadarAdrResponderResponder is a good place to start, but I kept mine very simple.

My InvoiceApplicationResponder class takes a Twig_Environment as a dependency. This introduced an interesting puzzle for my development. If I was using a common Responder for multiple actions, how would I select which template to load? I didn’t want the action to know anything about how it’s response was going to be delivered so it couldn’t go in there. It had to be defined outside of the domain.

My solution was to pass it in as a default value through the router. It’s technically passed into the action, but the actions aren’t using it in any way. My responder however, knows to fetch the _view attribute from the request and uses that value to render the page.

Conclusion

I’m really happy with how well Radar worked. I like how it enforces the pattern of the Domain Interactor from Robert Martin’s talk. It was too easy with Silex to skirt around creating interactors for things.

App Loader

UPDATE 2015-12-17: Dave has moved on to Electron so I’ve discontinued this project.

Yesterday Dave Winer requested on his website Let’s make nw.js easy to start up and he asked for a simple app that he could use to bootstrap nw.js apps.

Here is my attempt at a solution:

If you’re using a Mac the easiest will be the OSX Bundled App

If you’re using Linux or Windows you’ll want the NW.js package and follow instructions on How to run apps.

If you’re a NW.js hacker and want to see what I’m actually doing you can view the source.

Uncertainty about death

I feel like I dodged a bullet today.

Back in May, I found out that my application for life insurance, both personally and for “Key Man” life insurance at work, were denied. I wasn’t completely shocked since two years ago I had heart surgery to repair a prolapsed mitral valve. They said that if I got another echocardiogram they would reopen my application and see if they could cover me.

I knew that two years ago I got a clean bill of health so having another echo could do nothing but confirm that I’m doing great. It didn’t quite work out that way.

I had another echocardiogram done end of May but I wouldn’t be able to get in to see the cardiologist until today (July 7th). I had not heard anything from any doctors regarding my echo, which in this case I assumed no news was good news. Surely if something was wrong I’d get a phone call.

Two weeks ago I get an e-mail from one of the insurance companies. I was still denied.

The reasoning for the decline was due to a combination of the mitral valve repair and an abnormal follow up echo showing atrial septal aneurysm, ejection fraction of 40% and an abnormal EKG showing t wave changes.

What the hell is an “atrial septal aneurysm”? What is a normal ejection fraction? Shouldn’t it be 100%? Am I going to die?

I send my primary care provider an e-mail asking “What’s going on with my echo?”

It looks like your heart function has been stable since your previous echocardiogram of almost 2 years ago.

Ok, but he still didn’t address the aneurysm or why my ejection fraction is so low.

Today I saw my cardiologist. Apparently an atrial septal aneurysm isn’t a big deal. It just means that the wall in my heart is slightly bowed. Almost no chance for rupture because the pressure is the same on both sides.

Ejection fraction is what percentage of the blood in my heard gets pushed out when my heart contracts. Normal is 55% and my latest was actually 45% (up from 40% right after surgery).

He was slightly concerned that my ejection fraction wasn’t higher but it wasn’t life threatening and I shouldn’t even feel any different between 45% and 55%. In order to increase it I’m going to start taking some ACE inhibitors although I’m not sure what they do. All I know is that it will also lower my blood pressure (which isn’t high) and it should help my heart recover.

I feel like there is a lot that could have been handled differently here but I’m not exactly sure how.

  1. I should not have learned about my echo results from underwriting, I should have heard from a doctor.
  2. There shouldn’t have been 6 weeks between my echo and my cardiology appointment.
  3. If there was no way for me to have been seen sooner, I should have gotten a call or e-mail with my results right away.

Because of the way this was handled I’ve just had two of the most stressful weeks of my life. I was full of anxiety and having difficulty concentrating at work. I broke down in tears at the dinner table with my family. I had to explain to my wife, parents and boss that there could still be something wrong with my heart and I don’t know what’s going to happen. I literally spent the last two weeks thinking that at any moment something was going to pop in my chest and I was going to drop dead or worse I’d have a stroke.

Two years ago I was a newlywed heading in for heart surgery. I had come to terms with dying and was able to go through my operation with levity. Now I have a 10 month old daughter. My wife is a stay at home mom and we have a mortgage. It’s not like before where if I died my wife could be sad and then move on easily. There is more at stake now.

I guess I should take away from this that life is fleeting. I try to enjoy each day as much as I can because in a very real way for me I never know if it will be my last.

What is rssCloud?

Jeffrey Kishner asks:

I don’t understand what rssCloud does. Is it related to River?

Back in the RSS 2.0 spec, Dave Winer documented a cloud element which is used to point to an rssCloud server for real time updates about a feed changing.

Typically feed readers poll a feed periodically to see if it’s changed. That means a lot of checking for feeds that might not change a lot. It also means that if you have a feed that changes frequently (like the hacker news firehose) you would have to check it every minute or 30 seconds to keep up with all the changes if you wanted something close to real time.

RssCloud is a notification server. An RSS feed specifies via the cloud element what rssCloud server it’s notifying of changes. Then the aggregator sends a request to the rssCloud server and says “hey, let me know when this river changes” and then doesn’t need to poll anymore (or at least not as frequently). When the website pings the rssCloud server telling it that the feed has changed, the rssCloud server in turn pings everybody that asked for updates. Then they know to go check the feed again.

A similar technology that you may have heard of is PubSubHubbub or PuSH. The big difference is that a PuSH server actually parses the feed and grabs the new items. Then when it notifies the subscribers it sends a “fat ping” or a notification that includes the updated items. Many people prefer this, because then you don’t have a ton of aggregators all grabbing your feed at the same time.

An rssCloud server is far easier to implement because all it does is pass around URLs. It doesn’t care what the content is. I actually think this is a strength that hasn’t been explored very much. We could use rssCloud to notify subscribers of changes to any URL, not just of an RSS/Atom feed.

River4 is a river of news aggregator. Older versions of River did support rssCloud and Dave seems interested in adding support to River4 now that there is a new rssCloud server available.

For more information about rssCloud take a look at Dave’s republished documentation at rsscloud.co.

Rebooting rssCloud

I recently built an rssCloud Server implementation in node.js

It’s open source, MIT licensed and available on GitHub. I have a copy of it running live at rpc.rsscloud.io:5337. I’m hoping to get folks to poke it and help me make it more stable.

Since it’s hard to test an rssCloud server without data flowing through it I also built a Hacker News Firehose Feed which is populated live using the Hacker News API. It’s also open source, MIT licensed and available on GitHub.

Please submit issues on GitHub and I’m open to pull requests.

Will this make me feel better tomorrow?

I came home for lunch today and I feel like crap. I feel stressed and tired most of the time.

I shouldn’t though. Since the end of December I’ve been doing yoga 2-3 times a week. Even though I have an 8-month old daughter I actually sleep pretty well. My job does stress me out pretty regularly, but it’s way better than it was back in August. I have two great developers on my team now that I’m able to have work on things so I don’t have to.

However I don’t eat particularly well. My wife and I are trying to improve, but it’s difficult. I don’t typically plan my meals in advance which puts me in situations where I’m hungry and I need to find something to eat. That usually means I end up going out to eat or eating something quick at home that may not be ideal for being healthy.

So today I had an idea. Before I eat something, I need to ask myself a simple question.

Will this make me feel better tomorrow?

This doesn’t have to only apply to food. Just something in general I should be more aware of. I think too much of my daily habits are less than ideal, and happen because I’m trying to solve a short term problem. How do I make myself feel better now? What can I eat now?

Yes, I do need to start planning my food out more, but hopefully this minor change will help me make better decisions in the short term.