2012年7月3日 星期二

[tools] 找domain有無被用走的方便工具

https://github.com/zachwill/dom

$ pip install dom # 安裝
$ dom foo # 列出相關domain有無被註冊

2012年6月26日 星期二

[note] 2012 GDC Taipei - Aaron Pulkka (Rabbx) 利用AAA電腦/遊戲機遊戲開發經驗來獲得智慧手機/平板電腦遊戲的成功



AAA
------
  - big buget
  - large item
  - long development schedule
  -  requirement:
      * large scope,
      * broad feature set
  - long play time
  - high quality/ polish
  - innovation?
  - no middle in game market
  - marketing costs >= development costs


.. note:: core gamers bring high expectations but are willing to pay
.. note:: late adopters form new casual audience, but want to pay less


1. High Quality User Experiance
   - responsive
     - 0.1s good
     - 0.5s slow
   - consistent
   - clear/obvious
   - forgiving

  * Lasting Appeal
    - Ramping difficulty + Random Chance + Increasing Rewards = Replayability
    - Rollercoaster Excitement Curve

  * Quality Assurance
    - Start QA early, ramp-up from alpha through launch
    - 100 little bugs worse than 1 big bug

2. Launch Multiplatform

  * cross-platform social play allowed on mobile and can increase audience growth dramatically
  * Amortize Development & Marketing
  * Build game as native to each platform
    - meet 'cultural' expectations
    - tune for platform specific features
      * xbox live! rich presence
      * apple game center & retena display
      * android 'back'
3. Connect with yurr audience
  * Most AAA gamers target core gamers (young males)
  * konwing your audience
    * mobile has potential for broader audience
      - casual audience spends less per user
      - broader audience can increase costs
  * community anagement
      - best marketing: word-of-mouth
      - metric tracking can help filter noise
      - press is not magic entity but part of your community
      * bioware & blizzard provide great example
  * App store
    understanding how each app store search function works is key

  * Plannang
    - launch of game is just the beginning
    * plan for updates
      - DLC for AAA games usually in development before game launches
      - post-launch, be ready to modify update plan based on users

  * tools
    - metric tracking (flurry, bitpollen)
    - project management (Hansoft)
    - Feedback (Forum)

Naughty Dog (AAA developer with no project managers)


* clones copy a proven base set of features, without adding much new.
* experimental games focus more on innovation, generally at the expense of scope and polish
* AAA games focus on evolution and polish on proven features


smartphone
* short session
* always connected to Internet
tablate
* longer session
* often disconnected from Internet


AAA to mobile
* smaller scope
- app store
- more qualtiy
- more budget
+ larger possible audience
+ core gamers willing to pay to play


New Territory
---------------
TV + Mobile:
* Google TV
* Apple TV
* Transmedia
TV + Console + Mobile:
* MS Smart Glass
Tactile Controls:
* joysticks and buttons on mobile? (we missed buttons)


[note] 2012 GDC Taipei - Metro Style Game for Windows 8

Metro App min resolution: 1024x768
如果Metro App resolution大於1366x768+會在前景另外開一個APp (Snap View?)
Tile 動態磚, 每個是不同Entry Point, 同一個遊戲可有不同進入點 (從不同關卡進去)
Data sync:
* App Data(setting...)
* User Data (music, library...) -  live.com 帳號
Game可在任意時間(電動打一半)分享, 分享給個social service, 或"另一個App" (puzzle...)
統一Settings (Setting的framework?), 統一使用者體驗
http://ie.microsoft.com/testdrive/

2012年6月10日 星期日

好fish shell, 不用嗎

shell很多了: bash, ksh, dash, zsh... 在PyCon Taiwan 2012聽到這個很好用的fish shell,目前我只能發現自動補齊和指令顏色顯示很方便,不用很複雜的設定,就很好用了。

1. 在Mac OSX用brew安裝:
brew install fish
2. 設定檔在: ~/.config/fish/config.fish (自己新增) 顯示git branch,
    參考: https://wiki.archlinux.org/index.php/Fish#Configuration_Suggestions

3. 換預設shell:
chsh -s /usr/local/bin/fish
4. 以上出現"non-standard shell"錯誤, 到/etc/shells加"/usr/local/bin/fish"

但是指令和bash/zsh不太合。

2012年5月7日 星期一

Git 強制pull

git pull時出現 error: Untracked working tree file 'foo.bar' would be overwritten by merge. Aborting
git fetch --all
git reset --hard origin/master
ref: http://stackoverflow.com/questions/1125968/force-git-to-overwrite-local-files-on-pull

2012年5月2日 星期三

[Python][Javascript] Python抓Javascript產生的頁面 (phantomJs)

一向都是用Python的Beautiful Soup來parse網頁,現在出到第四版,更好用文件也好看多了。
from BeautifulSoup import BeautifulSoup
改成
from bs4 import BeautifulSoup
method name也有改,參考。 不過這次遇到的是內容是javascript產生的,如play.google.com,以前可能看一下js的code,學他送http request出去就可抓回來,現在的js越來越複雜,不好搞。
幸好有PhantomJS這種東西(headless WebKit with JavaScript API),就可以很方便的用webkit把網頁內容全開出來(跑完javascript)。 既然是javascript,DOM的selector就用jquery吧(page.injectJs("jquery.min.js"))。
var page = require('webpage').create(),
    t, address;

if (phantom.args.length === 0) {
    //console.log('Usage: loadspeed.js ');
    phantom.exit();
} else {
    address = phantom.args[0];
    page.open(address, function (status) {
        if (status !== 'success') {
            //console.log('FAIL to load the address');
        } else {
          
           if (page.injectJs("jquery.min.js")) {
                //console.log("jQuery loaded...");
            }

            var get_data = page.evaluate(function () {
              var data = {}
              data['title'] = $('h1.doc-banner-title').text();
              data['content'] = $('#doc-original-text').text();
              data['icon'] = $('.doc-banner-icon img').attr('src');
              var img_list = []
              $('.screenshot-carousel-content-container img').each(function(){ img_list.push($(this).attr('src')) });
              data['images'] = img_list

              return JSON.stringify(data);
            });
          console.log(get_data);
          phantom.exit();
        }

    });
}
command line執行$ phantomjs my_scrapy.js my_url console.log裡的資料就回跑出來了。 Python裡用commands.getoutput,再json.loads把JSON拆成dict,大改就這樣吧。
import commands
import json

out = commands.getoutput(my_cmd)
data = json.loads(out)

[Flask] multiple file input 上傳多檔案

這個害我傷腦筋好久,Flask處裡form的post,透過Werkzeug處理,如果是單一name,用request.values()(串列list)或request.form(dict),就可以抓到。如過是多重name,如:
<input name="animal" type="checkbox" value="lion" />
<input name="animal" type="checkbox" value="tiger" />
就要用request.form.getlist('animal')取的list。

檔案上傳:
<input name="icon[]" type="file" />
就要用request.files,是一個werkzeug自定的ImmutableMultiDict。 如果是同一個name的多檔案(input array)
<input name="image[]" type="file" />
<input name="image[]" type="file" />
request.files裡有值,但是用for j in request.files:同一個input name只能抓第一個出來,有人說Flask-WTF的FileField可以解決(沒試過)。後來去看了Werkzeug的原始碼:
class MultiDict
...
def iteritems
...
學他用
for key, values in dict.iteritems(request.files):
     for value in values:
         print key, value
就可以了。