Algorithm to find out checkdigits

I'm working on a code that finds the checkdigit of an array of ISBN numbers, and returns a boolean value of true is the ISBN number is valid and false if the ISBN nemuber is invalid. I've figured out most of it but need help with figuring out the rest. The whole thing takes up about three pages, here are screenshots of it in order: http://img219.imageshack.us/img219/1024/compscilab74iyt5.jpg
http://img233.imageshack.us/img233/4888/compscilab74iisj7.jpg
http://img218.imageshack.us/img218/7261/compscilab74iiirs3.jpg
If you don't want to go to the links, I'll try to explain it:
International Standard Book Numbers
The final character of a ten-digit International Standard Book Number (ISBN) is a check digit that is computed as follows:
Working from right to left,
multiply each digit (other than the as-yet-unknown check digit) by its position in the number (including the as-yet-unknown check digit);
add the products together;
subtract the total from the closest multiple of 11 greater than or equal to that total. The answer is the check digit (using the letter "X" if the answer happens to be 10).
Consider, for example, the ISBN 0-201-53082-1.
Calculating the digit-by-position products yields
2 ? 2 = 4; 8 ? 3 = 24; 0 ? 4 = 0; 3 ? 5 = 15; 5 ? 6 = 30;
1 ? 7 = 7; 0 ? 8 = 0; 2 ? 9 = 18; 0 ? 10 = 0.
Adding the products together yields
4 + 24 + 0 + 15 + 30 + 7 + 0 + 18 + 0 = 98.
Subtracting 98 from 99 yields the check digit 1.
Since our calculation yields the same result as the final digit of the given ISBN, we conclude that this ISBN is valid.
While this may seem more complicated than UPC check digits, it can be validated very simply by adding together all the digit-by-position products (including the check digit, whose position is of course 1). If the result is a multiple of 11, then the ISBN is valid. (Recall that to check if an int n is a multiple of 11, determine whether or not n % 11 is 0.)
The String Array c contains the "stringified" individual elements (including hypens) of a ten-digit ISBN. (In the above example, the contents of c would be "0", "-", "2", "0", "1", "-", "5", "3", "0", "8", "2", "-", "1", in that order.) Complete the following code to store in the boolean variable good the value true if and only if the ISBN is valid.
// Enter values to test here
String[] c = { "0", "-", "2", "0", "1", "-", "5", "3", "0", "8", "2", "-", "1" };
boolean good;
int sum = 0;
int pos = 1;
// Loop over array from end to start
for ( int i = c.length - 1; i >= 0; i-- )
// Ignore hyphens
if ( !c.equals( "-" ) )
// Deal with a possible "X" digit
if ( sum > 0 )
sum += Integer.parseInt(c[i]) * pos;
else
sum += Integer.parseInt(c[i]) * pos;
pos++;
int j = sum;
while(j % 11 != 0)
j++;
System.out.println(sum);
System.out.println(j);
good = ((j - sum) == Integer.parseInt(c[12]));

I'm working on a code that finds the checkdigit of an array of ISBN numbers, and returns a boolean value of true is the ISBN number is valid and false if the ISBN nemuber is invalid. I've figured out most of it but need help with figuring out the rest. The whole thing takes up about three pages, here are screenshots of it in order: http://img219.imageshack.us/img219/1024/compscilab74iyt5.jpg
http://img233.imageshack.us/img233/4888/compscilab74iisj7.jpg
http://img218.imageshack.us/img218/7261/compscilab74iiirs3.jpg
If you don't want to go to the links, I'll try to explain it:
International Standard Book Numbers
The final character of a ten-digit International Standard Book Number (ISBN) is a check digit that is computed as follows:
Working from right to left,
multiply each digit (other than the as-yet-unknown check digit) by its position in the number (including the as-yet-unknown check digit);
add the products together;
subtract the total from the closest multiple of 11 greater than or equal to that total. The answer is the check digit (using the letter "X" if the answer happens to be 10).
Consider, for example, the ISBN 0-201-53082-1.
Calculating the digit-by-position products yields
2 ? 2 = 4; 8 ? 3 = 24; 0 ? 4 = 0; 3 ? 5 = 15; 5 ? 6 = 30;
1 ? 7 = 7; 0 ? 8 = 0; 2 ? 9 = 18; 0 ? 10 = 0.
Adding the products together yields
4 + 24 + 0 + 15 + 30 + 7 + 0 + 18 + 0 = 98.
Subtracting 98 from 99 yields the check digit 1.
Since our calculation yields the same result as the final digit of the given ISBN, we conclude that this ISBN is valid.
While this may seem more complicated than UPC check digits, it can be validated very simply by adding together all the digit-by-position products (including the check digit, whose position is of course 1). If the result is a multiple of 11, then the ISBN is valid. (Recall that to check if an int n is a multiple of 11, determine whether or not n % 11 is 0.)
The String Array c contains the "stringified" individual elements (including hypens) of a ten-digit ISBN. (In the above example, the contents of c would be "0", "-", "2", "0", "1", "-", "5", "3", "0", "8", "2", "-", "1", in that order.) Complete the following code to store in the boolean variable good the value true if and only if the ISBN is valid.
// Enter values to test here
String[] c = { "0", "-", "2", "0", "1", "-", "5", "3", "0", "8", "2", "-", "1" };
boolean good;
int sum = 0;
int pos = 1;
// Loop over array from end to start
for ( int i = c.length - 1; i >= 0; i-- )
// Ignore hyphens
if ( !c.equals( "-" ) )
// Deal with a possible "X" digit
if ( sum > 0 )                                                      } This is the part
sum += Integer.parseInt(c) * pos;                         } that I                
else                                                                   } think i'm doing
sum += Integer.parseInt(c) * pos;                         } wrong.
pos++;
int j = sum;
while(j % 11 != 0)
j++;
System.out.println(sum);
System.out.println(j);
good = ((j - sum) == Integer.parseInt(c[12]);Edited by: stone_cutter on Nov 9, 2007 4:12 PM
Edited by: stone_cutter on Nov 9, 2007 4:18 PM

Similar Messages

  • Help needed to write algorithm to find Direction given lat/lon

    Hello, i need an algorithm to find out the direction being traveled given the starting and ending lat/lon decimal coordinates. Anybody have any clues how to do it? or where i can find one to just plug into my program? thanks for your help
    public String getDirection(double prevLat, double prevLon, double newLat, double newLon) {
        String direction;
        return direction;
    }

    Perhaps this helps:
    http://www.cssd.ab.ca/tech/social/latitude/index.html
    It will help you learn the meaning of lat/long-coords. I think you will end up with somthing like this:
    if ( prevLat < newLat) {
       //we are travelling north
    else {
       // we are travelling south
    if (prevLong < newLong) {
       //we are travelling east?
    else {
       //we are travelling west
    }This could be wrong, since there is a west-long and an east-long..
    Anyhow, hope this gets you on your way.
    ps: is this a class-assignment??

  • How do I find out when a picture was downloaded in my photo file on my ipad

    I'm trying to find out when a picture was added to photos on my iPad.  Is there away to do so?

    i'm not entirely sure about the new tab page - in principle it will use an algorithm which populates the slots based on the frequency & the recency of visits. however i think that sites removed from the history should also disappear from the new tab page (when i tried it it was at least true after i've restarted the browser once) - if this isn't happening for you then it might be some bug...
    in any case firefox won't have the proper features to reliably monitor your kids' browsing behaviour - they always can use private browsing mode where no traces will be left on the pc or manually "clean up" the history.

  • How to find out the columns which has 16 digit credit card number

    Hi All,
    I have a requirement where in i need to find out the columns which has 16 digit credit number in it and create a report with owner, table name and column name.
    The issue is that the credit card number can be entered in any columns of any table of any schema. For example the credit card number can be entered in any description field(eg: The number is 4001412134642881), in that case i need to filter only the numbers and do the LUHN check to validate the credit card number.
    Please provide me a suggestion on how to scanl the values of all the columns to know the column which has credit card number.
    Regards,
    Raj.

    Tell me this - how the hell do you have a database with credit card number data and NOT know which columns of which tables contain credit card numbers? (and how on earth is this data NOT encrypted!?)
    How is what you want to do, NOT a fishing expedition to hack a database that may or may not be storing credit card details?
    And do you honestly think that we should simply trust that once you have extracted these numbers, performed a Luhn algorithm to verify these as credit card numbers, you are not going to fraudulently use these credit card numbers!?
    I have marked your posting as an attempt to hack an Oracle database for fraudulent use of credit card data. I hope that your OTN account is terminated soon and trust that your too much of a coding idiot to actually succeed in this endevour.

  • How to find out the amount of ram a computer can hold

    I want to know how to find out what is the max amount of ram my computer can actually take advantage of, rather than tell you my model and you tell me what is the max because I know it varies according to the model of the Computer
    But if you'd like to help the other way, here is my model: Macbook(13-inch, Mid 2010 [unibody]) basically the latest version of the white macbook.

    Pointdexter11 wrote:
    simple version: what algorithms do they use to figure out the max is 8GB 
    That is not a simple question.  I don't think anyone here knows the exact testing process that Apple uses to determine what the max ram will be at the time of release.  This is done during the development process.

  • How to find out the best settings for BDT

    Hi there.
    I am trying to predict a movie rating. I downloaded datasets from IMDb, prepared them. A tried all of the regression algorithms, but the best result is giving Boosted Decision Tree. Now I am dealing with the best settings in this algorithm.
    With default, running time was 69 seconds and the mean absolute error was 0.4844, which is quite much I think. So I tried to improve it by changing parameters of the BDT module. I tried to set Leaves per tree to 150 and than experimentaly find
    remaining parameters. I've come to Samples per leaf=12, Learning rate=0.04 and
    Number of trees=700. Running time was 78 seconds and mean absolute error was 0.4596.
    Input of the algorithm is joined matrix with 14 columns (11 features) and 67672 rows splitted into 70:30 (training:testing).
    Is there any way how to find out the best setting of Boosted Decision Tree?

    Yordan's suggestion is correct, though the documentation is a bit outdated.
    You can use the single parameter + sweeper mode or define your own custom ranges in the BDT module with the Parameter Range setting
    Regards,
    aK

  • How do I find out when a I calendar event was declined by it invitee?

    How do I find out the date and time a I calendar events invitation was declined?

    i'm not entirely sure about the new tab page - in principle it will use an algorithm which populates the slots based on the frequency & the recency of visits. however i think that sites removed from the history should also disappear from the new tab page (when i tried it it was at least true after i've restarted the browser once) - if this isn't happening for you then it might be some bug...
    in any case firefox won't have the proper features to reliably monitor your kids' browsing behaviour - they always can use private browsing mode where no traces will be left on the pc or manually "clean up" the history.

  • How do I find out when I last paid for exporting Adobe files to Excel?

    I paid for a year of service and my service appears no longer active.  It seems as though it has been less than a year since I paid for my subscription.  How do I find out when I actually first signed up for this service?

    i'm not entirely sure about the new tab page - in principle it will use an algorithm which populates the slots based on the frequency & the recency of visits. however i think that sites removed from the history should also disappear from the new tab page (when i tried it it was at least true after i've restarted the browser once) - if this isn't happening for you then it might be some bug...
    in any case firefox won't have the proper features to reliably monitor your kids' browsing behaviour - they always can use private browsing mode where no traces will be left on the pc or manually "clean up" the history.

  • Algorithm to find non repeating number from the list

    Hi,
    Can anybody provide me the algorithm for the program:
    User has provided a list of 'n' numbers (0-9) with only a single number not repeating at all and rest may repeat odd or even number of times. Now, job is to find out the number which is occuring only single time without repetition....

    Hi
    If n is a smallish number, then something like
    int bins[10];
    memset bins to zero;
    for (int i = 0; i < n; ++i)
    ++bins[arrayDigits[i]];
    for (int i = 0; i < 10; ++i)
    if (bins[i] == 1)
    printf("digit is %d\n", i);
    /* break if certain that i is the only bin == 1 */
    break;
    (arrayDigits is an array of the 'n' digits).
    If n is large, then you'll probably want to break out of that first loop as soon as only one of the bins.
    unsigned flag;
    unsigned first = 0US;
    unsigned second = 0US;
    for (int i = 0; i < n; ++i)
    flag = 1U << arrayDigits;
    if (first & flag)
    if (!(second & flag))
    /* second occurence of digit */
    second |= flag;
    /* exit condition is that 'first' has all bottom 10 bit set and
    'second' has all but 1 of the bottom 10 bits set */
    if (first == 0x3ff)
    /* all 'first' bits set */
    switch (second)
    case ~(1U << 0): /* digit is 0 */
    case ~(1U << 1): /* digit is 1 */
    case ~(1U << 9): /* digit is 9 */
    printf("digit is %d\n", i);
    break;
    default:
    /* do nothing - more than one digit still not at 'first' */
    /* else already seen 2 or more of digit */
    else
    /* first occurence of digit */
    first |= flag;
    I haven't tested any of the code.
    Paul

  • SQL to find out changes

    Hi,
    I have a table with 50 columns, lets call it Table_A . There is a identical table called Table_B. The data in Table_B gets flushed every night and data from Table_A is moved to Table_B. A new set of data is inserted into Table_A. Now I need to find out which field value is changed and what is changed . A minus command can give the changed records, but how to get the what was prior value for each changed field . Here is what I am looking for
    WITH TABLE_A AS  (  SELECT 1 ID, 'JOHN' NAME,  'SALES' DIV FROM DUAL
    UNION
            SELECT 2 ID, 'MARRY' NAME,  'ACCOUNTS' DIV FROM DUAL
    UNION
            SELECT 3 ID, 'KIM' NAME,  'SERVICE' DIV FROM DUAL),
    TABLE_B AS  (  SELECT 1 ID, 'JOHN' NAME,  'SALES' DIV FROM DUAL
    UNION
            SELECT 2 ID, 'MARRY' NAME,  'ACCOUNTS' DIV FROM DUAL
    UNION
            SELECT 3 ID, 'KIM' NAME,  'SALES' DIV FROM DUAL) 
    SELECT * FROM TABLE_A
    MINUS
    SELECT * FROM TABLE_B
    what i want is something that will spit out this (only one record, because there is only one diff record found in the above query.)
    ID,     OLD_ID,     NAME,   OLD_NAME ,  DIV ,       OLD_DIV
    3           3       KIM       KIM       SERVICE     SALESThe above one is for sample purpose, The actual table has 50 fields, and except the ID field, all other field values might change.
    All ideas and solutions are appreciated.
    Thanks in advance.

    >
    I understand your frustration. Here is the scenario. There are set of 5 tables. 1 master and 4 child tables ( and an identical set of 5 tables called "prior" tables, to store the flushed data from the "current" 5 tables). Every night data comes in XML files, the data from the 5 "prior" tables get flushed out . The data from the 5"current" table set moves to 5 "prior" tables. Then XML data gets loaded into the 5 "current"tables. Now once XML gets loaded into the original table ,I have to find out the diffs in those 5 tables(between current and prior) and generate result sets listing only the columns that have changed value. So what is current value and what was the prior value(from the prior table) side by side .
    >
    I'm not frustrated. It's just that any suggestions we make are solely based on the information provided. Sometimes posters start focusing on the solution they want to use (which is ok for their viewpoint) and don't explain the actual problem they are trying to solve. That often limits our ability to understand the options.
    Now that you posted the above there is another option you could use that might better deal with some of the issues people have mentioned.
    That solution is to compare the XML versions of the data. You haven't mentioned HOW you load that XML data into relational tables (what tool and process) but there is one VERY USEFUL feature of data in XML format:
    ALL data is already in TEXT format (excluding the obvious LOB possibilities, which you also haven't mentioned).
    That means ALL datatypes can use simple string comparison to detect differences: numbers, dates, character data. The actual meaning doesn't matter. If even a single byte is different the value can be considered different.
    Oracle uses XML and XSLT functionality as the base for their DBMS_METADATA_DIFF package. That package is used to compare schemas or databases to detect object (e.g. tables, views) differences and to automatically produce DDL for ALTER statements that can modify an object to have the same structure as the objects being compared.
    I suggest that you consider doing your comparisons on the XML versions of the data. Each night you would compare the new XML file data against the previous night's XML data. You can use XSLT to do the comparison and also to produce an XML file that contains the differences. Then you can use that 'difference' file as the source of your process to ultimately display the data.
    An additional advantage of doing the XML comparisons is that you can do them asynchronously as soon as the new file is available. And the, if you don't really need the 'change' info in the database you never need to load it. Just transform the change XML into an Excel file or flat file format for users to load into Excel for review.
    Do you license the partitioning option? If so then another suggestion would be to stop doing your nightly 'flush and move'. Recreate your 'prior' tables as partitioned tables that have just ONE range partition; a MAXVALUE partition that covers ALL data. Then each night you would:
    1. TRUNCATE the prior table
    2. Do an EXCHANGE partition between the 'current' table and the associated 'prior' table. Very fast, metadata only - no data actually gets moved.
    3. Load the 'current' table with new data.
    The above process avoid any actual data movement between the 'current' and 'prior' tables.
    Not picking on you but you also haven't said how that new daily 'current' data is being used. If the only reason you are loading it into a table is to compare it to yesterday's data you could just do that with XML like I mentioned above.
    Or you could load the XML itself into a table (e.g. XMLTYPE) and uses Oracle's built-in XDB fuctionality and do the XML comparison 'inside' the database. Then load a standard heap table from the XML table when you need to.
    Maybe the above helps explain why the more info we have about the actual end-to-end problem you have the more options we can suggest for dealing with it. You are the only one that can determine if an option is viable for your particular use case and constraints.
    Updated to add links to Oracle's XML functionality
    See the XMLDiff function that you can use IN the database if you load the XML files themselves. From the SQL Language doc
    http://docs.oracle.com/cd/E11882_01/server.112/e26088/functions241.htm#SQLRF20025
    >
    Purpose
    The XMLDiff function is the SQL interface for the XmlDiff C API. This function compares two XML documents and captures the differences in XML conforming to an Xdiff schema. The diff document is returned as an XMLType document.
    For the first two arguments, specify the names of two XMLType documents.
    For the integer, specify a number representing the hashLevel for a C function XmlDiff. If you do not want hashing, set this argument to 0 or omit it entirely. If you do not want hashing, but you want to specify flags, then you must set this argument to 0.
    For string, specify the flags that control the behavior of the function. These flags are specified by one or more names separated by semicolon. The names are the same as the names of constants for XmlDiff function.
    See Also:
    Oracle XML Developer's Kit Programmer's Guide for more information on using this function, including examples, and Oracle Database XML C API Reference for information on the XML APIs for C
    Examples
    The following example compares two XML documents and returns the difference as an XMLType document:
    >
    See Oracle' own XML Developer's Kit for out-of-the-box functionality for 'diffing' XML documents:
    http://docs.oracle.com/cd/E11882_01/appdev.112/e23582/adx_c_diff.htm
    >
    21 Determining XML Differences Using CThe Oracle XDK includes components that help you to determine the differences between the contents of two XML documents and then to apply the differences (patch) to one of the XML documents.
    This chapter contains these topics:
    Overview of XMLDiff in C
    Using XmlDiff
    Using XmlPatch
    Using XmlHash
    Overview of XMLDiff in C
    You can use Oracle XmlDiff to determine the differences between two similar XML documents. XmlDiff generates an Xdiff instance document that indicates the differences. The Xdiff instance document is an XML document that conforms to an XML schema, the Xdiff schema.
    You can then use XmlPatch, which takes the Xdiff instance document and applies the changes to other documents. This can be used to apply the same changes to a large number of XML documents.
    XmlDiff only supports the DOM API for input and output.
    XmlPatch also supports the DOM for the input and patch documents.
    XmlDiff and XmlPatch can be used through a C API or a command line tool, and they are exposed by two SQL functions.
    An XmlHash C API is provided to compute the hash value of an XML tree or subtree. If hash values of two trees or subtrees are equal, the trees are identical to a very high probability.
    >
    Did you notice that part about 'XmlDiff generates an Xdiff instance document that indicates the differences'? That is EXACTLY what your initial question was asking about, albeit from a DB perspective.
    But XML is XML, DIFF is DIFF, a date/number/text are all strings. So XML 'database data' works the same as XML 'test or complex hierarchy' data.
    Here is a pretty good writeup of how to do XML diff. See the XMLDIFF2 section for the best Oracle sample:
    http://ellebaek.wordpress.com/2011/02/01/comparing-xml-in-oracle/
    >
    XMLDIFF2
    The algorithm in our extended XMLDIFF function that we’re going to call XMLDIFF2 is:
    1.Prepare CLOB variable for constructing the difference XML.
    2.Find minimum number of leading elements that form primary key values (unique lookup).
    3.Look for primary key values in XML1 not present in XML2: These primary key values have been deleted.
    4.Look for primary key values in XML2 not present in XML1: These primary key values have been inserted.
    5.Diff all common primary key values, ie in both XML1 and XML2.
    6.Return NULL if no differences found.

  • ACE 4710: Find out the response time of a real server

    Hi to everyone,
    I have a couple of ACE 4710 and I need to find out what is the response time of a real server.
    Is there a way for this?
    Thank you for any answer!
      giorgio romano

    Hi,
    Kindly add the following line in your serverfarm configuration:
    predictor response syn-to-synack
    Suppose your serverfarm looks like this:
    serverfarm host AAA_FARM
    predictor response syn-to-synack
    probe HTTP_PROBE
    probe TCP9001_PROBE
    rserver SC106
    inservice
    rserver SC107
    inservice
    rserver SC108
    inservice
    rserver SC109
    inservice
    rserver SC110
    inservice
    rserver SC111
    inservice
    rserver SC112
    inservice
    rserver SC113
    inservice
    rserver SC114
    inservice
    rserver SC120
    inservice
    rserver SC131
    inservice
    And then use the following command to see the average response time from your rserver as follows:
    ACE1/prod# show serverfarm AAA_FARM detail
    serverfarm     : AAA_FARM, type: HOST
    total rservers : 11
    active rservers: 11
    description    : ServerFarm AAA
    state          : ACTIVE
    predictor      : RESPONSE
    method            : syn-to-synack
    samples           : 8
    failaction     : -
    back-inservice    : 0
    partial-threshold : 0
    num times failover       : 0
    num times back inservice : 0
    total conn-dropcount : 0
    Probe(s) :
    HTTP_PROBE,  type = HTTP
    TCP9001_PROBE,  type = TCP
    ----------connections-----------
    real                  weight state        current    total      failures
    ---+---------------------+------+------------+----------+----------+---------
    rserver: SC106
    x.x.x.x.:0        8      OPERATIONAL  2          1125       0
    max-conns            : 4000000   , out-of-rotation count : 0
    min-conns            : 4000000
    conn-rate-limit      : -         , out-of-rotation count : -
    bandwidth-rate-limit : -         , out-of-rotation count : -
    retcode out-of-rotation count : -
    load value           : 0
    average response time (usecs) : 81   ----> thats what you might be looking for
    From other day :
    rserver: SC114
    x.x.x.x:0        8      OPERATIONAL  70         10903      2
    max-conns            : 4000000   , out-of-rotation count : 0
    min-conns            : 4000000
    conn-rate-limit      : -         , out-of-rotation count : -
    bandwidth-rate-limit : -         , out-of-rotation count : -
    retcode out-of-rotation count : -
    load value           : 0
             average response time (usecs) : 1334                       ----> thats what you might be looking for
    For Serverfarm BBB_FARM
    serverfarm     : BBB_FARM, type: HOST
    total rservers : 1
    active rservers: 1
    description    : ServerFarm BBB
    state          : ACTIVE
    predictor      : RESPONSE
    method            : syn-to-synack
    samples           : 8
    failaction     : -
    back-inservice    : 0
    partial-threshold : 0
    num times failover       : 1
    num times back inservice : 1
    total conn-dropcount : 0
    Probe(s) :
    ----------connections-----------
    real                  weight state        current    total      failures
    ---+---------------------+------+------------+----------+----------+---------
    rserver: SC208
    x.x.x.x:0        8      OPERATIONAL  0          0          0
    max-conns            : 4000000   , out-of-rotation count : 0
    min-conns            : 4000000
    conn-rate-limit      : -         , out-of-rotation count : -
    bandwidth-rate-limit : -         , out-of-rotation count : -
    retcode out-of-rotation count : -
    load value           : 0
             average response time (usecs) : 0   ----> thats what you might be looking for
    Use more detials for response predictor:
    http://www.cisco.com/en/US/docs/app_ntwk_services/data_center_app_services/ace_appliances/vA3_1_0/configuration/slb/guide/rsfarms.html#wp1068831
    Configuring the Application Response Predictor
    To instruct the ACE to select the server with the lowest average response time for the specified response-time measurement based on the current connection count and server weight (if configured), use the predictor response command in server farm host or redirect configuration mode. This predictor is considered adaptive because the ACE continuously provides feedback to the load-balancing algorithm based on the behavior of the real server.
    To select the appropriate server, the ACE measures the absolute response time for each server in the server farm and averages the result over a specified number of samples (if configured). With the default weight connection option configured, the ACE also takes into account the server's average response time and current connection count. This calculation results in a connection distribution that is proportional to the average response time of the server.
    The syntax of this command is as follows:
    predictor response {app-req-to-resp | syn-to-close | syn-to-synack}[samples number]
    The keywords and arguments are as follows:
    •app-request-to-resp—Measures the response time from when the ACE sends an HTTP request to a server to the time that the ACE receives a response from the server for that request.
    •syn-to-close—Measures the response time from when the ACE sends a TCP SYN to a server to the time that the ACE receives a CLOSE from the server.
    •syn-to-synack—Measures the response time from when the ACE sends a TCP SYN to a server to the time that the ACE receives the SYN-ACK from the server.
    •samples number—(Optional) Specifies the number of samples over which you want to average the results of the response time measurement. Enter an integer from 1 to 16 in powers of 2. Valid values are 1, 2, 4, 8, and 16. The default is 8.
    For example, to configure the response predictor to load balance a request based on the response time from when the ACE sends an HTTP request to a server to when the ACE receives a response back from the server and average the results over four samples, enter:
    host1/Admin(config)# serverfarm SFARM1
    host1/Admin(config-sfarm-host)# predictor response app-req-to-resp
    samples 4
    To reset the predictor method to the default of round-robin, enter:
    host1/Admin(config-sfarm-host)# no predictor
    To configure an additional parameter to take into account the current connection count of the servers in a server farm, use the weight connection command in server farm host predictor configuration mode. By default, this command is enabled. The syntax of this command is as follows:
    weight connection
    For example, enter:
    host1/Admin(config)# serverfarm SF1
    host1/Admin(config-sfarm-host)# predictor response app-request-to-resp
    samples 4
    host1/Admin(config-sfarm-host-predictor)# weight connection
    To remove the current connection count from the calculation of the average server response time, enter:
    host1/Admin(config-sfarm-host-predictor)# no weight connection
    You can use threshold milliseconds parameter which is optional Specifies the required minimum average response time for a server. If the server response time is greater than the specified threshold value, the ACE removes the server from the load-balancing decision process (takes the server out of service).
    Enter an integer from 1 to 300000 milliseconds (5 minutes). The default is no threshold (servers are not taken out of service).
    In case if you have measures the response time from  when the ACE sends a TCP SYN to a server to the time that the ACE receives a CLOSE from the server  use syn-to-close      (already discussed previously)
    If you have to measures the response time from when the ACE sends a TCP SYN to a server to the time that the ACE receives the SYN-ACK from the server use syn-to-synack   (already discussed previously)
    SAMPLES parameter is optional and  specifies the number of samples that you want to average from the results of the response time measurement and response time is used to select the server with the lowest response time for the requested response-time measurement. If you do not specify a response-time measurement method, the ACE uses the HTTP app-req-to-response method.
    Whenever a server's load reaches zero, by default, the ACE uses the autoadjust feature to assign a maximum load value of 16000 to that server to prevent it from being flooded with new incoming connections. The ACE periodically adjusts this load value based on feedback from the server's SNMP probe and other configured options.
    Using the least-loaded predictor with the configured server weight and the current connection count option enabled, the ACE calculates the final load of a real server as follows:
    final load = weighted load × static weight × current connection count
    where:
    •weighted load is the load reported by the SNMP probe
    •static weight is the configured weight of the real server
    •current connection count is the total number of active connections to the real server
    The ACE recalculates the final load whenever the connection count changes, provided that the (config-sfarm-host-predictor) weight connection command is configured. If the (config-sfarm-host-predictor) weight connection command is not configured, the ACE updates the final load when the next load update arrives from the SNMP probe.
    If two servers have the same lowest load (either zero or nonzero), the ACE load balances the connections between the two servers in a round-robin manner.
    HTH
    Plz rate if u find it useful.
    Sachin

  • How do i find out when a tab was last visited?

    I have just recently started using Firefox, after using Chrome for a long time. It was on my computer, but I never used it before. However, some of my kids use my computer. I stopped using Chrome and just began using Firefox for my browsing and when I open a new tab, the window includes other tabs that have been visited. I see that there is some questionable browsing going on and I want to find out when these websites were visited. When I check the History, I only get for today and yesterday and it doesn't take much to figure out how to browse in private. My question is twofold...first, how did these tabs get there in the first place? And two, is there any way to find out when they were accessed?
    Thanks!

    i'm not entirely sure about the new tab page - in principle it will use an algorithm which populates the slots based on the frequency & the recency of visits. however i think that sites removed from the history should also disappear from the new tab page (when i tried it it was at least true after i've restarted the browser once) - if this isn't happening for you then it might be some bug...
    in any case firefox won't have the proper features to reliably monitor your kids' browsing behaviour - they always can use private browsing mode where no traces will be left on the pc or manually "clean up" the history.

  • Find out the peak position from graph

    Hello All,,
    Actually i want to run this algorithm real time,, to find out the peak position from graph ,, i need to generate the position automatically,,, firstly i try to use image processing by  apply threshold followed by edge detection and the find out the center of each  detected part. the drawpack of this procedure is that the obtained images are different and that lead to different threshold values,, so how can i directly find the position from the graph,,, here i attach the image and the graph of the image,,
    thank you,,
    Attachments:
    11.png ‏15 KB
    13.PNG ‏85 KB

    Hello Klemen: 
    here i will explain in more details: the main objective of my work is to calculate velocity of small particle,, i perform my experiments by exposing the particle to 2 light pulses,, and i know the time between the two pulses,, so i need to know the distance to calculate the velocity,,, for that i apply correlation,,, the spot that appear in the correlation image is an indication of symmetry,,,so i should know the location of maximum intensity of each peak. The central peak (highest intensity) will be the reference (zero point) and the other peaks locations should be subtracted from the reference peak to determine the shift,,,
    Here is the sequence of the process:
    Acquiring raw image, correlation, position of central peak, shift calculation, velocity determination,,,,,
    applying image processing is good idea in case of post processing condition,,, but in my case i need it real time, that mean if i need to apply image processing for calculation, i have to find out a universal criteria for threshold value that can be applied for all raw images,, from my experiments i didn't find specific criteria & i have to manually change the threshold value,,
    If I choose the intensity (grey level) to be the criteria, then the small peaks (symmetry) will not take place,, because their intensity is very low compare to the central peak,,,
    So the most reliable procedure is to directly find out the position of the two small peaks beside the central peak and save this values into an array and use it for calculation,,, I hope I am clearly explain my problem..
    Thanks 
    Attachments:
    7-2.png ‏36 KB
    7-1.png ‏3 KB
    7-700.PNG ‏123 KB

  • Recursive algorithm to find maximum

    Hi there,
    I am looking for a recursive algorithm for finding the maximum and minimum values in a double array.
    I did find the code from this forum. It works upto the size of array=200 fine.. it however just waits and waits for larger size of the array.
    The code I am using is:
    public double maxRecursive(double [] array){
    if (array.length==1){
         return array[0];
    double [] next=new double[array.length-1];
    System.arraycopy(array,1,next,0,array.length-1);
    return Math.max(array[0],maxRecursive(next));
    Could anyone help me with a better algorithm? I feel the above code is a overhaul with arraycopy as well as the recursive calls.
    Thanks for all your help!
    JP

    try this exact code, and see the output (System.out.prints). That will explain you the logic.
    public double maxRecursive(double [] array, int pos) {
         if (array.length - 1==pos) {
              System.out.println("So, I read all the elements, Final Value is :"+array[pos]+"\n");
              return array[pos];
         double recMax = maxRecursive(array, pos+1);
         System.out.println("Now I am at "+pos+" Position !!!\n");
         System.out.println("Till now my maximum value is : "+recMax+"\n");
         if(array[pos] > recMax) {
              System.out.println("My previous element is "+array[pos]+" since it is greater than my max value, here onwards, this will be my max value\n");
              return array[pos];
         else {
              System.out.println("My Previous element is "+array[pos]+" since it is less than my max value, my max value will not change\n");
              return recMax;
    }Sudha

  • How to find out list user who did the printing

    Dear All,
    We are using network print server using HP LaserJet 5550 and jetdirect, since our number of users is more than 500 staff in one place, sometimes they do the unresponsible printing such as print full color photos for personal use, print a novel and anything that not related to the business purpose.
    Today, our director found out that someone print out a whole story book and spend a lot of paper... he challenge me to find out who is the user who did this? I can log on to the printer web console, but I can't find user log printing...
    Any help will be much appreciated.
    Thanks & Regards,
    Franky

    This seems to be a commercial product. For the best chance at finding a solution I would suggest posting in the forum for HP Business Support!
    You can find the Commercial Jetdirect board here:
    http://h30499.www3.hp.com/t5/Print-Servers-Network​-Storage/bd-p/bsc-254
    Best of Luck!
    You can say thanks by clicking the Kudos Star in my post. If my post resolves your problem, please mark it as Accepted Solution so others can benefit too.

Maybe you are looking for

  • Installation of B1 Integration Component in SAP Business One 9.0 PL 08

    Hi Experts I have trouble with installing B1 integration component Below is the specs of the system 1. SAP 9.0 PL 08 2. SQL 2008 R2 3. Windows 7 32 Bit Initially this system was with installed with SAP 9.0 PL 05 and later upgraded to PL 08 During the

  • Blanket Purchase Order and the Framework Order

    hi Gurus, I wanted to know the following. What is the difference between Blanket Purchase Order and the Framework Order. Thanks.

  • Using Nik Silver Efex 2.0 in Photoshop

    I am editing a picture using Silver Efex 2.0 through Photoshop filters. When I am completed I click on OK and get a message that Photoshop has stopped working and the program closes. My work is lost. Any ideas on the issue?

  • Can someone explain why upgrading to PSE 12 resulted in two kinds of people tags?

    Can someone explain why upgrading to PSE 12 resulted in two kinds of people tags? One is the new Group tag (with its own two-person icon) and the other tag is the original People tag (one perswon silhouette icon) from previous version. If person alre

  • Problem to run a web querie

    Hello everyone, I have a small problem, I made a modification of a querie because it gave an error when executed. And it turns out that once corrected the error, I run the query in the BEX analyzer, and everything perfect no mistake, however querie r