2011

September

    My mac book pro arrived on Monday and since then I've spent most of my time trying to figure out some settings that I consider to be basic.

    • mapping capslock to escape
    • swap fn and ctrl
    • keyboard shortcut to maximize a window
    • keyboard to active/deactive fullscreen

    mapping caps lock to escape

    I can't believe how difficult this is. In ubuntu this is a simple keyboard setting, but sadly on OSX I had to install some thirdparty software to do this. The tools i used was PCKeyboardHack

    swapping fn and ctrl

    I am used to having the ctrl key in the bottom left corner of the keyboard so i found it more natural to swap the two keys. To do this i used KeyRemap4Macbook

    keyboard shortcut to maximize a window

    I'm currently trying this script in combination with quicksilver triggers and mapped to cmd+ctrl+z. So far i'm not liking this setup. I prefer winkey + up on windows or alt + f10 on ubuntu.

    keyboard shortcut to activate/dectivate fullscreen.

    To do this follow the instructions here. Unfortunatly, the cmd + escape combination did not work for me so i opted for ctrl+cmd+f

    working with screen in bash in terminal

    To get screen to and bash to function properly and recognize your .rvmrc project files follow the instructions in this post

    .bashrc

    1 alias screen='export SCREENPWD=$(pwd); /usr/bin/screen'
    2 export SHELL='/bin/bash -rcfile ~/.bash_profile';
    3 
    4 case "$TERM" in
    5     'screen')
    6              cd $SCREENPWD
    7                       ;;
    8                       esac
    

    .screenrc

    1 startup_message off
    2 shell -$SHELL
    

    customizing the terminal prompt

    to get your prompt to look like mine ie.

    mo@mobook ~/development/blah
    $ 
    

    .bashrc

    export PS1="\u@\h\w \n$ "
    

    installing imagemagick properly

    Follow the instructions found on this stackoverflow post

    1   brew remove imagemagick
    2 
    3   rm -rf 'brew --cache imagemagick'
    4 
    5   brew install -f imagemagick --disable-openmp
    

    how to source .bashrc by default in terminal

    read this

    /etc/profile

    1   [ -r $HOME/.bashrc ] && source $HOME/.bashrc
    

July

    Top 4 picks

    jasmine

    qunit

    screwunit

    #

    other libs

    helpful links

    Domain Logic Patterns

    Transaction Script

    Organizes business logic by procedures where each procedure handles a single request from the presentation.

    Domain Model

    An object model of the domain that incorporates both behavior and data

    Table Module

    A single instance that handles the business logic for all rows in a database table or view.

    Service Layer

    Defines an application's boundary with a layer of services that establishes a set of available operations and coordinates the applications response in each operation.

    Data Source Architectural Patterns

    Table Data Gateway

    An object that acts as a gateway to a database table. One instance handles all the rows in the table.

    Row Data Gateway

    An object that acts as a gateway to a single record in a data source. There is one instance per row.

    Active Record

    An object that wraps a row in a database table or view, encapsulates the database access, and adds domain logic on that data.

    Data Mapper

    A layer of mappers that moves data between objects and a database while keeping them independent of each other and the mapper itself.

    Object-Relational Behavioral Patterns

    Unit of Work

    Maintains a list of objects affected by a business transaction and coordinates the writing out of changes and the resolution of concurrency problems.

    Identity Map

    Ensures that each object gets loaded only once by keeping every loaded object in a map. Looks up objects using the map when referring to them.

    Lazy Load

    An object that doesn't contain all of the data you need but knows how to get it.

    Object-Relational Structural Patterns

    Identity Field

    Saves a database id field in an object to maintain identity between an in-memory object and a database row.

    Foreign Key Mapping

    Maps an association between objects to a foreign key reference between tables.

    Association Table Mapping

    Saves an association as a table with foreign keys to the tables that are linked by the association.

    Dependent Mapping

    Has one class perform the database mapping for a child class.

    Embedded Value

    Maps an object into several fields of another objects table.

    Serialized LOB

    Saves a graph of objects by serializing them into a single large object (LOB), which it stores in a database field.

    Single Table Inheritance

    Represents an inheritance hierarchy of classes as a single table that has columns for all the fields of the various classes.

    Class Table Inheritance

    Represents an inheritance hierarchy of classes with one table for each class.

    Concrete Table Inheritance

    Represents an inheritance hierarchy of classes with one table per concrete class in the hierarchy.

    Inheritance Mappers

    A structure to organize database mappers that handle inheritance hierarchies.

    Object-Relational Metadata Mapping Patterns

    Metadata Mapping

    Holds details of object-relational mapping in metadata.

    Query Object

    An object that represents a database query.

    Repository

    Mediates between the domain and data mapping layers using a collection like interface for accessing domain objects.

    Web Presentation Patterns

    Model View Controller

    Splits user interface interaction into three distinct roles.

    Page Controller

    An object that handles a request for a specific page or action on a website.

    Front Controller

    A controller that handles all requests for a website.

    Template View

    Renders information into HTML by embedding markers in an html page.

    Transform View

    A view that processes domain data element by element and transforms it into html.

    Two Step View

    Turns domain data into html in two steps. First by formatting some kind of logical page, then rendering the logical page into html.

    Application Controller

    A centralized point for handling screen navigation and the flow of an application.

    Distribution Patterns

    Remote Facade

    Provides a coarse-grained facade on fine-grained objects to improve efficiency over a network.

    Data Transfer Object

    An object that carries data between processes in order to reduce the number of method calls.

    Offline Concurrency Patterns

    Optimistic Offline Lock

    Prevents conflicts between concurrent business transactions by detecting a conflict and rolling back the transaction.

    Pessimistic Offline Lock

    Prevents conflicts between concurrent business transactions by allowing only one business transaction at a time to access data.

    Coarse-Grained Lock

    Locks a set of related objects with a single lock.

    Implicit Lock

    Allows framework or layer supertype code to acquire offline locks.

    Session State Patterns

    Client Session State

    Stores session state on the client.

    Server Session State

    Keeps the session state on a server system in a serialized form.

    Database Session State

    Stores session data as committed data in the database.

    Base Patterns

    Gateway

    An object that encapsulates access to an external system or resource.

    Mapper

    An object that sets up a communication between two independent objects.

    Layer Supertype

    A type that acts as the supertype for all types in its layer.

    Separated Interface

    Defines an interface in a separate package from its implementation.

    Registry

    A well known object that other objects can use to find common objects and services.

    Value Object

    A small simple object, like Money or a Date Range, whose equality isn't based on identity.

    Money

    Represents a monetary value.

    Special Case

    A subclass that provides special behavior for particular cases.

    Plugin

    Links classes during configuration rather than compilation.

    Service Stub

    Removes dependencies upon problematic services during testing.

    Record Set

    An in-memory representation of tabular data.

June

    Programming Ruby 1.9

    The basics

    1   class Book
    2     def initialize(isbn, price)
    3       @isbn = isbn
    4       @price = price
    5     end
    6   end
    7 
    8   book = Book.new("isbn", 3)
    

    initialize is a special method in Ruby programs. When you call Book.new to create a new object, Ruby allocated memory to hold an uninitialized object and then calls that object's initialize method. T

    initialize is an objects constructor. The call to Book.new calls the Book's constructor (initialize) and allocates a new instance of Book.

    @isbn in an instance field of the class. when you want to declare a instance field you must prefix the name of the variable with the "@" sign.

    To customize how an object is displayed via puts or p you can override the "to_s" method.

     1   class Movie
     2     def initialize(name, studio, year_published)
     3       @name = name
     4       @studio = studio
     5       @year_published = year_published
     6     end
     7     def to_s
     8       "Name: #{@name}, Studio: #{@studio}, Year: #{@year_published}"
     9     end
    10   end
    11 
    12   p Movie.new("MegaMind", "DreamWorks", 2010)
    

    Attributes (methods)

    By default instance variables are private and cannot be accessed from outside the class. You can define "attributes" on the class to be able to see and change the internal state of the class. These are equivelant to properties in c#.

    You can define read only attribute explicitly, like this.

     1   class VideoGame
     2     def initialize(name)
     3       @name = name
     4     end
     5     def name
     6       @name
     7     end
     8   end
     9 
    10   game = VideoGame.new("call of duty")
    11   puts game.name
    

    Ruby has a handy little shorthand to save you from having to type out your read only attributes. It's called "attr_reader".

     1   class VideoGame
     2 
     3     attr_reader :name
     4 
     5     def initialize(name)
     6       @name = name
     7     end
     8   end
     9 
    10   game = VideoGame.new("call of duty")
    11   puts game.name
    

    To create a method that would allow me to change the name of a video game I can define a method named "name=".

     1   class VideoGame
     2 
     3     def initialize(name)
     4       @name = name
     5     end
     6     def name=(new_name)
     7       @name = new_name
     8     end
     9   end
    10 
    11   game = VideoGame.new("call of duty")
    12   game.name="GTA4"
    

    There's also a shorthand for having to write your own setter methods. It's called attr_writer.

     1   class VideoGame
     2 
     3     attr_writer :name
     4 
     5     def initialize(name)
     6       @name = name
     7     end
     8   end
     9 
    10   game = VideoGame.new("call of duty")
    11   game.name="GTA4"
    

    There's also a shorthand for defining a setter, and getter for your instance variable called "attr_accessor"

     1   class VideoGame
     2 
     3     attr_accessor :name
     4 
     5     def initialize(name)
     6       @name = name
     7     end
     8   end
     9 
    10   game = VideoGame.new("call of duty")
    11   game.name="GTA4"
    12   puts game.name
    

    Access Control

    You get 3 levels of protection:

    • Public methods (default): can be called by anyone.
    • Protected methods: can be invoked by defining class and subclasses.
    • Private methods: can only be called within the context of the current object.

    It is never possible to access another object's private methods directly, even if the object is of the same class as the caller.

     1   class MyClass
     2     def public_method
     3     end
     4 
     5   protected
     6     def protected_method
     7     end
     8 
     9   private
    10     def private_method
    11     end
    12 
    13   public 
    14     def another_public_method
    15     end
    16   end
    17   
    18 # or
    19 
    20   class AnotherClass
    21     def public_method
    22     end
    23 
    24     def protected_method
    25     end
    26 
    27     def private_method
    28     end
    29 
    30     public      :public_method
    31     protected   :protected_method
    32     private     :private_method
    33   end
    

    Variables

    Variables are used to keep track of objects; each variable holds a reference to an object. A variable is simply a reference to an object.

    1   movie = Movie.new("man on fire")
    2   another_movie = movie
    3   movie = Movie.new("batman")
    4 
    5   puts movie.name
    6   puts another_movie.name
    

May

    Referenced from Programming Ruby 1.9 The Pragmatic Programmers' Guide

    installing ruby

      $ sudo apt-get update
      $ sudo apt-get install curl
      $ bash < <( curl -s https://rvm.beginrescueend.com/install/rvm )
    

    Add to .bashrc

    source $HOME/.rvm/scripts/rvm
    

    then.

      $ rvm notes # follow instructions to install missing libs
      $ sudo apt-get install build-essential bison openssl libreadline5 libreadline-dev curl git-core zliblg zliblg-dev libssl-dev vim libsqlite3-0 libsqlite3-dev sqlite3 libreadline-dev libxml2-dev git-core subversion autoconf
      $ rvm install 1.9.2
      $ rvm use 1.9.2
      $ ruby -v
    

    documentation

      $ ri GC
      $ ri GC::enable
      $ ri assoc
    

    ruby is object-oriented

    arrays and hashes

    arrays and hashes are indexed collections. both store collections of objects, accessible using a key.

    e.g array literal

    1   a = [ 1, 'cat', 3.14 ] # array with three elements
    2   puts "the first element is #{a[0]}"
    

    ruby has a shortcut for creating arrays of strings

    1   a = [ 'ant', 'bee', 'cat', 'dog', 'elk' ]
    2   a[0] # => "ant"
    3   a = %w[ ant bee cat dog elk ]
    4   a[0] # => "ant"
    

    hashes are similar to arrays. you must supply two objects for every entry, one for the key, the other for the value.

     1   dead_rappers = {
     2     'tupac'   => '1996'
     3     'biggie'   => '1997'
     4     'big l'   => '1999'
     5     'eazy e'   => '1995'
     6     'odb'   => '2004'
     7   }
     8 
     9   p dead_rappers['tupac']   # => '1996'
    10   p dead_rappers['biggie']  # => '1997'
    11   p dead_rappers['big pun']  # => nil
    

    a hash by default returns nil when indexed by a key it doesn't contain. to change the default value you can specify it when creating a new hash.

    1   histogram = Hash.new(0) # the default value 0
    2   histogram['ruby'] # => 0
    3   histogram['ruby'] = histogram['ruby'] + 1
    4   histogram['ruby'] # => 1
    

    symbols

    are simple constant names that you don't have to predeclare and that are guaranteed to be unique. a symbol literal starts with a colon and is normally followed by some kind of name:

    1   walk(:north)
    2   walk(:east)
    

    there's no need to assign some kind of value to a symbol - ruby takes care of that for you. ruby also guarantees that no matter where it appears in your program, a particular symbol will have the same value.

    e.g

    1   def walk(direction)
    2     if direction == :north
    3       # ...
    4     end
    5   end
    

    symbols are frequently used as keys in hashes.

    like this

    1   dead_rappers = {
    2     :tupac    => '1996'
    3     :biggie   => '1997'
    4     :bigl     => '1999'
    5     :eazye    => '1995'
    6     :odb      => '2004'
    7   }
    8 
    9   dead_rappers[:odb] # => '2004'
    

    in ruby 1.9 you can use name: value pairs to create a hash if the keys are symbols.

    1   dead_rappers = {
    2     tupac:    '1996'
    3     biggie:   '1997'
    4     bigl:     '1999'
    5     eazye:    '1995'
    6     odb:      '2004'
    7   }
    8   puts "big l died in #{dead_rappers[:bigl]}"
    

    control structures

    the if/elseif/else structure

    1   today = Time.now
    2 
    3   if today.saturday?
    4     puts "do chores around the house"
    5   elsif today.sunday?
    6     puts "chill out"
    7   else
    8     puts "go to work"
    9   end
    

    the while loop

    1   i = 0
    2   while i < 100
    3     i+=1
    4   end
    

    ruby treats nil as a false, so you can write this.

    1   while line = gets
    2     puts line.downcase
    3   end
    

    statement modifiers are a cool shortcut if the body of an if or while statement is just a single express.

     1   if radiation > 3000
     2     puts "danger, will robinson"
     3   end
     4 
     5   puts "danger, will robinson" if radiation > 3000
     6 
     7   square = 4
     8   while square < 1000
     9     square = square * square
    10   end
    11 
    12   square = square*square while square < 1000
    

    blocks

    this is a code block:

    1   { puts "hello" }
    

    so is this:

    1   do 
    2     club.enroll(person)
    3     person.socialize
    4   end
    

    the only thing you can do with a block is associate it with a call to a method. you can do this by putting the start of the block at the end of the source line containing the method call.

    1   greet { puts "hi" }
    

    the method greet is given a block. if the method has parameters, then they appear before the block:

    1   verbose_greet("mo", "a geek") { puts "hi" }
    

    a method can invoke the block by calling yield.

    1   def call_block
    2     puts "start of method"
    3     yield
    4     yield
    5     puts "end of method"
    6   end
    7 
    8   call_block { puts "in the block" }
    
      output:
      start of method
      in the block
      in the block
      end of method
    

    you can also pass arguments to the block. within the block you need to list the names of the parameters to receive these arguments between vertical bars.

    1   def who_says_what
    2     yield("mo", "hello")
    3     yield("morilla", "yo")
    4   end
    5 
    6   who_says_what {|person, phrase| puts "#{person} says #{phrase}"
    

    code blocks are used throughout the ruby library to implement iterators, which are methods that return successive elements from some kind of collection, such as an array:

    1   animals = %w( ant bee cat dog elk )
    2   animals.each {|animal| puts animal }
    3   [ 'cat', 'dog', 'horse' ].each {|name| print name, " "}
    4   5.times { print "*" }
    5   3.upto(6) {|i| print i }
    6   ('a'..'e').each {|char| print char}
    

February

    Step 3: legally minimize your taxes

    In week three of the Kustom Design Level 1 Financial boot camp we covered the CRA, taxes, and tax reduction strategies.

    Below are my notes from the class.

    The Authority Hierarchy

    1. The Supreme Court of Canada
    2. Tax Court of Canada
    3. Canada Revenue Agency (formerly 'Revenue Canada', formerly Canada Customs and Revenue Agency (CCRA))

    The CRA is a corporation, and their main line of business is collections or as they call it "to administer tax". They are effectively a collection agency. In Alberta, they only adminster personal income tax not corporate.

    The Tax Court of Canada

    The tax court of Canada is a specialized court of law whose jusisdiction extends to several Acts of parliament, and most notable the Income Tax Act, the Excise Tax Act, and several provisions of the Employment Insurance Act.

    This is a superior court to which individuals and companies may appeal to settle disagreements with the Canada Revenue Agency on matters of income tax, GST and employment insurance.

    The Supreme Court of Canada

    The Supreme Court of Canada is Canada's final court of appeal, the last judicial resort for all litigants, whether individuals or governements.

    The Canada Revenue Agency

    • CRA loses many cases that are appealed to the Supreme Court of Canada.
    • The Supreme Court of Canada over the years have repeatedly said to the CRA:

      Taxpayers have the right to structure their affairs in a way that minimizes taxes.

    Never ever give the CRA originals of anything! They have a history of accidentally losing documents.

    Dealing with the CRA

    • Don't ever take what an agent says on the phone as fact, get it in writing.
    • Go to the rulings department to get it in writing.
    • object if you don't agree. (appeal)
    • make applications to the fairness and Tax Ombudsman.
    • you have 90 days to object to an assessment (the blue paper in your taxes)
    • stay in honour with them.

    Disclaimer

    ... nor is it responsible for the accuracy, reliability or currency of the information contained on our Web site and supplied by external sources.

    CRA Disclaimer

    Understanding Tax Brackets

    • 15% on the first $40,970.00 of taxable income.
    • 22% on the next $40,971.00 of taxable income. ($40,970.00 to $81,941.00)
    • 26% on the next $45,080.00 of taxable income. ($81,941.00 to $127,021.00)
    • 29% of taxable income over $127,021.00.

    Provincial tax rate for Alberta is a flat 10% on taxable income.

    In week two of the Kustom Design Level 1 Financial boot camp we covered budgeting, good debt vs. bad debt, and we discussed some advice that is now obsolete.

    Below are my notes from the class.

    Financial Calculator:

    • N = Time/Periods
    • I/Y = Interest/Year
    • PV = Present Value
    • PMT = Payment (negative value)
    • FV = Future Value
    • COMP = Compute

    E.G. How many years if you could only contribute $400 monthly? FV = 700000 PV = 0 I = 6% PMT = -$400 N = 38.05 (38 years 1 month or 457 months)

    Top 3 Credit Bureau's:

    • Equifax
    • TransUnion
    • Northern Credit

    Steps to fix your credit report

    1. deal directly with the company.
    2. order investigation by equifax.
    3. make a note on your credit report.

    Always pull your own score before you go to borrow (soft check).

    RBC credit alert notifies you when something happens to your credit score or report.

    Improving Your Credit Score

    • remains on your credit report for six years.
    • a hard check can knock 10-20 points off your score.
    • can fall over night.
    • good credit will save you money.
      • lower interest on mortgages/loans.
    • 650 bottom line for most lenders.

    5 Main Ares Used in Calculating Your Credit Score

    1. Your payment history
    2. Amounts you owe
    3. Length of your credit history
    4. Types of credit used.
    5. Your new credit

    Top 5 Ways to Improve Your Credit Score

    • Pay all bills on time.
    • Keep revolving credit balances low.
    • Limit your credit.
    • Be focused when you go for credit.
    • Manage your credit responsibly and regularly.

    Some agreements allow lenders to check your credit when they want.

    Brokers are good, they check your credit once then shop it around for you.

    If you have a good score you can negotiate a lower rate with your lender. If your write them a letter, then it is documented.

    • Open Circle (ever expanding)
    • Closed Circle (fixed)

    The Closed Circle

    • Obligations
    • Necessities
    • Wants

    • Issue a tracking system.

    • Total of expenditures.
    • Capture sources of income.
    • Determine material wants.
    • Determine between Obligations, Necessities or Wants.
    • Prepare the closed circle.
    • Compare income and expenses.

    notes

    • you are much more likely to get something if you write it out.
    • split and list wants.

    Calculate your expenses first.

    Only take what you need from your business, nothing more.

    When you take good care of what you have been given, you will receive more to take care of!

    Overflow

    Overflow can be used for: * eliminating bad debt. * planned giving. * investing. * other agreed upon items that help you achieve your goals.

    What about cash flow?

    • not all funds come when you think they are coming.
    • use your cash flow wisely and don't go over your budget.

    2 ways to increase cash flow: * more cash flow coming in * less expenses going out

    incoming cash flow can be active or passive.

    Step 2: Eliminate Bad Debt

    Good Debt: * Has asset attached. * Is tax deductible. * leverage used to invest. (rental property)

    Bad Debt: * Consumer (credit cards) * Non Deductible (Mortgage) * High Interest

    Example:

    You owe $10,000.00 on your credit cards with an average interest rate of 20%. The standard minimum payment for $10,000.00 is $250.00. If that is all you pay each month, it will be 37 years and more than $19,000.00 in interest charges before your balance is paid off.

    What if you have more than one credit card to pay off?

    1. List outstanding credit card balances.
    2. Divide each balance by the minimum payment required.
    3. Do this for all of your credit cards.
    4. List them in order of payments from lowest to highest.
    5. Apply your extra $10.00 a day to the one with the least amount of payments.

    Example

    Mastercard
    • balance of $3000 @ 19.99%
    • Minimum payment of $300.00
    Visa
    • balance at $4000.00 @ 17.99%
    • minimum payment of $450.00
    Calculation:
    • MC $3000.00/$300.00 = 10
    • Visa $4000.00/$450.00 = 9

    Pay off your Visa first, then your mastercard.

    Eliminating Bad Debt

    Don't be a slave to interest

    • all credit card interest.
    • high interest loans, notes and credit lines.
    • non deductible loans, notes and credit lines.
    • all non deductible mortgages.
    • family debt with no repayment structure.

    Bad Debt elimination strategies * refinancing at lower interest rates * consolidation * depositing paychecks to line of credit. * smith maneuver

    What We Were Taught

    • Work hard and you'll get job security.
    • The company pension plan will take care of you.
    • Canada pension plan will take care of you.
    • save money
    • get out of debt
    • invest for the long term.
    • diversify your investments.
    • turn your money over to an expert - someone you can trust.
    • you need to have money to make money.
    • to good to be true? it probably is.

    Why working hard is obsolete advice

    • income tax was first imposed in Canada in 1917 on both individuals and corporations, collected primarily by the federal government.
    • Canada has a graduated tax system, as do most provinces. (Alberta does not 10%)
    • tax rate can exceed 50% annually in many provinces:
      • federal and provincial surtaxes
      • provincial health premium taxes
    • other mandatory government premiums (not officially taxes)
      • CPP
      • EI
    • effective tax rate of close to 60%
    • the government has the right to get paid its taxes at the same time as employees.
    • business owners are allowed to pay their expenses before they pay their taxes.
      • this massive loophole is one of the reasons that the rich get richer.

    Therefore, the harder you work as an employee the more you pay in taxes.

    The RRSP

    Positives: * tax deductions * long term growth for future income * forced savings program

    Negatives: * eventually taxed * limit on amount * no collateral advantage * investment restrictions * age and income restrictions * government control * interest on load not deductible * liquidity * cannot claim losses * no tax savings on capital gains or dividends

    notes

    • interest on loans are tax deductible for other investments but not for RRSP's

    Why "Save Money" is obsolete advice

    • after the U.S. went off the gold standard, a dollar saved was no longer a dollar earned.
    • Prior to 2000, in fear of Y2K the government of the U.S. printed billions of dollars to keep the economy afloat.
    • 9/11, Iraq War and Bailouts the US printed massive amounts of money again.
    • at the same time China entered the World Trade Organization and became the biggest creditor in the world and the U.S. became the biggest debtor.
    • As our economy floats on the U.S. dollar, the Canadian dollar will continue to be devalued.
    • The core Consumer Price Index determines the rate of inflation, but it is missing fruit, vegetables, gasoline, fuel oil, natural gas, mortgage interest, intercity transportation, tabacco products as well as the effect of changes in indirect taxes on the remaining components.
    • In spite of house prices doubling, and tripling... and oil going from $10.00 a barrel to $90.00 a barrel, the economists say there is no real inflation. That's because economists watch the CPI, not the price of assets.
    • The bank can leverage your dollars to the tune of 20 to 1.
    • The savers lose because the value of their dollar goes down, and the bank has created 20 more dollars from their 1 dollar.

    Notes

    • The more currency they inject, the less it is worth. (supply and demand)
    • Buy GOLD!

    Why "Get Out of Debt" is Obsolete Advice

    • Good debt is money leveraged to make more money such as the real estate investment.
      • This is debt that someone else pays for you.
    • Bad debt is consumer debt; money spent on consumable items.
      • This is debt that you pay for.
    • The majority of people think that all debt is bad because they have not been trained to use debt properly.

    Why "Invest for the Long Term" is Obsolete Advice

    • All mutual funds require fees regardless of whether you earn money or lose money.
    • Canadians pay much more for the same services than Americans do.
    • It is possible to receive higher rates of return by making your money work for you. It doesn't make sense to simple hand over your money - to complete strangers - and expect to receive a return at some point in the future.
    • You have to be willing to invest in your financial education so that you can see the potential in any oppurtunity.

    "Rule number one is don't lose money" - Warren Buffet "Rule number two is always remember rule number one." - Warren Buffet "Diversification is required when investors do not know what they are doing." - Warren Buffet

    Why "Diversify" is Obsolete Advice

    • Diversification is like going to the racetrack and betting on all the horses; you may not lose much money, but you also won't make much money.
    • Many financial advisors recommend diversification because they don't have the ability to pick the winner.. so they play it safe and recommend that you "bet on all the horses".
    • There are three basic asset classes:
      • Paper Assets: promissary notes, bonds etc.
      • Real Estate: raw land or buildings
      • Businesses: publicly held or private

    The five biggest markets to invest in are: * The Stock Market * The Bond Market * The Real Estate Market * The Currency Market * The Commodities Market

    The Smith Manoeuvre

    1. Get a re-advanceable mortgage
    2. Liquidate non-registered assets (like stocks held outside of an RRSP) into cash.
    3. Use this cash as a down payment on your mortgage.
    4. Make mortgage payments like normal.
    5. Re-borrow $1 for every $1 of mortgage principle you pay each month.
    6. Invest that borrowed money at a higher rate of return than the loan interest you pay.
    7. Deduct your investment loan interest and use the tax savings to pre-pay your mortgage.

    Repeat steps 3-7 until your mortage is paid off!

    This one is a little confusing, because now you have an extra interest payment to make against the line of credit portion of the re-advanceable mortgage. I've read that you're supposed to capitalize the interest by borrowing from your line of credit to pay the interest payment on your line of credit. This sounds very risky! - mo

    links

    freenx is like remote desktop (mstsc.exe). The way it works is you have to run a NX server on the box that you want to remote in to. You then use a NX Client to remote in to the box.

    There's a great Community Doc page for getting up and running on Ubuntu.

    If you don't already have SSH set up, you will probably want to get that up and running first.

    Below is a short version of what I ran to get up and running on 10.10.

    Install Server

      $ sudo add-apt-repository ppa:freenx-team
      $ sudo sed -i 's/maverick/lucid/g' /etc/apt/sources.list.d/freenx-team-ppa-maverick.list
      $ sudo apt-get update
      $ sudo apt-get install freenx
      $ cd ~/Downloads
      $ wget https://bugs.launchpad.net/freenx-server/+bug/576359/+attachment/1378450/+files/nxsetup.tar.gz
      $ tar -xvf nxsetup.tar.gz
      $ sudo cp nxsetup /usr/lib/nx/nxsetup
      $ sudo /usr/lib/nx/nxsetup --install
    

    Install Client

    There seems to be several NXClients available but I chose to try the NoMachine client which can be downloaded from here.

January

    Earlier this week I attended the first of seven classes of Kustom Design's Level 1 financial boot camp.

    paraphrased: "Accumulate assets that are valuable whether or not the financial system crashes." - Mike

    The class is taught by Michael E. Lepitre. Mike is super passionate about money, and it shows when he's teaching.

    Financial freedom: Where you do not have to work for money. Instead money works for you providing plenty to fulfill your purpose, enjoy life and allow your wealth to grow for future generations and charity.

    The 5 Steps

    1. Develop a closed circle budget.
    2. Eliminate bad debt (consumer & mortgage).
    3. Legally Minimize Taxes.
    4. Wealth accumulation & increase passive cash flow.
    5. Wealth preservation.

    Today's educational system focuses on:

    • academic education: ability to read, write and compute.
    • Professional education: learning a trade to earn money, to get a job.
    • NOT financial education: learning how to make money work for you.

    Classes of Investors

    • Non-investor (the poor)
      • consume everything they earn.
    • Active Investors
      • these people are entrepreneurs.
      • They invest first in becoming financial experts.
    • Passive Investors (the middle class)
      • believes in good education, a high paying job, home ownership and saving for retirement through a pension.
      • Turns their money over to financial experts to invest.

    Key Differences

    Passive Investors

    • no control
    • higher risks
    • banks will not lend money to them
    • higher taxes
    • worries about market crash
    • low returns
    • plan can run out of money
    • may never retire

    Active Investors

    • has control
    • lower risks
    • use bank's money (OPM)
    • uses insurance
    • may pay zero taxes
    • welcomes market crash
    • high returns
    • plan provides for generations
    • may retire early (choice)

    Cash Flow Quadrants

    • E Employee - You have a job
    • S Self Employed - You own a job
    • B Business Owner - You own a system & people work for you
    • I Investor - Money works for you.

    Employee

    • earns income, works for money, has a job.
    • Believes the harder you work, the more money you make.
    • Believes more money will solve their financial problems.
    • Searches for a safe secure job with good pay and excellent benefits.
    • Believes the level of formal education relates directly to receiving a higher income.
    • Taxes are their number one expense.
    • Invests in RRSPs and mutual funds.

    Self Employed

    • hardest working people on the planet.
    • Usually wear all the hats.
    • 90% fail after 5 years.
    • Work harder and longer than most employees and bring their work home with them.
    • Like to "be their own boss" and do it themselves.
    • Seek to be in control and resist delegating.

    Business Owner

    • surround themselves with smart people from all four quadrants
    • learn technical skills:
      • reading financial statements
      • marketing
      • sales
      • accounting
      • management
      • how to lead people
    • pay very little in taxes
    • protected by using corporations and trusts.

    Investor

    • knows that you must invest to be wealthy
    • have money working for them
    • do not invest in RRSPs
    • main focus on ROI (return on investment) and cash flow
    • pay the least amount of taxes
    • invest utilizing corporations and trusts

    investment income

    • interest income: taxed very high
    • capital gains income: taxed at 50%
      • if you buy one share at $10. Then watch it go up to $20, and sell it you will be taxed on the $10 increase at 50%.
    • dividend income: most tax advantageous

    There are people who become wealthy in each quadrant and sometimes derive income from different sources.

    History of Money

    • Before money, the barter system was used.
    • Silver, gold and other metals were the first forms of the monetary system.
    • Gold became the standard of currency banking.
    • The fiat money system has been tested for 2000 years (never with any long term success due to debt.)
    • The separation process of gold from paper money began in 1933.
    • In 1971, Richard Nixon took the US off of the quasi-gold standard.
    • Savers become losers because they were now saving a currency instead of saving money.
    • The problem with saving a currency is that a currency is designed to go down in value.

    Wake Up Call

    Banks make a tonne of money off of our money. E.G. If I deposit $100,000.00 in to the bank and I receive an interest rate of 3%. I can expect to make about $3000.00 in a year.

    The bank could then lend out $100,000.00 at a rate of 6% and make $6000.00.

    So far the bank has lost $3000.00 but gained $6000.00, so that would be about a 100% return for them.

    Apparently, banks can actually lend out 20 times that original $100,000.00 I put in. Which means that bank can lend out $2,000,000.00 at 6% and get a return of $120,000.00 in a year. It costs the bank $3000.00 and earns them $120,000.00. This sounds crazy!

    It's called fractional reserve banking

    Next, up it's time to visit the Finance section of the Khan Academy.

    2-3 rounds:

    • Pushup Hold
    • Extended Arm Hang
    • Dip Hold
    • Flexed Arm Hang

    2-3 rounds:

    • Pushups
    • Body Rows
    • Dips
    • Chinups

    Progress slowly with this as it's VERY intense!

    How do you replace a deprecated application that was built on top of Microsoft Content Management System (MCMS) 2002?

    You could recursively download the entire website and serve it up as static html pages. This is where you use a tool like wget.

      $ sudo apt-get install wget
    

    or download the wget package via cygwin.

      $ wget -r -p http://mokhan.ca/
    

    And there you have it. You now have a local copy of the target website.

    If you notice that some content wasn't pulled down, that should have been, it's likely because the site has a robots.txt file at root that disallows certain urls.

    links

    To install ssh in ubuntu

    $ sudo apt-get install openssh-client openssh-server
    

    To install in cygwin install the openssh package under "net". You will also need to run "ssh-host-config" after install to run the server.

    Then to ssh into your machine use the below command. The standard port is 22, but you should change this. You can either update the config file located at "/etc/ssh/sshd_config" or you can do a port forward on your public facing firewall.

      $ ssh mo@<server> -p <port>
    

    To copy files from a remote machine down to your local machine you can use the scp command.

    # copy from a remote machine to my machine:
      $ scp user@192.168.1.100:/home/remote_user/Desktop/file.txt /home/me/Desktop/file.txt
    
    # copy from my machine to a remote machine:
      $ scp /home/me/Desktop/file.txt user@192.168.1.100:/home/remote_user/Desktop/file.txt
    
    # copy all file*.txt from a remote machine to my machine (file01.txt, file02.txt, etc.; note the quotation marks:
      $ scp "user@192.168.1.100:/home/remote_user/Desktop/file*.txt" /home/me/Desktop/file.txt
    
    # copy a directory from a remote machien to my machine:
      $ scp -r user@192.168.1.100:/home/remote_user/Desktop/files /home/me/Desktop/.
    

    SSH & GIT

    When you need to manage public/private keys for different git repositories on one machine you can use a config file in your ~/.ssh/ directory. Using the config file you can specify which keys to use for specify urls.

    For example the following is a sample ssh config file.

    Host github.com
      User git
      Hostname github.com
      PreferredAuthentications publickey
      IdentityFile ~/.ssh/github/id_rsa
    
    Host unfuddle.com
      User git
      Hostname unfuddle.com
      PreferredAuthentications publickey
      IdentityFile ~/.ssh/unfuddle/id_rsa
    

    In some cases you may need to "ssh-add ~./ssh/github/id_rsa" each public key/pair. You may also have to "chmod 600 ~/.ssh/github/*"

    To figure out what key is being supplied when cloning a git repo you can ssh to the destination server using the git user. The following command should give you enough information to figure out what's going on.

      $ ssh -v git@github.com
    

    SSHFS

    To mount a remote filesystem.

      $ mkdir ~/godaddy
      $ sshfs -C user@user.com: ~/godaddy
      $ ls ~/godaddy
    

    To unmount

      $ fusermount -u ~/godaddy
    

    mount a remote file system

Archive