tag:blogger.com,1999:blog-30400276234347638322024-02-20T00:47:08.943+08:00Experimenterrm -rf *Anonymoushttp://www.blogger.com/profile/07515835891250773234noreply@blogger.comBlogger226125tag:blogger.com,1999:blog-3040027623434763832.post-89652765860849811042017-01-13T17:00:00.000+08:002017-01-16T20:06:32.701+08:00這星期看的文章 (1/9/2017 ~ 1/13/2017)<h2 style="height: 0px;">
健康 <a href="http://news.tvbs.com.tw/health/698262?utm_source=linetoday&utm_medium=line" rel="nofollow" target="_blank">護眼營養品哪個好</a></h2>
<div>
<br /></div>
<div>
<br /></div>
<div>
<span style="font-family: inherit;">對長期使用3C產品的辛苦勞工朋友,如何保護靈魂之窗,更顯得重要。文章列出市面上常見的護眼營養品,分析其優缺點。</span></div>
<div>
<span style="font-family: inherit;"><br /></span></div>
<div>
<h2>
<span style="font-family: inherit;">產品設計 <a href="https://getpocket.com/explore/item/how-technology-hijacks-people-s-minds-from-a-magician-and-google-s-design-ethicist-1300144185" target="_blank">How Technology Hijacks People's Minds</a></span></h2>
</div>
<div>
<span style="font-family: inherit;">許多頂尖設計團隊在設計商品時,都將心理學家對人類認知和行為的最新研究成果應用在產品上。這篇文章裡的許多概念在 <<a href="https://www.amazon.com/Hooked-How-Build-Habit-Forming-Products-ebook/dp/B00HJ4A43S" target="_blank">Hooked: How to Build Habit-Forming Products</a>> 也都有提到。我們的行為和生活方式正不知不覺中被這些科技產品綁架。</span></div>
<div>
<span style="font-family: inherit;"><br /></span></div>
<div>
<h2>
<span style="font-family: inherit;">新創觀察 <a href="https://rocket.cafe/talks/81444" target="_blank">Uber和傳統計程車之爭,到底誰得利?</a></span></h2>
<div style="background-color: white; border: 0px; color: #444444; font-stretch: inherit; letter-spacing: -1px; line-height: 1.3em; margin: 10px 0px; padding: 0px; vertical-align: baseline; word-wrap: break-word;">
自從Uber進入台灣市場後,備受爭議。這篇文章作者以親身經歷,來討論到底Uber是否有如其支持者所說的這麼好,小黃是否就真的應該被淘汰?</div>
</div>
<div>
<span style="font-family: inherit;"><br /></span></div>
<h2>
<span style="font-family: inherit;">金融市場</span></h2>
<h3>
<span style="font-family: inherit;"><a href="https://cointelegraph.com/news/chinas-central-bank-is-raiding-bitcoin-operators-bitcoin-price-is-tumbling" target="_blank">China's Central Bank is Inspecting Bitcoin Operators</a></span></h3>
<div>
<span style="font-family: inherit;">近來由於國際政經情勢的變化,造成美金走強與人民幣走貶。這促使中國民眾為防止持有的人民幣資產貶值,利用Bitcoin將資產轉出中國。國家匯兌管制有助於控管境內不法事業活動。而Bitcoin的私密性,使得人民可繞過國家匯兌管制,將資產流出中國。</span><br />
<span style="font-family: inherit;"><br /></span></div>
<div>
<h2>
<span style="background-color: white; color: #424858;">危機處理技巧 </span><a href="http://blog.dilbert.com/post/102627983751/high-ground-maneuver" style="font-family: inherit;" target="_blank">High Ground Maneuver</a></h2>
</div>
<div>
<span style="font-family: inherit;">處理公眾危機時,先將問題範疇提升到一個所有人都無法辯駁的層面,再回到個人或公司如何處理問題上,藉以降低公眾對公司或個人犯錯的不可忍受程度。</span><br />
<span style="font-family: inherit;">實際的例子有蘋果在處理2014年iPhone天線門事件時,Steve Jobs在面對記者提問時,</span><br />
<blockquote class="tr_bq">
<span style="background-color: white; color: #231f20; font-size: 20px;"><span style="font-family: inherit;">“We’re not perfect. Phones are not perfect. We all know that. But we want to make our users happy.” </span></span></blockquote>
<span style="font-family: inherit;">"We're not perfect. Phones are not perfect. We all know that" 這先將問題本身提升到眾人無法辯駁的層次(哪家手機廠敢說自己手機都沒問題?)。</span><br />
<span style="font-family: inherit;">"But we want to make our users happy" 這讓大家認為蘋果正在努力處理一個所有手機都有可能發生的問題。</span><br />
<span style="font-family: inherit;"><br /></span> <span style="font-family: inherit;">另一個想到的例子是多年之前成龍在說明外遇的記者會上所說的,</span><br />
<blockquote class="tr_bq">
<span style="font-family: inherit;">我犯了所有男人都有可能犯的錯</span></blockquote>
<span style="font-family: inherit;">這先將這事件提升到一個無法辯駁的層次(哪個人敢說自己不可能犯這種錯?),再接著說自己自己盡多大努力來補救。</span><br />
<span style="font-family: inherit;"><br /></span> <i><span style="font-family: inherit;">簡而言之,先將所有人都拖下水,形成共犯結構後,在磕頭認錯。 </span></i></div>
Anonymoushttp://www.blogger.com/profile/07515835891250773234noreply@blogger.comtag:blogger.com,1999:blog-3040027623434763832.post-51566033451054399372017-01-11T14:32:00.000+08:002017-01-11T14:49:32.195+08:00常用的 Apps <h2>
feed.ly</h2>
喜歡其簡單,而不像Flipboard那般華麗的介面。<br />
<br />
<h2>
Pocket</h2>
我使用的模式是將所有在瀏覽社群網站或Feedly時覺得有趣的文章,先加入Pocket。等到有空時再慢慢看,若覺得有參考價值,就在加進Evernote裡。Pocket的文章推薦功能也非常好。有許多新知或好的內容都是經由他的推薦列表。<br />
<br />
<h2>
Evernote</h2>
這不用說。免費版限制兩台裝置使用,儲存上限和離線記事等等。<br />
<br />
<h2>
F.lux <a href="https://justgetflux.com/">https://justgetflux.com/</a></h2>
<div>
根據指定地理位置,自動調整螢幕的色溫,減少藍光對眼睛的傷害。<br />
<br /></div>
<h3>
</h3>
<h2>
FreeSnap <a href="http://mike-ward.net/freesnap/">http://mike-ward.net/freesnap/</a></h2>
利用鍵盤熱鍵快速調整視窗大小以及位置。<br />
<br />
<h2>
Tide <a href="https://itunes.apple.com/id/app/tide-stay-focused-be-peaceful/id1077776989?mt=8">https://itunes.apple.com/id/app/tide-stay-focused-be-peaceful/id1077776989?mt=8</a></h2>
<div>
環境噪音產生器。幫助專注或睡眠。有定時功能,可以提醒休息時間避免久坐。</div>
<div>
<br /></div>
Anonymoushttp://www.blogger.com/profile/07515835891250773234noreply@blogger.comtag:blogger.com,1999:blog-3040027623434763832.post-17455057271628329072017-01-08T15:25:00.003+08:002017-01-08T15:25:50.272+08:00新年計劃新的一年開始,總覺得該做些計劃。以前的計劃開始總是很遠大,想成為海賊王之類,但到年末總是在淡水河邊騎騎腳踏車而已。今年換個方式,從Y軸換成X軸,也是從深度換成廣度。目前先擬定幾個和平常工作不直接相關的領域來發展,第一個想到的就是多練習英文和中文寫作,題材隨便,讀書心得到旅遊雜記皆可,重點並不在於要妙筆生花,而在於養成寫作的習慣,以及寫作時整理思緒邏輯及資料的訓練。
為了養成這個習慣,首先需要有持續性的寫作題材。當然,到處吃吃喝喝是一個絕佳題材,但未免過於傷身,也不符合個人低調生活準則。近日,桃園機場捷運即將通車,想想何不在這新的一年將每個捷運站周邊都走一走。而且,這也像是行銷上利用人們想把集點卷上的格子填滿的心理,刺激顧客回店消費一樣。有限的捷運站就像集點卷上的格子,一年的時間也綽綽有餘,而不會讓內容流於形式。
第二個就是讀書的心得,這就比較困難了。工作上的經驗告訴我,在做任何專案,隨時記錄想法和結果,有非常多的好處。讀一本書就是一個專案,未經過整理,就像紙屑一樣,風一吹就散了。原則上,希望可以一個月交一次心得報告。Anonymoushttp://www.blogger.com/profile/07515835891250773234noreply@blogger.com0tag:blogger.com,1999:blog-3040027623434763832.post-8763313393041811362017-01-06T00:42:00.004+08:002017-01-06T00:45:47.509+08:00Hooked: How to Build Habit-Forming Products 讀後感根據自己工作的經驗和作者書中的分析,我倒是認為使用者黏著度似乎能更貼切地代表一個產品是否能持續成長。<br />
<blockquote class="tr_bq">
<span style="font-size: large;">
使用者黏著度=產品功能+轉換產品的成本+對產品的情感連結</span></blockquote>
<i>一個可以持續成長的產品,必定是使用者黏著度不斷提高,且呈正向循環</i>。舉例來說,一個Facebook的活躍使用者轉換到其他社群網站時,說服其好友或粉絲一同轉換,並不是一件容易的事。因此,Facebook的轉換成本基本上會與使用時間,好友人數或是社群名人等成正比。又如Apple將其產品塑造成時尚新潮的象徵,並把商品和人們希望與眾不同的情感連結在一起。而其App Store的軟體數量亦提高使用者轉換到其他平台的成本。
一個成熟市場的新進者,除非綜合以上三項後,仍有至少數倍以上的優勢,才有可能挑戰市場領導者的地位。Anonymoushttp://www.blogger.com/profile/07515835891250773234noreply@blogger.com0tag:blogger.com,1999:blog-3040027623434763832.post-22389124565384883632015-11-16T19:21:00.000+08:002015-11-16T19:21:14.652+08:00The Hard Thing About Hard Things: Building a Business When There Are No Easy Answers 讀後感(一)這是一本由Ben Horowitz,知名創投a16z的創始人,所寫一本關於自己創業過程甘苦的書。讀完這本書有段時日,一直在細細品味其中許多的情節,要是自己會怎麼做。有時想想,自己可能連捲起袖子來承擔的勇氣都沒有。<br />
<br />
這幾天,突然想起其中的一段關於一對一會談的內容。在書中提到,作者的一個同事認為一對一會談只是浪費彼此的時間,所以根本沒有和他管理的開發者定期一對一面談。作者認為這是不可容許的管理缺失,強烈要求該主管若不照做就捲舖蓋走人。在讀到這部分內容時,心裡覺得次數有那麼重要嗎?不是質量比較重要嗎?<br />
<br />
現在想想,的確次數很重要。為什麼?<u><i>領導者一項很重要個工作就是從開發者緊閉的嘴巴裡一點點挖出問題。</i></u>但是這句話本身就有個問題,為什麼開發者要跟你說自己真正所想的?除了領導者本身的溝通技巧之外,什麼才是使一對一會談成功的基本必要條件?我個人認為是相互的信任感。試想,如果你不信任對方,相信你不會把心裡所想的告訴對方,而是將過度修飾的事實(mitigated speech)或謊話告訴對方。除非你用刑求,沒有相互的信任,無論你的溝通技巧有多高超,能問出真正有價值的組織問題的機率不會太高。<br />
<br />
但人畢竟是情感的動物,相互之信任並不是一天一夜就可以建立。因此,一對一面談的次數就顯得重要了。經由規律的會談,了解彼此想法。並在每次會談後,針對上次會談的內容,再交換雙方思考後的看法。唯有經由這種過程,領導者和開發者才能提升一對一會談的品質,並協助改變團隊的文化。<br />
<br />
Anonymoushttp://www.blogger.com/profile/07515835891250773234noreply@blogger.comtag:blogger.com,1999:blog-3040027623434763832.post-46408128384392565302015-11-10T23:26:00.002+08:002015-11-10T23:27:49.024+08:00對於這篇文章的自我反思這篇 <a href="http://waitbutwhy.com/2013/09/why-generation-y-yuppies-are-unhappy.html" target="_blank">Why Generation Y Yuppies Are Unhappy </a>文章中提出一個重點, <br />
<h2 style="text-align: center;">
快樂 = 現實 - 期待</h2>
<div style="text-align: left;">
<br />
在現今富裕社會成長的人們,在上一輩的悉心呵護下,過度高估自我才能並對努力之成果產生不成比例的期待,導致與現實脫離的不快樂。</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
仔細想想,自己在某些時候似乎也是落入這種可悲的情境。希望Overnight Success或是認為自己的些許努力比別人更應獲得肯定;看到成功的人光鮮亮麗的一面卻忽略其背後的犧牲與努力。這是人的通病嗎?還是可以經由訓練來克服?作者提出了三個建議,</div>
<ol>
<li>保持赤子之心來探索新的領域。</li>
<li>停止覺得你自己很特別、很厲害。</li>
<li>保持自己的步調,只跟自己競爭。</li>
</ol>
<div style="text-align: left;">
雖是中肯,但可以改成這樣嗎?</div>
<ol>
<li>保持初心(Beginner's Mind)</li>
<li>成功的人才有靠北別人,吹噓自己。</li>
<li>他強歸他強,我自一口真氣足。</li>
</ol>
Anonymoushttp://www.blogger.com/profile/07515835891250773234noreply@blogger.comtag:blogger.com,1999:blog-3040027623434763832.post-64186975714237760792015-11-10T22:44:00.001+08:002015-11-10T22:44:50.333+08:00Blockchain個人研究進度(一)<div dir="ltr">
對於FinTech領域的切入,想從研究Bitcoin/Blockchain相關的技術和其對社會經濟面的影響開始。一般來說,學習新事物是先從類似Wikipedia的大綱頁面,找出一個進入點,再逐漸擴大學習面。但說實在的,我自己覺得Wikipedia的<a href="https://en.wikipedia.org/wiki/Bitcoin" target="_blank">Bitcoin</a>頁面,內容的編排有點雜亂,實在找不出進入點。因此,我決定先放棄由Wikipedia開始,改從已出版的書籍開始。</div>
<div dir="ltr">
<br /></div>
<div dir="ltr">
下面這本書對Bitcoin的歷史沿革以及許多重要的人事時地物都有介紹,且在Amazon上的評價很高。因此,就先從這本書開始,<span style="font-weight: normal;"><span class="a-size-large" id="productTitle"></span></span></div>
<ul>
<li><a href="http://www.amazon.com/Digital-Gold-Bitcoin-Millionaires-Reinvent/dp/0062362496/ref=tmm_hrd_swatch_0?_encoding=UTF8&qid=&sr=" target="_blank"><span style="font-weight: normal;"><span class="a-size-large" id="productTitle">Digital Gold: Bitcoin and the Inside Story of the Misfits and Millionaires Trying to Reinvent Money</span></span></a></li>
</ul>
<div dir="ltr">
<br /></div>
對於一些較新的資訊則由下面來源獲得,<br />
<ol>
<li>使用Google Alert訂閱Blockchain或Bitcoin的搜尋。</li>
<li><a href="https://letstalkbitcoin.com/" target="_blank">Let's Talk Bitcoin (LTB)</a> - 這個Podcast常會邀請許多在Bitcoin舉足輕重的開發者針對一些問題進行比較深入的討論。</li>
<li><a href="http://www.coindesk.com/" target="_blank">CoinDesk</a></li>
</ol>
<div dir="ltr">
核心技術方面,從Satoshi Nakamoto的原始論文開始:</div>
<ul>
<li><a href="https://bitcoin.org/en/bitcoin-paper" target="_blank">Bitcoin: A Peer-to-Peer Electronic Cash System</a></li>
<li><a href="https://bitcoin.org/en/developer-documentation" target="_blank">https://bitcoin.org/en/developer-documentation </a></li>
</ul>
<div dir="ltr">
另外,這本書也是不錯的開始,</div>
<ol>
<li><a href="http://www.amazon.com/gp/product/1449374042?keywords=Mastering%20bitcoin&qid=1447162649&ref_=sr_1_1&sr=8-1" target="_blank">Amazon - Mastering Bitcoin: Unlocking Digital Cryptocurrencies </a></li>
<li><a href="http://www.bookdepository.com/Mastering-Bitcoin/9781449374044" target="_blank">Book Depository - Mastering Bitcoin: Unlocking Digital Cryptocurrencies</a> </li>
</ol>
<div dir="ltr">
(因為Book Depository全球免運費,相較於Amazon的價格會稍微便宜一些。)</div>
<div dir="ltr">
<br /></div>
<div dir="ltr">
在閱讀這本書的同時,我想也可以試著在<a href="http://www.bookdepository.com/Mastering-Bitcoin/9781449374044" target="_blank">Transifex</a>翻譯這本書來貢獻使用中文的社群,雖然目前進度明顯非常落後於其他語系。</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiosy8fgqhTTuUNeYpNuvwQePUQ5qZ_FeGnS_X5lv1rkGFIw0aj6OvEuNkjKDB2ufpJ-5KIZDFu9oYIqJk8DfXnoLPoaJYoKBjFYukkg9S-qgDoSwrC5HgDNBNfU4eSUvK4fu8v_N0ilQ/s1600/Transifex+-+status+of+Mastering+of+Bitcoin.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="349" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiosy8fgqhTTuUNeYpNuvwQePUQ5qZ_FeGnS_X5lv1rkGFIw0aj6OvEuNkjKDB2ufpJ-5KIZDFu9oYIqJk8DfXnoLPoaJYoKBjFYukkg9S-qgDoSwrC5HgDNBNfU4eSUvK4fu8v_N0ilQ/s400/Transifex+-+status+of+Mastering+of+Bitcoin.png" width="400" /></a></div>
<div dir="ltr">
<br /></div>
<div dir="ltr">
相對程度的Code study也是需要,以方便了解整個系統的運作。</div>
<ul>
<li><a href="https://github.com/bitcoinj/bitcoinj" target="_blank">BitcoinJ - Java implementation for Bitcoin</a></li>
<li><a href="https://github.com/bitcoin/bitcoin" target="_blank">Bitcoin Core - Satoshi Reference Implementation</a></li>
<li><a href="https://github.com/schildbach/bitcoin-wallet" target="_blank">Bitcoin Wallet for Android</a></li>
</ul>
<div dir="ltr">
<br /></div>
Anonymoushttp://www.blogger.com/profile/07515835891250773234noreply@blogger.comtag:blogger.com,1999:blog-3040027623434763832.post-44430835748460237882015-11-04T23:25:00.001+08:002015-11-04T23:25:20.372+08:002015年末的初步回顧與展望(上)今年大致上完成不少年初目標。就個人發展方面,到目前為止看了21本書,雖然裡面可能有不少是科幻小說,不過其中也有幾本是真的有讓我獲取到新的知識的。<br />
<ol>
<li><a href="http://www.amazon.com/gp/product/B00P6TZLOU?keywords=digital%20gold&qid=1446649181&ref_=sr_1_1&s=books&sr=1-1" target="_blank"><span class="a-size-extra-large" id="productTitle">Digital Gold: Bitcoin and the Inside Story of the Misfits and Millionaires Trying to Reinvent Money</span></a> </li>
<li> <a href="http://www.amazon.com/gp/product/0071747052?psc=1&redirect=true&ref_=ox_sc_act_title_5&smid=ATVPDKIKX0DER" target="_blank">The Four Pillars of Investing: Lessons for Building a Winning Portfolio</a></li>
<li><a href="http://www.anobii.com/books/%E5%95%86%E6%A5%AD%E5%86%92%E9%9A%AA/9789862135761/01b45937899d85f14b" target="_blank">商業冒險 華爾街的12個經典故事</a></li>
<li><a href="http://www.amazon.com/Hard-Thing-About-Things-Building/dp/0062273205/ref=tmm_hrd_swatch_0?_encoding=UTF8&qid=1446649447&sr=1-1" target="_blank">The Hard Thing About Hard Things: Building a Business When There Are No Easy Answers</a></li>
</ol>
今年看的書感覺比較偏向商業金融方面。對一個全職程式設計師來說,好像有些偏離本行。但這也是歸因我這幾年來的感想,在一個領域浸淫太久,雖然美其名是高度專業,但思考邏輯也難免會框住,長久以往,在專業領域上,卻顯得捉襟見絀,有些江郎才盡的窘態。或許藉由涉獵其他領域,能截其所長補己之短。<br />
<br />
人生步入壯年後,健康更是相形重要。近年來,接連幾次的食安危機,台灣食品工業的信用實在受人質疑,加上自己本身怕麻煩,不喜歡花太多時間在吃飯上面,吃就簡單健康就好。因此,也慢慢地盡量嘗試做些超級不用腦的料理並且開始不吃明顯由玉米澱粉再製的食品。再加上定期運動,說實在地,自己明顯有感受到有好處。這些想當然明年必須繼續保持。<br />
<br />
<ol>
</ol>
<ol>
</ol>
Anonymoushttp://www.blogger.com/profile/07515835891250773234noreply@blogger.comtag:blogger.com,1999:blog-3040027623434763832.post-90945448023070299282014-09-28T17:34:00.002+08:002014-09-28T20:37:05.132+08:00Build PA (Paranoid Android) for Nexus 5 (hammerhead) in MacOSX MavericksThanks for this post in XDA <a href="http://forum.xda-developers.com/showthread.php?t=2510898" target="_blank">[GUIDE] Setting up a build environment on OSX 10.9 Mavericks</a> so that I can build PA on my old Macbook Pro without many troubles.<br />
<br />
<h2>
Preparation</h2>
Install Xcode/JDK/Homebrew as the XDA post mentioned. However, the installation of Xcode is not really necessary. It saves you some work, though. The CommandLineTools is enough to finish the build if you manually set the variable <i>mac_sdk_version</i> in <i>build/code/combo/HOST_darwin-x86.mk</i> instead of obtaining it from <i>xcodebuild</i>.<br />
<br />
<h2>
Download prebuilt kernel/proprietary files for hammerhead</h2>
<h3>
Kernel</h3>
<h4>
Sync or download from Google site</h4>
<span style="font-family: 'Andale Mono'; font-size: 13px; font-stretch: normal;"> git clone </span><span style="color: #042eee; font-family: 'Andale Mono'; font-size: 13px; font-stretch: normal;"><u>https://android.googlesource.com/device/lge/hammerhead-kernel</u></span><br />
<div>
<br /></div>
<div>
This is a long process. If you don't want to waste time, just download the vmlinux.bz2 and zImage-dtb.</div>
<div>
<br /></div>
<h4>
device/lge/device.mk</h4>
<div>
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjwmOEn0RUmBMOpt6BO_1Al1IieQZTbqa5qOgqDJEBYjN0B7LvWvD7CXDrxrG1_Xn-B-sehDiGeANEhanvI2Xzb_maXZAnHmCjRaAJPnvasnOJmQ2zg37m7YNvIiif8ygKsD47nY75J_A/s1600/build_paranoid_android_on_mavericks_3.png" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-right: 1em; text-align: center;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjwmOEn0RUmBMOpt6BO_1Al1IieQZTbqa5qOgqDJEBYjN0B7LvWvD7CXDrxrG1_Xn-B-sehDiGeANEhanvI2Xzb_maXZAnHmCjRaAJPnvasnOJmQ2zg37m7YNvIiif8ygKsD47nY75J_A/s1600/build_paranoid_android_on_mavericks_3.png" /></a></div>
<div>
<br /></div>
<div>
Set TARGET_PREBUILT_KERNEL to your download location.</div>
<div>
<br /></div>
<div>
<br /></div>
<h3>
Proprietary files</h3>
<div>
Just download and extract.</div>
<div>
<a href="https://developers.google.com/android/nexus/drivers#hammerheadktu84q">https://developers.google.com/android/nexus/drivers#hammerheadktu84q</a></div>
<br />
<h2>
build/core/combo/HOST_darwin-x86.mk</h2>
The first change is to add 10.9 to the variable <i>mac_sdk_verions_supported.</i><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6I5KNWl__k2CUlPuKYLQJAME_pPOvngM2efnvYKKHjXEy7fOgCKduIZbMV7XuV2NwfhqjVc4ULxLySpoZpC1KEgIjBweAw1c5ArNfzsrjW5L8QXO65nlBNowsdJCLhzf0PLXuYHWHtw/s1600/build_paranoid_android_on_mavericks_1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6I5KNWl__k2CUlPuKYLQJAME_pPOvngM2efnvYKKHjXEy7fOgCKduIZbMV7XuV2NwfhqjVc4ULxLySpoZpC1KEgIjBweAw1c5ArNfzsrjW5L8QXO65nlBNowsdJCLhzf0PLXuYHWHtw/s1600/build_paranoid_android_on_mavericks_1.png" height="137" width="640" /></a></div>
<br />
The second change is to instruct build system to use the correct toolchain (missing stdarg.h in 10.8+). This is different from what was recommended in the XDA post.<br />
<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhqw1Nk6uDMVcAIaWEx5KJVwAZ3M0wxumMydqzaTcNB25iRfk4Hawb2MuJ80fbTgzENZPTJvIkcDc3OKBSRZncS43OxXJsmpsOcc5cey-N492i0xhI84tNm55Rh47qSnOlWaO8zgYvNMg/s1600/build_paranoid_android_on_mavericks_2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em; text-align: center;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhqw1Nk6uDMVcAIaWEx5KJVwAZ3M0wxumMydqzaTcNB25iRfk4Hawb2MuJ80fbTgzENZPTJvIkcDc3OKBSRZncS43OxXJsmpsOcc5cey-N492i0xhI84tNm55Rh47qSnOlWaO8zgYvNMg/s1600/build_paranoid_android_on_mavericks_2.png" height="233" width="640" /></a><br />
<br />
<br />
The third change is to use gstat instead of stat.<br />
<br />
<pre class="alt2 " dir="ltr" style="background: rgb(249, 249, 249); border: 1px inset; color: #454545; font-size: 14px; height: 162px; line-height: 20px; max-width: 700px; overflow: auto; padding: 5px; width: 685px;"># $(1): The file to check
define get-file-size
GSTAT=$(which gstat) ; \
if [ ! -z "$GSTAT" ]; then \
gstat -c "%s" $(1) ; \
else \
stat -f "%z" $(1) ; \
fi
endef</pre>
<h2>
Build</h2>
As <a href="https://github.com/AOSPA/manifest">https://github.com/AOSPA/manifest</a> says,<br />
<br />
./rom-build.sh hammerheadAnonymoushttp://www.blogger.com/profile/07515835891250773234noreply@blogger.comtag:blogger.com,1999:blog-3040027623434763832.post-66135660622562873952014-08-13T21:40:00.002+08:002014-08-13T21:55:51.152+08:00The project-based environmentI've been tweaking the environment for my work, mostly programming, for years. I don't use any fancy IDE or desktop environment. Some of my co-workers use Citrix Client and this is actually recommended by our IT department. But, considering the just acceptable performance of connecting to remote sever, I am much more inclined to use terminal and switch to Citrix if I need to use any GUI application.<br />
<br />
It is common that a company need to maintain several versions of a product for years and programmers need to port changes to different branches. Sometimes, a programmer need to run same experiment on different version to observe behavior or performance differences. It would be much safer if these runs are separated by different terminals even at the same machine.<br />
<br />
The workspace-based flow is probably the most suitable one I've found. My configuration is pretty simple but effective. It's based on <b>screen/tmux/emacs</b> and submitted on GitHub. <br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://raw.githubusercontent.com/yenliangl/Settings/master/image/tmux_screenshot1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="235" src="https://raw.githubusercontent.com/yenliangl/Settings/master/image/tmux_screenshot1.png" width="400" /></a></div>
Check it out on <a href="https://github.com/yenliangl/Settings" target="_blank">Workspace-based configuration</a><br />
<br />
<br />Anonymoushttp://www.blogger.com/profile/07515835891250773234noreply@blogger.com0tag:blogger.com,1999:blog-3040027623434763832.post-3961092816028765402012-02-04T20:29:00.004+08:002012-02-04T20:33:27.515+08:00Implement an AppWidget for BozaAlarm - Part I: LimitationToday, I released BozaAlarm v4.10 to the Android Market. What's new in this version is the simple AppWidget to display the next enabled alarm.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-fGyFyxTWKE8/Txe7fBlGisI/AAAAAAAAM8M/zB5CHa-Quhc/s1600/nextalarm_appwidget.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="http://1.bp.blogspot.com/-fGyFyxTWKE8/Txe7fBlGisI/AAAAAAAAM8M/zB5CHa-Quhc/s320/nextalarm_appwidget.png" width="213" /></a></div>
<br />
Here, I'd like to talk about how I implemented this simple widget. Before I go too far, you probably need to take a look at least these two topics,<br />
<br />
<ol>
<li><a href="http://developer.android.com/guide/topics/appwidgets/index.html#AppWidgetProvider" target="_blank">AppWidgetProvider</a></li>
<li><a href="http://developer.android.com/guide/practices/ui_guidelines/widget_design.html#anatomy_determining_size" target="_blank">App Widget Design Guidelines</a></li>
</ol>
<div>
Just as I said before, there are some <a href="http://yenliangl.blogspot.com/2010/06/appwidget-design-can-i-use-my-own.html" target="_blank">limitations</a> in App Widget design and understand these should save you some time.</div>
<div>
<br /></div>
<div>
Basically, the Launcher process hosts AppWidgetHostView for each App Widget and talk with your process through RPC calls. You can image there are many RPC (binder) calls between Launcher and your process. That's why you will use RemoteViews to package your update actions in your process and apply them on the App Widget on the Launcher side. In fact, the RemoteViews is implemented as Command pattern in software terminology.</div>
<img src="https://docs.google.com/drawings/pub?id=1k5Oiw5SqAUPxm5YzCG7GhzC9tW6hjfrcUHIhtOfzwZ4&w=640&h=360" />
<br />
<div>
Now, you can imagine why AppWidget design is so restricted.</div>
<div>
<br /></div>
Moreover, because it's always unsafe to load classes from other process in a process, you're not allowed to use custom classes in your widget layout. Only built-in widget classes can be used in your layout xml file and only methods tagged by RemotableMethod in these classes are allowed.<br />Anonymoushttp://www.blogger.com/profile/07515835891250773234noreply@blogger.comtag:blogger.com,1999:blog-3040027623434763832.post-53489844937812440722012-02-04T14:09:00.000+08:002012-02-04T20:34:18.209+08:00Experiment the Tips for reducing APK file sizeI came across <a href="http://developer.sonyericsson.com/wp/2012/01/31/tips-for-reducing-apk-file-size/#comments" target="_blank">this article: Tips for reducing APK file size</a> at SonyEricsson Developer blog. Among them, the one I am aware of is the PNG file optimization. So, I took some time to experiment it.<br />
<br />
First, I downloaded the GUI wrapper of command-line optimizer <a href="http://imageoptim.pornel.net/" target="_blank">ImageOptim</a> and optimize the PNG files at res/ directory. According to the result, it reduce total file size from 748K bytes to 700K bytes.<br />
<br />
Second, I recompile the release binary of my application. But, the size of APK file remains the same as the one w/o PNG optimization.<br />
<br />
Hmm. I repeated this process some times to make sure I didn't miss some important steps. While I was wondering, I noticed some messages spewed out during compilation like,<br />
<blockquote class="tr_bq">
[crunch] Processing image to cache: /Users/yenliangl/Work/Android/bozaalarm-android/res/drawable-hdpi/handler_app.png => /Users/yenliangl/Work/Android/bozaalarm-android/bin/res/drawable-hdpi/handler_app.png</blockquote>
<i>Looks like PNG optimization has been included in the standard Android tool v14??</i><br />
<br />
This should confirm my guess. <a href="http://www.blogger.com/(http://tools.android.com/recent/buildchangesinrevision14" target="_blank">From official site of Android tool</a>, it says that in revision 14, aapt optimizes PNG during compilation. <br />
<br />
<i style="background-color: white; color: #444444; font-family: Arial, Verdana, sans-serif; font-size: 13px; line-height: 21px; text-align: left;">png processing in aapt.</i><br />
<span style="background-color: white; color: #444444; font-family: Arial, Verdana, sans-serif; font-size: 13px; line-height: 21px; text-align: left;">When aapt packages the resources, its main goal is to compile the XML to binary format and to create a resource table with all the resource values (string, color, ids, etc...). <b>Additionally, it processes the png files to optimize them (for instance, pre-processing of 9-patches).</b></span><br />
<span style="background-color: white; color: #444444; font-family: Arial, Verdana, sans-serif; font-size: 13px; line-height: 21px; text-align: left;">Because the aapt process is not incremental, this means every build goes through all png files and processes them always. For large projects with numerous (and/or large) png this process could take a long time.</span><br />
<span style="background-color: white; color: #444444; font-family: Arial, Verdana, sans-serif; font-size: 13px; line-height: 21px; text-align: left;">Revision 14 now processes the png files outside of the aapt packaging step and caches them. Only modified png files are re-processed. </span><br />
<br />
<br />
<br />Anonymoushttp://www.blogger.com/profile/07515835891250773234noreply@blogger.comtag:blogger.com,1999:blog-3040027623434763832.post-70422353287175172062012-01-06T21:01:00.000+08:002012-01-06T21:06:50.382+08:00TimePicker/DatePicker with keyboard input problemI got some complaints from users saying they can't use keyboard to input in TimePicker or DatePicker widgets and found that this bug has been posted on Android developer forum for some time.<br />
<br />
The quick workaround for this bug is,
<script src="https://gist.github.com/1570501.js"> </script>Anonymoushttp://www.blogger.com/profile/07515835891250773234noreply@blogger.comtag:blogger.com,1999:blog-3040027623434763832.post-9631883419232635542012-01-05T16:34:00.001+08:002012-01-05T16:35:01.321+08:00Publish org to remote host through ssh<p>I've used Emacs org-mode to manage my personal notes and work stuff for a while. Its flexibility always amazes me.</p><p>Normally, I keep my personal notes in a Dropbox directory that are synced automatically. But, for work stuff, I created a local directory for them in intranet and published them to a secured remote host through ssh. The org-publish supports this feature well after you've configured ssh.</p><p><script src="https://gist.github.com/1564238.js"> </script></p>Anonymoushttp://www.blogger.com/profile/07515835891250773234noreply@blogger.comtag:blogger.com,1999:blog-3040027623434763832.post-89514312176083657852012-01-05T16:04:00.002+08:002012-01-05T16:06:01.893+08:00Customize Emacs compile<div>At work, I use <span style="font-family: 'courier new', courier;">M-x compile</span><span style="font-family: arial, helvetica, sans-serif;"> to build the project I'm working on. Chances are that default <span style="font-family: 'courier new', courier;">compile-command</span> is not what you want. You can customize it and bind it to hotkeys as follows, </span></div><div></div><div><script src="https://gist.github.com/1564186.js">
haha
</script></div><div></div><div>Now, you can use F8, F9 to build the optimized and debug version.</div>Anonymoushttp://www.blogger.com/profile/07515835891250773234noreply@blogger.comtag:blogger.com,1999:blog-3040027623434763832.post-37146733031926083912011-12-27T15:21:00.007+08:002012-03-03T13:06:45.298+08:00Emacs server per workspace (GNU Screen)I am a heavy user of GNU screen and Emacs at work and home. In the past, I created different GNU Screen instances for different projects and only one instance of Emacs server in one machine. For instance, you are aked to fix bugs in threee code branches and some fixes can't go into certain branches, I need to be very careful when I edit and switch buffers because only once emacs server out there.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-7gzP9mffGbU/TvlytowNC2I/AAAAAAAAM1U/nq3xlk7DhxI/s1600/emacs_screen_work_model_1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="197" src="http://4.bp.blogspot.com/-7gzP9mffGbU/TvlytowNC2I/AAAAAAAAM1U/nq3xlk7DhxI/s320/emacs_screen_work_model_1.png" width="320" /></a></div>
<br />
<br />
What I really need to have setup like this,<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-JRZs1zLr2vA/TvlyrQwLftI/AAAAAAAAM1M/P77D6Th4bn8/s1600/emacs_screen_work_model_2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="188" src="http://1.bp.blogspot.com/-JRZs1zLr2vA/TvlyrQwLftI/AAAAAAAAM1M/P77D6Th4bn8/s320/emacs_screen_work_model_2.png" width="320" /></a></div>
<br />
<br />
Now, whenever you edit or switch files in a GNU screen by emacsclient, you can sit back and relax for a while. But, the problem is how do I make this a bit automatic? If you need to execute 'emacs --daemon=serverN' for every created GNU Screen, that will be very troublesome.<br />
Here is what I have done to make this happen,<br />
<br />
<script src="https://gist.github.com/1564216.js">
</script><br />
<br />
Now, when you instantiate GNU Screen by 'ws_XXX' aliases, an Emacs server identified by 'XXX' is created for you. And then you can use 'et' to edit a file in the proper Emacs server.<br />
<br />
The only thing I don't like is that I am compelled to use another alias 'kill-emacs' to kill Emacs server. I often 'pkill' to kill process, but this will kill <b>all</b> Emacs servers in the same machine which is absolutely not the behavior I want.<br />
<br />
The last thing to do is to patch the source code of emacsclient. In my experiment, emacsclient in the latest stable release (23.3b) doesn't pass correct argument for Emacs to start its daemon mode. So, I made minor changes to make it right.<br />
<br />
<script src="https://gist.github.com/1523697.js">
</script><br />
<br />
After recompile and install, you can start using these two power tools in this way as I do.Anonymoushttp://www.blogger.com/profile/07515835891250773234noreply@blogger.comtag:blogger.com,1999:blog-3040027623434763832.post-61111638181388708702011-05-27T18:43:00.000+08:002011-05-27T18:43:04.499+08:00Load machine-dependent bash settingI own several computers and each is running different OS on it. We all know that maintaining different settings for different OS is very cumbersome. A simple solution for this is to separate common settings and machine-dependent settings into different files like this,<br />
<pre class="brush:bash">MNAME=`uname -s`
MBASHRC=$HOME/Settings/bashrc.${MNAME,,}
if [ -f $MBASHRC ]; then
echo "==> loading $MBASHRC"
. $MBASHRC
fi
</pre>In this way, all you need to do is to write your machine-dependent settings in the bashrc.darwin or bashrc.linux.Anonymoushttp://www.blogger.com/profile/07515835891250773234noreply@blogger.comtag:blogger.com,1999:blog-3040027623434763832.post-70736480067060065982011-05-27T18:25:00.002+08:002012-01-06T20:14:34.133+08:00MacOSX-like open command in Ubuntu and Windows/Cygwin.I always find 'open' command in MacOSX is very useful for people always hanging around in the Terminal. To get the similar behavior in Ubuntu or other Linux system, we can create an alias such as,<br />
<script src="https://gist.github.com/1570314.js"> </script>Anonymoushttp://www.blogger.com/profile/07515835891250773234noreply@blogger.comtag:blogger.com,1999:blog-3040027623434763832.post-66721190447123748862011-05-16T21:24:00.001+08:002011-05-27T18:27:55.711+08:00My new Android application TallyCounterI've published a new application, TallyCounter, on the Android Market.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"></div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgF86O3Q-vIfoIeiCb4K8urrffAgzN6IYIAIudJOBPiuyC9DbKcXUe_XGVtmoZ1fFOAE0Q68dIsij_7Cd6Ev322qMNvBjzucBpw4gRzIugzrHvJWitntFfhG5qCNgBPNlftz964k2sKGQ/s1600/main_screen.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgF86O3Q-vIfoIeiCb4K8urrffAgzN6IYIAIudJOBPiuyC9DbKcXUe_XGVtmoZ1fFOAE0Q68dIsij_7Cd6Ev322qMNvBjzucBpw4gRzIugzrHvJWitntFfhG5qCNgBPNlftz964k2sKGQ/s320/main_screen.png" width="192" /></a></div><br />
It's very easy to use. You can download it on this <a href="https://market.android.com/details?id=org.startsmall.tallycounter">link</a>.Anonymoushttp://www.blogger.com/profile/07515835891250773234noreply@blogger.comtag:blogger.com,1999:blog-3040027623434763832.post-74109723632107952242011-05-04T11:30:00.000+08:002011-05-04T11:30:30.782+08:00Run Android CTSRecently, I was asked to look into CTS report of my work. So, I downloaded CTS on <a href="http://source.android.com/compatibility/cts-intro.html">Android website</a> and started running it. After hours of experiments, these are my experiences that should save you some time.<br />
<ul><li>Use SDK 1.6r1 against your CTS. Don't use SDK r10. </li>
<li>Modify <b>maxTestCount</b> to -1 in your $CTS_ROOT/repository/host_config.xml</li>
<li>Don't run large test plan. Predefined test plans in the CTS are,</li>
<ul><li><b>CTS</b> plan</li>
<ul><li><b>VM</b> plan</li>
<li><b>Java</b> plan</li>
<li><b>Android</b> plan</li>
<ul><li><b>RefApp</b> plan</li>
<li><b>AppSecurity</b> plan</li>
</ul><li><b>Signature</b> plan</li>
</ul><li><b>Performance</b> plan</li>
</ul><li>If you run into errors complaining this "<i>Installing met .... due to unknown reasons</i>", try to run a customized smaller test plan composed of nonExecuted packages.</li>
<ul><li> <i>add --plan reset_of_packages</i>. It prompts you available packages to add into this plan and you can add packages that haven't run yet since the error happens.</li>
</ul><li>You can run CTS in Linux, Windows or Ubuntu. The whole CTS suite is just a script wrapped on top of "java -cp". It should be platform-independent. If you are running CTS on Windows/cygwin system, </li>
<ul><li>Move the definition of ${JARS} in your <i>startcts</i> to the following, <pre class="brush:bash">JARS=`cygpath -w -p ${CTS_LIB}:${DDM_LIB}:${JUNIT_LIB}:${HOSTTEST_LIB}`</pre></li>
<li>and, this line <pre class="brush:bash">java ${JAVA_OPTS} -cp ${JARS} com.android.cts.TestHost `cygpath -w ${CONFIG}` "$@" ${DDCONFIG}</pre></li>
</ul><i> </i></ul>Anonymoushttp://www.blogger.com/profile/07515835891250773234noreply@blogger.comtag:blogger.com,1999:blog-3040027623434763832.post-60638318432720925232011-04-27T22:22:00.000+08:002011-04-27T22:22:29.708+08:00New alpha version for features I've implemented since v3.07bI've compiled a new alpha version that includes features I've implemented since the release of v3.07b on the Android Market. These features include,<br />
<ol><li>New alarm action for launching application.</li>
<li> New equation mode on the AlarmAlert activity to unlock snooze/dismiss buttons.</li>
<li>The redesigned password input widget. </li>
</ol>Screenshots are uploaded to my Picasa space.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://4.bp.blogspot.com/-Q4OPZ4HJ6_4/TbbQmcWDfMI/AAAAAAAAKu8/cMlU0k0Cf08/s1600/select_application.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="320" src="http://4.bp.blogspot.com/-Q4OPZ4HJ6_4/TbbQmcWDfMI/AAAAAAAAKu8/cMlU0k0Cf08/s320/select_application.png" width="213" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Select an application to launch</td></tr>
</tbody></table><br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg4eElY2u1g0cew8iuKngUFTU5gyGIsdW9uNS7RN87TUxmQcSNCkPfsIJztNDJr3En1z32iFcbR1LQk7z2qPoEC6gig1u9JYfFiCjGIFwqN8yGDxnsEVL-RchI-q_LbowViNOZEDUIkYA/s1600/enter_password_for_an_alert.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg4eElY2u1g0cew8iuKngUFTU5gyGIsdW9uNS7RN87TUxmQcSNCkPfsIJztNDJr3En1z32iFcbR1LQk7z2qPoEC6gig1u9JYfFiCjGIFwqN8yGDxnsEVL-RchI-q_LbowViNOZEDUIkYA/s320/enter_password_for_an_alert.png" width="213" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Set password for an alert</td></tr>
</tbody></table><br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEicg_nXr6s_IwcYEPxKjfPtnKtx7JVsfhazasMN4lIEEdy3btkchcYFeCvue0QKrZUYsMfNTGkQUOBDDiT501hHsvmYMhN-Q62fqrxgJtgaoWfgQFRbuaEtwQ9wT60bN7IRB6Y2n3tKTQ/s1600/answer_math_equatioin_to_snooze_or_dismiss.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEicg_nXr6s_IwcYEPxKjfPtnKtx7JVsfhazasMN4lIEEdy3btkchcYFeCvue0QKrZUYsMfNTGkQUOBDDiT501hHsvmYMhN-Q62fqrxgJtgaoWfgQFRbuaEtwQ9wT60bN7IRB6Y2n3tKTQ/s320/answer_math_equatioin_to_snooze_or_dismiss.png" width="192" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Solve a simple equation to unlock snooze/dismiss buttons</td></tr>
</tbody></table><br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjl-oD_LpdeM_Yzo1NqBRp9sFWNmJyAI3GYEPNOdswUAedEaUk_fouxRLYC9rZPuQCqM2Sv3aVpCi2EmJTMvT4p0NeH8SJW4-aPbzwfSoobmNQKByZO1icg8szkFMlGJYyl52TFxC_tmQ/s1600/enter_password_to_snooze_or_dismiss.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjl-oD_LpdeM_Yzo1NqBRp9sFWNmJyAI3GYEPNOdswUAedEaUk_fouxRLYC9rZPuQCqM2Sv3aVpCi2EmJTMvT4p0NeH8SJW4-aPbzwfSoobmNQKByZO1icg8szkFMlGJYyl52TFxC_tmQ/s320/enter_password_to_snooze_or_dismiss.png" width="192" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Enter specified or random-generated password to unlock snooze/dismiss buttons</td></tr>
</tbody></table><div class="separator" style="clear: both; text-align: center;"></div>You can install this new alpha version <a href="http://dl.dropbox.com/u/946518/BozaAlarm-release.free.v3.12a.apk">from my Dropbox space</a>.Anonymoushttp://www.blogger.com/profile/07515835891250773234noreply@blogger.comtag:blogger.com,1999:blog-3040027623434763832.post-45107201666615097132011-04-26T22:09:00.000+08:002011-04-26T22:09:11.394+08:00New alarm action to launch an application main activityI was struggling to add this feature my application because I believe it won't do much help. Still, I tried to implement this as a practice. It's pretty easy to get all installed applications on the phone by these lines.<br />
<br />
<script class="brush: java" type="syntaxhighlighter">
<![CDATA[
private void loadInstalledApplications() {
final PackageManager pm = getPackageManager();
List<applicationinfo> appInfos = pm.getInstalledApplications(PackageManager.GET_META_DATA);
Collections.sort(appInfos,
new Comparator<applicationinfo>() {
public int compare(ApplicationInfo obj1, ApplicationInfo obj2) {
String s1 = obj1.loadLabel(pm).toString();
String s2 = obj2.loadLabel(pm).toString();
return s1.compareTo(s2);
}
});
]]>
</script><br />
<br />
and you can launch the main activity of an application by <br />
<pre class="brush:java">Intent launchIntent = pm.getLaunchIntentForPackage(packageName);
launchIntent.setFlags(Intent.FLAG_ACTIVIY_NEW_TASK|Intent.FLAG_ACTIVITY_NO_USER_ACTION);
context.startActivity(launchIntent);
</pre><br />
What I said it doesn't do much help is that you can only bring up an activity unless you know how to talk to it through its public interface.Anonymoushttp://www.blogger.com/profile/07515835891250773234noreply@blogger.comtag:blogger.com,1999:blog-3040027623434763832.post-741863779386571682011-04-22T17:42:00.000+08:002011-04-22T17:42:53.427+08:00How to toggle power controls (Wi-Fi, GPS, bluetooth, brightness, sync)This topic has been asked on Android forums regularly and sometimes you are told not to turn on/off GPS/Bluetooth without consents from users. That's true.<br />
<br />
Despite this consent issue, what is the simplest way to toggle power controls programmatically? For Android 2.1+, my opinion is to take advantage of the code Settings already provides.<br />
<br />
<pre class="brush:java">Intent intent = new Intent();
intent.setClassName("com.android.settings","com.android.settings.widget.SettingsAppWidgetProvider");
intent.addCategory(Intent.CATEGORY_ALTERNATIVE);
intent.setData(Uri.parse("custom:" + getButtonId()));
context.sendBroadcast(intent);
</pre><br />
The getButtonId() returns the button id on the PowerControl widget. You can try to put this widget on your device. It is not impossible that these button ids are changed in the future Android release or by vendors. But, I have to say it's not very likely to happen.<br />
<br />
<ul><li>Wi-Fi: 0</li>
<li>Brightness: 1</li>
<li>Sync: 2</li>
<li>GPS: 3</li>
<li>Bluetooth: 4</li>
</ul><br />
Another advantage of using this is the reduction of hardware permissions you have to declare.Anonymoushttp://www.blogger.com/profile/07515835891250773234noreply@blogger.comtag:blogger.com,1999:blog-3040027623434763832.post-68538699985825693272011-04-21T16:12:00.000+08:002011-04-21T16:12:38.380+08:00New alpha version of BozaAlarm v3.01aI've implemented these experimental changes into this new alpha version - v3.01a.<br />
<br />
<ol><li>GPS and Bluetooth toggling action.</li>
<li>Wi-Fi action has no toggling option any more. It toggles current Wi-Fi state.</li>
<li>Honor user's group-by setting when viewing alarms through View/All.</li>
</ol><div>This new test release can be downloaded <a href="http://dl.dropbox.com/u/946518/BozaAlarm-release.free-v3.01a.apk">here in my Dropbox space.</a></div>Anonymoushttp://www.blogger.com/profile/07515835891250773234noreply@blogger.comtag:blogger.com,1999:blog-3040027623434763832.post-66857425206692220852011-04-09T15:07:00.002+08:002011-04-09T15:40:07.461+08:00How CursorAdapter worksFor people who are new to Android development, sometimes, they are wondering why <span style="font-family: "Courier New",Courier,monospace;">CursorAdapter</span> know when to refresh your UI and how the connection between your model and view is set?<br />
<br />
I looked into the Android source code and learned that <b><i>two key method calls</i></b> will establish this connection. This following diagram was drawn in order to understand how your model (Database) and View (<span style="font-family: "Courier New",Courier,monospace;">AdapterView</span>) are bound together. From this diagram, we can see<br />
<ol><li style="font-family: "Courier New",Courier,monospace;">Cursor.setNotificationUri(ContentResolver, Uri)</li>
<li style="font-family: "Courier New",Courier,monospace;">ContentResolver.notifyChange(...)<span style="font-family: "Courier New",Courier,monospace;"> </span></li>
</ol>The first call will insert an hash entry (<span style="font-family: "Courier New",Courier,monospace;">Uri</span>, <span style="font-family: "Courier New",Courier,monospace;">Cursor</span>) into the hash map hold by <span style="font-family: "Courier New",Courier,monospace;">ContentResolver</span> (<span style="font-family: "Courier New",Courier,monospace;">ContentService</span>) so that <u><i>whenever the data pointed by this <span style="font-family: "Courier New",Courier,monospace;">Uri</span> object is changed, it will requery the <span style="font-family: "Courier New",Courier,monospace;">Cursor</span> object.</i></u><br />
<br />
But the question is how <span style="font-family: "Courier New",Courier,monospace;">ContentResolver </span>knows your data is changed? It's your responsibility to tell it. In your implementation of <span style="font-family: "Courier New",Courier,monospace;">ContentProvider</span> or <i><b>internal database</b></i>, when you insert, delete, update the data successfully, you need to call <span style="font-family: "Courier New",Courier,monospace;">ContentResolver.notifyChange(Uri, ...)</span> to let <span style="font-family: "Courier New",Courier,monospace;">ContentResolver</span> know it should requery the hosted <span style="font-family: "Courier New",Courier,monospace;">Cursor</span> object keyed by the passed <span style="font-family: "Courier New",Courier,monospace;">Uri</span>.<br />
<br />
As for the internal database, if it is <span style="font-family: "Inconsolata",Courier,monospace;">SQLiteDatabase</span>, I prefer using <i><b>non-exported</b></i> <span style="font-family: "Courier New",Courier,monospace;">ContentProvider</span> because its well-established interface.<br />
<br />
<br />
<br />
<iframe frameborder="0" height="560px" src="https://docs.google.com/viewer?a=v&pid=explorer&chrome=false&embedded=true&srcid=0B0ZUw6inr9WXYzZiODA2ZTktYTc3Ny00MTk5LTlkYjEtZTQ5MDc5MDQ4MjZm&authkey=CJGVvOUJ&hl=en" width="100%"></iframe>Anonymoushttp://www.blogger.com/profile/07515835891250773234noreply@blogger.com