4 stores out of 188 has iPhones 3G 5

The phones are going faster than they are coming, only one store in each of these states are listed as having one type of the models: Florida, New Hampshire, California and Michigan. So if you take into account that some store list phones that didn’t work out of the box as available, the Apples Stores may well be out of stock today.

Data from: Apple.com and visualized by hasiphone.com
hasiphone.com - Statistics and Overview of iPhone availability at US Apple Stores 8
As part of the iPhone 3G mania I checked out Apple iPhone 3G availability website and that’s how I found where to buy my iPhone in Denver. I was however also wondering how many Apple store still had the iPhone in the US, so I wrote http://hasiphone.com that provides an overview of the availability of the iPhone 3G in the US based on the data provided by Apple website.

On the server an AIR application checks once a day the new availability data, crunches it up and saves it a a serialized datastructure to a ByteArray. The Hasiphone Flex application reads this data and visualizes it. Well, I spend 4 hours (which I didn’t really have before my vacations) on it, so their may be some glitches here and there. Leave comment on this blog if you find any issues.
Also a note of caution on the data. Like Apple’s site mentions it’s updated only once a day in the evening. One of the sales guy also mentioned to me that any iPhone that has an issue and cannot be sold but still is in stock may appear as available, thus their are stores that don’t have any 3G to sell but still show up on the list.
iPhone 3G or not? 12
Since they announced the iPhone 3G I am pretty convinced that there isn’t much new over my current iPhone. Camera is still 2Mega pixels, the plastic case is not so nice, gps is cool, but I have one in my car, 16Gb over 8 could be useful, form factor changed slightly so it may not fit in my car cradle. So it’s basically the same phone with slightly faster internet. But I’m such a sucker when it comes to gadgets and I was just reading this article on How to replace an original iPhone with an iPhone 3G. Now if only my wife didn’t want my current iPhone, I wouldn’t have to buy the new one :-)
Compassionate Communications. A different kind of Rails application. 3
Running mod_rails on Leopard (OSX 10.5) 2
From the command line:
gem install passenger
sudo passenger-install-apache2-moduleThe Apache 2 module was successfully installed.
Please edit your Apache configuration file, and add these lines:
LoadModule passenger_module /Library/Ruby/Gems/1.8/gems/passenger-1.0.5/ext/apache2/mod_passenger.so
RailsSpawnServer /Library/Ruby/Gems/1.8/gems/passenger-1.0.5/bin/passenger-spawn-server
RailsRuby /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
Hey…where is the configuration. Google told me to read this blog entry: http://www.fuzzylizard.com/archives/2008/05/29/947/
So copy these three lines and add them to the end of this file: /etc/apache2/httpd.conf
$ sudo mate /etc/apache2/httpd.conf
Start and stop Apache go the to the System Preferences|Sharing and select the Web Sharing service:

Then the install script gives you the following instructions.
Deploying a Ruby on Rails application: an example
Suppose you have a Ruby on Rails application in /somewhere. Add a virtual host
to your Apache configuration file, and set its DocumentRoot to
/somewhere/public, like this:
<VirtualHost *:80>
ServerName www.yourhost.com
DocumentRoot /somewhere/public
</VirtualHost>
And that's it! You may also want to check the Users Guide for security and
optimization tips and other useful information:
/Library/Ruby/Gems/1.8/gems/passenger-1.0.5/doc/Users guide.html
Enjoy Passenger, a product of Phusion (www.phusion.nl) :-)
http://www.modrails.com/ Now where is “my” apache configuration file? And more important where is yours? On the command line do
$ ls /etc/apache2/users/
And I see daniel.conf, so let’s edit that one. I am developing one Rails app in this folder: /Users/daniel/SvnProjects/for/stockportfolio/rails. So let’s define this application in that conf file:
$ sudo mate /etc/apache2/users/daniel.conf
<Directory "/Users/daniel/SvnProjects/for/stockportfolio/rails/">
Order allow,deny
Allow from all
</Directory>
<VirtualHost *:80>
ServerName dev.stockportfolio.com
DocumentRoot /Users/daniel/SvnProjects/for/stockportfolio/rails/public
</VirtualHost>Note the /public at the end of the folder in the DocumentRoot. Now I am adding dev.stockportfolio.com in my /etc/hosts file. So just add the following line
127.0.0.1 dev.stockportfolio.comNow go back to the system preference sharing tab and restart the web service. Now you have your application running … in production mode. Just point your browser to dev.stockportfolio.com.
Enjoy Daniel!
Advanced Rails Studio: Day 3 1
We are onto the 3rd day of the training, and the guys are still kicking. We are now onto Asynchronous processing. That’s good as I needed to catch up on what’s out there. I didn’t know about Starling. A light-weight queue server, might be a better solution than the heavier BackgroundRb based on the scenario you need to address. Any of you using Starling? Chad now goes into creating a plugin…ReviewableFu! Now onto debugging. And Caching.
Thanks guys awesome training, you covered tons of good material. Again, really worthwhile if you want to go to the next level with Rails.
Advanced Rails Studio: Custom Form Builder 8
Custom Form Builder
Use a custom form builder to clean up your html.erb files.
class LabelFormBuilder < ActionView::Helpers::FormBuilder
helpers = field_helpers +
%w{date_select datetime_select time_select} +
%w{collection_select select country_select time_zone_select} -
%w{hidden_field label fields_for} # Don't decorate these
helpers.each do |name|
define_method(name) do |field, *args|
options = args.last.is_a?(Hash) ? args.pop : {}
label = label(field, options[:label], :class => options[:label_clas])
@template.content_tag(:p, label +'<br/>' + super) #wrap with a paragraph
end
end
endThen you can remove all the <p> and label tags from you form.
<h1>Editing user</h1>
<% form_for(@user, :builder => LabelFormBuilder) do |f| %>
<%= f.error_messages %>
<%= f.text_field :name %>
<%= f.text_field :address %>
<%= f.text_area :comment %>
<%= f.check_box :check %>
<%= f.submit "Update" %>
<% end %>
<%= link_to 'Show', @user %> |
<%= link_to 'Back', users_path %>Add this to your application initializer to have all form use this form builder
ActionView::Base.default_form_builder = LabelFormBuilder<% form_for(@user, :builder => LabelFormBuilder) do |f| %><% form_for(@user) do |f| %>Now the same form with no custom builder was looking like this before.
<h1>Editing user</h1>
<% form_for(@user) do |f| %>
<%= f.error_messages %>
<p>
<%= f.label :name %><br />
<%= f.text_field :name %>
</p>
<p>
<%= f.label :address %><br />
<%= f.text_field :address %>
</p>
<p>
<%= f.label :comment %><br />
<%= f.text_area :comment %>
</p>
<p>
<%= f.label :check %><br />
<%= f.check_box :check %>
</p>
<p>
<%= f.submit "Update" %>
</p>
<% end %>
<%= link_to 'Show', @user %> |
<%= link_to 'Back', users_path %>Advanced Rails Studio: Meta Programming 3
Chad is giving a very nice presentation walking us through meta programming step by step. You can see the code examples we are creating during his talk, but just looking at the code will note give the whole picture.
At the Advanced Rails Studio in Denver 1
We are just starting Day 2. Mike Clark and Chad Fowler are giving the training and are really good at it. They are 24 people taking the training, most not from Denver, and one from Mexico. Right now attendees are not awake and Mike and Chad are trying to wake us up. Yesterday we covered routes, looked at the Rails and Mongrel source code, looked at a RESTful application, covered ActiveResource, and checked ActiveRecord Associations. It’s nice to be able to sit back and take time to play with all these goodies without having to deliver code. It’s a nice refresher for me. Next step will be meta programming.
Here are some notes from the ActiveRecord Associations part of the training:
Join Model: has_many :through
Polymorphic Associations: has_many :address, :as => :addressable
Custom Finders:
class User
has_many :visits do
def recent(limiit - 5)
find(:all, :order => 'created_at DESC', :limit => 5)
end
endActive Record Scoping:
with_scope # protected now
before_filter :find_account
Scoped Relationships:
@event.registations.find(params[:id])
@user.events.find_by_id(params[:id])
@event.registations.find(:all, :conditions => "pre_register is true")class Event < ActiveRecord::Base
has_many :registrations
has_many :pre_registrations,
:class_name => "Registration",
:conditions => "pre_register is true"
end
@event.pre_registrationsNamed Scope:
class Coupon < ActiveRecord::Base
named_scope :limit_not_exceeded, :conditions => "use_count < max_uses"
named_scope :usable_in_store, :conditions => "external_only is false"
end
Coupon.limit_not_exceeded
Coupon.usable_in_store
Coupon.limit_not_exceeded.usable_in_storeDynamic Named Scope:
class Coupon < ActiveRecord::Base
named_scope :not_expired, lambda { { :conditions => ['expires_at > ?', Time.now] } }
named_scope :used_at_most, lambda { |uses| { :conditions => ['use_count <= ?', uses] } }
end
Coupon.not_expired
Coupon.used_at_most(30)
Coupon.not_expired.used_at_most(10)RailsConf 2008 Ruby Hero Awards Video 6
RailsConf 2008 Ruby Hero Award Video on Vimeo.
The guys over at Rails Envy somehow managed to present (and create) the Ruby Heroes Awards at RailsConf…funny as usual. Check out this video extracts from the talk.
UPDATE: what I didn’t mention for this video and what remi realized is that I was sitting way back in the room and took only sections of the video and it’s quite ruff and shaky.
