A counting algorithm

I am suppose to print out tickets with a running number. This ticket is design in MS Words, however my problem is that I have no idea as to how to implement this running number on the ticket. And since I am most familiar with java, I hope it would be able to do something.
If anyone has a solution or could point me in the right direction, I would be very much grateful.

Your questions is kind of vague but here is a guess:
Use Java to create a file containing the ticket number (formatted for Word's mail merger), change the ticket number in the document to be a mail merge field, and merge the two files.
Not sure if this is what you need as it is a pretty manual process.

Similar Messages

  • SS9 CC5.6 compiler bug - algorithm count confused with struct member

    Found some code that fails to compile in CC 5.6
    CC: Sun C++ 5.6 2004/07/15
    #include <algorithm>
    using namespace std;
    struct A {
      int count;   
    struct B
      struct A *a;
    int main(int argc, char **argv)
      struct B *b = 0;
      // This line fails to build, any other operator is ok
      if ( b->a->count < 50 )
      return (1);
    }Fails with error :
    "c56_algorithm_bug.cpp", line 21: Error: Unexpected ")" -- Check for matching parenthesis.
    "c56_algorithm_bug.cpp", line 22: Error: "," expected instead of "{".
    "c56_algorithm_bug.cpp", line 22: Error: Illegal value for template parameter.
    "c56_algorithm_bug.cpp", line 22: Error: ")" expected instead of "{".
    4 Error(s) detected.The compiler is getting confused with the use of the count struct member vs the count algorithm. Changing the < to a > fixes the problem.
    Using CC5.3 works fine as well as all other compilers we use (gcc 3.4, mipspro 7.4, VC 7.1)
    Anyone seen this ?
    - mark

    This bug has been fixed in the C++ 5.6 compiler. I'm not sure if the fix is in the first patch which is about to be released. If not, the fix definitely will be in the next patch.
    The workaround is not to use
    using namespace std;That using-declaration is a pretty big hammer, and often results in conflicts with user code, compiler bugs aside.

  • Announce: Generic Algorithms for Java, 0.3 release

    The latest release of jga: Generic Algorithms for Java is now available at
    http://jga.sf.net/
    Included in this release are a collection of algorithms adapted from STL that operate over generic collections and iterations. What's included are the algorithms that do not attempt to modify the collection/iteration that they're given: in other words, all of the find/search/count algorithms. Also included are the complete set of functors and predicates that were present in the last release, with a few modifications for easier use.
    The library is released under the LGPL, and includes the source for the library, the test framework, and a non-genericized version of the test framework that verifies that the library may be used without having the generic environment available.

    A (similar, it seems) parameterized collections library for JSR-14 Java.I had looked at JUtil some time ago, and I'm not sure of the similarity: JUtil looks to provide a number of interesting (if somewhat specialized) collections. JGA provides functors & predicates, and STL-ish algorithms that operate on collections and iterators. Looks to me to be more complimentary than similar.
    Mr. Ananian/Astaire's site is also the source of SinjDoc, the javadoc tool that I used to generate the javadoc at jga.sf.net, and with which I replaced the munge4doc.pl and mungedoclist.pl scripts that I had previously used and posted on this forum.

  • Buffer_pool & db_keep_cache_size

    Our database is 10.2.0.3 with 2 nodes RAC. The database servers are window 2003.
    I ran the query “select * from dba_tables where buffer_pool = 'KEEP'” and get 6 records come back. Some tables are pretty big.
    I ran “select sum(blocks) * 8192 from dba_tables where buffer_pool = 'KEEP'” and get:
    5489451008
    The parameter for db_keep_cache_size is 1073741824 for both instances.
    My question is: How Oracle handles this if Oracle allocated memory is smaller than the requested space? What are the impacts on the performance?
    Thanks,
    Shirley

    Yes, a buffer pool is a buffer pool and is managed as such. Each type of pool may have has some unique logic especially for how data is selected to go into the pool (keep, recycle, 16K block size, 2K block size) but when all else is said and done the end product is a buffer cache that has to be managed.
    Personally, I am not a fan of using multiple buffer pools. For most situations Oracle can probably do a better job of deciding what blocks to keep and purge from one large buffer cache than most DBA's can do by using the normal buffer cache, a keep, and a recycle pool. Over time the application data and usage changes. The pool configuration probably is not checked regularly enough to keep it properly aligned.
    Besides Oracle really uses a modified for touch count algorithm to manage the buffer cache instead of the documented LRU. Call it a modified LRU algorithm so the need to use a keep and/or recycle really isn’t there for most shops.
    IMHO -- Mark D Powell --

  • Identifying candidates for KEEP pool

    Hi,
    recently a DBA I know was asked to make a list of candidates for KEEP pool in buffer cache. He's not familiar with the application. Is there an automated way to do this, or is this something that only someone familiar with the business logic can do manually?
    I googled a bit on the subject, but haven't found much except for Mr. Burleson's scripts (who has a history of giving idiotic advice so I don't trust him) or rather general theoretical discussions (like the thread on AskTom). I'm interested in someone who has done it (or learned why this cannot be done) himself sharing his experience.
    Thanks in advance!
    Best regards,
    Nikolay

    rp0428 wrote:
    Jonathan - none of those referenced articles seem to have a recommendation as to what is appropriate for the KEEP cache. There is a mention of a large frequently used object.eey
    I thought that small lookup tables that were frequently used were the best candidates for the KEEP pool. Is this not the case?
    That suggestion was a consequence of a bug with the touch count algorithm that has been fixed. If blocks were read by TABLESCAN then their touch count was never incremented, so they would always fall off the end of the buffer cache LRU fairly promptly, hence putting them into a KEEP cache would solve the problem. However if the table was being used as a lookup table - with primary key access - the problem didn't arise and if it were a popular lookup then the normal LRU mechanism would keep it cached.
    Can you provide any links to your books or articles that have a recommendation on how to select objects for the keep pool?I don't think there are any - I think it's only possible to make a highly generic statement and then think about individual cases and watch out for unexpected side effects. (That's what my comments above, and the articles, are about).
    From my perspective - every time I've tried to beat the LRU by creating a KEEP pool I haven't managed to do any better than the default LRU and all I've managed to do is limit the flexibility of the system by carving a load of memory off the main cache.
    I have used the KEEP pool successfully - but not for "KEEP"ing; I've used it simply to cache LOBs in a small part of the cache. I've also had a couple of successes with the RECYCLE pool as a damaged limitation mechanism.
    Regards
    Jonathan Lewis
    http://jonathanlewis.wordpress.com
    Author: <b><em>Oracle Core</em></b>

  • How to keep track of client in rmi server

    how can I keep track of a disconnected client in a rmi server ?
    And what logic do I use to disconnect a client fro mthe server ?

    When a RMI client receives a stub to the remote object, RMI client runtime sends a dirty() call to the RMI server runtime which in turn helps the RMI server runtime in updating the client references to the remote object. Client reference is nothing but a unique identification generated by client RMI runtime for that instance of JVM. RMI uses a reference counting algorithm for destroying unreferenced remote objects. Once all references (all clients who are holding the stub to this remote object) to a remote object drops to zero, local garbage collector takes care of freeing this remote object.
    RMI client runtime initiates a TCP connection with the remote object only when a method is invoked on the stub. RMI transport layer uses a simple connection pooling mechanism to use already established TCP connections with server objects in further remote method invocations. Let's say the client is invoking a remote method on the remote object's stub fetched from the registry service. Now RMI transport layer initiates a TCP connection with the remote object (exported at ("host1", 4567)). After completion of the remote method, RMI client's transport layer keeps the connection open for some time (some configurable value) to take the advantage of the already established TCP connection in future remote method invocations on remote objects exported on the same host and port ("Host1", 4567"). RMI transport layer also takes care of closing these connections if the connections are idle more than configured value of connection open time.
    From the RMI server's perspective, once the RMI server runtime receives a remote method invocation request from the RMI client, it creates a new thread and try to dispatch the method on the designated remote object. After returning the results of the remote method to the client, RMI client's transport layer may not end this conservation with this remote object to take the advantage of this TCP connection in future remote method invocations. So the same thread may be used for dispatching another remote method in future. This is actually the side effect of re-using the established TCP connections on the client side.
    RMI server maintains client's reference in the client's reference set of the remote object as long as the client holds a normal reference to remote object's stub in its JVM. Once the client relinquishes the reference to the stub (goes out of the scope or setting it to the null), RMI client automatically sends clean() call to the RMI server runtime to update client reference set of the remote object. There is no public API to lookup or manipulate the client references for a given remote object, but you can always unexport the remote object even some clients are holding stubs to the remote object. Next time when the client invokes the remote method using this stub, client will receive a "connection refused exception" from the server because the remote object is already unexported. Let's say if the RMI server is started again (remote object is exported and registered with registry service), the client once again obtains the stub to the remote object from the registry service instead of using earlier stale stub. (This time remote object may have been exported on different port, so the port details in the old stub may not be valid any more).
    At any point of time there can be more than one established TCP connection with the RMI client. This may be the temporary condition; RMI client's transport layer automatically closes these connections if it does not receive any remote method invocation requests with in a pre-determined interval of time (default: 2 min). You can always find out RMI client's host in a given remote invocation by using getClientHost(), but how can you semantically define a "disconnected client in a rmi server" in your application context ? You can always force all the clients to fetch the stub again in future remote method invocations by unexporting the remote object in RMI server. I hope this information helps ...
    -- Srinath Mandalapu

  • LRU and CKPTQ in database buffer cache

    Hi experts out here,
    This functionality will work out in Database buffer cache of Oracle 10.2 or greater.
    Sources:OTN forums and Concepts 11.2 guide
    As per my readings.To improve the funtionality and make it more good Database Bufer cache is divided into several areas which are called workareasNow further
    zooming this each workarea will store multiple lists to store the buffers inside the database buffer cache.
    Each wrokarea can have one or more then one lists to maintain the wrokordering in there.So the list each workarea will have is LRU list and CKPTQ list.LRU list
    is a list of pinned,free and dirty buffers and CKPTQ is a list of Dirty buffers.We can say CKPTQ is a bundled of dirty buffers in low RBA ordering and ready to be flushed from cache to disk.
    CKPTQ list is maintained in low RBA ordering.
    As being novice let me clear about low RBA and High RBA first
    RBA is stored in the block header and will give us the information about when this block is changed and how many times it is changed.
    Low RBA : the low RBA is the address of the redo for the first change that was applied to the block since it was last clean,
    high RBA : the high RBA is the address of the redo for the most recent change to have been applied to the block.
    Now Back to CKPTQ
    It can be like this (Pathetic diagram of CKPTQ)
    lowRBA==================================High RBA
    (Head Of CKPTQ)                         (Tail Of CKPTQ)
    CKPTQ is a list of Dirty buffers.As per RBA concept.The most recent buffer modified is at the tail of CKPTQ.          
    Now oracle process starts and Try to Get buffer from DB cache if it gets a Buffer it will put a buffer MRU end of the LRU list.and buffer will become the most
    recently used.
    Now if process cant find a required buffer.then first it will try to find out Free buffer in LRU.And if it finds it its over it will place a datablock from datafile to the
    place where free buffer was sitting.(Good enough).
    Now if process cant fnd a Free buffer in LRU then First step would be it will find some Dirty buffers from the LRU end of the LRU list and place them on a
    CKPTQ(Remeber in low order of RBA it will arrange it in CKPT queue). and now oracle process will take required buffer and place it on the MRU end of LRU list.(Because space has been acclaimed by moving Dirty buffers to CKPTQ).
    I am sure that from CKPTQ the buffers(to be more accurate Dirty buffers) will move to datafiles.all the buffers are line up n CKPTQ in lower RBA first manner.But
    will be flushed to datafile how and in which manner and what event?
    This is what i understand after last three days flicking through blogs,forums and concepts guide.Now what i am missing please clear me out and apart from that
    i cant link the following functionalities with this flow..that is
    1)How the incremental checkpoint work with this CKPTQ?
    2)Now what is that 3 seconds timeout?
    (Every 3 seconds DBWR process will wake and find if anything there to write on datafiles for this DBWR will only check CKPTQ).
    3)apart form 3 second funda , when CKPTQ the buffers will be moved??(IS it when Process cant find any space in CKPTQ to keep buffers from LRU.ITs a
    moment when buffer from CKPTQ will be moved to disk)
    4)Can you please relate when control file will be updated with checkpoint so it can reduce recovery time?
    To many ques but i am trying to build up the whole process in mind that how it works may be i can be wrong in any phase in any step please correct me up and
    take me @ the end of flow..
    THANKS
    Kamesh

    Hi Amansir,
    So i m back with my bunch of questions.I cant again ask a single because you know its a flow so i cant end up with single doubt.Thanks for your last reply.
    Yes amansir first doubt clear that was buffer will be inserted at MID point for this i got one nice document (PDF)names "All about oracle touch count algorithm by CRAIG A SHALLAHAMER".That was quite nice PDF allabout hot and cold buffer and buffer movments inside the LRU list.I am prettly much clear with that point.Thank you. and Incremental checkpoint i read from Harald.van.Breederode ppt a person from oracle.You have shared it on one of your thread.that was nice reference
    flicking through threads i came across term REPL and its variations REPL-AUX (thread was for Oracle 9i).Is this variation REPL-AUX deprecated in 10g So i i am not wrong For each work area two main lists that are LRU and CKPTQ exists??not more than that any other types?
    For non-RAC database Thread checkpoint is a Full checkpoint?
    I read about the incremental checkpointing Here incremental checkpointing in my words n brief.Incremental Checkpoints means write only some selected buffer from CKPTQ to Datafiles.FROM CKPTQ few Low orders RBA buffers are selected and chekcpointed *(Buffer will be checkpointed on many conditions)* and When the Next checkpoint occurs that buffers are flushed to disk.Now this thing *(Checkpointing few buffers and flushing them to disk)* can be multiple times within three seconds so after 3 seconds *(This is the 3 second concept i was asking in the starting of the thread,Can this time be changed if yes with which parameter)* the checkpoint RBA and Checkpoint*(the point upto which database buffer has flushed to disk)* will be updated in Control file header *(Datafile also)* by CKPT process.So that Checkpoint will be used for Instance recovery purpose.Which can dramatically down the instance recovery time.
    every 3 seconds control file is updated with checkpoint and that checkpoint is the point from where we have to start the recovery process in oracle from redo log.I m aware that incremental checkpointing is controlled by Fast_start_mttr_target prarameter and now it is autotuned for >10.2 but the smaller value i will keep the less time my instance will take.
    Is above two para right what i understood if wrong correct me??
    What i understand is after three seconds it will take some buffers from the CKPTQ ( from low RBA end ) and flush them to disk.apart from this many other conditions are there when Data will be flushed to disk.
    1) like CKPTQ is full.
    2)Process cant find a free buffer in LRU
    3)to advance checkpoint DBWR writes..
    Correct me if i m wrong?
    THANKS
    Kamesh
    Edited by: Kamy on May 2, 2011 10:55 PM

  • Some hot objects related issue in x$bh

    Does this query can be used to keep the object in the keep buffer pool
    My db version is oracle 9.2.0.6
    set lines 80;
    set lines 999;
    column avg_touches format 999
    column myname heading 'Name' format a30
    column mytype heading 'Type' format a10
    column buffers format 999,999
    select object_type mytype,object_name myname,
    blocks,count(1) buffers,avg(tch) avg_touches
    from sys.x$bh a,
    dba_objects b,
    dba_segments s
    where
    a.obj=b.object_id
    and
    b.object_name=s.segment_name
    and
    b.owner='CD'
    group by
    object_name,object_type,blocks,obj
    having avg(tch)>5
    and count(1)>20;
    /Edited by: user00726 on Feb 3, 2009 11:18 PM
    Edited by: user00726 on Feb 3, 2009 11:22 PM

    user00726 wrote:
    Does this query can be used to keep the object in the keep buffer pool
    from sys.x$bh a,
    dba_objects b,
    dba_segments s
    where
    a.obj=b.object_idNo - none of the scripts in this series of posting tells you anything useful regarding the KEEP pool. In particular, your script joins to the wrong column in dba_objects - it should use data_object_id.
    The best way to check the benefits of setting up a keep pool are (for your version of Oracle) to run statspack at level 7 (the default is level 5) and check the segment statistics section of the reports to see if there are any objects which are responsible for a large amount of physical I/O that would give you a lot of benefit if you could "KEEP" them, without sacrificing a lot of memory that might cause other objects to start doing more physical I/O.
    There is one particular benefit of the KEEP pool that can be of short term benefit (in your version of Oracle) - there is a bug with the touch count algorithm in 8i and 9i which means that blocks read for short tablescans do not get their touch count incremented: so if you are doing lots of short tablescans and see the relevant tables appearing high in the physical read report, then you could create a KEEP pool for them. However, you ought then to work out why they are being scanned so much when its possible they should be subject to indexed access.
    Regards
    Jonathan Lewis
    http://jonathanlewis.wordpress.com
    http://www.jlcomp.demon.co.uk
    "Science is more than a body of knowledge; it is a way of thinking"
    Carl Sagan
    To post code, statspack/AWR report, execution plans or trace files, start and end the section with the tag {noformat}{noformat} (lowercase, curly brackets, no spaces) so that the text appears in fixed format.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Algorithm to count frequencies

    i have a flat file of data, where rows are records and columns are variables. the variables are X1, X2, ..., XN. i need a data structure and/or algorithm to count the frequencies of this data. for example, i need to query how many times X1=true and X2=false, or X3=false and X2=false and XN=true, etc... i could easily put this data into a database (which i have). however, i find (using the profiler in Eclipse TPTP) that database calls are the most time-consuming calls. is there a data structure and/or algorithm to handle frequency counts?
    i know that the .NET framework has a DataTable data structure, and it can be used like an in-memory database where one can filter quickly. is there a corresponding data structure/object in Java or any Java projects anywhere?
    thanks.

    jakester wrote:
    If this is not what you had in mind, a better explanation would be in order.the format of my data is easy to understand. let's say you have N categorical variables, denoted as X1, X2, ..., XN. if N=3 and the variables are binary (each variable has 2 values), then the data set looks like the following.
    X1, X2, X3
    true, false, true
    true, false, false
    false, false, false
    so, it's a CSV (comma-separated value) file.
    now, i can load this into a table in a database. i can filter
    1. select count(*) from theTable where x1='true'
    2. select count(*) from theTable where x1='true' and x2='true'
    in fact, this is what i do currently: i parse the CSV file, and load it into a database. to get the frequencies of the combinations of values, i simply issue select statements. this solution works, but is not optimal. what i am finding is that the database calls take up the majority of the time leading to poor performance (even when the database is local, not on a network, tested with Oracle and MySQL). i am wondering, is there is a better way to achieve this type of frequency count?
    please note that the categorical variables may not all be binary. if they are all binary, there are up to 2^N unique combinations of values to keep track of. however, the categorical variables have at least 2 or more values. for example, we can have N=3 with the values of
    X1 : {val1, val2, val3},
    X2 : {valR, valS, valT}, and
    X3 : {valU, valV, valZ, valA}.
    please note that i am not querying for just one variable-value frequency (i.e. X1=val1} or dealing with just boolean (true/false) categorical variables (i.e. X1=false). i have to query for combinations of values. for example, the following are types of filters that i may need:
    1. X1=val1 and X2=valR and X3=valA
    2. X1=val1 and X3=valV
    3. X1=val3
    thanks.Okay, I understand.
    You don't necessarily need an actual B(+)-tree class. You can mimic the characteristics of such a structure using some nested Maps and a Set:
    Map<String, Map<String, Set<Combination>>>
    //    |            |              |
    //    |            |              +--------> the combinations  (eg: ['val1', 'valT', 'valV'])
    //    |            |
    //    |            +-----------------------> the value  (eg: 'val1')
    //    |
    //    +------------------------------------> the variable (eg: 'X1')Given the following data file (data.txt):
    X1  , X2  , X3
    val1, valR, valV
    val2, valS, valA
    val1, valR, valV
    val1, valS, valZ
    val1, valR, valA
    val2, valS, valA
    val1, valT, valZ
    val1, valR, valA
    val3, valR, valA
    val3, valR, valU
    val1, valT, valZ
    val1, valR, valV
    val2, valS, valA
    val2, valT, valA
    val1, valT, valV
    val3, valS, valU
    val2, valS, valA
    val1, valT, valZ
    val2, valS, valAHere's even a quick test harness:
    public class Main {
        public static void main(String[] args) throws Exception {
            DataFile dataFile = new DataFile("data.txt");
            System.out.println(dataFile);
            // X1=val1 and X2=valR and X3=valA
            for(Combination c : dataFile.getCombinations("X1=val1", "X2=valR", "X3=valA")) {
                System.out.println(c);
            System.out.println();
            // X1=val1 and X3=valV
            for(Combination c : dataFile.getCombinations("X1=val1", "X3=valV")) {
                System.out.println(c);
            System.out.println();
            // X1=val3
            for(Combination c : dataFile.getCombinations("X1=val3")) {
                System.out.println(c);
            System.out.println();
    class DataFile {
        private String[] variableNames;
        private Map<String, Map<String, Set<Combination>>> dataMap;
        DataFile(String fileName) throws FileNotFoundException {
            dataMap = new HashMap<String, Map<String, Set<Combination>>>();
            read(fileName);
        private void associate(String variable, String value, Combination comb) {
            Map<String, Set<Combination>> variableMap = dataMap.remove(variable);
            Set<Combination> combinations = variableMap.remove(value);
            if(combinations == null) combinations = new HashSet<Combination>();
            combinations.add(comb);
            variableMap.put(value, combinations);
            dataMap.put(variable, variableMap);
        Set<Combination> getCombinations(String... constraints) {
            Set<Combination> combinations = new HashSet<Combination>();
            boolean firstRun = true;
            for(String constraint : constraints) {
                String[] keyValue = constraint.split("=");
                String variable = keyValue[0];
                String value = keyValue[1];
                Set<Combination> temp = dataMap.get(variable).get(value);
                if(firstRun) {
                    firstRun = false;
                    combinations.addAll(temp);
                } else {
                    combinations.retainAll(temp);
            return combinations;
        private void read(String fileName) throws FileNotFoundException {
            Scanner file = new Scanner(new File(fileName));
            variableNames = file.nextLine().trim().split("\\s*+,\\s*+");
            for(String varName : variableNames) {
                dataMap.put(varName, new HashMap<String, Set<Combination>>());
            int row = 2;
            while(file.hasNextLine()) {
                String[] line = file.nextLine().trim().split("\\s*+,\\s*+");
                Combination comb = new Combination(line, row);
                for(int i = 0; i < line.length; i++) {
                    associate(variableNames, line[i], comb);
    row++;
    @Override
    public String toString() {
    StringBuilder b = new StringBuilder("DataFile=[\n");
    for(String var : dataMap.keySet()) {
    b.append(" "+var+"\n");
    Map<String, Set<Combination>> values = dataMap.get(var);
    for(String val : values.keySet()) {
    b.append(" "+val+"\n");
    Set<Combination> combinations = values.get(val);
    for(Combination comb : combinations) {
    b.append(" "+comb+"\n");
    return b.append("]").toString();
    class Combination {
    private final String[] values;
    private final int row;
    Combination(String[] v, int r) {
    values = v;
    row = r;
    @Override
    public boolean equals(Object o) {
    if(o == null || this.getClass() != o.getClass()) return false;
    Combination that = (Combination)o;
    return this.row == that.row;
    @Override
    public int hashCode() {
    return row;
    @Override
    public String toString() {
    return String.format("row=%d, values=%s", row, Arrays.toString(values));
    }{code}
    As you can see, after building the data file, the two main-query operations are two O(1)'s:
    {code}// in DataFile#getCombinations(String...)
    Set<Combination> temp = dataMap.get(variable).get(value);{code}
    The code above should of course be properly tested, the getCombinations(...) should be re-factored so that it doesn't rely on split(...) to get the variables and values information, etc.
    Good luck!

  • Lync 2013 Front End SIP/2.0 500 Compression algorithm refused

    I've deployed a brand new Lync 2013 environment hosted on Windows Server 2012 R2 that is currently in co-existence mode with my Lync 2010 environment. 
    I have SCOM 2012 monitoring the environment and it recently started reporting that one or more of my front end servers
    was in a critical state.  Diving into it revealed the following perf counter threshold was being tripped:
    Time Sampled: 3/26/2014 2:33:30 PM
    Object Name: LS:SIP - Responses
    Counter Name: SIP - Local 500 Responses
    Instance Name: 
    First Value: 14287
    Last Value: 14340
    Delta Value: 53
    Using OCSLOGGER.exe on the front end to capture logs, i trapped the following:
    TL_INFO(TF_PROTOCOL) [11]9138.1C58::03/26/2014-19:12:39.098.0022c780 (SIPStack,SIPAdminLog::ProtocolRecord::Flush:ProtocolRecord.cpp(265))[120713120] $$begin_record
    Trace-Correlation-Id: 120713120
    Instance-Id: 7D80EB
    Direction: outgoing;source="local"
    Peer: poolA.contoso.com:63820
    Message-Type: response
    Start-Line: SIP/2.0 500 Compression algorithm refused
    FROM: <sip:poolA.contoso.com>;ms-fe=FEserver1.contoso.com
    To: <sip:poolA.contoso.com>;tag=F8B88CAB38613EB380773027C56D94AF
    CALL-ID: 986f9f568c794ce39d33d7158376157b
    CSEQ: 1 NEGOTIATE
    Via: SIP/2.0/TLS 10.154.228.225:63820;ms-received-port=63820;ms-received-cid=C3D7C00
    Content-Length: 0
    ms-diagnostics: 2;reason="See response code and reason phrase";HRESULT="0xC3E93C0F(SIP_E_REACHED_CONFIGURED_LIMIT)";source="FEserver1.contoso.com"
    Server: RTC/5.0
    $$end_record
    The only recent change made to the front end servers was making the registry change outlined in this article: 
    http://support.microsoft.com/kb/2901554/en-us so i'm wondering if that has something to do with it.

    The MSFT support person said to re-apply CU5 to the Director servers and reboot.  Since this is impactful to the environment and I would have to do reboots anyway, I opted to go the route of installing the more recent update so....
    Last weekend I updated my Lync environment with what I think is considered CU6, the September 2014 updates for Lync 2013 Server (https://support.microsoft.com/kb/2809243) and still no luck. The front
    end servers are fine; no excess SIP 500 errors occurring there but within 30 minutes of removing the SCOM override on the Director servers the alerts started firing again.
    I reinstated the override in SCOM for the Directors and had my case with Premier support un-archived.  The MSFT support person said if the alerts didn't go away she was going to have to engage the Lync product group for help.  We'll see where it
    goes from here.
    JKuta

  • CAn Someone Please Help me? Turn this program in a algorithm

    DECLARE SUB RentCar ()
    DECLARE SUB PayBill ()
    DECLARE SUB Main ()
    DECLARE SUB ReadCarData ()
    DECLARE SUB FindCar ()
    TYPE Car ' User made Type To hold Car Data
    CarNumber AS INTEGER
    License AS STRING * 8
    Year AS INTEGER
    CarMaker AS STRING * 16
    CarName AS STRING * 16
    Description AS STRING * 20
    ColorOfCar AS STRING * 10
    NumberOfDoors AS INTEGER
    Price AS DOUBLE
    Rented AS INTEGER
    Customer AS INTEGER
    END TYPE
    TYPE Customer ' User made Type to hold Customer data
    CustomerNumber AS INTEGER
    CustName AS STRING * 50
    Bill AS DOUBLE
    END TYPE
    DIM SHARED Cars(1 TO 26) AS Car ' Global Variables
    DIM SHARED p(4) AS Customer
    DIM CustName AS STRING * 50
    p(0).CustName = "Kevin" ' Assign Customers who need to pay bills
    p(0).Bill = 0
    p(1).CustName = "Eljah"
    p(1).Bill = 100
    p(2).CustName = "Jared"
    p(2).Bill = 55
    p(3).CustName = "Claudwin"
    p(3).Bill = 60
    p(4).CustName = "Isaac"
    p(4).Bill = 1500
    CALL ReadCarData ' This reads the data statements into the Cars() array.
    WIDTH 80, 50 ' Formats screen and call the main part of the program
    CALL Main
    ' CAR DATA STATEMENTS
    ' LICENSE YEAR MAKER MODEL DESCRIPTION COLOR DOORS PRICE
    DATA "X-5687", 2007, "DODGE", "CALIBER", "FAMILY CAR", "DARK RED", 4, 89.99
    DATA "X-9681", 2006, "DODGE", "CHARGER", "SPORT", "GREY", 4, 47.99
    DATA "X-9684", 2006, "DODGE", "RAM 2500", "PICKUP", "BLACK", 4, 101.99
    DATA "X-9437", 2004, "FORD", "MUSTANG", "SPORT", "RED", 2, 45.99
    DATA "X-2562", 2002, "FORD", "TAURUS", "SEDAN", "LIGHT GREY", 4, 67.99
    DATA "X-3856", 2003, "FORD", "CONTOUR", "SMALL", "LIGHT BLUE", 2, 45.99
    DATA "X-2724", 2001, "FORD", "BRONCO", "JEEP", "BLACK", 4, 63.99
    DATA "X-2724", 2001, "FORD", "BRONCO", "JEEP", "DARK GREEN", 4, 63.99
    DATA "X-8568", 1998, "FORD", "ESCORT", "COMPACT", "BROWN", 2, 35.99
    DATA "X-4724", 2004, "FORD", "PROBE", "SPORT", "BLACK", 2, 58.99
    DATA "X-4724", 2004, "FORD", "PROBE", "SPORT", "RED", 2, 58.99
    DATA "X-4724", 2004, "FORD", "PROBE", "SPORT", "YELLOW", 2, 58.99
    DATA "X-4724", 2003, "FORD", "AEROSTAR", "S.U.V.", "DARK GREEN", 4, 87.99
    DATA "X-2727", 1999, "PONTIAC", "GRAND AM", "SPORT CAR", "BLACK", 2, 45.99
    DATA "X-2327", 1999, "PONTIAC", "GRAND AM", "SPORT CAR", "RED", 2, 45.99
    DATA "X-2767", 1999, "PONTIAC", "GRAND AM", "SPORT CAR", "GREY", 2, 45.99
    DATA "X-2723", 1999, "PONTIAC", "GRAND AM", "SPORT CAR", "PURPLE", 2, 45.99
    DATA "X-8486", 2005, "PONTIAC", "TRANSPORT", "S.U.V.", "WHITE", 2, 96.99
    DATA "X-3261", 2005, "PONTIAC", "AZTEC", "S.U.V.", "YELLOW", 4, 93.99
    DATA "X-1864", 2006, "PONTIAC", "TORRENT", "S.U.V.", "RED", 4, 98.99
    DATA "X-8521", 2006, "MERCURY", "COUGAR", "SPORT", "BLACK", 2, 69.99
    DATA "X-8471", 2006, "LINCOLN", "TOWN CAR", "LUXURY", "BLACK", 4, 149.99
    DATA "X-8635", 2001, "LINCOLN", "CONTINENTAL", "LUXURY", "GOLD", 4, 139.99
    DATA "X-2643", 2006, "CHEVROLET", "F-150", "PICKUP", "GREY", 2, 95.99
    DATA "X-7143", 2006, "CHEVROLET", "CORVETTE", "SPORT", "YELLOW", 2, 131.99
    DATA "X-7378", 2006, "CHEVROLET", "MALIBU", "SEDAN", "BLACK", 4, 81.99
    SUB FindCar ' This sub goes through the data to search for a car
    DIM Counter AS INTEGER 'variables need for sub
    DIM TempMaker AS STRING
    DIM TempModel AS STRING
    DIM TempColor AS STRING
    DIM TempCarType AS STRING
    DIM TempRangeFrom AS DOUBLE
    DIM TempRangeTo AS DOUBLE
    DIM TempMax AS DOUBLE
    DIM TempMin AS DOUBLE
    DIM LeaveFindCar AS INTEGER
    DIM MoreCar AS STRING
    DIM CanDisplay AS INTEGER
    DO WHILE LeaveFindCar = 0 ' Main loop to find type of car
         ' Initialize the variables
    Counter = 0
    TempMaker = ""
    TempModel = ""
    TempColor = ""
    TempRangeFrom = 0
    TempRangeTo = 0
    CLS ' Draw the screen with the search fields"
    COLOR 15
    PRINT "FIND IDEAL CAR: (Enter one or more of these items)"
         PRINT STRING$(80, CHR$(196))
         COLOR 11
         PRINT "Car Builder:"
         PRINT "Car Model:"
         PRINT "Car Color:"
         PRINT "Price Range: From: To:"
         COLOR 10 ' GetsUser can enter any search fields he wants
         LOCATE 3, 19
         INPUT TempMaker
         LOCATE 4, 19
         INPUT TempModel
         LOCATE 5, 19
         INPUT TempColor
         LOCATE 6, 19
         INPUT TempRangeFrom
         LOCATE 6, 36
         INPUT TempRangeTo
         COLOR 15
         PRINT STRING$(80, CHR$(196))
         CanDisplay = 0
         FOR Counter = 1 TO 26 '' This loop does the actual search of the matching cars
         'We compare all string type variables as an
         'uppercase (UCASE$) and Right Trimmed (RTRIM$)
         'to avoid having to compare upper and lower case
         'Values, this makes the condtions here twice
         'as short to perform.
         IF RTRIM$(TempMaker) <> "" THEN
         IF UCASE$(RTRIM$(Cars(Counter).CarMaker)) = UCASE$(RTRIM$(TempMaker)) THEN
         IF RTRIM$(TempModel) <> "" THEN
         IF UCASE$(RTRIM$(Cars(Counter).CarName)) = UCASE$(RTRIM$(TempModel)) THEN
         IF RTRIM$(TempColor) <> "" THEN
         IF UCASE$(RTRIM$(Cars(Counter).ColorOfCar)) = UCASE$(RTRIM$(TempColor)) THEN
    IF TempRangeFrom > 0 AND TempRangeTo > 0 THEN
    IF TempRangeFrom > TempRangeTo THEN
    TempMin = TempRangeTo
    TempMax = TempRangeFrom
    ELSE
    TempMin = TempRangeFrom
    TempMax = TempRangeTo
    END IF
    ' If Price of car is in between Mininum and Maximum Price
    'Allows to display the record.
    IF Cars(Counter).Price >= TempMin AND Cars(Counter).Price <= TempMax THEN
    CanDisplay = 1
    ELSE
    CanDisplay = 0
    END IF
    END IF
    ELSE
    CanDisplay = 0
    END IF
    ELSE
    ' The IF is to set Min to the smallest of
    ' the range vales and TempMax to the biggest.
    IF TempRangeFrom > 0 AND TempRangeTo > 0 THEN
    IF TempRangeFrom > TempRangeTo THEN
    TempMin = TempRangeTo
    TempMax = TempRangeFrom
    ELSE
    TempMin = TempRangeFrom
    TempMax = TempRangeTo
    END IF
    IF Cars(Counter).Price >= TempMin AND Cars(Counter).Price <= TempMax THEN
    CanDisplay = 1
    ELSE
    CanDisplay = 0
    END IF
    END IF
    END IF
    ELSE
    CanDisplay = 0
    END IF
    ELSE
    IF RTRIM$(TempColor) <> "" THEN
    IF UCASE$(RTRIM$(Cars(Counter).ColorOfCar)) = UCASE$(RTRIM$(TempColor)) THEN
    ' This IF is to set Min to the smallest of
    ' the range values and Max to the biggest.
    IF TempRangeFrom > 0 AND TempRangeTo > 0 THEN
    IF TempRangeFrom > TempRangeTo THEN
    TempMin = TempRangeTo
    TempMax = TempRangeFrom
    ELSE
    TempMin = TempRangeFrom
    TempMax = TempRangeTo
    END IF
    IF Cars(Counter).Price >= TempMin AND Cars(Counter).Price <= TempMax THEN
    CanDisplay = 1
    ELSE
    CanDisplay = 0
    END IF
    END IF
    ELSE
    CanDisplay = 0
    END IF
    ELSE
    ' The IF is to set Min to the smallest of
    ' the range vales and Max to the biggest.
    IF TempRangeFrom > 0 AND TempRangeTo > 0 THEN
    IF TempRangeFrom > TempRangeTo THEN
    TempMin = TempRangeTo
    TempMax = TempRangeFrom
    ELSE
    TempMin = TempRangeFrom
    TempMax = TempRangeTo
    END IF
    IF Cars(Counter).Price >= TempMin AND Cars(Counter).Price <= TempMax THEN
    CanDisplay = 1
    ELSE
    CanDisplay = 0
    END IF
    ELSEIF TempRangeFrom = 0 AND TempRangeTo > 0 THEN ' The IF one of the range to be 0
    TempMin = TempRangeFrom
    TempMax = TempRangeTo
    IF Cars(Counter).Price >= TempMin AND Cars(Counter).Price <= TempMax THEN
    CanDisplay = 1
    ELSE
    CanDisplay = 0
    END IF
    ELSEIF TempRangeFrom > 0 AND TempRangeTo = 0 THEN ' This IF one of the range to be 0
    TempMin = TempRangeTo
    TempMax = TempRangeFrom
    IF Cars(Counter).Price >= TempMin AND Cars(Counter).Price <= TempMax THEN
    CanDisplay = 1
    ELSE
    CanDisplay = 0
    END IF
    ELSE
    CanDisplay = 1
    END IF
    END IF
    END IF
    END IF
    ELSE
    'Same as previously, all string variables are UCASEd and
    'RTRIMmed to shorten the comparison lenghts.
    IF RTRIM$(TempModel) <> "" THEN
    IF UCASE$(RTRIM$(Cars(Counter).CarName)) = UCASE$(RTRIM$(TempModel)) THEN
    IF RTRIM$(TempColor) <> "" THEN
    IF UCASE$(RTRIM$(Cars(Counter).ColorOfCar)) = UCASE$(RTRIM$(TempColor)) THEN
    IF TempRangeFrom > 0 AND TempRangeTo > 0 THEN
    IF TempRangeFrom > TempRangeTo THEN
    ' This IF is to setMin to the smallest of
    ' the range vales and Max to the biggest
    TempMin = TempRangeTo
    TempMax = TempRangeFrom
    ELSE
    TempMin = TempRangeFrom
    TempMax = TempRangeTo
    END IF
    IF Cars(Counter).Price >= TempMin AND Cars(Counter).Price <= TempMax THEN
    CanDisplay = 1
    ELSE
    CanDisplay = 0
    END IF
    END IF
    ELSE
    CanDisplay = 0
    END IF
    ELSE
    ' This IF is to setMin to the smallest of
    ' the range vales and Max to the biggest
    IF TempRangeFrom > 0 AND TempRangeTo > 0 THEN
    IF TempRangeFrom > TempRangeTo THEN
    TempMin = TempRangeTo
    TempMax = TempRangeFrom
    ELSE
    TempMin = TempRangeFrom
    TempMax = TempRangeTo
    END IF
    IF Cars(Counter).Price >= TempMin AND Cars(Counter).Price <= TempMax THEN
    CanDisplay = 1
    ELSE
    CanDisplay = 0
    END IF
    END IF
    END IF
    ELSE
    CanDisplay = 0
    END IF
    ELSE
    IF RTRIM$(TempColor) <> "" THEN
    IF UCASE$(RTRIM$(Cars(Counter).ColorOfCar)) = UCASE$(RTRIM$(TempColor)) THEN
    ' This IF is to setMin to the smallest of
    ' the range vales and Max to the biggest
    IF TempRangeFrom > 0 AND TempRangeTo > 0 THEN
    IF TempRangeFrom > TempRangeTo THEN
    TempMin = TempRangeTo
    TempMax = TempRangeFrom
    ELSE
    TempMin = TempRangeFrom
    TempMax = TempRangeTo
    END IF
    IF Cars(Counter).Price >= TempMin AND Cars(Counter).Price <= TempMax THEN
    CanDisplay = 1
    ELSE
    CanDisplay = 0
    END IF
    ELSE
    CanDisplay = 1
    END IF
    ELSE
    CanDisplay = 0
    END IF
    ELSE
    ' This IF is to setMin to the smallest of
    ' the range vales and Max to the biggest
    IF TempRangeFrom > 0 AND TempRangeTo > 0 THEN
    IF TempRangeFrom > TempRangeTo THEN
    TempMin = TempRangeTo
    TempMax = TempRangeFrom
    ELSE
    TempMin = TempRangeFrom
    TempMax = TempRangeTo
    END IF
    IF Cars(Counter).Price >= TempMin AND Cars(Counter).Price <= TempMax THEN
    CanDisplay = 1
    ELSE
    CanDisplay = 0
    END IF
    ELSEIF TempRangeFrom = 0 AND TempRangeTo > 0 THEN
    TempMin = TempRangeFrom
    TempMax = TempRangeTo
    IF Cars(Counter).Price >= TempMin AND Cars(Counter).Price <= TempMax THEN
    CanDisplay = 1
    ELSE
    CanDisplay = 0
    END IF
    ELSEIF TempRangeFrom > 0 AND TempRangeTo = 0 THEN
    TempMin = TempRangeTo
    TempMax = TempRangeFrom
    IF Cars(Counter).Price >= TempMin AND Cars(Counter).Price <= TempMax THEN
    CanDisplay = 1
    ELSE
    CanDisplay = 0
    END IF
    ELSE
    CanDisplay = 1
    END IF
    END IF
    END IF
    END IF
    IF CanDisplay = 1 THEN ' If car match fields entered it is displayed
              COLOR 11
    PRINT Cars(Counter).CarNumber;
    PRINT " " + RTRIM$(Cars(Counter).License);
    PRINT " - " + RTRIM$(Cars(Counter).CarMaker);
    PRINT " " + RTRIM$(Cars(Counter).CarName);
    PRINT " " + RTRIM$(Cars(Counter).Description);
    PRINT " " + RTRIM$(Cars(Counter).ColorOfCar);
    PRINT TAB(60); USING " $###.##"; Cars(Counter).Price
    CanDisplay = 0
    END IF
    NEXT Counter ' displays line after listing cars
    COLOR 15
    PRINT STRING$(80, CHR$(196))
    DO WHILE UCASE$(MoreCar) <> "Y" AND UCASE$(MoreCar) <> "N"
    LOCATE CSRLIN, 1 ' This loop ask useers if they want another car search
    PRINT "Find Another Car (Y/N)"
    INPUT MoreCar
    LOOP
    IF UCASE$(MoreCar) = "N" THEN ' If user entered "n" the loop is exited
    LeaveFindCar = 1
    END IF
    MoreCar = ""
    LOOP
    END SUB
    SUB Main
    ' This SUB is the main part of the program. It displays
    ' the menu and accepts the choices from the user, when the
    ' user picks a valid value, it executes the proper choice
    DO
    CLS
    COLOR 15
    'print the menu on the screen      
    LOCATE 1, 33
    PRINT "RENT CARS PLUS"
    LOCATE 2, 1
    PRINT STRING$(80, CHR$(196))
    COLOR 11
    PRINT " 1 - Pay Bill"
    PRINT " 2 - Rent Car"
    PRINT " 3 - Find Ideal Car"
    PRINT " 999 - Exit"
    COLOR 15
    PRINT STRING$(80, CHR$(196))
    INPUT "Choice: ", Choice ' The user enters his/her choice
    IF Choice = 999 THEN END
    IF Choice <> 999 AND Choice <> 1 AND Choice <> 2 AND Choice <> 3 THEN
    PRINT " Error Please Enter Correct Choice! " ' If not valid answer user is asked to enter correct choice
    END IF
    SELECT CASE Choice ' This Select Case executes the subprograms options
    CASE 1
    CALL PayBill
    CASE 2
    CALL RentCar
    CASE 3
    CALL FindCar
    CASE 5
    END SELECT
    LOOP UNTIL Choice = 999
    END SUB
    SUB PayBill' This sub does the bill paying process.
    ' it asks a few question to the user to get the right
    ' information and be able to pay the given bill.
    DIM CustName AS STRING
    DIM MoreBill AS INTEGER
    DIM Answer AS STRING
    DIM Flag AS INTEGER
    COLOR 15
    MoreBill = 0 ' To start loop variable
    DO WHILE MoreBill = 0 ' Loop to start the Bill Paying Process
    StartBill:
         ' Displays screen to user
    CLS
    COLOR 15
    PRINT "PAY A BILL"
    PRINT STRING$(80, CHR$(196))
    INPUT "Customer Name: ", CustName ' user enters customer name
    Flag = 0
    FOR Q = 0 TO 4 ' Loops to search for customer name in array
    IF UCASE$(RTRIM$(p(Q).CustName)) = UCASE$(RTRIM$(CustName)) THEN
    Flag = 1
    PRINT p(Q).CustName; p(Q).Bill
    EXIT FOR
    END IF
    NEXT Q
    '' If customer name invalid error message displayed
    IF Flag = 0 THEN
    PRINT "Invalid name. Press a key to try again."
    DO WHILE INKEY$ <> "": LOOP
    GOTO StartBill
    END IF
    MethodInput:
    DO
    LOCATE 4, 1     ' Display Payment methods and wait for user to pick one
    COLOR 11
    PRINT "We only use Visa or American Express. How do you wish to pay?"
    PRINT "1 - Visa"
    PRINT "2 - American Express"
    PRINT "3 - Check"
    PRINT "4 - Cash"
    INPUT "Select 1, 2, 3, or 4: ", howtopay$ ' User enters way to pay
    IF howtopay$ = "1" OR howtopay$ = "2" THEN ' CArd number asked for If american or visa
    INPUT "Enter account number: ", cardnum$
    ELSEIF howtopay$ <> "3" AND howtopay$ <> "4" THEN
    PRINT "You must select method of payment."
    END IF
    LOOP WHILE howtopay$ < "1" OR howtopay$ > "4"
    PaymentInput:
    '' users enters payment amount
    INPUT "Payment Amount (0 to cancel the transaction): ", PayAmount
    IF PayAmount <> 0 THEN
    IF PayAmount > p(Q).Bill THEN
    '' If payment bigger than amount owed message displayed
    PRINT "Payment is bigger than amount due. Press key to enter payment."
    DO WHILE INKEY$ = "": LOOP
    GOTO PaymentInput
    ELSE
    ' If amount valid , payment subtracted from amount owed
    p(Q).Bill = p(Q).Bill - PayAmount
    PRINT "New balance is "; USING "$#####.##"; p(Q).Bill
    END IF
    END IF
         '' Loop ask if user wishes to pay another bill
    DO WHILE UCASE$(RTRIM$(Answer)) <> "Y" AND UCASE$(RTRIM$(Answer)) <> "N"
    COLOR 15
    LOCATE 48, 1
    PRINT "Pay Another Bill (Y/N) ";
    INPUT Answer
    LOOP
    IF UCASE$(RTRIM$(Answer)) = "N" THEN ' If answer is "N" then loop exited
    MoreBill = 1
    END IF
    LOOP
    END SUB
    SUB ReadCarData
    ' This sub reads all data from the DATA statements
    ' And puts them in the Cars array
    DIM Counter AS INTEGER
    FOR Counter = 1 TO 26
    Cars(Counter).CarNumber = Counter
    READ Cars(Counter).License
    READ Cars(Counter).Year
    READ Cars(Counter).CarMaker
    READ Cars(Counter).CarName
    READ Cars(Counter).Description
    READ Cars(Counter).ColorOfCar
    READ Cars(Counter).NumberOfDoors
    READ Cars(Counter).Price
    NEXT Counter
    END SUB
    SUB RentCar
    ' This sub does the renting of a car
    ' to a customer. This ask several questions
    ' in order to get the right customer and the right
    ' car to rent then it rents it.
    DIM MoreRent AS INTEGER
    DIM TempCustomer AS INTEGER
    DIM TempBill AS DOUBLE
    DIM Answer AS STRING
    DIM TempPrice AS DOUBLE
    DIM TempInsurance AS DOUBLE
    DIM CustName AS STRING
    DIM Number AS STRING
    DIM CarNumber AS INTEGER
    DIM Days AS INTEGER
    DIM Q AS INTEGER
    MoreRent = 0 ' Loop for rental process
    DO WHILE MoreRent = 0
    InputName:
    CLS ' Display screen to user
    COLOR 15
    PRINT "RENT A CAR"
    PRINT STRING$(80, CHR$(196))
    COLOR 11
    LOCATE 3, 1
    INPUT " Full Name: ", CustName ' user enters his name
    IF RTRIM$(CustName) = "" THEN
    PRINT "You Must Enter Your Name. Press a key to retry." ' User is told he must enter a name
    DO WHILE INKEY$ = "": LOOP
    GOTO InputName
    ELSE
    FOR Q = 0 TO 4
    IF UCASE$(RTRIM$(p(Q).CustName)) = UCASE$(RTRIM$(CustName)) THEN
    Flag = 1
    PRINT p(Q).CustName; p(Q).Bill
    TempCustomer = Q
    EXIT FOR
    END IF
    NEXT Q
    END IF
    InputNumber:
    LOCATE 5, 1
    INPUT " Phone Number: ", Number ' User enters phone number
    IF RTRIM$(Number) = "" THEN
    PRINT "You Must a phone number. Press a key to retry." ' User is warned he must enter a number
    DO WHILE INKEY$ = "": LOOP
    GOTO InputNumber
    END IF
    CarInput:
    LOCATE 7, 2
    COLOR 11
    INPUT "Car Number: ", CarNumber     
    ' This awaits a car number from the user.
    IF CarNumber < 1 AND CarNumber > 26 THEN ' If the car number is out of range, we warn and start again
    PRINT "Car Number must be between 1 and 26. Press a key to retry."
    DO WHILE INKEY$ = "": LOOP
    GOTO CarInput
    ELSE
    ' No need to search, we just display the car information
    COLOR 14
    PRINT RTRIM$(Cars(CarNumber).License) + " - ";
    PRINT Cars(CarNumber).Year;
    PRINT RTRIM$(Cars(CarNumber).CarMaker) + " " + RTRIM$(Cars(CarNumber).CarName) + " ";
    PRINT RTRIM$(Cars(CarNumber).ColorOfCar)
    PRINT "PRICE: "; USING "$####.##"; Cars(CarNumber).Price
    END IF
    DaysInput:
    LOCATE 10, 1
    COLOR 11
    INPUT " Number of Days to rent: ", Days
    ' This awaits for a number of days to rent the car for.
    IF Days < 1 AND Days > 31 THEN
    PRINT "Days are 1 to 31. Press a key to retry."
    ' Can't have less than 1 day or more than a month or we warn.
    DO WHILE INKEY$ = "": LOOP
    GOTO DaysInput
    END IF
    TempPrice = Days * Cars(CarNumber).Price
    ' Calculate the Price of the rental
    InsuranceInput:
    LOCATE 13, 1
    COLOR 11
    DO WHILE UCASE$(RTRIM$(Answer)) <> "Y" AND UCASE$(RTRIM$(Answer)) <> "N"
    COLOR 11
    LOCATE 13, 1
    PRINT "Add Insurance (Y/N)";
    ' the customer has the option to purchase insurance here.
    INPUT Answer
    LOOP
    IF UCASE$(Answer) = "Y" THEN
    COLOR 11
    DO WHILE UCASE$(RTRIM$(Answer)) <> "F" AND UCASE$(RTRIM$(Answer)) <> "D"
    'we loop until the users enters y or n
    COLOR 11
    LOCATE 14, 1
    PRINT "(F)ixed Or (D)aily Amount";
    ' If the user selected yes, we ask for fixed or daily insurance amount.
    INPUT Answer
    LOOP
    ' if Fixed amount was picked we ask for that amount
    IF UCASE$(RTRIM$(Answer)) = "F" THEN
    INPUT "Fixed Insurance: ", TempInsurance
    ELSE
    TempInsurance = 15 * Days ' If Daily was picked we multiply 15 by the number of days rented
    END IF
    END IF
    DO     ' this loop asks for a payment method.
    LOCATE 17, 1
    PRINT "We only use Visa or American Express. How do you wish to pay?"
    PRINT "1 - Visa"
    PRINT "2 - American Express"
    PRINT "3 - Check"
    PRINT "4 - Cash"
    INPUT "Select 1, 2, 3, or 4: ", howtopay$
    IF howtopay$ = "1" OR howtopay$ = "2" THEN
    INPUT "Enter account number: ", cardnum$
    ELSEIF howtopay$ <> "3" AND howtopay$ <> "4" THEN
    PRINT "You must select method of payment."
    END IF
    LOOP WHILE howtopay$ < "1" OR howtopay$ > "4"
    COLOR 14
    PRINT     
    ' This part displays some totals to the user.
    PRINT "Rental Price = "; USING "$##,###.##"; TempPrice
    PRINT "Insurance Amount = "; USING "$##,###.##"; TempInsurance
    PRINT "Total Price = "; USING "$##,###.##"; TempPrice + TempInsurance
    PRINT " ----------"
    TempBill = p(TempCustomer).Bill
    TempBill = TempBill + (TempPrice + TempInsurance)
    p(TempCustomer).Bill = TempBill
    PRINT "New Balance = "; USING "$##,###.##"; TempBill
    PRINT " =========="
    Answer = ""
    ' This loop asks if the user wants to rent another car.
    DO WHILE UCASE$(RTRIM$(Answer)) <> "Y" AND UCASE$(RTRIM$(Answer)) <> "N"
    COLOR 15
    LOCATE 48, 1
    PRINT "Rent Another Car (Y/N) ";
    INPUT Answer
    LOOP
    IF UCASE$(RTRIM$(Answer)) = "N" THEN
    ' If user selected N, we assign value to exit the loop
    MoreRent = 1
    END IF
    LOOP
    END SUB
    Im really good at programming but really suck at algorithms can someone please please write in a algorithm form for me , i need it by friday i would greatly be thankful for u

    Im really good at programming but really suck at algorithms
    >If your are 'really good' at programming, you will be able to solve this problem. Because, it has nothing to do with algorithm.
    >>can someone please please write in a algorithm form for me , i need it by friday i would greatly be thankful for u
    >Wrong person, in the wrong place.

  • NI-DAQmx: PCI - 6601 - counting pulses in fixed intervals

    Dear friends,
    I found, that similar topics to my question have already been discussed, but I was unable to find exactly my case, or where it is near - LabView is discussed. If you know address where my question already has been discussed, please, let me know. Because I still have not decided whether I will use CVI or other C-based environment, my questions are more oriented to the principles, I hope that no matter which C environment is used, the algorithm should be the same.
    Now to the question:
    For my project, I am using board PCI6601 and NI-DAQmx drivers. What I need to do is illustraded in the following figure:
    I time ago I have tried to realize the above function through the evalution CVI environment, but I filed. I have some questions regarding my experience:
    1. I have one general question: Is the functionality needed possible to be realized using the board 6601 and LabWindows/CVI (or Visual C environment )? If yes, please, comment the questions below:
    2. I suppose, a period measurement should be used, but which type? I suppose, a single period measurement should be used. The buffered continuous period measurement seems to be not suitable, because there is no way for ensuring the time T2 for system processing.
    3. How the measurement should be configured, which functions should be used? I tried to apply the function DAQmxCreateCIPeriodChan(..) and I noticed the following:
    - in order to be able to set the GATE time T1 according the needs, I must use for the parameter measMethod only value DAQmx_Val_HighFreq2Ctr;
    - may be the values for the parameters minVal  and maxVal need to be calculated each time dependently on the time T1 set?
    4. How should be organized the reading, which functions should I use to read the counter value? By now I tried to use the function DAQmxReadCounterScalarF64(...) and I noticed the following:
    - my system needs to know when the counting T1 is finished, in order to do the processing needed in the period T2. What value should I set for the parameter timeout in respect to this? Shall I use the timeout in order to obtain the result, or I must detect when the result is ready checking the Return Value of the function? Shall I use timeout, depending on the T1 period used?
    -  a number of pulses “zero” in my system is a normal value. How to avoid the problems, related to this? When I connect and disconnect the pulse source, an error occurs. I tried to use the function SetBreakOnLibraryErrors() to disable the error messages, and I succeeded to disable them, but it seems, on error the task is automatically stopps and needs to be restarted.
    - which variant is the correct way for reading with respect to the task start/stop:
    Variant 1:
    a) Start the task
    b) Start the counting
    c) Wait the counting to finish
    d) Stop the task
    e) Process the result
    d) repeat the sequence (a-e) so many times as the number of the countings;
    Variant 2:
    a) Start the task
    b) Start the counting
    c) Wait the counting to finish
    d) Process the result
    e) Repeat the sequence (b-e) so many times as the number of the countings;
    f) Stop the task
    Thank you in advance,
    Kamen Ivanov
    Message Edited by THE_SNAKE on 10-09-2008 05:41 AM
    Message Edited by THE_SNAKE on 10-09-2008 05:43 AM

    Dear
    Kevin,
    Thank
    you for your attention! Now step by step:
    > You mention a DAC -- do you have another NI board, maybe a
    multifunction board? If you do, or if you can add one, there's a pretty
    straightforward way to do this stuff well. Assuming there's an NI multifunction
    board available (I'd recommend an M-series board), I would approach this just a
    little differently.
    The
    only NI hardware I have is this 6601 counter board. It has enough general
    purpose pins, and I am using them to realize the digital part of the DAC. The
    additional analog components, needed to complete the DAC functionality are
    existing in the XPS system and they don't need to be added by me. The NI board
    only must provide the corresponding binary combination. In fact, by this moment
    I realized the DAC in this way, using a simple software routine to convert the
    decimal value to a binary output value on the general purpose pins, it seems to
    work fine (I have not explored its timing parameters yet – for example the time
    needed for the output to be updated).
    >The approach you've planned counts on making a near-real-time
    update of an analog output DAC based on measured results. 
    You
    got it right! Here I need to correct myself: the DAC update is always related
    to "moving" the DAC output with one step/level prior each counting. The
    DAC output value does not depend on the result from the last counting, I know I
    have written like this in my first message, excuse me for this! However, this
    does not change the task to be solved
    >Your data correlation depends on you stopping and starting the
    counting in sync with generating your DAC update.
    This
    is very well said!
    >It restricts you to doing software-timed AO as well. 
    I
    am not sure that I got this right, but if you mean the DAC update itself - yes,
    the DAC update is software driven.
    >All that can work, but consider the following approach that also
    uses an analog input A/D channel. I assume what you care about is the
    correlation of AO voltage to subsequent count rate, right? 
    What
    I need to ensure is that no single counting will be started prior its
    corresponding DAC update, and that after finishing a counting, the next DAC
    update will be done as soon as possible.
    > What *I* would consider doing first is to hardware-sync the
    counting task with an analog INPUT task which simply measures the analog output
    voltage.  It sounds kinda dumb at first
    to create a measurement task that measures a signal you're generating, but
    there are benefits to this approach.  It
    would free you to change the analog output DAC voltage any time and any way you
    want, without having to worry about the processing time spent on it.  Your master data record would be the count
    and analog input tasks, which can be synced in hardware.  
    Also, you would have a continuous record of count rate vs voltage
    with no "blind" time.
    I
    think I got your idea. But my problem is related only to the board 6601.
    May
    be we have to think how using only this board similar to your idea can be implemented.
    It
    seems, I can additionally simplify my question:
    Is
    the board 6601 suitable to be used for the task I need to solve, without adding
    any additional (NI) hardware?
    Because,
    if my task can not be solved easy using exactly this board, I will try to
    search other solution, but I need to know for sure and to have arguments, that
    this board alone is suitable/not suitable for the task I have to solve.
    Best regards:
    Kamen Ivanov

  • Best way to implement a word frequency counter (input = textfile)?

    i had this for an interview question and basically came up with the solution where you use a hash table...
    //create hash table
    //bufferedreader
    //read file in,
    //for each word encountered, create an object that has (String word, int count) and push into hash table
    //then loop and read out all the hash table entries
    ===skip this stuff if you dont feel like reading too much
    then the interviewer proceeded to grill me on why i shouldn't use a tree or any other data structure for that matter... i was kidna stumped on that.
    also he asked me what happens if the number of words exceed the capacity of the hash table? i said you can increase the capacity of the hash table, but it doesn't sound too efficient and im not sure how much you know how to increase it by. i had some ok solutions:
    1. read the file thru once, and get the number of words in the file, set the hashtable capacity to that number
    2. do #1, but run anotehr alogrithm that will figure out distinct # of words
    3. separate chaining
    ===
    anyhow what kind of answeres/algorithms would you guys have come up with? thanks in advance.

    i had this for an interview question and basically
    came up with the solution where you use a hash
    table...
    //create hash table
    //bufferedreader
    //read file in,
    //for each word encountered, create an object thatWell, first you need to check to make sure the word is not already in the hashtable, right? And if it is there, you need to increment the count.
    has (String word, int count) and push into hash
    table
    //then loop and read out all the hash table entries
    ===skip this stuff if you dont feel like reading too
    much
    then the interviewer proceeded to grill me on why i
    shouldn't use a tree or any other data structure for
    that matter... i was kidna stumped on that.A hashtable has ammortized O(1) time for insert and search. A balanced binary search tree has O(log n) complexity for the same operations. So, a hashtable will be faster for large number of words. The other option is a so-called "trie" (google for more), which has O(log m) complexity, where m is the length of the longest word. So if your words aren't too long, a trie may be just as fast as a hashtable. The trie may also use less memory than the hashtable.
    also he asked me what happens if the number of words
    exceed the capacity of the hash table? i said you can
    increase the capacity of the hash table, but it
    doesn't sound too efficient and im not sure how much
    you know how to increase it by. i had some ok
    solutions:The hashmap implementation that comes with Java grows automatically, you don't need to worry about it. It may not "sound" efficient to have to copy the entire datastructure, the copy happens quickly, and occurs relatively infrequently compared with the number of words you'll be inserting.
    1. read the file thru once, and get the number of
    words in the file, set the hashtable capacity to that
    number
    2. do #1, but run anotehr alogrithm that will figure
    out distinct # of words
    3. separate chaining
    ===
    anyhow what kind of answeres/algorithms would you
    guys have come up with? thanks in advance.I would do anything to avoid making two passes over the data. Assuming you're reading it from disk, most of the time will be spent reading from disk, not inserting to the hashtable. If you really want to size the hashtable a priori, you can make it so its big enough to hold all the words in the english language, which IIRC is about 20,000.
    And relax, you had the right answer. I used to work in this field and this is exactly how we implemented our frequency counter and it worked perfectly well. Don't let these interveiewers push you around, just tell them why you thought hashtable was the best choice; show off your analytical skills!

  • Count Days in month

    Hi Team members,
    we are working on a budgeting application and stuck on below Research, please assist/advise is there any built-in Function to count Days in a Month which we can use or a work around .
    Requirement:
    To calculate budgeted Expenses per month, user will enter the daily budgeted expenses for a month and it will multiple with total number of days in a month via formula. same thing happens to some revenue items.
    Note:
    every months contains different number of Days which will result in change in Expense/Revenue figures.
    e.g
    Daily Expense for Jan will be $100/day
    total days in Jan = 31
    Result will be 31*100 = $3100 expense in Jan
    but in Feb it will be
    Daily Expense for Feb will be $100/day
    total days in Jan = 28
    Result will be 28*100 = $2800 expense in Feb
    Regards,
    Alee

    Dear Alp,
    Thanks for the Code!!!
    Note:
    In general terms the algorithm for calculating a leap year is as follows...
    A year will be a leap year if it is divisible by 4 but not by 100. If a year is divisible by 4 and by 100, it is not a leap year unless it is also divisible by 400.
    Thus years such as 1996, 1992, 1988 and so on are leap years because they are divisible by 4 but not by 100. For century years, the 400 rule is important. Thus, century years 1900, 1800 and 1700 while all still divisible by 4 are also exactly divisible by 100. As they are not further divisible by 400, they are not leap years.
    Regards,
    Alee

  • How to implement this algorithm with region growing ?

    hi,
    I would like to ask u to help me in developing code for the region growing segmentation algorithm for digital images.The algorithm perform
    1.Model I should use the average of the pixel(for each colorchanel,red-green-blue ) from the color I choose.
    2. Strating start by choosing an arbitrary seed pixel via 10X10 region and calculate the average of the region and compare it with neighbouring pixels.
    3. growing region is grown from the seed pixel by adding in neighbouring pixels that are similar , increasing the size of the region.
    4. stop when the growth of one region stops, then the program should try another direction. the growth is starting on the left and in the same direction as the rotating hands of a clock
    the whole process is stoped until the growth of all the direction stoped and choose a largest region with a bounding box. all the pixels in the bounding box is now similar.
    I really don't know , how can I do it?
    Please suggest the tips to develop or code if u have for this algorithm.
    Thanks for ur help

    Something you need to consider is what sort of data structure you will use to hold the result of a region that you are growing. One possibility is to keep a second black and white image that is simply a mask of the grown region, i.e. black in the areas that have been included and white in the areas not yet covered.
    You also need to determine a threshold for similarity. How close in color space must two pixels be in order that you consider them to belong to the same region. You will need a boolean function that compares two colors and returns true if they are similar.
    Finally, if you use a mask bitmap to indicate where you have been, you can proceed in the following sort of manner.
    You can sweep across the entire image array, first right to left, then top to bottom, then left to right, then bottom to top, cycling through these 4 directions until nothing changes.
    A single sweep will consist of a double nested for loop, one incrementing x and the other incrementing y. Inside the inner loop you are considering a single pixel at (x,y)
    So assume that you are sweeping from left to right, i.e. incrementing x
    You will be expanding the reagion at (x,y) only if
    a) mask(x-1,y) is black (i.e. the previous pixel is in the region.
    b) maks(x,y) is white (the current point is not in the region
    c) color of image at (x,y) is similar to color of region
    When you update the region you will
    a) color the mask at (x,y) black
    b) add the RGB from the image to TotalR,TotalG,TotalB in region
    c) increase point count for the region
    The point count for a region and the TotalR etc allow you to compute the average color of the region at any time. You can detect if a single pass changed anything by noticing if the pointCount changed between two passes
    This algorithm is not particularly efficient, because you keep sweeping over the entire array, but it is easy to comprehend and easy to code.
    Note: the hard part is determining a decent threshold for color similarity. everything else is very straight forward.
    Enjoy!

Maybe you are looking for

  • Validate Text Box value for ending spaces entered in a Custom 2010 InfoPath SharePoint 2010 form

    I have Custom InfoPath form for added and editing items into a SharePoint 2010 list.  For one of the fields I want to perform some data validation to make sure they did not add any spaces at the beginning or ending of the value they entered.  I have

  • Files on Memory Card

    I am deleting unwanted files and programs from my Memory Card. There are some names having large files  i am not familiar with. MSG-m1 MSG-m1b MSG-m2 MSG-m4 & m4b NASB module 1 & 1F NASB Module 2 &2F  NLT-m1 - m4 I cant figure what they are associate

  • Updating to ipod software version 1.2.1.

    I have just bought a new ipod (5th generation) and am prompted to update to version 1.2.1., when synchronizing with my computer. However, despite having no internet connectivity problems for anything else I get the following pop up message. 'Itunes c

  • Portal Logoff delaying.

    Dear All, I'm facing the problem like while click on logoff, it will take time to logoff. My system is running on EP7.01 SP3. Please reply back how to resolve this. Really appriciated your inputs. Thanks and Regards, Mahee.

  • Claims (Asia) : Benefits Administration

    Hi SAPients, My query is regarding the processing of Claims. How to delete the processed/accounted Claims from system. Also is it at all recommended to delete the accounted Claims of past years from the system. Also please comment as how to use the P