问题列表 - 第33089页

Rails Paperclip多态风格

我正在使用paperclip为使用accepts_nested_attributes_for的多个模型的附件.有没有办法为每个模型指定特定的回形针样式选项?

ruby-on-rails paperclip

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

如何从QUrl获取"查询字符串"?

我有一个QUrl,我需要提取路径+文件+参数.基本上除了主机名之外的所有内容 - 通过HTTP请求的内容.

我查看了Qt 4.6文档,但我找不到任何看起来会这样做的内容.

我会用什么方法打电话?

qt http qurl

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

将表达式树作为参数传递给另一个表达式树

我有两个表达式树定义如下:

private Expression<Func<TEntity, TPropertyResult>> PropertyAccessor { get; set; }
Run Code Online (Sandbox Code Playgroud)

private Expression<Func<TPropertyResult, bool>> TestExpression { get; set; }
Run Code Online (Sandbox Code Playgroud)

我需要创建一个新的表达式树,它将产生相当于:

var expression = p => this.TestExpression(this.PropertyAccessor(p));
Run Code Online (Sandbox Code Playgroud)

使用时Expression.Invoke(this.TestExpression, this.PropertyAccessor),我收到以下错误

{"类型'System.Func`2 [MyEntity,System.String]'的表达式不能用于'System.String'类型的参数"}

TPropertyResult 我测试时是一个字符串.

我试过用Expression.Call或者Expression.Invoke.没运气.我该怎么用?

c# lambda expression-trees

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

为什么Java中的正则表达式无法将\ s识别为空格字符?

我从很多网页上读到(例如:http://www.wellho.net/regex/java.html),他们都提到它可以代表任何空间字符.但是当我在Java中使用\时,它不是一个合格的表达式.

谁知道原因?

java regex

3
推荐指数
1
解决办法
3878
查看次数

如何计算反向运动学

我想知道如何使用反向运动学计算旋转角度.我打算用它来实时制作3D动画.有人知道一些详细介绍特定解决方案的优秀文献吗?

math 3d computational-geometry inverse-kinematics

34
推荐指数
4
解决办法
4万
查看次数

C++将自定义类型的转换运算符重载为std :: string

我希望有人能够回答为什么以下不起作用.虽然忍受我,我仍然是一个菜鸟......我只是无法深究为什么以下

using namespace std;
#include <string>
#include <iostream>

class testClass
{
public:
 operator char* () {return (char*)"hi";};
 operator int ()  {return 77;};
 operator std::string  () {return "hello";};
};

int main()
{
 char* c;
 int i;
 std::string s = "goodday";

 testClass t;

 c = t;
 i = t;
 s = t;

 cout<< "char: " << c << " int: " << i << " string: "<<s<<endl;

 return 0;
}
Run Code Online (Sandbox Code Playgroud)

给我一个编译时错误:

myMain.cpp: In function ‘int main()’:
myMain.cpp:23: error: ambiguous overload for ‘operator=’ …
Run Code Online (Sandbox Code Playgroud)

c++ overloading operator-keyword

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

WPF按钮isPressed和isEnabled问题

更新:使用Expression Blend 3

我正在尝试为WPF应用程序中的一类按钮设置IsPressed和IsEnabled(false)属性触发器的样式.

这是一个带有Button的UserControl,使用样式...

<UserControl
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    x:Class="Kiosk.ButtonTest"
    x:Name="UserControl">

    <Grid x:Name="LayoutRoot">
        <Button HorizontalAlignment="Left" Style="{DynamicResource BlueButton}" VerticalAlignment="Top" Width="155" Content="Button" Height="52.9"/>
    </Grid>
</UserControl>
Run Code Online (Sandbox Code Playgroud)

这是风格片段......

   <!-- Blue Button -->
   <Style x:Key="BlueButton" TargetType="{x:Type Button}">
    <Style.Triggers>
        <Trigger Property="IsMouseOver" Value="True">
            <Setter Property="Background" Value="{DynamicResource BlueGradient3}"/>
        </Trigger>
        <Trigger Property="IsEnabled" Value="False">
            <Setter Property="Background" Value="{DynamicResource DarkGradient1}"/>
            <Setter Property="BorderBrush" Value="{DynamicResource BlueGradient3}"/>
        </Trigger>
        <Trigger Property="IsPressed" Value="True">
            <Setter Property="Background" Value="{DynamicResource DarkGradient1}"/>
            <Setter Property="BorderBrush" Value="{DynamicResource BlueGradient1}"/>
        </Trigger>
    </Style.Triggers>
    <Setter Property="FocusVisualStyle" Value="{StaticResource ButtonFocusVisual}"/>
    <Setter Property="Background" Value="{DynamicResource BlueGradient1}"/>
    <Setter Property="BorderBrush" Value="{DynamicResource BlueGradient2}"/> …
Run Code Online (Sandbox Code Playgroud)

wpf xaml wpf-controls expression-blend

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

远程主机关闭了连接.错误代码是0x80070057

我在我的一台服务器上的日志中收到了很多这些错误消息,而在其他两台服务器上间歇性地收到了这些错误消息.

谷歌搜索没有透露太多信息,主要与文件上传或下载被中断有关.

我的页面基本上只是带有"ok"的文本文件,其中只有.aspx扩展名用于未来的计划,没有实际的代码为页面供电.服务器都是运行IIS7/ASP.NET 4的Windows Server 2008 RC2 x64.

从统计上来说,它发生在1%的时间内,但由于流量仍然使我的事件日志每分钟有2或3条消息混乱.

编辑:我跟踪了问题,将缓冲设置为true使其停止发生.

asp.net iis-7

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

另一种方法,而不是逃避正则表达式模式?

通常当我的正则表达式模式如下所示:

http://www.microsoft.com/
Run Code Online (Sandbox Code Playgroud)

然后我必须像这样逃避它:

string.match(/http:\/\/www\.microsoft\.com\//)
Run Code Online (Sandbox Code Playgroud)

有没有其他方式而不是像那样逃避它?

我希望能够像http://www.microsoft.com一样使用它,因为我不想逃避所有模式中的所有特殊字符.

ruby regex

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

如何将PATH环境变量设置为指向JRE 1.5版

您好,我有一个程序,要求我将PATH环境变量设置为指向JRE版本1.5,因为我需要通过命令提示符访问该程序.那么关于如何做到这一点的任何想法?

java windows path command-prompt

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