List E .add always returns true (or throws)?

http://download.java.net/jdk6/docs/api/java/util/List.html#add(E)
"Returns:
true (as specified by Collection.add(E))"
but http://download.java.net/jdk6/docs/api/java/util/Collection.html#add(E)
"Returns:
true if this collection changed as a result of the call"
and also says, "(Returns false if this collection does not permit duplicates and already contains the specified element.)"
I am implementing a list that doesn't allow duplicate elements -- which the List<E> doc says "is not inconceivable ... but we expect this usage to be rare." My rarity notwithstanding, I don't understand the parenthetical remark in the Returns doc for List, and I don't know whether to return false or throw if an attempt is made to add a duplicate to my list.

Err... stupid me! I totally forgot about LinkedHashSet which looks like it will solve your problem directly, with no code!
Meanwhile, a question arose on my reading of the
javadoc on LinkedHashMap. It says, "It can be used
to produce a copy of a set that has the same order as
the original, regardless of the original set's
implementation:void foo(Set m) {
Set copy = new LinkedHashSet(m);
}I don't understand how the LinkedHashSet copy
constructor can produce a copy that "has the same
order" unless the implementation of the original set
-- in particular, I guess, its iterator -- guarantees
some ordering. But then that would contradict
"regardless of the original set's implementation."Looking at the implementation, I would suggest that the JavaDoc is poorly worded. What it means is that this copy constructor will copy everything out of the first set into the new set and the order of the new set will be consistent with the order of the elements returned by the first set's iterator. (Which, of course, is likely to be undefined for the majority of Set implementations.)

Similar Messages

  • HasEventListener and willTrigger always return true

    Hi  everybody.
    I'm trying to achieve the following result.
    I'm listing all items in a form.
    When I encounter a button I check if it has already an event listener applied to it. If not , I apply the event Listener with addEventListener.
    In this way, the next time I'll list the whole form I won't apply the event listener another time (if for example I apply the same event listener twice to a button which insert a new record in a database as result I'll have 2 records added also if the user clicked once...no good at all!!!)
    To accomplish this task I'm using the Actionscript function hasEventListener(EventType) and here comes the weird thing.
    Eveytime I invoke hasEventListener on the form's button it always returns true event if is the first time a list the form (so no event listener applied yet) , even if before to invoke hasEventListener I run removeEventListener.
    I've got the same behavior when i use willTrigger() function, it always returns true no matter when i call it.
    One possible solution could be set a global boolean property to store if Ialready listed the form and applied the event listener to it, but it would be better using hasEventListener, because I've got a class that perform this form listing , and this class is used on wide project, so if I get to fix this problem inside the class I would fix the problem in the entire project in on shot (I love oop programming!!!!)
    Has anybody already addressed this problem?
    Any advisement would be really appreciated.
    Thanks in advance for the attention.
    Best regards!!
    Luke

    Hi, flex harUI.
    Thanks very much for your reply.
    I knew that if I apply an event listener twice it should fire up only once, but this isn't what happen.
    Here's my scenario:
    -  I've got a component with the form inside it
    - Through a menu a go to the state the component is in and I call an "init" function inside the component
    - In the init function I call the Class which activate the form by applying eventlistener on the button
    - The user can navigate away from the component by click another menu item and then return to the component invoking again the form activation (and so let my application apply once again the addEventListener)
    - Here's what happen: the second,third,... time the user return to the component, when he try - for example - to add a record, the record is added two,three... times according to how many times the users "reinitialized" the component. The same things happen when the user tries to delete a record, he is prompted two,three,.... times if he's sure to delete it.....
    It's a really strange behaviour.
    I've found i worked around, by setting a global bool var "initialized" and before call the form activation i check the value of this var, but It's not a very beautiful solution, 'cause I would prefer to fix this problem inside the class, so the fix the problem in the whole project just in one shot!!! (that's why I would like to use hasEventListener() to check if the button has already an eventListener)
    Thaks anyway for the reply!
    If I've some news I'll update ya.
    Bye!

  • HST65_DUTCH: Not_On_Stack_Yes always returns True

    Hello,
    It seems that the Not_On_Stack_Yet always returns true.
    I used some trace commands to show the uk1 value in the Debug Monitor and everything seems right, allthough I get always a true... And prior to my trace output I see that funtion to validate if the BR is needed and I see the BR is added.
    Could you confirm the Not_On_Stack_Yet is working properly.
    I went through through the Headstart code myself, this are my remarks:
    - See nothing strange !!
    - The add_rule checks if the rule is allready on the stack. If not, the br will be added. The add_rule doens't uses the Not_On_Stack_Yet function !!!!!
    Thanks for your help,
    Marcel Overdijk

    Marc,
    I made the following example. It's NOT working.
    * 2 BusinessRules:
    BR_JNT001_MOD (insert, update, delete)
    BR_JNT002_TPL (insert, update)
    Trigger When Condition
    qms_transaction_mgt.not_on_stack_yet
    ( p_br_name => 'BR_JNT001_MOD'
    , p_uk_comp1 => to_char(:new.bdt_id)
    , p_uk_comp2 => to_char(:new.volgnummer)
    * Debug Output:
    19:17:41 - QMS_TRANSACTION_MGT.ADD_BUSINESS_RULE BR_JNT002_TPL
    19:17:41 - MAS_DEV.MAS_JNT_CAPI.need_br_jnt002_tpl (f)
    19:17:41 - QMS_TRANSACTION_MGT.ADD_BUSINESS_RULE BR_JNT001_MOD
    19:17:41 - MAS_DEV.MAS_JNT_CAPI.need_br_jnt001_mod (f)
    * PK components of table.
    PROMPT Creating Primary Key on 'MAS_JOURNAALPOSTEN'
    ALTER TABLE MAS_JOURNAALPOSTEN
    ADD (CONSTRAINT MAS_JNT_PK PRIMARY KEY
    (BDT_ID
    ,VOLGNUMMER))
    * Need function in capi
    function need_br_jnt002_tpl
    return boolean
    is
    l_when_condition boolean;
    l_updating boolean;
    l_dml_operations boolean;
    begin
    trace('need_br_jnt002_tpl (f)');
    l_when_condition := qms_transaction_mgt.not_on_stack_yet
    ( p_br_name => 'BR_JNT001_MOD'
    , p_uk_comp1 => to_char(g_current_row.bdt_id)
    , p_uk_comp2 => to_char(g_current_row.volgnummer)
    g_current_ind.brutobedrag
    := g_current_ind.brutobedrag
    and
    (g_current_row.brutobedrag
    <> g_current_old_row.brutobedrag
    or
    (g_current_row.brutobedrag is null
    and
    g_current_old_row.brutobedrag is not null
    or
    (g_current_row.brutobedrag is not null
    and
    g_current_old_row.brutobedrag is null
    g_current_ind.btw_bedrag
    := g_current_ind.btw_bedrag
    and
    (g_current_row.btw_bedrag
    <> g_current_old_row.btw_bedrag
    or
    (g_current_row.btw_bedrag is null
    and
    g_current_old_row.btw_bedrag is not null
    or
    (g_current_row.btw_bedrag is not null
    and
    g_current_old_row.btw_bedrag is null
    g_current_ind.nettobedrag
    := g_current_ind.nettobedrag
    and
    (g_current_row.nettobedrag
    <> g_current_old_row.nettobedrag
    or
    (g_current_row.nettobedrag is null
    and
    g_current_old_row.nettobedrag is not null
    or
    (g_current_row.nettobedrag is not null
    and
    g_current_old_row.nettobedrag is null
    l_updating := g_updating
    and (g_current_ind.brutobedrag
    or
    g_current_ind.btw_bedrag
    or
    g_current_ind.nettobedrag
    l_dml_operations := g_inserting
    or l_updating
    if br_enabled('BR_JNT002_TPL')
    then
    return l_when_condition
    and
    (g_validate_all_static
    or
    l_dml_operations
    else
    return false;
    end if; -- br_enabled
    end need_br_jnt002_tpl;

  • Boolean User Properties always returns TRUE

    Hi, I am trying to get some propeties from the user on the AD and I found out with the following issue, all the boolean attributes always return TRUE as value. The Code that I am using to extract them is the following
    foreach ($objUser in $objUsers)
     $bolPasswordNeverExpires = [boolean] $objUser.Properties['PasswordNeverExpires'];
     $bolEnabled = [boolean] $objUser.Properties['Enabled'];
     $bolAccountExpired = [boolean] $objUser.Properties['AccountExpired'];
    Could you please guide me into the proper direction to solve it. I looked up in most of powershell related topic and did not find a way to solve it. I even attempt using UserAccountControl Attribute to check Enabled status do not matter agains which value
    I check it, it always returns TRUE.

    Thank´s for the tip. Unluckily when I attempt it, if I left only
    $objUsers.PasswordNeverExpires or $objUsers.Enabled, it only return whites spaces and no comparison from True or False is feasible.
    If I change it to [boolean] $objUsers.PasswordNeverExpires or $objUsers.Enabled instead of using the Properties option, it returns False for all values.
    I attempt to use the UserAccountControl field for look up the property Ex: (objUser.UserAccountControl AND 2) for Enabled and it also returns True for all situation
    I look up for the properties on the ISE interface and the only ones displayed are the following ones:
    distinguishedname
    displayname
    whencreated
    samaccountname
    sn
    accountexpires
    pwdlastset
    samaccounttype
    adspath
    useraccountcontrol
    whenchanged
    cn
    userprincipalname
    lastlogontimestamp
    msds-user-account-control-computed
    May it be an issue with the filter that does not load the specified properties?

  • CI - Powershell Boolean Rule Always Returns True

    I'm trying to create a configuration baseline / item for a particular piece of software using a powershell script of data type Boolean. However, I'm having the issue that the evaluation is always returning compliant whether the workstation is or not. The
    script is as follows:
    $ErrorActionPreference = "SilentlyContinue"
    $Condition1 = (Test-Path -LiteralPath 'HKLM:\SOFTWARE\Adobe\Premiere Pro')
    $Condition2 = (Test-Path -LiteralPath 'C:\Program Files\Adobe\Adobe Premiere Pro CS6\Presets\Textures\720_govt1_bar.png')
    if ($Condition1) {
    if ($Condition2) {echo $true}
    else {echo $false}
    else {echo $true}
    This script works perfectly fine when run locally and always returns $true or $false as expected. However it only ever returns Compliant when used in a CI. It doesn't matter what the state of the 2 conditions are, it always evaluates Compliant.
    Any ideas?

    I'm beginning to wonder if there is variation between how well this feature works on Windows 7 and Windows 8.1. I'm beginning to notice that it usually works well on 7 but I have constant hell with it on 8. The last thing I tried which seemed to work (assuming
    it was not just randomness) was accepting the default "Platform" settings of the CI/CB. Before I had chosen Windows 7 and 8.1 only and was never able to return any value except Compliant on 8. Accepting the all platforms default Finally
    allowed me to show a state of Non-Compliant on 8. This was using a powershell script of string data type as discussed previously.
    My latest torment is discovering how to force a true re-evaluation of an updated CI/CB. In my non-compliant Win8 example, I have added a remediation script to an existing Monitor-Only CI and configured it to remediate. In my Win 7 members of the collection,
    everything works successfully, the condition is remediated and the state reports Compliant but on the Win8, although the local Control Panel applet shows both the CB and CI to have new revisions and the evaluation shows it has run with a new date/time,
    the remediation script never runs and changes to Compliant.
    Any suggestions how I can force an updated CI/CB to really re-evaluate, not just report it has?

  • Exchange 2007 SP2: HasActiveSyncDevicePartnership Always Returns True

    I am currently work with a customer in an Exchange Server 2007 SP2 environment. A Powershell script that is used for gathering mobile device information begins with at the mailbox level and filters with
    HasActiveSyncDevicePartnership equal to true, as in -
    Get-casmailbox -Filter {HasActivesyncDevicePartnership -eq $true }
    We have discovered that it appears as though this flag is set to true for every mailbox account, despite the fact that only a few mailboxes have actual EAS partnerships with devices.
    My understanding was that this flag should only ever return true if there is an actual ActiveSync partnership. Is there something I am missing here? Can the flag be true even if there is no (or has never been) a partnership?
    Don Sorcinelli - Microsoft MVP, Mobile Devices

    Hi,
    Yes, the value of the " HasActiveSyncDevicePartnership " will be set to true if there is an actual ActiveSync partnership. Also you can use the following command to
    check the detail sync information such as device name,  last sync time:
    Get-ActivesyncDeviceStatistics -Mailbox [email protected]
    If no statistics information returns, The most probable cause 
    should be that someone set the HasActiveSyncDevicePartnership to true for all mailbox users accidently. Please run the following command to change them back:
    get-casmailbox |set-casmailbox -HasActivesyncDevicePartnership $false
    Then set the
    HasActiveSyncDevicePartnership to true for the users who have an actual ActiveSync partnership:
    Set-casmailbox –identity
    [email protected] -HasActivesyncDevicePartnership $true
    Gen Lin
    TechNet Subscriber Support
    in forum
    If you have any feedback on our support, please contact
    [email protected]
    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. Thanks
    Gen Lin-MSFT

  • KAudioSessionProperty_OtherAudioIsPlaying Always Returns True

    I have followed as many different examples as I can, most of them in the Apple documentation, but I cannot find out the reason why kAudioSessionProperty_OtherAudioIsPlaying always returns a positive on my devices.
    I have initialized and activated the session, yet it still returns positives when my music is paused.
    Here is my code:
    - (void)viewDidLoad
        [super viewDidLoad];
        AVAudioSession* session = [AVAudioSession sharedInstance];
        NSError *activationError = nil;
        BOOL success = [session setActive: YES error: &activationError];
        if (!success) { NSLog(@"%@", activationError); }
        UInt32 otherAudioIsPlaying;
        UInt32 propertySize = sizeof (otherAudioIsPlaying);
        AudioSessionGetProperty (
                                 kAudioSessionProperty_OtherAudioIsPlaying,
                                 &propertySize,
                                 &otherAudioIsPlaying
        if (otherAudioIsPlaying) {
            [session setCategory: AVAudioSessionCategoryAmbient error: nil];
        } else {
            [session setCategory: AVAudioSessionCategorySoloAmbient error: nil];
    What am I doing wrong?

    I have followed as many different examples as I can, most of them in the Apple documentation, but I cannot find out the reason why kAudioSessionProperty_OtherAudioIsPlaying always returns a positive on my devices.
    I have initialized and activated the session, yet it still returns positives when my music is paused.
    Here is my code:
    - (void)viewDidLoad
        [super viewDidLoad];
        AVAudioSession* session = [AVAudioSession sharedInstance];
        NSError *activationError = nil;
        BOOL success = [session setActive: YES error: &activationError];
        if (!success) { NSLog(@"%@", activationError); }
        UInt32 otherAudioIsPlaying;
        UInt32 propertySize = sizeof (otherAudioIsPlaying);
        AudioSessionGetProperty (
                                 kAudioSessionProperty_OtherAudioIsPlaying,
                                 &propertySize,
                                 &otherAudioIsPlaying
        if (otherAudioIsPlaying) {
            [session setCategory: AVAudioSessionCategoryAmbient error: nil];
        } else {
            [session setCategory: AVAudioSessionCategorySoloAmbient error: nil];
    What am I doing wrong?

  • Custom Login Module - Commit Method return TRUE always?

    Hi,
    I am creating a custom login module for my portal authentication.
    For the login module, should the commit() method always return TRUE?
    The example code on help.sap.com indicates yes to this question.
    However, the JAVA Sun standard indicates that commit should return FALSE if the preceding login method returned FALSE.
    Does the SAP example stray from the SUN standard?  How should I code the commit() method such that it works (Always TRUE, or follow lead of login() method)?
    Regards,
    Kevin

    Hi Kevin,
    I'm actually working with this document: <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/events/webinars/jaas%20login%20module%20development%20on%20webas%20java%20640.pdf#search=%22classloader%20sda%20jar%20reference%22">JAAS Login Modules</a>.
    There is also example code. If it should be ignored they return false, otherwise true (page 32).
    Regards,
    Marcus
    Message was edited by: Marcus Freiheit

  • ExternalInterface.available returns true in standalone

    Incredibly frustrating - no matter what I try, in standalone test environment it always returns true - it should return false - any thoughts on this anyone.
    Its just ridiculous that Bugs like this occur.......
    Cheers,

    To add to this - I also have incubator "Molehill" build.
    I can simply create a new document - place the following on the root timeline
    trace(ExternalInterface.available);
    and it will return true.
    Anyone help with this ? Adobe needs to be aware of this as it may be an incubator issue, and therefore serious.

  • Request.getParameter() always returns null

    I have a html file and am trying to retrieve the values from a formin my servlet.
    here is the html code:
    <html>
    <head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <h1><b>Add DVD</b></h1>
    </head>
    <body>
    <form action="add_dvd.do" method="POST">
    Title:<input type="text" name="title" />
    Year:<input type="text" name="year" />
    Genre: <select name='gselected'>
    <option value='Sci-Fi'>Sci-Fi</option>
    </select>
    or enter new genre:<input type="text" name='gentered' value="" />
    <input type="submit" value="Add DVD" />
    </form>
    </body>
    </html>
    and here is the servlet code:
    public class AddDVDServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
    // System.out.println("in AddDVDServlet post method");
    List errorMsgs = new LinkedList();
    //retrieve form parameters
    try{
    String title = request.getParameter("title").trim();
    String year = request.getParameter("year").trim();
    *String gentered = request.getParameter("gentered");
    String gselected = request.getParameter("gselected");
    String genre="";
    if("".equals(gentered))
    genre = gselected;
    else
    genre = gentered;
    // System.out.println("parameter retrieved");
    if(!year.matches("\\d\\d\\d\\d"))
    // System.out.println("year not 4 digit long");
    errorMsgs.add("Year must be four digit long");
    if("".equals(title))
    // System.out.println("title not entered");
    errorMsgs.add("Please enter the title of the dvd");
    if("".equals(genre))
    // System.out.println("genre not valid");zdf
    errorMsgs.add("Enter genre.");
    if(! errorMsgs.isEmpty())
    //System.out.println("errors in entry ");
    request.setAttribute("errors",errorMsgs);
    // System.out.println("error attribute set in request");
    RequestDispatcher rd = request.getRequestDispatcher("error.view");
    rd.forward(request, response);
    return;
    //create DVDItem instance
    DVDItem dvd = new DVDItem(title,year,genre);
    request.setAttribute("dvdItem",dvd);
    RequestDispatcher rd = request.getRequestDispatcher("success.view");
    rd.forward(request, response);
    catch(Exception e){
    errorMsgs.add(e.getMessage());
    request.setAttribute("errors",errorMsgs);
    RequestDispatcher rd = request.getRequestDispatcher("error.view");
    rd.forward(request, response);
    e.printStackTrace();
    System.out.println("exception:"+e);
    why does getParameter always return null??? whats wrong?

    I don't know. However, I suspect that because you have a tag with the same name as 'title', its causing a name conflict. Chnage the name to something else. If it works, then that's the likely explaination.

  • GetUsageData is always returning Null

    Let me first start out by stating that I know there are many questions on this issue, and I have read them all. However, none of the suggestions that I have read have seemed to help my situation. Therefore, I figure I would supply my code with the hopes
    that someone can solve the issue that is mentioned in the title. Let me first supply a little bit of background.
    My goal in this code is to determine what are the most visited sites in our SharePoint 2010 farm. To do this, I figured I would cycle through all of the webs in the farm, and then obtain the amount of page views within each site using the GetUsageData function.
    Just to test if the GetUsageData was supplying the correct data, I coded the web part in such a way where if GetUsageData returned "Null", it would print it for every site, and "Not Null" if otherwise. In every case I have tested this web part, it has always
    returned Null for evey site it has checked.
    I am fairly new to programming web parts in C#, so a lot of this code is derived from what I have read when researching the subject. If anyone can assist me to see where I could fix my issue, I would greatly appreciate it.
    Thank you.
    Below is my Code:
    using System;
    using System.Data;
    using System.Collections;
    using System.ComponentModel;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using Microsoft.SharePoint;
    using Microsoft.SharePoint.Administration;
    using Microsoft.SharePoint.WebControls;
    //This code has been derived from the following link: http://blog.rafelo.com/2008/07/22/iterating-through-sharepoint-web-applications-site-collections-and-sites-webs/
    namespace WebAnalyticsTest.Test
    [ToolboxItemAttribute(false)]
    public class Test : WebPart
    //For testing purposes. More is explained further in the code.
    int test;
    ArrayList totalHitsArray = new ArrayList();
    int totalHits;
    DataGrid grid = null;
    public void BeginProcess()
    // Get references to the farm and farm WebService objects
    // the SPWebService object contains the SPWebApplications
    SPFarm thisFarm = SPFarm.Local;
    SPWebService service = thisFarm.Services.GetValue<SPWebService>("");
    foreach (SPWebApplication webApp in service.WebApplications)
    //Execute any logic you need to against the web application
    //Iterate through each site collection
    foreach (SPSite siteCollection in webApp.Sites)
    //do not let SharePoint handle the access denied
    //exceptions. If one occurs you will be redirected
    //in the middle of the process. Handle the AccessDenied
    //exception yourself in a try-catch block
    siteCollection.CatchAccessDeniedException = false;
    try
    //Execute any logic you need to against the site collection
    //Call the recursive method to get all of the sites(webs)
    GetWebs(siteCollection.AllWebs);
    catch (Exception webE)
    //You should log the error for reference
    //reset the CatchAccessDeniedException property of the site
    //collection to true
    siteCollection.CatchAccessDeniedException = true;
    public void GetWebs(SPWebCollection allWebs)
    //iterate through each site(web)
    foreach (SPWeb web in allWebs)
    if(web.Exists)
    //For every site the program finds, the count will increase by one. If this code is executed by a user who does not have
    //full control, then the count will be inaccurate as it will only return the number of sites the user can access.
    test += 1;
    DataTable table = web.GetUsageData(Microsoft.SharePoint.Administration.SPUsageReportType.browser, Microsoft.SharePoint.Administration.SPUsagePeriodType.lastMonth);
    if (table == null)
    HttpContext.Current.Response.Write("Null");
    else
    HttpContext.Current.Response.Write("Not Null");
    protected override void CreateChildControls()
    BeginProcess();

    Hi, Shiladitya.
    Sorry I haven't replied until now. I'll paste the current code I am using, but my solution is not yet complete. What it does as of right now is it creates a data table with all of the webs located in your farm, as well as the total amount of page views for
    each web. What I noticed though is that when I compare these stats with the web analytics for the specific web, they don't match. I put the project on hold for this reason, and I might start it back up again soon. Feel free to use the code, and perhaps you
    maybe can shed some light on my issue.
    using System;
    using System.Data;
    using System.Collections;
    using System.ComponentModel;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using Microsoft.SharePoint;
    using Microsoft.SharePoint.Administration;
    using Microsoft.SharePoint.WebControls;
    //This code has been derived from the following link: http://blog.rafelo.com/2008/07/22/iterating-through-sharepoint-web-applications-site-collections-and-sites-webs/
    namespace WebAnalyticsTest.Test
    [ToolboxItemAttribute(false)]
    public class Test : WebPart
    //For the total amount of hits for a single web
    int totalHits;
    //The final data table that will be added to.
    DataTable final = new DataTable();
    //Size of the data table
    int finalSize = 0;
    //The grid that will be displayed
    DataGrid grid = new DataGrid();
    public void BeginProcess()
    //To allow users with lower permissions to view the proper content, the code must be used with RunWithElevatedPrivileges.
    SPSecurity.RunWithElevatedPrivileges(delegate()
    // Get references to the farm and farm WebService objects
    // the SPWebService object contains the SPWebApplications
    SPFarm thisFarm = SPFarm.Local;
    SPWebService service = thisFarm.Services.GetValue<SPWebService>("");
    foreach (SPWebApplication webApp in service.WebApplications)
    //Execute any logic you need to against the web application
    //Iterate through each site collection
    foreach (SPSite siteCollection in webApp.Sites)
    //do not let SharePoint handle the access denied
    //exceptions. If one occurs you will be redirected
    //in the middle of the process. Handle the AccessDenied
    //exception yourself in a try-catch block
    siteCollection.CatchAccessDeniedException = false;
    try
    //Execute any logic you need to against the site collection
    //Call the recursive method to get all of the sites(webs)
    GetWebs(siteCollection.AllWebs);
    catch (Exception webE)
    //Place any error logic here
    //reset the CatchAccessDeniedException property of the site
    //collection to true
    siteCollection.CatchAccessDeniedException = true;
    public void GetWebs(SPWebCollection allWebs)
    //iterate through each site(web)
    foreach (SPWeb web in allWebs)
    if (web.Exists)
    DataTable table = web.GetUsageData(SPUsageReportType.url, SPUsagePeriodType.lastMonth);
    if (table != null)
    //Determines the total amount of hits for a single web
    foreach (DataRow row in table.Rows)
    int num = System.Convert.ToInt32(row["Total Hits"]);
    totalHits = totalHits + num;
    //Temporarily stores the total hits with the associated web.
    DataTable temp = new DataTable();
    temp.Columns.Add("Site", typeof(string));
    temp.Columns.Add("Total Views", typeof(int));
    temp.Rows.Add(web.Title, totalHits);
    //Merges the data table "temp" to the data table "final"
    final.Merge(temp);
    //Data table size increases by one.
    finalSize += 1;
    //Resets the total hit counter
    totalHits = 0;
    protected override void CreateChildControls()
    BeginProcess();
    //Sorts the data table bases on the total hits
    final.DefaultView.Sort = "Total Views DESC";
    //The total amount of pages to show is 10. Therefore, only execute this If statement if the final's size > 10.
    if (finalSize > 10)
    //Data table of the top ten most viewed pages. This data table will be used in the data grid "grid"
    DataTable topTen = final.Clone();
    for (int i = 0; i < 10; i++)
    topTen.ImportRow(final.Rows[i]);
    grid.DataSource = topTen;
    else
    grid.DataSource = final;
    grid.DataBind();
    this.Controls.Add(grid);
    ListBox list = new ListBox();

  • Global Temp Table, always return  zero records

    I call the procedure which uses glbal temp Table, after executing the Proc which populates the Global temp table, i then run select query retrieve the result, but it alway return zero record. I am using transaction in order to avoid deletion of records in global temp table.
    whereas if i do the same thing in SQL navigator, it works
    Cn.ConnectionString = Constr
    Cn.Open()
    If FGC Is Nothing Then
    Multiple = True
    'Search by desc
    'packaging.pkg_msds.processavfg(null, ActiveInActive, BrandCode, Desc, Itemtype)
    SQL = "BEGIN packaging.pkg_msds.processavfg(null,'" & _
    ActiveInActive & "','" & _
    BrandCode & "','" & _
    Desc & "','" & _
    Itemtype & "'); end;"
    'Here it will return multiple FGC
    'need to combine them
    Else
    'search by FGC
    SQL = "BEGIN packaging.pkg_msds.processavfg('" & FGC & "','" & _
    ActiveInActive & "','" & _
    BrandCode & "',null,null); end;"
    'will alway return one FGC
    End If
    ' SQL = " DECLARE BEGIN rguo.pkg_msds.processAvedaFG('" & FGC & "'); end;"
    Stepp = 1
    Cmd.Connection = Cn
    Cmd.CommandType = Data.CommandType.Text
    Cmd.CommandText = SQL
    Dim Trans As System.Data.OracleClient.OracleTransaction
    Trans = Cn.BeginTransaction()
    Cmd.Transaction = Trans
    Dim Cnt As Integer
    Cnt = Cmd.ExecuteNonQuery
    'SQL = "SELECT rguo.pkg_msds.getPDSFGMass FROM dual"
    SQL = "select * from packaging.aveda_mass_XML"
    Cmd.CommandType = Data.CommandType.Text
    Cmd.CommandText = SQL
    Adp.SelectCommand = Cmd
    Stepp = 2
    Adp.Fill(Ds)
    If Ds.Tables(0).Rows.Count = 0 Then
    blError = True
    BlComposeXml = True
    Throw New Exception("No Record found for FGC(Finished Good Code=)" & FGC)
    End If
    'First Row, First Column contains Data as XML
    Stepp = 0
    Trans.Commit()

    Hi,
    This forum is for Oracle's Data Provider and you're using Microsoft's, but I was curious so I went ahead and tried it. It works fine for me. Here's the complete code I used, could you point out what are you doing differently?
    Cheers,
    Greg
    create global temporary table abc_tab(col1 varchar2(10));
    create or replace procedure ins_abc_tab(v1 varchar2) as
    begin
    insert into abc_tab values(v1);
    end;
    using System;
    using System.Data;
    using System.Data.OracleClient;
    class Program
        static void Main(string[] args)
            OracleConnection con = new OracleConnection("data source=orcl;user id=scott;password=tiger");
            con.Open();
            OracleTransaction txn = con.BeginTransaction();
            OracleCommand cmd = new OracleCommand("begin ins_abc_tab('foo');end;", con);
            cmd.Transaction = txn;
            cmd.ExecuteNonQuery();
            cmd.CommandText = "select * from abc_tab";
            OracleDataAdapter da = new OracleDataAdapter(cmd);
            DataSet ds = new DataSet();
            da.Fill(ds);
            Console.WriteLine("rows found: {0}", ds.Tables[0].Rows.Count);
            // commit, cleanup, etc ommitted for clarity
    }

  • Bc4j:RowScope on a Master Detail page always returns 0 rows for detail

    Hi,
    I have a problem with a Master Detail page that is called from another page. The Master Detail page has two View Objects, Budgets and Budget Versions. These are linked properly in BC4J and when I use these VOs together I can navigate through the Budgets (master) and the Budget Versions (details) are populated correctly.
    However, I want to navigate to this page from another page which lists all possible Budgets. I pass the key of the selected Budget to the Master Detail page and the correct Budget is displayed, BUT the Budget Versions are NOT displayed - I get 0 rows returned.
    The mechanism I use to pass the selected Budget ID to my Master Detail page is:
    <ctrl:property name="key">
    <ctrl:selection name="ViewTable" key="key"/>
    </ctrl:property>
    My BC4J Registry is set up as follows:
    <bc4j:registryDef>
    <bc4j:rootAppModuleDef name="BudgetModule"
    defFullName="BudgetPackage.BudgetPackageModule"
    configName="BudgetPackageModuleLocal"
    releaseMode="stateful">
    <bc4j:viewObjectDef name="ItiBudgetsView1">
    <bc4j:rowDef name="CurrentBudgetRow" usesCurrency="True">
    <bc4j:propertyKey name="key"/>
    </bc4j:rowDef>
    </bc4j:viewObjectDef>
    <bc4j:viewObjectDef name="ItiBudgetVersionsView2" rangeSize="15"/>
    </bc4j:rootAppModuleDef>
    </bc4j:registryDef>
    I then use
    <bc4j:rowScope name="CurrentBudgetRow">
    to get the correct Budget row in my master VO. But this always returns 0 rows in my detail VO. If I comment out the rowScope element, I don't get the desired Budget row, but I do get the correct Budget Version rows displayed. Is the rowScope element on the Budget VO interfering with the Budget Version VO?
    Hope this is not too confusing!!
    Thanks,
    Steve

    Steve,
    I tried to create a comparable set of two pages and initially ran into the same problem. I just realized that my issue (which I hope is yours too) is that the rootAppModule name was different across my two pages. This led to each page having its own application module instance, so the currency was different on each page.
    By changing all of my pages to use the same application module name (in the registryDef, in the appModuleScope tags in the page, and in the findAppModule tags in the handlers), I resolved this problem.
    My event handler to go to the master/detail page from the master page, FYI, looks like this:
      <event name="details" >
       <bc4j:findRootAppModule name="MyApp" >
        <!-- establish the ViewObject scope -->
        <bc4j:findViewObject name="CustomersView1" >
         <!-- find the selected Row -->
         <bc4j:findRowByKey>
          <bc4j:keyBinding>
           <bc4j:selectionKey name="viewTable" key="key" />
          </bc4j:keyBinding>
         </bc4j:findRowByKey>
        </bc4j:findViewObject>
        <bc4j:executeQuery />
        <go name="OrdersByCustomer_View" redirect="true" />
       </bc4j:findRootAppModule>                     
      </event>Hope this helps.
    -brian
    UIX Team

  • Execute oracle stored procedure from C# always returns null

    Hi,
    I'm trying to execute a stored procedure on oracle 9i. I'm using .Net OracleClient provider.
    Apparently, I can execute the stored procedure, but it always returns null as a result (actually all the sp's I have there returns null)! I can execute any text statement against the database successfully, and also I can execute the stored procedure using Toad.
    This is not the first time for me to call an oracle stored procedure, but this really is giving me a hard time! Can anyone help please?
    Below are the SP, and the code used from .Net to call it, if that can help.
    Oracle SP:
    CREATE OR REPLACE PROCEDURE APIECARE.CHECK_EXISTENCE(l_number IN NUMBER) AS
    v_status VARCHAR2(5) := NULL;
    BEGIN
    BEGIN
    SELECT CHECK_NO_EXISTENCE(to_char(l_number))
    INTO v_status
    FROM DUAL;
    EXCEPTION WHEN OTHERS THEN
    v_status := NULL;
    END;
    DBMS_OUTPUT.PUT_LINE(v_status);
    END CHECK_CONTRNO_EXISTENCE;
    C# Code:
    string connStr = "Data Source=datasource;Persist Security Info=True;User ID=user;Password=pass;Unicode=True";
    OracleConnection conn = new OracleConnection(connStr);
    OracleParameter param1 = new OracleParameter();
    param1.ParameterName = "v_status";
    param1.OracleType = OracleType.VarChar;
    param1.Size = 5;
    param1.Direction = ParameterDirection.Input;
    OracleParameter param2 = new OracleParameter();
    param2.ParameterName = "l_number";
    param2.OracleType = OracleType.Number;
    param2.Direction = ParameterDirection.Input;
    param2.Value = 006550249;
    OracleParameter[] oraParams = new OracleParameter[] { param1, param2 };
    OracleCommand cmd = new OracleCommand("CHECK_EXISTENCE", conn);
    cmd.CommandType = CommandType.StoredProcedure;
    cmd.Parameters.AddRange(oraParams);
    conn.Open();
    object result = cmd.ExecuteScalar();
    conn.Close();

    Hi,
    Does that actually execute? You're passing two parameters to a procedure that only takews 1 and get no error?
    Your stored procedure doesnt return anything and has no output parameters, what are you expecting to be returned exactly?
    If you're trying to access V_STATUS you'll need to declare that as either an output parameter of the procedure, or return value of the function, and also access it via accessing Param.Value, not as the result of ExecuteScalar.
    See if this helps.
    Cheers,
    Greg
    create or replace function myfunc(myinvar in varchar2, myoutvar out varchar2) return varchar2
    is
    retval varchar2(50);
    begin
    myoutvar := myinvar;
    retval := 'the return value';
    return retval;
    end;
    using System;
    using System.Data;
    using Oracle.DataAccess.Client;
    public class odpfuncparams
         public static void Main()
          OracleConnection con = new OracleConnection("user id=scott;password=tiger;data source=orcl");
          con.Open();
          OracleCommand cmd = new OracleCommand("myfunc", con);
          cmd.CommandType = CommandType.StoredProcedure;
          OracleParameter retval = new OracleParameter("retval",OracleDbType.Varchar2,50);
          retval.Direction = ParameterDirection.ReturnValue;
          cmd.Parameters.Add(retval);
          OracleParameter inval = new OracleParameter("inval",OracleDbType.Varchar2);
          inval.Direction = ParameterDirection.Input; 
          inval.Value="hello world";
          cmd.Parameters.Add(inval);
          OracleParameter outval = new OracleParameter("outval",OracleDbType.Varchar2,50);
          outval.Direction = ParameterDirection.Output;
          cmd.Parameters.Add(outval);
          cmd.ExecuteNonQuery();
          Console.WriteLine("return value is {0}, out value is {1}",retval.Value,outval.Value);
          con.Close();
    }

  • Select query on table rcv_lots_interface is always returning null

    Hi ,
    I need a help on the below issue.
    The issue is after creating PO in Oracle 11i I receive it in MSCA application.
    When we receive it at that point data gets inserted in the table " rcv_transactions_interface " and we have written a trigger on it.
    From the trigger on table " rcv_transactions_interface " we are calling a package and in the package we have select query on "rcv_lots_interface."
    But the select query is always returning null even though we are passing the correct "interface_transaction_id " and also after the "Receiving Transaction Processor" is executed i can see data in the table " RCV_LOT_TRANSACTIONS " for the same transaction.
    Below is the sample code i am using.
    CREATE OR REPLACE TRIGGER inv.RCV_TRAN_TRIGGER
    AFTER UPDATE
    ON po.rcv_transactions_interface
    FOR EACH ROW
    WHEN (NEW.processing_status_code='PENDING'
    AND NEW.destination_type_code IN ('INVENTORY','RECEIVING')
    AND NEW.mobile_txn = 'Y')
    DECLARE
    PRAGMA AUTONOMOUS_TRANSACTION;
    v_user_id NUMBER;
    v_interface_transaction_id NUMBER;
    v_organization_id NUMBER;
    v_item_id NUMBER;
    v_quantity NUMBER;
    v_resp_id NUMBER;
    v_mobile_txn VARCHAR2(5);
    v_shipment_header_id NUMBER;
    v_bill_of_lading VARCHAR2(100);
    v_group_id NUMBER;
    v_header_interface_id NUMBER;
    BEGIN
    v_interface_transaction_id := :NEW.interface_transaction_id;
    v_organization_id := :NEW.to_organization_id;
    v_user_id := :NEW.created_by;
    v_item_id := :NEW.item_id;
    v_quantity := :NEW.quantity;
    v_resp_id :=fnd_profile.VALUE('RESP_ID');
    v_transaction_type := :NEW.transaction_type;
    v_mobile_txn := :NEW.mobile_txn;
    v_bill_of_lading := :NEW.bill_of_lading;
    v_group_id := :NEW.group_id;
    v_header_interface_id := :NEW.HEADER_INTERFACE_ID;
    INV.INV_RCV_TRX_PKG.INV_RCV_LABEL_GEN_PRC( v_user_id,
    v_interface_transaction_id,
    v_item_id,
    v_quantity,
    v_organization_id,
    v_resp_id,
    v_shipment_header_id,
    v_bill_of_lading,
    v_header_interface_id,
    v_group_id);
    END;
    CREATE OR REPLACE PACKAGE BODY INV.INV_RCV_TRX_PKG
    AS
    PROCEDURE INV_RCV_LABEL_GEN_PRC( p_user_id IN NUMBER,
    p_interface_transaction_id IN NUMBER,
    p_item_id IN NUMBER,
    p_quantity IN NUMBER,
    p_organization_id IN NUMBER,
    p_resp_id IN NUMBER,
    p_shipment_header_id IN NUMBER,
    p_bill_of_lading IN VARCHAR2,
    p_header_interface_id IN NUMBER ,
    p_group_id IN NUMBER
    IS
    v_user_id NUMBER;
    v_print BOOLEAN;
    v_resp_id NUMBER;
    v_resp_appl_id NUMBER;
    v_lot_num VARCHAR2(50);
    BEGIN
    BEGIN
    SELECT application_id
    INTO v_resp_appl_id
    FROM apps.fnd_responsibility_tl frt
    WHERE responsibility_id=p_resp_id;
    END;
    apps.fnd_global.apps_initialize(p_user_id, p_resp_id, v_resp_appl_id);
    BEGIN
    SELECT rli.lot_num , rli.expiration_date
    INTO v_lot_num ,
    v_expiration_date
    FROM apps.rcv_lots_interface rli
    WHERE rli.interface_transaction_id = p_interface_transaction_id ;
    EXCEPTION
    WHEN OTHERS THEN
    v_lot_num :=NULL;
    v_expiration_date :=NULL;
    apps.fnd_file.put_line(fnd_file.log,'Exception while deriving LOT Number ######### '||p_interface_transaction_id||'------'||SQLERRM);
    END;
    END;
    Need your help to understand why the below query is always returning null and what is the solution for it ?
    SELECT rli.lot_num , rli.expiration_date
    FROM apps.rcv_lots_interface rli
    WHERE rli.interface_transaction_id = p_interface_transaction_id ;
    Thanks
    Jaydeep
    Edited by: user10454886 on Mar 25, 2013 6:31 AM
    Hi ,
    I need a solution to this issue at the earliest.
    Appreciate all of your help
    Thanks
    Jaydeep

    Centinul wrote:
    There are a lot of bugs listed in Metalink with respect to wrong results and function-based indexes.
    Here are a few:
    Bug 4028186 Wrong results if function based index exists
    Bug 4717546 Wrong results / poor plan when function based index exists
    Bug 5092688 Wrong results if function based index exists
    Based on reviewing them the workarounds range from dropping the index to setting "_disable_function_based_index" to TRUE.Facinating. It seems to me that if you use the undocumented intitialization parameter you might just as well drop the FBIs too.
    Another hazard of FBIs is the Law of Unintended Consequences. 2 years ago we tried to use one to speed up a query in a PL/SQL package. Worked OK for that purpose, but an unrelated loader on the affected table ran and rand but never finished until the FBI was dropped.

Maybe you are looking for

  • Problems with video after upgrading to 10.7.2

    Hi, I just updated my Mac with new v10.7.2. Everything went perfect with really usual Apple quality ;-) but for one point I would need to check since new for me. In case of watching videos via iTunes, I have now the phenomena that in case of pressing

  • How do I stop my search engine from being "hijacked"? I can no longer get direct access to websites.

    When I open my Mozilla Start Page, I type in a name or website I am searching and Google provides the usual list of websites. When I click on the website I want it won't open. Instead I keep getting redirected instead of going directly to the website

  • Won't Open in Tabs

    How do I get any new sites to open in tabs? I have all the right things set in preferences, but any time I hit a new page it just opens a new window. I know command T allows me to open a blank tab, but what I'd like to do is have it open a new tab ev

  • Any report on fbl1n and fbl3n

    hello gurus , plz send me the report of 'z' or 'y' on FBL1N, FBL3N and FBL5N. its very urgent . Thanks in advance .

  • Connecting Photoshop as an external editor?

    I can't get Photshop CS2 to show up in my shortcut menu when trying to send and edit a graphic from FCP5. I know how to set the external editor, but do I connect it to the shortcut or an application icon in CS2? Thanks