我在这段代码上看到了奇怪的行为:
images = dict(cover=[],second_row=[],additional_rows=[])
for pic in pictures:
if len(images['cover']) == 0:
images['cover'] = pic.path_thumb_l
elif len(images['second_row']) < 3:
images['second_row'].append(pic.path_thumb_m)
else:
images['additional_rows'].append(pic.path_thumb_s)
Run Code Online (Sandbox Code Playgroud)
我的web2py应用程序给了我这个错误:
Run Code Online (Sandbox Code Playgroud)if len(images['cover']) == 0: TypeError: object of type 'NoneType' has no len()
我无法弄清楚这有什么问题.也许是一些范围问题?
我的意见按预期进行; 每当我改变某些东西时,它会立即反映在页面上.但每次我在控制器,模型或配置中进行更改时,我都必须重新启动服务器才能显示它.
我启动我的服务器,rails s -e development它说明了这一点:
=> Booting Puma
=> Rails 4.1.8 application starting in development on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Notice: server is listening on all interfaces (0.0.0.0). Consider using 127.0.0.1 (--binding option)
=> Ctrl-C to shutdown server
Run Code Online (Sandbox Code Playgroud)
我config/environments/development.rb看起来像这样:
# -*- encoding : utf-8 -*-
Gvm::Application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# In the development …Run Code Online (Sandbox Code Playgroud) 对于我尝试运行的每个git命令,我收到此消息.例:
stewie:~# git --version
git: /usr/local/lib/libz.so.1: no version information available (required by git)
git version 1.7.11.4
Run Code Online (Sandbox Code Playgroud)
我怎么能摆脱这个?
编辑1:
试图更新zlib1g:
stewie:/tmp# apt-get install zlib1g
Reading package lists... Done
Building dependency tree
Reading state information... Done
zlib1g is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Run Code Online (Sandbox Code Playgroud)
编辑2:
我在Debian Lenny(5),不幸的是,使用apt-get并不那么容易.
提前抱歉,如果世界某处已有答案,但我已经3小时尝试在我的PRODUCTION服务器上安装,而且我没有到达任何地方.
我的需求:
我想在我的服务器上运行git命令(例如:push,commit等).为了做到这一点,我需要"git"命令(呃!).
我尝试了什么:
试图遵循这个:http://oli.zilla.org.uk/2010/12/07/installing-git-on-debian-lenny.html
尝试下载源(http://packages.debian.org/lenny/i386/git-core/download)的.deb文件(http://ftp.de.debian.org/debian/pool/main/ g/git /)
问题:
404在试图获取源代码时:http://packages.debian.org/lenny/i386/git-core/download
下载软件包时,我尝试使用的所有存储库都给了我404
需要将libc6从2.7更新到2.9才能安装git-1.7.9,如下所示:
stewie:/tmp# dpkg -i git_1.7.9-1~bpo60+1_i386.deb
Selecting previously deselected package git.
(Reading database ... 20477 files and directories currently installed.)
Unpacking git (from git_1.7.9-1~bpo60+1_i386.deb) ...
dpkg: dependency problems prevent configuration of git:
git depends on libc6 (>= 2.9); however:
Version of libc6 on system is 2.7-18lenny7.
git depends on libcurl3-gnutls (>= 7.16.2-1); however:
Package …Run Code Online (Sandbox Code Playgroud) 我很抱歉在这里问这个问题,但是我试过了serverfault并且4天没有得到任何答案.
那里的相关问题:https://serverfault.com/questions/394197/mount-shared-folder-vbox-as-another-user
题:
每次我的ubuntu(10.04)启动时,我都试图挂载我的vbox共享文件夹.
所以,我在/ etc/init上添加了一个条目:
description "mount vboxsf Desktop"
start on startup
task
exec mount -t vboxsf Desktop /var/www/shared
Run Code Online (Sandbox Code Playgroud)
似乎工作,除了所有文件都由"root"拥有的事实,我没有权限写在文件夹上(chmod和chown似乎都没有工作).
那么,如何让这个共享文件夹下的所有文件归www-data user/group所有呢?
ps.:我有一个自动共享文件夹的主要原因是,我可以在GUEST www文件夹上的HOST中创建/编辑文件.
如果你有更好的想法,而不是共享文件夹,可以自由地说.
我对Git(和VC这个问题)很陌生,我正在努力了解使用分支机构开发Dev> Staging> Live工作流程背后的概念.
我正在尝试应用此工作流的一部分,它使用dev分支和发布分支而不是固定的分段.
在尝试使用Git之前,我使用SVN进行了"相同"的工作流程.但是我们不是为每个阶段创建分支,而是使用单独的存储库.现在我正在尝试应用分支,事情变得有点模糊.
我可以理解工作流程背后的想法,但无法从技术角度来理解它.
我正在创建它的步骤:
创建文件夹
user:/var/www/$ mkdir dev.example.local
user:/var/www/$ mkdir staging.example.local
user:/var/www/$ mkdir example.local
Run Code Online (Sandbox Code Playgroud)
初始存储库
user:/var/www/example.local$ git init
user:/var/www/example.local$ git remote add origin git@bitbucket.org:user/example.com.git
user:/var/www/example.local$ echo "README" > README
user:/var/www/example.local$ git commit -am "First"
user:/var/www/example.local$ git push origin master
user:/var/www/example.local$ cd ../dev.example.com
user:/var/www/dev.example.local$ git clone git@bitbucket.org:user/example.com.git .
user:/var/www/dev.example.local$ git checkout -b dev
user:/var/www/dev.example.local$ git push origin dev
user:/var/www/dev.example.local$ cd staging.example.com
user:/var/www/staging.example.local$ git clone git@bitbucket.org:user/example.com.git .
Run Code Online (Sandbox Code Playgroud)
一些关于dev分支的工作
user:/var/www/dev.example.local$ echo "New" …Run Code Online (Sandbox Code Playgroud) 在Yosemite更新之前,我使用这个 Applescript来控制我的Spotify.
当我跑步时,一切都充满了魅力/usr/bin/osascript /Users/jdrummond/SpotifyControl.scpt play/pause.
现在我已经将我的OSX更新为Yosemite,当我运行相同的命令时,我会继续这样做:
/Users/jdrummond/SpotifyControl2.scpt:1217:1222: script error: Expected end of line, etc. but found identifier. (-2741)
Run Code Online (Sandbox Code Playgroud)
所以我尝试创建一个简单的Applescript来与Spotify交互:
using terms from application "Spotify"
tell application "Spotify" to play
end using terms from
Run Code Online (Sandbox Code Playgroud)
但我也得到一个错误:

我做错了什么以及如何与优胜美地的Spotify互动?有什么改变?
所以,我有一个PHP脚本:
<?
rand(1000000000000,9999999999999);
Run Code Online (Sandbox Code Playgroud)
预期结果是13位数字.
但它正在返回一些奇怪的数字,如:
987419207
1032717476
-455563764
Run Code Online (Sandbox Code Playgroud)
有谁知道发生了什么?
PHP:5.2.17
操作系统:在Debian Squeeze和Windows 7上测试,均为64位
<?
echo rand(10000,99999).rand(10000000,99999999);
Run Code Online (Sandbox Code Playgroud) 什么相当于PHP的$my_array[] = "abc";Python中的"追加到数组"(),我最近开始学习?
让我们说我有一个这样的字典:
my_dict = {'fruits':['orange', 'pear']}
Run Code Online (Sandbox Code Playgroud)
现在我想添加另一种水果my_dict['fruits']:apple
我想让fancybox尺寸与"手动创建的"iframe的内容大小相匹配.
我试过这个:http://jsfiddle.net/ystLD/3/
但它不起作用,现在我有点卡在这里.
有谁知道如何做到这一点?
谢谢.