Sunday, February 26, 2012

Hangover II

This is the sequel film to the similarly titled Hangover.

It uses the same characters, the same general plot line, the same twists, turns and climax as the first.  Everything that was spontaneous and fun about the original is repeated in the second film, and becomes dull, tired and painful.

The most superficial parts of the first movie are used to create a shell of a movie.  Then, the details of the movie are filled in with whatever is needed to make the plot line somewhat coherent.

A great sequel will take advantage of the viewers knowledge of and connection with the characters and can spend time developing a greater appreciation for these characters.  In this movie, the characters go through the same experience that we've seen them go through before, and they react in a completely identical fashion.  This diminishes the richness of the characters and the original movie.

Thursday, February 23, 2012

Proving a point

This is a maneuver where one person does something, that they normally wouldn't do, so that a second person would learn something.

Usually, the first person is upset that they're doing something that they don't want to do, and the second person fails to notice that a lesson was being given.

Sunday, February 5, 2012

Rails cheat sheet

#  create a new project (the -T flag means, don't make the test directory)
    rails new new_project_name -T

#  to include 'gems' to be installed for your app
    modify the Gemfile
    bundle update
    bundle install

#  do an install with a flag to skip some things
    bundle install --without production

#  create a resource, called "User" with attributes "name" and "email" of type string
    This will create all the MVC parts.
    rails generate scaffold User name:string email:string

#  The user Model is defined in this file.
#  This is similar to a C++ class definition (it even inherits from something, ActiveRecord::Base)
#  You can further tailor your model by adding validation constraints or
#  or create relationships between this model and others
    app/models/user.rb

#  The user Controller is defined in this file.
#  This looks like a list of event handlers that can affect your users model or view.
    app/controllers/users_controller.rb

#  The user View is defined in this file.
#  This gives info on how to display the page.
    app/views/users/index.html.erb

#  If you don't generate with a scaffold, this creates just a model, called "Model_name" with attribute1 and attribute2 of type string without the controller or view.
    rails generate model Model_name attribute1:string attribute2:string

#  If you don't generate with a scaffold, this creates just a controller, called "controller_name" that will control page "page_name"
    rails generate controller controller_name page_name

#  update the database structure after generate controller or generate user ...
    bundle exec rake db:migrate

#  undo a database update (the previous command)
    bundle exec rake db:rollback

#  get more help for database tasks
    bundle exec rake -T db

#  turn on the rails server
    rails s
    or (rails server)

#  start interactive rails environment
    rails console

#  location of resource pages [after generating the user resource and adding it to our database]
    /users   -> list of users
    /users/1  -> list of user with id == 1
    /users/new  -> place to make new users
    /users/1/edit  -> place to edit user with id == 1

#  create an integration test
    rails generate integration_test test_name
    - creates a test file under test_name_spec.rb

#  run test files (that are in directory spec/)
    bundle exec rspec spec/

#   create rspec tests
#   this creates files like spec/spec_helper.rb
     rails generate rspec:install

git cheat sheet

# configuration stuff
    git config --global alias.co checkout
    git config --global core.editor "gvim -f"

# initialize a repository
    git init

# edit file to change what files are excluded from the git repository
    vi .gitignore

# add files that will be checked in
    [in this case, add all files not excluded in .gitignore]
    git add .

# see what files were modified, added to be commited, and what's not tracked
    git status

# commit changes to local repository
    git commit -m "Comments on changes. ..."

# committing all modifications to existing files
    git commit -a -m "Comments on changes. ..."

# show committed changes
    git log

# checkout the local repository version and overwrite any changes
    git checkout -f

# checkout an old version [the period will checkout all the files]
    git log <-- to find the version you want (get the hastag)
    git checkout <hashtag> .
# create a new branch, and switch to it
    git checkout -b 'new branch name'

# switch to master branch
    git checkout master

# merge one branch with another
    git merge <branch name>
 
# list existing and current branch
    git branch

# update your git changes onto another remote repository
    (you should have created a repository with the same name first)
    git remote add origin git@github.com:<username>/repository_name
    git push origin master
 
# remove a file and also tell git to remove it
    git rm filename

Heroku cheat sheet

#  install, add ssh keys
    gem install heroku
    heroku keys:add

#  create a new application
    heroku create

#  deploy
    git push heroku master

#  push model updates onto heroku
    heroku rake db:migrate

#  install a program to push database data onto heroku
    gem install taps

#  push data onto heroku [overwrites the online data]
    heroku db:push

#  open the application
    heroku open

Thursday, February 2, 2012

A ruby on rails tutorial

I have been following this http://ruby.railstutorial.org/ruby-on-rails-tutorial-book, and it's pretty good.

After the first chapter, you will have created a simple application, saved it to github, and published it on heroku.

After the second chapter, you will use 'scaffold' to quickly create a rails application, create models that are backed by databases, and add some logic to define the relationship between the models.  This is done with git version control and publishing onto heroku.

After the third chapter, you will create a set of pages written in html using ruby.
You will build this page with test-driven development and will again check in the code to git hub and you publish onto heroku.

After the fourth chapter, you will continue development of the application made in the third chapter. You will add usage of css style sheets, with minimal changes to the application.  The majority of the chapter is spent explaining how objects are used in ruby and rails.

After the fifth chapter, you will have made a web page that has internal links to navigate within your application. At this point, you have a basic framework to build a basic web page.  At the same time, you will have created a page that may contain lots of elements and features that you do not fully understand how to use.

Wednesday, February 1, 2012

Local Lending

This is a system where people lend money to funds which go exclusively to local businesses.

The key to the process is that the lenders, also known as investors, would accept a rate of return that is not very competitive.

The local business borrowers would then be able to get capitol at a better than premium rate.  With the money, businesses could build a better product, expand, or withstand lean times. 

The lenders would benefit from this because the neighborhood that they live in will become infused with more money and the value of their homes will rise.  There are also psychological gains in which members of a community feel as if they have a stake in the community's success.

One obstacle in this plan is the risk for the lender where the borrower does not repay.

Track It

This is a program that makes it dirt-simple to enter data.

The UI would have a text input box, where users would input data with the following syntax:
<num> <identified>
For example, a user may input "15 push ups" indicating that they did 15 push ups, or "1000 calories" indicating that they burnt 1000 calories (or ate 1000).  The program would then facilitate analysis of this data - plotting the values over time, providing averages, standard deviations and of course allow for exporting of the data into some other data formats, like excel.

An api could eventually be provided so that the other programs could use the general storage facilities.