Necessary CAPICOM SetSecret algorithm

We use CAPICOM encode API to encrypt a message in our projects. Since the support for CAPICOM is currently abandoned, I am replacing CAPICOM with an alternative. I am considering the CryptEncrypt function as an alternative, but the API is very different from CAPICOM that we currently use. We use the method SetSecret of CAPICOM

IEncryptedDataPtr enc (__uuidof (EncryptedData));
HRESULT hr = enc-> SetSecret ("* secretPassword *", CAPICOM_SECRET_PASSWORD "");

I'm not able to find another way to do what the SetSecret. Could you please give me the algorithm used by SetSecret to derive a session key? Any help/suggestion will be appreciated as well.

Link to SetSecret of CAPICOM: http://msdn.microsoft.com/en-us/library/windows/desktop/aa382015%28v=vs.85%29.aspx

Link to the CryptEncrypt function: http://msdn.microsoft.com/en-us/library/windows/desktop/aa379924%28v=vs.85%29.aspx

Hello

Your message exceeds the scope of those consumer forums. Better, answered by the developer audience.

Go to the following site.

http://social.msdn.Microsoft.com/forums/en-us/home

Concerning

Tags: Windows

Similar Questions

  • Support OFF-tas maps seem to generate a lot of garbage to insert... ! ?

    I did a lot of caches distributed with cards support different landmarks. The results where partially positive (I was hoping that partitioned card support off-tas (splitting) would be almost as fast as a non split on bunch of support card). For different types of queries in reading and this turns out to be mostly true (some queries were slightly slower - probably because they when executed by partition).

    For insertions, it does however unfortunately quite seem to be another story - already when using a card of support of NIO no splitting inserts seem to generate a lot of waste slowing the reference down considerably and when to pass a plan to support NIO splitting this effect became so extreme that full GC took place more or less constantly on the nodes of the cache slows down execution down to almost a standstill :-(

    Has anyone else tried this and seen the same results or one of the developers of consistency have a theory?

    To me it seems like network-io for off-lot (using storage allocated using nio buffers just as the communication buffers!) should be at least also easy to achieve without generating excessive waste as for heap objects, but since I do not know the inner workings of consistency, I can't say with certainty if there is something that breaks this theory?

    For me the main covered advantage through the use off-lot rather than on the heap was REDUCED activity GC and shorter breaks, but instead of this, it seems that the result is the opposite - at least by making insertions...

    My example does not use (or need!) and secondary indexes (performs only the get/put/locking/unlocking) but each entry is locked before being inserted and unlocked after (this is necessary for the algorithm that I use as a benchmark) - as I mentioned in another thread, it is a shame that no 'lockAll' / unlockAll method calls are (my reference suffers a lot of all calls remote lock/unlock)-load for this, however, is nothing compared to the drop in performance that comes from the whole GC...

    I tried to adjust the GC in several ways, but this has only to a very limited extent reduced the length of breaks GC or the frequency of full-CG - it seems to me that as a LOT of waste is generated for a reason any...

    The setings which so far resulted in any GC-overhead (yet terribly wrong though!) are - XX: + UseParallelGC - XX: + UseAdaptiveSizePolicy. I use 1.6.0_14 coherence 3.5 GE and Sun JRE.

    / Magnus

    Published by: MagnusE on August 10, 2009 15:01

    Hi Magnus,

    You have reached a bug we are working on currently: COH-2495. We will publish a patch when a fix is available.

    In the meantime, you can avoid this problem by specifying and the same in (http://coherence.oracle.com/display/COH35UG/nio-memory-manager).

    If you validate your configuration of nio memory manager, we can see him again.

    Kind regards

    David

  • How to use CAPICOM to digitally sign an xml document given a certifcate security uses the RSA-SHA256 algorithm

    We have an old VB6 application that uses CAPICOM to digitally sign an xml document?  The certificate of the previous guest set implemented the RSA-SHA1 algorithm.

    New client certificate using RSA-SHA256.  Can I use CAPICOM2 or .NET to use the new certificate to accomplish the same function?

    Hello

    Your question of Windows is more complex than what is generally answered in the Microsoft Answers forums. It is better suited for the IT audience Pro on MSDN. Please post your question in the MSDN forum. You can follow the link to your question:

    http://social.msdn.Microsoft.com/forums/en-us/categories/

  • Death in unicast and multicast mode detection algorithm

    Hello

    Today, I tried to check - how does detection of death in multicast and unicast. To my understanding - that, in two modes, consistency has following algorithm:

    1. All members in unicast cluster heartbeat messages send with 2 other members, using the TCP connection via the port UDP cluster.
    2. Senior member (senior for that service?) send heartbeat broadcast messages.

    In both modes (Unicast and Multicast) - consistency is using TcpRing mode, am I right?

    My questions are:

    1. How each Member of the cluster detects - so that others of 2 nodes, it must send the message of heartbeat?
    2. If the node 1 is down - how nodes, which sent the message drive to this node change heartbeat for message impulse unicast address? And how long will it take?
    3. If the node that declined-joins the cluster - node will send heartbeat messages to this node and works with her consistency?
    4. How can I see in the newspapers, the heart beats (I changed the level of logging at 9, but it does not show the heartbeat messages)?
    5. What is a full role of the upper limb in multicast (perhaps new members connect to the upper limbs, and then it sends the notification to all members via broadcast/multicast or something else?)? And what is the difference between the WKA and senior member unicast? What is a member additional features WKA performs?

    Thank you!

    There is only one difference between unicast and multicast dead detection variants so we will cover only the first.  In a multicast are grouped the cluster senior (member of the cluster of longer life) emits a blink of an eye a multicast times per second.  That heartbeat contains the IDS of all the cluster members.  A non-superieur member receives the multicast heartbeat if heart rate is its main known, and does not contain the Member of reception in all of the known members of the recipient will deduct that it was for a reason any declared as dead and so now does not not to be part of the cluster.  At this point, the receiving Member stops his grouping and wait for an external stimulus to try to join the cluster.  This stimulus would be basically any user code that attempted to use a cluster resource.  Note that this is not exactly detection of death, but rather of detection that you have been declared dead.  In a cluster of unicast only the realization even happen by non primary member by train to learn that other members refuse to ack, any of her communications.  It should be noted that in both cases, we take on a undead member of learning that he was falsely declared dead and this is an extremely rare event.

    Next move common aspects of the detection of death which are used by multicast and unicast based clusters.  All other forms use only unicast i.e. point to point networks.  In fact, we have three separate death detection mechanisms:

    The first is TcpRing, which monitors deaths in the form of suspension of processing of other members.  Basically, we create a 'ring' of TCP connections which includes all members of the cluster, for example 3-> 2-> 1-> 3.  On the side of the destination of the connection will never close the connection, so the side origin knows that if the connection is closed, it means that the Remote OS kernel has detected that the process is dead and this nucleus has cleaned the connection and to inform the other side that it is closed.  This form of detection of death is deterministic, that there is essentially no such thing as a false positive, and that if the connection is detected as closed the remote member must be dead.  One of the advantages of this is that it allows a very fast detection because it involves no waiting times, only the time that necessary for the nucleus remote to send a packet to the original machine, so we don't talk detection of millisecond under processes completed that.  Most of the deaths are detected through this mechanism.  Unfortunately, this mechanism is not infallible because it is based on a working network connection between the origin of the Member and the machine target.  Thus, it cannot detect a failed computer or network.

    This is where IpMon comes.  IpMon is a component within coherence where each Member once a second "pings" one machine in the cluster.  If the ping fails he follows it with additional pings (two by default).  If none of these pings work and there had been no acknowledgements of all members on the target during the ping cycle machine failed the remote machine is considered be failed and all the members who were running on it are reported as dead.  Note that the pings are not against members remote but the remote machines and therefore should succeed even if the remote member was temporarily unavailable due to a GC.  Time-out based means it is not deterministic, and we must set a relatively high time and try the County to try to avoid false positives.  The default value is three five second ping attempts.  So basically if you put a machine out of service or disconnect it from the IpMon network must withdraw all its members fifteen seconds approximately.  It is quite a long time from the time of detection under "millisecond" of TcpRing, but it is still fast enough.  Failure also produces far less often then suspension of treatment so it ends not accounting for most of the detections, but it does not fill in the void left by TcpRing.

    The final mechanism used is a delay of delivery of packets.  Each packet by coherence should get ack was within a few hundred milliseconds.  If it's not it gets broadcast automatically every few hundred milliseconds.  If this condition persists for an extended period (five minutes by default) then a fault is declared and one on both sides of the operation in the end must be removed from the cluster.  The original Member will consult with the other two members of the cluster and at least another agrees that the Member does not meet the destination member is declared as dead.  If both consulted members indicate that the destination seems to work very well then the author assumes local failure and ends.  In addition to the traffic normal cluster consistency will automatically send a heartbeat from point to point to a few other members once per second with an algorithm that ensures that every Member will be issued a heartbeat or some other communication within 2/3 of the timeout that is 2/3, 5 m.  And even in an inactive cluster sure us we would still have minimum transmissions both detect the inability of the acknowledgement, and also to have enough current stats to answer another Member of query asking if some third-party member building.  This type of detection of death only comes into play for a strange type of death.  The faulty Member machine and the process are detected as living, but the Member is inadmissible.  Basically it watches just for bugs in the transport of coherence itself.  It can also be caused by the target process receives no time CPU for a long time, I.E. CTRL-Z, GC, or Exchange and as such almost never occurs because failure would need to last five minutes.

    Regarding forestry, we do not have an option to save the package-level operations, but there will be if a member is declared as death and why he stated as being deceased.

    I hope that answers your questions.

    Thank you

    Mark

    The Oracle coherence

  • Algorithm in PL/SQL

    I have a table that contains versions of a tool installed in the format

    1.0.2

    1.0.3

    1.0.3.1

    1.0.4

    1.0.4.1

    1.0.4.2

    I want a digital equivalent of these versions, 1.0.3.1 is a version of 1.0.3 sup

    Its digital equivalent must follow the rule below

    that is numeric (1.0.3) < numeric (1.0.3.1) < numeric (1.0.4).

    This must be done using PL/SQL, there should be an algorithm for it

    Not necessarily to provide the exact code, the pseudo-code / logical is also welcome

    I'm on 11g

    Mehdi says:

    More, that the versions can be alphanumeric also just one condition

    as 1.0.2a.3

    It will not be as 1.0.2ab.3 - there will be just one character

    And you didn't think that this little piece of overtaking has been important to mention at the beginning?

    If you examine the word characters in it, then you need something that determines that under the versions without an alpha come before (or after, if you like the choice belongs to you) with the alphas.

    So, suppose that those without alphas come before those with alphas, we don't have to look at the characters ascii values.  You are indicating that the alphas will be just something like a to z, so if we assume that no void alpha versions have a space character, we know that a space is ascii 32 and highlight alphas...

    SQL > ed
    A written file afiedt.buf

    1 with t as (select ' 1.0.2' like worm from dual union all)
    2. Select '1.0.3' across double Union
    3. Select "1.0.3.1" any double Union
    4 Select "1.0.3a.1" of all the double union
    5 Select ' 1.0.3.2» of any union double
    6 select ' 1.0.4' throughout Union double
    7 select ' 1.0.4.1» of any union double
    8 select ' 1.0.4.2' double
    9            )
    10-
    11 - the end of test data
    12-
    13. Select worm
    14, nvl (regexp_substr (ver2,'[^.] +', 1, 1) '000').
    15 nvl (regexp_substr (ver2,'[^.] +', 1, 2), "000").
    16 nvl (regexp_substr (ver2,'[^.] +' 1, 3), "000").
    NVL 17 (regexp_substr (ver2,'[^.] +' 1, 4), "000") as order_value
    18 in (select worm, regexp_replace ('00' | regexp_replace(ver||))) e ',' [(0-9])\.','\1.'),'(\.)','\100') as t ver2)]
    19 * order by 2
    SQL > /.

    ORDER_VALUE WORM
    -------- ------------------------------
    1.0.2 001 000 002 000
    1.0.3 001 000 003 000
    1.0.3.1 001 000 003 001
    1.0.3.2 001 000 003 002
    1.0.3a.1 a 001 000 003, 001
    1.0.4 001 000 004 000
    1.0.4.1 001 000 004 001
    1.0.4.2 001 000 004 002

    8 selected lines.

    So, now the order of the data is based on strings rather than numbers.

    So that allows you to compare versions using esityksen < versionb="" or="" versiona=""> versionB, I personally believe that it bad practice to compare strings using operators of numerical range... even if it does not work.

    In this case I would probably go for a version that includes the alphas according to their values in the value ascii digital overall... something like...

    SQL > ed
    A written file afiedt.buf

    1 with t as (select ' 1.0.2' like worm from dual union all)
    2. Select '1.0.3' across double Union
    3. Select "1.0.3.1" any double Union
    4 Select "1.0.3a.1" of all the double union
    5 Select ' 1.0.3.2» of any union double
    6 select ' 1.0.4' throughout Union double
    7 select ' 1.0.4.1» of any union double
    8 select ' 1.0.4.2' double
    9            )
    10-
    11 - the end of test data
    12-
    13. Select worm
    14, (ascii (upper (p4_a))-32) +.
    p4_n 15 * 100 +.
    16 (ascii (upper (p3_a))-32) * 10000 +.


    17 p3_n * 1000000 +.
    18 (ascii (upper (p2_a))-32) * 100000000 +.
    19 p2_n * + 10000000000
    20 (ascii (upper (p1_a))-32) * 1000000000000 +.
    21 p1_n * 100000000000000 as num_value
    22 in (select worm
    23, nvl (regexp_substr (regexp_substr (worm, "[^.]"))) +', 1, 1),'[0-9] +'), '0') as p1_n
    24, nvl (regexp_substr (regexp_substr (worm, "[^.]"))) +', 1, 1), "[a - z] (+')(,' ') as p1_a.
    25, nvl (regexp_substr (regexp_substr (worm, "[^.]"))) +', 1, 2),'[0-9] +'), '0') as p2_n
    26, nvl (regexp_substr (regexp_substr (worm, "[^.]"))) +', 1, 2), "[a - z] (+')(,' ') as p2_a"
    27, nvl (regexp_substr (regexp_substr (worm, "[^.]"))) +'1, 3),'[0-9] +'), '0') as p3_n
    28, nvl (regexp_substr (regexp_substr (worm, "[^.]"))) +' 1, 3), "[a - z] (+')(,' ') as p3_a"
    29, nvl (regexp_substr (regexp_substr (worm, "[^.]"))) +'1, 4),'[0-9] +'), '0') as p4_n
    30, nvl (regexp_substr (regexp_substr (worm, "[^.]"))) +' 1, 4), "[a - z] (+')(,' ') as p4_a"
    31 t)
    32 * order by 2
    SQL > /.

    NUM_VALUE WORM
    -------- -----------------------------
    1.0.2 100000002000000
    1.0.3 100000003000000
    1.0.3.1 100000003000100
    1.0.3.2 100000003000200
    1.0.3A.1 100000003330100
    1.0.4 100000004000000
    1.0.4.1 100000004000100
    1.0.4.2 100000004000200

    8 selected lines.

    It is what allows from 0-99 for the digital part of each version of sub as 0-99 for the ascii value of the alpha character (I subtracted 32 in my code just to make it not alphanumeric subversions have a value of 0 for the alpha part, and using the STEM is not really necessary, because I subtract 32) , brings just the ascii values to a lower level, so there is less danger of having an ascii value of more than 99.

  • PL/SQL implementation of algorithm of backpack without terminals?

    Hello world

    I am currently working on an algorithm to find the best possible combination according to a lower cost for > = necessary quantity (it's much a similar to a backpack boundless algorithm). For example, if 100 pieces are necessary since the given pool stores (see the data in the table below), I have to come up with a best possible combination. So, in this example, the best choice would be to pull the store_id (A, B, C). I'm currently experimenting with a limited record set 20 who, according to my approach (ie the brute force) who would SELECT (POWER (2.20)) FROM DUAL;  1048576 * 20 iterations and it takes more than 30 seconds using pure PL/SQL. Some information more I play a few checks to see if one store has a required amount then choose the store and out else make a comparison of cross join assuring that the store_id even are not attached then finally if nothing bothers me the quantity required then I'll for a brute force approach. If there is a best way to short circuit the third stage or all have a similar problem and came up with a BETTER solution, please let me know. He could help me and probably many others (SQL approach is available but not PL/SQL). I tried to look for something similar online but has never been able to find any implementation of PL/SQL of the algorithm of bag backpack.

    store_id available_qty cost_per_unit

    A431.93
    B342.01
    C272.12
    D242.18
    E242.18
    F24

    2.18

    Table script and insert above instructions

    DROP TABLE available_qty;

    CREATE TABLE available_qty (store_id VARCHAR2 (1) PRIMARY KEY,)

    available_qty NUMBER,

    cost_per_unit NUMBER);

    INSERT INTO available_qty)

    store_id,

    available_qty,

    cost_per_unit)

    VALUES ('A',

    43,

    1.93);

    INSERT INTO available_qty)

    store_id,

    available_qty,

    cost_per_unit)

    VALUES ('B',

    34,

    2.01);

    INSERT INTO available_qty)

    store_id,

    available_qty,

    cost_per_unit)

    VALUES ('C',

    37 M

    2.12);

    INSERT INTO available_qty)

    store_id,

    available_qty,

    cost_per_unit)

    VALUES (',)

    24,

    2.18);

    INSERT INTO available_qty)

    store_id,

    available_qty,

    cost_per_unit)

    VALUES ('E',

    24,

    2.18);

    INSERT INTO available_qty)

    store_id,

    available_qty,

    cost_per_unit)

    VALUES ('F',

    24,

    2.18);

    COMMIT;

    The package that I put in place (I took ideas from multiple sources and come to this, just so that everyone knows)

    CREATE or REPLACE PACKAGE get_available_qty

    IS

    TYPE available_qty_typ IS RECORD (store_id VARCHAR2 (1))

    available_qty NUMBER,

    cost_per_unit NUMBER,

    best_combo_flag VARCHAR2 (1));

    TYPE available_qty_nt IS TABLE OF THE available_qty_typ;

    TYPE available_qty_aat IS TABLE OF THE available_qty_typ

    INDEX BY PLS_INTEGER;

    FUNCTION get_best_combo (p_qty_required NUMBER)

    RETURN available_qty_nt

    IN PIPELINE;

    END;

    /

    CREATE or REPLACE PACKAGE get_available_qty BODY

    AS

    FUNCTION get_best_combo (p_qty_required NUMBER)

    RETURN available_qty_nt

    PIPELINED

    IS

    get_available_qty_nt get_available_qty.available_qty_nt

    : = get_available_qty.available_qty_nt ();

    -Local subprogramme

    FUNCTION get_required_qty

    RETURN available_qty_nt

    IS

    v_qty NUMBER: = 0;

    v_cost_per_unit NUMBER: = 0;

    V_cost_per_unit1 NUMBER: = 0;

    v_best_store_id VARCHAR2 (4000) DEFAULT NULL;

    v_best_store_id_combo VARCHAR2 (4000);

    is_qty_available BOOLEAN DEFAULT FALSE;

    is_first_run BOOLEAN DEFAULT TRUE;

    v_assign_store_id_flag DBMS_UTILITY.uncl_array;

    v_table_length directory.

    -Local subprogramme nested

    FUNCTION return_null

    RETURN available_qty_nt

    IS

    BEGIN

    get_available_qty_nt. Delete;

    RETURN get_available_qty_nt;

    END;

    BEGIN

    SELECT aq.*,

    "N' best_combo_flag

    LOOSE COLLECTION get_available_qty_nt

    Of available_qty aq;

    FOR indx IN 1... get_available_qty_nt. COUNTING LOOP

    v_qty: = v_qty + get_available_qty_nt (indx) .available_qty;

    END LOOP;

    -If the total available quantity is less than the required quantity can return null

    IF v_qty > = p_qty_required THEN

    is_qty_available: = TRUE;

    ON THE OTHER

    get_available_qty_nt: = return_null();

    END IF;

    -The sub condition will run when the available quantity > = necessary quantity

    IF is_qty_available THEN

    -Check if any single store has available!

    FOR rec IN 1... get_available_qty_nt. COUNTING LOOP

    IF get_available_qty_nt (rec) .available_qty > = p_qty_required THEN

    IF (v_cost_per_unit > get_available_qty_nt (rec) .cost_per_unit) THEN

    v_cost_per_unit: = .cost_per_unit get_available_qty_nt (CRE);

    v_best_store_id_combo: = .store_id get_available_qty_nt (CRE);

    ELSIF (v_cost_per_unit = 0) THEN

    v_cost_per_unit: = .cost_per_unit get_available_qty_nt (CRE);

    v_best_store_id_combo: = .store_id get_available_qty_nt (CRE);

    END IF;

    END IF;

    END LOOP;

    -Reset local variables

    IF v_best_store_id_combo IS NOT NULL THEN

    is_qty_available: = FALSE;

    ON THE OTHER

    v_cost_per_unit: = 0;

    v_best_store_id_combo: = NULL;

    END IF;

    -If above condition does not then execute a combination of Cartesian product comparison

    IF is_qty_available THEN

    BECAUSE me in 1... get_available_qty_nt. COUNTING LOOP

    v_qty: = 0;

    v_cost_per_unit1: = 0;

    FOR j IN 1... get_available_qty_nt. COUNTING LOOP

    IF (get_available_qty_nt (i) .store_id! = get_available_qty_nt (j) .store_id) THEN

    v_qty: = get_available_qty_nt (i) .available_qty

    + get_available_qty_nt (j) .available_qty;

    v_cost_per_unit1: = get_available_qty_nt (i) .cost_per_unit

    + get_available_qty_nt (j) .cost_per_unit;

    IF v_qty > = p_qty_required THEN

    IF (v_cost_per_unit! = 0)

    AND v_cost_per_unit1 < v_cost_per_unit) THEN

    v_cost_per_unit: = v_cost_per_unit1;

    v_best_store_id_combo: = get_available_qty_nt (i) .store_id

    || ','

    || get_available_qty_nt (j) .store_id;

    ELSIF v_cost_per_unit = 0 THEN

    v_cost_per_unit: = v_cost_per_unit1;

    v_best_store_id_combo: = get_available_qty_nt (i) .store_id

    || ','

    || get_available_qty_nt (j) .store_id;

    END IF;

    END IF;

    END IF;

    END LOOP;

    END LOOP;

    -Reset local variables

    IF v_best_store_id_combo IS NOT NULL THEN

    is_qty_available: = FALSE;

    ON THE OTHER

    v_cost_per_unit: = 0;

    v_cost_per_unit1: = 0;

    v_best_store_id_combo: = NULL;

    END IF;

    -Carry out all possible combinations (Brute Force approach)

    IF is_qty_available THEN

    BECAUSE me in 1... POWER (2, get_available_qty_nt.) (COUNT) - 1 LOOP

    v_qty: = 0;

    v_best_store_id: = NULL;

    v_cost_per_unit: = 0;

    FOR j IN 1.get_available_qty_nt. COUNTING LOOP

    IF BITAND (i, POWER (2, j - 1))! = 0 THEN

    v_qty: = v_qty + get_available_qty_nt (j) .available_qty;

    v_best_store_id: = v_best_store_id | get_available_qty_nt (j) .store_id | ',';

    v_cost_per_unit: = (v_cost_per_unit + get_available_qty_nt (j) .cost_per_unit);

    END IF;

    END LOOP;

    IF (v_qty > = p_qty_required) THEN

    IF is_first_run THEN

    v_cost_per_unit1: = v_cost_per_unit;

    is_first_run: = FALSE;

    END IF;

    IF (v_cost_per_unit < = v_cost_per_unit1) THEN

    v_best_store_id_combo: = RTRIM (v_best_store_id, ",");

    v_cost_per_unit1: = v_cost_per_unit;

    END IF;

    END IF;

    END LOOP;

    END IF;

    END IF;

    END IF;

    -Make a list for the allocation of the Pavilion

    DBMS_UTILITY.comma_to_table (list = > v_best_store_id_combo,)

    Many = > v_table_length,

    tab = > v_assign_store_id_flag);

    FOR k in 1... v_assign_store_id_flag. COUNTING LOOP

    FOR l IN 1... get_available_qty_nt. COUNTING LOOP

    IF get_available_qty_nt (l) .store_id = v_assign_store_id_flag (k) THEN

    get_available_qty_nt (l) .best_combo_flag: = 'Y ';

    END IF;

    END LOOP;

    END LOOP;

    RETURN get_available_qty_nt;

    END;

    BEGIN

    get_available_qty_nt: = get_required_qty();

    BECAUSE me in 1... get_available_qty_nt. COUNTING LOOP

    PIPE ROW (get_available_qty_nt (i));

    END LOOP;

    RETURN;

    END;

    END get_available_qty;

    -When you call the function, it returns the result back with indicators updated for stores with the most profitable combination!

    SELECT *.

    TABLE (get_available_qty.get_best_combo (100))

    ORDER BY best_combo_flag DESC;

    The best combination for 100 items stores are marked "Y".

    store_id available_qty cost_per_unit best_combo_flag

    A431.93THERE
    B342.01THERE
    C272.12THERE
    D242.18N
    E242.18N
    F242.18N

    SELECT *.

    TABLE (get_available_qty.get_best_combo (70))

    ORDER BY best_combo_flag DESC;

    The best combination of store that will make up 70 or more items are marked "Y".

    store_id available_qty cost_per_unit best_combo_flag

    A431.93THERE
    B342.01THERE
    E242.18N
    D242.18N
    F242.18N
    C272.12N

    Sorry, this seems to be a problem trivial backpack to me, since the 'size' different weighted units is the same.

    Then you can simply use a greedy algorithm, taking the cheaper units first.

    This could easily be done using analytical functions.

    The magic number here is 100. It can be replaced by a parameter or variable binding.

    To make it more unambigous in two stores have the same costs, you can extend the order by the analytical function with the value.

    Select

    store_id

    available_qty

    cost_per_unit

    case

    When nvl (sum (available_qty) (cost_per_unit order

    lines between unlimited and 1 preceding)

    0)

    < 100="" then="">

    another "n".

    end best_combo_flag

    of available_qty

    order of cost_per_unit, store_id

    STORE_ID AVAILABLE_QTY COST_PER_UNIT BEST_COMBO_FLAG
    A 43 1.93 THERE
    B 34 2.01 THERE
    C 27 2.12 THERE
    F 24 2.18 N
    D 24 2.18 N
    E 24 2.18 N

    Post edited by: chris227

  • I need the Md5 algorithm for password encryption adf

    Can someone provide pointer how to use the algorithm Md5 password encryption for the adf

    Ah, database 11g is great.
    But it does not help you. In middleware, alias in a managed Bean of ADF you must use the Oracle Security Development Toolkit libraries to encrypt the password before storing it in the database. Traffic between the middleware and database is not normally encrypted and readable for all network sniffer.
    When the user connects, you can use a similar mechanism to compare the encrypted password.
    The other solution would be to use an LDAP server for the user/password information (WebLogic has a built-in and very good for small environments). No encryption necessary, as does the LDAP protocol.
    Since you don't mention the middleware you use, here is the link to 11g of BCI for the tool box: http://download.oracle.com/docs/cd/E14571_01/apirefs.1111/e10668/toc.htm

    HTH,
    -olaf

  • sql/PLSQL algorithm: is a rectangle filled with the other rectangles

    Hello
    I have 2 tables: T1 and T2:
    with T1 as
    (select 2 FromPeriod, 4 ToPeriod, 10 FromSum, 12 ToSum  from dual)
    select * from t1;
    
    
    with T2 as
    (select 1 FromPeriod, 2 ToPeriod, 9 FromSum, 5 ToSum  from dual
    union all
    select 1 FromPeriod, 3 ToPeriod, 9 FromSum, 4 ToSum  from dual
    union all
    select 2 FromPeriod, 5 ToPeriod, 9 FromSum, 11 ToSum  from dual
    union all
    select 2 FromPeriod, 5 ToPeriod, 11 FromSum, 12 ToSum  from dual)
    select * from t2;
    FromPeriod, ToPeriod are positive whole number without decimal point.
    FromSum, ToSum are positive numbers can have the comma.

    Table T1 contains unique in the columns 'FromPeriod-ToPeriod' points, that means that is there is a record where "FromPeriod-ToPeriod" = [2-4], then it is certainly not rendered as "FromPeriod-ToPeriod" = [1-4] keys wich [2-4] period, such a thing is not possible in table P1, it contains only unique periods that do not touch. Then the records with periods [2-4], [5-6] are ok in there.
    But table T2 allows periods affecting somehow. You can see that T2 contains "FromPeriod-ToPeriod" = [1-2] and also [1-3] that touch each other.

    We can look at the two tables T1 and T2 as rectangles where X - axis is the values of the axes and the "FromPeriod-ToPeriod" is [FromSum, ToSum].
    I need sql/plsql algorithm that returns true if the rectangle of table T1 is discovered/filled with rectangles in table T2. If the rectangle in T1 is completely filled or even more filled than necessary, then algorithm should return true. If even a small neighborhood in rectangle T1 is not filled by rectangles in T2, then the algorithm must return false.

    As see you in the sample data, T1 has a rectangle: [2-4; 10-12] T2 contains 4 mentions that fill/overdraw this area defined by T1. So for the moment the algorithm must return true.

    I do not know how to write effective elsewhere such algorithm, can you help me?

    --
    At the moment I only came with such algorithm/query:

    Test1: this test should return true:
    --query: is rectangle [2-4;10-12] filled? -Yes.
    with T2 as
    (select 1 FromPeriod, 2 ToPeriod, 9 FromSum, 5 ToSum  from dual
    union all
    select 1 FromPeriod, 3 ToPeriod, 9 FromSum, 4 ToSum  from dual
    union all
    select 2 FromPeriod, 5 ToPeriod, 9 FromSum, 11 ToSum  from dual
    union all
    select 2 FromPeriod, 5 ToPeriod, 11 FromSum, 12 ToSum  from dual)
    select * from t2
    where (2 <= ToPeriod and 4 >= FromPeriod) -- x-axes overlapping
    and (10 <= ToSum and 12 >= FromSum)--y-axes overlapping
    ;--2 rows
    
    --
    
    2     5     9     11
    2     5     11     12
    I takes as input the T1 table horizontal axes (2, [4]) and research data table T2 that affect this horizontal axes, also the value axes is compared. But how then? There are 2 files, but it can give 10 stores overlap in the periods and amounts. How to determine now that rectange T1 is filled?

    Test2: This case should return false:
    --query: is rectangle [2-4;10-12] filled? -No.
    with T2 as
    (select 1 FromPeriod, 2 ToPeriod, 9 FromSum, 4 ToSum  from dual
    union all
    select 1 FromPeriod, 3 ToPeriod, 9 FromSum, 4 ToSum  from dual
    union all
    select 2 FromPeriod, 4 ToPeriod, 9 FromSum, 11 ToSum  from dual
    union all
    select 2 FromPeriod, 5 ToPeriod, 13 FromSum, 13 ToSum  from dual)
    select * from t2
    where (2 <= ToPeriod and 4 >= FromPeriod) -- x-axes overlapping
    and (10 <= ToSum and 12 >= FromSum)--y-axes overlapping
    ;--1 row.
    
    2     4     9     11

    Charles,

    I see 2 choices, but none is likely to evolve very well. The first can be with SQL - subdivision T1 into unit squares and see if everything not covered by T2:

    with T1 as
    (select 2 FromPeriod, 4 ToPeriod, 10.1 FromSum, 12 ToSum  from dual)
    , T1X as
    (select (FromPeriod+level)-1 as Period from T1 connect by level <= (ToPeriod-FromPeriod)+1)
    , T1Y as
    (select (FromSum+level*.01)-.01 as Summ from T1 connect by level <= (ToSum-FromSum+.01)/.01)
    , T1XY as (select Period,Summ from T1X,T1Y)
    ,T2 as
    (select 1 FromPeriod, 2 ToPeriod, 9.99 FromSum, 10.1 ToSum  from dual--satisfies sub-region [(2,2);(10.1,10.1)]
    union all
    select 1 FromPeriod, 2 ToPeriod, 9.99 FromSum, 10.11 ToSum  from dual--now satisfied sub-regions: [(2,2);(10.1,10.11)
    union all
    select 2 FromPeriod, 2 ToPeriod, 10 FromSum, 12.01 ToSum  from dual--now satisfied sub-regions: [(2,2);(10.1,12)
    union all
    select 3 FromPeriod, 4 ToPeriod, 10 FromSum, 11.99 ToSum  from dual--now satisfied sub-regions: [(2,2);(10.1,12)],[(3,4);(10,11.99)]
    union all
    select 4 FromPeriod, 4 ToPeriod, 10 FromSum, 13 ToSum  from dual--now satisfied sub-regions: all filled, return true
    )
    select Period,Summ from T1XY
    where not exists (
    select 1
    from T2
    where T2.FromPeriod<=T1XY.Period
    and   T2.ToPeriod>=T1XY.Period
    and   T2.FromSum<=T1XY.Summ
    and   T2.ToSum>=T1XY.Summ
    )
    ;
    

    The second option is more inspiring you described, using a recursive algorithm to subdivide the T1 into small rectangles for each rectangle in T2. For example:

    X(1)={[a,b;c,d]}
    
    Y={[e,f;g,h];[i,j;k,l]}
    
    X(2)={[a,e;c,g];[e,f;c,g];[f,b;c,g];[a,e;g,h];[f,b;g,h];[a,e;h,d];[e,f;h,d];[f,b;h,d]}
    or
    X(2)={[a,b;c,g];[a,b;h,d];[a,e;c,d];[f,b;c,d]}  -- this gives some overlap, but fewer rectangles and the algorithm still works.
    
    You would have to refine it to handle partial overlaps correctly, then drop areas that don't have a positive area. If
    X(2) becomes empty then it is fully covered. It might be most efficient to sort T2 in order of descending area.
    

    Kind regards
    Bob

  • Oracle password algorithm

    Hi I'm trying to simulate oracle algorithm to create a hash of the user name and password.

    the version of the database is 10.2

    >
    Algorithm:
    1 concatenate the user name and the password to produce a string of plain text;
    2 convert the string in clear uppercase;
    3 convert the string of plain text to the storage format of number of bytes; ASCII characters have the
    high byte value 0 x 00;
    4 encrypt the plain text string (completed with 0 if necessary for the next block length)
    using the algorithm in block cipher block chaining) the CBC mode (with a fixed key value of)
    0x0123456789ABCDEF;
    5. encrypt the string of plaintext with DES-CBC, but using the last output block
    from the previous step (without taking into account the parity bits) as the encryption key. The last block of the
    output is converted to a printable string in order to get the password hash value.
    >
    DECLARE
      username varchar2(30):= 'bob';
      pass varchar2(30):='bob1';
         enc_val RAW(2048);
      str varchar2(60);
      l_mod number;
      key_bytes      RAW (16):=hextoraw('0123456789ABCDEF');
    BEGIN
      str:= UPPER(username || pass);
    
      l_mod:= dbms_crypto.ENCRYPT_DES + dbms_crypto.CHAIN_CBC+ dbms_crypto.PAD_ZERO;
      
      enc_val := dbms_crypto.encrypt(UTL_I18N.STRING_TO_RAW (str,  'AL32UTF8'),l_mod,key_bytes);
      enc_val := dbms_crypto.encrypt(UTL_I18N.STRING_TO_RAW (str,  'AL32UTF8'),l_mod, enc_val);
         
      dbms_output.put_line(enc_val);
    END;
    I got:
    A338AB13B60756EA
    And if I try:
    Select password from sys.user$ where name = "BOB";
    D5D3AA09DD03B20F

    What I am doing wrong?

    Take the unicode_str functions and crack of his screenplay.

  • Interesting scenario, is it necessary to reset the logs periodically?

    10.2.0.2 Ent Ed - Rman 10.2.0.2 - aix 5.3

    Is it possible you need to perform a reset of the logs periodically? This issue initially came to me at the worst of times, during a large enough database recovery.

    If / when you perform a spfile or controlfile recovery without a recovery catalog, if your log sequence is greater than 255 and your last backup was more a day there, is - it possible your last backup is located? In our scenario, we had a day old controlfile cliché that we used, but I don't know if we would have been able to recover was not there. Reading of 10g, Recovery Manager Reference manual:

    "FROM AUTOMATIC BACKUP.
    [autoBackupOptionList]
    Restores a backup of control file. You can specify this option on the RESTORE CONTROLFILE controls and RESTORE SPFILE. When restoring or another type of file in NOCATALOG mode, the SAFEGUARD clause is necessary.

    RMAN starts the search on the current date or the day specified with the VALUE up to THAT. If no automatic backup is in the currents or DEFINED so far, RMAN checks the previous day from sequence 256 (or sequence specified by MAXSEQ) until it reaches 0. The search continues until days MAXDAYS (default 7, maximum of 366) of the current or DEFINED to date. If no automatic backup located within days MAXDAYS, RMAN reports an error and stops the command. "

    The doc says not her, but if you have not already tried it define MAXSEQ > 256, you will get an error if you do. 256 is the upper limit for the parameter MAXSEQ. This is an excerpt from my test of this code:

    < code >
    oracle_sandbox1 > target rman.

    Recovery Manager: release 10.2.0.2.0 - Production on Fri 21 Nov 09:16:36 2008

    Copyright (c) 1982, 2005, Oracle. All rights reserved.

    connected to target database: WEBDEV (DBID = 1965364971)

    RMAN > show all.

    using the control file of the target instead of recovery catalog database
    RMAN configuration parameters are:
    CONFIGURE REDUNDANCY 5 RETENTION STRATEGY;
    CONFIGURE BACKUP OPTIMIZATION # by default
    CONFIGURE THE TYPE OF DEFAULT DEVICE TO 'SBT_TAPE ';
    CONFIGURE CONTROLFILE AUTOBACKUP ON;
    CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE SBT_TAPE TO "%F" # by default
    CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO "%F" # by default
    SET UP THE DEVICE TYPE SBT_TAPE PARALLELISM 1 BACKUP BACKUPSET TYPE; # by default
    SET UP THE DEVICE TYPE DISK PARALLELISM 1 BACKUP BACKUPSET TYPE; # by default
    CONFIGURE BACKUP COPIES OF DATA FILE FOR DEVICE TYPE SBT_TAPE TO 1; # by default
    CONFIGURE BACKUP OF DATA TO DISK FILE TYPE DEVICE TO 1; # by default
    CONFIGURE BACKUP ARCHIVELOG FOR DEVICE TYPE SBT_TAPE TO 1; # by default
    CONFIGURE BACKUP ARCHIVELOG FOR DEVICE TYPE DISK TO 1; # by default
    CONFIGURE MAXSETSIZE TO UNLIMITED; # by default
    CONFIGURE ENCRYPTION OF DATABASE # by default
    CONFIGURE THE ENCRYPTION ALGORITHM "AES128"; # by default
    CONFIGURE THE NONE ARCHIVELOG DELETION POLICY; # by default
    CONFIGURE SNAPSHOT CONTROLFILE NAME TO ' / app/oracle/product/10.2/dbs/snapcf_webdev.f'; # by default

    RMAN > run {}
    2 > allocate channel t1 type 'SBT_TAPE ';
    3 > restore spfile from pfile ' / app/oracle/product/10.2/dbs/webdev_pfile.tst' from autobackup maxseq = 300;
    {4 >}

    allocated channel: t1
    channel t1: sid = 256 devtype = SBT_TAPE
    channel t1: Veritas NetBackup for Oracle - version 6.5 (2007111606)

    From restoration to November 21 08

    output channel: t1
    RMAN-00571: ===========================================================
    RMAN-00569: = ERROR MESSAGE STACK FOLLOWS =.
    RMAN-00571: ===========================================================
    RMAN-03002: failure of the restore command at 21/11/2008 09:23:46
    RMAN-06494: MAXSEQ = 300 is out of range (0-255)

    RMAN >
    < code >

    255 is max he seeks. The sequence which means MAXSEQ is not the same as the sequence of redo logs.

    You can always resort to restore spfile/controlfile by specifying the name of the backuppiece itself.

  • a VPN client is necessary?

    Is a customer VPN as necessary Incognito on MacBook?

    I've recently updated Sierra

    Yes if yu to connect to public networks and you don't want your ISP know what sites you visit

  • Keyboard in iOS Safari 10 appears when the is not necessary.

    I have a problem on my site, where the keyboard in Safari is showing all the time when there are areas of text on the page.

    The HTML code on the page is built using JavaScript, but there is no box entry and no reason the keyboard would be necessary.

    Does anyone know what are the causes of the keyboard show, or whether or not it is documented somewhere?

    I have the same problem.

    We recently launched a web application for a large client, and this problem appeared with the iOS 10 update. It wasn't a problem with previous versions of iOS and we are perplexed as to why it happens.

    Someone please drop some wisdom!

  • Install a cleaning is necessary for OS Sierra?

    Install a cleaning is necessary for OS Sierra?

    N ° it has been my experience that the so-called 'clean' install is a complete waste of time.

  • The operation cannot be completed because you do not have the necessary permissions.

    The operation cannot be completed because you do not have the necessary permissions. This is the message I get when I want to create a new folder. I don't have this problem until recently. 1.

    How should I do?

    2 is that there is a security breach?

    I use sierra but, I had the same problem with el Capitan

    When you try to create a new folder? is it an external device? your office? a NAS?

  • Is it necessary for 9.2.1 IOS users to install IOS 9.3.5 patch

    Is it necessary that the users of iphone that is running IOS 9.2.1 must install the 9.3.5 patch update which fixes a major security vulnerability or it is for users who have already updated to 9.3.4 IOS?

    Yes, if you correct the defect.

Maybe you are looking for

  • Where is the Windows taskbar?

    Why Firefox hide my taskbar Windows all of a sudden?

  • iMovie will not import film

    I have an old version of iMovie - ' 09, version 8.0.6. (821), who nonetheless worked for several projects. I am now wanting to just download a short clip - long less than 1.30 min - to give subtitles. Can't seem to be able to import it. I click file,

  • Error code 646 when trying to install Windows updates.

    Windows updates appear to download but will not be installed.  I tried to go into 'control panel '; Security systems &; then Windows updates.  It checks and concludes that they are downloaded and try to install but won't.   My computer is set to auto

  • DeskJet F4500 (wireless printing)

    Once the printer has not been used for some time, you must close the market to use wireless. It worked fine when we first bought, then all of a sudden you unplug it or turn off to have this job. Does anyone have an idea how to remedy this situation a

  • SPCSCM MFC Application has stopped working.

    SPCSCM MFC Application has stopped working. A problem caused program stop working. Windows will close the program and notify solution.Please what is and how to fix it. Pop Windows comes back with no. Solutions.  Please help me. I am a novice to the c