Archive for December, 2014

作者:AngryFox 分类: Uncategorized December 25th, 2014 暂无评论
yum install strace
strace -p 15118
需要分析PHP代码的性能,或者说实现同样功能的代码到底哪个更好呢?或者说想知道底层的实现可以使用VLD查看opcode
下载与安装VLD
# wget http://pecl.php.net/get/vld-0.11.2.tgz
# tar zxvf vld-0.11.2.tgz
# cd ./vld-0.11.2
# /usr/local/php/bin/phpize              或者直接phpize
# ./configure --with-php-config=/usr/local/php/bin/php-config --enable-vld
# make && make install
---------------------------------
编辑php.ini文件激活vld扩展:
php.ini位置
#cd /usr/local/php/lib
增加
extension=vld.so
增加test.php
<?php
$a = '123';
echo $a

php -dvld.active=1 ./test.php

git clone https://github.com/ericzhang-cn/opdumper.git
Opdumper支持类似vld的命令行方式输出opcode,只需在执行php命令时通过-d参数将opdumper.active=1传入
php -d opdumper.active=1 foo.php
作者:AngryFox 分类: Uncategorized December 23rd, 2014 暂无评论

1.product->clean
2.product->manage schems
3.->edit
4.info选项卡->build->release->ok
5.product->build->(生成app)
6.将app拖到itunes->应用程序
7.右键->show in finder

作者:AngryFox 分类: Uncategorized December 22nd, 2014 暂无评论

提到的所谓的内建函数是指那些在Swift中不需要导入任何模块(如Foundation等)或者引用任何类就可以使用的函数。

abs(signedNumber): 返回给定的有符号数字的绝对值。很简单,但是没有在文档中记录。
abs(-1) == 1
abs(-42) == 42
abs(42) == 42 

contains(sequence, element): 如果给定的序列(如数组)包含特定的元素,则返回true。
var languages = ["Swift", "Objective-C"]
contains(languages, "Swift") == true
contains(languages, "Java") == false
contains([29, 85, 42, 96, 75], 42) == true 

dropFirst(sequence): 返回一个去掉第一个元素的新序列(如数组)。
var languages = ["Swift", "Objective-C"]
var oldLanguages = dropFirst(languages)
equal(oldLanguages, ["Objective-C"]) == true 

dropLast(sequence): 返回一个的新序列(如数组),该序列去掉作为参数传递给函数的最后一个元素。
var languages = ["Swift", "Objective-C"]
var newLanguages = dropLast(languages)
equal(newLanguages, ["Swift"]) == true 

dump(object): 一个对象的内容转储到标准输出。
var languages = ["Swift", "Objective-C"]
dump(languages)
// Prints:
// ? 2 elements
// - [0]: Swift
// - [1]: Objective-C 

equal(sequence1, sequence2): 如果序列1和序列2包含相同的元素,则返回true。
var languages = ["Swift", "Objective-C"]
equal(languages, ["Swift", "Objective-C"]) == true
var oldLanguages = dropFirst(languages)
equal(oldLanguages, ["Objective-C"]) == true 

filter(sequence, includeElementClosure): 返回序列的一个元素,这个元素满足includeElementClosure所指定的条件。
for i in filter(1...100, { $0 % 10 == 0 })
{
    // 10, 20, 30, ...
    println(i)
    assert(contains([10, 20, 30, 40, 50, 60, 70, 80, 90, 100], i))
} 

find(sequence, element): 再给定的序列中返回一个指定的索引,如果在序列中没有找到这个元素就返回nil。
var languages = ["Swift", "Objective-C"]
find(languages, "Objective-C") == 1
find(languages, "Java") == nil
find([29, 85, 42, 96, 75], 42) == 2 

indices(sequence): 在指定的序列中返回元素的索引(零索引)。
equal(indices([29, 85, 42]), [0, 1, 2])
for i in indices([29, 85, 42]) {
    // 0, 1, 2
    println(i)
} 

join(separator, sequence): 返回一个由给定的分隔符分离出来的序列的元素。
join(":", ["A", "B", "C"]) == "A:B:C"
var languages = ["Swift", "Objective-C"]
join("/", languages) == "Swift/Objective-C" 

map(sequence, transformClosure): 如果transformClosure适用于所给序列中所有的元素,则返回一个新序列。
equal(map(1...3, { $0 * 5 }), [5, 10, 15])
for i in map(1...10, { $0 * 10 }) {
    // 10, 20, 30, ...
    println(i)
    assert(contains([10, 20, 30, 40, 50, 60, 70, 80, 90, 100], i))
} 

max(comparable1, comparable2, etc.): 返回函数所给参数中的最大值。
max(0, 1) == 1
max(8, 2, 3) == 8 

maxElement(sequence): 返回所给序列的同类元素中的最大元素。
maxElement(1...10) == 10
var languages = ["Swift", "Objective-C"]
maxElement(languages) == "Swift" 

minElements(sequence): 返回所给序列的同类元素中的最小元素。
minElement(1...10) == 1
var languages = ["Swift", "Objective-C"]
minElement(languages) == "Objective-C" 

reduce(sequence, initial, combineClosure): 从第一个初始值开始对其进行combineClosure操作,递归式地将序列中的元素合并为一个元素。
var languages = ["Swift", "Objective-C"]
reduce(languages, "", { $0 + $1 }) == "SwiftObjective-C"
reduce([10, 20, 5], 1, { $0 * $1 }) == 1000 

reverse(sequence): 返回所给序列的倒序。
equal(reverse([1, 2, 3]), [3, 2, 1])
for i in reverse([1, 2, 3]) {
    // 3, 2, 1
    println(i)
} 

startsWith(sequence1, sequence2):如果序列1和序列2的起始元素相等,则返回true。
startsWith("foobar", "foo") == true
startsWith(10..100, 10..15) == true
var languages = ["Swift", "Objective-C"]
startsWith(languages, ["Swift"]) == true 

abs(...)
advance(...)
alignof(...)
alignofValue(...)
assert(...)
bridgeFromObjectiveC(...)
bridgeFromObjectiveCUnconditional(...)
bridgeToObjectiveC(...)
bridgeToObjectiveCUnconditional(...)
c_malloc_size(...)
c_memcpy(...)
c_putchar(...)
contains(...)
count(...)
countElements(...)
countLeadingZeros(...)
debugPrint(...)
debugPrintln(...)
distance(...)
dropFirst(...)
dropLast(...)
dump(...)
encodeBitsAsWords(...)
enumerate(...)
equal(...)
filter(...)
find(...)
getBridgedObjectiveCType(...)
getVaList(...)
indices(...)
insertionSort(...)
isBridgedToObjectiveC(...)
isBridgedVerbatimToObjectiveC(...)
isUniquelyReferenced(...)
join(...)
lexicographicalCompare(...)
map(...)
max(...)
maxElement(...)
min(...)
minElement(...)
numericCast(...)
partition(...)
posix_read(...)
posix_write(...)
print(...)
println(...)
quickSort(...)
reduce(...)
reflect(...)
reinterpretCast(...)
reverse(...)
roundUpToAlignment(...)
sizeof(...)
sizeofValue(...)
sort(...)
split(...)
startsWith(...)
strideof(...)
strideofValue(...)
swap(...)
swift_MagicMirrorData_summaryImpl(...)
swift_bufferAllocate(...)
swift_keepAlive(...)
toString(...)
transcode(...)
underestimateCount(...)
unsafeReflect(...)
withExtendedLifetime(...)
withObjectAtPlusZero(...)
withUnsafePointer(...)
withUnsafePointerToObject(...)
withUnsafePointers(...)
withVaList(...)  
作者:AngryFox 分类: Uncategorized December 19th, 2014 暂无评论

phpmd安装
http://phpmd.org/support/index.html

PHPMD这个工具能够探测PHP源代码中一些潜在的问题。如:可能存在的Bug;未达最佳标准的代码;过于复杂的语法;从未使用过的参数、方法、属性。

主页:http://phpmd.org/
下载:http://phpmd.org/download/index.html
问题:[PHP] Fatal error: Class ‘DOMDocument’ not found
yum install php-xml
This will install XML support and will solve the DOMDocument issue
安装合适的包php53-xml.x86_64
使用方法:
/home/www/phpmd/src/bin/phpmd /home/su/framework text codesize,unusedcode,naming –reportfile /home/www/vipcat3/this.txt
phpmd+要检查的文件夹+生成报告方式+检查内容+报告地址
在编辑模式下输入ngg 或者 nGn为指定的行数(如25)25gg或者25G 跳转到第25行.在命令模式下输入行号n: n如果想打开文件即跳转vim +n FileName查看当然光标所在的行Ctrl+g

作者:AngryFox 分类: Uncategorized December 19th, 2014 暂无评论

phpdoc生成文档,首先安装PhpDocumentor,利用pear安装:

切换用户:
su root
安装PhpDocumentor:

pear install PhpDocumentor
生成文档:

phpdoc -o HTML:frames:earthli -d /home/su/framework  -t /home/www/vipcat
PhpDocumentor的默认编码是:iso-8859-1的,我的项目都是utf8编码的,所以需要把编码改成utf-8才可以。
进入PhpDocumentor的模板目录把模板文件修改成utf-8编码:

cd /usr/share/php/data/PhpDocumentor/phpDocumentor/Converters/
寻找文件夹下的header.tpl类文件,执行字符串查找并替换命令:

find ./ -name ‘*.tpl’ | xargs sed -i ‘s/iso-8859-1/utf-8/g’
执行完毕之后再生成项目文档,浏览项目中中文乱码解决。
以后如果项目换了别的编码,也可以用此命令修改过去。

指定 -o CHM:default:default 可以生成 chm,还需要借助“HTML Help Workshop” 来编译成 chm,能通过 HTML Help Workshop 编译成chm。

地址:http://www.phpdoc.org/

 

作者:AngryFox 分类: Uncategorized December 16th, 2014 暂无评论

1).  xdebug下载安装

http://xdebug.org/download.php

git clone git://github.com/xdebug/xdebug.git

php.ini配置

http://xdebug.org/docs/install

[xdebug]
;扩展文件路径
zend_extension = /usr/lib/php5/20090626+lfs/xdebug.so
;开启自动跟踪
xdebug.auto_trace = On
;开启异常跟踪
xdebug.show_exception_trace = On
;开启远程调试自动启动
xdebug.remote_autostart = On
;开启远程调试
xdebug.remote_enable = On
;收集变量
xdebug.collect_vars = On
;收集返回值
xdebug.collect_return = On
;收集参数
xdebug.collect_params = On
;跟踪格式
xdebug.trace_format = 0
;输出文件夹
xdebug.trace_output_dir=/tmp/xdebug
;输出文件名格式
xdebug.trace_output_name = trace.%c.%p
;开启分析器
xdebug.profiler_enable = On
;输出路径
xdebug.profiler_output_dir = /tmp/xdebug
;输出文件名格式
xdebug.profiler_output_name = cachegrind.out.%p
;记录内存使用情况
xdebug.show_mem_delta = On

2) webgrind

http://code.google.com/p/webgrind/

下载地址:http://webgrind.googlecode.com/files/webgrind-release-0.81.zip

  1. 下载webgrind,解压缩到web目录
  2. 首先访问需要优化的php程序,get/post请求中加入XDEBUG_PROFILE
    例如info.php,http://localhost/info.php?XDEBUG_PROFILE
  3. 然后访问:http://localhost/webgrind/
    默认auto,即为刚刚请求的文件profile,[update]!

3) 测试代码

test
<?php
//仅使用内置函数
function t1(){
time();
}
//自定义函数外再执行一次
&nbsp;time();
&nbsp;sleep(1);
t1();
//t2调用自定义函数
function t2(){
t1();
}
t2();
//增加内置函数耗时
function t3(){
sleep(1);
}
t3();
//t4增加调用自定义函数t3一次。
function t4(){
t3();
sleep(1);
}
t4();
//t5增加非调用函数式内耗 for循环10万次,并调用t4
function t5()
{ $u=0;
for($i=0;$i<100000;$i++)
{ $u+=$i;   }
t4();
}
t5();
?>

4)webgrind分析结果参数说明

分析结果包括了页面执行过程中所访问的方法,函数以及required/include包含的文件。
Invocation Count 方法被执行的次数
Total Self Cost  执行该过程/方法的时间,不包括方法内调用执行其他的自定义函数的时间
Total Inclusive Cost 方法执行的总时间,包括方法内调用的其他方法的执行时间
Calls 执行过程中调用的方法/函数
Total Call Cost 执行所有的调用函数/方法的时间总计
Count 方法被调用的次数

关于不同的颜色的说明:蓝色代表PHP内置函数所占耗费时间的比例,绿色是自定义函数所占耗费时间的比例,灰色是required/include所占耗费时间的比例,黄色是过程执行所占时间的比例

通过该工具我们可以很直观的看到某个方法,某个过程所花费的时间,可以分析出程序的瓶颈在哪里。另外可以配置成图形化的调用显示。

作者:AngryFox 分类: Uncategorized December 14th, 2014 暂无评论
Type LibDescription LibLocation
Android SlidingMenu https://github.com/jfeinstein10/SlidingMenu
https://github.com/SpecialCyCi/AndroidResideMenu
https://github.com/SimonVT/android-menudrawer
ActionBar https://github.com/ManuelPeinado/FadingActionBar
模仿Path菜单 https://github.com/siyamed/android-satellite-menu
https://github.com/daCapricorn/ArcMenu
https://github.com/dodola/PathButton
时间选择控件 https://github.com/vanniktech/VNTNumberPickerPreference
字体 https://github.com/vanniktech/VNTFontListPreference
https://github.com/chrisjenx/Calligraphy
滚动条选择 https://github.com/ai212983/android-spinnerwheel
https://github.com/maarek/android-wheel
https://github.com/Todd-Davies/ProgressWheel
时间选择 https://github.com/square/android-times-square
图片处理/缓存 https://github.com/christophesmet/android_maskable_layout
https://github.com/Pkmmte/CircularImageView
https://github.com/vinc3m1/RoundedImageView
https://github.com/daimajia/AndroidImageSlider
头像识别裁剪 https://github.com/lafosca/AndroidFaceCropper
https://github.com/koral–/android-gif-drawable
https://github.com/jdamcd/android-crop
https://github.com/edmodo/cropper
https://github.com/square/picasso
https://github.com/chrisbanes/PhotoView
https://github.com/nostra13/Android-Universal-Image-Loader
根据鼠标滑动,动态变化图片的颜色值 https://github.com/fedestyla/FillingEffect
视频 https://github.com/ghy/VideoPlayer
音频处理 https://github.com/FFmpeg/FFmpeg
Toast https://github.com/JohnPersano/SuperToasts
https://github.com/jenzz/Android-UndoBar
https://github.com/sd6352051/NiftyNotification
屏幕底部Toast,可以添加Action button https://github.com/MrEngineer13/SnackBar
Android Wear https://github.com/9elements/9elements-One-for-Android-Wear
Android TV https://github.com/jerrellmardis/Amphitheatre
图表 https://github.com/xcltapestry/XCL-Charts
https://github.com/blackfizz/EazeGraph
https://github.com/PhilJay/MPAndroidChart
https://github.com/diogobernardino/WilliamChart
列表交互控件 https://github.com/lawloretienne/QuickReturn
https://github.com/medyo/dynamicbox
https://github.com/matrixxun/PullToZoomInListView
https://github.com/andraskindler/quickscroll
https://github.com/dommerq/SuperListview
https://github.com/AndroidAlliance/EdgeEffectOverride
https://github.com/nolanlawson/CustomFastScrollViewDemo
https://github.com/bilalsammour/DobList
https://github.com/learnNcode/GmailLikePullToRefresh
https://github.com/nicolasjafelle/RefreshMenuItem
https://github.com/chrisbanes/ActionBar-PullToRefresh
https://github.com/etsy/AndroidStaggeredGrid
https://github.com/tjerkw/Android-SlideExpandableListView
https://github.com/JakeWharton/Android-ViewPagerIndicator
https://github.com/pakerfeldt/android-viewflow
https://github.com/Issacw0ng/SwipeBackLayout
listview滑动菜单 https://github.com/daimajia/AndroidSwipeLayout?utm_source=Android+Weekly&utm_campaign=384c7cee0e-Android_Weekly_117&utm_medium=email&utm_term=0_4eb677ad19-384c7cee0e-337825917
https://github.com/daimajia/AndroidViewHover
listview head悬停 https://github.com/emilsjolander/StickyListHeaders
多级listview https://github.com/luhaiwork/NLevelExpandableListView
https://github.com/applidium/HeaderListView
拖动布局 https://github.com/pedrovgs/DraggablePanel
字体视图 https://github.com/ikocijan/MagicViews
刮奖效果 https://github.com/hcq0618/Android—ScratchOutView
动画 https://github.com/daimajia/AndroidViewAnimations
https://github.com/daimajia/AnimationEasingFunctions
https://github.com/DesarrolloAntonio/FragmentTransactionExtended
https://github.com/xgc1986/ParallaxPagerTransformer
滚动条控件 https://github.com/daimajia/NumberProgressBar
https://github.com/dmytrodanylyk/android-process-button
https://github.com/dmytrodanylyk/circular-progress-button
https://github.com/edmodo/range-bar
角标控件 https://github.com/stefanjauker/BadgeView
接口调试 https://github.com/jakubroztocil/httpie
输入框控件 https://github.com/wrapp/floatlabelededittext
https://github.com/danialgoodwin/android-widget-keyboardless-edittext
https://github.com/hoang8f/android-flat-button
输入验证 https://github.com/vekexasia/android-edittext-validator
输入框悬浮提示 https://github.com/marvinlabs/android-floatinglabel-widgets
表情输入 https://github.com/rockerhieu/emojicon
bean转换 https://github.com/joelittlejohn/jsonschema2pojo
数据传输/处理 https://github.com/square/okhttp
https://github.com/square/retrofit
https://github.com/douglascrockford/JSON-java
https://github.com/loopj/android-async-http
https://github.com/mcxiaoke/android-volley
https://github.com/stormzhang/AndroidVolley
velleyDemo https://github.com/yayuhh/Projectile
sharePreference https://github.com/dkunzler/esperandro
相机 https://github.com/randomlytyping/Randomly-Camera-AnDevCon-2014
https://github.com/rexstjohn/UltimateAndroidCameraGuide
主题 https://github.com/negusoft/holoaccent
可以显示不同颜色主题的App https://github.com/HozakaN/MaterialDesignColorPalette
开发工具框架 https://github.com/inmite/android-butterknife-zelezny
https://github.com/antonkrasov/AndroidSocialNetworks
https://github.com/excilys/androidannotations
https://github.com/deano2390/OpenFlappyBird
https://github.com/google/iosched
https://github.com/LIFX/lifx-sdk-android
https://github.com/kentarosu/AndroidWearAndLIFX
https://github.com/GoogleChrome/MiniMobileDeviceLab
https://github.com/romainguy/google-io-2014
https://github.com/dodgepudding/wechat-php-sdk
https://github.com/jayway/maven-android-plugin-samples
https://github.com/mobileresearch/weibo_android_sdk
https://github.com/yangfuhai/afinal
https://github.com/adennie/fb-android-dagger
https://github.com/square/dagger
二维码 https://github.com/wildabeast/BarcodeScanner
https://github.com/JeffreyZH/ZXingSimple
混淆 https://github.com/facebook/proguard
打包 https://github.com/beanu/ant-android
https://github.com/alexvasilkov/AndroidGradleSignPlugin
布局 https://github.com/andersericsson/AnchorView
iconView https://github.com/JoanZapata/android-iconify
关于页面Lib https://github.com/mikepenz/AboutLibraries
Tools 获取APK信息 https://github.com/poorevil/GetAPKDetails
https://github.com/AnyOfYou/MultiDevicesADB
https://github.com/JakeWharton/pidcat
教程 https://github.com/kesenhoo/android-training-course-in-chinese
https://github.com/dmytrodanylyk/dmytrodanylyk
开源项目汇总 https://github.com/Trinea/android-open-project
Design design/Document https://github.com/1sters/material_design_zh
https://github.com/alexjlockwood/alexjlockwood.github.io
Proxy shadowsocks https://github.com/clowwindy/shadowsocks-libev
https://github.com/shadowsocks/shadowsocks-gui
https://github.com/clowwindy/shadowsocks
GAE https://github.com/madeye/gaeproxy
hosts https://github.com/txthinking/google-hosts
https://github.com/smarthosts/smarthosts
全球google Ip https://github.com/justjavac/Google-IPs
代理软件 https://github.com/ohdarling/GoAgentX
免翻墙镜像 https://github.com/greatfire/wiki
翻墙路由 https://github.com/lifetyper/FreeRouter_V2
https://github.com/cyfdecyf/cow
PAC https://github.com/clowwindy/gfwlist2pac
Other 插件 https://github.com/akira-cn/sublime-gbk
https://github.com/Vektah/CodeGlance
https://github.com/dallasgutauckis/android-parcelable-intellij-plugin
https://github.com/pbreault/adb-idea
文档 https://github.com/Thibaut/devdocs
编程教程 https://github.com/stormzhang/free-programming-books
ios https://github.com/fullstackio/FlappySwift
https://github.com/numbbbbb/the-swift-programming-language-in-chinese
富文本编辑器 https://github.com/mycolorway/simditor
编辑器MD https://github.com/joemccann/dillinger
webapp https://github.com/kikinteractive/app
Linux Linux https://github.com/LCTT/TranslateProject
Python Python教程 https://github.com/revolunet/PythonBooks
Front-end 前端教程 https://github.com/foru17/front-end-collect
https://github.com/darcyclarke/Front-end-Developer-Interview-Questions
https://github.com/JacksonTian/fks
前端 https://github.com/angular/angular.js
https://github.com/usablica/front-end-frameworks
https://github.com/Polymer/polymer-tutorial
https://github.com/nckprsn/scrollme
控件 https://github.com/smalot/bootstrap-datetimepicker
虚拟键盘 https://github.com/Mottie/Keyboard
JAVA json解析 https://github.com/Instagram/ig-json-parser