问题列表 - 第43106页

MPMoviePlayerContentPreloadDidFinishNotification似乎比MPMoviePlayerLoadStateDidChangeNotification更可靠

我将小型电影(1-3MB)从我的网站流式传输到我的iPhone应用程序中.我有一个slicehost网络服务器,我认为这是一个"500MB切片".我不确定这会如何转化为带宽,但我可以在以后解决这个问题.

我对MPMoviePlayerLoadStateDidChangeNotification的体验不是很好.使用旧的MPMoviePlayerContentPreloadDidFinishNotification,我获得了更可靠的结果

如果我得到一个MPMoviePlayerContentPreloadDidFinishNotification,电影将播放没有口吃,但如果我使用MPMoviePlayerLoadStateDidChangeNotification,电影经常停止.

我不确定检查哪种加载状态:

枚举{MPMovieLoadStateUnknown = 0,MPMovieLoadStatePlayable = 1 << 0,MPMovieLoadStatePlaythroughOK = 1 << 1,MPMovieLoadStateStalled = 1 << 2,};

MPMovieLoadStatePlaythroughOK似乎是我想要的(基于文档中的描述):

MPMovieLoadStatePlaythroughOK
  Enough data has been buffered for playback to continue uninterrupted.
  Available in iOS 3.2 and later.
Run Code Online (Sandbox Code Playgroud)

但是在我的应用中,负载状态永远不会设置为此状态.

我错过了什么吗?有一个更好的方法吗?

mpmovieplayercontroller video-streaming mpmovieplayer ios4

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

更新Magento特价

在"特价至今"传递给null之后,我试图恢复"特价".所以基本上当我使用这段代码以编程方式更新我的产品的特价时:

$todayDate  = Mage::app()->getLocale()->date()->toString(Varien_Date::DATETIME_INTERNAL_FORMAT);

$collection = Mage::getModel('catalog/product')->getCollection()
        ->addStoreFilter()
        ->addAttributeToFilter('special_price', array('gt' => 0))
        ->addAttributeToFilter('special_to_date', array('date' => true, 'to' => $todayDate));
echo "Total products found : ".count($collection);
foreach ($collection as $product)
{
        $product->setSpecialPrice(null)
        ->setSpecialFromDate(null)
        ->setSpecialToDate(null)
        ->save();
}

echo "<br/> Done!";
Run Code Online (Sandbox Code Playgroud)

但在我将特价更新为null后,magento产品向导不允许我为我的产品设置新的特价.当我保存表格时,它不会给我任何错误,也不会影响特价的任何变化,它仍然是空的!怎么了?!

php magento e-commerce

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

有没有更好的方法在Pyramid中切换HTML和JSON输出?

# /test{.format} no longer seems to work...
config.add_route('test', '/test.{ext}', view='ms.views.test')
Run Code Online (Sandbox Code Playgroud)

views.py:

from pyramid.response import Response
from pyramid.renderers import render

import json

def test(request):
    extension = request.matchdict['ext']
    variables = {'name' : 'blah', 'asd' : 'sdf'}

    if extension == 'html':
        output = render('mypackage:templates/blah.pt', variables, request=request)

    if extension == 'json':
        output = json.dumps(variables)

    return Response(output)
Run Code Online (Sandbox Code Playgroud)

有更简单的方法吗?有了Pylons,它很简单:

def test(self, format='html'):
    c.variables = {'a' : '1', 'b' : '2'}

    if format == 'json':
        return json.dumps(c.variables)

    return render('/templates/blah.html')
Run Code Online (Sandbox Code Playgroud)

我怀疑我接近这个错误的方式......?

python api pylons pyramid

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

如何删除Mysql中的空行?

我有一个包含超过100000个数据元素的表,但其中有近350个空白行.如何使用phpmyadmin删除此空白行?手动删除是一项繁琐的工作.

mysql sql phpmyadmin delete-row sql-delete

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

如何在我将应用程序提交到商店之前,从同一个应用程序中链接到我的应用程序的iTunes页面?

我有一个应用程序.我要把它提交给商店.在那个应用程序中,我有一个按钮,应该转到同一个应用程序的iTunes页面.我想应该有一种方法可以使用app bundle或plist或者其他东西来做到这一点.

  1. 如果我能做到,我该怎么做?
  2. 即使在提交到商店之前,是否可以在iTunes中获取应用程序的链接?

谢谢..

iphone

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

我使用GWT RPC时出错

当我使用RPC时,我遇到了Eclipse的问题.如果我使用单个方法调用它的方向正确,但如果我添加一个新方法来处理服务器,我会收到以下错误:

com.google.gwt.core.client.JavaScriptException: (null): null
    at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:237)
    at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:126)
    at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561)
    at com.google.gwt.dev.shell.ModuleSpace.invokeNativeBoolean(ModuleSpace.java:184)
    at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeBoolean(JavaScriptHost.java:35)
    at com.google.gwt.user.client.rpc.impl.RpcStatsContext.isStatsAvailable(RpcStatsContext.java)
    at com.google.gwt.user.client.rpc.impl.RequestCallbackAdapter.onResponseReceived(RequestCallbackAdapter.java:221)
    at com.google.gwt.http.client.Request.fireOnResponseReceived(Request.java:287)
    at com.google.gwt.http.client.RequestBuilder$1.onReadyStateChange(RequestBuilder.java:395)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
    at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
    at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:157)
    at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:326)
    at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:207)
    at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:126)
    at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561)
    at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:269)
    at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
    at com.google.gwt.core.client.impl.Impl.apply(Impl.java)
    at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:214)
    at sun.reflect.GeneratedMethodAccessor13.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
    at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
    at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:157)
    at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:281)
    at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:531)
    at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:352)
    at java.lang.Thread.run(Thread.java:619)
Run Code Online (Sandbox Code Playgroud)

我可以在异步调用中获得更多服务吗?我哪里错了?

这是我的实现MyService:

package de.vogella.gwt.helloworld.client;

import com.google.gwt.user.client.rpc.RemoteService; …
Run Code Online (Sandbox Code Playgroud)

gwt gwt-rpc asynccallback

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

自动释放在线程中创建的对象并在objective-C中传递给另一个对象

我有一个对象的方法,它创建对象,然后传递给另一个线程中的另一个对象的方法,如下所示:

MyClass* myClass = [[MyClass alloc] init];
[anotherClass performSelectorOnMainThread:@selector(method) withObject:myClass waitUntilDone:NO];
Run Code Online (Sandbox Code Playgroud)

在方法中,我立即保留该对象,假设它将以某种方式由创建者释放.我的问题是:如何让MyClass正确发布该对象?这是正确的方法吗?

我的解决方案是在方法中手动释放对象.无论如何,我看到泄漏分析仪仍然认为这是泄漏,似乎它不是Apple推荐的,因为所有者有责任释放对象.

你能解释一下处理这种情况的正确方法吗?谢谢!

cocoa-touch objective-c autorelease nsautoreleasepool ios4

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

在UITableView中编辑模式

所以我已经实现了

- (BOOL)tableView:(UITableView *)tableView
canEditRowAtIndexPath:(NSIndexPath *)indexPath
Run Code Online (Sandbox Code Playgroud)

- (void)tableView:(UITableView *)tableView
commitEditingStyle:(UITableViewCellEditingStyle)editingStyle
forRowAtIndexPath:(NSIndexPath *)indexPath
Run Code Online (Sandbox Code Playgroud)

但是我将如何触发将tableview切换到编辑模式的东西?与单击编辑时iphone中的消息一样,将显示删除图标.这可能听起来非常基本,但我对此毫无头绪并且有点紧急,任何线索都将受到赞赏,谢谢.

iphone objective-c uitableview iphone-sdk-3.0

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

是否有更有效的方法来随机化一组LINQ结果?

我已经生成了一个函数来取回一组随机的提交,具体取决于传递给它的数量,但是我担心即使它在大量数据传递时现在只使用少量数据,它也会变得很有效率.引起问题.

有更好的方法来做以下事情吗?

    public List<Submission> GetRandomWinners(int id)
    {
        List<Submission> submissions = new List<Submission>();
        int amount = (DbContext().Competitions
                     .Where(s => s.CompetitionId == id).FirstOrDefault()).NumberWinners;

        for (int i = 1 ; i <= amount; i++)
        {
            bool added = false;
            while (!added)
            {
                bool found = false;

                var randSubmissions = DbContext().Submissions
                    .Where(s => s.CompetitionId == id && s.CorrectAnswer).ToList();

                int count = randSubmissions.Count();
                int index = new Random().Next(count);

                foreach (var sub in submissions)
                {
                    if (sub == randSubmissions.Skip(index).FirstOrDefault())
                        found = true;
                }

                if (!found)
                { …
Run Code Online (Sandbox Code Playgroud)

c# linq random

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

定位jquery ui对话框

如何相对于body内的div元素定位jquery ui对话框?

javascript jquery user-interface

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