29
Prologue: Macau State of the Web 2009
First of all, welcome you all to the State of the Web: Macau 2009.
These blog series are focused in the state of the web design and development, the work being produced locally by the people of Macau, editorials and opinions will be shared, some of you may not agree and some you may, but hopefully it will be an interesting discussion from which we all can benefit.
The goal of these series is to raise awareness of the current state of the industry in Macau, to raise the expectations and levels of confidence in local talent, to educate the people acquiring these services and mostly to elevate our standards to an international level, as say Sidney, Melbourne, Japan, Singapore and Hong Kong.
Its my hope, we can stand tall and proud amongst our Asian peers.
Next Post in the Series: The State of Web Design in Macau.
28
Trying ECTO in MAC OSX
This is a post to WordPress blog, by using the tool called ECTO, i don’t know yet if i am going to use the tool or not, since i can post directly from the blog admin interface, but its enticing to see if from one tool i could post to all my accounts, probably a better tool exists out there, to post to facebook, twitter, youtube, blogs, etc, lets see.
22
Ruby on Rails Quick Tip #1: Loading models in Rails 2.0
Here is a quick tip, that i have learned, this applied to the book Beginning Ruby on Rails chapter 7 (page 206), in the book we were asked to load models (please remember that the book was published when the rails being used was 1.2.X, around 2007.
# Ruby on Rails - Quick Tip - Loading models in Ruby 2.X.X
# Book: Beginning Ruby on Rails Chapter 7 (page 206)
# Marco's notes: 2009.03.23
# We were asked to load models in the application controller
class ApplicationController < ActionController::Base
model :cart
model :purchases
end
# Results in this:
# undefined method `model' for ApplicationController:Class
# This ofcourse won't work in Ruby 1.8.6 (universal-darwin9.0)
# and Rails version 2.3.2
# So we try this:
class ApplicationController < ActionController::Base
require_dependency 'cart' # this solves the issue load :model
require_dependency 'purchase' # this solves the issue load :model
end
By the way, for those who have this book, the official forum for it is: Beginning Ruby on Rails.
Learn more about require_dependency .
I hope it was useful.
22
Ruby on Rails: Scaffold before and after 2.0
Here we are, i have spent quite some time figuring this out, hopefully google is our friend and patient as well, this example comes from doing the excelent Beginning Ruby on Rails book from Wrox, chapter 6 page 167.
Please read the comments on the code:
# Ruby on Rails - Learnt by example, Scaffold issue old vs new # Book: Beginning Ruby on Rails Chapter 6 (page 167) # Marco's notes: 2009.03.23 # In step 2 - Create a model named Item and a controller named Manage ... # Original code, as run by the Ruby 1.8.4 and Rails 1.2.1 (circa 2006) ruby script/generate scaffold Item Manage # Results in this: wrong number of arguments (1 for 2) # Topic available here: # http://groups.google.com/group/bangalorerug/browse_thread/thread/c08b0dccd17f06d1 # This ofcourse won't work in Ruby 1.8.6 (universal-darwin9.0) # and Rails version 2.3.2 # So we try this: # ruby script/generate scaffold model field:fieldType ... ruby script/generate scaffold Item name:string description:text price:float # This solves the issue in page 167, but remember that now your controller will be # items, not manage, so in the example would be http://localhost:3000/items
See, there you go, remember that after doing this, in your chapter 6, you won’t access your scaffold result by going to http://localhost:3000/manage but http://localhost:3000/items.
Beginning Ruby on Rails – Chapter 6 Wrong number of arguments.
Also a nice tutorial, although a bit long is: Rails 2.0 step by step.
Hope this has helped.
22
Code Syntax Highlight Test
Testing the code syntax highlight:
class Field < ActiveRecord::Base
# validates_format_of :data, #validates the email address is a correct one
# :with => /^([^@s]+)@((?:[-a-z0-9]+.)+[a-z]{2,})$/i,
# :message => "is not a valid email address"
# validates_inclusion_of :data,
# :in => 1..99,
# :message => "is out of bounds"
# validates_acceptance_of :check1,
# :message => "was not checked"
# validates_confirmation_of :data,
# :message => "should match confirmation"
# validates_length_of :data,
# :maximum => 8,
# :message => "its too long"
# validates_length_of :data,
# :minimum => 4,
# :message => "its too short"
protected
def validate
errors.add(:data, "is not 'Steve'") unless data == "Steve"
end
end
22
A Brave Story …
Just finished watching “A Brave Story”, a fantastic anime, a Brave Story is an awsome tale of young boy in current japan times, who faced with a sad destiny decides to change his fate by entering a fantasy world called “Vision”, in this surreal world, everything is possible …
The official site has been closed, so i will leave you with some other links:

A Brave Story
The wikipedia entry: Wikipedia: A Brave Story
The AnimeNewNetwork mini review: AnimeNewsNetwork: A Brave Story
I strongly recommend this anime movie, if you like japanese animation.
Rating: B+
22
A web ninja is born … or sort of …
Well here i am again, i don’t know how many times i tried to blog, my super powers have been weakened by the Styrofoam (same as in Bolt movie), well let’s try again shall wel.
I have no idea yet, how the blog thing will come out, mostly just a way for me to output whatever slurp of thoughts floating around in my brain, i bet it would be probably be alot of daily ramblings, game reviews, movie reviews coupled with some web design, coding articles and good links, stuff that i enjoy daily.
My writing will be super casual, not that technical either, even if the article is of technical type, i am not aiming for a super grammar correct blog, its for fun and if we all can learn something, then all the best.
So for the time being, hasta la viva muchachos, see you soon.




