4/11/2015

PM2 tips - uncommon ssh port, cluster_mode and deploy troubleshooting

Note: PM2 own code quality is bad and cluster_mode is not production ready. I would not recommend to use PM2, anywhere. You have been warned.

How to use a different ssh port for PM2

Since pm2-deploy directly forward the host string to ssh, you can simply use:

"host": "HOSTNAME -p PORT"

inside the configuration file.

How to use cluster_mode in PM2

Make your app instances listen on port 8000 and pm2 will load-balance any request on 8080 to your app instances.

Troubleshooting pm2 deploy

pm2-deploy outputs its log into /tmp/pm2-deploy.log so if you don't understand why pm2 deploy is not working, a tail -f /tmp/pm2-deploy.log might help.

4/06/2015

[Book Review] Mastering JavaScript Design Patterns

Mastering JavaScript Design Patterns (MJDP) is another book Packt graciously sent me. This book is divided in two parts. The first part is about Gang Of Four (GoF) classical Design Patterns the other part is about other well know patterns.

TL;DR: Overall the book is good enough and will be perfect for developers with little experience in software development.

However be careful with the following points below:
  • UML diagrams are not descriptive as they should be, "memberName" should not be written multiple times as class attributes
  • The part where the author said that singleton could not be created in JavaScript in a OOP way is plain wrong
  • In the Functional Programming chapter, JavaScript examples could have been written better. Using a for loop instead of map (IE9+) is disappointing (to say the least!)
  • The MV* chapter does not follow the Separation of Concerns principle well enough
    • View initialization and rendering are done inside the constructor (they should not be)
    • Model attributes are too often manipulated inside the controller
    • State information is duplicated (e.g. IsValid in ValidationResult)
    • A dispose (or release) method is missing for clean life-cycle management
    • bind (IE9+) should be used instead of the old _this workaround

3/25/2015

[Book Review] AngularJS UI Development

Once again Packt graciously sent me AngularJS UI Development book for reviewing and I am grateful for that.
But I will be brief. It's one of the worst written "technical" book I've ever read.

  • silly chapter ordering and subject choices
  • chapter subjects are glanced over, chapters feel like unfinished copy/pasted tutorials
  • code samples should have never been approved during the review
    • separation of concerns is not respected most of the time
      • and by most of the time I mean 95% of the time, not 60%
    • there are so much state in these examples, everywhere
  • this book does not even talk about routing and state management
    • ... well, unless you wait until chapter 10 and consider a one-route single page application (SPA) good enough.
    • In a book about UI Development, view state management is essential so in my humble opinion the book should have started with it. 

When we think about AngularJS UI Development, the first library that come to mind is ui-router. Instead we have a chapter 3 about google maps integration, chapter 5 about ng-animate, chapter 6 about charts integration and so on...

Okay, let's stop there and just say that I won't recommend this book to anyone, ever.

If you are new to AngularJS and are looking for a serious book on that matter consider MEAN Web Development, at least this one is well written.

« »
 
 
Made with on a hot august night from an airplane the 19th of March 2017.