我正在阅读Neo4J发表的论文(前一段时间):http://dist.neo4j.org/neo-technology-introduction.pdf
在第二页到最后一页," 缺点"部分指出Neo4J不适合任意查询.
假设我有具有以下属性的用户节点:NAME,AGE,GENDER
以下关系:LIKE(指向Sports,Technology等NODE)和FRIEND(指向另一个USER).
Neo4J在查询类似的东西时效率不高:
找到喜欢运动,技术和阅读的FRIENDS(给定节点)OVER_THE_AGE 21.
因此,您必须首先找到USER1的FRIEND边缘,然后找到朋友的LIKE边缘并确定该节点是否被称为Sports,并且您必须确定给定朋友的年龄属性是否大于21.
这是一个糟糕的数据模型吗?特别是对于图形数据库?LIKE关系的原因是,如果您想找到所有喜欢运动的人.
对此更好的数据库选择是什么?Redis,Cassandra,HBase,PostgreSQL?为什么?
有没有人有这方面的经验数据?
如何证明这个文本的合理性?我已经尝试并搜索了几天以获得如此简单的工作......
例如:
HTML:
<div id="justify">
<p>I just want this to justify..</p>
</div>
Run Code Online (Sandbox Code Playgroud)
CSS:
#justify {
width: 100%;
background: #D33;
}
#justify p {
margin: 0 auto;
max-width: 70%;
list-style: disc outside none;
text-align: justify;
display: list-item;
background: #ccc;
}
Run Code Online (Sandbox Code Playgroud)
在这里JSFiddle:
任何帮助将非常感激.
标题说明了一切,但最好举个例子。
interface A {
key1: string
key2: string
key3: number
}
type KeysOfType<O, T> = keyof {
[K in keyof O]: O[K] extends T ? O[K] : never
}
function test<O,T>(obj: O, key: KeysOfType<O,T>) {
obj[key] // should only be of type T
}
const aa: A = {
key1: "1",
key2: "2",
key3: 3
}
test<A,string>(aa, "key1") // should be allowed, because key1 should be a string
test<A,string>(aa, "key3") // should NOT be allowed (but is), because key3 should …Run Code Online (Sandbox Code Playgroud) 这可能是由于我对C的理解不足,但在处理数组时,我得到一些(我称之为)模糊的错误:
这是代码:
int * generateRandomArray(int numPageReplacements) {
// Seed random number generator
srand(time(NULL));
int * randPages = (int *)malloc(sizeof(int)*numPageReplacements);
for (int i = 0; i < numPageReplacements; i++) {
randPages[i] = rand() % 10; // generate (with uniform distribution) number 0 - 9
printf("%d ", randPages[i]); // for testing purposes
}
printf("\nRandomPages[3] = %d \n" ,randPages[3]);
return randPages; // return array pointer
}
Run Code Online (Sandbox Code Playgroud)
输出:
7 9 4 6 4 6 5 7 6 3
RandomPages[3] = 6
Program ended with …Run Code Online (Sandbox Code Playgroud)