问题列表 - 第24444页

UIAlertView在未记录的方法上崩溃

由于一个难以捉摸的错误,我们的应用程序以大约每1,500个发布一次的频率崩溃.包括堆栈跟踪的相关部分.它被作为回调被解雇,所以我没有参考它在我自己的代码中发生的位置.

看起来正在发生的是有一个UIViewAnimationState对象正在调用UIAlertView'sprivate method(_popoutAnimationDidStop:finished:).唯一的问题是,看来UIAlertView已经被这一点解除了分配.我不会对警报视图做任何奇怪的事情.我把它们扔了,我等待用户输入.它们在被释放之前都被展示出来.

谁遇到过这个?在这一点上,我倾向于它是一个苹果虫.

Thread 0 Crashed:
0   libobjc.A.dylib                 0x3138cec0 objc_msgSend + 24
1   UIKit                           0x326258c4 -[UIAlertView(Private) _popoutAnimationDidStop:finished:]
2   UIKit                           0x324fad70 -[UIViewAnimationState sendDelegateAnimationDidStop:finished:]
3   UIKit                           0x324fac08 -[UIViewAnimationState animationDidStop:finished:]
4   QuartzCore                      0x311db05c run_animation_cal
Run Code Online (Sandbox Code Playgroud)

lbacks

iphone crash cocoa-touch uialertview

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

VB6中的多态行为

我最近注意到VB6中的CallByName关键字.

由于这需要一个对象,过程名称,"调用类型"和参数数组,这可以用来"伪造"某些类型的多态行为吗?

我可以创建2个类,A类和B类,每个类都使用相同的方法Foo,并执行:

Dim list As New Collection
Dim instanceA As New ClassA
Dim instanceB As New ClassB
Dim current As Object

Call list.Add(instanceA)
Call list.Add(instanceB)

For Each current in list
  Call CallByName(current, "methodName", vbMethod)
Next
Run Code Online (Sandbox Code Playgroud)

有人这样做过吗?问题?可怕的想法或天才的想法?启示?意想不到的后果?

oop vb6 polymorphism

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

将grails app转换为插件

我通过grails create-app开始了grails应用程序.对于模块化,我觉得组件成为一个插件会更好.我可以将此应用程序转换为grails插件吗?谢谢,巴布.

grails plugins

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

为什么给我一个SQL语法错误?

你知道为什么我得到这个:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '``, `title` varchar(255) collate latin1_general_ci NOT NULL default ``,' at line 3
Run Code Online (Sandbox Code Playgroud)

代码是这样的(部分我有问题......)

$sql = 'CREATE TABLE `forum` (
                        `postid` bigint(20) NOT NULL auto_increment,
                        `author` varchar(255) collate latin1_general_ci NOT NULL default ``,
                        `title` varchar(255) collate latin1_general_ci NOT NULL default ``,
                        `post` mediumtext collate latin1_general_ci NOT NULL,
                        `showtime` varchar(255) collate latin1_general_ci NOT NULL default ``, …
Run Code Online (Sandbox Code Playgroud)

php mysql sql mysql-error-1064

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

用于选择元素选择的 Javascript 事件

我正在寻找我需要放入 jQuery.bind函数的 Javascript 事件,以便在从<select>元素中进行选择时触发该函数。

目前我正在使用,.bind('change',function() { ...})但我需要在再次选择所选选项时触发事件。

有什么建议?

html javascript jquery events

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

擦除绑定到Winforms表单的对象的所有属性值?

在C#Winforms(3.5)应用程序中,我添加了一个类,其中包含许多属性(get/set),用于存储来自12个表单长的进程的值.

在表单12之后,我想清除存储类中的所有属性值,以便下一个用户在表单1启动进程时不会意外记录值.

是否可以擦除/销毁/处置类中的所有属性值?

我的班级看起来像这样:

private static int battery;
public int Battery
{
    get { return storeInspectionValues.battery; }
    set { storeInspectionValues.battery = value; }
}
Run Code Online (Sandbox Code Playgroud)

c# properties winforms

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

用Guice注入泛型

我正在尝试迁移一个小项目,用Guice替换一些工厂(这是我的第一个Guice试验).但是,在尝试注射仿制药时,我陷入困境.我设法提取了一个带有两个类和一个模块的小玩具示例:

import com.google.inject.Inject;

public class Console<T> {
  private final StringOutput<T> out;
  @Inject
  public Console(StringOutput<T> out) {
    this.out = out;
  }
  public void print(T t) {
    System.out.println(out.converter(t));
  }
}

public class StringOutput<T> {
  public String converter(T t) {
    return t.toString();
  }
}

import com.google.inject.AbstractModule;
import com.google.inject.Guice;
import com.google.inject.Injector;
import com.google.inject.TypeLiteral;


public class MyModule extends AbstractModule {

  @Override
  protected void configure() {
    bind(StringOutput.class);
    bind(Console.class);
  }

  public static void main(String[] args) {
    Injector injector = Guice.createInjector( new MyModule() );
    StringOutput<Integer> out = injector.getInstance(StringOutput.class); …
Run Code Online (Sandbox Code Playgroud)

java dependency-injection guice

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

PHP文本格式化:检测连续的几个符号

我有一种奇怪的事情,我真的需要我的文本格式化.不要问我为什么我做了这个奇怪的事情!;-)

所以,我的PHP脚本用一个像"|"这样的特殊符号替换所有行折叠"\n".当我将文本数据插入数据库时​​,PHP脚本用符号"|"替换所有行折叠 当脚本从数据库中读取文本数据时,它将替换所有特殊符号"|" 用折叠线"\n".

如果在每个分隔文本中使用超过2行折叠,我想限制文本格式以剪切行折叠.

以下是我希望脚本格式化的文本示例:

this is text... this is text... this is text...this is text...this is text... this is text... this is text... this is text... this is text... this is text...

this is text... this is text... this is text... this is text... this is text... this is text... this is text... this is text... this is text... this is text...
Run Code Online (Sandbox Code Playgroud)

我想重写格式,如:

this is text... this is text... this is text...this is text...this is text... this is …
Run Code Online (Sandbox Code Playgroud)

php formatting line folding str-replace

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

使用C#迭代具有相同名称的表单字段

我有一个表单的一部分,我需要处理不同于其他表单结果.在需要特殊处理的部分中,我需要迭代3个具有相同名称的表单字段.它们必须具有相同的名称,我无法改变它.我所指的表单部分看起来像这样:

<td><input name="Color" size="20" value="" type="text"></td>
<td><input name="Color" size="20" value="" type="text"></td>
<td><input name="Color" size="20" value="" type="text"></td>
Run Code Online (Sandbox Code Playgroud)

使用C#我尝试这样的事情:

我尝试像这样处理它:

int i;

for (i = 1; i <= Request.Form["Color"][i]; i++)
{
    colorName.Text += Request.Form["Color"];
}
Run Code Online (Sandbox Code Playgroud)

这导致以下异常:

System.NullReferenceException: Object reference not set to an instance of an object.

我该如何处理具有相同名称的表单字段?

c# forms asp.net webforms request

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

覆盖Rails Paperclip插件的content_type

我想我有一点鸡蛋和鸡蛋的问题.我想设置通过Paperclip上传的文件的content_type.问题是默认的content_type只基于扩展,但我想将它建立在另一个模块上.

我似乎能够使用before_post_process设置content_type

class Upload < ActiveRecord::Base 
  has_attached_file :upload
  before_post_process :foo

  def foo
    logger.debug "Changing content_type"

    #This works
    self.upload.instance_write(:content_type,"foobar")

    # This fails because the file does not actually exist yet
    self.upload.instance_write(:content_type,file_type(self.upload.path)
  end

  # Returns the filetype based on file command (assume it works)
  def file_type(path)
    return `file -ib '#{path}'`.split(/;/)[0]
  end
end
Run Code Online (Sandbox Code Playgroud)

但是......我不能将内容类型基于文件,因为Paperclip直到after_create才写入文件.

并且我似乎无法在保存后使用content_type或使用after_create回调(甚至回到控制器中)

所以我想知道在保存之前我是否可以以某种方式访问​​实际的文件对象(假设没有处理器对原始文件做任何事情),这样我就可以在其上运行file_type命令.或者有一种方法可以在创建对象后修改content_type.

content-type ruby-on-rails paperclip

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