V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX  ›  paloalto  ›  全部回复第 87 页 / 共 113 页
回复总数  2254
1 ... 83  84  85  86  87  88  89  90  91  92 ... 113  
2012-08-04 22:42:52 +08:00
回复了 paloalto 创建的主题 Python nginx上跑webpy网站,form提交数据时遇到了action的url跳转问题
这里似乎是个解决办法 http://www.iteye.com/problems/80467
2012-08-03 02:27:47 +08:00
回复了 Livid 创建的主题 天黑以后 20120803 午夜俱乐部
刚更新完博客,接着研究代码。
早上骑车去公司摔了一跤,膝盖胯骨和肩膀都破了,好疼,还不敢洗澡。
2012-08-02 23:47:00 +08:00
回复了 paloalto 创建的主题 Python 求助web.py查询mysql,获得最新注册用户头像的问题。
@aggron 多谢解答!

刚才执行时发现报错,是因为后面的order='id DESC'没有指明是用哪个表的id,改为

db.select(['users', 'profile'], where="users.id=profile.userID", limit = 10, order='users.id DESC')

这样就行啦!


另外请问如果数据为空的话,db.select()能像web.listget()或者xxx.get()一样指定一个返回的数值吗?如下:

web.listget(
db.select('users', vars=dict(username=username),
where='username = $username'), 0, {'为空时返回的东西'})
————

return ids.get('id', False) —— False 也是为空时返回的。

还是说db.select()需要手动去判断返回的值是否为空?
2012-07-30 10:56:33 +08:00
回复了 uniy 创建的主题 Ruby Ruby到底是干什么用的,都能做什么样项目。
花费几个铜币来挽尊。
2012-07-27 15:07:18 +08:00
回复了 icepanda 创建的主题 上海 【上海】ios游戏创业团队寻php程序员/实习生,c#客户端程序
LZ的官网news里 http://www.magicbone.com/index.php?m=content&c=index&a=lists&catid=6 有張图片的地址不对。
<img src="http://127.0.0.12:8888/uploadfile/2012/0317/20120317082350171.png" style="float:right">
2012-07-27 14:28:07 +08:00
回复了 talentsnail 创建的主题 分享发现 画旅途,我的图片游记
这个网站去年我就开始关注了,主要的界面基本上都是在模仿 https://jux.com/

Jux:
http://ww2.sinaimg.cn/large/61b8bbf4gw1dvbdsj40oej.jpg

画旅途:
http://ww4.sinaimg.cn/large/61b8bbf4gw1dvbdspvb69j.jpg
2012-07-27 02:06:07 +08:00
回复了 paloalto 创建的主题 macOS 升级ML后,python的开发环境悲剧了。
刚又有新发现。

上面提到
————
在/etc的profile文件中加入一行
export DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH:/usr/local/mysql/lib"
————

刚才在运行nginx是发现有点小问题:

$ sudo nginx
dyld: DYLD_ environment variables being ignored because main executable (/usr/bin/sudo) is setuid or setgid

多了一行提示,但是没什么影响。

似乎是profile中的那行DYLD_LIBRARY_PATH的原因,我现在注释掉了,明天重新开机后看看会有什么情况。
2012-07-27 01:56:00 +08:00
回复了 paloalto 创建的主题 macOS 升级ML后,python的开发环境悲剧了。
补记一下后续:

command line tool装上之后,用easy_install安装mysql-python:

$ sudo easy_install mysql-python
Password:
Searching for mysql-python
Reading http://pypi.python.org/simple/mysql-python/
Reading http://sourceforge.net/projects/mysql-python/
Reading http://sourceforge.net/projects/mysql-python
Best match: MySQL-python 1.2.3
Downloading http://download.sourceforge.net/sourceforge/mysql-python/MySQL-python-1.2.3.tar.gz
Processing MySQL-python-1.2.3.tar.gz
Running MySQL-python-1.2.3/setup.py -q bdist_egg --dist-dir /tmp/easy_install-XKbf0S/MySQL-python-1.2.3/egg-dist-tmp-Y1AssU
warning: no files found matching 'MANIFEST'
warning: no files found matching 'ChangeLog'
warning: no files found matching 'GPL'
clang: warning: argument unused during compilation: '-mno-fused-madd'
In file included from _mysql.c:36:
/usr/local/mysql-5.5.25-osx10.6-x86_64/include/my_config.h:329:11: warning: 'SIZEOF_SIZE_T' macro
redefined
#define SIZEOF_SIZE_T SIZEOF_LONG
^
/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/pymacconfig.h:43:17: note:
previous definition is here
# define SIZEOF_SIZE_T 8
^
In file included from _mysql.c:36:
/usr/local/mysql-5.5.25-osx10.6-x86_64/include/my_config.h:422:9: warning: 'HAVE_WCSCOLL' macro redefined
#define HAVE_WCSCOLL
^
/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/pyconfig.h:891:9: note:
previous definition is here
#define HAVE_WCSCOLL 1
^
_mysql.c:253:14: warning: implicit conversion loses integer precision: 'Py_ssize_t' (aka 'long') to 'int'
[-Wshorten-64-to-32]
cmd_argc = PySequence_Size(cmd_args);
~ ^~~~~~~~~~~~~~~~~~~~~~~~~
_mysql.c:278:12: warning: implicit conversion loses integer precision: 'Py_ssize_t' (aka 'long') to 'int'
[-Wshorten-64-to-32]
groupc = PySequence_Size(groups);
~ ^~~~~~~~~~~~~~~~~~~~~~~
_mysql.c:405:14: warning: implicit conversion loses integer precision: 'Py_ssize_t' (aka 'long') to 'int'
[-Wshorten-64-to-32]
int j, n2=PySequence_Size(fun);
~~ ^~~~~~~~~~~~~~~~~~~~
_mysql.c:986:9: warning: implicit conversion loses integer precision: 'unsigned long' to 'int'
[-Wshorten-64-to-32]
len = mysql_real_escape_string(&(self->connection), out, in, size);
~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
_mysql.c:988:9: warning: implicit conversion loses integer precision: 'unsigned long' to 'int'
[-Wshorten-64-to-32]
len = mysql_escape_string(out, in, size);
~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
_mysql.c:1016:9: warning: implicit conversion loses integer precision: 'Py_ssize_t' (aka 'long') to 'int'
[-Wshorten-64-to-32]
size = PyString_GET_SIZE(s);
~ ^~~~~~~~~~~~~~~~~~~~
/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/stringobject.h:92:32: note:
expanded from macro 'PyString_GET_SIZE'
#define PyString_GET_SIZE(op) Py_SIZE(op)
^
/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/object.h:116:56: note:
expanded from macro 'Py_SIZE'
#define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size)
~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
_mysql.c:1025:9: warning: implicit conversion loses integer precision: 'unsigned long' to 'int'
[-Wshorten-64-to-32]
len = mysql_real_escape_string(&(self->connection), out+1, in, size);
~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
_mysql.c:1027:9: warning: implicit conversion loses integer precision: 'unsigned long' to 'int'
[-Wshorten-64-to-32]
len = mysql_escape_string(out+1, in, size);
~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
_mysql.c:1111:11: warning: implicit conversion loses integer precision: 'Py_ssize_t' (aka 'long') to 'int'
[-Wshorten-64-to-32]
if ((n = PyObject_Length(o)) == -1) goto error;
~ ^~~~~~~~~~~~~~~~~~
/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/abstract.h:434:25: note:
expanded from macro 'PyObject_Length'
#define PyObject_Length PyObject_Size
^
_mysql.c:1298:10: warning: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to
'int' [-Wshorten-64-to-32]
len = strlen(buf);
~ ^~~~~~~~~~~
_mysql.c:1300:10: warning: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to
'int' [-Wshorten-64-to-32]
len = strlen(buf);
~ ^~~~~~~~~~~
_mysql.c:1336:11: warning: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to
'int' [-Wshorten-64-to-32]
len = strlen(buf);
~ ^~~~~~~~~~~
_mysql.c:1338:11: warning: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to
'int' [-Wshorten-64-to-32]
len = strlen(buf);
~ ^~~~~~~~~~~
_mysql.c:1421:10: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
if (how < 0 || how >= sizeof(row_converters)) {
~~~ ^ ~
16 warnings generated.
zip_safe flag not set; analyzing archive contents...
Adding MySQL-python 1.2.3 to easy-install.pth file

Installed /Library/Python/2.7/site-packages/MySQL_python-1.2.3-py2.7-macosx-10.8-intel.egg
Processing dependencies for mysql-python
Finished processing dependencies for mysql-python

虽然有一些奇怪的东西出现,但好歹装上了。

接着去web.py下运行project试试能不能启动:

$ python application.py
Traceback (most recent call last):
File "application.py", line 13, in <module>
import config
File "/Users/hanjiyun/Project/sputnik/config.py", line 10, in <module>
db = web.database(dbn='mysql', db='mlss', user='sputnik', passwd='paloalto-3859675')
File "/Library/Python/2.7/site-packages/web.py-0.37-py2.7.egg/web/db.py", line 1143, in database
return _databases[dbn](**params)
File "/Library/Python/2.7/site-packages/web.py-0.37-py2.7.egg/web/db.py", line 975, in __init__
import MySQLdb as db
File "build/bdist.macosx-10.8-intel/egg/MySQLdb/__init__.py", line 19, in <module>
File "build/bdist.macosx-10.8-intel/egg/_mysql.py", line 7, in <module>
File "build/bdist.macosx-10.8-intel/egg/_mysql.py", line 6, in __bootstrap__
ImportError: dlopen(/Users/hanjiyun/.python-eggs/MySQL_python-1.2.3-py2.7-macosx-10.8-intel.egg-tmp/_mysql.so, 2): Library not loaded: libmysqlclient.18.dylib
Referenced from: /Users/hanjiyun/.python-eggs/MySQL_python-1.2.3-py2.7-macosx-10.8-intel.egg-tmp/_mysql.so
Reason: image not found

悲剧,后来在 http://yan-yan.info/2011/install-mysql-5.5-on-mac-os-10.7-with-python-support.html 找到办法:

在/etc的profile文件中加入一行
export DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH:/usr/local/mysql/lib"

然后重启电脑。

再次运行项目,发现无法与Mysql连接,我这才想起来mysql还没启动,我的mysql版本是mysql-5.5.25-osx10.6-x86_64,需要通过“系统偏好设置” 中的MySQL面板来启动。

http://ww1.sinaimg.cn/large/61b8bbf4gw1dvarzkytqgj.jpg

但是启动的时候发现报错:

Warning: The /usr/local/mysql/data directory is not owned by the 'mysql' or '_mysql' user

在stackoverflow找到解决办法:
http://stackoverflow.com/questions/4762543/mysql-what-user-should-own-usr-local-mysql-on-mac

按照帖子中说的,运行命令:
sudo chown -R _mysql:wheel /usr/local/mysql/data
Mysql顺利启动。

再次运行项目:
$ python application.py
http://0.0.0.0:8080/


终于搞定了。


绳命在于折腾。
2012-07-26 23:55:16 +08:00
回复了 paloalto 创建的主题 macOS 升级ML后,python的开发环境悲剧了。
@pepsin 新系统似乎是不用GCC,改用Clang了,本来我正在研究怎么装Clang,但是看了你的恢复之后决定先装上command line tool,但是不知道你说的Link一下是指什么?还请详细赐教。
@nichan 额..我也知道在虚拟机里开发是最合适的,但是还是习惯在mac里做。。。感觉每次都要开虚拟机好麻烦。。
2012-07-26 23:36:58 +08:00
回复了 paloalto 创建的主题 macOS 升级ML后,python的开发环境悲剧了。
mysql-python还装不上。。。

$ sudo easy_install mysql-python
Searching for mysql-python
Reading http://pypi.python.org/simple/mysql-python/
Reading http://sourceforge.net/projects/mysql-python/
Reading http://sourceforge.net/projects/mysql-python
Best match: MySQL-python 1.2.3
Downloading http://download.sourceforge.net/sourceforge/mysql-python/MySQL-python-1.2.3.tar.gz
Processing MySQL-python-1.2.3.tar.gz
Running MySQL-python-1.2.3/setup.py -q bdist_egg --dist-dir /tmp/easy_install-KsFBj4/MySQL-python-1.2.3/egg-dist-tmp-5MHDrO
warning: no files found matching 'MANIFEST'
warning: no files found matching 'ChangeLog'
warning: no files found matching 'GPL'
unable to execute clang: No such file or directory
error: Setup script exited with error: command 'clang' failed with exit status 1
@kekecen 人物卡真是个好东西!
说到城市功能瘫痪,我倒联想到最近北京的暴雨了。

ps:《百年孤独》中有很多情节像是有预言性质一般。 《百年孤独》的那场大雨 : http://www.douban.com/note/227435386/
@kokdemo 最近正在看小说,找语感。很久不看小说,都不知道怎么下笔了。

另外,对于整部小说的类型划分,我现在觉得划为“科幻”可能有点偏差。也许村上春树的一些小说如《海边的卡夫卡》《寻羊历险记》《1Q84》里面一些脱离现实的情节更适合展开作为整部小说的风格。荒诞不经,稀奇古怪,但是不会村上作品中的“羊先生”“鼠先生”“空气蛹”之类比较“神奇”的东西出现。——不过呢,我也还没想好,只是往这边想了一下而已。也可能到时候下笔写着写着就知道是什么风格了。

@greenymora 关于“怎么结识终南山的隐士”这点,没有想象中那么困难。“1989年,比尔·波特探访终南山,写成《空谷幽兰:寻访当代中国隐士》一书。”—— 《华夏地理 》2011年6月号 《重访空谷幽兰》这篇文章描述了现在终南山隐士的生活状态。http://ngmchina.com.cn/web/?action-viewnews-itemid-173815

引用其中的一部分:

....他在书里采访过的隐士们,更有一大半已经不在人世。我问他是否知道有谁22年来一直待在终南山,他搜肠刮肚一番,也只找到一位:净土茅篷的比丘尼乘波。回美国之后,比尔找出了乘波的电话发给我(“没错,隐士们现在都有电话了”,比尔在电邮里写道)。他还告诉我,净土茅篷也和以前不一样了,它已经被扩建成一座可以容纳许多人的寺院。

我一点不觉得意外。1989年到今天,我去过的许多地方已沧海桑田,而这也是中国人民早经习以为常的共同经验。终南山纵然曾经藏着百千隐士,可它毕竟距离西安城只有咫尺之遥。二十多年过去,隐士们还在么?

隐士们当然还在。这是比尔· 波特的书商给我的答案。他还特别推荐我去找一个当地人。“你一百个放心,张剑锋认识终南山所有的隐士。”张剑锋是位同行,他在西安编辑一份名为《问道》的系列读物,接到我们的电话,他善解人意地把见面地点约在了山里一个叫作终南草堂的所在。

....

现在的隐士除了辟谷(大概就是闭关的意思)期间不与外人接触之外,其实还是可以和俗人聊天的。

http://ww3.sinaimg.cn/large/a74ecc4cjw1dv8ewm8x6jj.jpg
2012-07-23 18:36:24 +08:00
回复了 jamiesun 创建的主题 程序员 发毒誓,以后再不通宵赶活了。
早上六点睡,下午三点起的路过。。。。
2012-07-23 02:15:57 +08:00
回复了 elepone 创建的主题 PHP 求大家推荐一个PHP的自助建站系统
wordpress+1
just do it.
2012-07-19 02:47:20 +08:00
回复了 mimzy 创建的主题 分享发现 武大faceMash - WHU FaceJoking
top50我以为都是一个人。。。。囧
1 ... 83  84  85  86  87  88  89  90  91  92 ... 113  
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2608 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 48ms · UTC 06:22 · PVG 14:22 · LAX 22:22 · JFK 01:22
Developed with CodeLauncher
♥ Do have faith in what you're doing.