Apple Special Event, September 2010まとめ
ざっとメモのまとめ.
- 全世界で300店舗
iOS 4.1
- HDR photo
- Game Center
- 来週公開
- iPhone, iPod touch対応
iOS 4.2
- 印刷対応!!
- 2010 Nov公開
- iPad対応
- 275 million iPods Sold
- iPod classic以外刷新
- なぜかボタンインターフェース復活
- タッチインターフェース
- 大変な小型化
- Retina Display
- front/back camera
- Face Time
iTunes 10
Apple TV
- s/One more thing/One more hobby/
- 本体サイズが約1/4
- 映画のレンタル $4.99
- TV番組のレンタル $0.99
- TV番組レンタルで参入はABC/FOX
- 本体価格$99
- 初期販売はアメリカ,カナダ,イギリス,フランス,オーストラリア
iPhone OS 4.0 preview eventまとめ: Get a sneak peek into the future of iPhone OS
発表されました!! iPhone OS 4.0!!
もちろんリアルタイムで追っていたのですが,眠いのでメモをとってた内容を軽くまとめて寝ます.
Multitasking
- Background Audio API
- バックグラウンドでVoIP APIをたたける
- Background Location API (凄い!!)
- バックグラウンドタスクを管理するのにUIが素晴らしい
Folder UI
- アプリのインストール上限が2160までに一気に引き上げ
- Unified Inbox (複数アカウントを統合してinboxに)
- メールのThread表示
- 添付ファイルのopen
Enterprise
- データ保護のためのなんらかの機構
- Exchange Server 2010対応
- SSL VPN対応
Game Center
- Appleがゲームアプリ向けにプラットフォームを開放
- 友達の招待,マッチメイキング,戦績管理,ランキング管理とかやってくれる
iAd
その他
- リリースは今夏
- iPad対応は今秋
- 開発者にはbeta版を今日から配布
Erlang Lite #4の予習をやってみた
なんとなく時間ができたのでErlang Lite #4の予習やってみた.
とりあえずchap.4のexerciseを解いてみたのでそれだけ.
未だErlangよく分かってない上に英文読み違えてたりする可能性高しなのでつっこみよろしくお願いします!!
Ex.4-1
%% %% Exercise 4-1 %% An Echo Server %% %% -module(echo). -export([start/0, print/1, stop/0, loop/0]). %% %% echoサーバの起動 %% start() -> register(eserver, spawn(echo,loop,[])), io:format("echo server is running....~n"). %% %% echoサーバにメッセージ送信 %% print(Term) -> eserver ! {print, Term}. %% %% echoサーバの停止 %% stop() -> eserver ! {exit}. loop() -> receive {print, Term} -> io:format("~s (reply from echo server)~n",[Term]), loop(); {exit} -> ok; Other -> io:format("undefined message: ~p~n", [Other]), loop() end.
特につまづくポイントはないのかな?
ヒントの通りにサーバプロセスをregisteredにして,exitの時はloopの再帰を止めてあげる.
実行結果
bash-3.2$ erlc ./echo.erl bash-3.2$ erl Eshell V5.6.3 (abort with ^G) 1> echo:start(). echo server is running.... ok 2> echo:print("nya!!"). nya!! (reply from echo server) {print,"nya!!"} 3> echo:stop(). {exit} 4>
Ex.4-2
%% %% Excersize 4-2 %% The Process Ring %% %% -module(ring). -export([start/3, quit/0, init/0, init/1]). %% %% ringサーバの起動 %% start(M, N, Message) -> put(messagenum, M), % 回っているメッセージ数を保管しておく create_ring(N), send(M, Message). %% %% node0にM個のMessageを送信 %% send(0,_) -> ok; send(M,Message) -> node0 ! {message, Message}, send(M-1, Message). %% %% プロセスリングの生成 %% create_ring(N) -> Pid = spawn(ring, init, []), create_ring(N, N-1, Pid). create_ring(_N,1,NextPid) -> Pid = spawn(ring, init, [NextPid]), register(node0, Pid); create_ring(N,C,NextPid) -> Pid = spawn(ring, init, [NextPid]), create_ring(N, C-1, Pid). %% %% 回っているメッセージを止める %% quit() -> N = get(messagenum), % 回っているメッセージ数を調べる node0 ! {quit, N}. %% %% プロセス生成時のイニシャライザ %% init() -> put(next, node0), % 最後に生成されたノードはnextに最初のノードを定める io:format("init: ~p: next is ~p ~n",[self(), get(next)]), loop(). init(NextPid) -> put(next, NextPid), % nextに次のノードを設定する io:format("init: ~p: next is ~p ~n",[self(), get(next)]), loop(). %% %% M個のメッセージを無視する %% ignore_mes(0) -> ok; ignore_mes(M) -> receive {message, _} -> ignore_mes(M-1) end. loop() -> receive {message, Mes} -> io:format("~p: ~s~n", [self(), Mes]), Next = get(next), Next ! {message, Mes}; {quit, M} -> ignore_mes(M); Other -> io:format("undefined message: ~p~n", [Other]) end, loop().
問題文の言われる通りに作ってみたんだけど,なんか煩雑なコードになってる気がする.
リングプロセスは1つ前に作ったノードプロセスのPidを受け取りに,メッセージの送信先にしてやればOK.
最初に作ったノード(node0)はregisteredなプロセスにしてやって,最後のノードのメッセージ送信先に指定したり,メッセージを回す最初のノードに使う.
回るメッセージを止めるには,node0が回ってるメッセージのM個分を無視してやればいいので,そのようにignore_mes関数を実装してみました.
実行結果
(500ノードのプロセスリングで100のメッセージを回す) bash-3.2$ erlc ./ring.erl bash-3.2$ erl Eshell V5.6.3 (abort with ^G) 1> ring:start(100, 500, "nya!!"). .... 2> <0.466.0>: nya!! 2> <0.409.0>: nya!! 2> <0.405.0>: nya!! 2> <0.408.0>: nya!! 2> <0.480.0>: nya!! 2> ring:quit(). .... 3> <0.32.0>: nya!! 3> <0.33.0>: nya!! 3> <0.32.0>: nya!! 3> <0.33.0>: nya!! 3> <0.32.0>: nya!! 3> <0.32.0>: nya!! 3> (メッセージが止まった!!)
Apple "iPad"発表
まもなく大林檎祭 "Come see our latest creation"
ひさびさの大林檎祭がやってきました!!
いろんなうわさがとびかってるなか,ついしゃべっちゃう方まで出てきており,今回こそはAppleの本気のタブレットが発表されそうです.
個人的にタブレットで気になるポイントは,
- 一般アプリ開発の制限をなくすか?
- 一般アプリにマルチプロセス動作を許可するか?
- 言語の処理系を載せられない制限をライセンス条項から外すか?
なのですが,これらのどれかが外れたらそのまま購入してしまいそうなテンション感です.
イベントは日本時間2010Jan28THU03:00-です!!
ざっと箇条書きですが,うわさ系リンクと中継サイトをまとめておきます!!
[うわさ系リンク]
AppleのタブレットはiSlateと命名か? [TechCrunch]
The tablet Apple iPad on Apple.com [YouTube]
Is this the Apple tablet? [Engadget]
「アップル タブレット」らしき画像&仕様、価格など (画像追加) [Engadget Japanese]
Apple's iPhone dev program whoopsie: 'Need to update this for the 27th launch' [Engadget]
アップル、iPhone開発者サイトで「27日発表」を漏らす [Engadget Japanese]
アップルのタブレットは書籍・ゲーム・TVの大手がコンテンツ提供、WSJ報道 [Engadget Japanese]
Is This the Outside of the Apple Tablet? [Gizmodo]
[中継サイト]
Live from the Apple 'latest creation' event [Engadget]
速報:アップル "latest creation"イベント [Engadget Japanese]
Apple Press Event – Come See Our Latest Creation [SlashGear Live]
基調講演日本語通訳tweet [macwebcaster.com]
Apple Event Gizmodo Liveblog [Gizmodo]
アップルスペシャルイベント更新予定地 [Gizmodo Japan]
Apple takes stage amid tablet frenzy (live blog) [CNET news]
Apple's "Latest Creation" Live Event Coverage [Apple Insider]
Apple January 27 “Latest Creation” Media Event Live Coverage [TheAppleBlog]
Live Apple “Come see our latest creation” / tablet event coverage [gdgt live]
Live Coverage of Apple's 'Latest Creation' Event [iLounge]
Apple live blog: January 27th, 2010, 1 P.M. Eastern time [Computerworld Blogs]
Appleスペシャルイベント実況中継! [iphone&PC情報レポート]
Live Coverage: Apple’s Special Tablet Event [Wired.com]
Erlang Programmingのchapter3のexciseを途中まで
本日のErlang Lite #2の予習なんだけど,もう眠くなったのであきらめる!!
なので中途半端に途中までw.
Ex.3-1
%% ex1.erl -module(ex1). -compile(export_all). sum(1) -> 1; sum(N) -> N + sum(N-1). sum(N, M) -> if N == M -> N; N < M -> M + sum(N, M-1) end.
Ex.3-2
%% ex2.erl -module(ex2). -compile(export_all). create(0) -> []; create(N) -> create(N-1) ++ [N]. reverse_create(0) -> []; reverse_create(N) -> [N|create(N-1)].
Ex.3-3
%% ex3.erl -module(ex3). -compile(export_all). printnum(0) -> ok; printnum(N) -> io:format("Number:~p~n",[N]), printnum(N-1). printevennum(0) -> ok; printevennum(N) when N rem 2 == 0 -> io:format("Number:~p~n",[N]), printevennum(N-1); printevennum(N) -> printevennum(N-1).
Ex.3-4
%% db.erl -module(db). -compile(export_all). new() -> []. %% reserved function destroy(Db) -> ok. write(Key, Element, Db) -> [{Key,Element}|Db]. delete(Key, Db) -> case Db of [] -> []; [H|T] -> case H of {Key, Element} -> delete(Key,T); _ -> [H|delete(Key,T)] end end. read(Key, Db) -> case Db of [] -> {error, instance}; [H|T] -> case H of {Key, Element} -> {ok, Element}; _ -> read(Key,T) end end. match(Element, Db) -> case Db of [] -> []; [H|T] -> case H of {Key, Element} -> [Key|match(Element,T)]; _ -> match(Element,T) end end.
Ex.3-5
%% ex5.erl -module(ex5). -compile(export_all). filter(List, Target) -> case List of [] -> []; [Target|_T] -> [Target]; [H|T] -> [H|filter(T,Target)] end. reverse(List) -> case List of [] -> []; [H|T] -> reverse(T) ++ [H] end. concatenate(Lists) -> case Lists of [] -> []; [H|T] -> H ++ concatenate(T) end. flatten(List) -> case List of [] -> []; [H|T] when is_list(H) -> concatenate([flatten(H)|[flatten(T)]]); [H|T] -> [H|flatten(T)] end.
Ex.3-6 (quick sort)
%% ex6.erl -module(ex6). -compile(export_all). %% WikipediaのErlangのページのコードが参考になる quicksort([]) -> []; quicksort(List) -> case List of [Pivot|Rest] -> quicksort([ X || X <- Rest, X < Pivot]) ++ [Pivot] ++ quicksort([ Z || Z <- Rest, Z >= Pivot]) end.