[iOS][Android] 許多好用的SDK蒐集(1)

[WWDC2014]影片學習心得

這裡放一些我看完WWDC2014 session 的心得

  • Introduce of Swift

    • 身為WWDC2014最大的震撼彈,Swift的發表代表著iOS/MacOS的開發也可以使用現代程式設計語言的特性.

    • Swift擁有的新的特性如下:

      • Generic

      • Tuples

      • Closure

    • 整個會場內容大多都是簡單地介紹語法,我覺得光是看官方語法就很足夠了.

  • Introduce CloudKit

    • 這是我最期待的session,因為他可以幫忙架設server的部分.

    • CloudKit 的簡介:

      • 主要是用來存取iCloud services

      • 支援OSX與iOS

      • 必須使用iCloud 帳號

      • 可以擁有公開(?)與隱秘的資料庫

    • Container

      • 基本單位,一個App會有一個Container

      • 負責讀取與寫資料到iCloud

    • Database

      • 一個app可以管理一個公開的跟一個私密的資料庫

        • 公開資料庫負責放共享的資料,只有在寫的時候才需要帳號~容量算在開發者身上

        • 私密資料庫負責放使用者資料,不論寫或是讀都需要帳號~容量算在使用者身上

    • Record:

      • 在我看起來很像是資料庫的Table一樣,不過他是採取Map的方式也就是Key->Value 才讀取/寫入
    • Record Zone:

      • 管理一堆的Record,有分成Default Zone 跟 Custom Zone.俱有資料管理的功能,可以找回一些修改的變動.
  • Design for Game Controller

    • 主要是介紹如何設計一個能搭配MFi(Made For iPhone/iPad/iPod)的外在遊戲控制器的app.

    • 所有的遙控器都支援GamePad而具有左右蘑菇頭的遙控器(joystick: API ThumbStick)會有GCExtendedGamePad

      • PressedChangedHandler: 可以接受按下去與放開的event

      • 可以偵測按鈕的敏感度(presure sensitive),官方也給一些幾個建議.

    •  新的部分(iOS8)如下:

      • Controller Forwarding

        • 把iPhone當成一個額外的控制器來控制其他iDevice(iPad) (以後應該有 Apple TV)

        • iPhone會被當成是搖桿而被GamePad API找到

      • Motion Forwarding

        • 可以用G Sensor 並且有三軸定位的資料結構
      • Idle Timer

        • 玩遊戲的時候到了iOS8 會自動把省電關閉螢幕的裝置關掉 (其實iOS7 是bug吧?)
      • Pause Button

        • 它是一個toggle的按鈕,要自己處理相關行為
      • Player Indicator LEDs

        • 也就是定位你是第幾個遙控器(看來敵人真的是一般的遊戲主機)

        • 當多人控制的時候,這邊有些部分要注意:

          • 好好的分配整個Indicator Array

          • 要分陪哪個控制器可以操控選單

          • 定義如果有任何遙控斷線的撞控(哪些要暫停~哪些不需要)

[iOS]好用的XCode快速鍵 - Work efficiency with xcode

https://developer.apple.com/videos/wwdc/2012/#402 

  • 關於 三欄式UI的打開跟關閉

    • [command + 0] -> 切換打開/關閉左邊欄

    • [command + option+ 0] -> 切換打開/關閉右邊欄

  • 關於搜尋

    • [command + shift + O] -> 快速搜尋

    • [command + option + click]  functions -> 可以快速找到implement  或是找出caller 或是 callee 

  • 類似瀏覽器的Tab相關控制

    • [command + T] -> 新增tab

      • 這個對我應該會相當的好用,原本是不知道有這樣的功能.
  • 跟縮排有關

    • [command + “[“ ] 向左縮

    • [command + “]“ ] 向右縮

  • 跟自動完成(auto complete)有關

    • [ctrl + “.”] 自動完成

    • [ctrl + “/“,  ctrl+shift+ “/“] 選擇自動完成

NewImage

[coursera][Functional Programming Principles in Scala] 關於課程學習心得(1)

偶然的狀況下,知道其實coursera 有在教 scala 的課程,於是多花一點自己的時間來學習.
其實主要的課程時間並不會花很多,就如同他所講的,一個禮拜頂多一兩個小時看video leture
但是assignment 可就不是開玩笑的了,每一次的assignment 都花了我好幾個晚上熬夜慢慢地看
目前到了week4 的階段,大概算是剛剛進入FP的世界,有一些心得可以分享:

  • 千萬要注意assignment 的 instruction

    • 或許也只有我吧,每次拿到作業就打開來想寫.結果就發現沒parameter或是沒有variable.其實都是因為沒有好好的看instruction 產生的.
  • 用Functional Programing 來思考 (Think with FP)

    • 由於我很習慣邊寫測試程式邊寫程式 (TDD is dead? XD) 所以這邊很容易遇到困難點

    • 幾個推薦的方式是回過頭去慢慢思考set 與 list 的本質,不要被  p => Boolean 搞破頭

 

這裡也記錄一些課程摘要,有興趣可以考慮修修看,畢竟是scala的創辦人開的課(法國人講英文沒那麼難懂)

  • week 0

    • 主要是sbt應用跟簡單的scala 程式架構
  • week 1 

    • 主要是recursive的programming有 Pascal’s Triangle,Parentheses Balancing 跟 Counting Change

    • 我覺得主要是換回你對於recursive programming 的熟悉程度

  • week 2

    • 一些關於set 的操作,不論是 union 還是 contains 

    • 這邊就開始考驗著Functional Programming 的概念了. 讓我相當痛苦…. 所以為了能夠更了解整個架構~我寫了很多的unit test case 並且把整個結果在main 裡面都印出來看.才能有點了解

  • week3

    • 感覺這次的比較實用,利用Set 與 List 來完成 TweetReader來尋找目前趨勢 Trending ,算是相當有用的課程,但是也很難.

    • 因為一開始整個程式碼架構相當的大,極度推薦把instruction 好好看完,再開始看要完成的部分.跟著instruction 一步步把需要完成的完成,會比較容易….

 弄了兩個禮拜~總算搞懂 week3 接下來要繼續努力 … week4…

[live555][OpenRTSP][SDL][ffmpeg] 利用ffmpeg 與SDL 達成 streaming 筆記(1)

這邊記錄一下筆記,因為太多公司內部的運作就無法貼code

  • 關於ffmpeg Streaming與 SDL

  • 從live555的 OpenRTSP 拿出 data buffer 丟到 ffmpeg 去decode

    • 這邊大概是我最不熟悉的部分,也是花最久時間的部分.一開始是拿openRTSP.c 來改

    • 由於我是接H264得source stream所以我拿 QuickTimeFileSink來用,選定MPEG4與MP4之後,其實檔案接下來都可以直接播放~這是沒有問題的.

    • 那如何要把資料接出來,方法如下:

      • 先到QuickTimeFileSink的 AfterGettingFrame 去implement 一個callback function

      • 其中最重要的是把buffer data 接出來

        • ioState->fBuffer->dataStart 這是frame buffer資料的起頭

        • packageDataSize 是frame buffer的大小

      • 由於資料是一個video frame 後面緊接著有數個audio frame,所以記得要先查看是哪一種格式好做相關的decode 準備

        • ioState->fOurSubsession.mediumName()
      • 至於接出來要怎麼decode 就要參考第一段的tutorial

      • 這裡要注意的是,由於拿到的frame data 是一張一張的,所以許多ffmpeg資料要填好 (SDL_AudioSpec)

  • 在ffmpeg中audio decoder無法順利地打開

    • 這個問題主要是在SDL_OpenAudio 可以正常開起,如果有把相關資料填對的話.但是卻無法開啟ffmpeg audio 的 avcodec_open2 

    • 原因是因為你需要把 audio Codec context 要填對,主要是:

      • adoContext->sample_rate

      • adoContext->channel

  • 在ffmpeg 接到的時候,video frame 無法順利decode

    • 這個狀況會很詭異的是,直接用ffmpeg 去接RTSP會成功,但是把一張張frame data接過來用ffmpeg去decode的話就會失敗.

    • 回去觀察原來的h264 frame data會發現,其實在video frame data buffer 起始的四個data 分別是

      • 0x00, 0x00, 0x00, 0x01
    • 所以如果把這四個位元加在video frame buffer的前面,就可以正常decode

 

先寫到這裡,其實還有許多更多的相關處理.之後整理一下心得在寫…. 

 

參考:

[研討會心得]PyCon APAC 2014 05/18 Day2 Note

Keynote: Jessica McKellar


R2 What Is Async, How Does It Work, and When Should I Use It?

A. Jesse Jiryu Davis http://emptysqua.re/blog/ https://twitter.com/jessejiryudavis


StreetVoice 改造後, 現在我們如何進行開發工作

http://tzangms.com/

  • StreetVoice

    • SimpleLife
  • Old street voice

    • windows + ASP 

    • no version control

  • New Street voice

    • Python + Django

    • MariaDB

    • redis

    • RabbitMQ

    • Git/Github

  • What changes

    • unit test

    • travis 

    • error tracking

    • sentry for JS/python

      • can use sentry for github issues.
    • deployment

    • saltstack

      • use one command line to push to all servers
    • hubot https://hubot.github.com/

    • hipchar -> hubot -> saltstack

      • using chat message to control deployment
  • Make it all together  — Hipchat

    • hipchat

    • error -> hipchat

    • Github update -> hipchat

  • github branch strategy

    • default — develop

    • When it done -> product branch

    • Implement new -> feature branch

  • Github submit flow

    • pull request

    • travis (unit test)

    • push back result on hipchat

  • Open Source Projects

  • Resource:

    • 工作流程: trello, github

    •   - 即時討論: hipchat

    •   - 錯誤追蹤: sentry

    •   - 單元測試: 使用 travis / coveralls, 搭配  pip wheels

    •     - 如何提升? 每週五衝 unit test, 在兩個月內衝了 10% coverage

    •   - 部署: saltstack + hubot

    •     我們有北京 + 台灣 + AWS 機房

    •   - 趣味: hubot

    •   - 現在我們持續開源:

    •     - ididit:  idonethis clone

    •     - django-celery-ses: Django Email Backend + SES + Celery

    •     - HysteriaPlayer: Streaming media player for iOS

如何用 grs 擷取台灣上市股票股價資訊 @toomore

http://www.toomore.net/

  • Why use python

    • Excel has limitation 65536

    • 81 days only 

  • 股票分析網站

    • 消息類

    • 注意與收集相關個股消息

    • 技術類

    • 看線圖的價跟量
  • grs

    • 本身偏技術分析

    • Install and using

    • pip install grs

    • from grs import Stock

    • stock(‘2618).info

    • grs-doc

    • it has version control, different version have diff doc
  • 簡單分析

    • 均價/均量

    • (Stock.MA, Sock.MAV)

    • 五日均價  Stock(‘2618’).MA(‘5’)

    • 均價乖離

    • Stock.MAO 

    • 乖離轉折點

    • Stock(‘2618).MAO

    • 四大買賣判斷

    • BestFourPoint

    • 買(賣)點

      • 負 (正) : 乖離扣至最大 量大收紅 (黑)

      • 負 (正) : 乖離扣至最大 量縮價不跌(跌)

      • 短期日 3/6/18 日 ~比起市場 5/20/60 日提早是因為想要更早看出線圖

    • from grs import BestFourPoint
  • 其他常用工具

    • 顯示台灣時間  TWTime

    • 是否開市  TWSEOpen

    • 個股即時盤  RealtimeStock

    • 大盤即時資訊  Realtimeeight

    • 上市~上櫃代碼 TWSENo OTCNo

    • 單日倒數時間 Countdown

  • 其他利用工具

    • XMPP rubot

    • using XMPP with grs+GAE
  • Resource


Rapid Web Development with Mezzanine Stephen McDonald

  https://pyconapac2014.hackpad.com/Keynote-Stephen-McDonald-day2-x4HpfSvNc1f

  • Why another CMS?

    • People do awesome job in marketing but don’t have good technical skills to back it up.

    • Try to abstract out the logic to make things reusable without copy-pasting.

  • ”You make different things if you focus on constraints instead of requirements.” — Benjamin Black (@b6n)

  • Mezzanine i

    • Constraints

    • Simplicity

    • Just Django

  • Model graph http://bit.ly/MezzLego

  • About Mezanine

    • class RichTextPAge(Page)

    • class Form(Page)

    • class Gallery(Page)

    • It is very easy to implement blog/shopping cart/gallery 

  • About Batteries included in Mezzanine

    • Python and Django is good ecosystem to provide more “power”

    • batteries include

    • Keywords, rating, threaded comments

    • search 

    • user editable setting

    • Multi-tenancy 

    • image thubnailing

    • caching

    • bootstrap + live edting

    • deploy tooling
  • Extra Batteries

  • Other ~70 packages

  • Resource:


Functional Programming in Python

https://pyconapac2014.hackpad.com/Functional-Programming-in-Python-101-nvp9OVl6NPz

http://www.slideshare.net/littleq0903/functional-programming-in-python-33358806


以廣告品項為基礎的行動廣告推薦系統: 以 Python Hadoop Streaming 實作

  • Mobile Advertise System

    • Impression AD

    • Banner, Or any kind of AD in mobile system

    • Conversion

    • 到定點列印QR code 去兌換東西

    • Landing pages

    • 可以顯示廣告接受人與店家的距離
  • 行動廣告重要數據

    • Click Through Rate (CTR)  每一百次顯示有多少點擊次數

    • Conversion Rate 產生的實際行為

    • Goal:

    • Maximum CTR and conversations
  • Architect

    • Http Host

    • DB: Couch DB (NoSQL)

    • In memory grid for realtime backend process.

    • Hadoop distributed + spark + HBase

    • Web

    • Django + SSH

    • AD video, image

    • CDS

    • Message Queue

    • Ad Operation

    • Reporting Operation
  • Data Selection -> Machine Learning -> Prediction -> Evaluation (for machine learning adjustment)

High Performance Tool with Python

Andreas Klöckner 

  • Scripting language are SLOW

  • Let computing in OpenCL other using Python

  • OpenCL

    • JIT build kernel
  • Moving Data

    • Latency

    • Higher Current (more power)

  • Programing Model need modification to adopt concurrency Parallelism

  • Parallel Programming 

  • PyOpenCL

    • Benefit in just use OpenCL

    • PyOpenCl will compile and cache the kernel code for you.

    • Auto cleanup

    • Error Checking
  • Machine generate code (code generation)

    • Using PyOpenCL could generate kernel by using some function packages

    • Let machine generate OpenCL kernel code for you.

    • Automated tuning

    • data types 

    • specialize code for given problem

    • constants faster than variables

    • Loop unrooling
  • Scan problem (input need last output)

    • 1 , 1, 2, (1+1+2) 4, (1+1+2+4) 8

    • Using GenericScan in OpenCL you don’t need write any kernel code here.

  • Loop Generation 

    • c[i, j] = a[i] * b[j]

    • It is very hard for OpenCL to do it because it need other input

  • Bonus Features

    • A-priori bounds checking

    • Generate a sequential version of code

    • Automatic Benchmarking

    • Free tuning advice

    • Local memory layout

    • Automatic Testing

    • Data layout transformation
  • loo.py

    • Will be MIT, release in summer
  •  http://andreask.cs.illinois.edu/aboutme/