不知怎的,我已经成功完成了在Ubuntu karmic上安装postgresql的麻烦.我想从头开始,但是当我用apt-get"清除"包时,它仍然留下痕迹,使重新安装配置无法正常运行.
我做完之后:
apt-get purge postgresql
apt-get install postgresql
Run Code Online (Sandbox Code Playgroud)
它说
Setting up postgresql-8.4 (8.4.3-0ubuntu9.10.1) ...
Configuring already existing cluster (configuration: /etc/postgresql/8.4/main, data: /var/lib/postgresql/8.4/main, owner: 108:112)
Error: move_conffile: required configuration file /var/lib/postgresql/8.4/main/postgresql.conf does not exist
Error: could not create default cluster. Please create it manually with
pg_createcluster 8.4 main --start
or a similar command (see 'man pg_createcluster').
update-alternatives: using /usr/share/postgresql/8.4/man/man1/postmaster.1.gz to provide /usr/share/man/man1/postmaster.1.gz (postmaster.1.gz) in auto mode.
Setting up postgresql (8.4.3-0ubuntu9.10.1) ...
Run Code Online (Sandbox Code Playgroud)
我有一个"/ etc/postgresql",其中没有任何内容,"/ etc/postgresql-common /"有一个'pg_upgradecluser.d'目录和root.crt和user_clusters文件.
/ etc/passwd有一个postgres用户; 清除脚本似乎没有触及它.我经历过一系列症状只是为了暴露下一个.
这一秒,当我运行该命令"pg_createcluster ..."时,它抱怨'/var/lib/postgresql/8.4/main/postgresql.conf不存在',所以我会找到其中一个,但我我肯定不会结束它. …
我有一个PowerShell 1.0脚本来打开一堆应用程序.第一个是虚拟机,其他是开发应用程序.我希望虚拟机在其他应用程序打开之前完成启动.
在bash我可以说 "cmd1 && cmd2"
这就是我所拥有的......
C:\Applications\VirtualBox\vboxmanage startvm superdooper
&"C:\Applications\NetBeans 6.5\bin\netbeans.exe"
Run Code Online (Sandbox Code Playgroud) ./manage.py test app现在..
tests.py文件变得相当大/复杂/凌乱tests.py分成更小的测试集合......怎么样?
发行说明说:
Django 1.3为Python的日志记录模块添加了框架级支持.
真好.我想利用这一点.不幸的是,文档并没有以完整的工作示例代码的形式将它全部交给我,这表明这是多么简单和有价值.
如何设置这个时髦的新功能,以便我可以使用我的代码
logging.debug('really awesome stuff dude: %s' % somevar)
Run Code Online (Sandbox Code Playgroud)
并查看文件"/tmp/application.log"填写
18:31:59 Apr 21 2011 awesome stuff dude: foobar
18:32:00 Apr 21 2011 awesome stuff dude: foobar
18:32:01 Apr 21 2011 awesome stuff dude: foobar
Run Code Online (Sandbox Code Playgroud)
默认的Python日志记录和这种"框架级支持"之间有什么区别?
什么是如何生成随机颜色以传递给绘图函数的简单例子?
我在循环中调用散射并希望每个绘图都有不同的颜色.
for X,Y in data:
scatter(X, Y, c=??)
Run Code Online (Sandbox Code Playgroud)
c:一种颜色.c可以是单色格式字符串,或长度为N的颜色规范序列,或使用通过kwargs指定的cmap和norm映射到颜色的N个数字序列(见下文).请注意,c不应该是单个数字RGB或RGBA序列,因为它与要进行颜色映射的值数组无法区分.然而,c可以是2-D阵列,其中行是RGB或RGBA.
Ping默认返回此值:
64 bytes from 203.173.50.132: icmp_seq=0 ttl=244 time=57.746 ms
Run Code Online (Sandbox Code Playgroud)
有什么方法可以让它添加时间戳吗?
例如,
Mon 21 May 2012 15:15:37 EST | 64 bytes from 203.173.50.132: icmp_seq=0 ttl=244 time=57.746 ms
Run Code Online (Sandbox Code Playgroud)
我在OS X v10.7(Lion)上似乎有一些BSD版本的ping.
我只想要固定宽度的文本列,但字符串都填充正确,而不是左边!!?
sys.stdout.write("%6s %50s %25s\n" % (code, name, industry))
Run Code Online (Sandbox Code Playgroud)
产生
BGA BEGA CHEESE LIMITED Food Beverage & Tobacco
BHP BHP BILLITON LIMITED Materials
BGL BIGAIR GROUP LIMITED Telecommunication Services
BGG BLACKGOLD INTERNATIONAL HOLDINGS LIMITED Energy
Run Code Online (Sandbox Code Playgroud)
但我们想要
BGA BEGA CHEESE LIMITED Food Beverage & Tobacco
BHP BHP BILLITON LIMITED Materials
BGL BIGAIR GROUP LIMITED Telecommunication Services
BGG BLACKGOLD INTERNATIONAL HOLDINGS LIMITED Energy
Run Code Online (Sandbox Code Playgroud) 我正在尝试在PyCharm(在Windows主机上)和运行我的django应用程序的debian虚拟主机之间进行调试.说明说要安装egg,添加导入,然后调用命令.我假设这些东西需要在debian主机上完成?
好的,那么,我应该把这两行放在什么文件中?
from pydev import pydevd
pydevd.settrace('not.local', port=21000, stdoutToServer=True, stderrToServer=True)
Run Code Online (Sandbox Code Playgroud)
我尝试将它放入settings.py但是得到了这样的东西......
File "/django/conf/__init__.py", line 87, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "/django/utils/importlib.py", line 35, in import_module
__import__(name)
File "/settings.py", line 10, in <module>
pydevd.settrace('dan.local', port=21000, stdoutToServer=True, stderrToServer=True)
File "/pycharm-debug.egg/pydev/pydevd.py", line 1079, in settrace
debugger.connect(host, port)
File "/pycharm-debug.egg/pydev/pydevd.py", line 241, in connect
s = StartClient(host, port)
File "/pycharm-debug.egg/pydev/pydevd_comm.py", line 362, in StartClient
sys.exit(1)
SystemExit: 1
Run Code Online (Sandbox Code Playgroud)
虽然pycharm只是坐在那里"等待连接"
The documentation is a bit lacking with respect to this feature.
from django import forms
class TwoInputWidget(forms.MultiWidget):
"""An example widget which concatenates two text inputs with a space"""
def __init__(self, attrs=None):
widgets = [forms.TextInput, forms.TextInput]
Run Code Online (Sandbox Code Playgroud)
我可以看到我需要创建一个带有其他小部件列表的"小部件"属性,但之后它会得到一个小福尔摩斯.
有人请向我解释如何使用MultiWidget小部件吗?
谷歌正在推动我们提高对其gmail smtp服务器的脚本访问的安全性.对于那件事我没有任何疑问.事实上,我很乐意提供帮助.
但他们并没有让事情变得简单.建议我们一切都很好Upgrade to a more secure app that uses the most up to date security measures,但这并没有帮助我找出如何升级看起来像这样的代码:
server = smtplib.SMTP("smtp.gmail.com", 587)
server.ehlo()
server.starttls()
server.login(GMAIL_USER, GMAIL_PASSWORD)
server.sendmail(FROM, TO, MESSAGE)
server.close()
Run Code Online (Sandbox Code Playgroud)
当然,我会开启"访问安全性较低的应用程序",但如果有人知道要替换这些代码的话,我将不胜感激.
django ×4
python ×4
apt-get ×1
bash ×1
bsd ×1
execution ×1
gmail ×1
matplotlib ×1
osx-lion ×1
ping ×1
postgresql ×1
powershell ×1
pycharm ×1
ubuntu ×1
uninstall ×1
unit-testing ×1
wait ×1