Problem with JMenus that Persist - Is this a Java bug?

I am having a problem with JMenus that persist. By this I mean
that my drop down menus persist on the screen even after they have
been selected.
I've checked the Java bug database, and the following seems
to come closest to my problem:
Bug ID: 4235188
JPopupMenus and JMenus persist when their JFrame becomes visible
State: Closed, not a bug
http://developer.java.sun.com/developer/bugParade/bugs/4235188.html
This page says that the matter is closed and is not a bug. The
resolution of this matter printed at the bottom of the page
is completely abstruse to me and I would appreciate any
comments to understand what they are talking about.
The code at the end of my message illustrates my problem.
1. Why should paintComponent() make any difference to
Menu behavior?
2. Is this a bug?
3. What's the workaround if I have to paint() or repaint()?
Thanks
Tony Lin
// Example of Menu Persistence Problem
// Try running this with line 41, paintComponent(), and without line 41
// Menus behave normally if line 41 is commented out
// If line 41 exists, menus will persist after they have been selected
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class P2 extends JPanel {
JMenuItem[] mi;
public P2() {
JFrame thisFrame = new JFrame();
thisFrame.getContentPane().add(this);
JMenu menu = new JMenu("My Menu");
JMenuBar mb = new JMenuBar();
mi = new JMenuItem[4];
for (int i=0; i<mi.length; i++) {
mi[i] = new JMenuItem("Menu Item " + String.valueOf(i));
menu.add(mi);
mb.add(menu);
thisFrame.setJMenuBar(mb);
thisFrame.setSize(400,200);
thisFrame.setLocation(150,200);
thisFrame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent we) {
System.exit(0);
thisFrame.setVisible(true);
public void paintComponent(Graphics g) {} //Affects menu behavior!
public static void main(String[] args) {
new P2();

Well, my understanding of the way painting works is that a component doesn't UNPAINT itself. Instead a message is sent to the component under the coordinates of the menu to REPAINT itself.
In your demo program the JFrame is the component under the JMenu. The paintComponent() method of JFrame is empty, so nothing gets repainted.
I added super.paintComponent(g); to the method and everything works fine.

Similar Messages

  • I have problem with account that i can't make update or buy from app store There is massage appear in my payment page that i must contact with i tunes support to complete this transaction Please help me to fixe this problem as soon possible Hany hassan 00

    I have problem with account that i can't make update or buy from app store
    There is massage appear in my payment page that i must contact with i tunes support to complete this transaction
    Please help me to fixe this problem as soon possible
    Hany hassan
    0096597617317
    0096596677186
    Thank you

    You need to Contact iTunes Support...
    Apple  Support  iTunes Store  Contact Us

  • Hello I have a problem with a Wifi Survey app, this app is from Access Agility, however this app was working fine, but without advise stop of working, I tried to open again, but app be close after few seconds.

    Hello I have a problem with a Wifi Survey app, this app is from Access Agility, however this app was working fine, but without advise stop of working, I tried to open again, but app be close after few seconds. Every time that I tried to open it, in diagnostic and use create some files, in special one named LatestCrash-WifiSurvey.plist, this one generate an incident identifier E73B0164-CDFA-4E9E-839E-A0C021BD17A2, but this incident identifier change every time that I tried to open, the last incident identifier is: DE600EB3-AB57-4C33-8DE8-71F6788A7441.
    After of it, I checked that the app had a new version available for downloading, I took a backup of my ipad and then upgrade this app, but is the same problem, all I want is to save the projects I had in this app, I´m afraid that if I delete this app and re-install it, probably I loss my projects.
    Thanks for your help indicating how I can save my projects and see them for example in an iphone for assurance that data is not lost.
    Something that called my attention is part of the log that shows a big CPU processing, but the strange thing is I killed all applications.
    Incident Identifier: E73B0164-CDFA-4E9E-839E-A0C021BD17A2
    CrashReporter Key:   ed0ca1405ce83d4f80cb3cce063d7248d7b76e91
    Hardware Model:      iPad2,5
    Process:         WifiSurvey [139]
    Path:            /var/mobile/Applications/1BEEE35A-85FC-4BE4-B62A-39A930CB3CE2/WifiSurvey.app/Wi fiSurvey
    Identifier:      WifiSurvey
    Version:         ??? (???)
    Code Type:       ARM (Native)
    Parent Process:  launchd [1]
    Date/Time:       2013-08-08 19:01:13.476 -0500
    OS Version:      iOS 6.1.3 (10B329)
    Report Version:  104
    Exception Type:  00000020
    Exception Codes: 0x000000008badf00d
    Highlighted Thread:  0
    Application Specific Information:
    com.accessagility.wifisurvey failed to launch in time
    Elapsed total CPU time (seconds): 20.990 (user 20.990, system 0.000), 52% CPU
    Elapsed application CPU time (seconds): 19.954, 50% CPU

    See:
    iOS: Troubleshooting applications purchased from the App Store
    Contact the developer/go to their support site if only one app.
    Restore from backup. See:
    iOS: How to back up              
    Restore to factory settings/new iPod

  • My mozilla does't opening new tabs & I am having very problem with my work due to this.Please tell me how can i resolve this problem.

    My mozilla does't opening new tabs & I am having very problem with my work due to this.Please tell me how can i resolve this problem

    The Ask Toolbar is causing that in the Firefox 3.6.13 version. Evidently something in that extension isn't compatible with a Firefox security fix. Disable that extension or un-install it.

  • Problem with Spaces that started with Snow Leopard

    I've noticed two problems with Spaces that have arrived since switching to Snow Leopard... First, if I am in say Space 1 where I use Safari and I then want to move over to an open application, say like Excel, that I have running in Space 4, there are a number of ways to get there but one way I used to use all the time was to move down to the Dock and simply single click on the open Excel application and that would immediately switch me over to Space 4 and whatever Excel documents were already open there... Now, since switching to SL, a single click of whatever application in the Dock makes that application active in the Finder (you see its name appear in the upper left of the menu bar) but otherwise nothing happens... You then have to click a second time and then you switch over to Space 4... It's not really a double click because that implies to clicks closely spaced in time... For this, you can click once, leave the room, come back, click a second time and you will now switch to the alternate space where the open application is running... That is clearly different than it was under Leopard and I would suggest that it is a bug because there is no value in the outcome of that first click... It highlights the switched application but doesn't actually switch to it until you click a second time...
    Second, and this one is worse, if you say launch Excel (which you want to open in Space 4) while you are in Space 1, Excel will open and switch over to Space 4... So far so good... But now, with Excel open over in Space 4, if you are now back and working in Space 1 and while there you use the Finder to go to some other, currently unopened, Excel file and request that it open, it should switch over to Space 4 and open that file but instead it opens it wherever you are, in the case mentioned here, in Space 1... So now you have Excel files opened both in Spaces 1 and 4... Clearly a bug... Spaces had some similar issues in a few early versions of Leopard but they eventually got it working... Now it appears Spaces has regressed somewhat in SL... I love spaces and use it all the time... Hope it gets fixed soon... thanks... bob...

    Hi... I have since learned that the first paragraph of my original post where I say,
    "I've noticed two problems with Spaces that have arrived since switching to Snow Leopard... First, if I am in say Space 1 where I use Safari and I then want to move over to an open application, say like Excel, that I have running in Space 4, there are a number of ways to get there but one way I used to use all the time was to move down to the Dock and simply single click on the open Excel application and that would immediately switch me over to Space 4 and whatever Excel documents were already open there... Now, since switching to SL, a single click of whatever application in the Dock makes that application active in the Finder (you see its name appear in the upper left of the menu bar) but otherwise nothing happens... You then have to click a second time and then you switch over to Space 4... It's not really a double click because that implies to clicks closely spaced in time... For this, you can click once, leave the room, come back, click a second time and you will now switch to the alternate space where the open application is running... That is clearly different than it was under Leopard and I would suggest that it is a bug because there is no value in the outcome of that first click... It highlights the switched application but doesn't actually switch to it until you click a second time... "
    ...that turned out to be my mistake... In another post someone pointed out that in Spaces preferences you must have checked ON the preference that says,
    "When switching to an application, switch to a space with open windows for the application"...
    I had been playing with a number of things trying to figure out what was going on and somewhere in the mix had switched that off... (It is on on all my other computers and I'm sure it originally was on this one too)... When I switched it back on the above described problem went away... So that was my fault...
    But the second part,
    "Second, and this one is worse, if you say launch Excel (which you want to open in Space 4) while you are in Space 1, Excel will open and switch over to Space 4... So far so good... But now, with Excel open over in Space 4, if you are now back and working in Space 1 and while there you use the Finder to go to some other, currently unopened, Excel file and request that it open, it should switch over to Space 4 and open that file but instead it opens it wherever you are, in the case mentioned here, in Space 1... So now you have Excel files opened both in Spaces 1 and 4... Clearly a bug... "
    ...is a real problem... I fired up my G4 (power pc) that runs Leopard, 10.5.8, to see whether it behaves the above way or not and it does NOT... It works as one would expect.. So at least later in Leopard, the above mentioned problem was not present but it is in this first incarnation of Snow Leopard...
    To me, the utility of Spaces is all about keeping a single desktop from being cluttered with many open applications/files and to now have an application that opens in whatever space you happen to be in after it is first opened in its "correct" space sort of defeats the idea behind Spaces... I am currently trying to train myself to first hit <command><4> (my Excel space) before opening a second or subsequent Excel document to prevent it from opening somewhere where I don't want it to be...
    Again, I hope Apple sees and fixes this... I did submit an "Apple feedback" item for this issue... thanks... bob..

  • I have a Iphone 4S and i update a new version 6.1, and i have a problem with wifi from i update this version. What is this problem? thanks Andres

    I have a Iphone 4S and i update a new version 6.1, and i have a problem with wifi from i update this version. What is this problem? thanks Andres

    Move or Copy the ENTIRE iTunes folder from the old computer or the backup of the old computer to the new computer.

  • Automatic page updates causing problems with your screen reader? this kind of message come when i access yahoo mail.yahoo mail page not come properly.

    Automatic page updates causing problems with your screen reader? this kind of message come when i access yahoo mail.yahoo mail page not come properly.i can't chat,compose mail nothing accessing.

    Try Refresh Blocker: https://addons.mozilla.org/firefox/addon/992

  • I have a Mac with OS 10 5.8 and a new HP Pro 8500 Premier Printer. When printing, how do I change the print option from photo paper to plain or inkjet? This is a serious problem and HP tells me it is a problem with Firefox, that they are getting several

    I used to be able to choose print options with Firefox and now I can't. It forces me to use photo paper when I want only to use plain paper. I do not have this problem with Safari or IE, just firefox. I have an office jet 4500 HP printer

    I should add that it's an HP photosmart 4280.I found it online and it shows the Mac 0SX operating system.

  • Having Problems With The Neo2 ? Read This!!!!

    Hi,
    i just bought a neo2 motherboard, with a p4 2,6 HT and 512 mb Kingston hyper ram ( 2 peaces of 256, else it won't use the dual bandwith :D)
    In the beginning everything seemed fine, until i got some sudden reboots and other vague stuff. I read it could be the SB audigy messing things up. I removed the card and windows Xp pro runs fine now. no more sudden reboots or explorer not resonding crashes.
    But, i still had problems with games crashing. I got reboots. After i set the "automatic reboot after crash" to false, i got blue screens or lock-ups in my games.
    I wondered what it could be. Then i started to put my videocard ( a radeon 9700 pro 128 mb) in agp 4x mode instead of agp 8x! Now my games run without crashes, but benchmarks are not that high. 4780 marks with 3dmark 2003.
    I think i will send msi and Ati a mail concerning this problem. I don't know if it is PSU related. Maybe the videocard demands a little more power in agp 8x mode.
    Well, having probs with you're NEO2 ??
    remove the sb Audigy and turn the agp back to 4 using smartgart ( it's located in you're display settings screen ).
    First i tought it was a PSU related problem, because i swapped my 350 Watt enermax with a Q-tec 400 watt psu. The 400 watt PSU died while i was gaming. Maybe the enermax is the better PSU :D So, it could still be a PSU related problem. Maybe the agp 8x settings demands a lot more from you're psu. Anyway, i'll receive a 550 watt Antec PSU soon, so i can check this out....
    Btw. I cant run the motherboard in anything better than "slow" mode. In all other modes Xp won't boot. I haven't tryed it since the AGP is at 4X, but i don't think it will matter.
    Regards,
    Welcome to the real world NEO :D

    Ok.....
    i raised the memory voltage setting in the bios from 2.65 to 2.8 and the agp voltage from 1.5 to 1.7
    Everything seems fine, but games crash back to the desktop now without an error message or the either lockup.
    Whatever i do, i can't make the mobo crash in anything but games!
    Btw. the following message caught my attention, when i ran f1 2002 with directx 8.1. Since i have directx 9, i haven't seen it anymore. Maybe because the ati-drivers are made for directx 9....
    // Watchdog Event Log File
    LogType: Watchdog
    Created: 2003-10-04 02:02:53
    TimeZone: -60 - West-Europa (standaardtijd)
    WindowsVersion: XP
    EventType: 0xEA - Thread Stuck in Device Driver
    // The driver for the display device got stuck in an infinite loop. This
    // usually indicates a problem with the device itself or with the device
    // driver programming the hardware incorrectly. Please check with your
    // display device vendor for any driver updates.
    ShutdownCount: 9
    Shutdown: 0
    EaRecovery: 1
    EventCount: 2
    BreakCount: 2
    BugcheckTriggered: 1
    DebuggerNotPresent: 1
    DriverName: ati2dvag
    EventFlag: 1
    DeviceClass: Display
    DeviceDescription: RADEON 9700 PRO
    HardwareID: PCI\VEN_1002&DEV_4E44&SUBSYS_00021002&REV_00
    Manufacturer: ATI Technologies Inc.
    DriverFixedFileInfo: FEEF04BD 00010000 0006000E 000A18EA 0006000E 000A18EA 0000003F 00000008 00040004 00000003 00000004 00000000 00000000
    DriverCompanyName: ATI Technologies Inc.
    DriverFileDescription: ATI Radeon WindowsNT Display Driver
    DriverFileVersion: 6.14.10.6378
    DriverInternalName: ati2dvag.dll
    DriverLegalCopyright: Copyright (C) 1998-2002 ATI Technologies Inc.
    DriverOriginalFilename: ati2dvag.dll
    DriverProductName: ATI Radeon Family
    DriverProductVersion: 5.2.3790.2
    I wish i had another videocard to test. My radeon 9700 pro is getting suspicious...
    Regards,
    The real world

  • Problem with Checkbox that disables/enables other components.

    Hi
    As I show in the title, I have problems with a checkbox that enables/disables another components (three exactly).
    I have done the follow:
    1.- Set property "AutoSubmit" true in the SelectOneChoice
    2.- Set "Disabled" property true or false depending if the SelectOneChoice is selected or not
    (#...selectBooleanCheckbox.value?false:true})
    3.- Set the Partial triggers to the SelectOneChoice in the three components.
    CASE 1: The SelectOneChoice is unmarked. The three components appears disabled and when I mark the SelectOneChoice, this components appears enabled. The thing works ;)
    CASE 2: The SelectOneChoice is marked. The three components appears enabled and when I unmark the SelectOneChoice, the components continue enabled. They don't disable until I press the submit button.
    how can i make that the components appears disabled when i unmark the checkbox?
    i try with de ChangeValueListener, but it only works where the SelectOneChoice changes from unmarked to marked.
    thanks!

    I think the problem is, when the value is null the checkbox return with the selected state, b'coz u r
    returning the checkbox (as it is). so pl'z try with below code (ADDED).
    public Component getTableCellRendererComponent(JTable table, Object value,
    boolean isSelected, boolean hasFocus,
    int row, int column){
    if(value != null){
    Boolean booleanValue = (Boolean)value;
    setSelected(booleanValue.booleanValue());
    else /// ADDED
    setSelected(false);/// ADDED
    return this;
    Nediaph.

  • HT1296 Have a problem with syncing. I get this message: The ipod Bill's Ipod" cannot be synced because there is not enough space to hold all of the items in the iTunes library (additional 2.4GB required) I don't understand as I have much more space than 2

    I recently ran into a problem with syncing my ipod touch to itunes on my Windows 7 pc. It had previously been synced to my older laptop
    and I wanted to change to my newer Windows 7 laptop's itunes library that I had already been syncing with.
    Anyway, I started seeing this message that prevents my from syncing:
    The iPod "Bill's iPod" cannot be synced because there is not enough free space to hold all of the items in the iTunes library
    (additional 2.48 GB required)  
    Not sure if it is talking about my iPod free space or my PC itunes library free space. Either way I have 11.0 GB free space available
    on my iPod and 412 GB free space available on my Windows 7 PC.
    How do I handle this problem?   Please help!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    Thanks

    It is saying that the iPod does not have enough free storage to sync all the items yu have selected to sync to the iPod. You need 2.48 GB more free on the iPod. You need either to select less to sync or delete some content form the iPod.

  • Problem with package that create mail with PDF attachment

    Hola,
    I've this problem when I use the Oracle Package called "demo_mail",
    that I have download from this forum en september.
    The code of the Package, I post bottom, now I
    write the records of the Package,
    that I believe is the core of the problem:
    demo_mail.begin_attachment( conn => conn,
    mime_type => 'application/pdf',
    inline => TRUE, filename => ''|| VC_NOMEFILE ||'',
    transfer_enc => 'base64');
    The mime_type is correct?
    Why when I open the attachment of the mail, it say me that file type
    is not correct or the file has been damneged? I need help!
    Thank's
    *********************************************************The steps that I've done:
    1. PACKAGE demo_mail
    2. PACKAGE BODY demo_mail
    3. procedure P_SPEDMAILSERVATTA (that call package) this
    Cannot write the code, because this the result. :(((
    thank's
    CREATE OR REPLACE PACKAGE demo_mail IS
    -- Customize the SMTP host, port and your domain name below.
    smtp_host VARCHAR2(256) := 'XXX.YYYY.IT';
    smtp_port PLS_INTEGER := 25;
    smtp_domain VARCHAR2(256) := 'YYYY.it';
    -- Customize the signature that will appear in the email's MIME header.
    -- Useful for versioning.
    MAILER_ID CONSTANT VARCHAR2(256) := 'Mailer by Oracle UTL_SMTP';
    --------------------- End Customizable Section ---------------------
    -- A unique string that demarcates boundaries of parts in a multi-part email
    -- The string should not appear inside the body of any part of the email.
    -- Customize this if needed or generate this randomly dynamically.
    BOUNDARY CONSTANT VARCHAR2(256) := '-----7D81B75CCC90D2974F7A1CBD';
    FIRST_BOUNDARY CONSTANT VARCHAR2(256) := '--' || BOUNDARY || utl_tcp.CRLF;
    LAST_BOUNDARY CONSTANT VARCHAR2(256) := '--' || BOUNDARY || '--' ||
    utl_tcp.CRLF;
    -- A MIME type that denotes multi-part email (MIME) messages.
    MULTIPART_MIME_TYPE CONSTANT VARCHAR2(256) := 'multipart/mixed; boundary="'||
    BOUNDARY || '"';
    MAX_BASE64_LINE_WIDTH CONSTANT PLS_INTEGER := 76 / 4 * 3;
    -- A simple email API for sending email in plain text in a single call.
    -- The format of an email address is one of these:
    -- someone@some-domain
    -- "Someone at some domain" <someone@some-domain>
    -- Someone at some domain <someone@some-domain>
    -- The recipients is a list of email addresses separated by
    -- either a "," or a ";"
    PROCEDURE mail(sender IN VARCHAR2,
              recipients IN VARCHAR2,
              subject IN VARCHAR2,
              message IN VARCHAR2);
    -- Extended email API to send email in HTML or plain text with no size limit.
    -- First, begin the email by begin_mail(). Then, call write_text() repeatedly
    -- to send email in ASCII piece-by-piece. Or, call write_mb_text() to send
    -- email in non-ASCII or multi-byte character set. End the email with
    -- end_mail().
    FUNCTION begin_mail(sender IN VARCHAR2,
              recipients IN VARCHAR2,
              subject IN VARCHAR2,
              mime_type IN VARCHAR2 DEFAULT 'text/plain',
              priority IN PLS_INTEGER DEFAULT NULL)
              RETURN utl_smtp.connection;
    -- Write email body in ASCII
    PROCEDURE write_text(conn IN OUT NOCOPY utl_smtp.connection,
              message IN VARCHAR2);
    -- Write email body in non-ASCII (including multi-byte). The email body
    -- will be sent in the database character set.
    PROCEDURE write_mb_text(conn IN OUT NOCOPY utl_smtp.connection,
                   message IN VARCHAR2);
    -- Write email body in binary
    PROCEDURE write_raw(conn IN OUT NOCOPY utl_smtp.connection,
              message IN RAW);
    -- APIs to send email with attachments. Attachments are sent by sending
    -- emails in "multipart/mixed" MIME format. Specify that MIME format when
    -- beginning an email with begin_mail().
    -- Send a single text attachment.
    PROCEDURE attach_text(conn IN OUT NOCOPY utl_smtp.connection,
                   data IN VARCHAR2,
                   mime_type IN VARCHAR2 DEFAULT 'text/plain',
                   inline IN BOOLEAN DEFAULT TRUE,
                   filename IN VARCHAR2 DEFAULT NULL,
              last IN BOOLEAN DEFAULT FALSE);
    -- Send a binary attachment. The attachment will be encoded in Base-64
    -- encoding format.
    PROCEDURE attach_base64(conn IN OUT NOCOPY utl_smtp.connection,
                   data IN RAW,
                   mime_type IN VARCHAR2 DEFAULT 'application/octet',
                   inline IN BOOLEAN DEFAULT TRUE,
                   filename IN VARCHAR2 DEFAULT NULL,
                   last IN BOOLEAN DEFAULT FALSE);
    -- Send an attachment with no size limit. First, begin the attachment
    -- with begin_attachment(). Then, call write_text repeatedly to send
    -- the attachment piece-by-piece. If the attachment is text-based but
    -- in non-ASCII or multi-byte character set, use write_mb_text() instead.
    -- To send binary attachment, the binary content should first be
    -- encoded in Base-64 encoding format using the demo package for 8i,
    -- or the native one in 9i. End the attachment with end_attachment.
    PROCEDURE begin_attachment(conn IN OUT NOCOPY utl_smtp.connection,
                   mime_type IN VARCHAR2 DEFAULT 'text/plain',
                   inline IN BOOLEAN DEFAULT TRUE,
                   filename IN VARCHAR2 DEFAULT NULL,
                   transfer_enc IN VARCHAR2 DEFAULT NULL);
    -- End the attachment.
    PROCEDURE end_attachment(conn IN OUT NOCOPY utl_smtp.connection,
                   last IN BOOLEAN DEFAULT FALSE);
    -- End the email.
    PROCEDURE end_mail(conn IN OUT NOCOPY utl_smtp.connection);
    -- Extended email API to send multiple emails in a session for better
    -- performance. First, begin an email session with begin_session.
    -- Then, begin each email with a session by calling begin_mail_in_session
    -- instead of begin_mail. End the email with end_mail_in_session instead
    -- of end_mail. End the email session by end_session.
    FUNCTION begin_session RETURN utl_smtp.connection;
    -- Begin an email in a session.
    PROCEDURE begin_mail_in_session(conn IN OUT NOCOPY utl_smtp.connection,
                        sender IN VARCHAR2,
                        recipients IN VARCHAR2,
                        subject IN VARCHAR2,
                        mime_type IN VARCHAR2 DEFAULT 'text/plain',
                        priority IN PLS_INTEGER DEFAULT NULL);
    -- End an email in a session.
    PROCEDURE end_mail_in_session(conn IN OUT NOCOPY utl_smtp.connection);
    -- End an email session.
    PROCEDURE end_session(conn IN OUT NOCOPY utl_smtp.connection);
    END;
    CREATE OR REPLACE PACKAGE BODY demo_mail IS
    -- Return the next email address in the list of email addresses, separated
    -- by either a "," or a ";". The format of mailbox may be in one of these:
    -- someone@some-domain
    -- "Someone at some domain" <someone@some-domain>
    -- Someone at some domain <someone@some-domain>
    FUNCTION get_address(addr_list IN OUT VARCHAR2) RETURN VARCHAR2 IS
    addr VARCHAR2(256);
    i pls_integer;
    FUNCTION lookup_unquoted_char(str IN VARCHAR2,
                        chrs IN VARCHAR2) RETURN pls_integer AS
    c VARCHAR2(5);
    i pls_integer;
    len pls_integer;
    inside_quote BOOLEAN;
    BEGIN
    inside_quote := false;
    i := 1;
    len := length(str);
    WHILE (i <= len) LOOP
         c := substr(str, i, 1);
         IF (inside_quote) THEN
         IF (c = '"') THEN
         inside_quote := false;
         ELSIF (c = '\') THEN
         i := i + 1; -- Skip the quote character
         END IF;
         GOTO next_char;
         END IF;
         IF (c = '"') THEN
         inside_quote := true;
         GOTO next_char;
         END IF;
         IF (instr(chrs, c) >= 1) THEN
         RETURN i;
         END IF;
         <<next_char>>
         i := i + 1;
    END LOOP;
    RETURN 0;
    END;
    BEGIN
    addr_list := ltrim(addr_list);
    i := lookup_unquoted_char(addr_list, ',;');
    IF (i >= 1) THEN
    addr := substr(addr_list, 1, i - 1);
    addr_list := substr(addr_list, i + 1);
    ELSE
    addr := addr_list;
    addr_list := '';
    END IF;
    i := lookup_unquoted_char(addr, '<');
    IF (i >= 1) THEN
    addr := substr(addr, i + 1);
    i := instr(addr, '>');
    IF (i >= 1) THEN
         addr := substr(addr, 1, i - 1);
    END IF;
    END IF;
    RETURN addr;
    END;
    -- Write a MIME header
    PROCEDURE write_mime_header(conn IN OUT NOCOPY utl_smtp.connection,
                   name IN VARCHAR2,
                   value IN VARCHAR2) IS
    BEGIN
    utl_smtp.write_data(conn, name || ': ' || value || utl_tcp.CRLF);
    END;
    -- Mark a message-part boundary. Set <last> to TRUE for the last boundary.
    PROCEDURE write_boundary(conn IN OUT NOCOPY utl_smtp.connection,
                   last IN BOOLEAN DEFAULT FALSE) AS
    BEGIN
    IF (last) THEN
    utl_smtp.write_data(conn, LAST_BOUNDARY);
    ELSE
    utl_smtp.write_data(conn, FIRST_BOUNDARY);
    END IF;
    END;
    PROCEDURE mail(sender IN VARCHAR2,
              recipients IN VARCHAR2,
              subject IN VARCHAR2,
              message IN VARCHAR2) IS
    conn utl_smtp.connection;
    BEGIN
    conn := begin_mail(sender, recipients, subject);
    write_text(conn, message);
    end_mail(conn);
    END;
    FUNCTION begin_mail(sender IN VARCHAR2,
              recipients IN VARCHAR2,
              subject IN VARCHAR2,
              mime_type IN VARCHAR2 DEFAULT 'text/plain',
              priority IN PLS_INTEGER DEFAULT NULL)
              RETURN utl_smtp.connection IS
    conn utl_smtp.connection;
    BEGIN
    conn := begin_session;
    begin_mail_in_session(conn, sender, recipients, subject, mime_type,
    priority);
    RETURN conn;
    END;
    PROCEDURE write_text(conn IN OUT NOCOPY utl_smtp.connection,
              message IN VARCHAR2) IS
    BEGIN
    utl_smtp.write_data(conn, message);
    END;
    PROCEDURE write_mb_text(conn IN OUT NOCOPY utl_smtp.connection,
                   message IN VARCHAR2) IS
    BEGIN
    utl_smtp.write_raw_data(conn, utl_raw.cast_to_raw(message));
    END;
    PROCEDURE write_raw(conn IN OUT NOCOPY utl_smtp.connection,
              message IN RAW) IS
    BEGIN
    utl_smtp.write_raw_data(conn, message);
    END;
    PROCEDURE attach_text(conn IN OUT NOCOPY utl_smtp.connection,
                   data IN VARCHAR2,
                   mime_type IN VARCHAR2 DEFAULT 'text/plain',
                   inline IN BOOLEAN DEFAULT TRUE,
                   filename IN VARCHAR2 DEFAULT NULL,
              last IN BOOLEAN DEFAULT FALSE) IS
    BEGIN
    begin_attachment(conn, mime_type, inline, filename);
    write_text(conn, data);
    end_attachment(conn, last);
    END;
    PROCEDURE attach_base64(conn IN OUT NOCOPY utl_smtp.connection,
                   data IN RAW,
                   mime_type IN VARCHAR2 DEFAULT 'application/octet',
                   inline IN BOOLEAN DEFAULT TRUE,
                   filename IN VARCHAR2 DEFAULT NULL,
                   last IN BOOLEAN DEFAULT FALSE) IS
    i PLS_INTEGER;
    len PLS_INTEGER;
    BEGIN
    begin_attachment(conn, mime_type, inline, filename, 'base64');
    -- Split the Base64-encoded attachment into multiple lines
    i := 1;
    len := utl_raw.length(data);
    WHILE (i < len) LOOP
    IF (i + MAX_BASE64_LINE_WIDTH < len) THEN
         -- After upgrade to Oracle 9i, replace demo_base64.encode with the
         -- native utl_encode.base64_encode for better performance:
         -- utl_smtp.write_raw_data(conn,
    -- utl_encode.base64_encode(utl_raw.substr(data, i,
         -- MAX_BASE64_LINE_WIDTH)));
         utl_smtp.write_raw_data(conn,
    utl_encode.base64_encode(utl_raw.substr(data, i,
         MAX_BASE64_LINE_WIDTH)));
    ELSE
         -- After upgrade to Oracle 9i, replace demo_base64.encode with the
         -- native utl_encode.base64_encode for better performance:
         -- utl_smtp.write_raw_data(conn,
         -- utl_encode.base64_encode(utl_raw.substr(data, i)));
         utl_smtp.write_raw_data(conn,
         utl_encode.base64_encode(utl_raw.substr(data, i)));
    END IF;
    utl_smtp.write_data(conn, utl_tcp.CRLF);
    i := i + MAX_BASE64_LINE_WIDTH;
    END LOOP;
    end_attachment(conn, last);
    END;
    PROCEDURE begin_attachment(conn IN OUT NOCOPY utl_smtp.connection,
                   mime_type IN VARCHAR2 DEFAULT 'text/plain',
                   inline IN BOOLEAN DEFAULT TRUE,
                   filename IN VARCHAR2 DEFAULT NULL,
                   transfer_enc IN VARCHAR2 DEFAULT NULL) IS
    BEGIN
    write_boundary(conn);
    write_mime_header(conn, 'Content-Type', mime_type);
    IF (filename IS NOT NULL) THEN
    IF (inline) THEN
         write_mime_header(conn, 'Content-Disposition',
         'inline; filename="'||filename||'"');
    ELSE
         write_mime_header(conn, 'Content-Disposition',
         'attachment; filename="'||filename||'"');
    END IF;
    END IF;
    IF (transfer_enc IS NOT NULL) THEN
    write_mime_header(conn, 'Content-Transfer-Encoding', transfer_enc);
    END IF;
    utl_smtp.write_data(conn, utl_tcp.CRLF);
    END;
    PROCEDURE end_attachment(conn IN OUT NOCOPY utl_smtp.connection,
                   last IN BOOLEAN DEFAULT FALSE) IS
    BEGIN
    utl_smtp.write_data(conn, utl_tcp.CRLF);
    IF (last) THEN
    write_boundary(conn, last);
    END IF;
    END;
    PROCEDURE end_mail(conn IN OUT NOCOPY utl_smtp.connection) IS
    BEGIN
    end_mail_in_session(conn);
    end_session(conn);
    END;
    FUNCTION begin_session RETURN utl_smtp.connection IS
    conn utl_smtp.connection;
    BEGIN
    -- open SMTP connection
    conn := utl_smtp.open_connection(smtp_host, smtp_port);
    utl_smtp.helo(conn, smtp_domain);
    RETURN conn;
    END;
    PROCEDURE begin_mail_in_session(conn IN OUT NOCOPY utl_smtp.connection,
                        sender IN VARCHAR2,
                        recipients IN VARCHAR2,
                        subject IN VARCHAR2,
                        mime_type IN VARCHAR2 DEFAULT 'text/plain',
                        priority IN PLS_INTEGER DEFAULT NULL) IS
    my_recipients VARCHAR2(32767) := recipients;
    my_sender VARCHAR2(32767) := sender;
    BEGIN
    -- Specify sender's address (our server allows bogus address
    -- as long as it is a full email address ([email protected]).
    utl_smtp.mail(conn, get_address(my_sender));
    -- Specify recipient(s) of the email.
    WHILE (my_recipients IS NOT NULL) LOOP
    utl_smtp.rcpt(conn, get_address(my_recipients));
    END LOOP;
    -- Start body of email
    utl_smtp.open_data(conn);
    -- Set "From" MIME header
    write_mime_header(conn, 'From', sender);
    -- Set "To" MIME header
    write_mime_header(conn, 'To', recipients);
    -- Set "Subject" MIME header
    write_mime_header(conn, 'Subject', subject);
    -- Set "Content-Type" MIME header
    write_mime_header(conn, 'Content-Type', mime_type);
    -- Set "X-Mailer" MIME header
    write_mime_header(conn, 'X-Mailer', MAILER_ID);
    -- Set priority:
    -- High Normal Low
    -- 1 2 3 4 5
    IF (priority IS NOT NULL) THEN
    write_mime_header(conn, 'X-Priority', priority);
    END IF;
    -- Send an empty line to denotes end of MIME headers and
    -- beginning of message body.
    utl_smtp.write_data(conn, utl_tcp.CRLF);
    IF (mime_type LIKE 'multipart/mixed%') THEN
    write_text(conn, 'This is a multi-part message in MIME format.' ||
         utl_tcp.crlf);
    END IF;
    END;
    PROCEDURE end_mail_in_session(conn IN OUT NOCOPY utl_smtp.connection) IS
    BEGIN
    utl_smtp.close_data(conn);
    END;
    PROCEDURE end_session(conn IN OUT NOCOPY utl_smtp.connection) IS
    BEGIN
    utl_smtp.quit(conn);
    END;
    END;
    PROMPT     **********************************************************
    PROMPT     CREAZIONE PROCEDURA P_SPEDMAILSERVATTA
    PROMPT     **********************************************************
    create or replace procedure P_SPEDMAILSERVATTA( VC_DESCDENOAZIE IN VARCHAR2,
                                  VC_DESCINDIEMAI IN VARCHAR2,
                                  VC_NUMEBOLL     IN VARCHAR2,
                                  VC_PATHFILE     IN VARCHAR2,
                                  VC_NOMEFILE     IN VARCHAR2,
                                  VC_DESCINDIEMAIMITT IN VARCHAR2)
    IS
    conn utl_smtp.connection;
    req utl_http.req;
    resp utl_http.resp;
    data RAW(200);
    BEGIN
    conn := demo_mail.begin_mail(
    sender => 'SIAG srl <'|| VC_DESCINDIEMAIMITT ||'>',
    recipients => ''|| VC_DESCDENOAZIE ||' '||'<'|| VC_DESCINDIEMAI ||'>'||'',
    subject => 'Invio Bollettino n.'|| VC_NUMEBOLL ||'',
    mime_type => demo_mail.MULTIPART_MIME_TYPE);
    demo_mail.attach_text(
    conn => conn,
    data => 'Spett.le <b>'|| VC_DESCDENOAZIE ||'</b> <br> in allegato Le invio il Bollettino n. '|| VC_NUMEBOLL ||'.<br> <br> Distinti Saluti <br><br> <hr align="left" width="20%"> ',
    mime_type => 'text/html');
    demo_mail.begin_attachment(
    conn => conn,
    mime_type => 'application/pdf',
    inline => TRUE,
    filename => ''|| VC_NOMEFILE ||'',
    transfer_enc => 'base64');
    -- In writing Base-64 encoded text following the MIME format below,
    -- the MIME format requires that a long piece of data must be splitted
    -- into multiple lines and each line of encoded data cannot exceed
    -- 80 characters, including the new-line characters. Also, when
    -- splitting the original data into pieces, the length of each chunk
    -- of data before encoding must be a multiple of 3, except for the
    -- last chunk. The constant demo_mail.MAX_BASE64_LINE_WIDTH
    -- (76 / 4 * 3 = 57) is the maximum length (in bytes) of each chunk
    -- of data before encoding.
    req := utl_http.begin_request('http://localhost/'|| VC_PATHFILE ||'/'|| VC_NOMEFILE ||'');
    resp := utl_http.get_response(req);
    BEGIN
    LOOP
    utl_http.read_raw(resp, data, demo_mail.MAX_BASE64_LINE_WIDTH);
    demo_mail.write_raw(
    conn => conn,
    message => utl_encode.base64_encode(data));
    END LOOP;
    EXCEPTION
    WHEN utl_http.end_of_body THEN
    utl_http.end_response(resp);
    END;
    demo_mail.end_attachment( conn => conn );
    demo_mail.end_mail( conn => conn );
    END;
    Message was edited by:
    mosquito70
    Message was edited by:
    mosquito70

    Hola, I've this problem when I use the Oracle Package called "demo_mail",
    that I have download from this forum en september.
    The code of the Package, I post bottom, now I
    write the records of the Package,
    that I believe is the core of the problem:
    demo_mail.begin_attachment( conn => conn,
    mime_type => 'application/pdf',
    inline => TRUE, filename => ''|| VC_NOMEFILE ||'',
    transfer_enc => 'base64');
    The mime_type is correct?
    Why when I open the attachment of the mail, it say me that file type
    is not correct or the file has been damneged? I need help!
    Thank's
    The steps that I've done:
    1. PACKAGE demo_mail
    2. PACKAGE BODY demo_mail
    3. procedure P_SPEDMAILSERVATTA (that call package)
    I cannot post the code :((

  • Can the problems with the Cirrus server cause this

    Hello,
    We are have been developing an application using the Cirrus server for two months now and today we are having difficulties with the Netconnection.call method which we use to call the OnRelay method on the other peer. When a peer invokes the call method on his netconnection the OnRelay on the peer is called some of the time (so it is really unreliable).
    We are curious whether this could be related to the recent problems with the Cirrus server? If not, what could be a reason the calls are working only some of the time?
    regards,
    Kevin

    while the problems with our hosting provider are not yet resolved, the cluster should be operating nominally. that should include the proper and relatively reliable functioning of the relay/onRelay function.
    note that relay/onRelay is rate limited to about 1 relay every 2 seconds (approximated with a sliding window and about 10 relays every 20 seconds). this rate limit is in place because the relay/onRelay function is expensive to provide and a developer was abusing it. the limit is implemented by dropping relay requests for a time if the rate exceeds the limit point. the limit is per sender NetConnection.

  • Problem with processes that just won't die...

    Hi,
    first off, hullo everybody
    I'm new to Arch Linux, but I do already like it very much. I have just installed it on my workstation and it works fine, except for the following problem.
    My home directory here is mounted via NFS from a central server. My username is malte (we're using YP/NIS for central authentication) and my home dir is /WW/home/malte/
    The network file system that is mounted at boot time is /WW
    malte@bombadil $ grep nfs /etc/fstab
    quarterback:/WW    /WW           nfs       defaults               0      0
    Everything is setup at boot time automatically and all works fine so far. However, when I reboot my machine using sudo reboot, or even when cleanly logging out and using the Shutdown/Reboot button in GDM, what happens is that Arch tries to unmount the net file systems (that is, /WW in this case), but fails and outputs
    /WW: device is busy
    (or something to that effect); so it gives up, and goes on shutting down all the other services, like the network etc. At the very end, when "Unmounting all filesystems", it then again tries to unmount the net file system, which of course won't work since the network is already shut down. It tries for about a minute or so before timing out, giving up and just rebooting
    This of course is quite annoying, as I have to wait more than a minute each time I want to reboot (or I would have to press the reset button on the computer, which I really don't want to).
    So why doesn't Arch succeed in unmounting the net file system when it should? Using lsof, I have traced down the problem further:
    When I do not login as user in GDM after booting up the system, but immediately reboot again after GDM has just been started, there is no problem: /WW is unmounted properly, and my system reboots flawlessly.
    The problem is when I log in to my WM as user. Even if I log out cleanly to GDM again, there are two processes belonging to user malte that go on living and that access to /WW/home/malte, and I suppose that is why unmounting fails at reboot time, saying the device is busy.
    I have found out that (and which these processes are) by closely observing the output of watch 'lsof | grep WW' run as root on vc/1, just after I log out from my WM as user:
    root@bombadil $ lsof | grep WW # executed closely after logging out as user malte
    menu-cach 3410  malte  cwd       DIR               0,16     1536    8785908 /WW/home/malte (quarterback:/WW)
    gam_serve 5391  malte  cwd       DIR               0,16     1536    8785908 /WW/home/malte (quarterback:/WW)
    More information on those two processes:
    root@bombadil $ ps aux | grep -e gam_serv -e menu-cach
    malte     3410  0.0  0.1  41540  2680 ?        S    14:46   0:00 /usr/bin/menu-cached
    malte     5391  0.0  0.0  17444  1476 ?        S    15:38   0:00 /usr/lib/gamin/gam_server
    root      5473  0.0  0.0   9324   740 tty1     R+   15:38   0:00 grep -e gam-serv -e menu-cach
    So! In short, even after logging out, menu-cached and gam_server keep on living, and access to /WW/home/malte, and that is why when I try to reboot, Arch does not succeed in unmounting /WW, and that is why it tries to unmount it again at a later time, after networking has already been shut down, and that is why it waits for a time-out for about a minute at the end of the reboot procedure.
    In fact, gam_server only keeps on living for about 20 seconds after I logged out, then it is terminated. As for menu-cached, it goes on and on living, at least for 5 minutes, which is when I got tired of watching the output of watch 'lsof | grep WW' ;-)
    Any ideas how this could be remedied? Ideally, I'd like to be able to reboot using sudo reboot rather than by logging out and using GDM to reboot, but I guess that then there will be even more processes alive and accessing the NFS file system when already Arch tries to unmount it.
    Oh yes, maybe this is of some interest also:
    malte@bombadil $ grep DAEMONS /etc/rc.conf
    # DAEMONS
    DAEMONS=(syslog-ng network portmap nfslock @netfs ypbind sshd crond)
    Please help
    Cheers,
    Malte
    Last edited by einheitlix (2009-03-31 14:20:35)

    I have the same problem.  menu-caches doesn't die after user logs out of the session (don't have the gamin issue though).  I too am running LXDE.  When a different user logs in via gdm you'll still see the menu-cached processes for other users and I end up having to kill them as root.  I do believe this is a bug with either menu-caches and/or LXDE (or perhaps, more specifically, its session manager).  I've looked high and low through the system to figure out where menu-cached is invoked from and for any sort of associated configuration file to no avail.  I'm left with the conclusion that the invocation of menu-cached is hard-coded into start-lxde. 
    As a ugly-hack workaround you might try making a shell script like the following in /etc/gdm/PostSession/ directory:
    #!/bin/sh
    killall menu-cached
    This of course is only applicable for those running gdm as their display manager.  Also don't forget to make it executable.
    I would imagine that menu-cached not closing on user logout is very much a bug.  Or perhaps, more precisely, something that hadn't gotten put in yet.  Afterall, LXDE is still a relatively new desktop.  A good one at that so far, if you don't mind some of the missing polish that its dev haven't had a chance to add yet.
    If someone else knows a more elegant solution than that please let me, and the other LXDE users, know.
    Last edited by PingFloyd (2009-04-04 02:08:29)

  • How to fix problems with apps that need access to Apple servers?

    I have problems with Apple apps that connects to Apple servers (App Store, iTunes Store, Apple Support pages on Safari).
    They are very slow or even not responding like iTunes Store with blank pages.
    Please help.

    There have been other threads on this and it seems that some members have reported that resetting your Macs PRAM has fixed it for them.
    Reset your computer’s PRAM: http://support.apple.com/kb/PH14222

Maybe you are looking for