Flash Player 10 Mobile for iPhone?

What are all the Rails Date Formats? 3
Ever forget what all the Rails defined Date/DateTime/Time#strftime formats are? Or forget what ones you added to the project yourself?
Ala rake routes comes rake date_formats:
Date
====
db:'%Y-%m-%d' 2008-08-20
long_ordinal:'&proc' August 20th, 2008
long:'%B %e, %Y' August 20, 2008
rfc822:'%e %b %Y' 20 Aug 2008
number:'%Y%m%d' 20080820
short:'%e %b' 20 Aug
DateTime
========
db:'%Y-%m-%d' 2008-08-20 16:56:21
long_ordinal:'&proc' August 20th, 2008 16:56
long:'%B %e, %Y' August 20, 2008 16:56
rfc822:'%e %b %Y' Wed, 20 Aug 2008 16:56:21 -0600
number:'%Y%m%d' 20080820165621
short:'%e %b' 20 Aug 16:56
Time
====
db:'%Y-%m-%d %H:%M:%S' 2008-08-20 16:56:21
long_ordinal:'&proc' August 20th, 2008 16:56
long:'%B %d, %Y %H:%M' August 20, 2008 16:56
rfc822:'%a, %d %b %Y %H:%M:%S %z' Wed, 20 Aug 2008 16:56:21 -0600
short:'%d %b %H:%M' 20 Aug 16:56
number:'%Y%m%d%H%M%S' 20080820165621
time:'%H:%M' 16:56
360Flex sessions video - Day one
Sessions Posted:
- TicketMaster Kiosk by Kevin Fauth
- Flex Accessibility by Giorgio Natili
- Reading the Flex source code by Jonathan Branam
- Project Workflow by Axel Jensen
- Creating Reusable Components by Ben Clinkbeard
Nested to_xml for awesome_nested_set
I was updating an example build using the better_nested_set to use the awesome_nested_set. One thing that I didn’t find in awesome_nested_set are some helper methods that are returning a full tree of the nested set as one XML document. With better nested set I could do
Category.result_to_attributes_xml(Category.root.ancestors)So I have added the following full_xml method to my nested active record to recurse all the children. Note that the full_method calls the full_method on the children passing along the xml builder that is created by the to_xml method and passed as the xml variable to block, thus building a nested XML document.
class Category < ActiveRecord::Base
belongs_to :parent, :class_name => "Category"
acts_as_nested_set
def full_xml(builder=nil)
to_xml(:builder => builder, :skip_instruct => true) do |xml|
children.each { |child| child.full_xml(xml) }
end
end
end Obviously it would be nice that the awesome_nested_set provides such a method.
So let’s assume I create the following nested structure:
Category.transaction do
root = Category.create(:name => "Main Category")
cameras = Category.create(:name => "Cameras & Photo")
cameras.move_to_child_of(root)
Category.create(:name => "Bags", :qty_in_stock => 2).move_to_child_of(cameras)
Category.create(:name => "Accessories", :qty_in_stock => 12).move_to_child_of(cameras)
Category.create(:name => "Analog Cameras", :qty_in_stock => 0).move_to_child_of(cameras)
Category.create(:name => "Digital Cameras", :qty_in_stock => 5).move_to_child_of(cameras)
phones = Category.create(:name => "Cell Phones")
phones.move_to_child_of(root)
Category.create(:name => "Accessories", :qty_in_stock => 8).move_to_child_of(phones)
Category.create(:name => "Phones", :qty_in_stock => 20).move_to_child_of(phones)
Category.create(:name => "Prepaid Cards", :qty_in_stock => 3).move_to_child_of(phones)
dvds = Category.create(:name => "Dvds")
dvds.move_to_child_of(root)
Category.create(:name => "Blueray", :qty_in_stock => 10).move_to_child_of(dvds)
Category.create(:name => "HD DVD", :qty_in_stock => 0).move_to_child_of(dvds)
Category.create(:name => "DVD", :qty_in_stock => 100).move_to_child_of(dvds)
end I can now get the whole nested structure in one go:
Category.roots.first.full_xmlAnd get the following XML in return.
<category>
<created-at type="datetime">2008-08-18T14:46:07Z</created-at>
<description nil="true"></description>
<id type="integer">1</id>
<lft type="integer">1</lft>
<name>Main Category</name>
<parent-id type="integer" nil="true"></parent-id>
<qty-in-stock type="integer" nil="true"></qty-in-stock>
<rgt type="integer">28</rgt>
<updated-at type="datetime">2008-08-18T14:46:07Z</updated-at>
<category>
<created-at type="datetime">2008-08-18T14:46:07Z</created-at>
<description nil="true"></description>
<id type="integer">11</id>
<lft type="integer">2</lft>
<name>Dvds</name>
<parent-id type="integer">1</parent-id>
<qty-in-stock type="integer" nil="true"></qty-in-stock>
<rgt type="integer">9</rgt>
<updated-at type="datetime">2008-08-18T14:46:07Z</updated-at>
<category>
<created-at type="datetime">2008-08-18T14:46:07Z</created-at>
<description nil="true"></description>
<id type="integer">14</id>
<lft type="integer">3</lft>
<name>DVD</name>
<parent-id type="integer">11</parent-id>
<qty-in-stock type="integer">100</qty-in-stock>
<rgt type="integer">4</rgt>
<updated-at type="datetime">2008-08-18T14:46:07Z</updated-at>
</category>
<category>
<created-at type="datetime">2008-08-18T14:46:07Z</created-at>
<description nil="true"></description>
<id type="integer">13</id>
<lft type="integer">5</lft>
<name>HD DVD</name>
<parent-id type="integer">11</parent-id>
<qty-in-stock type="integer">0</qty-in-stock>
<rgt type="integer">6</rgt>
<updated-at type="datetime">2008-08-18T14:46:07Z</updated-at>
</category>
<category>
<created-at type="datetime">2008-08-18T14:46:07Z</created-at>
<description nil="true"></description>
<id type="integer">12</id>
<lft type="integer">7</lft>
<name>Blueray</name>
<parent-id type="integer">11</parent-id>
<qty-in-stock type="integer">10</qty-in-stock>
<rgt type="integer">8</rgt>
<updated-at type="datetime">2008-08-18T14:46:07Z</updated-at>
</category>
</category>
<category>
<created-at type="datetime">2008-08-18T14:46:07Z</created-at>
<description nil="true"></description>
<id type="integer">7</id>
<lft type="integer">10</lft>
<name>Cell Phones</name>
<parent-id type="integer">1</parent-id>
<qty-in-stock type="integer" nil="true"></qty-in-stock>
<rgt type="integer">17</rgt>
<updated-at type="datetime">2008-08-18T14:46:07Z</updated-at>
<category>
<created-at type="datetime">2008-08-18T14:46:07Z</created-at>
<description nil="true"></description>
<id type="integer">10</id>
<lft type="integer">11</lft>
<name>Prepaid Cards</name>
<parent-id type="integer">7</parent-id>
<qty-in-stock type="integer">3</qty-in-stock>
<rgt type="integer">12</rgt>
<updated-at type="datetime">2008-08-18T14:46:07Z</updated-at>
</category>
<category>
<created-at type="datetime">2008-08-18T14:46:07Z</created-at>
<description nil="true"></description>
<id type="integer">9</id>
<lft type="integer">13</lft>
<name>Phones</name>
<parent-id type="integer">7</parent-id>
<qty-in-stock type="integer">20</qty-in-stock>
<rgt type="integer">14</rgt>
<updated-at type="datetime">2008-08-18T14:46:07Z</updated-at>
</category>
<category>
<created-at type="datetime">2008-08-18T14:46:07Z</created-at>
<description nil="true"></description>
<id type="integer">8</id>
<lft type="integer">15</lft>
<name>Accessories</name>
<parent-id type="integer">7</parent-id>
<qty-in-stock type="integer">8</qty-in-stock>
<rgt type="integer">16</rgt>
<updated-at type="datetime">2008-08-18T14:46:07Z</updated-at>
</category>
</category>
<category>
<created-at type="datetime">2008-08-18T14:46:07Z</created-at>
<description nil="true"></description>
<id type="integer">2</id>
<lft type="integer">18</lft>
<name>Cameras & Photo</name>
<parent-id type="integer">1</parent-id>
<qty-in-stock type="integer" nil="true"></qty-in-stock>
<rgt type="integer">27</rgt>
<updated-at type="datetime">2008-08-18T14:46:07Z</updated-at>
<category>
<created-at type="datetime">2008-08-18T14:46:07Z</created-at>
<description nil="true"></description>
<id type="integer">6</id>
<lft type="integer">19</lft>
<name>Digital Cameras</name>
<parent-id type="integer">2</parent-id>
<qty-in-stock type="integer">5</qty-in-stock>
<rgt type="integer">20</rgt>
<updated-at type="datetime">2008-08-18T14:46:07Z</updated-at>
</category>
<category>
<created-at type="datetime">2008-08-18T14:46:07Z</created-at>
<description nil="true"></description>
<id type="integer">5</id>
<lft type="integer">21</lft>
<name>Analog Cameras</name>
<parent-id type="integer">2</parent-id>
<qty-in-stock type="integer">0</qty-in-stock>
<rgt type="integer">22</rgt>
<updated-at type="datetime">2008-08-18T14:46:07Z</updated-at>
</category>
<category>
<created-at type="datetime">2008-08-18T14:46:07Z</created-at>
<description nil="true"></description>
<id type="integer">4</id>
<lft type="integer">23</lft>
<name>Accessories</name>
<parent-id type="integer">2</parent-id>
<qty-in-stock type="integer">12</qty-in-stock>
<rgt type="integer">24</rgt>
<updated-at type="datetime">2008-08-18T14:46:07Z</updated-at>
</category>
<category>
<created-at type="datetime">2008-08-18T14:46:07Z</created-at>
<description nil="true"></description>
<id type="integer">3</id>
<lft type="integer">25</lft>
<name>Bags</name>
<parent-id type="integer">2</parent-id>
<qty-in-stock type="integer">2</qty-in-stock>
<rgt type="integer">26</rgt>
<updated-at type="datetime">2008-08-18T14:46:07Z</updated-at>
</category>
</category>
</category>How do you deal with that situation?
iPhone in nearly every state. 147 out of 188 stores. 8

From hasiphone.com July 22nd 2pm.
hasiphone.com now with US map
Thanks to the Degrafa library I was able to add a “US Map of iPhone 3G” Availability in an hour to the hasiphone.com application.

Also I automated the extraction part of the data and check every hour if new data is there. I was assuming that the data changes only once a day and therefore all the delta (the + and – next to the availability) are based on previous day. This morning there were only four stores with iPhones, and hour ago 76 and now 78. So it seems that the data is updated more frequently or I have a bug in my extraction routing. Whatever the situation I am leaving on vacations for the next two weeks and won’t take my notebook with me, so hopefully the data is correct. My good friend Sol will keep an eye on the extraction process to see that we get some daily data. Thanks Sol, ya da man.
Enjoy! Daniel.
is cool
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 :-)