问题列表 - 第14676页

WPF双重动画:步骤动画?

在我目前的应用程序中,我有这个小动画.它使画布完全旋转360度并且工作正常.

<DoubleAnimation
 Storyboard.TargetName="WaitCanvas" 
 Storyboard.TargetProperty="(Canvas.RenderTransform).(TransformGroup.Children)[0]  
 .(RotateTransform.Angle)" 
 From="0" To="360" Duration="0:0:2"
 AutoReverse="False" RepeatBehavior="Forever" />
Run Code Online (Sandbox Code Playgroud)

但我想要做的不是平滑的动画,而是动画是每个22.5度的步骤.如何才能做到这一点?

wpf animation

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

如何在 Perl 中比较 md5 校验和?

我正在尝试比较文件的校验和值。一个变量$a具有校验和(md5sum命令的输出,只有十六进制部分)并且相同的值在变量中$b

如果我这样做 ( $a == $b),我会收到一个错误,但如果我这样做,($a eq $b)它会给出不相等的结果。

感谢您的回答,它在修剪空格后在字符串比较中起作用,尽管使用 chomp 不起作用。

perl comparison md5

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

如何将GridView置于其LinearLayout父级中心?

GridView的行为并不像它应该的那样.此屏幕截图显示GridView(在横向模式下)向左刷新.我希望它居中.

这是GridView的XML布局.

<LinearLayout 
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:id="@+id/templatelandscape"
  android:orientation="horizontal"
  android:layout_width="fill_parent" 
  android:layout_height="wrap_content">
<GridView 
  android:id="@+id/commandsbarlandscape"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:layout_weight="1.0"
  android:layout_alignParentTop="true"
  android:layout_centerInParent="true"
  android:padding="0dp"
  android:verticalSpacing="2dp"
  android:horizontalSpacing="2dp"
  android:numColumns="auto_fit"
  android:columnWidth="52dp"
  android:stretchMode="spacingWidth"
  android:gravity="fill_horizontal" />
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

我究竟做错了什么 ?

layout android gridview android-linearlayout

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

mod_rails和Paperclip问题Paperclip :: NotIdentifiedByImageMagickError

我没有将我的应用程序部署到运行带有mod_rails的ubuntu的服务器上.在服务器上运行webrick看起来很好,我可以保存文件,没问题.但是通过nginx运行应用程序,当我尝试保存文件时出现此错误.

[paperclip]处理时收到错误:#[paperclip]处理时收到错误:#R

ruby-on-rails nginx mod-rails paperclip

6
推荐指数
1
解决办法
4875
查看次数

正则表达式命名组问题C#

我正在尝试用C#编写带有命名捕获的正则表达式来解析cron作业.但问题是,使用单引号和括号命名捕获组时,值都返回空白.例如,输入

*/15*****http://www.google.com/

这段代码:

Regex cronRe = new Regex(@"(?<minutes>[\d\*\-,]+) (?<hours>[\d\*\-,]+) (?<days>[\d\*\-,]+) (?<months>[\d\*\-,]+) (?<dotw>[\d\*\-,]+) (?<years>[\d\*\-,]+) (?<command>[\d\*\-,]+)");

//loop through jobs and do them
for (int i = 0; i < lines.Length; i++)
{
    Match line = logRe.Match(lines[i]);
    bool runJob = true;
    for (int j = 0; j < line.Groups.Count; j++)
    {
        Console.Write(j.ToString() + ": " + line.Groups[j].Value + "\n");
    }
    Console.Write("named group minutes: " + line.Groups["minutes"].Value);
}
Run Code Online (Sandbox Code Playgroud)

回来这个:

0:*/15*****http://www.google.com
1:*/15*
2:*3:*
4:*
5:*
6:http://www.google.com
命名组分钟:

有什么建议?

c# regex

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

在Compact Framework中检测"网络电缆未插入"

我已经浏览了所有Stack Overflow答案搜索结果,Google或Bing都没有向我展示任何爱情.我需要知道何时在Windows CE设备上连接或断开网络电缆,最好是从Compact Framework应用程序.

networking compact-framework ndis windows-ce

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

从控制器操作强制下载公共目录中的文件?

我这样做了:

<% response.headers['Content-Disposition'] = "attachment; 
        filename=somefile.txt" -%>

I am a text file!
Run Code Online (Sandbox Code Playgroud)

我想在我的公共文件夹中强制下载文件而不显示路径,所以我有一个控制器而不是检查一些参数来知道我的文件的位置(在我的公共文件夹中)然后我想要强制下载:

<% response.headers['Content-Disposition'] = "attachment; 
        filename=#{@invoice.file_name}" %>

How do I get the file content to be here rather than this text?
Run Code Online (Sandbox Code Playgroud)

有没有办法做到这一点?

ruby-on-rails header

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

更快版本的dec2bin函数用于转换多个元素?

我正在读取位图文件并将每个 RGB值从0到255转换为二进制.

因此240 x 320位图将具有230400个RGB值进行转换.原来的dec2bin函数太慢了,所以我写了自己的函数,因为我知道我的值总是在0到255之间.

但是,通过230400值仍将需要大约.在我的机器上6秒,单色位图大约需要2.3秒.

无论如何,加速到1秒甚至更好的0.5秒,因为我的应用程序每msec计数?

这是我的代码:

function s = dec2bin_2(input)

if input == 255
    s = [1;1;1;1;1;1;1;1];
    return;
end

s = [0;0;0;0;0;0;0;0];

if input == 0
    return;
end

if input >= 128
    input = input - 128;
    s(1) = 1;
    if input == 0
        return;
    end
end

if input >= 64
    input = input - 64;
    s(2) = 1;
    if input == 0
        return;
    end
end

if input >= 32
    input = input - 32;
    s(3) = …
Run Code Online (Sandbox Code Playgroud)

binary matlab

8
推荐指数
1
解决办法
4376
查看次数

当我使用文件句柄处理多行字符串时,如何避免使用Perl :: Critic警告?

有没有人能够解决一次处理多行字符串的任务,除了下面显示的字符串作为文件句柄解决方案?

my $multiline_string = "line one\nline two\nline three\nline four";
my $filehandle;
open( $filehandle, '<', \$multiline_string )
    or croak("Can't open multi-line string as a filehandle: $!");
while ( defined (my $single_line = <$filehandle>) ) {
    # do some processing of $single_line here ...
}
close( $filehandle );
Run Code Online (Sandbox Code Playgroud)

我不想使用文件句柄的原因相当薄弱.Test :: Perl ::当我在任何文件句柄上打开命令和关闭命令之间有超过10个源代码行时,批评者会发牢骚.我正在对$ single_line进行相当多的处理,所以在我的公开通话和近距离通话之间我实际上有大约40行代码,我没有看到任何方法将其降低到10.

而且我真的不想忽略我的构建中的Perl :: Critic测试,因为这实际上是一个不错的测试,我想在我的代码中打开一个实际的磁盘文件时通过它.

perl multiline filehandle perl-critic

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

Apple推送通知 - 注册通知时根本没有收到回叫

我已完成指定的所有步骤,使用启用了APN的开发证书,并调用registerForRemoteNotificationTypes:在我的应用委托中使用正确的标志.

仍然没有应用程序:didRegisterForRemoteNotificationsWithDeviceToken:也没有应用程序:didFailToRegisterForRemoteNotificationsWithError:正在被调用.看起来注册请求只是在运输中卡住了.

我究竟做错了什么?

iphone installation push

6
推荐指数
1
解决办法
2036
查看次数