The Trifitness Calendar

Tuesday, December 6, 2011

time to think is a bitch

[Woman on phone] “Hello Yeah I just walked in Yeah I’m good you still working? tonight, right now? ‘Did i go out’ yeah I went out I went, i went to a couple of clubs I never went to bed shit… wine or water You should see someone about a cold drink I don’t know, I’m delirious… night” [Drake - Verse 1] Cups of the Rose Bitches in my old phone I should call one and go home I’ve been in this club too long The woman that I would try Is happy with a good guy But I’ve been drinking so much That I’ma call her anyway and say “Fuck that nigga that you love so bad I know you still think about the times we had” I say “fuck that nigga that you think you found And since you picked up I know he’s not around” (Are you drunk right now?) I’m just sayin’, you could do better Tell me have you heard that lately? I’m just sayin’ you could do better And I’ll start hatin’, only if you make me Uh, cups of the XO All my people been here I see all of her friends here Guess she don’t have the time to kick it no more Flights in the morning What you doing thats so important? I’ve been drinking so much That I’ma call you anyway and say “Fuck that nigga that you love so bad I know you still think about the times we had” I say “fuck that nigga that you think you found And since you picked up I know he’s not around” (Are you drunk right now?) I’m just sayin’, you could do better Tell me have you heard that lately I’m just sayin’ you could do better And I’ll start hatin’, only if you make me I think I’m addicted to naked pictures And sittin talkin’ ’bout bitches that we almost had I don’t think I’m concious of making monsters Outta the women I sponsor til it all goes bad But shit it’s all good We threw a party, yeh we threw a party Bitches came over, yeh, we threw a party I was just calling cause they were just leaving Talk to me please, don’t have much to believe in I need you right now, are you down to listen to me? Too many drinks have been given to me I got some women thats living off me Paid for their flights and hotels I’m ashamed Bet that you know them, I won’t say no names After a while girl they all seem the same I’ve had sex four times this week I’ll explain Having a hard time adjusting to fame Sprite in that mixture, I’ve been talking crazy girl I’m lucky that you picked up Lucky that you stayed on I need someone to put this weight on [Drake and Woman on phone] “Well I’m sorry” – Drake “Are you drunk right now?” – Woman I’m just sayin’, you could do better Tell me have you heard that lately I’m just sayin’ you could do better And I’ll start hatin’, only if you make me [Drake on phone] “You’re not going to come?” “Guess i’m bout to just kick it here then…” Just throw up while I hold your hair back Her white friend said “you niggas crazy” I hope no-one heard that I hope no-one heard that Cause if they did, we gonna be in some trouble

Monday, November 21, 2011

music

A bunch of really hot artists have been active lately, fun to watch. Drake's im so proud of you struck a chord, or a cord. either way it worked

Sunday, November 20, 2011

last 1 for now

I am about done with joe and fred, here is the last one for a while before more work. yippee aye kiyay

#include 

using namespace std;

class Person 
{
protected:
 char *gender;
 double height, weight;
public:
 Person(char *g, double h, double w)
 {gender = g; height = h; weight = w;}

 void walks(int steps, char *dir)
  { cout << "I walked " << steps << " steps in " << dir << " direction\n"; }
  
 void talks(void)
  { cout << "Hello World!!\n"; }
};

class MailMan : public Person
{
protected:
 int bagWeight, routeLen;
public:
 MailMan(int b, int r, char *g, double h, double w): Person(g, h, w)
  {bagWeight=b; routeLen=r;}
 int delivery_time(void)
  {return bagWeight * routeLen;}
 void mailboxes_seen(void)
  { cout << "I saw " << routeLen << " mailboxes today!\n"; }
};

int main
(void)
{
 Person *fred = new Person("male", 6.0, 175.5);
 fred->talks();
 fred->walks(5, "north");
 
 MailMan *joe = new MailMan(5, 10, "male", 5.7, 140.2);
 joe->mailboxes_seen();
 joe->talks();
 cout << "Joe's estimated delivery time is " << joe->delivery_time() << "\n";
 joe->walks(9, "left");

 return 0;
}

// 

more objects

So while rewriting this in c and haskell is still a work in progress, here are a few more examples
gender = $gender;
        $this->height = $height;
        $this->weight = $weight;
    }
    
    public function talks() {
        echo "Hello World!!\n";
    }
    
    public function walks($steps, $direction) {
        echo "I walked ".$steps." steps in ".$direction."\n";
    }
}

class MailMan extends Person {
    public $bagWeight;
    public $routeLen;
    
    public function _construct($gender, $height, $weight, $bagWeight, $routeLen) {
        parent::_construct($gender, $height, $weight);
        $this->bagWeight = $bagWeight;
        $this->routeLen = $routeLen;
    }
    
    public function delivery_time() {
        return $this->bagWeight * $this->routeLen;
    }
    
    public function mailboxes_seen() {
        echo "I saw ".$this->routeLen." mailboxes today!\n";
    }
}

$fred = new Person("male", 6.0, 175);
$fred->talks();
$fred->walks(5, "west");

$joe = new MailMan("male", 5.5, 140, 5, 10);
$joe->talks();
echo "Joe's estimated delivery time is ".$joe->delivery_time()."\n";
$joe->mailboxes_seen();
$joe->walks(9, "right");

?>
if(!console){
    console.log = function(s){
        print(s);
    }
}

function Person(g, h, w) {
    this.gender = g;
    this.height = h;
    this.weight = w;
    
    this.talks = function() {
        console.log("Hello World!!");
        return false;
    }
    
    this.walks = function(steps, direction) {
        console.log("I walked "+steps+" steps in "+direction);
        return false;
    }
}

MailMan.prototype = new Person();
MailMan.prototype.constructor=MailMan;
function MailMan(g, h, w, b, r) {
    this.gender = g;
    this.height = h;
    this.weight = w;
    this.bagWeight = b;
    this.routeLen = r;
    
    this.delivery_time = function() {
        return this.bagWeight * this.routeLen;
    }
    
    this.mailboxes_seen = function() {
        console.log("I saw "+this.routeLen+" mailboxes");
        return false;
    }
}

fred = new Person("male", 6.0, 175);
fred.talks();
fred.walks(4, "north");

joe = new MailMan("male", 5.5, 140, 10, 5);
joe.talks()
console.log("My estimated delivery time is "+joe.delivery_time());
joe.mailboxes_seen();
joe.walks(8, "right");

Tuesday, November 15, 2011

a ruby person

here is another example and then I am done procrastinating and back to work. this re-implements the person classes in ruby rather than python if python is not your thing
#!/usr/bin/env ruby
class Person
    def initialize(gender, height, weight)
        @gender = gender
        @height = height
        @weight = weight
    end

    def talks
        "Hello World!!"
    end

    def walks(steps, direction)
        "I walked #{steps} to the #{direction}"
    end
end

class MailMan < Person
    def initialize(gender, height, weight, bagWeight, routeLen)
        super(gender, height, weight)
        @bagWeight = bagWeight
        @routeLen = routeLen
    end

    def delivery_time
        @bagWeight * @routeLen
    end

    def mailboxes_seen
        "I stopped at #{@routeLen} mailboxes"
    end
end

fred = Person.new("male", 6, 175)
puts fred.talks
puts fred.walks(5, "north")

joe = MailMan.new("male", 5.75, 140, 10, 5)
puts "Joe's estimated delivery time is #{joe.delivery_time}"
puts joe.walks(10, "right")
puts joe.talks
puts joe.mailboxes_seen
 
the most important part of programming really is just playing around and seeing if you can actually do what you want, usually you can, or you can teach yourself how after many hours of trying

Monday, November 14, 2011

A quick view of objects

Here is a quick intro to object oriented programming, the great new buzzword in modern programming. Its really quite simple, I will try to put this out in as many languages as I can, but here it is in python. The long short is that anything you can describe can be an object, for our example we're going to use people, fred and joe. Fred is a poor simple soul, nothing too special, joe however is a mailman. now a mailman should have all of the characteristics of a person, but he will need some extra stuff. However, it would be a waste of time to completely redefine everything they share as people just to create a mailman. so we make a object based off an object and voila. in the technical speak, we have classes and subclasses. pythons explicitness helps this a bit i think. without further ado, the code, enjoy
#!/usr/bin/env python
# coding: utf-8

#person, our first object
class Person(object):

#person traits
    gender = None
    height = None
    weight = None

#define our person object
    def __init__(self, gender=None, height=None, weight=None):
        self.gender = gender
        self.height = height
        self.weight = weight

#identify some actions
    def talks(self):
        print('Hello World')

    def walks(self, steps, direction):
        print('I walked %d steps to the %s' % (steps, direction))

#notice not an object, a Person
class MailMan(Person):
    routeLen = None
    bagWeight = None

#re inited with extra arguments **kwargs is shorthand for all of the person args
    def __init__(self, bagWeight, routeLen, **kwargs):
        self.bagWeight = bagWeight
        self.routeLen = routeLen
# super makes sure we know we are a sub class
        super(MailMan, self).__init__(**kwargs)

#new mailman specific actions
    def delivery_time(self):
        return self.routeLen * self.bagWeight
    
    def mailboxes_seen(self):
        print('I stopped at %d mailboxes' % self.routeLen)

if __name__ == '__main__':
#poor plain fred
    fred = Person(gender='male', height=6, weight=175)
    fred.talks()
    fred.walks(5, 'north')
#joe the mailman is just so much cooler
    joe = MailMan(10, 5, gender='male', height=5.75, weight=140)
    print('Joe\'s estimated delivery time is %d' % joe.delivery_time())
    joe.walks(5, 'right')
    joe.talks()
    joe.mailboxes_seen()

  
There you have your quick intro to objects, not so bad was it

Friday, November 11, 2011

life and stuff

So yea, i ride bikes and stuff, but the latest pressure has been coding on a coference call, next trick, live on stage at a conference. that and there are job listing that give me faith there is still home in the coding world thats it too much work and not enough play, coming soon a lesson on objects