luckyx1 / visualization_for_drifter

The visualization tool for Drifters@Berkeley (http://drifter-visualization.herokuapp.com/)

Home Page:http://float.berkeley.edu/drifters

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

README for Visualization Tool for Professor Bayen

This is a link to the project:Floating Sensors Network.

Useful links

Learn SQL comands for POSTSQL DB

Resource page of our android application:

Installing the Rails Visualization tool locally

Installing the application means you must have rails set up, so lets install the packages.

1. Prequisites

Windows

Please do not try to use Rails with Windows. Performance will be greatly hindered,and gems will constantly fail to build. Linux is a free alternative that you can use with VirtualBox(also free).

OS X

Please instaill Xcode from the apps store, and then install Xcode Command Line Tools from Xcode → Preferences → Downloads, or install the standalone Xcode Command Line Tools package from here.

Next install homebrew

Postgres

Since we use Postgres for our PostSQL database, the following is recommended:

Plan A(if using mac):
use this nifty guide:

Plan B(if using homebrew)
brew install postgres

Plan C(otherwise)
Download POSTSQL stable version at http://www.postgresql.org/download/

Heroku

This tutorial will have you deploying a Ruby app in minutes.

Hang on for a few more minutes to learn how it all works, so you can make the most out of Heroku.

2. Pull the code from Github

To get a new repository on your local computer:

  • Fire up your terminal and type in the following:
  • cd Desktop
  • Starting from Desktop, mkdir “visualization” on your terminal
  • cd “visualization”
  • git clone git@github.com:luckyx1/visualization_for_drifter.git
  • now you have everything!

2 1/2. Running Visualization Tool for the first time

  • 1. run the following: rake db:migrate
  • 2. "": rake db:seed
  • 3. "": rails s(assuming your postsql is running in the background, consult the POSTSQL doc to see how to do that for your computer)
  • 4. go to 0.0.0.0:3000 to see it locally!

3 Daily Visualization use

To check if new updates has happened (while you have created no new content)

  • git pull

To check if new updates has happpened(while you have created content)

  • git add -A //Only do this if you are working on a branch
  • git commit -m “what you were working on”
  • git pull
  • -fix any merge conflicts

How to push your changes

  • git add “file_name”
  • git commit -m “what you were working on”
  • git pull
  • -fix any merge conflicts
  • git push

To create a branch

  • git checkout -b branch_name

To push this branch to github

  • git push origin branch_name

To switch to branch

  • git checkout branch_name

To switch to master

  • git checkout master

To update branch

  • git pull master branch

To update master with branch

  • git merge branch master

4 Heroku and Visulization tool

Currently the tool is being hosted on Heroku, so as follows, here is a guide to make heroku your friend and work with the app accordily.

To push to heroku do

  • git add -A
  • git commit -m “what you were working on”
  • git pull
  • fix merge
  • git push
  • git push heroku master

Updating DB

To update the database using POSTSQL, a backup must be initiated to keep data consistent.
The following is how we suggest the use of the DB
1. To prepare db for new data:
bash pull_db_from_heroku.sh
bash dump_heroku.sh
bash heroku_reset.sh
2. If you want to clear data locally do
bash clean_up.sh
3. If you want to put data currently on local to heroku do:
bash mirror_local.sh

OR do all this in one go with the following:
bash heroku_update.sh
* A note: you might have to configure the bash files to your own settings, so do this so I can git ignore these files afterwards.

5 Other nifty tricks for Ruby, rails, SQL etc (for FUN!)

To use SQL with rails

  • rails console
  • ActiveRecord::Base.connection.execute(‘SELECT * FROM users’)

To use POSTSQL

  • psql
  • \c “InternLeauge_development” lets you connect to that specific db
  • \list shows all the db available
  • \d list all the tables

On Heroku, in order to modify and work with data
*heroku pg:psql

To update the pgsl db:migrate(a hack)
*heroku run rake db:schema:load

How to find empty params in old data, then just update it manually when you find it:

  • SELECT locaton, id
  • FROM mytable
  • WHERE COALESCE = ’’
  • ;

How to reindex the numbers
ALTER SEQUENCE opportunities_id_seq RESTART WITH 1;
UPDATE opportunities SET id=nextval(‘opportunities_id_seq’);

UPDATE opportunities
SET id = nextval(‘opportunities_id_seq’);

Run with puma:
bundle exec puma -p 3001

6. Maintainers

This is a list of the team as of 06/05/2014. If you have committed to this project, please add your name and contact to the list.

Drift team~

Robert Erick Hernandez Jr. <r.hernandez@berkeley.edu>
Deepak <r.hernandez@berkeley.edu>
Nicolas Plain <r.hernandez@berkeley.edu>

Written by (last update June 5, 2014)/ New update (May 4, 2015)
Robert Erick Hernandez Jr

Enjoy,
The WaterDrifter Team~

About

The visualization tool for Drifters@Berkeley (http://drifter-visualization.herokuapp.com/)

http://float.berkeley.edu/drifters


Languages

Language:JavaScript 72.7%Language:CSS 21.6%Language:HTML 3.2%Language:Ruby 2.4%Language:Shell 0.1%Language:CoffeeScript 0.0%