问题列表 - 第49897页

以全屏模式添加MPMoviePlayerController?

我的iPhone应用程序中有一个UIButton,当点击它时,它会播放一部电影.播放电影的代码如下所示:

NSURL *url = [[NSBundle mainBundle] URLForResource:@"Robot" withExtension:@"m4v"];
moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:url];
moviePlayer.controlStyle = MPMovieControlModeDefault;
[moviePlayer.view setFrame: self.view.bounds];
[self.view addSubview: moviePlayer.view];
[moviePlayer play];
Run Code Online (Sandbox Code Playgroud)

我希望电影以全屏模式打开,就像所有电影在iOS 3.2更新之前所做的那样,蓝色的"完成"按钮位于左上角,默认情况下视频以横向模式播放.

有谁知道如何做到这一点?谢谢.

iphone objective-c mpmovieplayercontroller ios4

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

为mvc3 webapplication自动生成规范

我想在我的网站上使用规范网址.我在互联网上阅读了一些关于它的内容,但我正在寻找一种解决方案,它将自动为我的运行时生成规范并将其添加到返回浏览器的html代码中.

我已经在互联网上找到了一个使用属性的例子,但这不是我想要的.使用属性我仍然决定哪个页面应该是规范或不是我自己,我希望每个页面都有一个自动生成的页面.我认为应该有(现有的)解决方案吗?我正在努力寻找一个好的榜样,所以任何帮助都会受到赞赏.

c# asp.net seo asp.net-mvc-3

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

在Intellij的表单中制作一个hello world应用程序

我正试图在Intellij中制作一个hello world form.我已经创建了表单,但现在的问题是在main()中使用什么代码来使表单运行并显示出来?

PS:周围的所有教程似乎只关注"如何在intellij上做表格",而不是"如何实际运行,然后".

谢谢

java ide swing intellij-idea

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

WPF 静态属性绑定不适用于列表视图

我目前正在将一个列表视图绑定到一个对象列表,并且一切正常。

只要我放入我的 Window 元素,我就可以很好地绑定到 xaml 后面的代码 DataContext="{Binding RelativeSource={RelativeSource Self}}"

我的 ListView 看起来像这样,并且我的绑定列与 MyCollection 项目的属性的绑定正常工作。

<ListView ItemsSource="{Binding MyCollection}">
Run Code Online (Sandbox Code Playgroud)

对于其中一个专栏,尽管我总是希望它说同样的话。例如,此列将始终包含“Hello World”

以下代码给了我一个绑定错误:

<GridViewColumn Header="I want all fields to be Hello World" DisplayMemberBinding="{Binding Source={x:Static Member=MyNamespace.MyStaticClass},Path=MyStaticStringField}" />
Run Code Online (Sandbox Code Playgroud)

我收到错误:

错误 MC3050:找不到类型“MyNamespace”。请注意,类型名称区分大小写。

MyNamespace 与窗口本身具有相同的命名空间,并且 MyStaticClass 是公共的

如果我尝试:

<GridViewColumn Header="I want all fields to be Hello World" DisplayMemberBinding="{Binding Source={x:Static Member=MyStaticClass},Path=MyStaticStringField}" />
Run Code Online (Sandbox Code Playgroud)

我收到错误:

错误 MC3029:“MyStaticClass”成员无效,因为它没有合格的类型名称。

奇怪的是,当我这样做时,它起作用了:

<GridViewColumn Header="This works" DisplayMemberBinding="{Binding Source={x:Static Member=SystemFonts.IconFontFamily}, Path=Source}" />
Run Code Online (Sandbox Code Playgroud)

我试图绑定到的字段的代码:

namespace MyNamespace
{
    public static class MyStaticClass
    {
        public static string MyStaticStringField{ get; …
Run Code Online (Sandbox Code Playgroud)

c# data-binding wpf binding

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

C#lambda表达式作为函数参数

我最近一直在忙着研究lambda表达式,并且我有一些特定的功能,我一直想要学习,但似乎无法做出正面或反面.

假设我的代码中有以下逻辑:

List<A> foo; // assuming this is populated
string[] bar = foo.Select<A,string>(x => x.StringProperty).ToArray<string>();
Run Code Online (Sandbox Code Playgroud)

现在,我想将整个操作抽象为一个处理程序方法,以便我可以这样做:

string[] bar = MakeArray<A,string>(foo, x => x.StringProperty);
int[] foobar = MakeArray<A,int>(foo, x => x.IntegerProperty);
Run Code Online (Sandbox Code Playgroud)

如何编写该方法的主体?我预见签名就像:

U[] MakeArray<T,U>( /* some lambda magic? */ ) where T : IEntity {}
Run Code Online (Sandbox Code Playgroud)

但我不知道如何指定我期待一个lambda表达式作为方法参数,以及它如何完全转换为方法的主体.

任何人都可以告诉我如何创建MakeArray()上面的功能?我很确定,一旦我看到它是如何完成的,我就可以从那里拿起它.

编辑

正如评论中指出的那样,MakeArray()需要参考一下IEnumerable<>.更新以反映这一点.

c# generics lambda

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

在mvn exec:exec中传递命令行参数

令我感到惊讶的是,本来应该是一项非常轻松的工作对我来说是一项非常烦人的任务.我需要的是将几个命令行参数传递给我的maven exec:exec插件.不幸的是,几个小时的谷歌搜索根本没有帮助.

这是我的插件

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>exec-maven-plugin</artifactId>
    <version>1.2</version>
    <dependencies>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-instrument</artifactId>
            <version>${spring.version}</version>
        </dependency>
    </dependencies>
    <configuration>
        <executable>java</executable>
        <arguments>
            <argument>-classpath</argument>
            <classpath />
            <argument>-javaagent:${settings.localRepository}/org/springframework/spring-instrument/${spring.version}/spring-instrument-${spring.version}.jar</argument>
            <argument>-Xmx256m</argument>
            <argument>com.myPackage.Myclass</argument>
        </arguments>
    </configuration>
    <executions>
        <execution>
            <goals>
                <goal>exec</goal>
            </goals>
        </execution>
    </executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)

现在从命令提示符我输入

mvn exec:exec -Dexec.args=-Dmy.property=myProperty
Run Code Online (Sandbox Code Playgroud)

我也试过了

mvn exec:exec -Dexec.arguments=-Dmy.property=myProperty
Run Code Online (Sandbox Code Playgroud)

还有很多其他的东西.但似乎没有任何工作.我知道exec:exec运行在一个单独的VM中,但根据文档-Dexec.args应该适合我.有人可以建议我哪里出错了???

maven-plugin

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

如何在jQuery中获取下一个或上一个属性id?

我有以下代码

<a class="getty" id="1" href="/...">One<./a>
<a class="getty" id="2" href="/...">Two<./a> 
<a class="getty" id="3" href="/...">Three<./a>
Run Code Online (Sandbox Code Playgroud)

当我点击左或右时,我需要获取之前的ID.
示例:如果我在id="2",我需要id="1"点击左边.

$(document).keydown(function(e){
    if (e.keyCode == 37) {
       $('.getty').attr("id");
       return false;
    } });
    if (e.keyCode == 33) {
       $('.getty').attr("id");
       return false;
    } 
});
Run Code Online (Sandbox Code Playgroud)

我怎样才能做到这一点 ?

谢谢

javascript ajax jquery attributes jquery-attributes

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

在.net 4.0 wpf应用程序中使用.Net 2.0 dll

我试图在针对.Net 4框架的WPF应用程序中添加对.Net 2.0 DLL的引用.

我添加<startup useLegacyV2RuntimeActivationPolicy="true">到app.config文件中.WPF应用程序构建正常,但在尝试访问.Net 2.0 DLL时在运行时获取BadImageFormatException.

"试图加载格式不正确的程序"

这适用于新的测试WPF项目,但不适用于我的应用程序.我的应用程序使用Entity Framework和MEF.这些技术会导致这个问题吗?

有任何想法吗?

编辑:已解决

根据下面的Alois的评论,我的主要应用程序针对"任何CPU",DLL的目标是32位.

<startup useLegacyV2RuntimeActivationPolicy="true"> 不是必需的

c# clr .net-4.0

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

NullPointerException getDefaultSharedPreferences()

我一直在这行上得到NullPointerException:

SharedPreferences myPreference = PreferenceManager.getDefaultSharedPreferences(this);
Run Code Online (Sandbox Code Playgroud)

我运行了一些东西,我相信我有错误的上下文,因为它在主包的子包中,所以我不认为它可以引用XML首选项文件.我已经在主程序包中的类中使用了这个,没有任何问题,但由于某种原因,这会导致异常.

完整代码:

package schoolBook.Icestone.Expandable;

import schoolBook.Icestone.Days;
import schoolBook.Icestone.Main;
import schoolBook.Icestone.SetPreference;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;

public class Lesson1 extends Lessons {

    public Lesson1(String name) {
        super(name);
        // setGroup(" " + Days.getLessonarray(0) + " ");
        String key = "W" + Main.getWeek() + "_" + SetPreference.xmlday + "_L"
                + SetPreference.xmllesson + "_Lesson";
        System.out.println(key);
        try {
            SharedPreferences myPreference = PreferenceManager
                    .getDefaultSharedPreferences(this);
            String group = myPreference.getString(key, "def");
            setGroup(" " + group + " ");
        } catch (NullPointerException ex) {
            ex.printStackTrace(); …
Run Code Online (Sandbox Code Playgroud)

java android nullpointerexception sharedpreferences

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

为Java程序创建Windows Installer

我是Java初学者.

我已经创建了一个简单的GUI应用程序,显示"hello world"标签.

但是,如何从.java或.jar为Windows创建安装程序.假设我已经创建了一个有用的应用程序,并希望与我的朋友分享它,以便在他们的PC中安装它,而无需知道什么是JRE,或者如何下载JRE.

java deployment installer desktop-application

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