我想在外部网站上添加一些广告,为此,我使用iframe:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body style="background:#ddd">
<center>My ad</center>
<iframe src="http://www.google.com" style="position:fixed; top:50px; left:0; width: 100%; bottom: 0; border: 0 ">
<p>Your browser does not support iframes.</p>
</iframe>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
iframe位于正确的位置,但'bottom:0'不起作用:为什么?我希望iFrame跟随窗口大小调整:如何继续?
我已经使用django-registration:您可以注册电子邮件验证,您可以通过电子邮件确认重置密码,但无法通过电子邮件验证更改用户的电子邮件.
你知道一个django应用程序,它能够通过向新地址发送验证电子邮件来更改用户的电子邮件地址吗?
我正在研究django的全文搜索引擎.它必须易于安装,快速索引,快速索引更新,索引时不阻塞,快速搜索.
阅读了很多网页之后,我列出了一个简短的列表:Mysql MYISAM全文,djapian/python-xapian和django-sphinx我没有选择lucene,因为它看起来很复杂,也没有haystack,因为它的功能比djapian/django-spĥinx少(喜欢田地加权).
然后我做了一些基准测试,为此,我在网上收集了许多免费书籍以生成一个包含1 485 000条记录(id,title,body)的数据库表,每条记录长约600字节.从数据库中,我还生成了一个包含10万个现有单词的列表,并将它们混洗以创建搜索列表.对于测试,我在我的笔记本电脑上进行了2次运行(4Go RAM,双核2.0Ghz):第一次,在服务器重新启动以清除所有缓存之后,第二次完成juste以便测试缓存结果有多好.以下是"自制"基准测试结果:
1485000 records with Title (150 bytes) and body (450 bytes)
Mysql 5.0.75/Ubuntu 9.04 Fulltext :
==========================================================================
Full indexing : 7m14.146s
1 thread, 1000 searchs with single word randomly taken from database :
First run : 0:01:11.553524
next run : 0:00:00.168508
Mysql 5.5.4 m3/Ubuntu 9.04 Fulltext :
==========================================================================
Full indexing : 6m08.154s
1 thread, 1000 searchs with single word randomly taken from database :
First run : 0:01:09.553524
next run : 0:00:20.316903
1 thread, …Run Code Online (Sandbox Code Playgroud) 我出于某些原因将bash脚本翻译成python.
Python更强大,但是,编写这样的简单bash代码要困难得多:
MYVAR = `grep -c myfile`
Run Code Online (Sandbox Code Playgroud)
使用python我首先要定义一个反引号函数可以是:
def backquote(cmd,noErrorCode=(0,),output=PIPE,errout=PIPE):
p=Popen(cmd, stdout=output, stderr=errout)
comm=p.communicate()
if p.returncode not in noErrorCode:
raise OSError, comm[1]
if comm[0]:
return comm[0].rstrip().split('\n')
Run Code Online (Sandbox Code Playgroud)
那太无聊了!
有没有Python的味道(IPython?),很容易产生进程并获得输出?
我正在编写一个基于django的网站.我实际上在Ubuntu 10.04下使用了一台小型计算机.我想购买更专业的东西,所以我想知道iMac是否有用,因为:
在Apache配置文件中,有一行可以避免对图像进行gzip压缩:
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
Run Code Online (Sandbox Code Playgroud)
我不相信可能存在类似的.gif文件名myfile.*:gif.
那?:意味着什么?
我在O'Reilly的书中发现了一个有点奇怪的例子:
@backwards = reverse qw/ yabba dabba doo /;
print "list context: @backwards\n";
$backward = reverse qw/ yabba dabba doo /;
print "scalar1 context: $backward\n";
$notbackward = qw/ yabba dabba doo /;
print "scalar2 context: $notbackward\n";
print "print context: ",reverse qw/ yabba dabba doo /;
print "\n";
Run Code Online (Sandbox Code Playgroud)
输出是:
list context: doo dabba yabba
scalar1 context: oodabbadabbay
scalar2 context: doo
print context: doodabbayabba
Run Code Online (Sandbox Code Playgroud)
我不理解的是scalar1上下文:
这本书说"反向某事"给出了一个列表上下文,所以我猜qw/ yabba dabba doo /是被视为一个列表和reverse qw/ yabba dabba doo /('doo','dabba','yabba').
因此, …
我想从项目中获取一些文件:我不需要克隆整个存储库:我只需要来自主分支的最新快照.这对我来说很重要,因为我的带宽非常低,下载所有内容需要一些时间.
在另一个问题上,我看到可以使用'git archive'这样做,不幸的是,似乎它不适用于https:
git archive --format=tar --remote=https://github.com/thomaspark/bootswatch.git master | tar tvf -
returns "fatal: Operation not supported by protocol."
Run Code Online (Sandbox Code Playgroud)
此命令与ssh://一起使用,但不与https://一起使用
对于github,我可以在Web界面上下载提供的zip文件,但对于其他没有提供它的存储库,如何从git存储库https URL获取简单快照?