Closed fence Algorithm

Hi guys,
i'm trying to find an Algorithm to solve the problem of closed fence..
a closed fence is a sequence of points of cordinates xi,yi in the plan in counter clockwise direction..
a valid fence is one that has no intersections: it means that each segment xi,yi xj,yj should not intersect another segment except for adjacent segments that have a point in common...
the first thing to do is to test a sequence of points to see if it is a valide closed fence! how???
if you have any hints, ideas, sample code please notice me..
thanks.

i am sorry if you found the problem unclear! my replies were brief for i was busy trying to solve the problem with my own efforts...
here is a detailed discription of the problem:
A CLOSED FENCE in the plane is a closed broken line with N corners and
no intersections. The corners or vertices are listed in counter-
clockwise order in an array {xi yi} i = 1,....N. Every pair of adjacent
vertices defines a side of the fence. Thus {xi  yi   xi+1  yi+1 }is a
side of the fence for i= 1,... N. Note that N+1=1 which connects the
first and last vertices making the fence closed.
* x3 y3
x5 y5 / \
x y * * / \
x6 y6* x4 y4 \
| \
| \
x1 y1*----------------* x2 y2
Write a program which will do the following:
a) Test an array of vertices {xi yi }, i = 1,....N to see if the array
is a valid fence. A valid fence is one that has no intersections.
b) Suppose a person (with no height) is standing in the plane at
position (x y) and looks at the fence. What sides can the person see?
The program must identify all sides of the fence that are visible or
partially visible from (x y). This means there exists a ray from (x y)
to the side which does not intersect any other side of the fence. A
side that is parallel to the line of sight is not considered visible.
In the figure above the segments x3 y3 x4 y4 and x5 y5 x6 y6 x1 y1
consisting of two sides are visible or partially visible from x y. If
only part of a side is visible, the entire side should be listed in
the visible segment. Do not list just the visible portion.
i'm about to solve the b) question but really needs feedback about a)...
thanks.

Similar Messages

  • 了解Oracle RAC Brain Split Resolution集群脑裂协议

    大约是一周前,一位资深的Oracle工程师向我和客户介绍RAC中脑裂的处理过程,据他介绍脑裂发生时通过各节点对voting disk(投票磁盘)的抢夺,那些争抢到(n/2+1)数量voting disk的节点就可以survive(幸存)下来,而没有争抢到voting disk的节点则被evicted踢出节点。
    不得不说以上这番观点,来得太过随意了,一位从Oracle 6就开始从事维护工作的老工程师也会犯这样的概念性错误,只能说Oracle技术的更新过于日新月异了。
    在理解脑裂(Brain Split)处理过程前,有必要介绍一下Oracle RAC Css(Cluster Synchronization Services)的工作框架:
    Oracle RAC CSS提供2种后台服务包括群组管理(Group Managment简称GM)和节点监控(Node Monitor简称NM),其中GM管理组(group)和锁(lock)服务。在集群中任意时刻总有一个节点会充当GM主控节点(master node)。集群中的其他节点串行地将GM请求发送到主控节点(master node),而master node将集群成员变更信息广播给集群中的其他节点。组成员关系(group membership)在每次发生集群重置(cluster reconfiguration)时发生同步。每一个节点独立地诠释集群成员变化信息。
    而节点监控NM服务则负责通过skgxn(skgxn-libskgxn.a,提供节点监控的库)与其他厂商的集群软件保持节点信息的一致性。此外NM还提供对我们熟知的网络心跳(Network heartbeat)和磁盘心跳(Disk heartbeat)的维护以保证节点始终存活着。当集群成员没有正常Network heartbeat或Disk heartbeat时NM负责将成员踢出集群,被踢出集群的节点将发生节点重启(reboot)。
    NM服务通过OCR中的记录(OCR中记录了Interconnect的信息)来了解其所需要监听和交互的端点,将心跳信息通过网络发送到其他集群成员。同时它也监控来自所有其他集群成员的网络心跳Network heartbeat,每一秒钟都会发生这样的网络心跳,若某个节点的网络心跳在misscount(by the way:10.2.0.1中Linux上默认misscount为60s,其他平台为30s,若使用了第三方vendor clusterware则为600s,但10.2.0.1中未引入disktimeout;10.2.0.4以后misscount为60s,disktimeout为200s;11.2以后misscount为30s:CRS-4678: Successful get misscount 30 for Cluster Synchronization Services,CRS-4678: Successful get disktimeout 200 for Cluster Synchronization Services)指定的秒数中都没有被收到的话,该节点被认为已经”死亡”了。NM还负责当其他节点加入或离开集群时初始化集群的重置(Initiates cluster reconfiguration)。
    在解决脑裂的场景中,NM还会监控voting disk以了解其他的竞争子集群(subclusters)。关于子集群我们有必要介绍一下,试想我们的环境中存在大量的节点,以Oracle官方构建过的128个节点的环境为我们的想象空间,当网络故障发生时存在多种的可能性,一种可能性是全局的网络失败,即128个节点中每个节点都不能互相发生网络心跳,此时会产生多达128个的信息”孤岛”子集群。另一种可能性是局部的网络失败,128个节点中被分成多个部分,每个部分中包含多于一个的节点,这些部分就可以被称作子集群(subclusters)。当出现网络故障时子集群内部的多个节点仍能互相通信传输投票信息(vote mesg),但子集群或者孤岛节点之间已经无法通过常规的Interconnect网络交流了,这个时候NM Reconfiguration就需要用到voting disk投票磁盘。
    因为NM要使用voting disk来解决因为网络故障造成的通信障碍,所以需要保证voting disk在任意时刻都可以被正常访问。在正常状态下,每个节点都会进行磁盘心跳活动,具体来说就是会到投票磁盘的某个块上写入disk心跳信息,这种活动每一秒钟都会发生,同时CSS还会每秒读取一种称作”kill block”的”赐死块”,当”kill block”的内容表示本节点被驱逐出集群时,CSS会主动重启节点。
    为了保证以上的磁盘心跳和读取”kill block”的活动始终正常运作CSS要求保证至少(N/2+1)个投票磁盘要被节点正常访问,这样就保证了每2个节点间总是至少有一个投票磁盘是它们都可以正常访问的,在正常情况下(注意是风平浪静的正常情况)只要节点所能访问的在线voting disk多于无法访问的voting disk,该节点都能幸福地活下去,当无法访问的voting disk多于正常的voting disk时,Cluster Communication Service进程将失败并引起节点重启。所以有一种说法认为voting disk只要有2个足以保证冗余度就可以了,没有必要有3个或以上voting disk,这种说法是错误的。Oracle推荐集群中至少要有3个voting disks。
    补充1:
    Question:
    有同学问那么voting disk 必须是奇数个呢?
    Answer:
    实际上我们仅仅是推荐使用奇数个vote disk ,而非必须是奇数个。10gR2中vote disk的数目上限是32个。
    Question
    我们可以使用2或4个vote disk吗?
    Answer:
    可以的。 但是2、4这样的数目在“至少(N/2+1)个投票磁盘要被节点正常访问”这一disk heartbeat的硬性算法下是不利的:
    当我们使用2个vote disk 时,不能发生任意个vote disk的心跳失败
    当我们使用3个vote disk 时,不能发生大于1个的vote disk心跳失败
    当我们使用4个vote disk 时,不能发生大于1个的vote disk心跳失败 ,这和3个时的容错率是一样,但是因为我们有更多的vote disk,这会导致管理成本和引入的风险增长
    当我们使用5个vote disk 时,不能发生大于2个的vote disk心跳失败
    当我们使用6个vote disk 时,仍然不能发生大于2个的vote disk心跳失败, 同样的因为比5时多出一个 ,也会引入不合理的管理成本和风险
    补充2:
    Question:
    若节点间的网络心跳正常,且节点所能正常心跳的vote disk 大于 不能正常访问的 ,如3个votedisk 时 恰巧有1个vote disk 的disk heartbeat 超时,此时Brain split 会发生吗?
    Answer:
    这种情况即不会触发Brain Split,也不会引发节点驱逐协议(eviction protocol)。 当单个或小于(N/2+1)个的voting disk心跳失败(disk heartbeat failure)时,这种心跳失败可能是由于短期内节点访问voting disk发生I/O error错误而引起的,此时css会立刻将这些失败的voting disk标记为OFFLINE。虽然有一定数量的voting disk OFFLINE了,但是我们仍有至少(N/2+1)个投票磁盘可用,这保证了eviction protocol不会被调用,所以没有节点会被reboot重启。紧接着node monitor模块的Disk ping Monitor Thread(DPMT-clssnmDiskPMT)会重复尝试访问这些失败的OFFLINE voting disk,若这些投票磁盘变得再次可I/O访问且经过验证其上的数据也没有讹误,那么css会再次将此voting disk标记为ONLINE;但是如果在45s( 这里的45s是基于misscount和 内部算法获得的) 内仍不能正常访问相关的voting disk,那么DMPT将在cssd.log中生成警告信息,如:
    CSSD]2011-11-11 20:11:20.668 >
    WARNING: clssnmDiskPMT: long disk latency >(45940 ms) to voting disk (0//dev/asm-votedisk1)
    假设以上发生clssnmDiskPMT警告的RAC场景共有3个voting disk,现已有一个asm-votedisk1因为I/O error或其他原因而被标记为OFFLINE,若此时再有一个votedisk也出现了问题并disk heartbeat 失败,那么节点会因为少于规定数目(2)的votedisk而引发eviction protocol,进而重启reboot。
    单个或小于(N/2+1)个的voting disk心跳失败都仅仅生成警告(Warning),而非致命的错误。因为仍有绝大数量的vote disk可被访问,因此生成的警告都是非致命的,eviction protocol将不会被触发。
    当实际的NM Reconfiguration集群重置情况发生时所有的active节点和正在加入集群的节点都会参与到reconfig中,那些没有应答(ack)的节点都将不再被归入新的集群关系中。实际上reconfig重置包括多个阶段:
    1.初始化阶段 — reconfig manager(由集群成员号最低的节点担任)向其他节点发送启动reconfig的信号
    2.投票阶段 — 节点向reconfig manager发送该节点所了解的成员关系
    3.脑裂检查阶段 — reconfig manager检查是否脑裂
    4.驱逐阶段 — reconfig manager驱逐非成员节点
    5.更新阶段 — reconfig manager向成员节点发送权威成员关系信息
    在脑裂检查阶段Reconfig Manager会找出那些没有Network Heartbeat而有Disk Heartbeat的节点,并通过Network Heartbeat(如果可能的话)和Disk Heartbeat的信息来计算所有竞争子集群(subcluster)内的节点数目,并依据以下2种因素决定哪个子集群应当存活下去:
    拥有最多节点数目的子集群(Sub-cluster with largest number of Nodes)
    若子集群内数目相等则为拥有最低节点号的子集群(Sub-cluster with lowest node number),举例来说在一个2节点的RAC环境中总是1号节点会获胜。
    采用Stonith algorithm 的IO fencing(remote power reset)
    补充:
    STONITH算法是一种常用的I/O Fencing algorithm,是RAC中必要的远程关闭节点的接口。其想法十分简单,当某个节点上运行的软件希望确保本集群内的其他节点不能使用某种资源时,拔出其他节点的插座即可。这是一种简单、可靠且有些残酷的算法。Stonith 的优势是其没有特定的硬件需求,也不会限制集群的扩展性。
    Oracle Clusterware的Process Monitor模块负责实现IO fencing,保证不会因节点/实例的不协调工作而产生corruption。Process Monitor的工作具体由hangcheck timer或者oprocd 完成, 在Linux平台上10.2.0.4 之前都没有oprocd的存在(其他Unix平台在10.2.0.1就有了),在安装RAC之前需要额外安装hangcheck timer软件以保证IO fencing, 到10.2.0.4 时Linux上也有了oprocd,具体见<Know about RAC Clusterware Process OPROCD> 一文。 这些负责IO fencing的进程一般都会被锁定在内存中(locked in memory)、实时运行(Real time)、休眠固定的时间(Sleep a fixed time)、以root身份运行;若进程唤醒后发现时间已经太晚,那么它会强制reboot;若这些进程发生失败,则也会重启,所以在RAC环境中oprocd是一个很重要的进程,不要失去手动去kill这个进程。
    在完成脑裂检查后进入驱逐阶段,被驱逐节点会收到发送给它们的驱逐信息(如果网络可用的话),若无法发送信息则会通过写出驱逐通知到voting disk上的”kill block”来达到驱逐通知的目的。同时还会等待被驱逐节点表示其已收到驱逐通知,这种表示可能是通过网络通信的方式也可能是投票磁盘上的状态信息。
    可以看到Oracle CSS中Brain Split Check时会尽可能地保证最大的一个子集群存活下来以保证RAC系统具有最高的可用性,而并不如那位资深工程师所说的在Cluster Reconfiguration阶段会通过节点对投票磁盘的抢占来保证哪个节点存活下来。
    http://www.oracledatabase12g.com/archives/oracle-rac-brain-split-resolution.html
    http://www.oracledatabase12g.com/archives/%E5%86%8D%E8%AE%AErac-brain-split%E8%84%91%E8%A3%82.html
    Edited by: Maclean Liu on Feb 4, 2012 9:16 AM

    that's ok!

  • EBS Importing Opening / Closing Balances

    I am Importing EBS via transation FF.5 (APACS EBS), the file is importing all details except the Opening Balance and Closing Balance.  I have checked Algorithm and they are set up.   Using 4.7 Enterprise.  Has anyone got any suggestions.

    Hi,
    There are various t. code to check line items for vendor like: S_ALR_87012103 but Any table is not helping to check opening/closeing balance for vendor.
    Table BSIK and BSAK are having are records for open items and close items for vendor and system calculate the balance by using these tables.
    Regards,
    Vinod

  • Closed loop control of step motors possible with 7344?

    Hi All
    I have been looking around here for a while for an answer to this question.
    For me, a closed loop control system is correcting for following errors all the time, also when the move is complete.
    If the load on a system changes, there will often be a need for compensation in order to keep the position right. Then you need a closed loop control system.
    I have made a system using DC motors with a 7342 controller. We are in the process og getting a new similar system, where the manufacturer chosed stepmotors in the believe that it can be used in closed loop.
    Is it really true that the NI version of closed loop is only performing a what you call a "pull-in" at the end of the move in order to correct for lost steps or flexibility of the connection between motor and object/encoder?
    I would call this "backlash compensation" or something like that.
    Why dont you make a real closed loop option. The control voltage from your servo motor control, could be fed into a voltage-frequency converter with a matchin sign signal.
    This shouldn't be too complicated to accomplish.
    /b

    You are right. NI motion control boards don't apply a control algorithm
    during moves when configured in closed loop stepper mode. In this mode
    the board monitors the following error during the move and generates an
    error when the following error limit is exceeded and they start the
    pull-in moves at the end of the move if necessary.
    If you really want to do PID control with stepper motors you still
    could connect an external V/f converter to the DAC outputs of the board
    and control the axes like DC motor axes. Some vendors implement this
    feature on their board but NI has decided not to do that as we don't
    think that this approach provides a good solution. Here are some reasons:
    The most important issue is the fact that you could easily exceed
    the maximum rate of change of the motor frequency in the case that the
    following error increases during the move. For a DC motor this would mean that the
    voltage of the controller increases to compensate for this error and
    the motor will follow - probably with some delay, but it will follow. For
    the stepper this could mean that the acceleration becomes so high
    that the motor stops immediately as it can't follow with a delay like a DC motor. What
    should the controller do then? Restart the move automatically? Generate
    an error? There is a big chance that you end up with a system moving in a stop and go mode.
    The second issue is related to the control algorithm itself. The transfer function of a stepper motor is not really linear so it will be quite hard to find good tuning parameters. A DC motor can be tuned by analyzing the step response and the Bode plot. For the reasons that I have described in 1.) this won't work for a stepper so how should you tune it?
    I have talked to some  motion control engineers who have tried to control steppers with a PID algorithm and they all agree that this is a real pain and it's not recommended.
    So if your system requirements involve online following error compensation I strongly recommend using a DC motor.
    Best regards,
    Jochen Klier
    National Instruments Germany

  • Main Memory Cleaning Policy (Algorithm)

    Respected Sir/Madam,
    I am studying the memory management concepts of Microsoft Windows Operating System.
    I need to know about the Main Memory Cleaning Policies or algorithms of latest Operating systems of Microsoft (Windows 7 and 8) in details.
    What is the threshold level required for the page replacement after remaining the minimum page frames available in main memory ?
    What is the Architecture of the Virtual memory management system of these operating systems?  
    It is Urgent.
    Please send me the answers of these questions.
    I shall be very thankful to you for this.

    Hi ,
     Thanks for the response. Basically I first opened parent panel which is of type Window. It included menu , toolbar etc. For menu/toolbar events it opens child windows which gets displayed in main window in the form of tabs. This is my use case.
    I tried the suggested profiler Redgate Ants profiler. Its very good and informative! I ran the profiler
    got the following output. Though I closed the child window it seems objects are still there in memory . No where I left out string , byte array objects in my code.
    Not sure why Runtimemethodinfo , hastable bucket are there in memory. I even tried the workaround mentioned at here.
    I thought panel resources might have not been freed up and in my code I am clearing them as well. Still did not see much improvement. Any additional things do I need to check? Please let me know.
    Thanks,
    Brahmaji.

  • Account is billing old, closed SA's on current bill

    I have some accounts that are acting strangely in CC&B. I have a customer who moves out and leaves a balance. The SA's are closed and this information comes over during conversion. Now, the same customer starts service again and the first bill is showing the old closed SA's as well and charging the past amounts in addition to the new charges on the new SA's. These closed SA's can go back years...
    Is this a configuratin issue and if so from where? Do we need a new algorithm for processing these scenarios or will this be a code change?

    This is a standard feature of CC&B - if the customer moves out, leaving a debt, and then signs up again with the same account, the previous debt will appear on the bill along with any new charges. If you don't want it billed, you could choose not to convert these amounts, or write them off during conversion, or not reuse accounts - all are possibilities, depending upon the business requirement.
    Regarding the status of the old SAs - if they have a financial balance, they should not have been converted as "Closed". In CC&B, the system will change SA Status to "Closed" only when there is no financial balance, and you can also close an SA online, but only if there is no financial balance. The meaning of "Closed" is essentially that there is no financial balance.

  • Zip File closed

    Hi
    I am trying to use the new Mustang release which has the CMS bug causing long rescans fixed. However, I am running into this exception which occurs in b71 but not Java 1.5.0
    Caused by: java.lang.IllegalStateException: zip file closed
                   at java.util.zip.ZipFile.ensureOpen(ZipFile.java:402)
                   at java.util.zip.ZipFile.getEntry(ZipFile.java:147)
                   at java.util.jar.JarFile.getEntry(JarFile.java:205)
                   at com.foo.cam.net.jar.URLJarFile.getEntry(URLJarFile.java:65)
                   at java.util.jar.JarFile.getJarEntry(JarFile.java:188)
                   at sun.misc.JarIndex.getJarIndex(JarIndex.java:96)
                   at sun.misc.URLClassPath$JarLoader$1.run(URLClassPath.java:606)
                   at java.security.AccessController.doPrivileged(Native Method)
                   at sun.misc.URLClassPath$JarLoader.ensureOpen(URLClassPath.java:597)
                   at sun.misc.URLClassPath$JarLoader.<init>(URLClassPath.java:559)
                   at sun.misc.URLClassPath$3.run(URLClassPath.java:331)
                   at java.security.AccessController.doPrivileged(Native Method)
                   at sun.misc.URLClassPath.getLoader(URLClassPath.java:320)
                   at sun.misc.URLClassPath.getLoader(URLClassPath.java:297)
                   at sun.misc.URLClassPath.access$000(URLClassPath.java:59)
                   at sun.misc.URLClassPath$1.next(URLClassPath.java:194)
                   at sun.misc.URLClassPath$1.hasMoreElements(URLClassPath.java:205)
                   at java.net.URLClassLoader$3$1.run(URLClassLoader.java:393)
                   at java.security.AccessController.doPrivileged(Native Method)
                   at java.net.URLClassLoader$3.next(URLClassLoader.java:390)
                   at java.net.URLClassLoader$3.hasMoreElements(URLClassLoader.java:415)
                   at sun.misc.CompoundEnumeration.next(CompoundEnumeration.java:27)
                   at sun.misc.CompoundEnumeration.hasMoreElements(CompoundEnumeration.java:36)
                   at sun.misc.Service$LazyIterator.hasNext(Service.java:255)
                   at java.sql.DriverManager.loadInitialDrivers(DriverManager.java:476)
                   at java.sql.DriverManager.initialize(DriverManager.java:579)
                   at java.sql.DriverManager.registerDriver(DriverManager.java:270)
                   at com.sybase.jdbc2.jdbc.SybDriver.registerWithDriverManager(SybDriver.java:561)
                   at com.sybase.jdbc2.jdbc.SybDriver.<init>(SybDriver.java:113)
                   at com.sybase.jdbc2.jdbc.SybDriver.<clinit>(SybDriver.java:79)
                   ... 14 moreThis seems that the jar file has been closed prematurely, causing an exception when it is being read. I cannot seem to find any regression bug in the database with this symptom. Any ideas for a solution or workaround for this problem? Any help would be much appreciated.
    Thanks.

    Currently i have the same problem with the bouncy castle JCE security jar :
    No such algorithm: DES
    java.security.NoSuchAlgorithmException: No such algorithm: DES
         at javax.crypto.Cipher.getInstance(DashoA14*..)
         at javax.crypto.Cipher.getInstance(DashoA14*..)
    Caused by: java.security.NoSuchAlgorithmException: Error constructing implementation (algorithm: DES, provider: BC, class: org.bouncycastle.jce.provider.JCEBlockCipher$DES)
         at java.security.Provider$Service.newInstance(Unknown Source)
         ... 9 more
    Caused by: java.lang.IllegalStateException: zip file closed
         at java.util.zip.ZipFile.ensureOpen(Unknown Source)
         at java.util.zip.ZipFile.getEntry(Unknown Source)
         at java.util.jar.JarFile.getEntry(Unknown Source)
         at com.sun.deploy.cache.CachedJarFile.getEntry(Unknown Source)
         at java.util.jar.JarFile.getJarEntry(Unknown Source)
         at sun.misc.URLClassPath$JarLoader.getResource(Unknown Source)
         at sun.misc.URLClassPath.getResource(Unknown Source)
         at java.net.URLClassLoader$1.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.net.URLClassLoader.findClass(Unknown Source)
         at sun.applet.AppletClassLoader.findClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at sun.applet.AppletClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at java.security.Provider$Service.getImplClass(Unknown Source)
         ... 10 more

  • SAP gateway was closed

    Dear Gurus,
                       We had a prob in our BW system i.e system was down for a moment and comes back automatically.In transaction SM 21 the error displays as
    Message server disconnected
    SAP gateway was closed
    I am alo attach the trace logs here (dev_rd)
    27.05.2009                                             RSTR0006: Display Developer Traces                                                    1
    trc file: "dev_rd", trc level: 1, release: "700"     
    Wed May 27 06:01:18 2009     
    ***LOG S00=> GwInitReader, gateway started ( 1724444) [gwxxrd.c     1757]
    systemid   324 (IBM RS/6000 with AIX)
    relno      7000
    patchlevel 0
    patchno    167
    intno      20050900
    make:      single threaded, ASCII, 64 bit, optimized
    pid        1724444
    gateway runs with dp version 240(ext=110) (@(#) DPLIB-INT-VERSION-240)
    gateway (version=700.2008.06.23)
    Wed May 27 06:01:19 2009
    gw/local_addr : 0.0.0.0
    CCMS: AlInitGlobals : alert/use_sema_lock = TRUE.
    CCMS: Initalizing shared memory of size 40000000 for monitoring segment.
    Wed May 27 06:01:20 2009
    CCMS: Checking Downtime Configuration of Monitoring Segment.
    Bind service sapgw02 (socket) to port 3302
    GwPrintMyHostAddr: my host addresses are :
      1 : [20.60.111.30] bascop11 (HOSTNAME)
      2 : [127.0.0.1] loopback (LOCALHOST)
      3 : [192.168.17.11] basaix11boot1 (NILIST)
      4 : [20.60.111.31] basaix11 (NILIST)
      5 : [192.168.23.16] 192.168.23.16 (NILIST)
      6 : [20.60.113.20] 20.60.113.20 (NILIST)
      7 : [192.168.17.139] basaix11boot2 (NILIST)
      8 : [192.168.23.144] basaix11mboot2 (NILIST)
      9 : [20.60.113.145] bascop11b (NILIST)
    Full qualified hostname = bascop11.basell.com
    DpSysAdmExtCreate: ABAP is active
    DpSysAdmExtCreate: VMC (JAVA VM in WP) is not active
    Wed May 27 06:01:46 2009
    DpShMCreate: sizeof(wp_adm)          30200     (1208)
    DpShMCreate: sizeof(tm_adm)          5283968     (26288)
    DpShMCreate: sizeof(wp_ca_adm)          120064     (60)
    DpShMCreate: sizeof(appc_ca_adm)     6000     (60)
    DpCommTableSize: max/headSize/ftSize/tableSize=500/8/548040/548048
    DpShMCreate: sizeof(comm_adm)          548048     (1088)
    DpSlockTableSize: max/headSize/ftSize/fiSize/tableSize=0/0/0/0/0
    DpShMCreate: sizeof(slock_adm)          0     (104)
    DpFileTableSize: max/headSize/ftSize/tableSize=0/0/0/0
    DpShMCreate: sizeof(file_adm)          0     (72)
    DpShMCreate: sizeof(vmc_adm)          0     (1616)
    DpShMCreate: sizeof(wall_adm)          (22440/36712/56/104)
    DpShMCreate: sizeof(gw_adm)     48
    DpShMCreate: SHM_DP_ADM_KEY          (addr: 7000000000ab000, size: 6054984)
    DpShMCreate: allocated sys_adm at 7000000000ab000
    DpShMCreate: allocated wp_adm at 7000000000acc30
    DpShMCreate: allocated tm_adm_list at 7000000000b4228
    DpShMCreate: allocated tm_adm at 7000000000b4288
    DpShMCreate: allocated appc_ca_adm at 7000000005db808
    DpShMCreate: allocated comm_adm at 7000000005dcf78
    DpShMCreate: system runs without slock table
    DpShMCreate: system runs without file table
    DpShMCreate: allocated vmc_adm_list at 700000000662c48
    DpShMCreate: allocated gw_adm at 700000000662cc8
    DpShMCreate: system runs without vmc_adm
    DpShMCreate: allocated ca_info at 700000000662cf8
    MtxInit: -2 0 0
    Wed May 27 06:01:54 2009
    GwDpInit: attached to gw_adm at 700000000662cc8
    Wed May 27 06:10:42 2009
    ***LOG Q0I=> NiPConnect2: connect (78: Connection timed out) [nixxi.cpp 2823]
    ERROR => NiPConnect2: SiPeekPendConn failed for hdl 20 / sock 31
        (SI_ECONN_REFUSE/78; I4; ST; 20.60.111.105:3300) [nixxi.cpp    2823]
    LOCATION    SAP-Gateway on host bascop11 / sapgw02
    ERROR       partner '20.60.111.105:sapgw00' not reached*
    TIME        Wed May 27 06:10:42 2009*
    RELEASE     700*
    COMPONENT   NI (network interface)*
    VERSION     38*
    RC          -10*
    MODULE      nixxi.cpp*
    LINE        2823*
    DETAIL      NiPConnect2*
    SYSTEM CALL connect*
    ERRNO       78*
    ERRNO TEXT  Connection timed out*
    COUNTER     34**
    GwTraceHdlInfo:
    HANDLE   = 20
    TIME     = Wed May 27 06:09:27 2009
    SOCKET   = 31
    STAT     = NI_CONN_WAIT
    TYPE     = STREAM IPv4
    OUT      = 0 messages 0 bytes
    IN       = 0 messages 0 bytes
    LOCAL    = -
    REMOTE   = -
    OPTIONS  = BUFFERED
      ni hdl      = 20
      type        = REM_GW
      net_stat    = CONNECT_TO_REM_GW_PENDING
      hostaddr    = 20.60.111.105
      opcode      = REMOTE_GATEWAY
      conn opcode = NORMAL_CLIENT
      conn vers   = 50
      index       = 5
      data        = 0
      ext_info    = 11049e1d0
      offset      = 0
      rest_len    = 0
      snc_forced  = 0
    remote gateway infos:
      hostname = basxip1.basell.com
      hostaddr = 20.60.111.105
      service  = sapgw00
      tpname   =
    sap wp info:
      tid = 20
      uid = 21
      mode = 0
      appc_ca_blk = 67
      len = 375
      wp = 20
      wait for answer = 1
      comm_idx = 7
    ERROR => GwErrToAll: mark comm_entry 8 (        ) as deallocated [gwdp.c       2641]
    ERROR => GwErrToAll: mark comm_entry 7 (        ) as deallocated [gwdp.c       2641]
    Wed May 27 06:12:15 2009
    ***LOG Q0I=> NiPConnect2: connect (78: Connection timed out) [nixxi.cpp 2823]
    ERROR => NiPConnect2: SiPeekPendConn failed for hdl 26 / sock 37
        (SI_ECONN_REFUSE/78; I4; ST; 134.81.30.190:3299) [nixxi.cpp    2823]
    GwTraceHdlInfo:
    HANDLE   = 26
    TIME     = Wed May 27 06:11:01 2009
    SOCKET   = 37
    STAT     = NI_CONN_WAIT
    TYPE     = STREAM IPv4
    OUT      = 0 messages 0 bytes
    IN       = 0 messages 0 bytes
    LOCAL    = -
    REMOTE   = -
    OPTIONS  = BUFFERED
      ni hdl      = 26
      type        = REM_GW
      net_stat    = CONNECT_TO_REM_GW_PENDING
      hostaddr    = ::
      opcode      = REMOTE_GATEWAY
      conn opcode = NORMAL_CLIENT
      conn vers   = 68
      index       = 7
      data        = 0
      ext_info    = 11049f4d0
      offset      = 0
      rest_len    = 0
      snc_forced  = 0
    remote gateway infos:
      hostname(route) = /H/134.81.30.190/S/sapdp99/H/147.204.2.5/S/sapdp99/H/oss001
    sap wp info:
      tid = 21
      uid = 22
      mode = 0
      appc_ca_blk = 69
      len = 1521
      wp = 21
      wait for answer = 1
      comm_idx = 7
    ERROR => GwErrToAll: mark comm_entry 7 (        ) as deallocated [gwdp.c       2641]
    Wed May 27 06:27:41 2009
    GwIFreeDiscConn: delete conversation 22058553 (conn=2) in state DISCONNECT
    Kindly suggest us what was the exact prob as it seems that this was due to the N/W related issue but we are not confirm about this.
    Thanks in advance.

    Thanks Rohit for your prompt Reply
    Pls find the logs (dev_w0) as per below:-
    trc file: "dev_w0", trc level: 1, release: "700"     
    ACTIVE TRACE LEVEL           1
    ACTIVE TRACE COMPONENTS      all, MJ
    M sysno      02
    M sid        EBW
    M systemid   324 (IBM RS/6000 with AIX)
    M relno      7000
    M patchlevel 0
    M patchno    169
    M intno      20050900
    M make:      single threaded, ASCII, 64 bit, optimized
    M pid        671770
    M
    M
    M Wed May 27 06:01:17 2009
    M  kernel runs with dp version 240(ext=110) (@(#) DPLIB-INT-VERSION-240)
    M  length of sys_adm_ext is 364 bytes
    M
    M Wed May 27 06:01:18 2009
    M  ***LOG Q01=> ThInit, WPStart (Workproc 0 1 671770) [thxxhead.c   1286]
    M  ThInit: running on host bascop11
    M  calling db_connect ...
    C  Got LIBPATH=/usr/sap/EBW/SYS/exe/run:/opt/CA/CAlib:/opt/CA/SharedComponents/lib:/usr/sap/EBW/SYS/exe/run:/oracle/client/10x_64/in
    C  Oracle Client Version: '10.2.0.2.0'
    C  Client NLS settings: AMERICAN_AMERICA.WE8DEC
    C  Logon as OPS$-user to get SAPR3's password
    C  Connecting as /@EBW on connection 0 (nls_hdl 0) ... (dbsl 700 250407)
    C  Nls CharacterSet                 NationalCharSet              C      EnvHp      ErrHp ErrHpBatch
    C    0 WE8DEC                                                    1  1128a2220  1128ad938  1128ad1e8
    C  Attaching to DB Server EBW (con_hdl=0,svchp=1128aac38,srvhp=1128afc98)
    C
    C Wed May 27 06:01:19 2009
    C  Starting user session (con_hdl=0,svchp=1128aac38,srvhp=1128afc98,usrhp=1128aa040)
    C  Now '/@EBW' is connected (con_hdl 0, nls_hdl 0).
    C  Got SAPR3's password from OPS$-user
    C  Disconnecting from connection 0 ...
    C  Closing user session (con_hdl=0,svchp=1128aac38,usrhp=1128aa040)
    C  Now I'm disconnected from ORACLE
    C  Connecting as SAPR3/<pwd>@EBW on connection 0 (nls_hdl 0) ... (dbsl 700 250407)
    C  Nls CharacterSet                 NationalCharSet              C      EnvHp      ErrHp ErrHpBatch
    C    0 WE8DEC                                                    1  1128a2220  1128ad938  1128ad1e8
    C  Starting user session (con_hdl=0,svchp=1128aac38,srvhp=1128afc98,usrhp=1128aa040)
    C  Now 'SAPR3/<pwd>@EBW' is connected (con_hdl 0, nls_hdl 0).
    C  Database NLS settings: AMERICAN_AMERICA.WE8DEC
    C  DB instance EBW is running on bascop11 with ORACLE version 10.2.0.2.0 since MAY 27, 2009, 06:00:16
    B
    B Wed May 27 06:01:20 2009
    B  Connection 0 opened (DBSL handle 0)
    B  Wp  Hdl ConName          ConId     ConState     TX  PRM RCT TIM MAX OPT Date     Time   DBHost
    B  000 000 R/3              000000000 ACTIVE       NO  YES NO  000 255 255 20090527 060118 bascop11
    M  db_connect o.k.
    M  ICT: exclude compression: .zip,.cs,.rar,.arj,.z,.gz,.tar,.lzh,.cab,.hqx,.ace,.jar,.ear,.war,.css,.pdf,.js,.gzip
    I
    I Wed May 27 06:01:46 2009
    I  MtxInit: 0 0 0
    M  SHM_PRES_BUF               (addr: 700004040000000, size: 20000000)
    M  SHM_ROLL_AREA          (addr: 700004050000000, size: 134217728)
    M  SHM_PAGING_AREA          (addr: 700004060000000, size: 67108864)
    M  SHM_ROLL_ADM               (addr: 700000005e78000, size: 2672386)
    M  SHM_PAGING_ADM          (addr: 700004070000000, size: 656416)
    M  ThCreateNoBuffer          allocated 324144 bytes for 1000 entries at 700004080002000
    M  ThCreateNoBuffer          index size: 3000 elems
    M  ThCreateVBAdm          allocated 7040 bytes (50 server) at 700000006106000
    X  EmInit: MmSetImplementation( 2 ).
    X  MM global diagnostic options set: 0
    X  EM/TOTAL_SIZE_MB = 262144
    B  dbntab: NTAB buffers attached
    B  dbntab: Buffer FTAB(hash header)  (addr: 700004080053088, size: 504)
    B  dbntab: Buffer FTAB(anchor array) (addr: 700004080053280, size: 480104)
    B  dbntab: Buffer FTAB(item array)   (addr: 7000040800c85e8, size: 1920000)
    B  dbntab: Buffer FTAB(data area)    (addr: 70000408029d1e8, size: 30720000)
    B  dbntab: Buffer IREC(hash header)  (addr: 700004081feb088, size: 504)
    B  dbntab: Buffer IREC(anchor array) (addr: 700004081feb280, size: 480104)
    B  dbntab: Buffer IREC(item array)   (addr: 7000040820605e8, size: 480000)
    B  dbntab: Buffer IREC(data area)    (addr: 7000040820d58e8, size: 6144000)
    B  dbntab: Buffer STAB(hash header)  (addr: 7000040826b3088, size: 504)
    B  dbntab: Buffer STAB(anchor array) (addr: 7000040826b3280, size: 480104)
    B  dbntab: Buffer STAB(item array)   (addr: 7000040827285e8, size: 480000)
    B  dbntab: Buffer STAB(data area)    (addr: 70000408279d8e8, size: 3072000)
    B  dbntab: Buffer TTAB(hash header)  (addr: 700004082a8d088, size: 3104)
    B  dbntab: Buffer TTAB(anchor array) (addr: 700004082a8dca8, size: 480104)
    B  dbntab: Buffer TTAB(item array)   (addr: 700004082b03010, size: 1200000)
    B  dbntab: Buffer TTAB(data area)    (addr: 700004082c27f90, size: 5640000)
    B  db_con_shm_ini:  WP_ID = 0, WP_CNT = 25, CON_ID = -1
    B  dbstat: TABSTAT buffer attached (addr: 7000040a000bb90)
    B  dbtbxbuf: Buffer TABL  (addr: 7000040b0000100, size: 50000000, end: 7000040b2faf180)
    B  dbtbxbuf: Buffer TABLP (addr: 7000000087da100, size: 20480000, end: 700000009b62100)
    B  dbexpbuf: Buffer EIBUF (addr: 700000009b64108, size: 40960000, end: 70000000c274108)
    B  dbexpbuf: Buffer ESM   (addr: 7000040c0000108, size: 204800000, end: 7000040cc350108)
    B  dbexpbuf: Buffer CUA   (addr: 70000408318e108, size: 5120000, end: 700004083670108)
    B  dbexpbuf: Buffer OTR   (addr: 7000040d0000108, size: 4194304, end: 7000040d0400108)
    B  dbcalbuf: Buffer CALE  (addr: 70000000c276000, size: 500000, end: 70000000c2f0120)
    M  CCMS: AlInitGlobals : alert/use_sema_lock = TRUE.
    S
    S Wed May 27 06:01:48 2009
    S  *** init spool environment
    S  initialize debug system
    T  Stack direction is downwards.
    T  debug control: prepare exclude for printer trace
    T  new memory block 112bc2e90
    S
    S Wed May 27 06:01:49 2009
    S  spool kernel/ddic check: Ok
    S  using table TSP02FX for frontend printing
    S  1 spool work process(es) found
    S  frontend print via spool service enabled
    S  printer list size is 150
    S  printer type list size is 50
    S  queue size (profile)   = 300
    S  hostspool list size = 3000
    S  option list size is 30
    S      found processing queue enabled
    S  found spool memory service RSPO-RCLOCKS at 700004083672060
    S  doing lock recovery
    S  setting server cache root
    S  found spool memory service RSPO-SERVERCACHE at 7000040836726e8
    S    using messages for server info
    S  size of spec char cache entry: 165024 bytes (timeout 100 sec)
    S  size of open spool request entry: 1248 bytes
    S  immediate print option for implicitely closed spool requests is disabled
    A
    A Wed May 27 06:01:50 2009
    A
    A          PXA          
    A     PXA      IN     ITIALIZATION     
    A  PXA: Locked PXA-Semaphore.
    A  System page size: 4kb, total admin_size: 45276kb, dir_size: 22552kb.
    A  Attached to PXA (address 7000040e0000000, size 800000K, 2 fragments of 377364K )
    A  abap/pxa = shared unprotect gen_remote
    A  PXA INITIALIZATION FINISHED
    A          PXA          
    A                    
    A
    A Wed May 27 06:01:51 2009
    A  ABAP ShmAdm attached (addr=700003f403ad000 leng=20955136 end=700003f417a9000)
    A  >> Shm MMADM area (addr=700003f407792f0 leng=261120 end=700003f407b8ef0)
    A  >> Shm MMDAT area (addr=700003f407b9000 leng=16711680 end=700003f417a9000)
    A  RFC Destination> destination bascop11_EBW_02 host bascop11 system EBW systnr 2 (bascop11_EBW_02)
    A  RFC Options> H=bascop11,S=02,d=1,
    A  RFC FRFC> fallback activ but this is not a central instance.
    A
    A  RFC rfc/signon_error_log = -1
    A  RFC rfc/dump_connection_info = 0
    A  RFC rfc/dump_client_info = 0
    A  RFC rfc/cp_convert/ignore_error = 1
    A  RFC rfc/cp_convert/conversion_char = 23
    A  RFC rfc/wan_compress/threshold = 251
    A  RFC rfc/recorder_pcs not set, use defaule value: 1
    A  RFC rfc/delta_trc_level not set, use default value: 0
    A  RFC rfc/no_uuid_check not set, use default value: 0
    A  RFC rfc/bc_ignore_thcmaccp_retcode not set, use default value: 0
    A  RFC Method> initialize RemObjDriver for ABAP Objects
    M
    M Wed May 27 06:01:52 2009
    M  ThrCreateShObjects          allocated 51666 bytes at 70000000c8ac000
    N  SsfSapSecin: putenv(SECUDIR=/usr/sap/EBW/DVEBMGS02/sec): ok
    N
    N  =================================================
    N  === SSF INITIALIZATION:
    N  ===...SSF Security Toolkit name SAPSECULIB .
    N  ===...SSF trace level is 0 .
    N  ===...SSF library is /usr/sap/EBW/SYS/exe/run/aix-5.1.0-64/libsapcrypto.o .
    N  ===...SSF hash algorithm is SHA1 .
    N  ===...SSF symmetric encryption algorithm is DES-CBC .
    N
    N Wed May 27 06:01:53 2009
    N  ===...completed with return code 5.
    N  =================================================
    N
    N Wed May 27 06:01:54 2009
    N  MskiInitLogonTicketCacheHandle: Logon Ticket cache pointer retrieved from shared memory.
    N  MskiInitLogonTicketCacheHandle: Workprocess runs with Logon Ticket cache.
    M  JrfcVmcRegisterNativesDriver o.k.
    W  =================================================
    W  === ipl_Init() called
    B    dbtran INFO (init_connection '<DEFAULT>' [ORACLE:700.08]):
    B     max_blocking_factor =   5,  max_in_blocking_factor      =   5,
    B     min_blocking_factor =   5,  min_in_blocking_factor      =   5,
    B     prefer_union_all    =   0,  prefer_join                 =   0,
    B     prefer_fix_blocking =   0,  prefer_in_itab_opt          =   1,
    B     convert AVG         =   0,  alias table FUPD            =   0,
    B     escape_as_literal   =   1,  opt GE LE to BETWEEN        =   0,
    B     select *            =0x0f,  character encoding          =SBCS / <none>:-,
    B     use_hints           = abap->1, dbif->0x1, upto->2147483647, rule_in->0,
    B                           rule_fae->0, concat_fae->0, concat_fae_or->0
    W    ITS Plugin: Path dw_gui
    W    ITS Plugin: Description ITS Plugin - ITS rendering DLL
    W    ITS Plugin: sizeof(SAP_UC) 1
    W    ITS Plugin: Release: 700, [7000.0.169.20050900]
    W    ITS Plugin: Int.version, [33]
    W    ITS Plugin: Feature set: [16]
    W    ===... Calling itsp_Init in external dll ===>
    W  === ipl_Init() returns 0, ITSPE_OK: OK
    W  =================================================
    N  VSI: WP init in ABAP VM completed with rc=0
    E  Replication is disabled
    E  EnqCcInitialize: local lock table initialization o.k.
    E  EnqId_SuppressIpc: local EnqId initialization o.k.
    E  EnqCcInitialize: local enqueue client init o.k.
    S
    S Wed May 27 06:01:55 2009
    S  server     bascop11_EBW_02      appears or changes (state 1)
    S  server     bascop11_EBW_02      appears or changes (state 1)
    M
    M Wed May 27 06:02:06 2009
    M  SosICreateNewAnchorArray: sos_search_anchor_semantics = 1
    M
    M Wed May 27 06:02:23 2009
    M  SecAudit(RsauShmInit): WP attached to existing shared memory.
    M  SecAudit(RsauShmInit): addr of SCSA........... = 700000020000000
    M  SecAudit(RsauShmInit): addr of RSAUSHM........ = 700000020000450
    M  SecAudit(RsauShmInit): addr of RSAUSLOTINFO... = 700000020000488
    M  SecAudit(RsauShmInit): addr of RSAUSLOTS...... = 700000020000494
    B

  • Invalid Key Specification with DESEde algorithm and SecretKeySpec

    Anyone know why attempting to create a SecretKeySpec with a byte array and the algorithm "DESede" would fail, while passing the same bytes to the DESedeSecretKeySpec constructor works? The exception from the former (see below for relevant snippet) claims that the key specification is invalid. I saw this bug which seems related, but is marked closed, so am not sure what's happening: http://bugs.sun.com/bugdatabase/view_bug.do;jsessionid=1371755199b0c24e4871e29a6028d?bug_id=4364490.
    Some of the stack trace from attempting to use SecretKeySpec:
    Caused by: java.security.spec.InvalidKeySpecException: Inappropriate key specification
         at com.sun.crypto.provider.DESedeKeyFactory.engineGenerateSecret(DashoA13*..)
         at javax.crypto.SecretKeyFactory.generateSecret(DashoA13*..)
         atEdited by: jgold on Jan 21, 2010 8:39 AM

    Please post the code for both and a typical key byte array. You might also want to say which version of Java on which OS.

  • Modify A* Algorithm

    Hi All! I have this A* Algorithm (pathfinding in games) and I'm trying to modify it to return the path closest to the destination if a path the the destination is unavailable....! I have a 2D grid as the map....
    Here's the code
    package kodekombat_bot;
    import java.util.Comparator;
    import java.util.Deque;
    import java.util.Iterator;
    import java.util.LinkedList;
    import java.util.PriorityQueue;
    import java.util.Queue;
    public final class AStar {
         private static class CostComparator implements Comparator<Node> {
              public int compare(Node nodeA, Node nodeB) {
                   return (nodeA.gcost + nodeA.hcost) - (nodeB.gcost + nodeB.hcost);
         class Node {
              final int x;
              final int y;
              Node parent;
              int gcost;
              int hcost;
              public Node(int x, int y) {
                   assert x >= 0 && x < map.width : "x = " + x;
                   assert y >= 0 && y < map.height : "y = " + x;
                   this.x = x;
                   this.y = y;
              public void calculateHeuristic() {
                   hcost = (Math.abs(x - destination.x) + Math.abs(y - destination.y)) * (VERTICAL_COST + HORIZONTAL_COST) / 2;
              public void setParent(Node parent) {
                   this.parent = parent;
                   if (parent.x == x) {
                        gcost = parent.gcost + HORIZONTAL_COST;
                   } else if (parent.y == y) {
                        gcost = parent.gcost + VERTICAL_COST;
                   } else {
                        gcost = parent.gcost + DIAGONAL_COST;
              @Override
              public String toString() {
                   return "(" + x + ", " + y + " : " + super.toString() + ')';
         private static final CostComparator COST_CMP = new CostComparator();
         private final int VERTICAL_COST = 10;
         private final int HORIZONTAL_COST = 10;
         private final int DIAGONAL_COST = (int) Math.rint(Math.sqrt(VERTICAL_COST * VERTICAL_COST + HORIZONTAL_COST
             * HORIZONTAL_COST));
         private final Map map;
         private final Node origin;
         private final Node destination;
         private final Queue<Node> open;
         private final int[] closed;
         public AStar(Map map, int originX, int originY, int destinationX, int destinationY) {
              assert map != null : "map = " + map;
              this.map = map;
              destination = new Node(destinationX, destinationY);
              origin = new Node(originX, originY);
              open = new PriorityQueue<Node>(Math.max(map.width, map.height) * 2, COST_CMP);
              closed = new int[(map.width * map.height >> 5) + 1];
          * Adds the node at {@code x}, {@code y} to the open list, using {@code parent} as the parent.
          * <p>
          * If the node was already added to the open list, the old value is either kept or replaced,
          * depending on whether the old one is closer to the origin or not.
          * </p>
          * @param x
          * @param y
          * @param parent
         private void addToOpen(int x, int y, Node parent) {
              Node openNode = new Node(x, y);
              openNode.setParent(parent);
              replacing: for (Iterator<Node> i = open.iterator(); i.hasNext();) {
                   Node existing = i.next();
                   if (existing.x == x && existing.y == y) {
                        if (existing.gcost > openNode.gcost) {
                             i.remove();
                             break replacing;
                        } else {
                             return;
              openNode.calculateHeuristic();
              open.add(openNode);
          * Starts the algorithm and returns true if a valid path was found.
          * @return
         public boolean findPath() {
              Node current = origin;
              while (current != null && (current.x != destination.x || current.y != destination.y)) {
                   process(current);
                   current = open.poll();
              if (current != null) {
                   destination.setParent(current.parent);
              return current != null;
         public Deque<Integer> getPath() {
              assert destination.parent != null || (destination.x == origin.x && destination.y == origin.y);
              Deque<Integer> path = new LinkedList<Integer>();
              Node current = destination;
              while (current != null) {
                   path.addFirst(current.y);
                   path.addFirst(current.x);
                   current = current.parent;
              return path;
          * Checks whether a node was already processed.
          * @param x
          * @param y
          * @return
         private boolean isClosed(int x, int y) {
              int i = map.width * y + x;
              return (closed[i >> 5] & (1 << (i & 31))) != 0;
          * Processes the passed node.
          * <ul>
          * <li>Adds it to the closed list.</li>
          * <li>Adds all adjacent nodes to the open list, if it was not processed yet and is walkable.</li>
          * </ul>
          * @param node
         private void process(Node node) {
              // no need to process it twice
              setClosed(node.x, node.y);
              // respect the array bounds
              int lX = node.x == 0 ? 0 : node.x - 1;
              int uX = node.x >= map.width - 1 ? map.width - 1 : node.x + 1;
              int lY = node.y == 0 ? 0 : node.y - 1;
              int uY = node.y >= map.height - 1 ? map.height - 1 : node.y + 1;
              // check all the neighbors
              for (int x = lX; x <= uX; ++x) {
                   for (int y = lY; y <= uY; ++y) {
                        if (!isClosed(x, y) && map.isWalkable(x, y)) {
                             addToOpen(x, y, node);
          * Sets the node at {@code x}, {@code y} to "already been processed".
          * @param x
          * @param y
         private void setClosed(int x, int y) {
              int i = map.width * y + x;
              closed[i >> 5] |= (1 << (i & 31));
    }Note: The function "isWalkable" returns true or false if the path is walkable or not...
    This is for a bomberman game AI...thanks a lot for all your help!

    +[removed previous post]+
    Edited by: prometheuzz on Feb 13, 2008 3:30 PM
    Cross posted in the Games-section of the forum.
    @OP: please don't post the same questions in multiple forums without mentioning this. That way, people might advise you something that has already been suggested in another thread, thus wasting people's time!

  • Algorithm comparison FLOPS

    Hi Everybody,
    Is there a method to compare two algorithms in Labview(v.7) when it comes to their floating point calculations or number of FLOPS?
    I am looking to compare two algorithm (roughly),  something like FLOPS command in Matlab if any. I know one way for performance comparison might be comparing their looped execution time. But any FLOPS alike command ?
    Thanks

    Hed wrote:
    FLOPS is just the number of floating point operations.
    The more common definition is "FLoating point Operations Per Second", comparing different hardware with the same algorithm.
    http://en.wikipedia.org/wiki/FLOPS
    (You seem to be using the plural definition of FLOP, which is not as common, comparing the number of operations needed to perform a certain task, irrespecitve of hardware).
    Both definitions are not really useful to compare two algorithms in LabVIEW. The only thing you should do is compare the timed performance between the two algorithms. Be aware that even the same algorithm can be implemented more or less efficient, depending on the skill and knowledge of the programmer. Make yourself a small bechmarking operation as a three-frame flat sequence. Make sure that nothing can run in parallel with the middle frame. Pure coding cosiderations such as "inplaceness" and avoidance of extra datacopes are crucial for very efficient code.
    Take a tick count in each edge frame and place your code in the middle. If it is a fast code, put it in a loop for a few million iterations. Take the difference in tick count and divide it by the number of iterations, convert to seconds, and display it in SI units e.g. 45u (=45microseconds) per loop.
    Watch out for constant folding. If your loop is folded into a constant, you might get false ultrafast readings. If you have LabVIEW 8.5, try the new inplace structure.
    If you are dealing with variable size arrays, measure the speed as a function of array size: Is the execution time linear with N, with NlogN, with N*N, etc. How is the memory use? Plot log(time) vs. log(size). What is the slope of the curve? Are there any breaks? (e.g. when you exceed the cache size or when you start swapping).
    If you are running on a multipurose OS (e.g. windows, mac, linux), there are many other things running at any given time, so the speed will have some variations. Some people are tempted to e.g. take the average, while the fastest speed is probably a better measure of true speed.
    You can norrow the variation by raising the priority of the subVI (careful!). If the computation is within a subVI, you should make sure that the front panel of the subVI is closed. Often, you gain speed by disabling debugging.
    If you have multiple CPUs/cores, watch the task manager? Are both being used? Code optimized for multicore might have a slight penalty on a single code system.
    LabVIEW RT has much tighter controls on execution and you can debug down to the clock tick using the execution trace toolkit(http://sine.ni.com/nips/cds/view/p/lang/en/nid/13746). I am not familiar with RT, though.
    Anyway, I am curious what kind of algorithms you are trying to test. Maybe it is of general interest. You could even start an informal "coding callenge" to tap into the collective wisdom of the forum members.
    For some ideas, here is a link to the coding challenge archive: http://zone.ni.com/devzone/cda/tut/p/id/5174
    LabVIEW Champion . Do more with less code and in less time .

  • Smart flash cache algorithm

    I'd like to understand exactly how smart flash cache algorithm works.
    I’ve read the Oracle white paper on smart flash cache. It says following:
    Exadata Smart Flash Cache provides an automated caching mechanism for frequently-accessed data in the Exadata Database Machine.
    What is the algorithm to figure out "frequently accessed data”?
    It also say following -
    The Oracle Database and Exadata Storage Server Software work closely together to cache frequently accessed data.
    When the database sends a read or write request to Exadata Storage Server, it includes additional information in the request about whether the data is likely to be read again and therefore whether it should be cached.
    Again what's the algorithm to figure out that data is likely to be read again?
    Does it simply cache all random reads against tables and indexes and ignores all sequential reads, scans, writing backups and mirrored blocks?
    I’ve also read that, Exadata tags each DB I/O is with metadata indicating I/O type which influence caching . Can somebody shed light on what are various I/O types and which ones are cached?

    user12254641 wrote:
    Thanks for your inputs.
    I see it knows what not to cache.
    However I was wondering if it has any special algorithm to decide frequently accessed data.
    It seems it will cache all random read/writes and of course file headers and control files.There are really two parts to caching: 1) what to cache and 2) the management of cached data.
    Assuming cell_flash_cache = default for these segments: index/table, any single block operation is cached. Also IIRC, multi-block reads (but not smart scan multi-block reads) are also cached, up until a certain size (64k or 128K are numbers that comes to mind, but I don't have the code open to check at this moment).
    The cache management is basically LRU based, like the db buffer cache -- frequently accessed data is kept on the hot end, and data is aged out on the cold end and replaced.
    While I'm sure "algorithms" are interesting for the geek in us, I 'm not sure how this info aids in any management or decision making. Questions are generally better formulated discussing what you would like to do so that appropriate advice can be given. You're question is context free.
    Regards,
    Greg Rahn | blog | twitter | linkedin

  • What is effect of closing account?

    Now that Cap One is making it as easy as pie to merge one account into another, one question I have is what effect will the closing of the merged account have on my score? In my case, e.g., I would be merging a 1 year old account into a 3 year old account. The 1 year old account would be closed. How would this transaction be interpreted by the FICO algorithm monster?

    Hello SJ!  Always good to see you on here. This looks like another one of your posts where I learn something new.  I didn't know there was such a thing as "merging", though I am not surprised.  I can certainly answer the "FICO monster" question as long as I am sure I understand what merging in this case means for the credit bueaus. If I understand you right, it means that Cap 1 will be transfering the balance from the 1-year account onto the 3-year account.  And then they will update your 1- year account with the status "closed" (with a date closed as of the day that the merge occured).  But the act of merging doesn't result in your 1-year account being deleted from the three CRAs -- just closed.  Your 3-year account will have the same credit limit as it did before the merge.  Is that all correct? If I got all that right (there were several assumptions) then it's easy to figure out what FICO will do.  You will have a new total credit limit -- whatever your previous limit was minus the CL of the closed card.  That will have a small effect on your total U, easy for you to figure that out.  Your AAoA will not change in any way, since the closed account is still on your reports and will continue to age.  10 years from now the closed account will fall off your reports, having a small effect on your AAoA. As you can see, the key question is not What Will FICO Do (there should be a tshirt for that), but what will the CRA do?  The key questions are (1) whether the 1-year account is deleted from the report or simply closed and (2) whether the 3-year account still has the same CL as it did before.  I don't know how Cap 1 works with that.  But once you know the answers to the CRA question, then you can answer the FICO question.

  • Encoder data into a PD closed control loop

    Hey, basically for our current project, we have to create a program that will run through a cRio for a buggy, the buggy has 2 motors of maximum 12V supply. The bugggy must travel a certain distance, 8m, over an uneven distance and end up at a particular end point.
    we are currently trying to create a a closed loop control system with a ramp input, then a Proportional Derivative system to alter the error from the encoders, which record the actual speed of the wheels.
    However we are unsure about how to go about creating this in labview or simulate this as we do not have access to the actual practical equipment at the moment, any help or links to guides about how to go about this or general help would be greatly appreciate, feel free to ask any questions if i have I can be clear about anything anymore, but we are really struggling atm.

    Thanks for replying,
     Basically we arent using a control and simulation loop anymore as it was proving to be too advanced for what we need to do. We arent using any toolkit in particular, however our vi is within a case structure, the attached folder is the vi that we have created so far.
    The simulated signals are to represent the encoder velocity values that we will obtain. If you can help us with any of the following it would be of great help:
    1. We currently a ramp input to simulate the acceleration at the start but are unsure on how to keep a constant velocity after the maximum velocity is reached and to have a deceleration at the end.
    2. We are unsure if what we have as P controller will actually minimise the error between desired velocity and actual velocity
    3. We dont have a stop condition, it has to travel a known distance, can this be worked out from the data gathered from the encoders and a stop condition created?
    We have access to the majority of applicable toolkits, shown in the attached photo.
    Any guidance would be greatly appreciated.
    Attachments:
    buggy control algorithm.vi ‏65 KB
    Tool pallette.png ‏39 KB

  • Planning time fence with Lot size MB

    Hi Friends,
    I am facing one issue as below,
    I am using MRP type P3 , Planning time fence is 20 days , Lot size is MB (Monthly).  I am not using MRP group.
    Planning time fence should be calculated as Todays date+Planning time fence on MRP1 but if the calculated date with this formula is going in next month system takes first date of next following month as Planning time fence (effect of lot size MB).
    WIth lot size EX , it works fine.
    Can we avoid shifting of Planning time fence to first date of following month with lot size MB?
    Thanks.
    Sandeep

    I got  a workaround  , I have used 2 lot sizing procedure in  a sigle lot size. Daily lot size (for Short term) and Monthly lot size for Long term. For short term requirements are grouped for 28 days. Closing the thread. Thanks.

Maybe you are looking for

  • Pinch to zoom not working properly in Safari 5.1

    I have OS X 10.6.8 (downloading lion as i type). I updated safari this morning and ever since I did that, pinch to zoom isnt working right. I can pinch to zoom in, to a certain extent but I can not get as large as I want as I used to and I cannot zoo

  • Problem in saving oracle report

    Hi, I am into creating a matrix report.I am able to run it successfuly.But i am unable to save the file once after the data model hasd been defined.But i am able to run it without saving it.When i try tosave it,it is showing error like rwbuilder.exe

  • TextEdit won't display recent files

    TextEdit won't display recent files!  THIS USED TO WORK-- but now all I see is the words (greyed-out) "Clear Menu".  Not even sure what that means. My recent files works fine in WORD and other applications that offer this.  Any comments appreciated a

  • Uploading data in the table from mysql db, any help is welcome

    Hi, I have made a table with two columns, "Name" and "ID". Those are binded to contexts NameCtx and IDCtx. There are ten rows in table. What I need to do is upload Names and IDs from mysql database and fill those rows from 1 to 10 and I dont have muc

  • Safari crashed while watching Netflix movie; now crashes repeatedly.

    I was watching a Netflix movie and Safari crashed. Now it crashes repeatedly, as soon a a load a page or two. Below please find my crash report. I would greatly appreciate any assistance. Thanks, Lawrence Process: Safari [183] Path: /Applications/Saf