testing p2, what else. need to figure out how to insert links
Recent Updates Toggle Comment Threads | Keyboard Shortcuts
-
Fernando
-
Fernando
-
Fernando
The Obvious Choice for NAHJ’s next VP of Online
This Saturday my four years on NAHJ’s board are about to come to a close. I have served with NAHJ’s best and brightest, the most committed and the most passionate. We accomplished much: established the VP of Online; established voting rights for the student representative, brought expenses in line with demand.
It’s not easy. But it never has been, never will be, and frankly, for the short-term at least is only going to get tougher.
Which is why the only obvious choice for NAHJ’s next VP of Online is Francisco Cortes.
As outgoing VP of Online, I know that it takes more than vision. It takes resources and support. Cortes has ample supplies of both.
NAHJ needs more than a web site. It needs a platform. Cortes has built one inside one of the largest media organizations in the world.
The VP of Online is one of the most important and influential positions on the board.
Francisco has carved out a voice for Latinos within Fox News at a time when our voice is most important.
Fox News Latino is a success. And part of an evolving investment in US Latinos by one of the largest media companies in the world.
Francisco is the highest ranking Latino at Fox News.
Be greedy for a moment. Think about what that means for NAHJ.
Cortes is one of the most influential Latinos in media. He’s not one to brag, or put himself out front. His results speak for themselves.
If we elect him, we’re not just getting a soft spoken, talented and generous journalist who is on the front lines. Through him, NAHJ gets a seat at one of the biggest tables in the game.
It’s an obvious choice. Francisco represents the future of our organization.
If you have voted, thank you. If you have not, consider what you can do with your voice. One minute of your time could put NAHJ inside one of the largest media companies in the world. Right now. VOTE NOW. You have until 5 p.m. PDT today to do so.
-
Fernando
Raghu’s Brain Buster – Code Academy homework
- Code Academy homework – no luck launching .rb file in Textmate from Terminal
- Code Academy homework – motherfucking success. Finally! Thanks John!
- Code Academy homework – rookie troubles with Terminal and irb
- Code Academy homework – Walking through Peter Cooper class tutorial Woof!
I’mI was stumped. I know what needs to be done but don’t know where to start. I have to add all of the elements in the shopping cart and calculate. I’m going to try to break it down to it’s smallest steps.I learned in reading Peter Cooper’s Beginning Ruby that I need to define the classes of products in one class Product. Then assign attributes to each of the objects within that class. I’m still fuzzy on whether I’m referring to them correctly, but I’m beginning to understand conceptually how they are related. (I think)
All elements in the shopping cart are objects, with their own attributes, pertaining to a class that can be compiled by a method shopping cart, which in this case is an array.
(If you’re confused at reading this, you’re not the only one. Bear with me, I’m trying to blog my way to understanding)
So before I try to calculate, I need to break each element out. I’m going to try that now.
11:22 pm – I’ve managed to get almost back to square one. And man am I rusty as a homework doer. I’ve got to find a way to define the attributes of each of the products in the shopping cart so I can do math. I’ve managed to define the elements in irb, and will now try to do so in textmate.
12:05 am – So I’m trying the .each, .times and do operations with no luck. But I just tried using Peter Cooper’s example on pet classes and objects. But I’m beginning to think the answer is obvious and that with all the prep in class I should have this. Will keep digging.
12:36 am – I finally realized it should be much simpler than I making it out to be. And that likely we have the logic, from class, that we need to solve the problem. Staring a full day tomorrow starting with class, then work, then painting and who knows what else will pop up before heading to Albuquerque, I submit and dial up Raghu’s answer sheet. And there it is, plain as day.
The lesson(s)?
- Pay more/better attention in class and learn to take better notes. Not just what was said, but important concepts on which to build later.
- Read, Read, Read. This shit isn’t going to learn itself.
- Campfire is our friend. John McCaffrey was an angel on Sunday night, answering my newbie questions.
And now that I think about it, I’m still stumped. But I’m going to keep making my way through Peter’s book and rereading the homework until I get it. Seeing the answer it’s obvious, but I was missing the critical piece, starting with total zero and looping.
I got this far:
- Long challenge: Based on the following data,
- write code that prints out the customer’s total, including estimated
- sales tax, based on the shipping address they entered.
- Your code should work even if the values of the data change.
- Your output should look like this: “Your total with tax is $4455.54.”
- shopping_cart = [
- {:name => "iPad 2", :price => 499, :quantity => 2},
- {:name => "iMac 27", :price => 1699, :quantity => 1},
- {:name => "MacBook Air 13", :price => 1299, :quantity => 1}
- ]
- sales_tax = {“IL” => 0.115, “IN” => 0.09, “MI” => 0.06, “WI” => 0.056}
- params = {
- :name => “Patrick McProgrammerson”,
- :address1 => “222 W. Merchandise Mart Plaza”,
- :address2 => “12th Floor”,
- :city => “Chicago”,
- :state => “IL”,
- :zip => “60654″
- }
- Now change the value of the key :state in the params hash to “WI” and run your code again.
- Encapsulate your code in a method if you haven’t already.
- The method should accept a cart, a hash containing tax rates, and an
- address as arguments.
- Now change the quantity of iMacs in the data to 3 and run your method.
- class Item
- attr_accessor :name, :price, :quantity
- end
- class Ipad2 < Item
- {Ipad2_name = “iPad 2″, Ipad2_price = 499}
- end
- class IMac < Item
- {Imac_name = “iMac 27″, Imac_price = 1699}
- end
- class Macbookair < Item
- {Macbookair_name = “MacBook Air 13″, Macbookair_price = 1299}
- end
shopping_cart = [
iPad2_hash = {:name => "iPad 2", :price => 499},
iMac27_hash = {:name => "iMac 27", :price => 1699},
Macbookair_hash = {:name => "MacBook Air 13", :price => 1299},
]
shopping_cart.each do |item|
puts item
end- iPad2 = Ipad.new
- => #<Ipad:0x107598c80>
- >> iPad2.price = 499
- => 499
- shopping_cart.each
- - – - The last part was from irb in terminal. – - -
And here is Raghu’s answer:
total = 0
shopping_cart.each do |item|
total = total + item[:price]*item[:quantity]*(1 + sales_tax[params[:state]])
end
puts “Your total with tax is $#{total}.”- Now change the value of the key :state in the params hash to “WI” and run your code again.
params[:state] = “WI”
total = 0
shopping_cart.each do |item|
total = total + item[:price]*item[:quantity]*(1 + sales_tax[params[:state]])
end
puts “Your total with tax is $#{total}.”- Encapsulate your code in a method if you haven’t already.
- The method should accept a cart, a hash containing tax rates, and an
- address as arguments.
def print_total(cart, taxes, address)
total = 0
cart.each do |item|
total = total + item[:price]*item[:quantity]*(1 + taxes[address[:state]])
end
puts “Your total with tax is $#{total}.”
end- Now change the quantity of iMacs to 3 and run your method.
shopping_cart[1][:quantity] = 3
print_total(shopping_cart, sales_tax, params)While I still have an interminably long way to understanding the fundamentals of Ruby, and coding, I am incredibly excited to have gotten this far. I couldn’t have done so without the help of John McCaffrey, who was a patient and generous CA community member holding my hand in the Campfire chatroom when I was having rookie problems with Terminal.
-
Fernando
“My toast has flown from my hand And my toast has gone to the moon. But when I saw it on television, Planting our flag on Halley’s comet, More still did I want to eat it.”
-
Fernando
All aboard for first day of Code Academy
I’ve been working on a bunch of different projects for the last 18 months but tomorrow is the beginning of chapter I’ve been trying to crack for years. We’re hours from my first day of school since I left college in 2004. I’m part of the Spring class of Code Academy, a sharp outfit breaking in the new 1871 space at Merchandise Mart. The story is a lot longer than I’ll put in this first post, but suffice it to say I’ll fill in the details as I go along.
I just wanted to make sure that I kept my personal goal of posting once a day for the next twelve weeks. I’m going to be publishing on several sites, whether it’s at work or on the soon-to-be-revealed site of NAHJ. But I wanted to commit to publishing here as I tread down the Ruby on Rails adventure. I’m thrilled to be part of the class and watching the threads on our Google Group tells me I’m in great company.
Some folks are incredibly bold, leaving jobs and home for twelve weeks in Chicago. I wish I was as gutsy as they are but I’m grateful I don’t have to be. I’m going to get my learn on and think big. Real big. As Daniel Burnham has been quoted as saying, ”Make no little plans. They have no magic to stir men’s blood and probably will not themselves be realized.”
I’m getting me a real big spoon.
But first a few props: This site is testament to the tremendous work done in beautiful Denver by Alex King‘s ninjas at Crowdfavorite. Not sure if they’ve been reading my mind or me theirs, but FavePersonal is the shit and a lot of #WP magic (that many developers would like to charge you thousands of dollars for) rolled (incredibly well and) stupid cheap (as in affordable, not bad). Go buy it for yourself now. My boss John Trainor for letting my crazy ass out of work on Monday and Wednesday mornings to go to class. And the great folks at Code Academy for giving me one of the 18 spots in the dev course. My baby for her galactic patience. Our dog for always welcoming us home. And the kids at Hoy – Chicago and vivelohoy for putting together one of the best newspapers in town and a damn fine web site to boot (We’re big in Mexico City, in case you were wondering).
-
Fernando
-
Fernando
-
Fernando
-
Fernando








