JSDK SE 1.4.2_03 Bugs?!

I use SE SDK 1.4.2_03
What wrong with:
JFrame frame = new JFrame("HelloWorldSwing");
I get this error:
HelloWorldSwing.java:5: cannot resolve symbol
symbol : constructor JFrame (java.lang.String)
location: class JFrame
JFrame frame = new JFrame("HelloWorldSwing");
^
1 error
I can still use setTitle("HelloWorldSwing"); but there is another problem ...
somehow the Panel doesnt shows up
Original Source Code(from the Swing Tutorial):
import javax.swing.*;
public class HelloWorldSwing {
public static void main(String[] args) {
JFrame frame = new JFrame("HelloWorldSwing");
final JLabel label = new JLabel("Hello World");
frame.getContentPane().add(label);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.pack();
frame.setVisible(true);
}

There's no JPanel anywhere in any of the code you posted, so I am not at all surprised that no JPanel shows up in your GUI. Whatever your problem is, it certainly isn't a bug in the SDK.

Similar Messages

  • Java 1.4.2_03 display bug -- anyone else seen this?

    Hi All,
    I've noticed that my application, which worked fine under 1.3.1 and 1.4.1 no longer works under the latest and greatest (?) J2SE, 1.4.2.
    In short, the application consists of a bunch of JApplets stored as cards in a CardLayout, which is then placed in a JFrame. When the user selects a particular JApplet, the card containing the JApplet is displayed in the JFrame.
    Under 1.4.2, the application window shows up, and I'm able to access all the JMenu entities, but the JFrame remains blank!
    Has anyone else happened to run into this behavior?
    Thanks,
    - Fromage

    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.text.SimpleDateFormat;
    public class Test extends JFrame implements ActionListener {
      CardLayout cl = new CardLayout();
      JPanel cardPanel = new JPanel(cl);
      public Test() {
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        Container content = getContentPane();
        JPanel buttonPanel = new JPanel();
        content.add(cardPanel, BorderLayout.CENTER);
        content.add(buttonPanel, BorderLayout.SOUTH);
        for (int i=1; i<10; i++) {
          JApplet applet = new TestApplet2("Applet-" + i);
          String name = "A-"+i;
          cardPanel.add(name,applet);
          applet.init();
          applet.start();
          JButton jb = new JButton(name);
          jb.setBorder(BorderFactory.createRaisedBevelBorder());
          buttonPanel.add(jb);
          jb.addActionListener(this);
        content.add(new JLabel("NORTH", JLabel.CENTER), BorderLayout.NORTH);
        setSize(400, 400);
        setVisible(true);
      public void actionPerformed(ActionEvent ae) {
        cl.show(cardPanel, ((JButton)ae.getSource()).getText());
      public static void main(String[] args) { new Test(); }
    class TestApplet2 extends JApplet implements ActionListener {
      JLabel time = new JLabel("No Time"), nameLabel;
      SimpleDateFormat sdf = new SimpleDateFormat("hh:MM:ss a");
      public TestApplet2(String name) { nameLabel = new JLabel(name); }
      public void init() {
        getContentPane().setLayout(new FlowLayout());
        JLabel version = new JLabel(System.getProperty("java.version"));
        version.setBorder(BorderFactory.createTitledBorder("Version:"));
        getContentPane().add(version);
        time.setBorder(BorderFactory.createTitledBorder("Time:"));
        getContentPane().add(time);
        getContentPane().add(nameLabel);
        Timer t = new Timer(1000, this);
        t.setRepeats(true);
        t.start();
      public void actionPerformed(ActionEvent ae) {
        time.setText(sdf.format(new java.util.Date()));
    }

  • Touchgraph link browser right click won't work; jre 1.4.2_03 linux

    touchgraph link browser right click won't work; jre 1.4.2
    Wanted to mention that the touchgraph link browser(java client) client starts correctly in Redhat 9, but i found one problem when trying to edit links. The problem being that I can't open the small popup menu when i right click in linux RedHat 9. left clicking while dragging on a selected link (in edit mode) lets you create a new link both in microsoft windows 95a and in Redhat 9. When i right click in win95a, a small menu appears that allows me to edit a link, but this menu doesn't appear after right clicking a link in edit mode in redhat 9 (which does work with TG link browser in win95).
    I tried using a 2 button mouse with 3 button emulation. I also tried to use a 3 button logitech trackball which works with the old logitech c7 setting in Redhat. I also tried to operate the mouse with it's three buttons using the number keypad in linux, which works in other applications under linux. The same problem still happens in trying all of these methods.
    I was told that unix and windows use different "select," "extend," and "menu" buttons(in relation to the mouse).
    Maybe, microsoft windows is using a different method of interpreting the right mouse button than redhat linux 9. if so, maybe there is a way to do this in linux (really, i have no idea how this could be done, but am open to try).
    If there is a solution, i would appreciate knowing how to go about doing it. .
    note: I am using Sun's java 1.4.2_04 in windows 95a and I am using Sun's java 1.4.2_03 in Redhat 9. Both are the most current, i just downloaded them recently.
    note: touchgraph link browser is an open source java client and applet under the GNU general Public License. I think that the source code was included with the binary. I am using touchgraph link browser v 1.20 . I downloaded from sourceforge.net
    in google i found the following:
    https://lists.xcf.berkeley.edu/lists/advanced-java/1999-September/000532.html
    note: mara, you helped me before when i was practically installing redhat 9 and i had a problem with the installation and you mentioned that it was a faulty cd-rom drive. with your help, i am enjoying in learning about linux for the past 5 months since your answer helped me install redhat 9 successfully. Thank you very much since my very first question to you.
    Answer Hello,
    I downloaded the program and, if I think of the right situation, the right-click doesn't bring a menu for me. The thing I noticed is that when I drag a new link and (with left mouse button pressed) press right button it has an effect of 'canceling' the link. That's why I think that right mouse button works correctly. The problem is why the menu does not appear.
    I can see two reasons, both causing problems not easy to solve: bug in the program or incompatibility between Windows and Linux java versions. The second one should not happen.. but it doesn't mean it's impossible. A bug in the program should be easier to find, but not by me (with not very big Java experience it'd take me several days).
    What I'd do in your place is to mail the program developers (or report a bug). It won't make things worse, but can fix things.
    Sorry that I can't help more
    Mara
    notethe second half is a post i made to all experts.com

    http://www.realvnc.com/pipermail/vnc-list/2001-February/020570.html
    this Url has a comment on this problem in linux. just wanted to post this. it might help.

  • Invalid initial heap size Problem with sdk1.4.2_03

    Hi,
    ich habe a troubling error with the java version 1.4.2_03.
    I use an Ant Task to start a Weblogic Server (J2EE Server). For this, I use the following Ant code :
    -----ANT CODE------------------------------------------------------------------------------------------------------------------------
    <java classname="weblogic.Server" fork="true" failonerror="true" dir="${weblogic.domain.dir}">
    <sysproperty key="bea.home" value="${bea.home.dir}"/>
    <sysproperty key="weblogic.Name" value="${weblogic.admin.server.name}"/>
    <sysproperty key="weblogic.management.username" value="${weblogic.user.name}"/>
    <sysproperty key="weblogic.management.password" value="${weblogic.user.password}"/>
    <sysproperty key="weblogic.ProductionModeEnabled" value="false"/>
    <sysproperty key="java.security.policy" value="${weblogic.home.dir}\server\lib\weblogic.policy"/>
    <sysproperty key="weblogic.security.SSL.trustedCAKeyStore" value="${weblogic.home.dir}\server\lib\cacerts"/>
         <jvmarg value="-Xms32m -Xmx200m"/>
    <classpath>
    <pathelement path="${windows.classpath.wls}"/>
    </classpath>
    </java>
    -----/ANT CODE------------------------------------------------------------------------------------------------------------------------
    This Task perfectly works with the sdk java version 1.4.1_05, but I have the following message with the sdk java version 1.4.2_03 :
    -----ERROR MESSAGE---------------------------------------------------
    Invalid initial heap size: -Xms32m -Xmx200m
    Could not create the Java virtual machine.
    -----/ERROR MESSAGE---------------------------------------------------
    The following parameter is anymore correct : <jvmarg value="-Xms32m -Xmx200m"/>
    I have tried with a lot of possibilty, 64-200, 128-200, 128-128, 256-256, 512-512, nothing works.
    I have tried without this parameter, this works fine.
    I have tried with the weblogic server without the Ant Task, and this works fine too.
    I think this is a bug in the JVM 1.4.2_03.
    What do you think about this problem ??? Do you have some solution ???
    I have also tried with another version of ant, I have the same problem. This works with JVM 1.4.1_05 and not with JVM 1.4.2_03.
    If you have an idea, please, help.
    Thanks

    If you can start a 1.4.2 JVM with all these parameters independently (i.e. not from Ant) and it works, but from Ant it doesn't work, it's more likely that the problem is somehow related to interaction between Ant and the JVM, rather than the JVM itself. So I would suggest trying some Ant forum first - I think it would also work faster than if you try to submit this bug to Sun.

  • Bad http.agent in Java properties : a bug in the HTTP user-agent string?

    Hi all,
    Me :
    I'm patching AWSTATS (web log analyzer tool) in order to recognize which Java version has
    been used to download files.
    Context of the problem :
    Each time a Java program (or applet) is downloading a file (for example .class, .png, .html)
    from a web server, a line will be added in the web server log file. If the web server is well
    configured, the user agent used to download the file will be at the end of the line in the log file.
    For Sun Java JVM, the user agent string is configured in the Java properties under "http.agent".
    Usually, the user-agent string contains the word "Java" and the virtual machine version. In most
    cases, this is just a string like "Java/1.4.2", so this is relatively easy to parse.
    Problem :
    Looking in my web server stats, and then on the web, I found that a JVM's user-agent is
    "Mozilla/4.0 (Windows XP 5.1)", which obviously does not contains the word "Java".
    Consequently, it is difficult to say that this user-agent string belongs to a JVM.
    Further look in my log files and on google shows that this http.agent string appears
    on Microsoft Internet Explorer (it seems MSIE 6.0) over Windows XP with the J2RE plugin:
    http://board.gulli.com/thread/300321
    http://forum.java.sun.com/thread.jsp?thread=531295&forum=30&message=2559523
    http://forum.java.sun.com/thread.jsp?forum=63&thread=132769&start=210&range=15&tstart=0&trange=15
    http://forum.java.sun.com/thread.jsp?forum=32&thread=480899
    http://www.goodidea.ru/setupJava/javaInstall.htm
    The J2RE plugin version does not seems to play a role as this user-agent string has
    been seen on 1.4.1_02-b06, 1.4.2_01, 1.4.2_03 and 1.4.2_04-b05.
    Further information requested :
    I would like to know:
    1) if you have reported the same problem;
    2) if there is some rules for the http.agent property;
    3) if this is a bug.
    Thank you very much, and feel free to add you opinion.
    Julien

    The web log files where the "Mozilla/4.0 (Windows XP 5.1)" user-agent appears can be displayed using the following search terms on google :
    "Mozilla/4.0 (Windows XP 5.1)" -"(Windows XP 5.1) Java"
    http://www.google.ch/search?hl=fr&ie=UTF-8&q=%22Mozilla%2F4.0+%28Windows+XP+5.1%29%22+-%22%28Windows+XP+5.1%29+Java%22&btnG=Rechercher&meta=
    Julien

  • Solaris 9 in a Sun Fire V100 Box ServerSocket Bug

    I am running Solaris 9 in a Sun Fire V100
    I am having a problem openning Sockets where programs are written in Java.
    The program is written in Java with the ServerSocket class.
    I wrote a very simple class to test.
    The port is available of course I already verified it.
    I checked with the SecurityManager to verify this is not a
    security policy but I receive a null from the System.getSecurityManager
    which means there is no securityu manager installed.
    I have many other apllications that are able to open ports and listen, but Java seams
    to be having problem in Solaris 9. I have tried 5 different versions of Java. Last version
    I tried is jsdk 1.4.2_05.
    The same thing happens with Tomcat that crashes while
    trying to open a listening Socket.
    ServerSocket server;
    try
    server = new ServerSocket(8005,1024, InetAddress.getByName("127.0.0.1"));
    System.out.println("BINDING SUCCESFUL");
    catch(Exception e)
    System.out.println(e);
    System.exit(-1);
    while(true)
    try
    Socket clientSocket = server.accept();
    ClientHandler2 t = new ClientHandler2(clientSocket);
    t.start();
    catch(IOException e)
    System.err.println( e );
    Is this a well known bug...
    Can anyone be so kind to help me up with this terrible matter
    Thank you,
    Juanpablo Lajud

    Hi,How to set my link up in solaris 10 ?
    I dont know want happend to my machine solaris v440 it suddenly disconnected from n/w and finally i came to know that is a problem with NIC card..i din't find any light's glowing back side of the machine at NIC card.
    can any one help me in this pls how can i proceed furture for getting my NIC back?
    and i have excuted few commands
    #ndd -set /dev/ce instance 0
    #ndd -set /dev/ce adv_1000fdx_cap 1
    #ndd -set /dev/ce adv_autoneg_cap 0
    I have got dladm show-dev is
    ce0 link: unknown speed: 1000 Mbps duplex: full
    ce1 link: unknown speed: 0 Mbps duplex: unknown
    I dont understand that why my link is showing still unknown ...any help..

  • Cloning bug in spec?

    I have hit on what I thought was a bug, but after looking at the spec I'm
    not sure.
    What I'm doing is cloning a persistence-capable class after is has been
    loaded from the database, but before fields that contain references to
    other persistence-capable classes have been accessed.
    The clone receives a shallow copy of the fields of the original (null at
    this point), and has its jdoStateManager set to null. After the clone
    operation is finished, the clone neither has the value of the field, or a
    jdoStateManager to later get the value of the field.
    Is this really how clone should work? The spec doesn't really address
    this situation. It only says that clones should receive "standard shallow
    copy of the fields of the cloned instance".
    My quetion is this: Is this a bug in the spec that I have to work around
    (be sure to at least access all fields that may need to be loaded from the
    database during or before clone), or is this something that JDO
    implementations should be taking care of for me?
    I have a very simple test case (three classes) that exhibits this behavior
    if it will help with diagnosis.
    I am running Kodo 2.2.5 on JSDK 1.3.1_03.
    Thanks!
    -- Chris

    Chris --
    This is more of a 'bug' in the spec. Prior to serialization, a persitent object will suck in all of its persitent fields and relations, so the entire object graph is serialized. Prior to cloning, though, nothing special is done. And of course, a clone is always transient (otherwise you'd get into situations where two objects in memory represented the same persistent state in the same PersistenceManager, which could lead to all sorts of problems).
    In the 1.0 JDO specification, supported by Kodo 2.3, there is a PersistenceManager.retrieve(Object pc) you can use to load all persistent fields into an instance prior to making it transient or cloning it. Look for a new beta of 2.3 in the next few days.

  • Floating point bug?

    Hello,
    Please, see this code:
      public static void main(String[] args)
        double[] arr=new double[]{3279.87d,-986.09d,-2293.78d};
        double d=0;
        double h=0;
        for(int i=0;i<arr.length;i++)
          double x=arr;
    System.out.println(x);
    if(x>0)
    d+=x;
    else
    h-=x;
    System.out.println("d = "+d);
    System.out.println("h = "+h);
    System.out.println("d-h= "+(d-h));
    System.out.println("d==h= "+(d==h));
    "d" and "h" must be equal.
    However, it prints:
    3279.87
    -986.09
    -2293.78
    d = 3279.87
    h = 3279.8700000000003
    d-h= -4.547473508864641E-13
    d==h= false
    Is this a bug?
    Using strictfp produces the same output.
    JDK: 1.4.2_03 (linux) and 1.5.0 (linux)

    Is this a bug? Using strictfp produces the same output.No, you just don't understand how floating point numbers work:
    What Every Computer Scientist Should Know About Floating Point Numbers
    Your own data is telling you that the difference between d and h is 1e-13, which is NOT zero. Since that's the case, how could d == h be true? Why don't you believe the evidence you have in front of you?
    Anyone who works with floating point numbers would know that you don't check equality like that. You compare the absolute value of the difference to a small error value.

  • Index with "or" clause (BUG still exists?)

    The change log for 2.3.10 mentions "Fixed a bug that caused incorrect query plans to be generated for predicates that used the "or" operator in conjunction with indexes [#15328]."
    But looks like the Bug still exists.
    I am listing the steps to-repro. Let me know if i have missed something (or if the bug needs to be fixed)
    DATA
    dbxml> openContainer test.dbxml
    dbxml> getDocuments
    2 documents found
    dbxml> print
    <node><value>a</value></node>
    <node><value>b</value></node>
    INDEX (just one string equality index on node "value")
    dbxml> listIndexes
    Index: unique-node-metadata-equality-string for node {http://www.sleepycat.com/2002/dbxml}:name
    Index: node-element-equality-string for node {}:value
    2 indexes found.
    QUERY
    setVerbose 2 2
    preload test.dbxml
    query 'let $temp := fn:compare("test", "test") = 0
    let $results := for $i in collection("test.dbxml")
    where ($temp or $i/node[value = ("a")])
    return $i
    return <out>{$temp}{$results}</out>'
    When $temp is true i expected the result set to contain both the records, but that was not the case with the index. It works well when there is no index!
    Result WITH INDEX
    dbxml> print
    <out>true<node><value>a</value></node></out>
    Result WITHOUT INDEX
    dbxml> print
    <out>true<node><value>a</value></node><node><value>b</value></node></out>

    Hi Vijay,
    This is a completely different bug, relating to predicate expressions that do not examine nodes. Please try the following patch, to see if it fixes this bug for you:
    --- dbxml-2.3.10-original/dbxml/src/dbxml/optimizer/QueryPlanGenerator.cpp     2007-04-18 10:05:24.000000000 +0100
    +++ dbxml-2.3.10/dbxml/src/dbxml/optimizer/QueryPlanGenerator.cpp     2007-08-08 11:32:10.000000000 +0100
    @@ -1566,11 +1572,12 @@
         else if(name == Or::name) {
              UnionQP *unionOp = new (&memMgr_) UnionQP(&memMgr_);
    +          result.operation = unionOp;
              for(VectorOfASTNodes::iterator i = args.begin(); i != args.end(); ++i) {
                   PathResult ret = generate(*i, ids);
                   unionOp->addArg(ret.operation);
    +               if(ret.operation == 0) result.operation = 0;
    -          result.operation = unionOp;
         // These operators use the presence of the node arguments, not their valueJohn

  • Bug report follow-up

    is there a way to follow-up on a bug report that i submitted?  i have the bug number, but would like to see if the report was understood, filled out properly and determine the status of the bug report.
    thanks,
    doug

    They comment on bugs if actions were taken. Otherwise - don't expect any feedback.

  • Solaris8 and 9 (possibly 7) /dev/poll driver bug report.

    Hello,
    I'd like to report a bug in the solaris 8 and 9 /dev/poll driver (poll(7d)).
    As i do not have a support account with sun or anything like that, there
    seems to be no other way to do that here (which is of course a very sad
    thing).
    Bug details:
    The /dev/poll device provides an ioctl-request (DP_ISPOLLED) for checking
    if a particular filedescriptor is currently in the set of monitored
    filedescriptors for that particular /dev/poll fd set (open /dev/poll fd).
    A quote from the documentation of the poll(7d) manual page taken from
    Solaris9:
    "DP_ISPOLLED ioctl allows you to query if a file descriptor is already in
    the monitored set represented by fd. The fd field of the pollfd structure
    indicates the file descriptor of interest. The DP_ISPOLLED ioctl returns 1
    if the file descriptor is in the set. The events field contains the
    currently polled events. The revents field contains 0. The ioctl returns 0
    if the file descriptor is not in the set. The pollfd structure pointed by
    pfd is not modified. The ioctl returns a -1 if the call fails."
    It says that when you query for an filedescriptor which is currently being
    monitored in the set, that it would return 1, and change the events field of
    the pollfd structure to the events it's currently monitoring that fd for.
    The revents field would be set to zero.
    However the only thing which actually happens here, is that FD_ISPOLLED
    returns 1 when the fd is in the set and 0 if not. When the fd is in the
    set, when FD_ISPOLLED returns 1, the events field remains unmodified, but
    the revents field gets changed.
    A small sample code to illustrate:
    #include <stdio.h>
    #include <unistd.h>
    #include <sys/types.h>
    #include <sys/stat.h>
    #include <fcntl.h>
    #include <sys/devpoll.h>
    main() {
    struct pollfd a;
    int dp_fd = open("/dev/poll", O_WRONLY);
    a.fd = 0; /* stdin */
    a.events = POLLIN; /* we monitor for readability, POLLIN=1 */
    a.revents = 0;
    write(dp_fd, &a, sizeof(a));
    a.fd = 0;
    a.events = 34; /* filled in with bogus number to show malfunctioning */
    a.revents = 0;
    printf("DP_ISPOLLED returns: %d\n", ioctl(dp_fd, DP_ISPOLLED, &a));
    printf("a.fd=%d, a.events=%hd, a.revents=%hd\n", a.fd, a.events,
    a.revents);
    According to the documentation of /dev/poll and namely DP_ISPOLLED this
    program is supposed to print the following:
    DP_ISPOLLED returns: 1
    a.fd=0, a.events=1, a.revents=0
    However it prints the following:
    DP_ISPOLLED returns: 1
    a.fd=0, a.events=34, a.revents=1
    You can take any number instead of '34' and it will simply remain untouched
    after the DP_ISPOLLED ioctl-request.
    I hope it's clear now that the solaris8 and solaris9 (and probably solaris7
    with /dev/poll patch too) DP_ISPOLLED implementation is broken.
    This bug is also easily illustrated by looking at the solaris8 kernel sourcecode:
    <snippet osnet_volume/usr/src/uts/common/io/devpoll.c:dpioctl()>
    case DP_ISPOLLED:
    pollfd_t pollfd;
    polldat_t *pdp;
    if (pollfd.fd < 0) {
    mutex_exit(&pcp->pc_lock);
    break;
    pdp = pcache_lookup_fd(pcp, pollfd.fd);
    if ((pdp != NULL) && (pdp->pd_fd == pollfd.fd) &&
    (pdp->pd_fp != NULL)) {
    pollfd.revents = pdp->pd_events;
    if (copyout(&pollfd, (caddr_t)arg,
    sizeof(pollfd_t))) {
    mutex_exit(&pcp->pc_lock);
    DP_REFRELE(dpep);
    return (set_errno(EFAULT));
    *rvalp = 1;
    </snippet>
    its' clearly visible that the code writes the current monitored events to
    the revents field:
    'pollfd.revents = pdp->pd_events;'
    and that it doesnt set revents to zero.
    It's funny to see that this has been like this since Solaris8 (possibly 7). That means nobody ever used DP_ISPOLLED that way or people were simply to lazy to file a bug report.
    Another funny thing related to this. is that Hewlett-Packard did seem to know about this. Since HP-UX11i version 1.6 they also support /dev/poll. From their manual page i ll quote some sentences from their WARNING session:
    "The ioctl(DP_ISPOLLED) system call also returns its result in the revents member of the pollfd structure, in order to be compatible with the implementation of the /dev/poll driver by some other vendors."
    Hopefully this will get fixed.
    I also like to reexpress my very negative feelings towards the fact that you're not able to file bug reports when you do not have a support contract. Ridiculous.
    Thanks,
    bighawk

    Have I mentioned how much i love my playbook now Great job on os 2.0

  • [bdb bug]repeatly open and close db may cause memory leak

    my test code is very simple :
    char *filename = "xxx.db";
    char *dbname = "xxx";
    for( ; ;)
    DB *dbp;
    DB_TXN *txnp;
    db_create(&dbp,dbenvp, 0);
    dbenvp->txn_begin(dbenvp, NULL, &txnp, 0);
    ret = dbp->open(dbp, txnp, filename, dbname, DB_BTREE, DB_CREATE, 0);
    if(ret != 0)
    printf("failed to open db:%s\n",db_strerror(ret));
    return 0;
    txnp->commit(txnp, 0);
    dbp->close(dbp, DB_NOSYNC);
    I try to run my test program for a long time opening and closing db repeatly, then use the PS command and find the RSS is increasing slowly:
    ps -va
    PID TTY STAT TIME MAJFL TRS DRS RSS %MEM COMMAND
    1986 pts/0 S 0:00 466 588 4999 980 0.3 -bash
    2615 pts/0 R 0:01 588 2 5141 2500 0.9 ./test
    after a few minutes:
    ps -va
    PID TTY STAT TIME MAJFL TRS DRS RSS %MEM COMMAND
    1986 pts/0 S 0:00 473 588 4999 976 0.3 -bash
    2615 pts/0 R 30:02 689 2 156561 117892 46.2 ./test
    I had read bdb's source code before, so i tried to debug it for about a week and found something like a bug:
    If open a db with both filename and dbname, bdb will open a db handle for master db and a db handle for subdb,
    both of the two handle will get an fileid by a internal api called __dbreg_get_id, however, just the subdb's id will be
    return to bdb's log region by calling __dbreg_pop_id. It leads to a id leak if I tried to open and close the db
    repeatly, as a result, __dbreg_add_dbentry will call realloc repeatly to enlarge the dbentry area, this seens to be
    the reason for RSS increasing.
    Is it not a BUG?
    sorry for my pool english :)
    Edited by: user9222236 on 2010-2-25 下午10:38

    I have tested my program using Oracle Berkeley DB release 4.8.26 and 4.7.25 in redhat 9.0 (Kernel 2.4.20-8smp on an i686) and AIX Version 5.
    The problem is easy to be reproduced by calling the open method of db handle with both filename and dbname being specified and calling the close method.
    My program is very simple:
    #include <stdlib.h>
    #include <stdio.h>
    #include <sys/time.h>
    #include "db.h"
    int main(int argc, char * argv[])
    int ret, count;
    DB_ENV *dbenvp;
    char * filename = "test.dbf";
    char * dbname = "test";
    db_env_create(&dbenvp, 0);
    dbenvp->open(dbenvp, "/home/bdb/code/test/env",DB_CREATE|DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_TXN|DB_INIT_MPOOL, 0);
    for(count = 0 ; count < 10000000 ; count++)
    DB *dbp;
    DB_TXN *txnp;
    db_create(&dbp,dbenvp, 0);
    dbenvp->txn_begin(dbenvp, NULL, &txnp, 0);
    ret = dbp->open(dbp, txnp, filename, dbname, DB_BTREE, DB_CREATE, 0);
    if(ret != 0)
    printf("failed to open db:%s\n",db_strerror(ret));
    return 0;
    txnp->commit(txnp, 0);
    dbp->close(dbp, DB_NOSYNC);
    dbenvp->close(dbenvp, 0);
    return 0;
    DB_CONFIG is like below:
    set_cachesize 0 20000 0
    set_flags db_auto_commit
    set_flags db_txn_nosync
    set_flags db_log_inmemory
    set_lk_detect db_lock_minlocks
    Edited by: user9222236 on 2010-2-28 下午5:42
    Edited by: user9222236 on 2010-2-28 下午5:45

  • Multiple return values (Bug-ID 4222792)

    I had exactly the same request for the same 3 reasons: strong type safety and code correctness verification at compile-time, code readability and ease of mantenance, performance.
    Here is what Sun replied to me:
    Autoboxing and varargs are provided as part of
    JSRs 14 and 201
    http://jcp.org/en/jsr/detail?id=14
    http://jcp.org/en/jsr/detail?id=201
    See also:
    http://forum.java.sun.com/forum.jsp?forum=316
    http://developer.java.sun.com/developer/earlyAccess/adding_generics/index.html
    Multiple return values is covered by Bug-ID 4222792
    Typically this is done by returning an array.
    http://developer.java.sun.com/developer/bugParade/bugs/4222792.html
    That's exactly the problem: we dynamically create instances of array objects that would better fit well within the operand stack without stressing the garbage collector with temporary Array object instances (and with their backing store: 2 separate allocations that need to be recycled when it is clearly a pollution that the operand stack would clean up more efficiently)
    If you would like to engage in a discussion with the Java Language developers, the Generics forum would be a better place:
    http://forum.java.sun.com/forum.jsp?forum=316
    I know that (my report was already refering to the JSR for language extension) Generics is not what I was refering to (even if a generic could handle multiple return values, it would still be an allocated Object
    instance to pack them, i.e. just less convenient than using a static class for type safety.
    The most common case of multiple return values involve values that have known static datatypes and that should be checked with strong typesafety.
    The simple case that involves returning two ints then will require at least two object instances and will not solve the garbage collection overhead.
    Using a array of variable objects is exactly similar, except that it requires two instances for the components and one instance for the generic array container. Using extra method parameters with Integer, Byte, ... boxing objects is more efficient, but for now the only practical solution (which causes the least pollution in the VM allocator and garbage collector) is to use a custom class to store the return values in a single instance.
    This is not natural, and needlessly complexifies many interfaces.
    So to avoid this pollution, some solutions are used such as packing two ints into a long and returning a long, depacking the long after return (not quite clean but still much faster at run-time for methods that need to be used with high frequencies within the application. In some case, the only way to cut down the overhead is to inline methods within the caller code, and this does not help code maintenance by splitting the implementation into small methods (something that C++ can do very easily, both because it supports native types parameters by reference, and because it also supports inline methods).
    Finally, suppose we don't want to use tricky code, difficult to maintain, then we'll have to use boxing Object types to allow passing arguments by reference. Shamely boxed native types cannot be allocated on the operand stack as local variables, so we need to instanciate these local variables before call, and we loose the capacity to track the cases where these local variables are not really initialized by an effective call to the method that will assign them. This does not help debugging, and is against the concept of a strongly typed language like Java should be:
    Java makes lots of efforts to track uninitialized variables, but has no way to determine if an already instanciated Object instance refered in a local variable has effectively received an effective assignment because only the instanciation is kept. A typical code will then need to be written like this:
    Integer a = null;
    Integer b = null;
    if (some condition) {
    //call.method(a, b, 0, 1, "dummy input arg");
    // the method is supposed to have assigned a value to a and b,
    // but can't if a and b have not been instanciated, so we perform:
    call.method(a = new Integer(), b = new Integer(), 0, 1, "dummy input
    arg");
    // we must suppose that the method has modified (not initialized!)
    the value
    // of a and b instances.
    now.use(a.value(), b.value())
    // are we sure here that a and b have received a value????
    // the code may be detected at run-time (a null exception)
    // or completely undetected (the method() above was called but it
    // forgot to assign a value to its referenced objects a and b, in which
    // case we are calling in fact: now.use(0, 0); with the default values
    // or a and b, assigned when they were instanciated)
    Very tricky... Hard to debug. It would be much simpler if we just used:
    int a;
    int b;
    if (some condition) {
    (a, b) = call.method(0, 1, "dummy input arg");
    now.use(a, b);
    The compiler would immediately detect the case where a and b are in fact not always initialized (possible use bere initialization), and the first invoked call.method() would not have to check if its arguments are not null, it would not compile if it forgets to return two values in some code path...
    There's no need to provide extra boxing objects in the source as well as at run-time, and there's no stress added to the VM allocator or garbage collector simply because return values are only allocated on the perand stack by the caller, directly instanciated within the callee which MUST (checked at compile-time) create such instances by using the return statement to instanciate them, and the caller now just needs to use directly the variables which were referenced before call (here a and b). Clean and mean. And it allows strong typechecking as well (so this is a real help for programmers.
    Note that the signature of the method() above is:
    class call {
    (int, int) method(int, int, String) { ... }
    id est:
    class "call", member name "method", member type "(IILjava.lang.string;)II"
    This last signature means that the method can only be called by returning the value into a pair of variables of type int, or using the return value as a pair of actual arguments for another method call such as:
    call.method(call.method("dummy input arg"), "other dummy input arg")
    This is strongly typed and convenient to write and debug and very efficient at run-time...

    Can anyone give me some real-world examples where
    multiple return values aren't better captured in a
    class that logically groups those values? I can of
    course give hundreds of examples for why it's better
    to capture method arguments as multiple values instead
    of as one "logical object", but whenever I've hankered
    for multiple return values, I end up rethinking my
    strategy and rewriting my code to be better Object
    Oriented.I'd personally say you're usually right. There's almost always a O-O way of avoiding the situation.
    Sometimes though, you really do just want to return "two ints" from a function. There's no logical object you can think of to put them in. So you end up polluting the namespace:
    public class MyUsefulClass {
    public TwoInts calculateSomething(int a, int b, int c) {
    public static class TwoInts {
        //now, do I use two public int fields here, making it
        //in essence a struct?
       //or do I make my two ints private & final, which
       //requires a constructor & two getters?
      //and while I'm at it, is it worth implementing
      //equals(), how about hashCode()? clone()?
      //readResolve() ?
    }The answer to most of the questions for something as simple as "TwoInts" is usually "no: its not worth implementing those methods", but I still have to think about them.
    More to the point, the TwoInts class looks so ugly polluting the top level namespace like that, MyUsefulClass.TwoInts is public, that I don't think I've ever actually created that class. I always find some way to avoid it, even if the workaround is just as ugly.
    For myself, I'd like to see some simple pass-by-value "Tuple" type. My fear is it'd be abused as a way for lazy programmers to avoid creating objects when they should have a logical type for readability & maintainability.
    Anyone who has maintained code where someone has passed in all their arguments as (mutable!) Maps, Collections and/or Arrays and "returned" values by mutating those structures knows what a nightmare it can be. Which I suppose is an argument that cuts both ways: on the one hand you can say: "why add Tuples which would be another easy thing to abuse", on the other: "why not add Tuples, given Arrays and the Collections framework already allow bad programmers to produce unmainable mush. One more feature isn't going to make a difference either way".
    Ho hum.

  • Extensions like Ghostery, WOT or AdBlock stop working after two or three times. Restarting the webpage in a new tab the extensions will work again for several times and then stop again. Has anybody an explanation or a workaround for this bug in Safari 5?

    Extensions like Ghostery, WOT or AdBlock stop working after two or three times. Restarting the webpage in a new tab the extensions will work again for several times and then stop again. Has anybody an explanation or a workaround for this bug in Safari 5?

    Remove the extensions, redownload Safari, reload the extensions.
    http://www.apple.com/safari/download/
    And if you really want a better experience, use Firefox, tons more choices and possibilities there.
    Firefox's "NoScript" will block the Trojan going around on websites. Best web security you can get.
    https://addons.mozilla.org/en-US/firefox/addon/noscript/
    Ghostery, Ad Block Plus and thousands of add-ons more have originated on Firefox.

  • Bug? My events on the iPad iCal app aren't shown in the year view if they are more than two years in the future.

    My events on the iPad iCal app aren't shown in the year view if they are more than two years in the future even though I can see them on the month, week and day view. Any suggestions on how to fix it? I've tried it all. I called the apple support and they checked on their iPads. They all did the same and they couldn't help me. They suggested trying this way. I'd like to be able to plan a few years ahead and the year view would make thing so easy!
    Is this a bug?

    Go to the Home screen and double click the Home button. That will reveal the row of recently used apps at the bottom of the screen. Tap and hold on the app in question until it wiggles and displays a minus sign. Tap the minus sign to actually quit the app. Then tap anywhere on the screen above that bottom row to return the screen to normal. Then restart the app and see if it works normally.
    Then reboot your iPad. Press and hold the Home and Sleep buttons simultaneously ignoring the red slider until the Apple logo appears. Let go of the buttons and let the iPad restart. See if that fixes your problem.

Maybe you are looking for