html tool

显示标签为“popexizhi -doing”的博文。显示所有博文
显示标签为“popexizhi -doing”的博文。显示所有博文

2016年8月7日星期日

Machine Learning

机器学习的几篇文章list推荐
https://github.com/ty4z2008/Qix/blob/master/dl.md 学习笔记

--------------------------------------------

有趣的机器学习:最简明入门指南  http://blog.jobbole.com/67616/
[popexizhi:
监督式学习(Supervised Learning) 和监督式学习(Unsupervised Learning) 的介绍很简单易懂,入门不错啊!
概括一下:使用足够的数据集测试你的全是疯狂的if else语句)的权重,如果验证已经存在的数据集就是Supervised Learning;如果是对未知的探测,嘻嘻Unsupervised Learning.
自己一直想测量两篇文章的相随度和图像的相似度,这个应该也是这个范围吗?
]

这里的两个推荐:

怎样深入学习机器学习

我认为,当前机器学习的最大问题是它主要活跃于学术界和商业研究组织中。对于圈外想要有个大体了解而不是想成为专家的人们,简单易懂的学习资料不多。但是这一情况每一天都在改善。
吴恩达教授(Andrew Ng)在Coursera上的机器学习免费课程非常不错。我强烈建议由此入门。任何拥有计算机科学学位、还能记住一点点数学的人应该都能理解。
另外,你还可以下载安装SciKit-Learn,用它来试验成千上万的机器学习算法。它是一个python框架,对于所有的标准算法都有“黑盒”版本。
【next】SciKit-Learn try一下:)

2015年2月9日星期一

Qpython and androidhelper

1.环境准备
use:ftp
2.testKivy
add:http://python-for-android.readthedocs.org/en/latest/android/#module-android
3.androidhelper
add:http://mp.unoji.com/docs/sl4a/api/ui.html

2014年7月17日星期四

xizhi plan-arduino uno的spi and string

robot using

  • uml:总体结构图:

  • 昨天调试的是图中green部分,ardunio上的code
  • 问题
    • arudino
      • string 匹配 不是 == ?
        自己定义如下:
        String getcon = String(thisChar);
        if (getcon== "open" ){
              //open power
              _Openpower();
              }
        thisChar远程输出为open后如何都不执行if中的定义。郁闷,最后将命令改为单字节char的匹配是转为int比较的,如下:
        if(int(thisChar)==int("o") )
        {
              //open power
              _Openpower();
              }
        调试通过了,但这个是个问题,要搞清楚一下
         
    •  
    •  
  • [note]
    • SPI使用时会占用13口,自己测试时开始定义pin13为OUTPUT,调试时led总是hight,后来吞提醒才发现的,要好好看手册啊!
      add:http://arduino.cc/en/Tutorial/BarometricPressureSensor
      占用的是13,12,11     

2014年4月14日星期一

git log


1.git init //初始化本地库
.git目录的简要说明:
===========================================================
表 1 .git 目录简要说明

子目录名 简要描述
branches Git 项目分支信息,新版 Git 已经不再使用该目录。
config Git 项目配置信息
description Git 项目描述信息
HEAD 指向 Git 项目当前分支的头指针
hooks 默认的"hooks"脚本,被特定事件发生前后触发。
info 里面含一个 exclude 文件,指 Git 项目要忽略的文件。
objects Git 的数据对象,包括:commits, trees, blobs, tags。
refs 指向所有 Git 项目分支的指针
====================================================================
2.git clone 版本库名称 //检出库内容
[针对第二类 Git 仓库,我们不需要 git init 初始化仓库,取而代之的是,使用 git clone 直接将远程镜像克隆到本地仓库。
http://www.ibm.com/developerworks/cn/opensource/os-cn-tourofgit/]
3.//创建用户&mail
[如果是第一次使用 Git,均需要配置用户信息,包括用户名与 Email(如下所示),以便以后每次 Git 提交时都可以自动引用这两条信息,说明是谁更新与提交了代码。http://www.ibm.com/developerworks/cn/opensource/os-cn-tourofgit/ ]
git config --global user.email "usermail@xxx"
git config --global user.name "username"
4.//增加修改到本地缓存
git add filename //add file ,* is ok
git commit -m "xxxx" //提交修改到本地缓存
5.//推送修改到远端库
git push orign master //master为本地要推送的分支名称
add test
[popexizhi:
出现报错如下
-----------------------------------------------------------------------
E:\pc\other\thinking\learning\testgit\gittry>git push origin master
Counting objects: 5, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (5/5), 496 bytes | 0 bytes/s, done.
Total 5 (delta 0), reused 0 (delta 0)
remote: error: refusing to update checked out branch: refs/heads/master
remote: error: By default, updating the current branch in a non-bare repository
remote: error: is denied, because it will make the index and work tree inconsist
ent
remote: error: with what you pushed, and will require 'git reset --hard' to matc
h
remote: error: the work tree to HEAD.
remote: error:
remote: error: You can set 'receive.denyCurrentBranch' configuration variable to

remote: error: 'ignore' or 'warn' in the remote repository to allow pushing into

remote: error: its current branch; however, this is not recommended unless you
remote: error: arranged to update its work tree to match what you pushed in some

remote: error: other way.
remote: error:
remote: error: To squelch this message and still keep the default behaviour, set

remote: error: 'receive.denyCurrentBranch' configuration variable to 'refuse'.
To E:/pc/other/thinking/learning/testgit/../gittry
 ! [remote rejected] master -> master (branch is currently checked out)
error: failed to push some refs to 'E:/pc/other/thinking/learning/testgit/../git
try'
-----------------------------------------------------------------------------
]
[popexizhi:ok,pope常犯的错误命令应该是
git push origin master
自己写成了:git push origin master
]
[参考:http://www.ibm.com/developerworks/cn/opensource/os-cn-tourofgit/]
6.//拉取修改版本
[popexizhi:git 这个很帅,pope执行时提示如下
E:\pc\other\thinking\learning\testgit\xizhi>git push origin master
Password for 'https://popexizhi@code.google.com':
To https://popexizhi@code.google.com/p/xizhi/
 ! [rejected]        master -> master (fetch first)
error: failed to push some refs to 'https://popexizhi@code.google.com/p/xizh
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
之后直接尝试]
git pull 再次尝试git push origin master 就ok 了。
----------------------------
而要将远程仓库抓取数据到本地,可以使用 git fetch 命令,从而获取所有本地仓库中还没有的数据。
$ git fetch [remote-name]
如果设置了某个分支用于跟踪某个远端仓库的分支,可以使用 git pull 命令自动抓取数据下来,然后将远端分支自动合并到本地仓库中当前分支。从这个角度,git pull 等价于 git fetch + git merge 的功能。
$ git pull [remote-name]
-------------------------------------
[http://www.ibm.com/developerworks/cn/opensource/os-cn-tourofgit/]
====================================================正文结束==================
[popexizhi:
1.log写的好乱,应该找个好方法更新记录结构了:)
2.http://www.ibm.com/developerworks/cn/opensource/os-cn-tourofgit/
IBM的这个内容写的很不错哟,好好阅读一下写写笔记吧
3.popexizhi计划的git使用方案,和其他代码的迁移是否要做thinking
]

2014年3月27日星期四

python 导入包路径添加

目的:安装google开发框架后,无法再直接import ,手动添加(通信使用gtalk-roboot,xmpp导入使用到google-appengine)

参考内容:
(地址:http://blog.csdn.net/kernelspirit/article/details/3381666)

---------------------------------------

模块的搜索路径

模块的搜索路径都放在了sys.path列表中,如果缺省的sys.path中没有含有自己的模块或包的路径,可以动态的加入(sys.path.apend)即可。下面是sys.path在Windows平台下的添加规则。
1、sys.path第一个路径往往是主模块所在的目录。在交互环境下添加一个空项,它对应当前目录。
2、如果PYTHONPATH环境变量存在,sys.path会加载此变量指定的目录。[popexizhi:自己只测试了这个很好用的:),添加后打印sys.path ,在空项后就是PYTHONPATH添加的]
3、我们尝试找到Python Home,如果设置了PYTHONHOME环境变量,我们认为这就是Python Home,否则,我们使用python.exe所在目录找到lib/os.py去推断Python Home。
如果我们确实找到了Python Home,则相关的子目录(Lib、plat-win、lib-tk等)将以Python Home为基础加入到sys.path,并导入(执行)lib/site.py,将site-specific目录及其下的包加入。
如果我们没有找到Python Home,则把注册表Software/Python/PythonCore/2.5/PythonPath的项加入sys.path(HKLM和 HKCU合并后加入),但相关的子目录不会自动添加的。
4、如果我们没有找到Python Home,并且没有PYTHONPATH环境变量,并且不能在注册表中找到PythonPath,那么缺省相对路径将加入(如:./Lib;./plat-win等)。
-------------------------------------------------------------------------------------

2014年3月14日星期五

目的:从windows的聊天窗口中读取内容。计划测试qq和gtalk (1)

目的:从windows的聊天窗口中读取内容。计划测试qq和gtalk
过程:
1.在打开窗口中找到聊天窗口---is ok
2.在被找到的窗口中读取内容

内容记录:
[popexizhi]1.py中的win32gui,win32api的使用
下载了三个版本的安装包如下:
pywin32-213.win32-py2.6.exe
pywin32-214.win32-py2.6.exe
pywin32-216.win32-py2.6.exe
但安装时都提示register中没有python,无法安装。郁闷我安装py2.6在D盘是绿色版本的。google了一下,要手动在注册表中注册一下,代码如下,

ok了:
--------------------------------------------------------------------------------------------------------
import sys
 
from _winreg import *
 
# tweak as necessary
version = sys.version[:3]
installpath = sys.prefix
 
regpath = "SOFTWARE\\Python\\Pythoncore\\%s\\" % (version)
installkey = "InstallPath"
pythonkey = "PythonPath"
pythonpath = "%s;%s\\Lib\\;%s\\DLLs\\" % (
    installpath, installpath, installpath
)
 
def RegisterPy():
    try:
        reg = OpenKey(HKEY_CURRENT_USER, regpath)
    except EnvironmentError as e:
        try:
            reg = CreateKey(HKEY_CURRENT_USER, regpath)
            SetValue(reg, installkey, REG_SZ, installpath)
            SetValue(reg, pythonkey, REG_SZ, pythonpath)
            CloseKey(reg)
        except:
            print "*** Unable to register!"
            return
        print "--- Python", version, "is now registered!"
        return
    if (QueryValue(reg, installkey) == installpath and
        QueryValue(reg, pythonkey) == pythonpath):
        CloseKey(reg)
        print "=== Python", version, "is already registered!"
        return
    CloseKey(reg)
    print "*** Unable to register!"
    print "*** You probably have another Python installation!"
 
if __name__ == "__main__":
    RegisterPy()
----------------------------------------------------------------------------------------------------------------
但是之后的安装pywin32-213.win32-py2.6.exe提示有系统动态库问题,自己的是xp sp3,在下载这几个安装文件时pope就郁闷很久这个的差异是什

么,试一试运气pywin32-214.win32-py2.6.exe安装成功了,想来这个213,214,216是针对不同操作系统版本吧:)只是猜想没有查。
PS:安装完成后帮助文档在Lib\site-packages下

2.关于查找窗口句柄
小插曲:查找窗口名称使用re.match是不可以的,要使用re.search.因为窗口名称中多包含地址,而包含地址的内容有\/:等特殊字符影响正则表达

的处理,re.search想必是对这些字符做转移处理了:)
help中如下解释
re.search(pattern, string[, flags])
Scan through string looking for a location where the regular expression pattern produces a match, and return a corresponding

MatchObject instance. Return None if no position in the string matches the pattern; note that this is different from finding a

zero-length match at some point in the string.
re.match(pattern, string[, flags])
If zero or more characters at the beginning of string match the regular expression pattern, return a corresponding MatchObject

instance. Return None if the string does not match the pattern; note that this is different from a zero-length match.

Note
If you want to locate a match anywhere in string, use search() instead

pope使用win32gui自己写了一个查找包含窗口名称的类如下,但没有写testcase:)留到下面再不上吧
-----------------------------------------------------------------------------------------------------------
# -*- coding=utf-8 -*-
# 从当前打开的全部窗口中查找标题包含指定内容的窗口句柄
import re,time
try:
import win32gui
import win32api
except:
win32gui=None

class winSeach():
def __init__(self,strcon):
"""查找包含strcon内容的窗口 """
self.__strcon=strcon
self.__hwnlist=[] #包含查找结果的tuple

def doseach(self,hwnd,ctx):
if win32gui.IsWindowVisible(hwnd):
name=win32gui.GetWindowText(hwnd)
#print name
if None == re.search(self.__strcon,name) :
pass
#print name,"is not in",self.__strcon
else:
self.__hwnlist.append(hwnd)
#print self.__hwnlist,"is else"

def getres(self):
win32gui.EnumWindows(self.doseach,None)
return self.__hwnlist

if __name__=="__main__":
test=winSeach("py")
for x in test.getres():
print x,win32gui.GetWindowText(x)
#win32gui.SetForegroundWindow(x) #将查找到的窗口设置到最前面

-------------------------------------------------------------------------------------------------------------