小编il_*_*uru的帖子

Java如何通过原始类型作为参数的反射来调用方法

我在类中有以下两种方法:

public void Test(int i){
    System.out.println("1");
}
public void Test(Integer i){
    System.out.println("2");
}
Run Code Online (Sandbox Code Playgroud)

以下代码行

this.getClass().getMethod("Test",Integer.class).invoke(this, 10);
Run Code Online (Sandbox Code Playgroud)

打印2,如何打印1

java reflection

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

使用NSArray指定otherButtonTitles?

UIAlertSheet的构造函数将otherButtonTitles参数作为varg列表.我想指定NSArray中的其他按钮标题.这可能吗?

即我必须这样做:

id alert = [[UIActionSheet alloc] initWithTitle: titleString
                                  delegate: self
                                  cancelButtonTitle: cancelString
                                  destructiveButtonTitle: nil
                                  otherButtonTitles: button1Title, button2Title, nil];
Run Code Online (Sandbox Code Playgroud)

但由于我在运行时生成可用按钮列表,我真的想要这样的东西:

id alert = [[UIActionSheet alloc] initWithTitle: titleString
                                       delegate: self
                              cancelButtonTitle: cancelString
                         destructiveButtonTitle: nil
                              otherButtonTitles: otherButtonTitles];
Run Code Online (Sandbox Code Playgroud)

现在,我想我需要单独拨打一个initWithTitle:项目,2个项目和3个项目.像这样:

if ( [titles count] == 1 ) {
     alert = [[UIActionSheet alloc] initWithTitle: titleString
                                         delegate: self
                                cancelButtonTitle: cancelString
                           destructiveButtonTitle: nil
                                otherButtonTitles: [titles objectAtIndex: 0], nil];
} else if ( [titles count] == 2) {
     alert = [[UIActionSheet alloc] initWithTitle: titleString
                                         delegate: self …
Run Code Online (Sandbox Code Playgroud)

iphone nsarray uialertsheet

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

Postgres FK引用复合PK

考虑

CREATE TABLE foo (
    id SERIAL,
    foo_created_on ABSTIME,
    foo_deactivated_on ABSTIME,
    PRIMARY KEY (id, foo_created_on)
);

CREATE TABLE bar (
    id SERIAL,
    bar_created_on ABSTIME,
    bar_deactivated_on ABSTIME,
    foo_id REFERENCES ( .. what goes here? ..),
    PRIMARY KEY (id, bar_created_on)
);
Run Code Online (Sandbox Code Playgroud)

如何在"bar"中创建引用"foo"中的PK的FK?

postgresql

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

Android应用程序包在手机上安装在哪里

我在手机上安装了一个Android应用程序,我在java上创建了自己的应用程序.该应用程序已成功安装在设备上,但我无法找到已安装的软件包.

如何找到已安装应用程序的路径?

installation android path

27
推荐指数
3
解决办法
12万
查看次数

如何获取结果集的最后一行中所有列值的总和?

我需要获取最后一行中结果集的所有列值的总和.
这是我的SQL查询.

select Master_Code, SUM(Jan), SUM(Feb), SUM(Mar)
from dbo.foobar
WHERE Participating_City = 'foofoo'
GROUP BY Master_Code ORDER BY Master_Code ASC
Run Code Online (Sandbox Code Playgroud)

这样的事情:

    Master_Code Jan Feb Mar 
    1            4   5   6
    2            5   5   5
    Total        9  10  11
Run Code Online (Sandbox Code Playgroud)

sql sql-server sql-server-2005

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

使用unique_ptr移动语义

我正在使用Visual Studio 2012 Update 2,并且无法理解为什么std :: vector正在尝试使用unique_ptr的复制构造函数.我已经看过类似的问题,大多数都与没有明确的移动构造函数和/或运算符有关.

如果我将成员变量更改为字符串,我可以验证是否调用了移动构造函数; 但是,尝试使用unique_ptr会导致编译错误:

error C2248: 'std::unique_ptr<_Ty>::unique_ptr' : cannot access private member declared in class 'std::unique_ptr<_Ty>'.

我希望有人能指出我所缺少的东西,谢谢!

#include <vector>
#include <string>
#include <memory>

class MyObject
{
public:
    MyObject() : ptr(std::unique_ptr<int>(new int))
    {
    }

    MyObject(MyObject&& other) : ptr(std::move(other.ptr))
    {
    }

    MyObject& operator=(MyObject&& other)
    {
        ptr = std::move(other.ptr);
        return *this;
    }

private:
    std::unique_ptr<int> ptr;
};

int main(int argc, char* argv[])
{
    std::vector<MyObject> s;
    for (int i = 0; i < 5; ++i)
    {
        MyObject o;
        s.push_back(o); …
Run Code Online (Sandbox Code Playgroud)

c++ visual-c++ move-semantics c++11 visual-studio-2012

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

Android in-app Billing意外回复

我正在尝试实现Android的In app billing Dungeon项目.

当我尝试购买我输入的物品时,我会继续:

06-04 10:37:33.343:E/Volley(1913):[228] BasicNetwork.performRequest:https ://android.clients.google.com/fdfe/completePurchase 06-04 10:37的意外响应代码500 : 33.343:W/Finsky(1913):[1] CheckoutPurchase.onErrorResponse:DisplayErrorMessage [您的订单无法处理.请再试一次.] 06-04 10:37:33.343:E/Finsky(1913):[1] CheckoutPurchase.setError:type = UNKNOWN,code = -1,message =您的订单无法处理.请再试一次.

我在应用内商品中设置了商品并发布了它们

我签署了应用程序并将已签名的应用程序上传到Google Play并通过adb上传到设备. - 同样的错误我试图发布应用程序然后将其下载到设备 - 同样的错误

按"接受并购买"后错误弹出

我的想法是它可能与我的Google商家帐户有关,任何想法?

谢谢,

android billing in-app merchant-account

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

使用SP_SEND_DBMAIL向所有收件人发送重复电子邮件的存储过程

我有一个每晚运行的存储过程,它应该将查询结果发送给几个收件人.但是在大多数日子里,它最终会在一分钟后发送重复的电子邮件.我使用的代码如下(所有电子邮件和数据库引用都已更改):

EXEC msdb.dbo.sp_send_dbmail
@recipients = 'email1@email.com',
@copy_recipients = 'email2@email.com;email3@email.com;email4@email.com',
@subject = 'Example Email',
@profile_name = 'ExampleProfile',
@query = 'SELECT name
    FROM table
    WHERE date BETWEEN (getdate() - 1) AND getdate()',
@attach_query_result_as_file = 1
Run Code Online (Sandbox Code Playgroud)

任何有关这方面的帮助将不胜感激.

sql sql-server email sp-send-dbmail duplicates

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

如何使用Microsoft Speech从语音模式识别扬声器?

我正在使用Microsoft Speech C#API进行家庭自动化命令

我想知道是否有一种方法或内置的C#方法来散列语音输入并识别谁在说话.如果是Alice或Bob说"Hello Alice"或"Hello Bob".

编辑:

Microsoft Speech API可以提供录制的.wav.它可能能够哈希,处理,...以了解谁在说话:

  • 响亮的声音,缓慢的调制,... =>鲍勃
  • 高声音,快速调制,... =>爱丽丝

c# speech

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

通过PHP将分层.ai转换为PDF

我有一个包含2个图层组的.ai文件,我想将它们管道化为带有图层的.pdf文件.我已经尝试过ImageMagick,但我无法获得选择器.我试过这个:

exec("convert 'test.ai[0]' output0.png");
exec("convert 'test.ai[1]' output1.png");
Run Code Online (Sandbox Code Playgroud)

第一个给了我整个文件.为了更快地预览内容,我尝试了.png.任何人都知道如何处理这个?PDF文件将包含更多信息,然后是.ai.友好的问候凯文

php pdf pdf-generation adobe-illustrator imagick

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