Retrofit Android example | Web services using Retrofit
http://www.androidwarriors.com/2015/08/retrofit-android-example-web-services.html
Retrofit Android Tutorial to Get JSON from Server
Android Studio Parsing Json Using Retrofit
Retrofit — Basic Authentication on Android
https://futurestud.io/blog/android-basic-authentication-with-retrofit
Make Your First Android App: Part 3/3
https://www.raywenderlich.com/56111/make-first-android-app-part-3
星期二, 3月 29, 2016
星期一, 3月 28, 2016
User Story Good Articles
用户故事驱动的敏捷开发 – 1. 规划篇
http://devopshub.cn/2016/02/28/user-story-driven-agile-development-1-planning/
http://geek.csdn.net/news/detail/63625
http://devopshub.cn/2016/01/10/user-story-mapping-for-the-first-time/
http://devopshub.cn/2016/01/11/how-to-create-user-story-mapping/
http://devopshub.cn/2016/02/28/user-story-driven-agile-development-1-planning/
http://geek.csdn.net/news/detail/63625
http://devopshub.cn/2016/01/10/user-story-mapping-for-the-first-time/
http://devopshub.cn/2016/01/11/how-to-create-user-story-mapping/
星期六, 3月 26, 2016
在ubutnu 14.04安裝ffmpeg
http://www.faqforge.com/linux/how-to-install-ffmpeg-on-ubuntu-14-04/
sudo add-apt-repository ppa:mc3man/trusty-media
sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get install ffmpeg
Why redirect output to 2>&1 and 1>&2?
Why redirect output to 2>&1 and 1>&2?
http://superuser.com/questions/436586/why-redirect-output-to-21-and-12
簡單的說,就是把stderr(2) 轉向到stdout(1), 讓一些命令可以進一步處理,例如grep就只能讀stdout的資料,如果我們想處理stderr的結果,就要2>&1
另外一種情況是想把stderr的錯誤也記錄下來到同一檔案, 可以一樣的做法。
http://superuser.com/questions/436586/why-redirect-output-to-21-and-12
簡單的說,就是把stderr(2) 轉向到stdout(1), 讓一些命令可以進一步處理,例如grep就只能讀stdout的資料,如果我們想處理stderr的結果,就要2>&1
另外一種情況是想把stderr的錯誤也記錄下來到同一檔案, 可以一樣的做法。
ns2 codelite debug gdb ubutnu 14.04 Setting
- Create Project using Project Wizard, and then select custom Makefile since we already have one in ns-2.35 directory
- Go to project setting to set the working directory
- Remember to modify Makefile add -g setting for debug
- Enable gdb debug, then you can add breakpoint like visual studio.
- Remember to right click the project, and select to "Import File(Directorys)...", in the filter, remember to add "*.cc;*.tcl" to add cc and tcl scripts
http://stackoverflow.com/questions/7832892/how-to-change-the-default-gcc-compiler-in-ubuntu/7834049#7834049
http://stackoverflow.com/questions/14997275/gdb-and-ns2-how-to-stop-program-at-some-function-call
星期三, 2月 17, 2016
H.264 SPS, PPS, Slice, MB主要資訊
SPS(Sequence Parameter Set)主要描述影片串流的資訊,此外也包含vui的資訊:
- profile_idc: 代表視訊所用的H264 Profile,如 Base, Extension, High Profile。codec會根據profile來初始化一些參數。
- pic_order_cnt_type: 代表計算圖片顯示順序(Picture Order Count, POC)所採用的方式 (POC Type)。大部分為零。
- log2_max_frame_num_minus4: 代表畫面幀的最大數字((值+4)*2)。在解碼時,會有緩衝區用來儲存I, P參考幀,該緩衝區會重覆使用。每個畫面幀在解碼時會有一個frame_num數字,代表該畫面於解碼緩衝區id。
- pic_width_in_mbs_minu1: 畫面幀的寛度,以microblock為單位。
- pic_height_in_map_units_minus1: 畫面幀的高度,以map unit為單位?。
- direct_8x8_inference_flag: 描述mv預測方式。
- vui:
- num_units_in_tick: 時間單位
- time_scale: 每個時間單位播幾張畫面
PPS(Picture Parameter Set)主要描述畫面幀(或field場)資訊:
- pic_parameter_set_id: PPS的id,在一個影片中會有很多畫面幀或片段(Slice),這些畫面片段會參考PPS的設定進行編解碼。
- seq_parameter_set_id: 目前PPS所參考到的SPS id。
- entropy_coding_mode_flag: 畫面幀壓縮方法,如1代表CABAC。
Slice Header:
- first_mb_in_slice: 第一個mb在slice中的位置,通常為0。
- slice_type: Slice的類型,如 I, P, B frame/slice
- frame_num: 在緩衝區的frame id
MicroBlock:
星期二, 2月 16, 2016
CodeLite使用補充
- 安裝cscope
https://github.com/eranif/codelite/issues/795
- 假如程式碼不需要build只想要查尋原始source code,則可匯入舊的程式碼,如library。(忽略custom build, 如果是用msys2等,直接打開shell 在msys2下make編譯library就好,不要再codelite中設定)。
假設舊的程式碼在
D:\TestArea\MyCustomProject and uses makefile for the build process.
The fastest way to import this project into CodeLite is:
- Create a new project Workspace -> Create New Project give it any name and place it under
D:\TestArea\MyCustomProject( you can check the option 'create the project under a separate directory' )
- Right-click on the project, and select Import Files From Directory. The import dialog will pop up; accept its defaults and click OK. (匯入不會把檔案複製一遍,原檔案還是會留在原來的地方)
- Once the import process completes, you can expand the tree to the left, where you should see all source files imported from the disk.
- You can add / delete any targets from the Project Settings -> Customize >Custom Build , the below screenshot shows how to add a cmake target
ffmpeg parser libx264資料
- FFMPEG结构体分析:AVFormatContext
http://blog.csdn.net/leixiaohua1020/article/details/14214705
- 使用FFMPEG类库分离出多媒体文件中的H.264码流
http://blog.csdn.net/leixiaohua1020/article/details/11800877
- FFmpeg的H.264解码器源代码简单分析:解析器(Parser)部分
http://blog.csdn.net/leixiaohua1020/article/details/45001033
- 最简单的视频编码器:基于libx264(编码YUV为H.264)
http://blog.csdn.net/leixiaohua1020/article/details/42078645
- 下載x264 程式碼
- git clone git://git.videolan.org/x264.git
- 下戴yasm
http://yasm.tortall.net/Download.html - 改名字,並複製到d:\msys64\usr\bin\yasm.exe.
YASM Setup
Download YASM executable from http://yasm.tortall.net/Download.html. You have to download the "general use" binaries and NOT the ones for VS2010. Either Win32 or Win64 binaries support outputting object files for both architectures so that should not matter. The last tested version was yasm-1.3.0-win64.exe.
Rename the downloaded executable to yasm.exe and place it in your MSYS2 path. E.g.C:\msys64\usr\bin\yasm.exe.
- 到codelite設定一下路徑
- 問題: codelite中,debugger有時候會不work,到設定中修改automatically set...就可以除錯
- 問題: 在編譯完後執行後產生不出來h264檔案,x264_encoder_encode函式傳回值為0, pNals, iNal值也為0,原因為多執行緒 delay encode的問題,如下:
http://blog.sina.com.cn/s/blog_51396f890102f061.html
到程式39行,新增一行
pParam->i_threads = 1;
強制thread為1就解決delay encode的問題,但是效能會比較差。
星期一, 2月 15, 2016
NALU h.264 相關資料
Concept:
一步一步解析H.264码流的NALU(SPS,PSS,IDR)
- Exploring H.264. Part 2: H.264 Bitstream format
http://gentlelogic.blogspot.tw/2011/11/exploring-h264-part-2-h264-bitstream.html
一步一步解析H.264码流的NALU(SPS,PSS,IDR)
http://guoh.org/lifelog/2013/10/h-264-bit-stream-sps-pps-idr-nalu/
- 解讀h264 SPS的參考資料
The h.264 Sequence Parameter Set
https://cardinalpeak.com/blog/the-h-264-sequence-parameter-set/
- IDR介紹
http://www.programgo.com/article/73452314422/
- 如何区分H.264视频流的I frame 和 P frame
http://www.yaosansi.com/post/how-to-distinguish-between-I-frame-and-P-frame-H264-video-streams/
- x264命令行參數解釋
https://www.ptt.cc/bbs/AVEncode/M.1305719689.A.615.html
- tool to extract H.264 frame size vector
http://forum.doom9.org/showthread.php?t=149122
- ffprobe showframes 再結合awk或其它工具,就可以抓frame的資訊
https://trac.ffmpeg.org/wiki/FFprobeTips
MSVC 使用linux C Library的方法
Microsoft Visual C++可以使用linux 有source code 的函式庫,如libjpeg等,方法如下:
- 利用mingw 編譯liunx library,產生.a 及dll
- 利用gcc 產生def檔, e.g.,
gcc -shared -o your_dll.dll your_dll_src.c -Wl,--output-def,your_dll.def
- 利用MSVC的工具lib.exe ,結合dll及.def 檔轉換成.lib檔,之後就可以在vc內使用
lib /def:your_dll.def
Note: 只能轉換C library,不能轉換C++ Library,因為gcc 跟 msvc在處理C++ Library的方式不相容,所以只能轉換C 函式庫
如何在vc內使用c lib?
例子:
extern "C" {
include "openssl.h"
}
Reference:
- How to use libraries compiled with MingW in MSVC?
http://stackoverflow.com/questions/2529770/how-to-use-libraries-compiled-with-mingw-in-msvc
Mingw 64及codelite安裝
[更新,簡易安裝方法,直接下載codelite進行安裝。第一次安裝時會提示是否要安裝gcc,這時選擇tdm-gcc 64下載及安裝後,再回到codelite掃描環境,就會把相關參數一次設定好,不用像下文要手動設定 (但是codecomplete 還是要自己設定一下,比較好用。]
mingw 是最小化的gun tools for windows開發環境
msys 是最小化的linux shell,處理一些環境變數,基於cygwin
從source forge 安裝 mingw 64的installer 會有問題,所以參考下列網站,先安裝msys2,再由msys2的套件管理程式安裝mingw-64
1. 如何在 Windows 上面使用 gcc 進行 C/C++ 程式開發
https://www.gitbook.com/book/shaochien/how-to-use-gcc-to-develop-c-cpp-on-windows/details
2. 安裝開發工具codelite
http://codelite.org/
mingw 是最小化的gun tools for windows開發環境
msys 是最小化的linux shell,處理一些環境變數,基於cygwin
從source forge 安裝 mingw 64的installer 會有問題,所以參考下列網站,先安裝msys2,再由msys2的套件管理程式安裝mingw-64
1. 如何在 Windows 上面使用 gcc 進行 C/C++ 程式開發
https://www.gitbook.com/book/shaochien/how-to-use-gcc-to-develop-c-cpp-on-windows/details
- Update the system packages with (Arch-Linux 的 pacman 套件管理程式,跟yum, apt類似的套件管理程式)
pacman --needed -Sy bash pacman pacman-mirrors msys2-runtime
- 關掉 MSYS2, 再執行一遍( run it again from Start menu and update the rest with)
pacman -Su
- 安裝git
pacman -S git
- 用套件管理程式安裝 GCC
pacman -S mingw-w64-i686-gcc
pacman -S mingw-w64-x86_64-gcc
pacman -S gcc
- 使用 gcc -v 來檢查是否安裝成功
- 安裝gdb
pacman -S gdb
- 安裝make
pacman -S make
2. 安裝開發工具codelite
http://codelite.org/
- 設定codelite及mingw 64 gcc compiler,到 build選單
- 補充設定make及gdb路徑
- 設定codecompletion路徑,寫程式才會自動找到function, class自動補上
- 建新專案,測試及執行
星期五, 12月 25, 2015
星期三, 12月 16, 2015
word vba
Sub ListUsedBookmark()
'
' ListNotUsedBookmark 巨集
'
'
Dim oField As Field
Dim sCode As String
Dim bFoundOne As String
For Each oField In ActiveDocument.Fields
If oField.Type = wdFieldSequence Then
sCode = oField.Code
' If InStr(sCode, "ref") <> 0 Then
' If oField.Result.Text = "57" Then
' Debug.Print oField.Result.Text
' End If
' End If
End If
'找出有cite到的reference
If oField.Type = wdFieldRef Then
sCode = oField.Code
If InStr(sCode, "REF") <> 0 Then
Debug.Print oField.Result.Text
End If
End If
Next
End Sub
'
' ListNotUsedBookmark 巨集
'
'
Dim oField As Field
Dim sCode As String
Dim bFoundOne As String
For Each oField In ActiveDocument.Fields
If oField.Type = wdFieldSequence Then
sCode = oField.Code
' If InStr(sCode, "ref") <> 0 Then
' If oField.Result.Text = "57" Then
' Debug.Print oField.Result.Text
' End If
' End If
End If
'找出有cite到的reference
If oField.Type = wdFieldRef Then
sCode = oField.Code
If InStr(sCode, "REF") <> 0 Then
Debug.Print oField.Result.Text
End If
End If
Next
End Sub
星期六, 11月 28, 2015
星期二, 10月 20, 2015
Django 設定建議
Django 設定好文章
reference:
http://www.revsys.com/blog/2014/nov/21/recommended-django-project-layout/
https://docs.djangoproject.com/en/1.8/intro/reusable-apps/
在Django中,樣板templates目錄及statics目錄可以有很多種設定方法:
Project based: 在setting.py中,設定
#設定靜態檔案的系統根目錄
STATIC_ROOT = os.path.join(BASE_DIR, '/static_root')
STATIC_URL = '/static/'
*其中STATIC_URL是當Server看到/static/目錄的request, 則Server會到STATIC_ROOT下映射去找資料,如果找不到,則會到每個 App目錄下去找static子目錄查詢內容。
*在template中的用法 (helpers function)
static: To link to static files that are saved in STATIC_ROOT Django ships with a static template tag.
#設定樣版檔案的系統目錄
TEMPLATE_DIRS = (
join(BASE_DIR, 'templates'),
)
*當Python看到/template/目錄的request, 則Server會到TEMPLATE_DIRS 下映射去找資料,如果找不到,則會到每個 App目錄下去找/templates/子目錄查詢內容。
*在每個app的/template/目前下,建議再建立app名字同名子目錄,方便render函式辨視及搜尋不同app的樣版檔案。例如render(polls/index.html),則系統會依路徑去找,所以會依下列方式 去找
mysite/templates/polls/index.html ,如果找不到,就會找
mysite/polls/templates/polls/index.html
#設定上傳檔案的系統根目錄
MEDIA_ROOT = os.path.join(BASE_DIR, '/upload_root')
MEDIA_URL = '/upload/'
*在FileField的upload_to會把檔案存在MEDIA_ROOT指定的路徑中。
*在template中的用法 (helpers function)
get_media_prefix: Similar to the get_static_prefix, get_media_prefix populates a template variable with the media prefix MEDIA_URL, e.g.:
{% load static %}
data-media-url="{% get_media_prefix %}">
#設定每個APP urls 路由方式
reference:
http://www.revsys.com/blog/2014/nov/21/recommended-django-project-layout/
https://docs.djangoproject.com/en/1.8/intro/reusable-apps/
在Django中,樣板templates目錄及statics目錄可以有很多種設定方法:
Project based: 在setting.py中,設定
#設定靜態檔案的系統根目錄
STATIC_ROOT = os.path.join(BASE_DIR, '/static_root')
STATIC_URL = '/static/'
*其中STATIC_URL是當Server看到/static/目錄的request, 則Server會到STATIC_ROOT下映射去找資料,如果找不到,則會到每個 App目錄下去找static子目錄查詢內容。
*在template中的用法 (helpers function)
static: To link to static files that are saved in STATIC_ROOT Django ships with a static template tag.
{% load static % }
src="{% static "images/hi.jpg" %}"
#設定樣版檔案的系統目錄
TEMPLATE_DIRS = (
join(BASE_DIR, 'templates'),
)
Deprecated since version 1.8: Set the DIRS option of a DjangoTemplates backend instead. 1.8版要改設一定為DIRS
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [
join(BASE_DIR, 'templates'),
],....}
*當Python看到/template/目錄的request, 則Server會到TEMPLATE_DIRS 下映射去找資料,如果找不到,則會到每個 App目錄下去找/templates/子目錄查詢內容。
*在每個app的/template/目前下,建議再建立app名字同名子目錄,方便render函式辨視及搜尋不同app的樣版檔案。例如render(polls/index.html),則系統會依路徑去找,所以會依下列方式 去找
mysite/templates/polls/index.html ,如果找不到,就會找
mysite/polls/templates/polls/index.html
#設定上傳檔案的系統根目錄
MEDIA_ROOT = os.path.join(BASE_DIR, '/upload_root')
MEDIA_URL = '/upload/'
*在FileField的upload_to會把檔案存在MEDIA_ROOT指定的路徑中。
*在template中的用法 (helpers function)
get_media_prefix: Similar to the get_static_prefix, get_media_prefix populates a template variable with the media prefix MEDIA_URL, e.g.:
{% load static %}
data-media-url="{% get_media_prefix %}">
#設定每個APP urls 路由方式
polls/
__init__.py
admin.py
models.py
tests.py
urls.py
views.py
mysite/urls.py其中^polls/結尾不能有$字號, Django 會移除己配對的字串,再把後續字串送到app目錄下的urls模組處理。from django.conf.urls import include, url from django.contrib import admin urlpatterns = [ url(r'^polls/', include('polls.urls')), url(r'^admin/', include(admin.site.urls)), ]
polls/urls.py
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', views.index, name='index'),
]
星期五, 7月 31, 2015
ios auto layout and size class
nice reference:
Size Classes 解決各種螢幕大小的問題
- h: any, w:any是大家共的的layout, 放在這上面的控制項,每個iphone 解析度都看的到
- h: regular, w:compact是直式螢幕,放在這上面的控制項,只有直式iphone 解析度看的到
Constraints 限制則是用來定位控制項大小及位置的方式
IOS8 Constraints and Size Classes
星期五, 7月 10, 2015
Python Flask Quick Guide
Django 功能強,但是不易學習,在設定上比較麻煩,Flask比較容易上手,可以快速架出restful 服務
Videos:
https://www.jetbrains.com/pycharm/documentation/
使用rest api及angular js的好影片
PyCharm Web Magic: Building a Pinterest Clone
Deploying Flask on Google App Engine
使用template方式架的影片
PyCharm - Flask Tutorial
Flask Authentication
http://blog.miguelgrinberg.com/post/restful-authentication-with-flask
Videos:
https://www.jetbrains.com/pycharm/documentation/
使用rest api及angular js的好影片
PyCharm Web Magic: Building a Pinterest Clone
Deploying Flask on Google App Engine
使用template方式架的影片
PyCharm - Flask Tutorial
Flask Authentication
http://blog.miguelgrinberg.com/post/restful-authentication-with-flask
星期六, 6月 27, 2015
Video Streaming Server, MP4, moov, and pseudo streaming
MP4 預設格式不適合seek in tcp streaming, 把moov atom移到MP4檔頭前,就可以加強seek功能
Streaming a video file to an html5 video player with Node.js so that the video controls continue to work?
http://stackoverflow.com/questions/24976123/streaming-a-video-file-to-an-html5-video-player-with-node-js-so-that-the-video-c
Seeking videos beyond the buffer line
http://1stdev.com/tremendum-transcoder/articles/seeking-videos-beyond-the-buffer-line/
HTTP Streaming 相關技術 pseudo, live
http://virdust.blogspot.tw/2011/11/http-streaming-pseudo-live.html
Streaming a video file to an html5 video player with Node.js so that the video controls continue to work?
http://stackoverflow.com/questions/24976123/streaming-a-video-file-to-an-html5-video-player-with-node-js-so-that-the-video-c
Seeking videos beyond the buffer line
http://1stdev.com/tremendum-transcoder/articles/seeking-videos-beyond-the-buffer-line/
HTTP Streaming 相關技術 pseudo, live
http://virdust.blogspot.tw/2011/11/http-streaming-pseudo-live.html
星期二, 6月 23, 2015
Django REST API and OAuth Good Reference, plus android client
A type-safe REST client for Android and Java
http://square.github.io/retrofit/
How to make a full fledged REST API with Django OAuth Toolkit
https://ep2014.europython.eu/en/schedule/sessions/81/
https://youtu.be/M6Ud3qC2tTk
訂閱:
文章 (Atom)


















