PLSQL function does not return the correct number of rows?

Hey folks. I'm still green when it comes to writing PLSQL. It's fun, rewarding and very frustrating. Hence, I'm turning to the experts. If you folks can help me understand what I'm doing wrong here, I'd really appreciate it.
The code is somewhat specific to my company's product, but I think it should be easy to read and understand what I'm doing. If not, please let me know what I can clarify.
All i'm trying to do is determine if the most recent iteration of data available for a particular host is a full scan or not (level2). I go about this in the following manner:
1. get the operatingsystem id, it's scandate (preferred), the most recent scandate and it's scan status from a table of where all operating systems data lives. Loop through all the Oses
(from this I set v_osid, v_mostrecentscandate, v_scandate).
2. Before doing the crazy logic, pick the low hanging fruit
2a. if the the level2 status of the host is N, then v_level2 = 'N';
2b. if the level2 = 'Y' and the mostrecentscandate and scandate are identical, then v_level2 = 'Y';
2c. for all other cases, go to 3
3. Using v_mostrecentscandate, find all table id that may hold the most recent instance of data for the host
4. Loop through through the concatenation of that id + _base. If you find the id in those tables, then store the id for the next step.
5. When you I find the right id, I now concatenate the id + attrdata. For the host id, I look for any rows where attribute_value in (..) and the corresponding number_value is not null.
5b. set v_level2 = 'Y'
5c. otherwise, set v_level2 = 'N'
6 end the loop
7 wash, rinse, repeat for each OS.
create or replace package body mostrecentlevel2 as
function getMostRecentL2 return bdna_mostrecent_level2 pipelined IS
v_lsid NUMBER;
v_sql VARCHAR2(5000);
v_sql_baseid NUMBER;
v_sql_numv NUMBER;
v_lsidt VARCHAR2(5000);
v_lsidt2 VARCHAR2(5000);
v_sql_rec VARCHAR2(5000);
v_osid NUMBER;
v_anchor DATE;
v_ls CHAR(2);
v_level2 CHAR(1);
v_mostrecentscandate DATE;
v_scandate DATE;
cursor getOSinfo_cur is select operatingsystem_id, scandate, mostrecentscandate, level2 from bdna_all_os;
cursor getlsID_cur is select id from local_scan where
          ((trunc(collect_start_time) - to_date(v_anchor))*24*60*60) <= ((to_date(v_mostrecentscandate) - to_date(v_anchor))*24*60*60)
          and
          ((trunc(collect_end_time) - to_date(v_anchor))*24*60*60) >= ((to_date(v_mostrecentscandate) - to_date(v_anchor))*24*60*60);
getOSinfo_rec getOSinfo_cur%rowtype;
getlsID_rec getlsID_cur%rowtype;
BEGIN
v_ls := 'ls';
v_anchor := '01-JAN-01';
FOR getOSinfo_rec IN getOSinfo_cur LOOP
     v_osid := getOSinfo_rec.operatingsystem_id;
     v_mostrecentscandate := getOSinfo_rec.mostrecentscandate;
     v_scandate := getOSinfo_rec.scandate;
     IF getOSinfo_rec.level2 = 'N' THEN
          v_level2 := 'N';
     ELSIF getOSinfo_rec.level2 = 'Y' THEN
          IF v_mostrecentscandate != v_scandate THEN
               FOR getlsID_rec IN getlsID_cur LOOP
                    v_lsid := getlsID_rec.id;
                    v_lsidt := v_ls||v_lsid;
                    v_sql := 'select id from '||v_lsidt||'_base where id = '||chr(39)||v_osid||chr(39);
                    EXECUTE IMMEDIATE v_sql into v_sql_baseid;
                    IF SQL%ROWCOUNT > 0 THEN
                         v_lsidt2 := v_lsidt;
                         v_sql := '';
                    END IF;
               END LOOP;
               v_sql := 'select number_value from '||v_lsidt2||'_attr_data where
                         lower(attribute_name) IN ('||chr(39)||'numcpus'||chr(39)||', '||chr(39)||'totalmemory'||chr(39)||', '||chr(39)||'cpuutilpercent'||chr(39)||', '||chr(39)||'numprocesses'||chr(39)||')
                         and
                         number_value is not NULL
                         and
                         element_id = '||chr(39)||v_osid||chr(39);
               EXECUTE IMMEDIATE v_sql into v_sql_numv;
               IF SQL%ROWCOUNT > 0 THEN
                    v_level2 := 'Y';
               ELSE v_level2 := 'N';
               END IF;
          END IF;
          v_level2 := 'Y';
     END IF;
     PIPE ROW (mostRecentLevel2Format(v_osid,v_mostrecentscandate,v_level2));
END LOOP;
END;
END;
/Now some will ask why I'm using pipelining? Again, I'm green.. I was reading around, looking for a way to make this code run as fast as possible (because it's potentially got to go through 56K records and perform the expensive work on).
I also realize I'm not providing the type or package code, and that's because I think I'm good on that. The code above compiles just fine without errors and when it runs, it only returns 6 consecutive rows.. I'm expecting 70K lol. So I know I'm doing something wrong.
Any thoughts?
Oh forgot to add this is on 11g R1 Enterprise Edition
Edited by: ErrolDC on Nov 14, 2011 4:52 PM
Edited by: ErrolDC on Nov 14, 2011 5:07 PM

ErrolDC wrote:
Hey folks. I'm still green when it comes to writing PLSQL. It's fun, rewarding and very frustrating. Hence, I'm turning to the experts. If you folks can help me understand what I'm doing wrong here, I'd really appreciate it.
The code is somewhat specific to my company's product, but I think it should be easy to read and understand what I'm doing. If not, please let me know what I can clarify.Post a complete script that peoople who aren't as familiar with the application as you are can run to re-create the problem and test their ideas. In this case, that includes CREATE TABLE and INSERT statements for the tables used (just the columns needed for this job), a query that uses the function, and the results you want from that query given the data you posted.
All i'm trying to do is determine if the most recent iteration of data available for a particular host is a full scan or not (level2). I go about this in the following manner:
1. get the operatingsystem id, it's scandate (preferred), the most recent scandate and it's scan status from a table of where all operating systems data lives. Loop through all the Oses
(from this I set v_osid, v_mostrecentscandate, v_scandate).
2. Before doing the crazy logic, pick the low hanging fruit
2a. if the the level2 status of the host is N, then v_level2 = 'N';
2b. if the level2 = 'Y' and the mostrecentscandate and scandate are identical, then v_level2 = 'Y';
2c. for all other cases, go to 3
3. Using v_mostrecentscandate, find all table id that may hold the most recent instance of data for the host
4. Loop through through the concatenation of that id + _base. If you find the id in those tables, then store the id for the next step.
5. When you I find the right id, I now concatenate the id + attrdata. For the host id, I look for any rows where attribute_value in (..) and the corresponding number_value is not null.
5b. set v_level2 = 'Y'
5c. otherwise, set v_level2 = 'N'
6 end the loop
7 wash, rinse, repeat for each OS.
create or replace package body mostrecentlevel2 as
function getMostRecentL2 return bdna_mostrecent_level2 pipelined IS
v_lsid NUMBER;
v_sql VARCHAR2(5000);
v_sql_baseid NUMBER;
v_sql_numv NUMBER;
v_lsidt VARCHAR2(5000);
v_lsidt2 VARCHAR2(5000);
v_sql_rec VARCHAR2(5000);
v_osid NUMBER;
v_anchor DATE;
v_ls CHAR(2);
v_level2 CHAR(1);
v_mostrecentscandate DATE;
v_scandate DATE;
cursor getOSinfo_cur is select operatingsystem_id, scandate, mostrecentscandate, level2 from bdna_all_os;
cursor getlsID_cur is select id from local_scan where
          ((trunc(collect_start_time) - to_date(v_anchor))*24*60*60) <= ((to_date(v_mostrecentscandate) - to_date(v_anchor))*24*60*60)
          and
          ((trunc(collect_end_time) - to_date(v_anchor))*24*60*60) >= ((to_date(v_mostrecentscandate) - to_date(v_anchor))*24*60*60);
getOSinfo_rec getOSinfo_cur%rowtype;
getlsID_rec getlsID_cur%rowtype;
BEGIN
v_ls := 'ls';
v_anchor := '01-JAN-01';
FOR getOSinfo_rec IN getOSinfo_cur LOOP
     v_osid := getOSinfo_rec.operatingsystem_id;
     v_mostrecentscandate := getOSinfo_rec.mostrecentscandate;
     v_scandate := getOSinfo_rec.scandate;
     IF getOSinfo_rec.level2 = 'N' THEN
          v_level2 := 'N';
     ELSIF getOSinfo_rec.level2 = 'Y' THEN
          IF v_mostrecentscandate != v_scandate THEN
               FOR getlsID_rec IN getlsID_cur LOOP
                    v_lsid := getlsID_rec.id;
                    v_lsidt := v_ls||v_lsid;
                    v_sql := 'select id from '||v_lsidt||'_base where id = '||chr(39)||v_osid||chr(39);
                    EXECUTE IMMEDIATE v_sql into v_sql_baseid;
                    IF SQL%ROWCOUNT > 0 THEN
                         v_lsidt2 := v_lsidt;
                         v_sql := '';
                    END IF;
               END LOOP;
               v_sql := 'select number_value from '||v_lsidt2||'_attr_data where
                         lower(attribute_name) IN ('||chr(39)||'numcpus'||chr(39)||', '||chr(39)||'totalmemory'||chr(39)||', '||chr(39)||'cpuutilpercent'||chr(39)||', '||chr(39)||'numprocesses'||chr(39)||')
                         and
                         number_value is not NULL
                         and
                         element_id = '||chr(39)||v_osid||chr(39);
               EXECUTE IMMEDIATE v_sql into v_sql_numv;
               IF SQL%ROWCOUNT > 0 THEN
                    v_level2 := 'Y';
               ELSE v_level2 := 'N';
               END IF;
          END IF;
          v_level2 := 'Y';
     END IF;
     PIPE ROW (mostRecentLevel2Format(v_osid,v_mostrecentscandate,v_level2));
END LOOP;
END;
END;
/Now some will ask why I'm using pipelining? Again, I'm green.. I was reading around, looking for a way to make this code run as fast as possible (because it's potentially got to go through 56K records and perform the expensive work on).
I also realize I'm not providing the type or package code, and that's because I think I'm good on that. The code above compiles just fine without errors and when it runs, it only returns 6 consecutive rows.. I'm expecting 70K lol. So I know I'm doing something wrong. You're calling TO_DATE with a DATE argument. Why are you calling TO_DATE at all?
It seems like this condition:
((trunc(collect_start_time) - to_date(v_anchor))*24*60*60) <= ((to_date(v_mostrecentscandate) - to_date(v_anchor))*24*60*60) is equivalent to
TRUNC (collect_start_time) <= v_mostrecentscandateThat probably has nothing to do with why you're only getting 6 rows.

Similar Messages

  • The illustration does not have the correct number of operands...

    I work on a Macbook Pro 10.8.5. When I open a file in AI CC and place any number of images, save and close the file. When I reopen the file I get this message. 'Can't open the illustration. The illustration does not have the correct number of operands for an operator... etc.' The file scan still open after this but all the placed images disappear.
    I've tested placing different formats ie. JPGs, TIFs, PNGs, flattened PSDs etc. They all come up with the same error.
    I've searched in Google and I haven't found a solution yet. There was a suggestion to import the AI file in INDD, this doesn't help beause all copy converts to outlines and embeds the images.
    Can anyone help?

    Hi, just tried this and AI says 'Could not open the file'. Here's a couple of screen grabs to show you my file setup and the exact error message.

  • DATE type returned from function does not return the time component

    Hi,
    I'm dealing with a strange problem. I have a PL/SQL function (running on Oracle 8.1.4.7) which returns a DATE value. Like we all know the DATE datatype includes a date component and a time component.
    The function I used for testing is like this:
    FUNCTION ReturnDate return Date is
    dReturn Date;
    Begin
    select sysdate into dReturn from dual;
    return dReturn;
    end ReturnDate;
    When I call this function from .NET using ODP.NET the date value I get does not have the time component included only the day-month-year components.
    This is a code-snippet that calls the function :
    command.CommandText="Schema.ReturnDate";
    command.CommandType=CommandType.StoredProcedure;
    command.Parameters.Add("Return_Value",
    OracleDbType.Date,0,ParameterDirection.ReturnValue);
    command.ExecuteNonQuery();
    I use the OracleDbType.Date type which I think is the most logical choice, because the type in the Database is after all DATE.
    However this does not include the time componet. But if I change the OracleDbType.Date to OracleDbType.TimeStamp I get the time component. I'm not happy with this "hack" because I'm not sure what will happen when we upgrade our version of the Database to Oracle 9i which uses the new TimeStamp datatype.
    Is this a bug that the OracleDbType.Date does not include the time component??

    How do you examine the output Date value?
    If it is from the string, then the time components will
    not show because the NLS_DATE format in the client
    machine does not contain the time components.
    In American, the Date format is 'DD-MON-RR' by default whereas, the TimeStamp format is 'DD-MON-RR HH.MI.SSXFF AM' by default.
    Can you take a look at the time components from the OracleDate by accessing the time properties, eg. OracleDate.Hour, OracleDate.Minute..etc to see if the time values are there?
    Thanks
    Martha

  • OraDynaSet not returning the correct number of records.

    Hello All, I am writing VB code in Excel 2007 and retrieving records from a Oracle 9i database. When I run my query from TOAD or any other sql app I get 56 records returned for certain query. However, when I do it from VB in excel and write the values to the excel file, it will not return the last 3 records, any suggestions? Here is part of my code:
    Worksheets("Report").Range("A3").Value = ""
    Worksheets("Report").Range("B3").Value = "Period"
    Worksheets("Report").Range("C3").Value = "Budget"
    Worksheets("Report").Range("D3").Value = "Projected"
    strSQL = "select group_name,period_name,budget_value,budget_value project from nlas_bdgt_loading_stg where plant = " & plant & " and group_number = 1 order by group_number, period_num"
    Set OraDynaSet = objDataBase.DBCreateDynaset(strSQL, 0&)
    If OraDynaSet.RecordCount > 0 Then
    OraDynaSet.MoveFirst
    'Loop the recordset for returned rows
    For i = 4 To OraDynaSet.RecordCount
    'Put the results in columns
    ActiveSheet.Cells(i, 1) = OraDynaSet.Fields(0).Value
    ActiveSheet.Cells(i, 2) = OraDynaSet.Fields(1).Value
    ActiveSheet.Cells(i, 3) = OraDynaSet.Fields(2).Value
    ActiveSheet.Cells(i, 4) = OraDynaSet.Fields(3).Value
    OraDynaSet.MoveNext
    Next i
    End If
    Thanks,
    Chris

    Hello.
    It's a bit weird. It works for me. If you have a look at oo4o help:
    CopyToClipboard Method
    Example
    Applies To
    OraDynaset
    Description
    Copy the rows from the dynaset to the Clipboard in text format.
    Usage
    OraDynaset.CopyToClipboard(NumOfRows ,colsep [optional],rowsep [optional] )
    Arguments
    NumOfRows     Number of rows to be copied to the dynaset ,
    colsep     Column separator in CHAR to be inserted between columns
    rowsep     Row seperater in CHAR to be inserted between Rows
    Remarks
    This method is used to facilitate transfer of data between Oracle Object for OLE’s cache (dynaset) and Windows applications such as Excel or Word. CopyToClipboard copies data starting from current position of the dynaset up to the last row.
    Default column separator is TAB (ASCII 9).
    Default row separator is ENTER (ASCII 13).
    Can it be that you don't have all the References needed?
    Octavio

  • Ldapsearch does not return the correct result

    We are using the Netscape Directory server 4.12. We try to use the Radiator Radius server to query the Directory server for authentication.
    When we use the filter:
    uid=itkychan
    to query if the user is in the Directory, it returns the correct result.
    However, we would like to query if the username is in a specified group, e.g. tss_ns_grp, in the Directory, we try to use the following command:
    #./ldapsearch -b "o=The xxx University,c=HK" -h hkpu19
    "(&(cn=tss_ns_grp)(|(&(objectclass=groupofuniquenames)(uniquemember=uid=itkychan))(&(objectclass=groupofnames)(member=uid=itkychan))))"
    but no result is returned.
    itkychan is a member of the group tss_ns_grp. The following is a portion of the LDIF file:
    dn: cn=tss_ns_grp, o=The xxx University, c=HK
    objectclass: top
    objectclass: groupOfUniqueNames
    objectclass: mailGroup
    cn: tss_ns_grp
    mail: [email protected]
    mailhost: abcd.xxxu.edu.hk
    uniquemember: cn=xxxxxxxxxxxxxx, uid=itkychan, ou=xxxu_ITS, o=The xxx University, c=HK
    uniquemember: cn=xxxxxxxxxxxxxx, uid=itjcheng, ou=polyu_ITS, o=The xxx University, c=HK
    uniquemember: .....

    You will have to use the full DN for the member and uniquemember e.g.
    (...(uniquemember=cn=xxxxxxxxxxxxxx, uid=itkychan, ou=xxxu_ITS, o=The xxx University, c=HK)...)

  • Can't open Illustrator file - "does not have the correct number of operands..."

    Right off the bat - Mac, 10.6.8, Illustrator CS4. I've seen different variations of this "...correct number of operands..." error on these boards, with fonts and other things as the culprit, but I haven't come across this specific issue yet. If someone has seen something along these lines please let me know.
    I work for a small design agency that uses Illustrator CS4 on a consistent basis. We have had an ongoing issue where random files that had been working fine will sporadically become corrupt, causing us to have to use the Document Recovery Mode and then edit the file in a text editor to fix the problem which does work for this issue flawlessly, other than the headache of having to do this repeatedly.
    Our workflow is such that we use a local area storage RAID which everyone uses to access the same client files. These client files are all in a series of nested folders we employ to keep all our separate client's work separate. The error arises when certain images are placed into a document, then the document is saved and closed. Upon trying to reopen the file we get an error message like this:
    Where the string "/CR0050_ret.psd" is the filename of the offending image. Basically what has happened is that in the actual code for the document, there is a string that starts as "%%IncludeFile....." which specifies the file's pathway on the local area storage we use. The last segment of that string is the image's filename, which has gotten returned to the next line down, and now the program cannot interpret that line in the code, so it cannot properly open the file. The file will open but only the content that is above the offending IncludeFile string is visible.
    (client information blurred out)
    This does not happen to all the "%%IncludeFile" strings in the document, and does not happen for all images on our local area storage. We know how to fix the problem through the Document Recovery mode and then editing the text. Once we return the filename portion of the code back up to the proper line, and save the file in the text editor, the file will open in Illustrator and show all the information contained within properly. However, if you save the file out again without making any changes, the same errors will propagate throughout the file's code again, and become unreadable prompting another document recovery. Insert endless cycle here.
    What we would like to try and find out is why is this happening, so we can prevent it from happening in the future. Is the image nested too far down in the hierarchy of folders? Are there too many characters in the file pathway string? What can we do to keep this from happening moving forward?
    I know that an easy answer is to copy the files over locally to our hard drives, and work from there, but this is not a very efficient way to work, as we are all collectively working on different files, utilizing common image resources. We like to keep one set of images so there is no duplication that may lead to the wrong image being sent out - "Oh you sent John's version? You should have sent Molly's version of the image for that file"
    We also downloaded the trial version of Illustrator CS6 to see if an upgrade would work wonders, but it does not, the problem persists when saving a recovered file in CS6.
    Any thoughts? Thanks in advance.
    ABK

    In Illustrator it is generally not a good idea to read and write directly to and from a server: http://helpx.adobe.com/illustrator/kb/illustrator-support-networks-removable-media.html
    If you really think you need to do it, then check your network thoroughly.

  • Discovery seach does not return the correct messages

    We're trying to produce what I thought would be simple reports on the entire mail database. We have a simple single Exch2010 box. When using the discovery search tool, it is returning WAY too much of the wrong info. I just want to put in keywords, restrict
    the FROM to a single @domain.com and limit by date. It seems like the tool would do such a simple thing, but it doesn't seem to filter out on the FROM at all. It just does the keywords and dates. Without the limit on the From domain there are thousands of
    incorrect hits.
    I have the latest CU's, the user is definitely part of the discovery role group, it works on just keywords, but its just spewing all kinds of useless information. Anyone have any ideas? I really don't use powershell and would prefer not to since I have a
    bunch of these to do in various options, but I can't trust the data.
    Curt Kessler - FLC

    Hi Curt,
    To know more about the issue, could you please let me know the search query you specified which give unexpected result? Since you mentioned you don’t want to use shell, are you using ECP? When
    perform the search, how did you specify the “Keywords” and “Messages To or From Specific E-mail Address”? Which mailbox did you use as the destination mailbox to store the search result?
    I recommend not choose the “Include items that can’t be searched” and “Enable deduplication” option. Please try again and give me a screenshot of the result
    if still other emails from other senders appear in the search result. Please set the keywords as format
    “Keywords”1 AND (“Keywords2” OR “Keywords3”)
    Note: If we only specify one keywords, what’s the result? Please test and check.
    Meanwhile, to narrow down the issue, it’s recommend to use shell to search, it’s useful to test the issue and verify if the same result using the same search queries and still emails form other
    senders appear. For example:
    New-MailboxSearch -Name "Search-20140307" -TargetMailbox “Target mailbox to store the search result” -StartDate "01/01/2014" -EndDate "03/07/2014" -Senders "sender
    email address or domain name" -SearchQuery "search keywords" -ExcludeDuplicateMessages
    For more information about discovery search, we can refer to the following articles:
    Title: Mailbox Search
    Link1:
    http://technet.microsoft.com/en-us/library/dd298064(v=exchg.141).aspx
    Link2:
    http://technet.microsoft.com/en-us/library/dd335072(v=exchg.141).aspx#PDS
    Link3:
    http://www.msexchange.org/articles-tutorials/exchange-server-2010/compliance-policies-archiving/managing-multi-mailbox-search-exchange-server-2010-part2.html
    Regards, Eric Zou

  • HttpServletRequest.getHeaders("accept") does not return the correct results

    I noticed that when I use the invoke the HttpServletRequest.getHeaders("accept") method I do not get the result that I am expecting.
    For instance, if the browser passes over the following accept header:
    "text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8"
    When i invoke the getHeaders() method, instead of it returning me a single value with the string that was passed over, it returns me 4 separate entries. It looks like Iplanet is parsing the header value and breaking it up by commas.
    When I run the same code in TomCat, it returns the single comma separated string as I would expect.
    Is there anything to keep Iplanet from breaking apart the header value?
    I am running Oracle iPlanet Web Server 7.0.15 B04/19/2012 21:52
    Thanks In Advance,
    Marty
    Edited by: MartyJones2 on Aug 30, 2012 2:44 PM

    You will have to use the full DN for the member and uniquemember e.g.
    (...(uniquemember=cn=xxxxxxxxxxxxxx, uid=itkychan, ou=xxxu_ITS, o=The xxx University, c=HK)...)

  • SSRS report with tabular model – MDX query CoalesceEmpty function does not return the provided string value

    Hello everyone,
    I created following calculated member in MDX query. I am using it in one of the report parameter in dataset (single select dropdown list as report parameter).
    WITH MEMBER [Measures].[ParameterCaption] AS
    CoalesceEmpty([Customer].[National Account Code].CURRENTMEMBER.MEMBER_CAPTION,'None')
    I would like to display 'None' text at the top of the dropdown list values. So that when user selects 'None' then this parameter will not considered in MDX query else the selected National Account Code will be considered to filter report data. But,
    the above return blank/empty value for  [Customer].[National Account Code].&  member though I specified 'None' as text in CoalesceEmpty function. Any advice would be appreciated.
    Thanks, Ankit Shah
    Inkey Solutions, India.
    Microsoft Certified Business Management Solutions Professionals
    http://www.inkeysolutions.com/MicrosoftDynamicsCRM.html

    Hi Ankit,
    It seems that you issue had been solved in your another thread.
    http://social.msdn.microsoft.com/Forums/sqlserver/en-US/5a5becac-226f-428a-95b0-aaaa22733818/ssrs-report-with-tabular-model-create-a-dropdown-report-parameter-with-none-option-as-the-top?forum=sqlanalysisservices#0e51bf8c-a66c-4df5-a244-0147728fdfdb
    iif([Customer].[National Account Code].CURRENTMEMBER.MEMBER_CAPTION="","None",[Customer].[National
    Account Code].CURRENTMEMBER.MEMBER_CAPTION)
    I marked this reply as answer, it will benefit to other members who have the similar issue.
    Regards,
    Charlie Liao
    TechNet Community Support

  • Why does not return the correct color?

    I have a resources dictionary with a color:
    <SolidColorBrush x:Key="MyColorWhenSelected" Color="{Binding Source={x:Static SystemColors.HighlightBrush}}"/>
    I have added this resources to App.Current.Resources.MergedDictionaries.
    Later, in my converter to set the background in a listview, I return:
    return App.Current.Resources["MyColorWhenSelected"]
    But the item has a white color, is not blue like the defult selected color.
    However, if I return:
    return System.Windows.SystemColors.HighlightBrush
    Then the color is the expected one.
    I have tried another color from my dictionary, por example:
    <SolidColorBrush x:Key="TestColor" Color="White" />
    If I return
    return App.Current.Resources["MyColorWhenSelected"]
    this works as expected.
    I guess that the problem is because in this second case all is SolidColorBrush type, while in the first case one is SolidColorBrush and the other is SystemColors.
    My idea is to use the resource dictionary because if in the future I decide to change the highlight color, change it in this resource, and not to change in all the converters in which I use this color.
    Thank so much.

    There is an error in your binding. You should bind to the Color property of the HighlightBrush:
    <SolidColorBrush x:Key="MyColorWhenSelected" Color="{Binding Path=Color, Source={x:Static SystemColors.HighlightBrush}}"/>
    Please remember to close your threads by marking helpful posts as answer and then start a new thread if you have a new question.

  • FileReader does not return the correct byte value of the characters

    I have some text in a very old persian code page and all I have from this code page is numerical table of the characters(like ASCII table).
    With a HashMap, the equivalent Unicode characters are mapped to the numerical values. With using FileInputStream and its read() method, it converts corretly;
    but by using the FileReader (following code snippet), just a few characters cannot be read correctly so it cannot be mapped correctly either.(I tryed several encodings too)
    FileReader in = new FileReader("inputFile");
    BufferedReader b = new BufferedReader(in);
    Stirng s = b.readLine();
    byte[] by = s.getBytes("encoding");
    I need to work with strings for conversion; so is ther any solution for it?

    I have some text in a very old persian code page and
    all I have from this code page is numerical table of
    the characters(like ASCII table).
    With a HashMap, the equivalent Unicode characters are
    mapped to the numerical values. With using
    FileInputStream and its read() method, it converts
    corretly;
    but by using the FileReader (following code snippet),
    just a few characters cannot be read correctly so it
    cannot be mapped correctly either.(I tryed several
    encodings too)
    FileReader in = new FileReader("inputFile");
    BufferedReader b = new BufferedReader(in);
    Stirng s = b.readLine();
    byte[] by = s.getBytes("encoding");
    I need to work with strings for conversion; so is ther
    any solution for it?Use FileInputStream to read the data into bytes, then use your mapping to convert bytes to characters. Then create a string representation by appending the characters to a StringBuffer. You can't use FileReader because readers convert bytes to characters using a character encoding, which you don't have.

  • TABLE(CAST()) function not returning the correct results in few scenarios.

    I am using TABLE(CAST()) operation in PL/SQL and it is returning me no data.
    Here is what I have done:
    1.     Created Record type
    CREATE OR REPLACE TYPE target_rec AS OBJECT
    target__id          NUMBER(10),
    target_entity_id NUMBER(10),
    dd           CHAR(3),
    fd           CHAR(3),
    code      NUMBER(10),
    target_pct      NUMBER,
    template_nm VARCHAR2(50),
    p_symbol      VARCHAR2(10),
    pm_init          VARCHAR2(3),
    target_name     VARCHAR2(20),
    targe_type     VARCHAR2(30),
    target_caption     VARCHAR2(30),
    sort_order      NUMBER (4)
    2.     Created Table type
    CREATE OR REPLACE TYPE target_arr AS TABLE OF target_rec
    3.     Created Stored procedure which accepts parameter of type target_arr and runs the Table(Cast()) function on it.
         Following is the simplified form of my procedure.
         PROCEDURE get_target_weights
         p_in_template_target IN target_arr,
         p_out_count          OUT NUMBER,
         IS
         BEGIN
              SELECT count(*) into p_out_count
         FROM TABLE(CAST(p_in_template_target AS                     target_arr)) arr;
         END;
    I am calling get_target_weights from my java code and passing p_in_template_target with 10140 records.
    Scenario 1: If target_pct in the last record is 0, p_out_count returned from the procedure is 0.
    Scenario 2: If target_pct in the last record is any other value(say 0.01), p_out_count returned from the procedure is 10140.
    Please help me understand why the Table(Cast()) is not returning the correct results in Scenario 1. Also adding or deleting any record from the test data returns the correct results (i.e. if keep target_pct in the last record as 0 but add or delete any record).
    Let me know how can I attach the test data I am using to help you debugging as I don’t see any Attach file button on Post Message screen on the forum.

    I am not able to reproduce this problem with a small data set. I can only reproduce with the data having 10140 records.
    I am not sure if this is the memory issue as adding a new record also solves the problem.
    This should not be the error because of wrong way of filling the records in java as for testing purpose I just saved the records which I am sending from java in a table. I updated the stored procedure as well to read the data from the table and then perform TABLE(CAST()) operation. I am still getting 0 as the output for scenario 1 mentioned in my last mail.
    Here is what I have updated:
    1.     Created the table target_table
    CREATE Table target_table
    target_id          NUMBER(10),
    target_entity_id NUMBER(10),
    dd           CHAR(3),
    fd           CHAR(3),
    code      NUMBER(10),
    target_pct      NUMBER,
    template_nm VARCHAR2(50),
    p_symbol      VARCHAR2(10),
    pm_init          VARCHAR2(3),
    target_name     VARCHAR2(20),
    target_type     VARCHAR2(30),
    target_caption     VARCHAR2(30),
    sort_order      NUMBER (4)
    2.     Inserted data into the table : The script has around 10140 rows. Pls let me know how can I send it to you
    3.     Updated procedure to read data from table and stored into variable of type target_arr. Run Table(cast()) operation on target_arr and get the count
    PROCEDURE test_target_weights
    IS
         v_target_rec target_table%ROWTYPE;
         CURSOR wt_cursor IS
         Select * from target_table;
         v_count NUMBER := 1;
         v_target_arr cws_target_arr:= target_arr ();
         v_target_arr_rec target_rec;
         v_rec_count NUMBER;
         BEGIN
         OPEN wt_cursor;
         loop
              fetch wt_cursor into v_target_rec; -- fetch data from table into local           record.
              exit when wt_cursor%notfound;
              --move data into target_arr
              v_target_arr_rec :=                     cws_curr_pair_entity_wt_rec(v_target_rec target_id,v_target_rec. target_entity_id,
                        v_target_rec.dd,v_target_rec.fd,v_target_rec.code,v_target_rec.target_pct,
         v_target_rec.template_nm,v_target_rec.p_symbol,v_target_rec.pm_init,v_target_rec.template_name,
         v_target_rec.template_type,v_target_rec.template_caption,v_target_rec.sort_order);
              v_target_arr.extend();
              v_target_arr(v_count) := v_target_arr_rec;
              v_count := v_count + 1;
         end loop;
         close wt_cursor;
         -- run table cast on target_arr
         SELECT count(*) into v_rec_count
         FROM TABLE(CAST(v_target_arr AS target_arr)) arr;
         DBMS_OUTPUT.enable;
         DBMS_OUTPUT.PUT_LINE('p_out_count ' || v_rec_count);
         DBMS_OUTPUT.PUT_LINE('v_count ' || v_count);
    END;
    Output is
    p_out_count 0
    v_count 10140
    Expected output
    p_out_count 10140
    v_count 10140

  • Adobe Acrobat 8 Professional does not accept the correct serial number after reinstallation

    Adobe Acrobat 8 Professional does not accept the correct serial number after reinstallation, what to do?

    Thank you Bill. You could help me with the answer and the one in the other forum:
    "Acrobat has a separate installation process and needs to be activated with your Adobe ID I think. The question on CC is really one for the folks in the CC forum (Adobe Creative Cloud), not the Acrobat forum".
    I could resolve things with Adobe CC. I don´t need my old Acrobat 8, but I could finally install Acrobat XI Pro - and this time it seems to work, without permanently crashing down.
    Thank you.

  • Adobe Acrobat 8 Professionals does not accept the correct serial number after reinstallation

    Adobe Acrobat 8 Professionals does not accept the correct serial number after reinstallation, what to do?

    Moved to Acrobat Installation & Update Issues

  • Certificate does not contain the correct site name

    Hello,
    I have to make a midlet that connect to a tomcat 5.5.9 server with ssl.
    I import the certificate whit tomcat alias in the wireless toolkit but when i run the midlet this error appear: Certificate does not contain the correct site name
    import java.io.*;
    import javax.microedition.midlet.*;
    import javax.microedition.io.*;
    import javax.microedition.lcdui.*;
    public class HelloNet extends MIDlet implements CommandListener , Runnable{
    // User interface command to exit the current
    // application.
    private Command exitCommand = new Command("Exit",
    Command.EXIT, 2);
    // User interface command to issue an HTTP GET
    // request.
    private Command getCommand = new Command("Get",
    Command.SCREEN, 1);
    /// The current display object.
    private Display display;
    // The url to GET from the 'net.
    private String url;
    * Initialize the MIDlet with a handle to the
    * current display.
    public HelloNet() {
    url = "https://127.0.0.1:8443/Hello.txt";
         display = Display.getDisplay(this);
    * This lifecycle method should return immediately
    * to keep the dispatcher
    * from hanging.
    public void startApp() {
         showPrompt();
    * Display the main screen.
    void showPrompt() {
    String s = "Press Get to fetch " + url;
    TextBox t = new TextBox("Http Result", s,
    s.length(), 0);
    t.addCommand(exitCommand);
    t.addCommand(getCommand);
    t.setCommandListener(this);
         display.setCurrent(t);
    * pauseApp signals the thread to stop by clearing
    * the thread field.
    * If stopped incorrectly, it will be restarted from
    * scratch later.
    public void pauseApp() {
    * destroyApp must cleanup everything. The thread
    * is signaled
    * to stop and no result is produced.
    * @param unconditional is a flag to indicate that
    * forced shutdown
    * is requested
    public void destroyApp(boolean unconditional) {
    * commandAction responds to commands
    * @param c command to perform
    * @param s Screen displayable object
    public void commandAction(Command c, Displayable s) {
         if (c == exitCommand) {
         destroyApp(false);
         notifyDestroyed();
         } else if (c == getCommand) {
              Thread th= new Thread (this);
              th.start();
    * Read the content of the page.
    public void run() {
    TextBox t = null;
    StringBuffer b = new StringBuffer();
    HttpsConnection c = null;
    InputStream is = null;
         try {
         int len = 0;
         int ch = 0;
         System.out.println("Cerco di leggere");
    c = (HttpsConnection)Connector.open(url);
    c.setRequestMethod(HttpsConnection.GET);
         is = c.openInputStream();
    // length of content to be read.
    len = (int) c.getLength();
    if (len != -1) {
    // Read exactly Content-Length bytes
    for(int i=0; i<len; i++) {
    if((ch = is.read()) != -1) {
    b.append((char) ch);
    } else {
    // Read until connection is closed.
    while((ch = is.read()) != -1) {
    len = is.available();
    b.append((char) ch);
    t = new TextBox("Https Result", b.toString(),
    b.length(), 0);
         } catch (Exception e) {
    e.printStackTrace();
    String s = e.toString();
    if(s != null) {
    t = new TextBox("Https Error", s, s.length(),
    0);
    } finally {
    if (is != null) {
         try {
              is.close();
         } catch (Exception ce) { }
    if (c != null) {
         try {
              c.close();
         } catch (Exception ce) { }
    display.setCurrent(t);
    }

    re: code tags, please see http://forum.java.sun.com/help.jspa?sec=formatting.
    As for the rest:
    See, we now know that you used keytool to generate you certificate. You need a new certificate. This time, when keytool asks you for a first and last name, type 127.0.0.1.

Maybe you are looking for

  • Period not open for G/L account

    Hi, Help needed- While posting goods issue, system gave error message as"Period 011 /2007 is not open for account type S and G/L 600101." So PGI could not be executed. How to make period open for accunt type & G/L acc. In MMRV, current period is 11/2

  • Acrobat X Pro Auto Complete Issues

    Does anyone else find this feature unusable? Every time I try to type something new in a field on a fillable pdf form the auto-complete makes its suggestion and I can't override it. In 8 Pro you could just keep typing and the auto-complete would reco

  • Updating multiple workbooks to a new substatus in performance mgmt.

    Hi I have a number of employee performance management workbooks that are all at a certain substatus right now, and I would like to be able to update them to a new substatus (basically move them back to an earlier substatus as the documents have been

  • How do I see TIF files in Bridge?

    When I am using Bridge I can't see TIF files. It only shows TIF logo?

  • Adding metadata

    hi all we have a fully functional km system.now my reqirement is to add certain properties to the documents in the repository like version,country,client etc (metadata) so that i can search the documents based on them .how can i add this metadata to