Friday, December 3, 2010

iPhone/iPad向けWebアプリ開発時のローカルファイルキャッシュ

最初理解できなかった。しかし、よく読んだらHTML5manifest機能を利用しているとわかった。
なるほどという感想だね。

iPhone/iPad向けWebアプリ開発時のローカルファイルキャッシュ
http://cloudcodedev.blogspot.com/2010/08/iphoneipadweb.html

iPhone/iPad向けのWebアプリケーションを開発する際、SenchaやjQTouchなどの
ライブラリーを活用してWebアプリケーションをあたかもネイティブアプリのように
振舞わせるわけだが、その際に避けて通れないのが
「ライブラリ・CSSなどのロード時の速度低下」です。

ライブラリやCSSなどのファイルのロードがかなり時間を食ってしまい、
利用者に「このページ遅いな」と思われてしまいます。

それを防ぐためには
「iPhone/iPadのフラッシュメモリ内にJavaScriptやCSSなどのファイルを保存させる」
という設定を行ないます。

この設定には「manifest」ファイルをサーバ側で用意し、manifestファイルには、
「どのファイルをローカルキャッシュさせるか」を記述してあげる必要があります。


以下に記述例を記載します。

使用するファイルの構成は以下の通りとなります。

【プロジェクトフォルダ内】
CSSファイル
/css/js/sencha_icons/mystyle.css
(元々app.yamlに以下の
- url: /css
  static_dir: css
という静的ファイルディレクトリ指定の設定をしています。)

JavaScirptファイル
/css/js/sencha_icons/ext-touch.js
/css/js/sencha_icons/index.js

作成したmanifestファイル
/css/js/sencha_icons/sitefile.manifest


1.まずはじめに、使用するHTMLファイル内のソースに



と記述します。
(example.manifestはexampleという名前のマニフェストファイルとなります。)


2.app.yamlに以下の内容を記述します。





- url: /css/js/sencha_icons/sitefile.manifest                        →所在URL
  static_files: /css/js/sencha_icons/sitefile.manifest          →ファイルの在処
  mime_type: text/cache-manifest                                        →mime_typeの指定
(↑これがないとマニフェストファイルとして認識されません。)
  upload: /css/js/sencha_icons/sitefile.manifest                →ファイルのアップロード先



3.sitefile.manifestファイル(ファイル名はsitefileでなくてもOK)を作成し、以下の内容を記述します。

CACHE:
mystyle.css
ext-touch.js
index.js

4.デプロイしてiPhone/iPadのブラウザで再読込する。


これで上記の3つのファイルがiPhone/iPadのローカルに保存され、
ページのロードが高速になります。




参考URL: http://www.html5rocks.com/tutorials/appcache/beginner/

Wednesday, November 17, 2010

Fixed positioning in Mobile Safari

Found a good site for fixed position on iPhone/iPad/iPod

There are several method to implement it. The best way is the new feature of iPhone OS 2.0.

"Fixed positioning in Mobile Safari
August 5, 2008

11/16/2010: It's been a long time since my fixed positioning script was released. I'm very pleased that it was the precursor for much more robust solutions to this problem. Please continue on if you'd like to read through the history of this hack. If you're looking for a real-world solution please take a look at one of the following, ranked (subjectively) in order of scroll performance:

Sencha Touch – A complete framework with fixed scrolling, custom widgets, and more.
YUI Scrollview – Standalone solution built on YUI3
iScroll – Completely standalone, no library dependencies

Update: An anonymous genius in the comments suggested using translateY instead of top for the animation. After some edits I've updated my demo, and it flies! The scrolling animation is smooth as silk. Apparently Webkit transforms are the only hardware-accelerated animations at this point. Thanks, random dude on the internet!

Update 2: This code is released to the public domain. You can use, modify, remix as you see fit.

Behold, fixed positioning on iPhone! http://doctyper.com/stuff/iphone/fixed/

Here's a video for those without iPhones. This is running in the iPhone Simulator bundled with the SDK. Note that the animation is much choppier on an actual iPhone.

With the release of iPhone OS 2.0 came some great improvements over previous Mobile Safari versions. CSS animations are in (though buggy), as well as native touch events like touchstart, touchend, gesturechange, etc.

I played around with these new goodies while hunting for improvements to build into Pickleview. The most fascinating change to me was that you can now prevent the default behavior of elements with a simple preventDefault() call. It allows a user to drag an element around the screen without having to worry about the viewport wobbling about.

I grew curious as to what I could specifically call this on, and started testing out several elements. Turns out you can preventDefault on everything in the DOM, including the body element. This seemed incredibly useless for no other reason than the terrible usability it would bring if you couldn't scroll the viewport. Then the proverbial light bulb went off: fixed positioning!

First, let's recap why fixed positioning does not work off-the-bat. Mobile Safari uses a viewport to show you websites. Imagine a book in front of you. Take a piece of paper, cut a 320×416 square in it, and lay it over the book. To read the book, move the paper around and position the hole over the words you want to see. This is exactly what Mobile Safari's viewport is doing. When you flick and scroll, you're moving the viewport around while the website behind it stays static.

This renders fixed positioning null and void on iPhone. An element that has its position fixed is affixed to the body, not the viewport. So it is actually working as intended, though most people would prefer it attached to the viewport.

There are workarounds in the wild, but these are inelegant. You can reposition an element onscroll, but a scroll event in Mobile Safari is only fired after scrolling has stopped. This results in an evident "glitch" since you have to a) flick to your desired position, throwing the element off-screen, and b) wait for the element to reappear in the viewport after scrolling has stopped.

By disabling the default scroll behavior on the body element, you essentially glue the viewport down to its initial starting point, where it's unable to go anywhere. This limits the viewport to exactly 320×416 pixels of space to show you. In this state, you have a perfectly useless experience.

This is where it gets interesting. In order to re-enable scrolling, I needed to only make the content area scrollable (think iframe, with header and footer above and below it). The touch and gesture events gives access to X/Y values, as well as timers and offset values. So by logging these and incrementing the top offset of the content area, we can create a scrollable block that does not affect the header or footer elements. A little spit and polish later: voila!

It's pretty evident from my proof-of-concept that CSS animations need a lot of work. They're promised to be "hardware-accelerated", but there's little proof of this. Most animations glitch, some to the point of non-use. The scrolling isn't particularly smooth and even something as simple as animating a 'top' CSS property takes its toll. Still it's usable, though I hope later Mobile Safari builds will address these issues.

If you're interested, I've bundled together the source files for my proof-of-concept. Grab 'em here."

Monday, November 8, 2010

テレビ会議の比較サイト

http://agtjapan.net/comparison.html

http://tvkaigi.hp2.jp/category/comparison

iPhone Snags 60% of Japanese Smartphone Market

iPhone Snags 60% of Japanese Smartphone Market

http://www.m2ri.jp/newsreleases/main.php?id=010120101026500

<<114849-japan_smartphones_apr_sep_2010.jpg>>

MobileCrunch reports on a new report from Japanese research firm MMRI claiming that Apple held a 60% share of the Japanese smartphone market for the period of April through September, easily outdistancing second-place Sony Ericsson's 20.6% share.

According to MMRI, a total of 2.23 million smartphones (Android/Windows Mobile/Blackberry/iOS/Palm) were sold in Japan between April and September this year, and 1.34 million (or 60.1%) of those were iPhones.

The report notes that smartphone sales more than doubled over the year-ago period, despite the fact that overall mobile phone sales in Japan grew by only 12%. With smartphones now approaching 12% of Japan's overall smartphone sales, Apple's dominant position in that rapidly-growing smartphone market has enabled it to grab 7% of the total mobile phone market there.

ARM��のリソ�ス

ARM Cortex-M3 システム��ガイド
http://www.cqpub.co.jp/hanbai/books/36/36491.htm
http://www.cqpub.co.jp/hanbai/books/36/36491/Contents/index.htm
μCOSII在Cortex-M3核ARM处理器上的移植
http://hi.baidu.com/comyboy/blog/item/968651095a5046a72eddd4bc.html


Monday, November 1, 2010

iPhone开发书籍

http://download.csdn.net/source/1120690 The Objective-C Programming Language-2006
http://download.csdn.net/source/1120832 Beginning iPhone Development Exploring the iPhone SDK 
http://download.csdn.net/source/1120883 Professional Iphone And Ipod Touch Programming,Building Applications For Mobile Safari

http://download.csdn.net/source/1120856 The iPhone Developer's Cookbook    
http://download.csdn.net/source/1121171 iPhone in Action Introduction to Web and SDK Development     
http://download.csdn.net/source/1121189 (开发iPhone程序必学的)O'Reilly.Objective-C Pocket Reference (2002)
http://download.csdn.net/source/1121193 O'Reilly.iPhone SDK Application Development
http://download.csdn.net/source/1121219 O'Reilly - Learning Cocoa with Objective-C, 2nd
http://download.csdn.net/source/1121264 (学习Objective-C最新最好的稀缺图书,配示例代码)Learn Objective-C On The Mac, 2009
http://download.csdn.net/source/1121268 (iPhone开发技术图书) OReilly.iPhone.Open.Application.Development.Mar.2008
http://download.csdn.net/source/1121269 (珍贵资源)Object-Oriented Programming And The Objective-C Language
http://download.csdn.net/source/1121692 (iPhone程序开发)Oreilly.iPhone.Forensics.chm
http://download.csdn.net/source/1121661 (iPhone开发C)The Objective-C 2.0 Programming.pdf
http://download.csdn.net/source/1121639 (开发iPhone必学图书)Sams.Programming.in.C.Jul.2003.pdf

Thursday, October 28, 2010

中国红木家具泡沫破灭 价格缩水百余倍

中国红木家具泡沫破灭 价格缩水百余倍    

http://news.creaders.net/headline/newsViewer.php?nid=449375&id=1017966&dcid=7

  _____  

经济观察报    2010-10-28 16:27:40      
       
   2007年10月在中国—东盟博览会上,曾经展出过一套价格为"8000万元"的老挝"红酸枝"家具,令人记忆犹新的是,这套家具的现场明确标出"价格不 打折,卖给有缘人"。

   2010年10月,同样在中国—东盟博览会的会场,《经济参考报》记者再次看到了包括"酸枝木"、"鸡翅木"、"紫檀木"、"黄花梨"在内的成套"红木 家具"。而这一次,鸡翅木的17件套,开价最高不超过17万元人民币;紫檀木的19件套,标价也不过19万元人民币。

  《经济参考报》记者采访的多位专家学者和业内人士认为:红木家具从天价暴跌的背后,是游资爆炒后撤离的恶果,而这一恶果,让整个家具行业付出了 惨重代价,数年都难以平复。

  博览会参展商家阮文成告诉《经济参考报》记者,"当年标出8000万元10件套的'天价家具',现在不到60万元就能买到19件套,价格缩水了 100多倍还不止。原来卖一套家具能买一架'空中客车',现在可能还买不到一台越野车!"

  当年接受《经济参考报》记者采访的红木家具经销商黄鹏曾经介绍:"酸枝木是广义上的红木家具,此类木材生长周期很长,成才基本上都要上百 年,2003年的酸枝木价格还不过7000元/吨,2007年的间隔已经飙升到35000元/吨。"

  而在本届博览会上,参展商家阮文成告诉《经济参考报》记者,红木家具系列中的酸枝木,价格已经从当年的近80万元/吨,跌落到不到10000元 /吨,价格缩水的速度之快,令人瞠目。

  原料价格的缩水带来的自然是下游产品的销售价格迅速跳水。《经济参考报》记者在广西凭祥、东兴等边境口岸和南宁、柳州、桂林等家装展会、家具场 采访时,绝大部分红木家具销售商认为,从2007年上半年达到巅峰以来,就一路下滑,目前为止,价格已经"跌落"到只有当年的百分之一甚至二百分之一。

  凭祥红木家具销售商黄翔告诉记者,2006年至2007年是价格疯涨的一年,2005年黄花梨、紫檀木的价格不过10万元至20万元一 吨,2007年8月,黄花梨就达到每吨250万元至270万元,紫檀超过每吨70万元至80万元,那几年,红木家具行当产生了一个接一个一夜暴富的神话。

  黄翔说:"但现在的价格,低得让人心痛,不仅原料价格超跌,家具市场也呈现出有价无市的局面。"

  黄翔告诉记者,2006-2008年上半年,几乎每个月都能有200-300万元的进账,江浙、福建一带的老板,看到店家有红木原料,不管品质 怎样,不管能否按时交货,直接就砸钱购买。从2008年下半年开始,市场迅速萎缩,如今一年到头可能都进不了100万元的货款。

  曾经多次在电视台"收藏"、"家珍"一类的栏目推荐红木家具的收藏爱好者蔡利强说:"现在我再也不说红木家具能保值增值了,因为 2006-2007年入行的亲戚朋友抢购的红木家具,现在都在骂我呢。"

  《经济参考报》记者对多位业内人士进行采访时,一个较为普遍的观点是:"红木家具"从"天价"到"地价"的迅速变化,与大量游资涌入其中进行疯 狂炒作密切相关,如今,炒作的游资早已纷纷离场,但由此导致的红木家具"产—供—销"环节的混乱,使整个产业面临着严重的危机。

  常年在福建、广东、北京、云南等地拥有多家"红木家具"销售场所的商人胡斌琳告诉记者,2003-2007年是"红木家具"飙升最为迅猛的时间 段,按照"红木家具"市场的基本规律,一般来说,家具每年增值15%-25%之间,属于较为正常的速度。但2003-2007年之间,"红木家具"的势头 几乎每年都是以"翻筋斗"的速度在飙升。

  胡斌琳说:"以最贵的海南黄花梨为例,2003年的价格不过3万多元/吨,但2004年就涨到6万元/吨,2005年飙升到12万元 /吨,2006年涨到80万元/吨,2007年迅速飙升到近300万元/吨。完全不符合这个市场的运行规律。"

  早在上世纪70年代就开始收集红木家具的收藏爱好者杜成峰分析认为:从后来了解的情况看,完全是因为有大量场外资金涌入红木家具市场,在短短几 年时间里,通过囤积居奇、买空卖空、拉高出货……等一系列手法,将红木原料和家具炒到了"天价"。

  杜成峰说:"当年流入红木家具市场的资金,要比原来已经入场的资金多200-300倍,由于行业内对这样的资金流向很不清楚,相互之间也缺乏原 料信息的互通有无,因此,在很短时间里,行业的所有原料几乎都'节节看涨',实际上是因为原料都垄断到职业炒家手中,缺货的业内人士只能眼睁睁看着价格飙 升。"

  最让这些红木家具经销商、收藏爱好者们懊悔的是:最初他们认为"稀缺"、"绝技"、"保存年代长"、"增值速度稳定"的"推销说法",成为"职 业炒家"们将价格"吹高"的最大推手。

  《经济参考报》记者在中越边境市场、家具制造企业和家具销售卖场暗访时却发现,仍然有相当一部分商家在混淆"红木"、"硬木"的标准,并以"标 准"没有强制执行力,来向消费者"答疑解惑"。

  记者深入采访时,不少业内人士认为,即使是红木家具进入"裸泳时代",一些企业也遭遇了"大浪淘沙"的行业洗牌,行业内部也出台了相关的标准, 但从实际情况看,行业混乱的状况并未彻底改变,市场的信心尚未得到提振。

  2008年9月1日,红木家具的新标准《中国深色名贵硬木家具标准》出台,规定销售的红木家具必须标明产品名、木材、辅料、木材产地、质量等 级、涂料、规格等。这一标准曾经被业内人士寄予厚望,认为是"规范红木标准、实现市场洗牌"的重要措施。

  然而,《经济参考报》记者在南宁富安居、柏图家居、春城家具等多家家具市场进行随机采访时,调查的63位"红木家具"销售商及其推销人员,超过 一半以上没有听说过有《中国深色名贵硬木家具标准》;2/3的表示"标准是标准,但我们企业有自己的生产规范,别的很多企业达不到的,我们都能达到。"; 还有30%左右的促销员明确表示"我们生产的是'红木'不是'原木',品质自然会有差别"……

  南宁"富安居"家具城的多位家具促销员表示:"《中国深色名贵硬木家具标准》是针对'硬木'而言的,'红木'不是'硬木',现在市场上销售的木 制家具,大部分都是胡桃木、乌木、水曲柳木等,'红木'的 价 格 就 是 再 低 , 也 要 比 这 些 木 料 价 格高。"

  胡斌琳告诉记者,目前"红木家具"的成套市场上仍然有不少混乱的情况,如到底用料多少称为"红木家具",比例占到百分之几以上才能称为"红木家 具";"红木"用料在哪些位置,是整块红木还是拼装红木……

  胡斌琳说:"这些别说没有产业标准,就是有产业标准,企业和商家在没有监管的情况下,也不会严格执行。因为谁都知道,老老实实做家具,要不就是 价格太高卖不出去,要不就是卖出的价格连本都赚不回来。"