Eric Guo's blog.cloud-mes.com

Hoping writing JS, Ruby & Rails and Go article, but fallback to DevOps note

AutoCAD 2014 Training Notes

Permalink

Just attend company training and below is quick notes/tips coming from trainer.

  • Always using mm as basic unit in drawing, no matteer your are drawing archtecture/mechanical.
  • Workspace setting is to classic, Options->User Preferences for Right-click Customization is set to 1/2/1 (repeat last cmd/shortcut menu/ENTER) mode is recommand.
  • Notice the Trim is only trim and can not delete whole object.
  • Menu undo is based on action, but Ctrl+Z can undo step in an action.
  • Polar Array can product beautiful result if set very high repeat rate.
  • Layer must be use in practical drawing, if output to A4, line weight should be larger than 0.53mm to see a noticable result.
  • Multiline must explode before trim
  • Overkill can be used to clean duplicate line and it's original express tools can be load by MENULOAD and select acetmain.cuix.
  • The Block should draw in layer 0.
  • The Block insert allow add negative value to get a mirror effect.
  • Delete Block should use PURGE command
  • Multi Text Text Height is based on the draw dimenstion
  • Multi Text upper side text and down side text should using stack
  • x/400 x is longest line in demension, 14000/400=40
  • Change line type, show detail to adjust the line Global scale factor if the dash style is too small to display completely.
  • You can turn off InfoCenter by change Windows Registry:
[HKEY_CURRENT_USER\Software\Autodesk\AutoCAD\R19.1\ACAD-D005:409\InfoCenter]
"InfoCenterOn"=dword:00000000

Enable Directory Listing in Nginx

Permalink

Step 1, setting the autoindex on in conf

server {
listen 80;
server_name cvpforms; #replace your DNS name
server_name cvpforms.sandisk.com;
rails_env development; #development/production
root /var/rails_apps/pl-form/public;
passenger_enabled on;
client_max_body_size 5m;
location /rf_image {
autoindex on;
autoindex_exact_size off;
}
}

Step 2, resolve the 403 forbidden error using below command if you meet such error.

chmod 755 * -R # in /home/pl-form/pl-form/public/rf_image

Change Binding Port in Microsoft WebMatrix Site Such as node.js Project

Permalink

Microsoft now is become quit outdated technology after they release so many outdated technology, but WebMatrix is in my opinion, the best tools to right node.js tools in Windows.

But I'm used to using port 3000 as default debug port since I'm switch to Ruby & Rails, so really not want to change port time to time, so here is how to change binding port.

D:\EricDocuments\IISExpress\config\applicationhost.config
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.applicationHost>
<sites>
<site name="firstNode" id="1">
<application path="/" applicationPool="UnmanagedClassicAppPool">
<virtualDirectory path="/" physicalPath="D:\EricDocuments\My Web Sites\firstNode" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:3000:localhost" />
</bindings>
</site>
</sites>
</system.applicationHost>
</configuration>

Just find the your node.js project entry in applicationhost.config and change port.

Frequently Used R Package List and Install Hint

Permalink

Confirm works at Ubuntu 14.04 / 12.04.

  • knitr - A general-purpose package for dynamic report generation in R
  • rmarkdown - Dynamic Documents for R
  • SixSigma - Six Sigma Tools for Quality and Process Improvement
  • sqldf - Perform SQL Selects on R Data Frames
  • tseries - Time series analysis and computational finance
  • quantmod - Quantitative Financial Modeling Framework
  • doBy - Groupwise summary statistics, general linear contrasts, population means (least-squares-means), and other utilities
  • rJava - Low-Level R to Java Interface to support RWeka and xlsx
run before install rJava
R CMD javareconf
  • xlsx - Read, write, format Excel 2007 and Excel 97/2000/XP/2003 files
  • RCurl - General network (HTTP/FTP/...) client interface for R
To install rgdal package
apt-get install libcurl-dev
  • devtools - Tools to make developing R code easier
  • gplots - Various R programming tools for plotting data
  • ggmap - A package for spatial visualization with Google Maps and OpenStreetMap
  • googleVis - Interface between R and the Google Chart Tools
  • rworldmap - Mapping global data, vector and raster.
  • rgdal - Bindings for the Geospatial Data Abstraction Library
To install rgdal package
apt-get install libgdal1-dev
apt-get install libproj-dev # or libproj if not found
  • ROracle - Oracle database interface (DBI) driver for R.

    ROracle need Oracle Client install, and further additional setup procedure

  • pls - Multivariate regression methods Partial Least Squares Regression (PLSR), Principal Component Regression (PCR) and Canonical Powered Partial Least Squares (CPPLS).

  • assertthat - assertthat is an extension to stopifnot() that makes it easy to declare the pre and post conditions that you code should satisfy.

  • dplyr - A fast, consistent tool for working with data frame like objects, both in memory and out of memory.

  • data.table - Fast aggregation of large data (e.g. 100GB in RAM), fast ordered joins, fast add/modify/delete of columns by group using no copies at all, list columns and a fast file reader (fread). Offers a natural and flexible syntax, for faster development.

  • earth - Build regression models using the techniques in Friedman's papers "Fast MARS" and "Multivariate Adaptive Regression Splines".

  • kernlab - Kernel-based machine learning methods for classification, regression, clustering, novelty detection, quantile regression and dimensionality reduction. Among other methods kernlab includes Support Vector Machines, Spectral Clustering, Kernel PCA, Gaussian Processes and a QP solver.

  • caret - Classification and Regression Training, Misc functions for training and plotting classification and regression models.

  • rpart - Recursive Partitioning and Regression Trees

  • party - A Laboratory for Recursive Partytioning

  • RWeka - An R interface to Weka (Version 3.7.12). Weka is a collection of machine learning algorithms for data mining tasks written in Java, containing tools for data pre-processing, classification, regression, clustering, association rules, and visualization.

  • ipred - Improved predictive models by indirect classification and bagging for classification, regression and survival problems as well as resampling based estimators of prediction error.

  • randomForest - Breiman and Cutler's random forests for classification and regression

  • gbm - Generalized Boosted Regression Models

  • Cubist - Regression modeling using rules with added instance-based corrections

  • VGAM - Vector Generalized Linear and Additive Models, An implementation of about 6 major classes of statistical regression models. At the heart of it are the vector generalized linear and additive model (VGLM/VGAM) classes. Currently only fixed-effects models are implemented, i.e., no random-effects models. Many (150+) models and distributions are estimated by maximum likelihood estimation (MLE) or penalized MLE, using Fisher scoring.

  • mda - Mixture and flexible discriminant analysis, multivariate adaptive regression splines (MARS), BRUTO...

  • klaR - Miscellaneous functions for classification and visualization developed at the Fakultaet Statistik, Technische Universitaet Dortmund

  • e1071 - Misc Functions of the Department of Statistics, Probability Theory Group (Formerly: E1071), TU Wien

  • C50 - C5.0 decision trees and rule-based models for pattern recognition.

  • ROCR - Visualizing the Performance of Scoring Classifiers

  • ISLR - Data for An Introduction to Statistical Learning with Applications in R

Notes to Upgrade Ruby 2.0.0-p195 in Windws 7

Permalink

Finally, I go to ruby 2.0, after the first patch p195 release, roughly three month the ruby 2.0 released in its 20 years celebration. I using the rubyinstaller.org version and also it's devkit, the detail installation procedure is very like previous 1.9.3, so won't repeat here now, but I do found some trick which should in fact including in the official document but not, so I would list as below:

  1. Need manually install the sqlite3.

    1. run C:\DevKit\devkitvars.bat
    2. mkdir c:\temp
    3. download http://packages.openknapsack.org/sqlite/sqlite-3.7.15.2-x86-windows.tar.lzma to c:\temp
    4. c:\Temp>bsdtar --lzma -xf sqlite-3.7.15.2-x86-windows.tar.lzma
    5. c:\Temp>gem install sqlite3 --platform=ruby -- --with-opt-dir=C:/Temp
  2. Using below .gemrc and reinstall the gems like yajl-ruby, win32console or bcrypt-ruby if you found the x86-mingw32 version can not work out of box.

edit/create the .gemrc as below content
---
:backtrace: false
:benchmark: false
:bulk_threshold: 1000
:sources:
- https://gems.ruby-china.com
:update_sources: true
:verbose: true
gem: --no-document --platform=ruby
  1. You may want to comment out the "DL is deprecated, please use Fiddle" warning at C:\Ruby200\lib\ruby\2.0.0\dl.rb since it's annoy and you are not the irb/pry or some other gems code owner...

Ruby 2.0 performance is somewhat improved and it's worth to using it right now.

  1. Create Environment Variable SSL_CERT_FILE and point to cacert.pem, example C:\Ruby200\cacert.pem.

Thought After JMP Scripting Language Training

Permalink

I learn quite a lot of R in last 4 months in my spare time by attending a network based class. Today I also got a chance to attend a official SAS JMP software course called "Introduction to the JMP Scription Language" by my employer (only one day), so I would like to record some my thought about R and JMP here.

The most amazing part of JSL script is the funtion Expr, Insert Into and Name Expr, the teacher introduce JSL(JMP Script Language) as object oriented language, but using the three function mentioned before, I think the JSL is primarily a functional language instead, you building a new expression in the beginning of the program, modify the expression in the mid based on the condition or iteration way, then at the end of JSL script, evaluate the whole program as a expression.

So the JSL and R in the language level, share a lot about theoretical language feature/design priciple, although there is also quite a lot syntax detail difference.

On the other hand, the JMP and R design priciple in User Interface part is totally different, JMP is a totall interactive, click-select-OK-repeat windows application while the R is even no GUI windows by default.

So JMP and R is the best gay friend in each other in my option, you start explore and found the suitable math model/chart in JMP, after you confident that you have a more clear/stable solution, you using R as a implement tools to building free solution, so you got the best part of each other: JMP for its excellent UI and interactive workflow; R for its totally free license and be able to export it's program as a web application.

Setup Mirror Between 2 or More Git Server Using Hooks Script

Permalink

First make sure the two server can using ssh to login each other, then add remote mirror to bare git repository.

git remote add --mirror=push cvpgitip01 git@10.11.37.110:repositories/Feng-Wu/demo.git

Add hooks post-commit in bare git repository.

#!/bin/sh
exec git push cvpgitip01 -f --mirror