Tips on 30Days30Skills(1)

TurnToJPG -->

Day 3 - Flask

First install the virtualenv environment via:

$ brew install pyenv-virtualenv

Create the 2.7 virtualenv of python, first you have to install 2.7(before you could use list for listing all of the aviable versions), then use following command for creating the 2.7 virtualenv for developing flask:

$ eval "$(pyenv init -)"
$ pyenv install --list
$ pyenv install 2.7
$ pyenv virtualenv 2.7 venv_For_Flask_2.7
$ pyenv versions
$ pyenv activate venv_For_Flask_2.7
(venv_For_Flask_2.7)Yosemite:~ Trusty$ pip install flask

Git clone the project from github, then install via the requirement.txt:

$ git clone scheduleapp
$ cd scheduleapp/
$ pip install -r requirements.txt
$ python create_tables
$ python runserver

Now you could visit the http://localhost:5000 for viewing the result.

Since you created this appliation, so it’s very easy for deploying it on Openshift.

Install rhc on Mac, before install, make sure your network is configured OK(mine is set the proxy via ):

sudo gem install rhc

Run following command for setup the rhc on your own machine:

rhc setup

Deploy the app via following command;

MacBook-Air-di-Trusty:schedulingapp Trusty$ rhc create-app schedapp python-2.7 postgresql-9.2 --from-code=

After deployment, the following app will be available for accessing:

Day 4 - PredictionIO

Install Vagrant and its plug-ins:

$ sudo pacman -S vagrant
$ vagrant plugin install vagrant-login vagrant-share

Download the latest PredictionIO-Vagrant:

$ wget

For working under proxy, install vagrant-proxyconf plugins:

$ vagrant plugin install vagrant-proxyconf

Add following to

  # Proxy Setting
  config.proxy.http = ""
  config.proxy.https = ""
  config.proxy.no_proxy = "localhost,"

Following the tutorial may cause error, so I follow the guideline from the official website:

$ vagrant box add precise64

Then go the downloaded folder and start the vagrant:

$ pwd
$ vagrant up

Now login into the vagrant machine and add the new user:

$ vagrant ssh
vagrant@precise64:~$ /opt/PredictionIO/bin/users 
Warning: JAVA_HOME environment variable is not set.

PredictionIO CLI User Management

1 - Add a new user
2 - Update email of an existing user
3 - Change password of an existing user
Please enter a choice (1-3): 1
Adding a new user
Password: ********
Retype password: ********
First name: Trusty
Last name: mao
User added

For settingup the vagrant in opensuse:

$ wget
$ rpm -ivh vagrant_1.6.5_x86_64.rpm
$ which vagrant
$ vagrant box add precise64
$ vagrant plugin install vagrant-proxyconf

Previous version won’t create the user successfully, then I switch to 0.6.5, thus everything goes OK.

After Added the users, you could visit the webpage at “http://localhost:9000”

Add the application named “blog-recommender” in the webpage.

Eclipse Setup

The Url for input in the elipse is:

Install the m2eclipse via following methods:
/images/eclipseplugins_m2eclipse1.jpg Then:

Create project via:
You will encounter error, simply download the catelog file from:
Then add the catalog file like following:
Now re-create the project :

But this won’t solve the problem, we have to install maven manually in ArchLinux:

$ sudo pacman -S maven
$ # fetch the files from:
$ mvn install:install-file -DgroupId=org.apache.maven.archetypes -DartifactId=maven-archetype-webapp -Dversion=1.0 -Dpackaging=jar -Dfile=maven-archetype-weba

Now re-new the configuration.

This method is not OK, finally I downloaded the Eclipse Kepler and place it under the /media/y/Vagrant/eclipse, this time it could create the project successfully, but it failed when creating classes, complaing that missing some dependencies.