安装平台 win7 x64 ,emacs 23.3.1
snippet工具,可自定义一些模板:
http://yasnippet.googlecode.com/files/yasnippet.avi
上面是演示demo
.emacs 配置如下
(add-to-list 'load-path "~/.emacs.d/yasnippet") (require 'yasnippet) ;; not yasnippet-bundle (yas/global-mode 1)
2. AutoComplete
自动完成工具,其实只是一个前端工具。当然也可以用ropemacs 作为它补全的后端使用。
.emacs 配置如下:
(add-to-list 'load-path "~/.emacs.d/") (require 'auto-complete-config) (add-to-list 'ac-dictionary-directories "~/.emacs.d//ac-dict") (ac-config-default)
3. Python-mode
安装python-mode :
http://www.loveshack.ukfsn.org/emacs/#python.el 下载后直接丢到load-path 中
4.Rope and Ropemacs
Ropemacs非常棒的重构工具,比如rename,move,extract method等等。还有非常好用的goto difinition(跳到定义),show documents(显示文档)、代码补全等等。安装Ropemacs前,必须先安装rope和pymacs 实际上还要安装rope-mode。
rope的安装方法:
python setup.py install
pymacs的win上安装方法:
python pppp -C ppppconfig.py pppp.rst.in pymacs.el.in \ pymacs.rst.in Pymacs contrib tests python setup.py install
注意此处:我git pymacs到本地后无法install成功,后来别人给一个pymacs包,我放在git的pymacs里,重新执行上面的安装方法后,成功。pymacs包见本文尾
如果成功,则在python环境中输入以下,不会报错:
from Pymacs import lisp
.emacs中:
(autoload 'pymacs-apply "pymacs") (autoload 'pymacs-call "pymacs") (autoload 'pymacs-eval "pymacs" nil t) (autoload 'pymacs-exec "pymacs" nil t) (autoload 'pymacs-load "pymacs" nil t)
注意完成后,将下图552行的Pymacs.pymacs 改成Pymacs
Ropmacs的安装方法:
python setup.py install
.emacs中:
(require 'pymacs) (pymacs-load "ropemacs" "rope-") (setq ropemacs-enable-autoimport t)
注意:ropemacs时,先将ropemacs解压缩,然后将刚刚安装好的ropemode拷贝进去,再执行安装,否则会出错。C:\Python27\Lib\site-packages\ropemacs
基本操作
rope-code-assist, M-/ Code completionrope-rename, C-c r r Rename a variable, function, etc.
5.程序调试
在Emacs中,通过M-x pdb可调出pdb对python代码进行调试。但是发现在Windows系统中,总进入不了调试模式。主要原因有:
1. windows中,找不到pdb.py位置。需自己制定pdb的路径。可以通过下面的方法设置pdb的路径:
;; pdb setup, note the python version
(setq pdb-path 'c:/python25/Lib/pdb.py
gud-pdb-command-name (symbol-name pdb-path))
(defadvice pdb (before gud-query-cmdline activate)
"Provide a better default command line when called interactively."
(interactive
(list (gud-query-cmdline pdb-path
(file-name-nondirectory buffer-file-name)))))
2. windows中,调用pdb时,未使用python -i 参数。
针对上面两个问题,我的解决办法是,不设置pdb具体路径,M-x pdb 回车后,出现下面命令:
Run pdb (like this): pdb
然后手动修改一下:
Run pdb (like this): python -i -m pdb test.py
6.代码检查
基本上都是flymake+pyflakes 或者 flymake +pylint模式,我选择了前者。并安装了pep8
flymake是emacs自带的,下载pyflakes 和pep8 安装好后,按下面配置好即可:
c-c c-w是执行命令!
注意pyflakes 和pep8 都是在cmd中执行命令的。
;pycheck grammer ; indent something
(add-to-list 'load-path "~/.emacs.d/")
(add-hook 'find-file-hook 'flymake-find-file-hook)
(when (load "flymake" t)
(defun flymake-pyflakes-init ()
(let* ((temp-file (flymake-init-create-temp-buffer-copy
'flymake-create-temp-inplace))
(local-file (file-relative-name
temp-file
(file-name-directory buffer-file-name))))
(list "pychecker" (list local-file))))
(add-to-list 'flymake-allowed-file-name-masks
'("\\.py\\'" flymake-pyflakes-init)))
(load-library "flymake-cursor")
;(global-set-key [f10] 'flymake-goto-prev-error)
;(global-set-key [f11] 'flymake-goto-next-error)
(setq python-check-command "pyflakes")
然后创建一个pychecker.bat的文档 丢到python里面,我的目录是c:\python27
python C:\Python27\runpyflakes.py %* pep8 --ignore=E221,E701,E202 --repeat %*
再在该目录创建一个runpyflakes.py的程序
from pyflakes.scripts.pyflakes import mainmain()
效果如下:
7.文档帮助
我还是喜欢firefox直接上官方文档库查找。
emacs wiki 也给出了sphinx后格式的文档下载,可以直接在emacs info里查看帮助。
具体链接请见本文末尾处效果可以看最后一个链接。
8.段落注解:
Comment/Uncomment Region
If you have ‘transient-mark-mode’ on, you can just use ‘comment-dwim’:
select a region and hit ‘M-;’.
The DoWhatIMean means that it will comment or uncomment the region as appropriate.
If you do not have ‘transient-mark-mode’ on by default, you can hit C-SPC twice to activate it temporarily.
( doesn’t python-mode.el offer `py-comment-region? --CH )
You can also use “rectangles” with comment/uncomment region (among other things that you can do with rectangles).
See RectangleCommands or “(emacs) Rectangles” in the Emacs manual.
9.框架支持
django: https://code.djangoproject.com/wiki/Emacs" 如果不是很熟悉的话,还是建议用pycharm来写吧。
10.测试
待完善,下面的link中含有。
主要参考了:
http://www.cnblogs.com/coderzh/archive/2009/12/26/emacspythonide.html
http://www.enigmacurry.com/2008/05/09/emacs-as-a-powerful-python-ide/
http://www.enigmacurry.com/2009/01/21/autocompleteel-python-code-completion-in-emacs/
http://www.emacswiki.org/emacs/?action=browse;oldid=PythonMode;id=PythonProgrammingInEmacs
http://www.saltycrane.com/blog/2010/05/my-emacs-python-environment/
http://stackoverflow.com/questions/3513975/problem-with-pyflakes-in-emacs-on-windows
http://pedrokroger.net/2010/07/configuring-emacs-as-a-python-ide-2/
Today , click up the vs 2008 ,
“A problem has been encountered while loading the setup components. Canceling setup” shows up.
the way to solve it: install “Windows install clean up” – can get from Microsoft itself . and remove vs2008 then reinstall it.
重新restore了mysql到另一台机器上,今天新写了一个app,发现在admin界面下一添加汉字就会报错如下:
Warning at /admin/assets/add/ Incorrect string value: '\xE5\x93\x88\xD5\x92\x88...' for column 'Name' at row 1 Request Method: POST Request URL: http://127.0.0.1:8000/admin/assets/add/ Django Version: 1.2.3 Exception Type: Warning Exception Value: Incorrect string value: '\xE5\x93\x88\xD5\x92\x88...' for column 'Name' at row 1 Exception Location: /usr/lib/pymodules/python2.7.1/MySQLdb/cursors.py in _warning_check, line 82 Python Executable: /usr/bin/python Python Version: 2.7.1
初步判断 应该是mysql的问题 [代研究本质问题]:
在my.ini 添加如下:
[client] character-set-client = utf8 default-character-set = utf8 [mysqld] character-set-server = utf8 character-set-filesystem = utf8[mysql] init_connect='SET NAMES utf8' [mysql] default-character-set=utf8
重启mysql服务器,问题解决。
-------------------------------------------------------------------------------------
查看创建mysql数据库的默认编码:
show create database db_name;
更改已经创建的db的编码:
alter database db_name character set utf8 collate utf8_general_ci;
查看数据库相关信息:
mysql>status
查看数据库相关信息2:
mysql> show variables like’char%’;
没用过mysql, 这几天折腾django ,发现连接mssql好像还是有些小bug,为了防止日后项目有些莫名的db故障,故选择django推荐之一的mysql。
版本号: 5.5.19-winx64
1、将my-small.ini 改为my.ini (请按照自己的机器配置更改)
2、在命令行输入:
\bin\mysqld –-console
回车后应该看到下面表示启动成功:
mysqld: ready for connections Version: '5.5.19-log' socket: '' port: 3306
接下来可以注册为win 服务
1、确认mysql 服务终止:
bin\mysqladmin -u root shutdown
2、注册服务:
bin\mysqld --install MySQL --defaults-file=c:\mysql5.5.19-winx64\my.ini
3、启动服务:
net start mysql
--------------------------------------------------------------------------------------------------------
my.ini 设置 --- 以下都可以用mysql administrator 来设置
[mysqld] character-set-server=utf8 [client] default-character-set=utf8
basedir="c:/mysql5.5.19" datadir="c:/mysql5.5.19/data"
version 1 & 2
name:pycharm
===== LICENSE BEGIN =====
61667-12042010
0000285EqkWlIA2ky6BoNqCag!fvO3
j2ICltgk6kiG8IjRMEfE17TsxSr4EF
b60Y9vBcUyQ6y0XdSjYF!b"E7f09oD
===== LICENSE END =====
name:opensource
===== LICENSE BEGIN =====
96189-12042010
00001WEdnZrgimaRUrqqOQkDQFWots
XiLKPDX4S5k5SsbtoxGEntWEf3XEAj
fK8PTjjGxnr9oWeO3CIq7"tQtPa!Dd
===== LICENSE END =====
Cognos 8 错误及故障排除。
2009年6月12日 林磊 www.CD39.com
Cognos安装配置确实很麻烦,相比其他的BI产品,有更多的额外配置,经常在论坛上看到网友提出各式各样的问题。
不知道是我运气背还是怎么着,遇到的问题特别多。将我在使用Cognos中遇到的错误及故障整理如下
1、jre 路径导致报错
这个时候我遇到一个问题,Cognos Configuration 无法正常启动,提示信息忘记截图了,不过这个问题比较简单。
错误提示中已经详细的描述了解决办法,其实是因为我的开发机上有Tomcat,设置了JAVA_HOME。
并且用的是JDK142的包,所以必须先修改其路径为Cognos的jre。否则启动Cognos Configuration的时候会报错。
2、Cognos8 The Database Connection Failed .运行数据库无法连接
遇到这个问题,是因为jdbc的缘故,如果是Oracle作为运行数据库,就会遇到。
将oracle/jdbc/lib/classes12.jar拷贝到Cognos8/webapps/p2pd/WEB-INF/lib下即可.
3、CFG-ERR-0106
这个问题就比较诡异了,反正就是启动超时,但是又没有具体原因,百度也没有任何解决办法。
外事不决问Google,还是Google强大,E文网站上倒是有不少同学遇到此类问题。
其实,是因为开发机上跑的程序太多,资源占用厉害导致的。
最后确定的解决办法是修改配置文件,增加Cognos的启动时间。
修改 c8_location /configuration/ cogconfig.prefs
增加以下两个配置
ServiceWaitInterval=
*默认是500,代表0.5秒
ServiceMaxTries=
*默认360,代表倍数
默认应该是3分钟超时。我增加到 1000*500,8分多钟。
4、CFG-ERR-0103
这个问题是在我们的Cognos测试服务器上遇到的,首先想到的就是BAIDU,发现也有不少朋友碰到这个问题。
中文的鸟文的解决办法也看了不少,但是都没能解决我的问题。非常苦恼的情况下,我死马当活马医。
我将 Cognos 8 Service 节点下的 Cognos8.3 删除,又重新建了一个,OK,神奇的解决了问题。
排查原因,发现是因为不小心在测试服务器的msconfig里将cognos的服务禁止了,服务禁用了,当然启不起来。
总结了下这个问题的原因,应该是因为Cognos主应用无法启起来,已知可能的原因如下:
1、Cognos数据库没有采用UTF-8的字符集(Oracle下常见)
2、系统服务中的Cognos服务被禁用,或受到其他第三方软件限制无法启动
5、CAM-AAA-0027
这个错误是在用Cognos SDK开发SSO的时候遇到的,利用SDk里的例子 TrustedSignonSample 程序实现SSO的时候遇到的。
根据Google搜索得出的结果,0027可能是一个Cognos8.3的BUG,在正常运行的Cognos应用中,可能突然会出现。
但是错误信息和我遇到的不同:The function call to 'CAM_AAA_Authenticate' failed.Reason:"
该问题的解决办法(百度搜的):
1、内存泄漏(最可能的原因)
如果服务器连续正常运行了一段时间后,突然报这个错,绝大部分原因是内存泄漏。
2、配置错误(较少可能)
比如你为 Cognos 配置了超出服务器所能提供的资源时,就会出现这个错。
不过不符合我们的现状,估计这个错误的原因应该还是SSO接口的问题,只是遇到同样的错误代码而已。
后来发现SDK的这个例子,其实是类似代理的方式,通过Cookie传参,登录Cognos的另一个认证,比如NTLM。
并不是如我们早期想的那样,认为 TrustedSignonSample 是一个独立认证。
所以在配置一个命名空间为 TS 的 NTLM 认证后解决了这个问题,其实很简单,应该就是认证找不到指定的命名空间,重试次数达到了10次。
6、CAM-AAA-0064
['CognosJavaProvider']
1. [ ERROR ] CAM-AAA-0064 The function 'CAM_AAA_JniAuthProvider::Configure' failed.
CAM-AAA-0154 Unable to load the Java authentication provider class 'TrustedSignonSample'.
TrustedSignonSample (Unsupported major.minor version 49.0)
83的SDK的实现遇到0027问题后,考虑换到Cognos8.2的生产系统上去试,结果遇到了0064,版本问题,这个问题解决不了。
可能更新JniAuthProvider的jar包可以解决这个问题。


