问题列表 - 第24062页

重构以下两个C++方法以移出重复的代码

我有以下两种方法(如你所见)在大多数语句中都是类似的,除了一种(详见下文)

unsigned int CSWX::getLineParameters(const SURFACE & surface, vector<double> & params)
{
    VARIANT varParams;

    surface->getPlaneParams(varParams); // this is the line of code that is different

    SafeDoubleArray sdParams(varParams);

    for( int i = 0 ;  i < sdParams.getSize() ; ++i )
    {
        params.push_back(sdParams[i]);
    }

    if( params.size() > 0 ) return 0;
    return 1;
}

unsigned int CSWX::getPlaneParameters(const CURVE & curve, vector<double> & params)
{
    VARIANT varParams;

    curve->get_LineParams(varParams); // this is the line of code that is different

    SafeDoubleArray sdParams(varParams);

    for( int i = …
Run Code Online (Sandbox Code Playgroud)

c++ refactoring

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

如何删除主要功能的头部?

我试图从一个单独的二进制文件移动一些代码,并将其放在我的主程序中.不幸的是我无法模仿main函数的初始化变量.

如何创建argcargv手?有人可以给我一些示例作业.

因为它看起来像这样:

int main(int argc, char *argv[])
Run Code Online (Sandbox Code Playgroud)

我想我可以像这样分配它们:

int argc=1;
char *argv[0]="Example";
Run Code Online (Sandbox Code Playgroud)

但它不起作用.谁能告诉我这是怎么做到的?

c program-entry-point function

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

iPhone 应用程序启动时间指南

请向我指出 iPhone 应用程序启动时间指南。

我看到有大约 24 秒的硬限制。如果应用程序在那个时间没有启动,操作系统会杀死应用程序并显示以下消息:

com.bundle.id failed to launch in time

还有一篇关于这个的QA 文章。(24 秒是我手机上的操作系统杀死应用程序的时间。)

但我认为文档中的某个地方应该有一个更短的软限制。但是,我无法找到它。

iphone launch-time

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

有没有人使用过EnergyPlus仿真软件?

http://apps1.eere.energy.gov/buildings/energyplus/

我正在研究这个软件,我想知道:

  1. 有多少人真的知道如何使用这个软件?如果你这样做,请表明你自己.
  2. 有多少公司正在使用它来进行节能模拟?请列出你知道的任何内容.
  3. 它是否可以与GUI环境集成?有没有人有实施集成的经验?

欢迎任何回应.谢谢.

architecture

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

document.getElementByID - 检查是否已找到元素

这是一个示例代码,它打开一个 Internet Explorer 窗口,导航到 google,并通过其唯一 id 获取页面上的某些元素:

set ie = CreateObject("InternetExplorer.Application")

ie.navigate("www.google.com")
ie.visible = true

while ie.readystate <> 4
    wscript.sleep 100
WEnd

set some_object = ie.document.getelementbyid("xjsc")

MsgBox some_object.tagname, 0
Run Code Online (Sandbox Code Playgroud)

这个示例给我带来了一个DIV弹出窗口,我完全满意。

但是在下一步中,我想检查页面中是否存在某个 id。不幸的是,我不能只是,就像,

set some_object = ie.document.getelementbyid("some_non_existant_id")
if some_object.tagname = "" then
...
Run Code Online (Sandbox Code Playgroud)

因为它给了我以下错误:

ie.vbs(12, 1) Microsoft VBScript runtime error: Object required: 'some_object'
Run Code Online (Sandbox Code Playgroud)

那么,检查是否已找到元素的最佳做法是什么?

html vbscript scripting dom

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

指针类型不兼容

我有以下签名的功能:

void box_sort(int**, int, int)
Run Code Online (Sandbox Code Playgroud)

和以下类型的变量:

int boxes[MAX_BOXES][MAX_DIMENSIONALITY+1]
Run Code Online (Sandbox Code Playgroud)

当我调用该函数时

box_sort(boxes, a, b)
Run Code Online (Sandbox Code Playgroud)

海湾合作委员会给了我两个警告:

103.c:79: warning: passing argument 1 of ‘box_sort’ from incompatible pointer type (string where i am calling the function)
103.c:42: note: expected ‘int **’ but argument is of type ‘int (*)[11] (string where the function is defined)
Run Code Online (Sandbox Code Playgroud)

问题是为什么?int x [] []和int**x(实际上是int*x [])是不是C中的相同类型?

c gcc

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

将私有API放在.m文件和Cocoa中的.h文件中的公共API是一种好习惯吗?

我当前项目中的许多类都有几个属性和方法,只能从类本身中调用.此外,他们可能会根据班级的当前状态搞乱班级的工作.
目前,所有这些接口都在.h文件的主接口声明中定义.将"私有"方法和属性放在.m文件的顶部是不错的做法?

这不会影响任何事情,因为我很可能是唯一一个看过这个源代码的人,但当然知道未来的项目会很有趣.

cocoa implementation private interface

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

jQuery对话框中的CKEditor实例

我正在使用jQuery打开一个对话框窗口,其中textarea转换为CKEditor的实例.我使用的是由CKEditor的团队提供的jQuery的适配器,但是当对话窗口打开了,我不能与编辑器进行交互(它的创建,但"空"是写在内容空间,我可以不点击任何东西,或修改内容).

这个错误报告似乎说通过使用补丁提供问题是固定的,但它似乎并没有为我工作...

这是我的代码(也许我以编程方式做错了):

HTML:

<div id="ad_div" title="Analyse documentaire">
<textarea id="ad_content" name="ad_content"></textarea>
</div>
Run Code Online (Sandbox Code Playgroud)

我的包括(所有内容都包含正确,但也许包括订单问题?):

<script type="text/javascript" src="includes/ckeditor/ckeditor.js"></script>
<link rel="stylesheet" type="text/css" href="includes/jquery/css/custom-theme/jquery-ui-1.7.2.custom.css" />
<script type="text/javascript" src="includes/jquery/js/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="includes/jquery/js/jquery-ui-1.7.2.custom.min.js"></script>
<script type="text/javascript" src="includes/jquery/plugins/dialog-patch.js"></script>
<script type="text/javascript" src="includes/ckeditor/adapters/jquery.js"></script>
Run Code Online (Sandbox Code Playgroud)

使用Javascript:

$('#ad_content').ckeditor();

/* snip */

$('#ad_div').dialog(
{
    modal: true,
    resizable: false,
    draggable: false,
    position: ['center','center'],
    width: 600,
    height: 500,
    hide: 'slide',
    show: 'slide',
    closeOnEscape: true,
    autoOpen: false
});

$('.analyse_cell').click(function(){
    $('#ad_div').dialog('open');
});
Run Code Online (Sandbox Code Playgroud)

编辑:经过一些进一步的测试后,我注意到按下工具栏按钮给了我这个错误:

错误:this.document.getWindow().$未定义源文件:includes/ckeditor/ckeditor.js行:82

jquery ckeditor jquery-dialog

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

列出当前为复制MS-SQL发布的所有表

我需要获取从MS-SQL数据库发布以进行复制的所有表的列表.是否有系统存储过程或我可以运行的查询来生成这样的列表?

t-sql sql-server replication publish-subscribe

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

App对象中的Log4Net?

我开始使用Log4Net作为日志记录组件登录WPF桌面应用程序.这是我的问题:在一个简单的桌面应用程序中,有没有理由不将我的记录器实例化为App类(App.xaml.cs)的属性,就像这样?

public partial class App : Application
{
        private static readonly ILog p_Logger = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);

        public ILog Logger
        {
            get { return p_Logger; }
        }

        #endregion
    }
}
Run Code Online (Sandbox Code Playgroud)

这将允许我调用记录器

wpf log4net

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