问题标签 [construction]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
c - 如何优雅地构造在 C 中遍历数组的长参数列表
我有一个接受可变参数的 C 函数,我需要用很长的参数列表调用它,其中所有参数都遍历数组的元素。例子:
其中 N 通常为 100-200。
我宁愿不必每次使 N 变大时都手动构建此调用,并开始思考,有没有一种优雅的方法来做到这一点?
我试过类似的东西:
但这当然失败了。然而,它更受欢迎的是,每当我使 N 变大时,我可以简单地一遍又一遍地复制同一行,而不必确保每个数组索引都是正确的,这非常乏味。
更改 myFunction() 不是一种选择。
我希望 C 有一种即时构造函数调用的方法,例如:
这正是我想要的,但当然这不是一个选择。
有什么更容易或更优雅的吗?
非常感谢。
javascript - Javascript Under Construction page ip redirect?
I am trying to create a site that when I am editing it the user will be redirected because its not on my ip. I have already created a script that should work but don't could someone please give me some pointers?
Javascript:
This script should detect if the user is me by my IP, but if its not redirect the user to the under construction page! I also understand that you can do this in .htaccess but I am using dropbox for the main part of my hosting so I can't do it.
Any help would be appreciated thanks :-)
linux - ./configure--with-boost 没有这样的文件或目录
当我使用 ./configure 时,终端返回:
检查 Boost 标头版本 >= 1.41.0 ... 没有配置:错误:找不到 Boost 标头版本 >= 1.41.0
所以我也使用了命令“./configure-with-boost=/usr/include”,但它只返回
没有这样的文件或目录
我已将最新版本的 Boost 标头提取到 /usr/include
c++ - 什么是 int() 调用?
原始类型没有构造函数已经被一遍又一遍地重新散列。例如_bar
,当我调用时,它没有初始化为 0 Foo()
:
所以显然int()
不是构造函数。但它叫什么名字?
在这个例子中,我想说i
的是:(构造?初始化?吃错了?)
Loki Astari在这里提到该技术有某种名称。
编辑回应迈克西摩:
在 Visual Studio 2013 上运行此代码会产生:
3382592
3382592
有趣的是 gcc 4.8.1 的产量:
134514651
0
c# - 如何在不同的类上使用相同的属性和方法?
我有 3 个类,例如 ClassVersion1、ClassVersion2 和 ClassVariables。ClassVariables 用于从 Form 中到达其他类的变量。
我认为是这些;
但是我必须将函数和变量调用到 if 条件中(两个具有相同名称的对象,不同的类)。我想将对象创建为条件并使用条件。
我怎样才能做到这一点?
c++ - 函数调用中的临时构造被解释为声明
最近我遇到了一个问题,它以某种方式(但仅以某种方式)对我有意义。它基于将临时构造解释为单个 (!) 构造函数参数的声明。请看下面的最小示例。
我已经读过这样的表达:
被解释为(如果有标准构造函数)作为 a 的声明。这是有道理的,而且完全没问题,因为您可以使用 {} 括号来明确构造。但我不明白的是:
为什么bar0的构造会出现问题?所有
Foo
s 都没有标准构造函数。因此,将诸如Foo0(x)
声明之类的内容解释为x
.为什么建设
bar1
和bar2
工作?对我来说,作品的构造是显而易见的bar4
,因为我对所有临时 s 使用 {}-括号Foo
,因此我明确说明了我想要什么。如果只需要使用只有一个
Foo
s 的 {} 括号来解决问题......为什么构造bar3
失败?此外,在构造任何 Bar 之前声明 x。为什么编译器不抱怨呢?
最后一个问题与我的最后一行示例代码有关。长话短说:编译器认为我想让他做什么,我在哪里错过了阴影的出现?
PS:如果有兴趣——我使用 gcc-4.9.2。
PPS:我尝试了相同bar
的构造函数,将三个Foo0
s 作为参数。同样的故事在这里。但是该错误没有说明冲突的声明,而是重新定义x
.
php - HTML 选定值 If 语句 PHP
我正计划制作一个具有以下功能的网站:http ://www.hwcompare.com/category/gpu/
而且我无法根据用户选择的值整理代码以显示我想要的图片、一些文本和一些基准。
HTML 代码:
和我的 PHP 代码:
我希望我的 PHP 能够像.. 一样工作。例如: if (option value = 'R7 240') { display R7 240 image + R7 240 specification }
optaplanner - I am getting 'Local Search phase started with an uninitialized Solution' when I run on a larger dataset
I am developing a solver using Optaplanner 6.1.0, similar to the Vehicle Routing Problem. When I run my solver on 700 installers and 200 bookings, it will successfully solve the planning problem. But, when I used against a larger dataset (700 installers and 1220 bookings), I get
Caused by: java.lang.IllegalStateException: Local Search phase started with an uninitialized Solution. First initialize the Solution. For example, run a Construction Heuristic phase first.
but right before the exception,
16:10:40,378 INFO [DefaultConstructionHeuristicPhase] [http-listener-1(4)] Construction Heuristic phase (0) ended: step total (194), time spent (30693), best score (-1hard/-688803soft).
I am using <constructionHeuristicType>FIRST_FIT_DECREASING</constructionHeuristicType>
in my config.
Am I using it wrong?
c++ - 递归地传递一个字符串而不进行重新创建
我在这里回答了一个问题:https ://stackoverflow.com/a/28862668/2642059我需要使用循环来逐步完成string
. 我想const string&
在每个函数上使用 a 作为我的参数,但除非我想在每次递归时重建字符串,否则我发现我需要传递 astart
和finish
位置以及它string
本身。因此,通过根本变得毫无意义string
。
最后,我选择只将 astart
和finish
指针传递给char[]
.
例如,假设我得到一个包含嵌套括号的字符串(但没有并排插入的括号。)所以像这样:
(abc(def(ghi((j)klm)nop)qrs)tuv)wxyz
但不是这样:
(abc(def)(ghi)(j)(klm)(nop)(qrs)tuv)wxyz
我想编写一个递归程序来提取最深嵌套括号中的字符串。就像是:
但是,我不高兴string
为foo
. 另一种方法是像链接示例中那样传递start
和finish
指针(或传递string::const_iterator
s。)
是否有包装器或其他东西可以让我使用string
功能,但不能重建 a string
?
exception - 我的愿望:继续编辑重定向页面
我正在从头开始构建我的第一个网站,并希望将所有查看者(主要是出于外观原因的雇主)重定向到“正在建设中”页面。我在头部使用了以下代码:
问题是,这是一个通用重定向。当我调整 html/css 并单击查看它时,无论是在我的浏览器中还是只是单击文件进行预览,它都会将我重定向到示例(我使用 youtube 作为测试) .
有没有办法可以重定向除我自己以外的所有访问者,以便我可以实时观看我的进度?