Monday, June 29, 2015

OCR links

Today ycombination has a discussion about OCR open sources. Here are some links and product names for future reference.

Tesseract with OpenCV

Torch or Caffe

Finereader engine Abbyy for Linux looks fine


dlib's face detection is the best of the open-source libs, in my experience.
The accuracy of GOCR is very high and it doesn't require any learning.

Tuesday, June 23, 2015

bash: express: command not found

After I installed express using npm install express -g

I tried to run to check the installed version
express -V

But I got
bash: express: command not found
explains starting express v4.0, user needs to install express-generator to get express command line works well.
npm install -g express-generator

upgrade nodejs

There is a very easy way of managing your node version, using the Node binary manager module ‘n’. Another one is 'nvm' node versioning manager.

sudo npm cache clean -f  [this one doesn't work well on my Mac OSX]
sudo npm install -g n [install node binary manager]
sudo n stable [install stable version, or specify version # here like 0.10.28]

With regard to installing node, I prefer to use the homebrew package manager to install node
brew install node

node -v [check node version]
n [to list out all current installed versions, and select node version]


Sunday, June 21, 2015

Javascript code smells

Today I read about javascript code smells from (twitter @elijahmanor), it is really good, so summarize here.

1. Too complex
jshint maxstatements, maxdepth, maxcomplexity

jshint, eslint, jscomplexity, escomplex, jasmine

2. Copy & Paste
jsinspect, JSCPD

3. Use switch statement
Violates open/closed principle (OCP) - open for extension but closed for modification
Use Strategy design pattern

4. Magic strings
Object types, const, symbols

5. This abyss
that, self, me etc
Use alternatives: bind, 2nd parameter of forEach, ES6, functional programming

6. String Concat
Template strings, handlerbar, ES6

7. Inappropriate intimacy (tight coupled)
Dependency injection, or message broker (pub/sub)


Saturday, June 13, 2015

Chrome image onerror caused high CPU

We use lazy loading and onerror to handle image loading. However, the onerror fallback for a huge amount of images in DOM will cause Chrome high CPU. After pinpoint this logic, we suspect it is a Chrome rendering bug because same code works well on Firefox. Our solution is to remove the onerror fallback for list view with a lot of images.

Monday, June 8, 2015

Clean up disk spaces on Mac OSX

Except for clear system caches and temp folders, usually iPhoto Library.photolibrary takes lots of spaces. When you connect your iPhone/iPad to Macbook, it will import movies and photos through iPhoto.

I usually delete "Original Files" after creating album, or backing up to my USB drive. However, there are two folders need to clean up too except ~/Pictures/iPhoto Library.photolibrary/Masters

These two folders are:
~/Pictures/iPhoto Library.photolibrary/Previews
~/Pictures/iPhoto Library.photolibrary/Thumbnails

They are mapping to /Masters folder when import photos. If Master was deleted, we should also delete them. If you use iPhoto to delete, it should delete the Previews/Thumbnails too. But if you open Finder to delete Master files, remember to delete Previews/Thumbnails.