问题列表 - 第28705页

在windows上的virtualenv中安装psycopg2(postgresql)

我在virtualenv中安装了psycopg2 easy_install psycopg2.我没有看到任何错误,看起来安装很顺利..有一个鸡蛋文件在site-packages目录中为psycopg2创建..

但是当我在解释器中运行import psycopg2时,我得到了以下错误..任何线索?我该如何解决..在virtualenv中安装psycopg2的任何其他方法..

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "build\bdist.win32\egg\psycopg2\__init__.py", line 69, in <module>
  File "build\bdist.win32\egg\psycopg2\_psycopg.py", line 7, in <module>
  File "build\bdist.win32\egg\psycopg2\_psycopg.py", line 6, in __bootstrap__
Run Code Online (Sandbox Code Playgroud)

谢谢.

python postgresql psycopg2 virtualenv easy-install

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

帮助Linq表达式 - INotifyPropertyChanged

我正在阅读最新的Prism 4 drop的源代码,我有兴趣解决这个问题.ViewModels有一个基类,它实现了INotifyPropertyChanged和INotifyDataErrorInfo,并提供了一些重构友好的更改通知.

protected void RaisePropertyChanged<T>(Expression<Func<T>> propertyExpresssion)
{
    var propertyName = ExtractPropertyName(propertyExpresssion);
    this.RaisePropertyChanged(propertyName);
}



private string ExtractPropertyName<T>(Expression<Func<T>> propertyExpresssion)
{
    if (propertyExpresssion == null)
    {
        throw new ArgumentNullException("propertyExpression");
    }

    var memberExpression = propertyExpresssion.Body as MemberExpression;
    if (memberExpression == null)
    {
        throw new ArgumentException("The expression is not a member access expression.", "propertyExpression");
    }

    var property = memberExpression.Member as PropertyInfo;
    if (property == null)
    {
        throw new ArgumentException("The member access expression does not access  property.","propertyExpression");
    }

    if (!property.DeclaringType.IsAssignableFrom(this.GetType()))
    {
       throw new ArgumentException("The referenced …
Run Code Online (Sandbox Code Playgroud)

linq data-binding mvvm

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

jQuery图像悬停颜色叠加

我似乎无法在互联网上的任何地方找到任何这方面的例子,但这是我要尝试做的事情......我正在努力寻找最简洁的方法来解决这个问题.

所以我有一个图像库,图像都是不同的大小.我想这样做,当你鼠标悬停在图像上时,它会变成橙色.只是一个简单的悬停效果.

我想在不使用图像交换的情况下执行此操作,否则我必须为每个单独的图库图像创建橙色悬停图像,我希望它更具动态性.

我的计划只是在图像上放置一个空div,背景颜色,宽度和高度100%,不透明度为0.然后使用jquery,在鼠标悬停时我将不透明度淡化为0.3左右,然后淡化为鼠标输出为零.

我的问题是,布局html和css以最有效和干净地完成这项工作的最佳方法是什么.

这是一个简短但不完整的设置:

<li>
  <a href="#">
    <div class="hover">&nbsp;</div>
    <img src="images/galerry_image.png" />
  </a>
</li>

.hover {
width: 100%;
height: 100%;
background: orange;
opacity: 0;
}
Run Code Online (Sandbox Code Playgroud)

html javascript css jquery hover

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

什么:编译器命令在Vim中做什么?

我最近发现Vim中有一个叫做编译器的命令.您可以使用任何常见的编译器(例如,:编译器gcc,:编译器php等)调用它,但它似乎没有立即生效.

我搜索了联机帮助页,但没有发现它实际上有什么用处,Vim Wiki也没有.有谁知道那个命令实际上做了什么?

vim command compilation

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

HTML5标签在firefox 3.6.3中根本不起作用

好的,所以我试图进入整个HTML 5的事情,本教程(http://www.webreference.com/authoring/languages/html/HTML5/)说这些标签应该在没有任何内容的情况下移动内容什么样的CSS,但我得到的只是一行文字,如下所示:

 Header tag   Nav tag    Artical Section tags    Aside tag   footer tag  
Run Code Online (Sandbox Code Playgroud)

这是代码:

<!DOCTYPE html>
<html lang="en">
    <head>
        <title>HTML5 test1</title>
        <meta charset="utf-8" />
    </head>

    <body> 
        <header>
            Header tag
        </header> 

        <nav>
            Nav tag
        </nav> 

        <article> 
            <section> 
                Artical Section tags
            </section> 
        </article>

        <aside>
            Aside tag
        </aside> 

        <footer>
            footer tag
        </footer> 
    </body>  
</html>
Run Code Online (Sandbox Code Playgroud)

html html5

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

尝试排除执行递归副本的某些扩展(MSBuild)

我正在尝试使用MSBuild从文本文件中读取文件列表,然后执行递归复制,将这些目录文件的内容复制到某个临时区域,同时排除某些扩展名(例如.tmp文件)

我已经设法使用CreateItem和MSBuild复制任务轻松完成上述大部分任务,无论我做什么,CreateItem任务都忽略了我的Exclude参数:

<PropertyGroup>
  <RootFolder>c:\temp</RootFolder>
  <ExcludeFilter>*.tmp</ExcludeFilter>
  <StagingDirectory>staging</StagingDirectory>
</PropertyGroup>
<ItemGroup>
  <InputFile Include="MyFile.txt" />
</ItemGroup>

<Target Name="Build">
  <ReadLinesFromFile File="@(InputFile)">
    <Output ItemName="AllFolders" TaskParameter="Lines" />
  </ReadLinesFromFile>

  <CreateItem Include="$(RootFolder)\%(AllFolders.RelativeDir)**"
              Exclude="$(ExcludeFilter)">
    <Output ItemName="AllFiles" TaskParameter="Include" />
  </CreateItem>

  <Copy SourceFiles="@(AllFiles)"
        DestinationFolder="$(StagingDirectory)\%(RecursiveDir)" 
Run Code Online (Sandbox Code Playgroud)

'MyFile.txt'的示例内容:

somedirectory\
someotherdirectory\
Run Code Online (Sandbox Code Playgroud)

(即路径是相对的$(RootFolder)- 提到这个,因为我读到某个地方可能是相关的)

我已经尝试了大量不同的Exclude过滤器组合,但我似乎无法让它正确排除我的.tmp文件 - 有没有办法用MSBuild做这个而不诉诸xcopy?

msbuild createitem

16
推荐指数
1
解决办法
9138
查看次数

为什么string.maketrans在Python 3.1中不起作用?

我是一个Python新手.

为什么在Python 3.1中不起作用?

from string import maketrans   # Required to call maketrans function.

intab = "aeiou"
outtab = "12345"
trantab = maketrans(intab, outtab)

str = "this is string example....wow!!!";
print str.translate(trantab);
Run Code Online (Sandbox Code Playgroud)

当我执行上面的代码时,我得到以下代码:

Traceback (most recent call last):
  File "<pyshell#119>", line 1, in <module>
    transtab = maketrans(intab, outtab)
  File "/Library/Frameworks/Python.framework/Versions/3.1/lib/python3.1/string.py", line 60, in maketrans
    raise TypeError("maketrans arguments must be bytes objects")
TypeError: maketrans arguments must be bytes objects
Run Code Online (Sandbox Code Playgroud)

"必须是字节对象"是什么意思?如果有可能,有人可以帮助发布Python 3.1的工作代码吗?

python python-3.x

18
推荐指数
5
解决办法
5万
查看次数

使用jQuery ajax响应数据

我正在使用ajax帖子并以html的形式接收数据.我需要分割数据并在整个页面上放置数据.我建立了我的响应数据,<p id='greeting'> Hello there and Welcome </p> <p id='something'>First timer visiting our site eh'</p>它有点复杂和动态,但如果得到这个问题,我可以弄明白.谢谢

$.ajax({
            type:'POST',
            url: 'confirm.php',
            data: "really=yes&sure=yes",
            success:function(data){
                    //Need to split data here
            }
        });
Run Code Online (Sandbox Code Playgroud)

jquery

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

在scala中处理csv

我正在使用scala 2.7.7,并希望解析CSV文件并将数据存储在SQLite数据库中.

我最终使用OpenCSV java库来解析CSV文件,并使用sqlitejdbc库.

使用这些java库使我的scala代码看起来几乎与Java代码相同(没有分号和val/var)

由于我正在处理java对象,我不能使用scala list,map等,除非我做scala2java转换或升级到scala 2.8

有没有办法可以使用我不知道的scala位进一步简化我的代码?

val filename = "file.csv";
val reader = new CSVReader(new FileReader(filename))
var aLine = new Array[String](10)
var lastSymbol = ""
while( (aLine = reader.readNext()) != null ) {
    if( aLine != null ) {
        val symbol = aLine(0)
        if( !symbol.equals(lastSymbol)) { 
            try {
                val rs = stat.executeQuery("select name from sqlite_master where name='" + symbol + "';" )
                if( !rs.next() ) {
                    stat.executeUpdate("drop table if exists '" + symbol + "';")
                    stat.executeUpdate("create table …
Run Code Online (Sandbox Code Playgroud)

java sqlite scala

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

在可选参数中设置DateTime的默认值

如何在可选参数中设置DateTime的默认值?

public SomeClassInit(Guid docId, DateTime addedOn = DateTime.Now???)
{
    //Init codes here
}
Run Code Online (Sandbox Code Playgroud)

c# datetime default optional-parameters

80
推荐指数
5
解决办法
7万
查看次数