Prostatitis

prostatitis prostate chronic pelvic pain syndrome cpps Ciprofloxacin Doxycycline bactrim tamsulosin chronicpain family support comic

A little over a month ago I was diagnosed with a prostate infection – better known as Prostatitis. The inflammation has made my life a living hell: Sleepless nights, the constant urge to pee, pain. Fun stuff, right? On top of this the condition takes a while to heal – 1 month, 3 months – on up to a year or more. Oh, and antibiotics don’t seem to help too much either due to the reclusive nature of the prostate gland.

That’s the bad.

Now for the good.

I’ve become a lot closer with my family.  I could not have gotten this far without their help. Thank you.

The condition has also made me reflect on myself as a person. Stress and anxiety are big contributors to Prostatitis. I’ve found myself being more patient with my kids – and myself. I do a lot less yelling and have started to let the “dirty clothes drop where the may”.

So, 1 month, 3 months, a year from now when I am finally better at least I’ll be able to look back and realize that I became a better person because of it.

Take care. Stay healthy. Live life.

– Scott

Next : Physical Therapy

#prostatitis #prostate #chronicpelvicpainsyndrome #cpps #Ciprofloxacin #Doxycycline #bactrim #tamsulosin #chronicpain #family #support #ilovemyfamily #comic #drawnandcoded

Just a little more sugar …

hummingbirds kids on sugar nectar flowers hummingbird feeder birds kids parenting family spring grandparents sugar comic
My dad passed away a year ago. I found it amusing that he loved hummingbirds so much given than he, too, thrived on sugar. Whereas his tiny feathered friends sucked it from his two hummingbird feeders, he got his own fix from cookies, brownies, and other sweets. When my dad passed away I inherited the feeders. I drew this comic in jest of his love for sugar … and hummingbirds. I miss you, dad.

#hummingbirds #kidsonsugar #nectar #flowers #hummingbirdfeeder #birds #kids #parenting #family #spring #grandparents #sugar #webcomic #funny #comic #drawnandcoded

A Stock Portfolio using Angular 6 : Routing

Angular

Routing is a cornerstone of single page applications (SPA’s). In SPA’s, a single page is loaded and the application resides within it. Re-loading the page or navigating to a new page or url is a no-no.Keeping the url static for the lifetime of the SPA is equally bad. Static urls don’t allow the web browser to collect history. Without history the web browser’s back button will just go to whatever site you visited previously – even if you spent 10 minutes judiciously navigating around the SPA. Bookmarks will become meaningless as well.

The Hash

So changing the url is mostly bad. A way around this is using hashes (#) in the URL Path. Hashes were initially used to navigate within a page to different anchor tags ( <a/> ) on the same page. They don’t cause a page refresh and are collected in the web browser’s history. A good example is a page that has a table of contents in the header. Clicking the hyperlinks in the table of contents scrolls down to that particular section on the page which is tagged with anchor. Adding ( or removing ) hashes to the URL does not cause the page to refresh.

This doesn’t cause a page refresh :

http://www.myapplication.com/quote#addnews

…this does :

http://www.myapplication.com/quote/addnews

In general, routing in a SPA leverages URL hashes. Navigating to different parts of the application changes the page’s URL by manipulating hashes.

programming hashtags angular routing software development

Routing in Angular

In Angular, Routing loads a Component given a URL Path. This was my first stab at a Routing Table for the Stock Portfolio Application.

const appRoutes: Routes = [
   { path: 'quote', component: TickerComponent },
   { path: 'quote/:id', component: TickerComponent, children:[
      { path: 'details', component: TickerContainerComponent},
      { path: 'addNews', component: TickerNewsAddComponent},
      { path: 'addSymbol', component: TickerAddComponent},
   ] },
   { path: '', redirectTo: '/quote', pathMatch: 'full'}
];

So, ../quote/msft will load the TickerComponent with ticker info for Microsoft.

And the “Child Route” ../quote/msft/details will load the TickerContainerComponent as a child element of the TickerComponent.

Child Routes

Child routes allow you to display a child component within a parent component based upon the URL. Typically, the Application component template contains a <router-outlet> directive that displays the initial Component. Parent Components follow a similar pattern. They will likewise have a <router-outlet> directive in which their child component gets loaded.

To clarify I should point out that the ultimate routing table that I ended up using for the Stock Portfolio does not use child routes. I just wanted to give a quick overview of them here as well, I almost used them.

The Routing Module

This is what the Routing Module ( minus the Routing Table ) looks like :

import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { APP_BASE_HREF} from '@angular/common';

import { TickerComponent } from './components/ticker/ticker.component';
import { TickerAddComponent } from './components/ticker-add/ticker-add.component';
import { TickerNewsAddComponent } from './components/ticker-news-add/ticker-news-add.component';
import { TickerContainerComponent } from './components/ticker-container/ticker-container.component';

const appRoutes: Routes = [
   /* Routing Table */
];

@NgModule({
   providers: [
      {provide: APP_BASE_HREF, useValue: '/stockapp'}
   ],

   imports: [
      RouterModule.forRoot(
         appRoutes,
         { enableTracing: true } // <-- debugging purposes only
      )
   ],
   exports: [
      RouterModule
   ]
})
export class AppRoutingModule {}

Make sure that you import all of the Components that are loaded by the URL Paths into the Module. The router needs to know about the Components it should load.

What is APP_BASE_HREF?

After migrating routing to a Module I kept getting an error when running my unit tests for the “root” AppComponent:

“Please provide a value for the APP_BASE_HREF token or add a base element to the document.”

Strangely, the error was NOT occuring at runtime. To fix the error I followed these instructions on the Angular website. The router needs to know which “base url” to use when navigating to your routes.

Why a Separate Module?

Best practices dictate that routing should be kept in a separate module from the rest of the application. Another best practices should also be to explain why doing something as such is a best practice. Unfortunately, the official Angular documentation dictates it as such and glosses over the “why”. I’ll take a stab at it :

  1. Seperation of Concerns. Components shouldn’t care what URL invoked them. They should be stand-alone and isolated from such things.
  2. Strategy Pattern. Keeping routing in a seperate module makes it easier to change which URLs launch which Components.

In a hurry?

The finished source code is available on my GitHub repository.

The finished application is up-and-running on Heroku here. Be aware that it is running on a “free” development server so give it a minute or so to spool up.

That’s it for now. Please let me know if you have any questions or comments!

-Scott

Previous : Finding a Financial Web Service


#Angular6 #Angular #CodingChallenge #CORS #FrontEnd #Heroku #Bootstrap #AngularMaterial#Programming #SoftwareDevelopment #SoftwareEngineer #DrawnAndCoded

Free Lunch

free lunch leftovers breakroom coworker freebie work brownbag comic
Qualcomm was notorious for lunchtime meetings and catered meals. While working there as a software engineer I had a co-worker who knew the precise times that each department distributed their leftovers and, miraculously, the restaurant that each department favored. Going “out” for lunch with him was essentially eating “in”.

#freelunch #leftovers #breakroom #coworker #freebie #worklunch#brownbag #drawnandcoded #comic

My 100th Comic

comic deforestation anniversary encouragement inspiration motivation patronizing kids parenting fail i will be an artist
I’ve been told that for every good drawing there are hundreds, if not thousands, of bad ones. I admit that I have killed my fair share of trees and disgraced their remains with some pretty horrible scribbling. However, today I celebrate – here’s my hundredth “keeper”!

#drawnandcoded #comic #deforestation #anniversary #encouragement #inspiration #motivation #patronizingkids #parentingfail #iwillbeanartist