问题列表 - 第49572页

virtualenv不会对python 2.7进行符号链接warnings.py

我在使用Lucid上的python2.7创建virtualenv(1.5.2)时遇到问题.看起来像virtualenv正在跳过warnings.py的symlink创建.

Running virtualenv with interpreter /usr/local/bin/python2.7
Creating test/lib/python2.7
Symlinking Python bootstrap modules
  Symlinking test/lib/python2.7/sre_compile.pyc
  Symlinking test/lib/python2.7/encodings
  Symlinking test/lib/python2.7/UserDict.pyc
  Symlinking test/lib/python2.7/stat.pyo
  Symlinking test/lib/python2.7/copy_reg.pyo
  Symlinking test/lib/python2.7/posixpath.py
  Symlinking test/lib/python2.7/stat.pyc
  Symlinking test/lib/python2.7/re.py
  Symlinking test/lib/python2.7/sre_parse.pyo
  Symlinking test/lib/python2.7/sre_constants.pyo
  Symlinking test/lib/python2.7/codecs.py
  Symlinking test/lib/python2.7/lib-dynload
  Symlinking test/lib/python2.7/locale.py
  Symlinking test/lib/python2.7/sre.pyc
  Symlinking test/lib/python2.7/ntpath.pyo
  Symlinking test/lib/python2.7/types.pyo
  Symlinking test/lib/python2.7/config
  Symlinking test/lib/python2.7/sre_parse.py
  Symlinking test/lib/python2.7/genericpath.pyc
  Symlinking test/lib/python2.7/sre.py
  Symlinking test/lib/python2.7/copy_reg.pyc
  Symlinking test/lib/python2.7/sre.pyo
  Symlinking test/lib/python2.7/sre_constants.py
  Symlinking test/lib/python2.7/types.pyc
  Symlinking test/lib/python2.7/UserDict.pyo
  Symlinking test/lib/python2.7/ntpath.pyc
  Symlinking test/lib/python2.7/fnmatch.py
  Symlinking test/lib/python2.7/os.pyo
  Symlinking test/lib/python2.7/codecs.pyo
  Symlinking test/lib/python2.7/os.pyc
  Symlinking test/lib/python2.7/fnmatch.pyo
  Symlinking test/lib/python2.7/genericpath.pyo
  Symlinking test/lib/python2.7/UserDict.py
  Symlinking test/lib/python2.7/re.pyc …
Run Code Online (Sandbox Code Playgroud)

python virtualenv

5
推荐指数
1
解决办法
2044
查看次数

Ant loadfile覆盖属性

我正在尝试<loadfile>在循环中使用Ant任务来解析文件的内容.我有类似的东西

<loadfile srcFile="@{some.input}" property="my.property">
Run Code Online (Sandbox Code Playgroud)

由于Ant属性是不可变的,这对我来说不起作用.我需要'my.property'来更新每次迭代.有没有办法实现这个目标?我知道Ant-contrib有一个<var>任务,但我不确定如何使用<loadfile>它.

有什么建议?

谢谢.

ant variables properties flaka

4
推荐指数
1
解决办法
4280
查看次数

错误:在'::'标记之前的预期构造函数,析构函数或类型转换

我在尝试编译我的课时遇到错误.

错误:

Matrix.cpp:13:错误:在'::'标记之前的预期构造函数,析构函数或类型转换

Matrix.h

#ifndef _MATRIX_H
#define _MATRIX_H

template <typename T>
class Matrix {
public:
    Matrix();
    ~Matrix();
    void set_dim(int, int);     // Set dimensions of matrix and initializes array
    unsigned int get_rows();    // Get number of rows
    unsigned int get_cols();    // Get number of columns
    void set_row(T*, int);      // Set a specific row with array of type T
    void set_elem(T*, int, int);// Set a specific index in the matrix with value T
    bool is_square();           // Test to see if matrix is …
Run Code Online (Sandbox Code Playgroud)

c++ templates class

0
推荐指数
1
解决办法
1856
查看次数

Python:根据计数创建多个列表

我试图创建一些列表,具体取决于我的header_count中的数字.下面的代码应该生成3个列表,但我得到语法错误.

header_count = 4
for i in range(1, header_count):
    header_%s = [] % i
Run Code Online (Sandbox Code Playgroud)

python

2
推荐指数
1
解决办法
6735
查看次数

在ruby中格式化

我有这个:

artists = search_object.map{|x| x["artistName"]}.uniq
=> ["Metallica", "Madonna", "Lady Gaga"]
Run Code Online (Sandbox Code Playgroud)

我需要这种格式json:

{"artists":[{"name":"Metallica"},{"name":"Madonna"},{"name":"Lady Gaga"}]}
Run Code Online (Sandbox Code Playgroud)

我试过这个:

>>     @api = {}
=> {}
>>          @api[:artists] = artists
=> ["Metallica", "Madonna", "Lady Gaga"]
>> @api
=> {:artists=>["Metallica", "Madonna", "Lady Gaga"]}
Run Code Online (Sandbox Code Playgroud)

我在这样的api调用中需要它:

respond_to do |format|
  format.json { render :json => @api}
end
Run Code Online (Sandbox Code Playgroud)

但是什么回来是不合适的json.

我如何以这种格式获得它?

ruby json ruby-on-rails

0
推荐指数
1
解决办法
94
查看次数

保存ModelForm错误(无法创建User_Message,因为数据未验证)

我遇到了一个似乎可能与djangocode相关的线程,但它并没有真正帮助.我正在尝试保存一个模型,它正在抛出异常.我认为这可能与我的模型中两次引用相同的外键有关.它也可能与其中一个外键字段中unique = True的定义有关.我不知道

class User_Message(models.Model):
   recipient=models.ForeignKey(User, unique=True, related_name="recipients")
   subject=models.CharField(max_length=100)
   sender=models.ForeignKey(User, related_name="senders")
   message=models.TextField(max_length=500)
sent=models.DateField(auto_now_add=True)

def __unicode__(self):
    return self.subject



if request.method=="POST" and request.POST['id_message']:
    messageform=User_MessageForm(request.POST)
    recipient=[]   #receiver of mail must be a list
    recipient.append(post.user)
    if messageform.is_valid:
        message=messageform.save(commit=False)
        message.sender=user
        message.recipient=post.user
        return HttpResponse('%s %s' %(user,post.user))
        message.save()

        #send the email
        subject=messageform.cleaned_data['id_subject']
        body=messageform.cleaned_data['id_message']

        try:
            send_mail(subject, body, sender, recipient)
        except BadHeaderError:
            return HttpResponse('Invalid header found.')
Run Code Online (Sandbox Code Playgroud)

它失败了,"messageform.save(commit = False).我认为这个陈述是失败证明.

modelform接收的POST数据包含主题和消息字段.我的模型成功验证了此数据.

是相关名称,唯一=真......什么给出?

谢谢

django django-models django-forms

14
推荐指数
1
解决办法
1万
查看次数

带有捕获组的RegEx中的空白问题

我有一个正则表达式,我试图匹配以下类型的数据,每个标记由未知数量的空格分隔.

更新:"文字"几乎可以是任何字符,这就是我.*最初的原因.重要的是,它还可以包括空格.

  1. 文本
  2. 文字01
  3. 03年第01号
  4. 文字01(03)
  5. 文字01-03

我想将"Text","01"和"03"作为单独的组捕获,除"Text"之外的所有组都是可选的.到目前为止我能做的最好的是:

\s*(.*)\s+(\d+)\s*(?:\s*\(?\s*(?:of|-)\s*(\d+)\s*\)?\s*)
Run Code Online (Sandbox Code Playgroud)

这匹配#3-#5,并将它们放在适当的捕获组中.但是,我无法弄清楚,为什么当我?在结尾处添加一个额外的部分以使表达式成为01可选项后,我的捕获组会变得非常时髦.

\s*(.*)\s+(\d+)\s*(?:\s*\(?\s*(?:of|-)\s*(\d+)\s*\)?\s*)?
Run Code Online (Sandbox Code Playgroud)

上面的RegEx匹配#2-#5,但捕获组仅对#2和#5正确.

这似乎是一个简单的正则表达式,所以我不知道为什么我遇到这么多麻烦.

这是一个在线RegEx评估员的链接,我用来帮助我调试这个:http://regexr.com?2tb64 .该链接已经有第一个RegEx和填写的测试数据.

regex whitespace capture-group

4
推荐指数
1
解决办法
8726
查看次数

如何在vb.net中使用Linq选择单个对象

我已经做了很多搜索似乎是一个简单的LINQ问题,但我无法弄清楚如何从具有指定最小值(或最大值)的集合中抓取一个对象而不采用这样的排序:

dim customers= GetCustomers()

dim youngest = (From c in customers
                 Order By c.age Ascending).ToList.First
Run Code Online (Sandbox Code Playgroud)

此(未经测试的代码)结构可正常工作,但必须对整个客户数组进行排序并将其放入列表中,以便仅提取第一个值.这不是获得最低限度的最佳方式!

请注意,在这种情况下我想要整个c记录,而不是像这样可以完成的客户的最小年龄(典型示例):

dim customers= GetCustomers()

dim youngest = (From c in customers
                 Select c.age).Min
Run Code Online (Sandbox Code Playgroud)

甚至

dim customers= GetCustomers()

dim youngest = (From c in customers
                 Select c).Min(Function(x) x.age)
Run Code Online (Sandbox Code Playgroud)

我不能为我的生活弄清楚如何获得整个对象(甚至索引)而不诉诸于排序......

linq vb.net lambda minimum

2
推荐指数
1
解决办法
2万
查看次数

clearcase - 更新和rebase之间的区别

我最近开始学习ClearCase(我来自git和svn的背景 - 我非常想念他们:))并且一直在咀嚼这个:在快照视图中,有什么区别更新和rebase?

我知道存在差异(老实说,我已经开始完全忽略"更新",因为它似乎永远不会做我想要的(这是为了降低其他开发人员最近提供的更改(git pull,svn update))),I只是看不出有什么不同(并且cc文档对此事的帮助不大(奖励积分:任何指向好cc资源的指针(例如类似于svn-book或git手册页))).是的,这是一个句子,半打括注.

version-control clearcase

10
推荐指数
3
解决办法
2万
查看次数

Jquery/Javascript - 如何在视觉上优化我的网站加载?

我正在对我的网站进行最后的修改,并且正在努力使页面的负载看起来不那么紧张.最好的方式向您展示我的意思是显示该网站:http: //marckremers.com/2011(仍未完成,处于alpha阶段)

正如您所看到的,内容粘在左侧,将大量的jquery和图像加载到页面中,然后单击到位(中心).

我想知道是否有一种方法可以让它先点击到位然后加载元素?

我尝试将重新定位脚本放在后面,甚至没有用.

有任何想法吗?谢谢

javascript optimization jquery positioning loading

0
推荐指数
1
解决办法
491
查看次数