我想使用OCAML读取位图文件(来自文件系统)并将像素(颜色)存储在具有位图的第二维的数组内,每个像素将占用数组中的一个单元.
我找到了函数Graphics.dump_image image - > color array array 但它不能从文件中读取.
我在IIS7上运行了一个Sitefinity 4.1网站,我在默认文档列表的顶部设置了"Default.aspx",但是当我访问http:// www时.* .org /它显示IIS7欢迎页面.
当我访问http:// www.* .org/default.aspx它运作得很好.
我检查了Web.config中的defaultDocument部分,它设置正确,回收了应用程序池,重新启动了网站,到目前为止没有任何内容.
我错过了什么?
编辑:
这似乎是一个缓存问题,如果我添加垃圾查询字符串参数,它会重定向到正确的页面,例如:http:// www.* .org /?aaa
我有一个<ListBox>带有白色背景的项目,我想更改滚动条颜色,以便在用户滚动项目时可以看到它们.
我怎样才能做到这一点?
我在OCaml中有这两个类
class type ['a] collection =
object
method add : 'a -> unit
method clear : unit -> unit
method iterator : unit -> 'a iterator
method remove : 'a -> unit
end
class type ['a] iterator =
object
method hasNext : unit -> bool
method next : unit -> 'a
end
Run Code Online (Sandbox Code Playgroud)
我需要创建两个具体类['a] queue子类型collection和['a] iterator_queue子类型iterator.
我想主要知道如何定义方法,iterator : unit -> 'a iterator因为我没有看到这两种类型是如何连接的,是否['a] iterator_queue必须从两个类型继承?或者我应该采取不同的行动
我想在不同的机器上使用 mpirun 运行程序(所有带有 Open Mpi 1.5 的 linux 机器)。
现在我有可以登录的机器username A,还有另一组可以使用username B. 所有机器都可以通过 ssh 访问,但我不知道如何实现这一点。
我的主机文件将是这样的:
localhost #username local
machine_set_A_1 #username A
machine_set_A_2 #username A
...
machine_set_B_1 #username B
machine_set_B_2 #username B
...
Run Code Online (Sandbox Code Playgroud)
是否有可能实现这一点。谢谢。
我有以下RDF模型:
@prefix : <http://test.com/#> .
:graph1 :hasNode :node1 ;
:centerNode :node1 .
:graph1 :hasNode :node2 .
:graph1 :hasNode :node3 .
Run Code Online (Sandbox Code Playgroud)
我想运行一个SPARQL查询,其中如果a 与一个谓词:nodeX相关,我返回(或其他一些指示); 结果如下所示::graphX:centerNodetruefalse
?n ?g ?centered
-----------------------------
:node1 :graph1 true
:node2 :graph1 false
:node3 :graph1 false
Run Code Online (Sandbox Code Playgroud)
有没有办法在SPARQL 1.0中执行此操作?如果没有,可以在SPARQL 1.1中完成吗?
我有一个网页,使用存储在localStorage中的不同语言,在jQuery对话框中,我希望按照语言动态更改按钮的名称,例如:
var btn_hello_text = getLanguageBtnHelloText();
$('#dialog').dialog({
autoOpen: false,
buttons: {
btn_hello_text: function() {
doThings();
}
}
});
Run Code Online (Sandbox Code Playgroud)
这里的问题是对话框显示一个带有文本的按钮,"btn_hello_text"而不是变量本身包含的值.我想办法动态地改变按钮文本的值,任何提示?谢谢.
我正在使用OCaml Makefile进行我正在进行的项目,我有以下模块
DynamicTree.ml
Huffman_Dynamic.ml 哪个使用 DynamicTree
Huffman_Static.ml
main.ml它使用Huffman_Static和Huffman_Dynamic.
这是我的make文件:
# put here the names of your source files (in the right order)
SOURCES = huffman_static.ml dynamictree.ml huffman_dynamic.ml main.ml
# the name of the resulting executable
RESULT = huffman
# generate type information (.annot files)
ANNOTATE = yes
# make target (see manual) : byte-code, debug-code, native-code
all: native-code
include OCamlMakefile
Run Code Online (Sandbox Code Playgroud)
当我尝试创建项目时,我得到了Makefile生成的Unbound value DynamicTree.create_anchor_leaf结果ocamlopt -c -dtypes huffman_dynamic.ml.
Ocaml Makefile wepage 声明它会自动 …
我有一个Matrix类是Rows 的集合.数据类型定义如下:
行:
template <typename Index>
class Row {
public:
Row()
{
_index_vector = std::vector<Index, aligned_allocator<Index> > ();
}
Row& operator=( const Row& source )
{
//some copy logic here
return *this;
}
private:
std::vector<Index, aligned_allocator<Index> > _index_vector;
};
Run Code Online (Sandbox Code Playgroud)
矩阵:
template <typename Index>
class Matrix {
public:
typedef std::vector<Row<Index> > Rep;
Matrix () : _m (0), _n (0)
{}
Matrix (size_t n, size_t m) :
_m (m),
_n (n)
{
_A = Rep (n);
}
private: …Run Code Online (Sandbox Code Playgroud) 编辑: 主要的完整代码在这里http://codepad.org/79aLzj2H
再一次,这就是奇怪的行为正在发生
for (i = 0; i<tab_size; i++)
{
//CORRECT OUTPUT
printf("%s\n", tableau[i].capitale);
printf("%s\n", tableau[i].pays);
printf("%s\n", tableau[i].commentaire);
//WRONG OUTPUT
//printf("%s --- %s --- %s |\n", tableau[i].capitale, tableau[i].pays, tableau[i].commentaire);
}
Run Code Online (Sandbox Code Playgroud)
我有一系列以下strcuture
struct T_info
{
char capitale[255];
char pays[255];
char commentaire[255];
};
struct T_info *tableau;
Run Code Online (Sandbox Code Playgroud)
这是阵列的填充方式
int advance(FILE *f)
{
char c;
c = getc(f);
if(c == '\n')
return 0;
while(c != EOF && (c == ' ' || c == '\t'))
{
c = getc(f);
}
return fseek(f, -1, …Run Code Online (Sandbox Code Playgroud) 我正在尝试计算C#中递归函数中成功案例的数量,但我对所有函数调用之间共享变量的事实感到惊讶!
[更新2]
这次比奇怪多了.这样做
i = i + validTreesFun(tree.Nodes, newWords.ToList()) ;
Run Code Online (Sandbox Code Playgroud)
将i重置为0
这样做
i = validTreesFun(tree.Nodes, newWords.ToList()) + i ;
Run Code Online (Sandbox Code Playgroud)
给出一些结果(我不确定它是否正确)
[更新:完整代码]
public static int validTreesFun(List<Tree<char>> nodes, List<string> words)
{
int i = 0;
if (nodes == null && (words == null || words.Count == 0 || (words.Count == 1 && words.First() == "")))
return 1;
else
if (nodes == null)
return 0;
foreach (Tree<char> tree in nodes)
{
var validWords = words.Where(w => w.ToCharArray()[0] == tree.Root)
.Select(w => w);
if …Run Code Online (Sandbox Code Playgroud) 我想获得以下输出:
<name><![CDATA[ SomeNameHere ]]></name>
Run Code Online (Sandbox Code Playgroud)
使用以下xslt:
<xsl:element name="name">
<xsl:cdata>
<xsl:value-of select="name"/>
</xsl:cdata>
</xsl:element>
Run Code Online (Sandbox Code Playgroud)
但是在编译时我得到以下异常:
'xsl:cdata' cannot be a child of the 'xsl:element' element.
Run Code Online (Sandbox Code Playgroud)
如何在xml节点中插入cdata元素呢?
谢谢.
我试图测试中的性能差异std::swap,并vector::swap和我有和没有编译-std=c++0x选项.我注意到大约200毫秒的差异,当我不包括这个选项时程序运行得更快.
#include <iostream>
#include <string>
#include <vector>
int main()
{
commentator.setReportStream (cout);
size_t nbElts = 2048;
vector<int> v, w;
v.resize (nbElts);
w.reserve (nbElts);
for (int i = 0; i < nbElts; ++i) {
w.push_back (i);
}
commentator.start ("std::swap", __FUNCTION__);
for (int i = 0; i < 10000000; ++i) {
std::swap (v, w);
}
commentator.stop (MSG_DONE);
commentator.start ("vector::swap", __FUNCTION__);
for (int i = 0; i < 10000000; ++i) {
v.swap (w);
}
commentator.stop (MSG_DONE);
return …Run Code Online (Sandbox Code Playgroud) ocaml ×3
c++ ×2
c++11 ×2
allocator ×1
bitmap ×1
c ×1
c# ×1
cdata ×1
class ×1
collections ×1
g++ ×1
iis-7 ×1
iterator ×1
jquery ×1
jquery-ui ×1
listbox ×1
makefile ×1
mpi ×1
openmpi ×1
performance ×1
printf ×1
rdf ×1
recursion ×1
scope ×1
silverlight ×1
sparql ×1
ssh ×1
vector ×1
web-config ×1
xaml ×1
xml ×1
xslt ×1