问题列表 - 第40715页

NullReferenceException在C#中未处理

我在第一行评论中采用了这个错误,问题是什么?

private void pictureBox34_Click(object sender, EventArgs e)
{
    if (pictureBox34.Image == chess9.Properties.Resources.siyahsah2)
    {
        f();
    }
}

public void picarray()
{
    pic[0, 0] = pictureBox54;
    pic[0, 1] = pictureBox64;
    pic[0, 2] = pictureBox48;
    pic[0, 3] = pictureBox42;
    pic[0, 4] = pictureBox34;
    pic[0, 5] = pictureBox26;
    pic[0, 6] = pictureBox18;
    pic[0, 7] = pictureBox8;
    pic[1, 0] = pictureBox1;
    pic[1, 1] = pictureBox2;
    pic[1, 2] = pictureBox3;
    pic[1, 3] = pictureBox4;
    ...
}

public void f()
{
    // int i = 0, j …
Run Code Online (Sandbox Code Playgroud)

c# exception-handling winforms

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

如何从资源中获取视图?

我有一个UI,我动态构建它.我想将一些组件放在xml资源文件中.所以我这样做:

<?xml version="1.0" encoding="utf-8"?>
<TextView
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:id="@+android:id/titreItem"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content">
</TextView>
Run Code Online (Sandbox Code Playgroud)

...在res/layout/titreitem.xml我看到的任何地方的文件中.但是我不明白如何将它放到我的UI中.所以,在里面activity.onCreate,我想做的事情如下:

RelativeLayout myBigOne = new RelativeLayout(this);
TextView thingFromXML = [what here ? ];
myBigOne.addView(thingFromXML);
setContentView(myBigOne);
Run Code Online (Sandbox Code Playgroud)

android

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

SQL Server 2008的分页方法?

我必须处理一个可能很大的记录列表,我一直在谷歌搜索避免选择整个列表的方法,而是我想让用户选择一个页面(如1到10)并相应地显示记录.

比方说,对于1000条记录,我将有100页,每页10条记录,最先显示10条记录,如果用户点击第5页,它将显示41到50条记录.

为每条记录添加行号然后根据行号查询是一个好主意吗?有没有更好的方法来实现分页结果而没有太多的开销?到目前为止,这里描述的方法看起来最有希望:

http://developer.berlios.de/docman/display_doc.php?docid=739&group_id=2899

http://www.codeproject.com/KB/aspnet/PagingLarge.aspx

sql sql-server performance pagination

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

Joomla获得插件ID

我写了一个Joomla插件,最终会加载一个库.

库的路径是一个插件参数,因此当路径不正确时,后端会弹出一条消息,以及编辑插件参数的链接:

/administrator/index.php?option=com_plugins&view=plugin&client=site&task=edit&cid[]=36

看到最后的36?这是我的插件在数据库中的id(表jos_plugins).

我的问题是这个id在安装时会发生变化,也就是说,在不同的安装上,这将是另一回事.所以我需要以编程方式找到这个id.

问题是我无法从插件对象本身找到这个id(至于为什么不能,这将是joomla可以说是短视的设计决策).

因此,除非你知道一些巧妙的技巧,(我已经检查并仔细检查了JPlugin和JPluginHelper类),否则我将使用数据库.

编辑; 一些有用的链接:

猜猜我会用最后一个链接的智慧......

php joomla plugins

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

如何从回调中访问闭包变量

我循环遍历一系列网址.每个人从不同的域中获取一些jsonp数据.成功处理程序需要能够访问原始循环中的数据,但是当从回调调用时,它始终是最后一个值,而不是调用ajax函数时设置的值.如何访问或将此值传递给回调?

for(var site in data.sites){
    var domain =  data.sites[site].domain;
    $('#site-logout').append('<div class="processing" id="' + domain.replace(".","-") + '"><strong>' + domain + '</strong> is logging out.');
    $.getJSON(url, function(data){
        if(data.success == true)
            $("#" +  domain.replace(".","-")).removeClass("processing").addClass("processed").html('<strong>' + domain + '</strong> has logged out.');
        else
            $("#" +  site.domain.replace(".","-")).removeClass("processing").addClass("error").text('<strong><a href="http://' + domain + '">' + domain + '</a></strong> has failed to log out. Follow the link to try manually.');
    });
}
Run Code Online (Sandbox Code Playgroud)

javascript jquery

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

php substr删除?

我的数据库中有一个游戏ip,如下所示: "271.29.248.23:27912"

我希望子字符串取最后5个数字" 27912",我也想删除它":".这可能,有人可以帮助我吗?

如果可能的话,我希望数字是这样的,这样会更容易......

$ip = "271.29.248.23";
$port = "27912";
Run Code Online (Sandbox Code Playgroud)

请帮助我,我需要这个脚本:(

php string numbers substring substr

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

有没有更快的方法将任意大整数转换为大端字节序列?

我有这个Python代码来做到这一点:

from struct import pack as _pack

def packl(lnum, pad = 1):
    if lnum < 0:
        raise RangeError("Cannot use packl to convert a negative integer "
                         "to a string.")
    count = 0
    l = []
    while lnum > 0:
        l.append(lnum & 0xffffffffffffffffL)
        count += 1
        lnum >>= 64
    if count <= 0:
        return '\0' * pad
    elif pad >= 8:
        lens = 8 * count % pad
        pad = ((lens != 0) and (pad - lens)) or 0
        l.append('>' + …
Run Code Online (Sandbox Code Playgroud)

python optimization

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

无法找到入口点 (cpp)

这是一个类似的问题这一个

我想从 C++ 导出一个简单的函数,由 C# 通过 PInvoke 调用。这是我的函数定义:

 int fnValue()
{
    return 42;
}
Run Code Online (Sandbox Code Playgroud)

这是.h文件中的导出定义:

__declspec(dllexport)  int fnValue();
Run Code Online (Sandbox Code Playgroud)

这就是我 PInvoke 函数的方式:

    [DllImport("WhatDll.dll")]
    public static extern int fnValue();
Run Code Online (Sandbox Code Playgroud)

很简单吧?但我得到了一个

System.EntryPointNotFoundException:无法在 DLL“WhatDll.dll”中找到名为“fnValue”的入口点

我使用 dumpbin 检查里面WhatDll有什么,这就是我所拥有的:

00000000 特征 4CFB5C95 时间日期戳 Sun Dec 05 17:34:13 2010 0.00 版本 1 序数基数 4 函数数 4 名称数

序数提示 RVA 名称

   1    2 00011014 ?fnValue@@YAHXZ = @ILT+15(?fnValue@@YAHXZ)
Run Code Online (Sandbox Code Playgroud)

请注意,函数名称后面有一些乱码fnValue

这很令人费解。任何的想法?

.net c++ interop

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

在Objective-C中操作字符串

我有一个10个字符的NSString.我需要添加一个破折号 - 在角色位置4和8.最有效的方法是什么?谢谢

iphone cocoa-touch objective-c nsstring

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

将鼠标悬停在列表上时如何更改锚点颜色

我有以下HTML和CSS.

当我将鼠标悬停在列表上时,我想要更改背景颜色和字体颜色.但是,当我将鼠标悬停在列表的填充上,边框上或列表内的边框附近时,我的样式不会改变.

http://jsfiddle.net/Hbf9D/1/

我该怎么做?

#nav li{
    display: inline;
    text-align: center;
    list-style-type:none;
    background-color:#1A365B;
    margin: 0 6px 0 0;
    padding: 2px 11px 4px 11px;

    -webkit-border-radius: 8px;
    -moz-border-radius: 8px;
    border-radius: 8px;
}

#nav li:hover{
    background-color:#E0F1EA;
    border: 2px solid #000;
    color: #000000;
    padding: 0 9px 2px 9px;
}

#nav li a:hover{
    color: #000000;
}

#nav li a{
    text-decoration: none;
    color: #ffffff;
    font-weight:bold;
    font-family: 'CantarellBold', Arial, sans-serif;
    text-transform: capitalize;
    font-size: 12px;
}

<ul id="nav" class="grid_16">
    <li><a href="#">FORSIDE</a></li>
    <li><a href="#">MOBIL</a></li>
    <li><a href="#">PC OG SERVERE</a></li>
    <li><a href="#">TJENESTER</a></li> …
Run Code Online (Sandbox Code Playgroud)

css hover

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