小编CRA*_*OLO的帖子

NSUnknownKeyException setValue:forUndefinedKey:

因未捕获的异常'NSUnknownKeyException'而终止应用程序,原因:'[setValue:forUndefinedKey:]:此类不是键值按钮,符号键为buttonOfFirstView."

为什么我会收到此错误?我试图通过XIB制作一个表格单元格.添加此代码后,它会抛出上述异常.

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{

    static NSString *CellIdentifier = @"MyCell";

    MyTableViewCell *cell = (MyTableViewCell*) [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

    if (cell == nil) {

        NSArray *arrayCellXib = [[NSBundle mainBundle] loadNibNamed:@"MyTableViewCell" 
                                                              owner:self 
                                                            options:nil];

....
} 
.....

return cell;
}
Run Code Online (Sandbox Code Playgroud)

怎么解决?

iphone uitableview nsexception ios5

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

成功重定向并在失败时显示错误

我已经实现了一个控制器来创建新用户.当它成功创建用户时,它会重定向到Index().

我想要的是在一切正常时重定向,但留在当前页面并在出现故障时看到错误.

我使用的是jQuery ajaxMVC.

我的控制器看起来像这样:

[Authorize]
public ActionResult CreateUser(string username)
{
    try
    {
        //here the logic to create the user
    }   
    catch (Exception ex)
    {
        string error = string.Format("Error creating user: {0}", ex.Message);
        Response.StatusCode = 500;
        Response.Write(error);    
    }
    return RedirectToAction("Index");
}
Run Code Online (Sandbox Code Playgroud)

使用jQuery拦截表单提交,然后使用ajax进行调用:

$("#new-user-form").submit(function() {
    var form = $(this);
    $.ajax({
    type: "GET",
        url: form.attr('action'),
        data: form.serialize(),
        success: function(data, textStatus, xhr) {
            //At this point I would like to redirect
        },
        error: …
Run Code Online (Sandbox Code Playgroud)

ajax asp.net-mvc jquery asp.net-mvc-2

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

在画布中使用javascript获取鼠标位置

我正在研究jquery和html5画布.我想做的只是一个简单的html5绘图示例.当鼠标移动时,我在鼠标下面画出红色方块.

我的代码很简单,但是在画布中获取鼠标光标位置时遇到了问题.

现在,我正在使用x = event.offsetX; 获得鼠标位置.这在chrome中非常有效,但是当涉及到firefox时,它不起作用.我将代码更改为x = event.layerX.但似乎layerX是我的鼠标相对于网页的位置,而不是画布的位置.因为我总是看到一个偏移.

我有两个问题,首先,在Firefox下获得正确的鼠标位置是正确的.第二,我怎样才能编写适用于firefox,chrome,safari和opera的代码?

这是我的代码:

 <!doctype html />
<html><head>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
  $(document).ready(
 function(){

var flip = document.getElementById('flip');
    var context = flip.getContext('2d');   
context.fillStyle = "rgb(255,255,255)";   
context.fillRect(0, 0, 500, 500);

      $("a").click(function(event){alert("Thanks for visiting!");});
   $("#flip").mousemove(function(event){
      var x, y;


    x = event.layerX;
    y = event.layerY;


    //alert("mouse pos"+event.layerX );
    var flip = document.getElementById('flip');
    var context = flip.getContext('2d');   
context.fillStyle = "rgb(255,0,0)";   
context.fillRect(x, y, 5, 5);
    }
   );
  }
  );    
  </script>
  </head>  <body bgcolor="#000000"> <a href="http://jquery.com/">jQuery</a><canvas id="flip" width="500" height="500"> …
Run Code Online (Sandbox Code Playgroud)

javascript html5 canvas

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

有没有在iOS SDK 4.3中使用Xcode 3的方法?

我在iOS 4.3上使用Xcode 4.Xcode 4非常缺陷,更不用说改变了很多东西.最让我烦恼的变化是热键,我甚至找不到以合适的方式定制它们的方法.我喜欢使用Xcode 3,因为它稳定,它可以满足我的需求.无论如何在iOS 4.3中使用Xcode 3?

iphone sdk xcode ios

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

为什么我在mdi子窗口上有额外的关闭按钮?

我遇到了一个奇怪的问题.我的mdi子窗体有2个关闭按钮和2个最大化按钮.

问题的截图:

在此输入图像描述

我像这样创建mdi孩子:

 summaryForm.MdiParent = ContainerForm;  
 summaryForm.WindowState = FormWindowState.Maximized;  
 summaryForm.Show();
Run Code Online (Sandbox Code Playgroud)

如果我摆脱"summaryForm.WindowState = FormWindowState.Maximized;",窗口样式是正确的.但我希望在创建时使mdi子窗体最大化.

c# winforms

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

NHibernate 3.2通过代码进行多对多映射

我正在努力学习NHibernate 3.2 built-in mapping by code api(不是 FluentNHibernate,也不是xml).你能帮我勾画出这些实体之间的多对多关系吗?

public class Post {
    public virtual Id { get; set; }
    public IList<Tag> Tags { get; set; }
}

public class Tag {
    public virtual Id { get; set; }
    public IList<Post> Posts { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

我的主要关键策略是:

Id( 
    t => t.Id, 
    t => { 
        t.Generator(Generators.HighLow, g => g.Params(new { max_low = 100 })); 
        t.Column(typeof(TEntity).Name + "Id"); 
    });
Run Code Online (Sandbox Code Playgroud)

我试试这个:

// TagMap : ClassMapping<Tag>
Bag(t => t.Posts, bag => …
Run Code Online (Sandbox Code Playgroud)

mapping nhibernate many-to-many nhibernate-3 nhibernate-mapping-by-code

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

IE 8:Object不支持属性或方法'getElementsByClassName'

我正在使用diapo滑块,除了Internet Explorer 8之外,它似乎适用于所有其他浏览器.

在调试模式下运行ie8后,我收到以下错误:

SCRIPT438:Object不支持属性或方法'getElementsByClassName'prototype.js,5988行5

return function(className, parentElement) {
    return $(parentElement || document.body).getElementsByClassName(className);
  };
Run Code Online (Sandbox Code Playgroud)

SCRIPT438:Object不支持属性或方法'fireEvent'prototype.js,第5736行第7行

if (document.createEvent)
      element.dispatchEvent(event);
    else
      element.fireEvent(event.eventType, event);

    return Event.extend(event);
Run Code Online (Sandbox Code Playgroud)

我在magento平台上运行这个滑块,看起来那个原型脚本有问题.它使用的原型版本是1.7,因此排除了脚本更新的可能修复.

注意:虽然,我在ie9中没有显示问题,但是我收到以下错误:

SCRIPT438:Object不支持属性或方法'dispatchEvent'prototype.js,第5734行character 7

if (document.createEvent)
      element.dispatchEvent(event);
    else
      element.fireEvent(event.eventType, event);

    return Event.extend(event);
Run Code Online (Sandbox Code Playgroud)

这些是diapo滑块工作所需的脚本,在头文件中加载了脚本标记.我不确定,但是这些脚本中的一些可能与现有脚本冲突:

<script type='text/javascript' src='http://www.pixedelic.com/plugins/diapo/scripts/jquery.min.js'></script>
<script type='text/javascript' src='http://www.pixedelic.com/plugins/diapo/jquery.mobile-1.0rc2.customized.min.js'></script>
<script type='text/javascript' src='http://www.pixedelic.com/plugins/diapo/jquery.easing.1.3.js'></script>
<script type='text/javascript' src='http://www.pixedelic.com/plugins/diapo/jquery.hoverIntent.minified.js'></script>
<script type='text/javascript' src='http://www.pixedelic.com/plugins/diapo/scripts/diapo.js'></script>
Run Code Online (Sandbox Code Playgroud)

error-handling internet-explorer slider prototypejs

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

将选项传递给chrome驱动程序selenium

我试图禁用输出到控制台的chrome.如果我通过--start-maximized选项,它可以正常工作.我可能有错误的命令?

DesiredCapabilities capabilities = DesiredCapabilities.chrome();
capabilities.setCapability("chrome.switches", Arrays.asList("--silent"));
chrome = new ChromeDriver(_chromeservice,capabilities);
Run Code Online (Sandbox Code Playgroud)

我也试过了

 ChromeOptions options = new ChromeOptions();
 options.addArguments("silent");
 chrome = new ChromeDriver(options);
Run Code Online (Sandbox Code Playgroud)

产量

已启动ChromeDriver port = 26703 version = 23.0.1240.0 log =/Brett/workspace/TestNG/chromedriver.log [1214/161331:ERROR:ipc_sync_channel.cc(378)]取消待处理的发送[1214/161331:错误:ipc_sync_channel.cc( 378)]取消待处理的发送[1214/161331:错误:ipc_sync_channel.cc(378)]取消挂起的sentBlockquote

java selenium webdriver selenium-chromedriver

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

在BxSlider Carousel中垂直居中对齐div

我正在使用bxslider脚本来构建旋转木马.我可以做得很好,我只是试图对齐以垂直居中放置幻灯片,因为它们没有相同的高度.我已经尝试了很多对齐技术,但是当bxslider正在运行时似乎都失败了.这是一个jsfiddle例子.

目前在示例中我设置了一个非常简单的CSS规则,该规则在未设置轮播时有效:

.bxslider-inner {
   vertical-align: middle;
    display: inline-block;
} 
Run Code Online (Sandbox Code Playgroud)

但是,正如您在jsfiddle中看到的那样,当轮播处于活动状态时,垂直对齐不再起作用.

我开始怀疑我可能必须更改脚本的核心代码才能实现这一点.

css jquery carousel bxslider

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

0x800a139e - JavaScript运行时错误:SyntaxError

我是Visual Studio Express 2012 for Windows 8的新手.

我已经能够得到一个简单的应用程序工作得很好,但它会抛出相同的"例外".

所以为了测试,我刚刚开始了一个全新的空白JavaScript项目,只是在default.html中链接了jQuery代码,并运行了调试器,但仍然抛出以下异常:

Exception was thrown at line 1217, column 4 in ms-appx://xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx/Scripts/jquery-2.1.1.js
0x800a139e - JavaScript runtime error: SyntaxError
Exception was thrown at line 1235, column 4 in ms-appx://xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx/Scripts/jquery-2.1.1.js
0x800a139e - JavaScript runtime error: SyntaxError
Run Code Online (Sandbox Code Playgroud)

如何编辑jQuery代码或我需要做些什么来摆脱抛出此异常?

jQuery代码中抛出第一个异常的部分:

assert(function (div) {
    // Support: Windows 8 Native Apps
    // The type and name attributes are restricted during .innerHTML assignment
    var input = doc.createElement("input");
    input.setAttribute("type", "hidden");
    div.appendChild(input).setAttribute("name", "D");

    // Support: IE8
    // Enforce case-sensitivity of name attribute …
Run Code Online (Sandbox Code Playgroud)

jquery windows-8 visual-studio-2012

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