小编Fra*_*Man的帖子

T-SQL递归选择循环依赖

我在我的数据库中有自我依赖的实体(a),它们是从另一个实体(b)引用的,并且给定一个特定的(b)实体,我需要获得所需的所有(a)实体.这些是多对多的映射,所以我有一个单独的映射表.我认为使用CTE的递归选择是我最好的选择,但我遇到了一个问题:

这个小提琴说明了我的问题.如果某些用户引入了循环引用,则我的递归选择将会突然停止.我一直在绞尽脑汁试图找到解决这个问题的方法.应该注意的是,虽然我已经在小提琴中引入了外键,但外键实际上并没有被我正在使用的系统所尊重(与DBA长期争论) - 我引入它们以使数据流更清晰.

递归查询,适用于那些不想点击小提琴的人:

WITH recur(objID) AS (
    SELECT usesObjID
        FROM #otherObj
        WHERE otherObjID = 1
    UNION ALL
    SELECT slaveObjID
        FROM #objMap
            INNER JOIN recur
                on #objMap.masterObjID = recur.objID
)SELECT objID from recur
Run Code Online (Sandbox Code Playgroud)

有什么想法吗?这个设计不是生产中的,所以我可以稍微改变一下架构,但我不想依赖于在插入时发现循环引用,除非可以通过T-SQL完成.

t-sql recursion sql-server-2008

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

svn merge --dry-run 显示 svn diff

我正在使用一个代码库,该代码库(历史上)是手动合并的,而不是通过svn merge. 我试图通过向每个人证明合并是多么有用来改变这一点 - 但当我进行空运行时,我得到了这个:

$ svn merge [[Repo URL]] . -c 21355,21358,21364,21370,21371,21373 --dry-run
--- Merging r21355 into '.':
U    [[File 1]]
--- Merging r21355 into '[[dir]]':
U    [[dir]]/[[File 2]]
U    [[dir]]/[[File 3]]
--- Merging r21358 into '[[dir]]':
U    [[dir]]/[[File 4]]
--- Merging r21364 into '[[dir]]':
U    [[dir]]/[[File 2]]
C    [[dir]]/[[File 4]]    
--- Merging r21370 into '[[dir]]':
U    [[dir]]/[[File 5]]
--- Merging r21371 into '[[dir]]':
U    [[dir]]/[[File 5]]
--- Merging r21373 into '[[dir]]':
C    [[dir]]/[[File 5]]
U    [[dir]]/[[File …
Run Code Online (Sandbox Code Playgroud)

svn diff merge

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

正则表达特定的日期格式

我需要帮助形成一个日期的正则表达式来匹配YYYYMMDD格式.以下是详细信息:

输入验证:输入的值是8的长度和所有数字.第一个字符是1或2.第5个和第6个字符在01到12之间,最后两个字符在01和31之间

我尝试了下面的表达式,但无法理解我们如何提供数值范围,如1-12个月和1-31天.

SELECT 'P' from dual where REGEXP_LIKE ('122412','^[1][2][0-9]{2}[1|12]$');
Run Code Online (Sandbox Code Playgroud)

提前致谢!

regex oracle

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

Java子类方法重写

我很确定我有继承权,但我希望得到确认:

class C1 {
    public int relation( C1 MyC2 ){
        //Do stuff
    }
}

class C2 extends C1{
    public int relation( C2 MyC2){
        //Do stuff
        return super.relation((C1) MyC2);
    }
}
Run Code Online (Sandbox Code Playgroud)

我的理解是C2#relation()实际上不会覆盖C1#关系,因此以下语句都是合法的:

MyC1_1.relation(MyC1_2); //Calls C1#relation()
MyC2_1.relation(MyC1_1); //Calls C1#relation()
MyC2_1.relation(MyC2_2); //Calls C2#relation()
Run Code Online (Sandbox Code Playgroud)

虽然以下是错误的

MyC1_1.relation(MyC2_1);
Run Code Online (Sandbox Code Playgroud)

如果我是对的,那很好.否则,我很想知道为什么......

java inheritance overriding

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

Makefile奇怪的行为

我有这个Makefile,它呈现出一些奇怪的行为:

$ javac -d Classes -sourcepath .. -classpath `for x in \`ls Classes/jars/*\`; do echo -n $x:; done` PCA/PCAClassifier.java
Run Code Online (Sandbox Code Playgroud)

编译java就好了.但是在我打电话的时候

make PCA
Run Code Online (Sandbox Code Playgroud)

我明白了:

Compiling PCAClassifier
javac -d Classes -sourcepath .. -classpath `for x in \`ls Classes/jars/*\`; do echo -n $x:; done` PCA/PCAClassifier.java
javac: invalid flag: Classes/jars/Jama.jar:
Usage: javac <options> <source files>
use -help for a list of possible options
make: * [Classes/RobotSuite/PCA/PCAClassifier.class] Error 2
Run Code Online (Sandbox Code Playgroud)

我感到很困惑.有人有解决方案吗?

制作版本信息:

GNU Make 3.81版权所有(C)2006 Free Software Foundation,Inc.这是免费软件; 查看复制条件的来源.没有保修; 甚至不适用于适销性或特定用途的适用性.

这个程序是为i386-apple-darwin10.0构建的

背景:处理小组项目.我正在运行Ubuntu,我的合作伙伴正在运行Mac OS X.无论出于何种原因,这个makefile在我的计算机上工作得很好,但在他的计算机上却没有.即使该命令在他的BASh终端中工作,但不知道Make是不是正确发送它.

macos bash makefile

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

Infinispan 初始状态传输挂起并超时

我正在尝试使用共享的 Infinispan 缓存(异步复制)对一对服务器进行集群。一个总是成功启动,并在 JDBC 数据库中正确注册自己。当另一个启动时,它在数据库中正确注册,我看到它们之间有一堆喋喋不休,然后,在等待第二个服务器的响应时,我得到

`org.infinispan.commons.CacheException: Initial statue transfer timed out`
Run Code Online (Sandbox Code Playgroud)

我认为这只是配置问题,但我不确定如何调试我的配置问题。我花了几天时间配置和重新配置我的 Infinispan XML 和 JGroups.xml:

无限跨度:

<?xml version="1.0" encoding="UTF-8"?>
<infinispan xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:infinispan:config:6.0"
xsi:schemaLocation="urn:infinispan:config:6.0     http://www.infinispan.org/schemas/infinispan-config-6.0.xsd
                   urn:infinispan:config:remote:6.0 http://www.infinispan.org/schemas/infinispan-cachestore-remote-config-6.0.xsd"
xmlns:remote="urn:infinispan:config:remote:6.0"
>

    <!-- *************************** -->
    <!-- System-wide global settings -->
    <!-- *************************** -->

    <global>
        <shutdown hookBehavior="DEFAULT"/>
        <transport clusterName="DSLObjectCache">
            <properties>
                <property name="configurationFile" value="jgroups.xml"/>
            </properties>
        </transport>
        <globalJmxStatistics enabled="false" cacheManagerName="Complex.com"/>
    </global>
    <namedCache name="ObjectCache">
        <transaction transactionMode="TRANSACTIONAL" />
        <locking
            useLockStriping="false"
        />
        <invocationBatching enabled="true"/>
        <clustering mode="replication">
            <async asyncMarshalling="true" useReplQueue="true" replQueueInterval="100" replQueueMaxElements="100"/>
            <stateTransfer fetchInMemoryState="true" />
        </clustering>
        <eviction strategy="LIRS" maxEntries="500000"/>
        <expiration …
Run Code Online (Sandbox Code Playgroud)

jgroups infinispan jboss7.x

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

该程序不适用于n> 9 ...当n是静态表达式时,它工作正常

如果我们取n> 9那么它就不会输入arr [n]的元素,其中n> 9.如果n是常数,程序工作正常..程序中有什么错误.请帮助...我遵守并使用mingw shell在Windows中运行它

/* Binary Search Program */

#include<stdio.h>
#include<stdlib.h>


int main()
{
    int n,arr[n],i,j,temp;
    printf("Enter The number of elements in array : ");
    scanf("%d",&n);
    printf("Enter the %d elements of array :\n",n);
    for(i=0;i<n;i++)
    {
        scanf("%d",&arr[i]);
    }

    printf("The Unsorted array is :\n");
    for(i=0;i<n;i++)
    {
        printf("%d\n",arr[i]);
    }
    /* BOUBBLE SORTING */

    for(j=0;j<n-1;j++)
    {
        for(i=0;i<n-1-j;i++)
        {
            if(arr[i]>arr[i+1])
            {
                temp=arr[i+1];
                arr[i+1]=arr[i];
                arr[i]=temp;
            }
        }
    }
    printf("The sorted array is :\n");
    for(i=0;i<n;i++)
    {
        printf("%d\n",arr[i]);
    }

    return 0;
}
Run Code Online (Sandbox Code Playgroud)

c arrays

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