问题列表 - 第22292页

是否可以在UITableView完成滚动时收到通知?

我引用了这个问题:如何检测UIScrollView何时完成滚动

UITablewView是UIScrollView的子类,当我手动滚动表时,我的UITableView委托确实收到了- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView消息.

但是,当我打电话- (void)scrollToRowAtIndexPath:(NSIndexPath *)indexPath atScrollPosition:(UITableViewScrollPosition)scrollPosition animated:(BOOL)animated滚动表格时,我没有收到scrollViewDidEndDecelerating消息.我正在调用scrollRowToIndexPath...方法animated:YES.

这是一个错误/ API限制(在iPhone SDK 3.1.3上)还是我错过了另一种方法来做到这一点?

iphone cocoa-touch

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

在Greasemonkey中自动登录?

我正在尝试使用Greasemonkey进行自动登录.
谁能帮我?

相关的HTML源代码:

<div id="login-main">
  <div id="login-container">
    <div id="login-left">
      <div id="welcome">Welcome</div>
      <form id="login-form" action="auth/login" method="post">
        <div>
          <label for="rememberme">Remember me</label>
          <input type="checkbox" class="remember" checked="checked" name="remember me"/>

          <label for="email" id="email-label" class="no-js">Email</label>
          <input id="email-email" type="text" name="handle" value="" autocomplete="off"/>

          <label for="combination" id="combo-label" class="no-js">Combination</label>
          <input id="password-clear" type="text" value="Combination" autocomplete="off"/>

          <input id="password-password" type="password" name="password" value="" autocomplete="off"/>
          <input id="sumbitLogin" class="signin" type="submit" value="Sign In"/>
        </div>
      </form>
Run Code Online (Sandbox Code Playgroud)

javascript greasemonkey

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

有没有办法减少ostringstream malloc/free?

我正在写一个嵌入式应用程序.在某些地方,我经常使用std :: ostringstream,因为它对我来说非常方便.但是,我刚刚发现性能受到了极大的影响,因为向流中添加数据会导致大量调用malloc和free.有什么办法可以避免吗?

我的第一个想法是使ostringstream静态并使用ostringstream :: set("")重置它.但是,由于我需要函数可重入,因此无法完成此操作.

c++ memory stl stringstream ostringstream

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

在Android中将16位pcm音频下采样到8位

我想将16位pcm音频下采样到8位,然后在android中将8位上采样到16位.我正在使用这似乎工作:

int tempint;
for (int i=1, j=0; i<tempBuffer.length; i+=2, j++)
{
    tempint = ((int) tempBuffer[i]) ^ 0x00000080;
    tempBuffer[j] = (byte) tempint; 
    Log.e("test","------------* COUNTER -> "+j+" BUFFER VALUE -> "+tempBuffer[j]+"*-----------");
} 
Run Code Online (Sandbox Code Playgroud)

其中tempbuffer是short [],tempint是int.任何人都可以告诉我,如果这是正常的,因为我是一个启动器,我也使用它将字节[]转换回短[]

for (int x=1, j=0; x<music.length; x+=2, j++)
{
    tempint = ((int) music[x])& 0xFF;
    music[j] = tempint.shortValue();
    Log.e("maxsap","------------*"+ music[j]+"*-----------");
}
Run Code Online (Sandbox Code Playgroud)

我不确定它是否有效.

audio android pcm

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

从ColdFusion调用jQuery

是否可以在ColdFusion switch语句中调用jQuery函数?如果是这样,怎么样?

coldfusion jquery

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

自定义Java启动屏幕"冻结",直到整个应用程序加载完毕

我有一个程序,需要很长时间才能加载.因此,我想开发一个启动画面,可以向用户提供有关正在加载的内容的反馈.一个简单的JFrame,带有图像,标签和JProgressBar.

我一直在进行实验,并且在我的工作中取得了最好的成绩main():

SwingUtilities.invokeAndWait(new Runnable() {

    public void run() {

        new SplashScreen();
    }
});

SwingUtilities.invokeAndWait(new Runnable() {

    public void run() {

        //Code to start system
        new MainFrame();
        //.. etc
    }
});
Run Code Online (Sandbox Code Playgroud)

SplashScreen和MainFrame都是扩展JFrame的类.我也使用Substance作为图书馆.

SplashScreen的构造函数将JLabel和JProgressBar添加到自身,包和集可见.JProgressBar是setIndeterminate(true);

当我运行我的程序时,我的SplashScreen会显示但ProgressBar会被锁定,它不会移动,直到程序的其余部分启动它才会按预期开始移动.

我在这里错过了什么?我所做的所有搜索似乎都没有提到这个问题,大多数"自定义启动画面"实现与我自己的方式非常类似.

java swing splash-screen

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

如何使用C#SMTP客户端进行Domainkeys/DKIM电子邮件签名?

我用C#编写了一个发送电子邮件的程序.现在我需要使用Dominkeys/DKIM签署出站电子邮件,但我不知道该怎么做.

我已经设置了所有密钥,但我不知道如何将它们和hwo包含在电子邮件标题中.

c# email smtp domainkeys dkim

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

是否可以访问css生成的内容:在规则之前?

我正在尝试使用html5和css计数器对文档中的数字进行编号.图编号css正在工作,但我需要能够生成包含图号的交叉引用.

有没有办法通过javascript访问这些值?我使用的计数器代码是:

body { counter-reset: section; }
section { counter-reset: figure;
          counter-increment: section; }
section section { counter-reset: section; }
section > h1:before { content: counters(section, '.'); }
.figure > .caption:before {
  counter-increment: figure;
  content: 'Figure ' counters(section, '.') '-' counter(figure); }
section > h1:before, .figure > .caption:before { margin-right: .5em; }
Run Code Online (Sandbox Code Playgroud)

javascript css

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

Java容器是否提供故障安全迭代器

这是我的问题:

这段代码抛出一个java.util.ConcurrentModificationException,因为在Vector listeners存在Iterator这个数据结构时会被修改.java-doc说这个容器只提供一个快速失败的迭代器.

如果在"生命" 期间删除了一个元素,是否有可能获得Iterator像Java VectorListJava那样的标准容器Iterator,它不会失效(不是快速失败)Iterator

我应该像std::list在C++中一样具有相同的行为.即使删除了当前的迭代器,迭代器也始终有效.比迭代器设置为列表中的下一个元素.

public class ClientHandle {
private final Vector<ClientHandleListener> listeners = new Vector<ClientHandleListener>();


public synchronized void  addListener(ClientHandleListener chl) {
    listeners.add(chl);
}

public synchronized void  removeListener(ClientHandleListener chl) {
    listeners.remove(chl); 
}

private void fireConnectionClosed() {
    final ClientHandle c = this;

    final Iterator<ClientHandleListener> it = listeners.iterator();
    new Thread(){
        @Override
        public void run() {
            while (it.hasNext()) {
                it.next().connectionClosed(c); //FIXME the iterator gets …
Run Code Online (Sandbox Code Playgroud)

java iterator fail-fast

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

Ninject.Web.PageBase仍导致对注入依赖项的null引用

我有一个使用Ninject 2.0的ASP.NET 3.5 WebForms应用程序.但是,尝试使用Ninject.Web扩展来向System.Web.UI.Page提供注入,即使我切换到使用服务定位器来提供引用,我也会得到对我注入的依赖项的空引用(使用Ninject ),没有问题.

我的配置(为简单而愚蠢):

public partial class Default : PageBase // which is Ninject.Web.PageBase
{
    [Inject]
    public IClubRepository Repository { get; set; }

    protected void Page_Load(object sender, EventArgs e)
    {
        var something = Repository.GetById(1); // results in null reference exception.
    }
 }
Run Code Online (Sandbox Code Playgroud)

... //global.asax.cs

public class Global : Ninject.Web.NinjectHttpApplication
{
    /// <summary>
    /// Creates a Ninject kernel that will be used to inject objects.
    /// </summary>
    /// <returns>
    /// The created kernel.
    /// </returns>
    protected override IKernel CreateKernel() …
Run Code Online (Sandbox Code Playgroud)

asp.net webforms ninject

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