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.

ocrad.js
Tesseract with OpenCV

Torch or Caffe
https://github.com/nyanp/tiny-cnn

https://ocr.a9t9.com/

Abbyy
Omnipage
Finereader engine Abbyy for Linux looks fine
http://ocrsdk.com/plans-and-pricing/

[0] http://docs.opencv.org/3.0-beta/modules/text/doc/erfilter.ht...
[1] https://github.com/Itseez/opencv_contrib/blob/master/modules...
[2] https://github.com/Itseez/opencv_contrib/blob/master/modules...
[3] http://cmp.felk.cvut.cz/~neumalu1/neumann-cvpr2012.pdf

dlib's face detection is the best of the open-source libs, in my experience.
http://blog.dlib.net/2014/02/dlib-186-released-make-your-own...

https://github.com/creatale/node-fv
The accuracy of GOCR is very high and it doesn't require any learning.
http://manpages.ubuntu.com/manpages/dapper/man1/gocr.1.html
https://github.com/tmbdev/ocropy

https://github.com/openalpr/openalpr

http://sourceforge.net/projects/tirg/
http://libccv.org/doc/doc-swt/
https://github.com/tesseract-ocr/tesseract
https://github.com/BVLC/caffe/tree/dev/examples/mnist
https://github.com/pannous/caffe-ocr
https://wiki.apache.org/tika/TikaOCR

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

http://expressjs.com/guide/migrating-4.html#app-gen
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]

Reference
http://davidwalsh.name/upgrade-nodejs

Sunday, June 21, 2015

Javascript code smells

Today I read about javascript code smells from http://elijahmanor.com/talks/js-smells (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
eslint-plugin-smells
eslint-disable

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

6. String Concat
Template strings, handlerbar, ES6
no-complex-string-concat

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

eslint-plugin-backbone
eslint-plugin-react

http://bit.ly/js-smells

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.