Wednesday, December 16, 2015

Jenkins Integration with Git Server

    Here is my configuration of Jenkins integration with Git Server - in my case Atlassian Bitbucket Server 4.1.3 x64.
  • Install Jenkins ButBucket Plugin in Jenkins
  • Install Bitbucket Server Webhook to Jenkins in Bitbucket via Web GUI, then set parameters of this Repo
    • Go to specific Repo, then go to Settings, then Hooks
    • Enable "Bitbucket Server Webhook to Jenkins"
    • Set Jenkins URL, Repo Clone URL
  • Go to Jenkins
    • Create a Task
    • Set Git Source Code Management
      • Git Repository URL, 
      • Credentials, 
      • Branches (I added two branches - develop, master in my case)
      • Additional Behaviors
        • Additional Behaviors: Check out to a sub-directory: C:\Build\AcRepo
    • Build Triggers:
      • Check option: "Build when a change is pushed to BitBucket"
      • Check option: "Poll SCM": Schedule: H/2 * * * *
        • The schedule follow the syntax of cron. The minimal time I can set is 2 minutes.
  • No once you push code the Repo, Jenkins will pull down the branch you push to, and build the project immediately.
Even though I checked the Poll SCM, with schedule for 2 minutes, the repo will build immediately. If I remote do not check this options, I can not get Jenkins Build.

Wednesday, December 2, 2015

Vim

============= Reference =============

Reference

  1. My vimrc, forked from amix/vimrc

============ Vim commands =============
:help    :helpgrep    ZZ    :q
:help normal-index     :help insert-index
<CTRL-G>

w  b   e  ge    0  ^  $  <CR>
gg G  <N>G  <N>gg  <p>%
%: set matchpairs+=<:>, <<:>>
more complex: matchit.vim

:set backspace=start,indent,eol

control you insertions: CR-Y, CR-E, CR-A, CR-=


Vim plugin manager: Pathogen, vundle, NeoBundle, vim-plug 

Firefox Plugin: VimFx

ReactJS / AngularJS / NodeJs / ExpressJS note-taking

===========================Angular.JS==============================

AngularJS

The Angular Team provides two tools for testing Angular APP (follow this blog: Testing AngularJS Apps Using Karma):
  1. Karma: a test runner for unit testing. Have available karma plugins for:
    1. Mocha:
    2. Chai:
    3. Jasmine:
    4. PhantomJS: a headless version of WebKit.
  2. Protractor: test framework for writing end-to-end (E2E) tests
  3. My TODOS:
    1. TO Learn angularJS via "Pro AngularJS", then read angularJS source code. follow this blog: Testing AngularJS Apps Using Karma

  4. Pro AngularJS: 
    1. Chap 07 is not runnable.
===========================React.JS==============================

ReactJS

  1. React JS Official
  2. React JS Tutorial
  3. Is React Killing Angular.

ReactJS Tutorial


===========================Node.JS==============================

Logging 

  1. Advanced logging with NodeJs

Promise

Open Source Project

  1. 10 Best Node.js Frameworks For Developers
  2. ngBoilerplate, ngBoilerplate  : angularjs Bootstrap nodejs
  3. Meteor.js, GitHub     1561  26096  2970, Should I use Meteor? Why?Book: discover meteor
  4. mean.io: OfficialGithub    503, 6930, 2071, learn mean.io
  5. meanjs: Github  270  2270  758
  6. hackathon-starter: Github link,  hackathon-angularjs stackoverflow
  7. Forums: Which do you prefer and why: MEAN stack or MeteorJS?

NW.js

  1. List of Companies using NW.js
  2. DaftMonk/generator-angular-fullstack

Forum

  1. Difference between MEAN.js and MEAN.io
  2. Should I use Meteor? Why?
  3. Most Popular JavaScript Frameworks 2015
  4. 3 JavaScript Libraries to Keep an Eye on in 2015 

Forums

  1.  https://github.com/sharelatex/sharelatex   166, 2970, 350
  2. Are there any open-sourced projects based on node.js and expressjs?
  3. 2015.01 Does anyone know of a real-world, complex, open-source NodeJS application? I need to make a RESTful API and tutorials / examples are way to simple
  4. https://github.com/tryghost/Ghost

Mean.io tutorial

  1. When using the mean.io stack, do you just start modifying/adding to the /packages/system directory or create your own package, if so, how do you route to your package (making '/' go to your package)?
  2. Using Mean.io for my SPA application 

Related Plugins for JSON:

  1. JSON Formatter  : make JSON beautiful in Chrome
  2. Postman - REST Client.

Packages

  1. mean.js
    1. mean.js    github
    2. Bower: npm install -g bower
    3. Grunt: npm install -g grunt-cli
    4. YEOMAN: http://yeoman.io/generators
      • scaffold application: npm install -g yo
      • npm install -g generator-meanjs
    5. go to folder, cd D:\GitHub\meanjs-study ==> yo meanjs
  2. run grunt in cmd to start site. ==> http://localhost:3000/  .
  3. now a site is created, signup ==> Menu Articles --> New Article ==> add articles via Here.
  4. Go over the source code
    1. app : server side code
    2. public: client side code
    3. root code
      1. server.js : main entry point code
      2. package.json

Digest

  1. Comparison: Tools to Automate Restarting Node.js Server After Code Changes
  2. Architecting a Secure RESTful Node.js app
  3. Compiling a nodejs projects as a single binary
  4. NodeJS background process:
    1. process = require('child_process') 

Testing / Debug

  1. Mocha
    1. npm install mocha --save-dev
    2. .npm install -g mocha
  2. Blanket
    1.  npm install blanket --save-dev
  3. HTML-Cov
  4. supertest git    npmjs.
  5. how to debug mocha test with chrome 

Debugger

  1. Node Inspector
    1. node --debug app.js
      1. node --debug-brk app.js
    2. node-debug app.js
    3. http://127.0.0.1:8080/?ws=127.0.0.1:8080&port=5858
  2.  Spy-js for Node.js

Digest

  1. Make Your Node.js API Bulletproof: How to Test with Mocha, Chai, and SuperTest.
  2. Tutorial on Test with Mocha from Scothmedia
  3. JetBrains: Preparing to Use Mocha Test Framework.

    NTLM Authentication Support

    Packages for NodeJS and NTLM
    1. node-http-ntlm
    2. express-ntlm 

    Code Protection

    Have some research into protecting NodeJS Code. Here is general discussion:
    1.  StackOverflow: node.js - Code Protection?
    2. Secure distribution of NodeJS applications
    Free Solution
    1. JXCore : encrypt the application source code to another format which can be executed by JXCore application. has some issue?
    2. YUICompressor.
    3. GruntJS. discussion
    4. nexe
    Commercial Solution
    1. Protect Your Node.js Sources With JScrambler Before Unleashing it Into the Wild Wild Web  
      1. JScrambler HomePage     result
    2. enclosejs : Looks like this is the most promising one

    Trouble Shooting

    We’ve Made Web Development Complicated


    1. a server-side language
    2. how to talk to a database (SQL)
    3. HTML
    4. CSS
    5. JavaScript
    6. Vagrant with a pre-built image (Laravel Homestead)
    7. SSH
    8. Version control (Git)
    9. A branching/merging process (Git Flow)
    10. Gulp
    11. Node.js (for running Gulp)
    12. Homebrew
    13. /etc/hosts file (or Dnsmasq)
    14. CSS pre-processors (Bootstrap was already using Less, I am using Sass)
    15. CSS concatenation
    16. JavaScript concatenation
    17. Image sprites
    18. A server-side framework (Laravel)
    19. Framework-specific command line utilities for creating template files, running pre-load optimizations, database commands, etc.
    20. ORM
    21. Security (SQL injection, XSS, CSRF, etc.)
    22. Templating syntax (Laravel uses one called Blade)
    23. A client-side framework (jQuery, Bootstrap, Angular, etc.)
    24. JSON
    25. PHP Composer
    26. PHP Packages
    27. Database migrations (database schema defined in code)
    28. Database seeding
    29. Faker (for creating dummy data)
    30. Unit testing

    Big Data: Hadoop, Spark



    1. Apache Hadoop - wiki.
    2. Hadoop Ecosystem
      1. Hadoop Vendors
        1. Hortonworks
        2. Cloudera,
        3. MapR, 
        4. Greenplum, 
        5. IBM, and 
        6. Amazon.
      2. Parts
        1. Hive is a SQL dialect and 
        2. Pig is a dataflow language for that hide the tedium of creating MapReduce jobs behind higher-level abstractions more appropriate for user goals. 
        3. Zookeeper is used for federating services and 
        4. Oozie is a scheduling system. Avro, 
        5. Thrift and Protobuf are platform-portable data serialization and description formats.
    3. Apache Spark
      1. Apache Spark Ecosystem
      2. Wiki
      3. Implementation
        1. 77% scala
        2. 9%  python
        3. 7%  java
        4. 8%  other
      4. Big Data Processing with Apache Spark
        1. Part 1: Introduction
        2. Part 2: Spark SQL
        3. Spark Streaming.

    Labels:

    Tuesday, December 1, 2015

    Git Server Installation Options for Windows

    Install Git Server on Windows

        If you are OK to install Git server on Linux, GitLab Community Version is the best options free of charge. It's just like a GitHub Server on you Local Network.
        If you prefer to host your Git server on Windows, here is some of the options as of December, 2015.
    1. Bitbucket by Atlassian Stash, developed with Java: 
      1. for up to 10 users, one-time $10 payment, 30 days try.
      2. Close integration with JIRA, as it come from same company.
      3. Close integration with Confluence (which is $120/year).
      4. Also Git GUI Client -- SourceTree same company is very good.
    2. Bonobo Server: Developed with .Net. Free and open source, hosted on IIS for windows. 
    3. GitStack: Run on Apache and Python. $720/year for up to 10 users. 30 days try.
       More information is also available here.

    Install Git Client on Windows

    Install git command tools is required for run scripts and future trouble shooting. install:
    • Git-2.6.3-64-bit.exe -- Git Command Line tools
    • git-credential-winstore.exe -- remember user name and password on your PC
    • SourceTreeSetup_1.6.25.exe -- GUI for Git command line tools
    In order to use Git command line, run:
    1. git config --global user.name "Emma Paris"
    2. git config --global user.email "eparis@atlassian.com"

    Programming Principles

    List of Programming Principles Here.
    • KISS: Keep it simple stupid.
    • YANGI: You aren't gonna need it. Don't implement something until it is necessary.
    • Do The Simplest Thing That Could Possibly Work.
    • Keep things DRY
    • Code for maintainer
    • Avoid Premature Optimization
    • Minimise Coupling