physioGEEKS! 0.001 Lives!

physioGEEKS!, a dream project that I have been planning for far too long now, lives!  (in the most rudimentary way)  It doesn’t do anything now, but my intention is to create both a toolbox and a community for Physical Therapists, and related fields.

In early operational form, I expect to be able to provide a few common assessment tests that many in the physical rehabilitation profession use – but, from my experience, struggle for consistent format and availability.  It’s true!  This profession, especially for Long-Term Care and Home-Care environments, are still using poor paper copies, when available, which are rarely accessible (not to mention legible) when the patient is to be tested again to measure gain/loss on the functional test.

In the longer range, I hope this site can grow in collaborative contribution and communications specific to the PT/OT/SLP rehabilitation professions and develop data driven tools to explore potential revelations, insights, perspective, and correlation’s that may be beyond our mere-mortal perspectives.

Anyway, for now, this is a simple, bare-bones, starter template RoR site… a seed, in fact… to grow. 

Frameworks, Scaffolds, and Rakes… Where I’ve Been, and What I’ve Been Up To

It’s been a long time… too long in fact.  If I am going to compose 1000 programs, I have a long way to go… a journey of 1000 programs starts with a simple “Hello World” – but it’s got to move on… somehow… some way… someday….

But development isn’t so simple to stuff into a “program” category these wild and wooly days.  In the world of web development, there is a way to spend a whole bunch of time and attention without being able to post a simple program to a lil’ ol’ blog… so, the best way to show a peek at what has been going on in Hakeonville, is a github link to my repositories.  It is here where the work of the past few weeks is found.

cheers!

8/1000: babyDragon.rb | undefined method `+’ for nil:NilClass (NoMethodError)

Houston, we’ve got a bug…

the following is the result of a command line run of babyDragon.rb

HAKEON-MacBook-Pro:ruby HAKEON$ ruby babyDragon.rb

babyDragon.rb:52: warning: found = in conditional, should be ==

What would you like to name your dragon?

Ted

Ted is born.

You feed Ted.

babyDragon.rb:87:in `passage_of_time': undefined method `+’ for nil:NilClass (NoMethodError)

from babyDragon.rb:32:in `feed’

from babyDragon.rb:118:in `<main>’

and this is the code

class Dragon

def initialize name
@name = name
@asleep = false
@stuff_in_belly = 10 #he is full
@stuff_in_intestive = 0 #he does not need to go

puts “#{@name} is born.”
end

def feed
puts “You feed #{@name}.”
@stuff_in_belly = 10
passage_of_time
end

def walk
puts “You walk #{@name}.”
@stuff_i_intestine = 0
passage_of_time
end

def put_to_bed
puts “You put #{@name} to bed.”
@asleep = true
3.times do
if @asleep
passage_of_time
end
if @asleep
puts “#{@name} snores, filling the room with smoke.”
end
end
if @asleep = false
puts “#{@name} wakes up slowly.”
end
end

def toss
puts “You toss #{@name} up into the air.”
puts “He giggles, which singes your eyebrows.”
passage_of_time
end

def rock
puts “You rock #{@name} gently.”
@asleep = true
puts “He briefly dozes off…”
passage_of_time
if @asleep
@asleep = false
puts “…but wakes when you stop.”
end
end

private

def hungry?
@stuff_in_belly <= 2
end

def poopy?
@stuff_in_intestine >= 8
end

def passage_of_time
if @stuff_in_belly > 0 || @stuff_in_intestine < 10
@stuff_in_belly = @stuff_in_belly – 1
@stuff_in_intestine = @stuff_in_intestine + 1
else
if @asleep
@asleep = false
puts “He wakes up suddenly!”
end
puts “#{@name} is starving! In desperation, he ate YOU!”
exit #terminates the program
end

if hungry?
if @asleep
@asleep = false
puts “He wakes up suddenly!”
end
puts “#{@name}’s stomach grumbles…”
end

if poopy?
if @alseep
@asleep = false
puts “He wakes up suddenly!”
end
puts “#{@name} does the potty dance.”
end
end
end

puts “What would you like to name your dragon?”
name = gets.chomp
pet = Dragon.new name
pet.feed
pet.toss
pet.walk
pet.put_to_bed
pet.rock
pet.put_to_bed
pet.put_to_bed
pet.put_to_bed
pet.put_to_bed

# Pine, Chris (2009-03-28). Learn to Program (Facets of Ruby)
# (Kindle Locations 3137-3142). Pragmatic Bookshelf. Kindle Edition.

7/1000: YAML & emacs

This is another Chris Pine exclusive, but this time I wrote the code via emacs… yes, I expect applause… thank you

# YAML is not actually part of the Ruby core (it is its own thing, and many other languages can use YAML),
# but it is part of the standard distribution. What does that mean? Well, when you install Ruby,
# you install YAML, too. But if you want to actually use YAML, you’ll need to import it into your program.
# This is really easy, though, with the require method.

# Pine, Chris (2009-03-28). Learn to Program (Facets of Ruby)
# (Kindle Locations 2543-2546). Pragmatic Bookshelf. Kindle Edition.

require ‘yaml’

test_array = [“No success like excess.”,
“If you can’t make it good, make it big.”,
“If you can’t make it big, make it red.”]

test_string = test_array.to_yaml

filename = ‘greatArtAdvice.txt’

File.open filename, ‘w’ do |f|
f.write test_string
end

read_string = File.read filename

read_array = YAML::load read_string

puts(read_string == test_string)
puts(read_array == test_array)

6/1000: pineQuote.rb | Saving and Loading for Grown-ups

# (a quote from Chris)
# Now that you’re good and afraid, let’s get to it.
# A file is basically just a sequence of bytes.
# A string is also, ultimately , just a sequence of bytes.
# This makes saving strings to files pretty easy, at least conceptually.
# (And Ruby makes it pretty easy in practice.)
# Here’s a quick example where we save a simple string to a file and
# then read it back out again.
# Pine, Chris (2009-03-28). Learn to Program (Facets of Ruby)
# (Kindle Locations 2508-2511). Pragmatic Bookshelf. Kindle Edition.

#variables for a text file and for a string
filename = ‘PineQuote.txt’
test_string = ‘Now that you’re good and afraid, ‘ +
‘let’s get to it.’

#save to file. the ‘w’ is for write-access to the file
File.open “filename”, “w” do |f|
f.write test_string
end #ruby closes filename with the end

read_string = File.read(“filename”) #load to variable read_string
puts(read_string == test_string) #test open/close/load algo

Github | hakeon/pinteresting

As I process through Mattel Griffel’s OneMonthRails course, my work will be publicly available via github repository hakeon/pineresting.  There are a few repositories under my account, all from various efforts to learn this stuff.  It’s funny, but I keep repeating the basics, sometimes in this language – some times in that, but it is always valuable to experience the fundamentals over and over again, from many sources.  Though of course the goal is to get out of the novice (nob) camp… someday…