SPRINT: Solve big problems and test new ideas in just five days – Monday [Summary]

512v2bznxq9l-_sx327_bo1204203200_

I recently started to read this amazing book. The book is very easy to read and pratical with lot of case studies and example. I found the methodology of 5-days sprint is really relevant for startup. And I thought about writing up a summary of the book.

So let get start with a why. Why sprint? There’re ton of startups build products that no one use. Lot of money spent, time wasted, and the startup went to an end. So people have thought about the way to build great product. Users gonna love it. And reduce the risk of startup failure.

So yeah, in order to have a sprint to apply to, you gonna need the following things:

IMG_20170520_153341.jpg

 

A sprint in this book is following 5 days of the week. Each day gonna be a journey of its own purpose.

Monday

Monday is super important. The goal of Monday is to find out the long-term goal of the sprint. It like the compass that help the team follow the right direction.

Monday begins with an exercise we call Start at the End: a look ahead – to the end of the sprint week and beyond. You and your team will layout the basics: long-term goal and the difficult questions that must be answered. Starting at the end like beign handed the keys to a time machine. You will know the future of your product. And you will started to question yourself that what would you do in order to get there. So here is the main tasks of Monday:

  • Set a long-term goal:

“Why are we doing this project? Where do we want to be six months, a year, or even five years from now on?”

  • List sprint questions
    • What questions de we want to answer in this sprint?
    • To meet our long-term goal, what has to be true?
    • Imagine we travel into the future and our project failed. What might have caused that?
  • Create a map

Map is customer-centric, with a list of key actors on the left. Each map is a story, with a beginning, a middle, and an end. And, no matter the business, each map is simple. The map composed of nothing more than words, arrows, and few boxes. Here are few example:

IMG_20170520_155622.jpg

IMG_20170520_155728.jpg

At this point, you will have reached an important milestone. You have a rough draft of long-term goal, print question, and map.

By the end of Monday, everyone on the team will have the same information, and everyone will understand the week’s objective. Next, on Tuesday, it’s will be time to come up with solutions.

There will be more.

SPRINT: Solve big problems and test new ideas in just five days – Monday [Summary]

Install Capybara-Webkit on Mac Sierra

If you’re trying to stall capybara-webkit on Mac sierra. And you’re following this guide https://github.com/thoughtbot/capybara-webkit/wiki/Installing-Qt-and-compiling-capybara-webkit#xcode-80 but it doesn’t work for you. Then you can try out the steps below:

  1. Download Qt 5.5.1 from here: https://download.qt.io/archive/qt/5.5/5.5.1/qt-opensource-mac-x64-clang-5.5.1.dmg
  2. Install with the default option
  3. QMAKE=~/Qt5.5.1/5.5/clang_64/bin/qmake gem install capybara-webkit

Good luck!

Install Capybara-Webkit on Mac Sierra

Backup database from corrupted DigitalOcean droplets

So this story happened to me recently. My client got a Odoo server running on DigitalOcean for quite sometime. And suddendly one day everything just stop working. The web app is down. I can not access to the server through ssh. Hard reboot also not work. Then I contacted DO people for support.

I got the feedback from DO’s guys in an instance. He said our droplet has been corrupted. And suggested me to do is to investigate the droplet, check for bad stuff with fsck ; pretty much I did following this article https://www.digitalocean.com/community/tutorials/how-to-recover-from-file-system-corruption-using-fsck-and-a-recovery-iso

After spending nearly 2 days following the above approach I learn some quite interesting stuff. However I realize that the droplet cannot be recorvered. So I was thinking of a simpler solution which is simply get the needed data and move them to a new droplet.

And this can be done with few simple step:

*NOTE*: the database in this case is Postgresql, and no backup has been made before. And I cannot run any pg_restore or pg_dump or any other helpful commands inside corrupted droplet.

  • I need to get the droplet into the recovery mode. This step need the support DO’s guys to enable.
  • Then I need to mount the device, enable network connection, and enable SSH (this is vital step)
  • Now I can ssh into the server, and everything will be under this folder /mnt 
  • Next, I need to locate where is the data directory of postgresql is. This can be done by looking at this file /mnt/etc/postgresql/9.x/main/postgresql.conf
  • When you know the data directory. That’s the place Postgresql store everything. So all I need to do is copy all of those files to a safe place.
  • Now I need to setup a new droplet instance with Odoo available. Then paste all of the file above into the data directory of the new instance.

That’s all. Quite simply isn’t it. You might run into some small problems with the process above, such as:

  • the data directory need to be owned by posgres user instead of root
  • you also might need to shutdown the postgresql service while you do the copy and paste process.

Other than that. Enjoy a new droplet!

Backup database from corrupted DigitalOcean droplets

How to improve code quality of Rails application

When you work in a team, there always will be the case that everyone want to roll out their own style or way of doing thing. And your teams might have junior developers that have very little experience with Ruby on Rails. And your codebase might easily get mess up if you don’t have a tools to help you automat scanning for code styles, code consistency, code complexity, and security. There’re couple of great services which you can integrate to CI, such as: codeclimate.com

However in this post, I gonna show couple of free tools which can solve the problems above.

 1. Rubocop – https://github.com/bbatsov/rubocop

It’s great tool for code styles. Make sure everyone follow the same code conventions, and can be easily integrate to any CI services.

2. Fasterer – https://github.com/DamirSvrtan/fasterer

Ruby being known for not very performance language. But we still can make a performance app if we do it right.

3. Brakeman – https://github.com/presidentbeef/brakeman

Scan for security holes in your project. Great tooll, I highly recommend using brakeman. It might give you some false alert. However in general, it’s very good starting point to find out about security risk.

4. Rubycritic – https://github.com/whitesmith/rubycritic

Rubycritic is a collection of couple of different gems. It got lot of different metrix to help you easily spot the complexity of the codes with super nice report in html.

5. Couple of other reputable gems

How to improve code quality of Rails application

Understand more about full-text search for Rails developer

If you’re a Rails developer, then you might have came across to use `pg_search` gem. It’s allow you to do full-text search in a Rails app very easily. All you need to do is to add the gem to your Gemfile and do the bundle install then include the module into a Rails model that you want to search against.

After all that you tested out the search functionality and all worked very nice then you decided to improve the performance by adding full-text search functionality. For example you have the following code

pg_search_scope :search_by_name, against: :name, using: {
  tsearch: {
    tsvector_column: "tsvector_name_tsearch",
    dictionary: "english",
    prefix: true
  }
}

Now you’re happy with the performance boost. But you’re also realize that the search doesn’t return all result as before. For example: you have an article with the following name `Business landing page` and the search `landi` or `landin` doesn’t return any result at all but `landing` return the correct result. So why is that ?

If you’re notice a little bit, you can see that in the code above we’re using dictionary is english as the way to do the index. It means that when you have the following content `Business landing page` then here is the list of tokens that Postgresql will do the index


"Business landing page" =>
  ["business",
   "businesses",
   "land",
   "lands",
   "landed"
   "landing",
   "page",
   "paged",
   "pages",
   "paging"
  ]

`landi` or `landin` are not the correct English words and they never got indexed so that why they never got return.

More  about dictionaries

  • Simple dictionary: The simple dictionary template operates by converting the input token to lower case and checking it against a file of stop words. If it is found in the file then an empty array is returned, causing the token to be discarded. If not, the lower-cased form of the word is returned as the normalized lexeme.
  • Synonym dictionary: This dictionary template is used to create dictionaries that replace a word with a synonym.
  • Thesaurus dictionary: A thesaurus dictionary is a collection of words that includes information about the relationships of words and phrases
  • Ispell dictionary: The Ispell dictionary template supports morphological dictionaries, which can normalize many different linguistic forms of a word into the same lexeme. For example, an English Ispell dictionary can match all declensions and conjugations of the search term bank, e.g., banking, banked,banks, banks', and bank's.

 

#References

Understand more about full-text search for Rails developer