Strange problem w/ DataInputStream in applet

I have an applet that uses DataInputStream to read a data located on the server. The applet works perfectly when I run it with AppletViewer. However, when I mount it on the server, it garbles the data from the data file. It does seem to be finding the datafile, but it is no longer reading it correctly. If anyone can tell me why this might be, I'd be very grateful--I'm stumped.
Here's the relevant code:
public void getChinese(int offset){//to read font file                       
System.out.println ("Beginning try in gbbutton...");
try{                                                                      
URL url=new URL(dat.url, "Csf/cclib.jgb");
DataInputStream in = new DataInputStream(url.openStream());
in.skip(offset*72);
for(int i=0; i<72; i++){                                                
byte2[i] = (in.read()+256)%256;//(byte1, 72*offset, 72);
if(i==71)System.out.println(""+byte2);
in.close();
}catch (Exception e){System.err.println("Attempted to read Csf/cclib.j24 
from gbbutton" );}
Again, I know that the data processing algorithm is correct, because it works in appletviewer. Any ideas??

Thanks for the suggestion. It turns out that the applet is accessing the correct data file (the URL is okay), but that it is reading the wrong data from it. It seems like the skip method is not always skipping the correct number of bytes, when that number is anything over 20. It says in the API that skip doesn't always skip the right number of bytes, which seems pretty stupid to me. Any way to make this work properly, other than just putting skip(1) in a for loop to get the right number of skips?

Similar Messages

  • Strange problem in applet application

    Hello Everybody,
    I hava an applet whit an image. This image has to changed by color, and text has to be added to the image. The text color is also changable. Here is where it goes wrong.
    When I change the background color of the applet, the transparant image will be colored. This is good.
    At the start text can be added.
    When you change the textcolor, the frame with the JColorChooser will get at the background of the image, like this:
    [http://schaftwagen.ncamade.nl/schaftwagenfout.png|http://schaftwagen.ncamade.nl/schaftwagenfout.png] (image)
    When you change the text with the "opschrift" button (vertical text) the old text stays under the new text.
    When you change the background after this, everything seems to be okay.
    At an other forum I've asked this question, and some of that people didn't had this "problem". I am using Windows 7RC with the newest java version. Tested it on an Windows vista and Windows XP all with the same problem.
    The source is to big for this forum and can be found at [http://www.dreamincode.net/forums/showtopic117029.htm|http://www.dreamincode.net/forums/showtopic117029.htm]. This is the other forum, where I've asked about his issue. (I hope this link isn't against the rules to post this link to the other forum?)
    I hope someone can help me with this problem. The applet can be tested here: [http://schaftwagen.ncamade.nl/colorchooser.asp|http://schaftwagen.ncamade.nl/colorchooser.asp]
    Greats,
    C.H.F.S.
    Edited by: C.H.F.S. on Jul 28, 2009 4:01 AM

    I've just tested it on different boxes, and sometimes it does work indeed, but sometimes other problems come up. On one the background color doesn't change but the text color does it right and changing the text work also correctly in that case.
    Can anyone help me please solving this strange problem?

  • Plz Help me Out Strange Problem ...................

    Hello Every One, I m not new to java but i m facing a strange problem.
    I have wriiten a simple applet but my browser does not show that applet, while it shows applets on the internet. which shows that JVM is installed.
    But i don't know why ie does not show my applets. it throws ClassdefinitionNotFound Exception. very strange, while class is in the local same directory.
    Still for the confirmation i have given class path in code base attribute.
    But it did't work.
    Please tell me where is problem or tell me solution.
    Thanx Alot

    Niether i m using any package nor any new features.
    My Applet Code is as Under
    //TestViewer.java
    import java.applet.*;     //Package for the Applet
    import java.awt.*;          //For different AWT Components
    public final class TestViewer extends Applet//SessionViewer Class
    public void init()                                   {
         public void paint(Graphics g)
              g.drawString("Testing", 500, 500);
              g.drawString("Hello There", 0, 0);
         public void start()                         
    HTML Code is as under
    <!-- TestViewer.html -->
    <HTML>
         <HEAD>
              <TITLE>Testing Applet</TITLE>
         </HEAD>
         <BODY>
              <APPLET code="TestViewer.class" height=500 width=500>
              </APPLET>
         </BODY>
    </HTML>
    I have also given codebase tag
    as
              <APPLET code="TestViewer.class" codebase="file://path" <!--or "http://path"--> height=500 width=500>
    It is very strange for me that IE shows the applet from Internet but not from my machine
              </APPLET>

  • Strange problem with DatagramSocket and DatagramPacket.

    Hi!
    I got a strange problem with UDP sockets:
    Client (hardware device) send binary data messages, consisting of bytes and shorts fields (8 and 16 bits). But when I tried to read byte array, received from socket, I got some type anomaly. For example:
    byte[] buffer = new byte[1024];
    DatagramPacket packet = new DatagramPacket(buffer, 1024);
    socket.receive(packet);
    byte[] data = packet.getData();
    System.out.println("Received data:");
    for (int i = 0; i < packet.getLength(); i++) {
      System.out.printf("%h:", data);
    I got such thing: 34:4:fffffff1:ffffffdb:ffffffdc:20:1:1:0:2:50
    If I try to parse it using ByteArrayInputStream and DataInputStream
    ByteArrayInputStream is = new ByteArrayInputStream(packet.getData());
    DataInputStream dis = new DataInputStream(is);
    int head = dis.readByte();
    int recvinfo = dis.readByte();
    short count = (short)dis.readShort();
    System.err.printf("Decoded:\n head: %h\n recvinfo: %h\n count: %h\n",
         head, recvinfo, count);i got following:
    Decoded:
    head: 34
    recvinfo: 4
    count: fffff1db
    So I get Integer entries in byte?! array. I also got Integer even I try to read and cast it as short in short!!! variable.
    Please help!
    P.S. Sorry for my bad English.

    Rather fortunate that it auto-casts(or rather, that 0xFF is int by default, rather than attempting any type-detection as most languages do), as otherwise the brackets would have been in the wrong place. If it was still a byte after the "& 0xFF", sign extension would still occur.
    For the sake of the less bit-literate reading this thread, it should be explained that the reason for this was large bytes being interpreted as negative numbers, which translate to negative int, which in hexa become very large ints. That's about as verbose as I can be about this without writing the equivalent of a wikipedia entry about 2s complement.

  • Strange problem when tried to convert HelloWorld.class..

    Hi friends..
    i've downloaded the Java Card SDK 2.2.1, and i tried to compile HelloWorld application that shipped with its distribution..
    i found strange problem when i tried to convert HelloWorld.class into .CAP, etc.. :(
    I use Windows XP, assume that i've set the Environment Variables needed
    i've compiled the HelloWorld.java into HelloWorld.class..
    the package of of HelloWorld is : com.sun.javacard.samples.HelloWorld;
    and i use this config file :
    -out EXP JCA CAP
    -exportpath .
    -applet  0xa0:0x0:0x0:0x0:0x62:0x3:0x1:0xc:0x1:0x1 com.sun.javacard.samples.HelloWorld.HelloWorld
    com.sun.javacard.samples.HelloWorld
    0xa0:0x0:0x0:0x0:0x62:0x3:0x1:0xc:0x1 1.0and then i tried to run converter script in the Console :
    *C:\java_card_kit-2_2_1\samples>converter -config com\sun\javacard\samples\HelloWorld\HelloWorld.opt*
    *error: file com\sun\javacard\samples\HelloWorld\HelloWorld.opt could not be found*
    Usage:  converter  <options>  package_name  package_aid  major_version.minor_ve
    sion
    OR
    converter -config <filename>
                        use file for all options and parameters to converter
    Where options include:
            -classdir <the root directory of the class hierarchy>
                          set the root directory where the Converter
                          will look for classes
            -i            support the 32-bit integer type
            -exportpath  <list of directories>
                          list the root directories where the Converter
                          will look for export files
            -exportmap    use the token mapping from the pre-defined export
                          file of the package being converted. The converter
                          will look for the export file in the exportpath
            -applet <AID class_name>
                          set the applet AID and the class that defines the
                          install method for the applet
            -d <the root directory for output>
            -out  [CAP] [EXP] [JCA]
                          tell the Converter to output the CAP file,
                          and/or the JCA file, and/or the export file
            -V, -version  print the Converter version string
            -v, -verbose  enable verbose output
            -help         print out this message
            -nowarn       instruct the Converter to not report warning messages
            -mask         indicate this package is for mask, so restrictions on
                          native methods are relaxed
            -debug        enable generation of debugging information
            -nobanner     suppress all standard output messages
            -noverify     turn off verification. Verification is defaultPlease help me regarding this, because i'm new in this field..
    Thanks in advance..

    Thanks safarmer for your reply..
    i tried this :
    C:\java_card_kit-2_2_1\samples>javac -target 1.3 -source 1.1 -g -classpath .\cla
    sses;..\lib\api.jar;..\lib\installer.jar src\com\sun\javacard\samples\HelloWorld
    \*.java
    javac: invalid source release: 1.1
    Usage: javac <options> <source files>
    use -help for a list of possible options
    C:\java_card_kit-2_2_1\samples>javac -target 1.3 -source 1.2 -g -classpath .\cla
    sses;..\lib\api.jar;..\lib\installer.jar src\com\sun\javacard\samples\HelloWorld
    \*.java
    it seems that i can't specify the -source to 1.1, so i tried to use -source 1.2..
    after that, i tried to convert again, and i got this error :
    C:\java_card_kit-2_2_1\samples\src>converter -config com\sun\javacard\samples\He
    lloWorld\HelloWorld.opt
    Java Card 2.2.1 Class File Converter, Version 1.3
    Copyright 2003 Sun Microsystems, Inc. All rights reserved. Use is subject to lic
    ense terms.
    error: com.sun.javacard.samples.HelloWorld.HelloWorld: unsupported class file fo
    rmat of version 47.0.
    conversion completed with 1 errors and 0 warnings.Please help me regarding this..
    Thanks in advance..

  • A strange problem for Find Value Function

    Hi, Dear
    I have a strange problem for search Function, my SRM_SERVER is 550 and Package is SAPKIBKT11.
    SRM_PLUS is SAPKIBK011.
    When I use Find Value Function to find Cost Ctr, Such as:
    Account object values = * (it is possible), Search Result: 300 Entries. I have no find my foucs data(12000)
    But
    Account object values = 12000, Search Result: 1 Entries,(Maximum No. of Hits is 500) I can find it. It is very jocularity.....Faint.
    Please help me.
    Thanks a lot.

    This is due to security permissions.
    You can do one thing, edit C:\Jdk1.3(your java home)\jre\lib\security\java.policy and add the following line,
    permission java.net.SocketPermission "*.*.*.109:1521-" "connect,resolve"; or
    permission java.net.SocketPermission "shenpeng:1521-" "connect,resolve";
    Save the file and run the applet from the command prompt. If this is not working, copy the java.policy file to C:\jdk1.3 (your java home) and execute the applet.
    Hope this helps.
    PS:- It is not recommended to access the database from applets.

  • I am facing a strange problem on new iphone 5 that I bought last week. The maps app and the places in photo gallery shows the pin and my location, however there is no information of locations. Tried to close the apps, phone restart, reset etc. Please help

    I am facing a strange problem on new iphone 5 that I bought last week. The maps app and the places in photo gallery shows the pin and my location, however there is no information of locations. Tried to close the apps, phone restart, reset etc. I am accessing it via strong wireless connection and it works fine on other devices. Please help.

    zapgrap wrote:
    there is no information of locations.
    Then no information exists.  Use the Report a Problem button within the app to report it.

  • Problem with GUI in applet

    Hai to all,
    I am having a problem with GUI in applets
    My first class extends a JPanel named A_a
    import javax.swing .*;
    import java.awt.*;
    import java.awt.event.*;
    public class A_a extends JPanel
    JButton jb;
    JTextArea text;
    public A_a()
    setLayout(new FlowLayout());
    jb=new JButton("Click me");
    //add(jb);
    text=new JTextArea(5,20);
    add(text);
    public void text_appendText(String aa)
    System.out.println("I AM IN A_a");
    text.append(aa);
    text.revalidate();
    revalidate();
    /*public static void main(String ags[])
    A_a a = new A_a();
    JFrame frame=new JFrame();
    frame.getContentPane().add(a);
    frame.pack();
    frame.addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent e) { System.exit(0); }
    frame.setSize(200,200);
    frame.show();
    and then I am using other class B_b which is an applet carries a exitsing panel (A_a) inside it .
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class B_b extends JApplet
    public A_a a;
    public void init()
    a=new A_a();
    getContentPane().add(a);
    public void text_appendText(String aa)
    final String aaa =aa;
    new Thread(new Runnable()
    public void run()
    a=new A_a();
    a.setBackground(new java.awt.Color(255,200,200));
    System.out.println("I AM IN B_b");
    a.text.append(aaa);
    a.text.revalidate();
    getContentPane().remove(a);
    resize(500,500);
    }).start();
    and the I am using the second applet C_c in which by performing a button action the old panel A_a should get removed and replace the new panel D_a (which is not here )in the applet B_b with all other components(namely button , text fields etc)
    import javax.swing .*;
    import java.awt.*;
    import java.awt.event.*;
    import java.applet.*;
    import java.util.*;
    public class C_c extends JApplet implements ActionListener
    JButton jbt;
    JTextArea jta;
    public void init()
    getContentPane().setLayout(new FlowLayout());
    jbt=new JButton("Click me");
    jbt.addActionListener(this);
    getContentPane().add(jbt);
    jta=new JTextArea(5,20);
    getContentPane().add(jta);
    public void actionPerformed(ActionEvent ae)
    Enumeration e = getAppletContext().getApplets();
    Applet applets = null;
    while(e.hasMoreElements())
    applets=(Applet)e.nextElement();
    if ( applets instanceof B_b)
    System.out.println("I AM CLASS C_c");
    ((B_b)applets).text_appendText(jta.getText());
    ((B_b)applets).remove());
    ((B_b)applets).getContentPane().add(D_d);
    both the applets C_c and B_b are in same browser page
    How can i achive that pls help .

    Just to make the code readable...
    import javax.swing .*;
    import java.awt.*;
    import java.awt.event.*;
    public class A_a extends JPanel
    JButton jb;
    JTextArea text;
    public A_a()
    setLayout(new FlowLayout());
    jb=new JButton("Click me");
    //add(jb);
    text=new JTextArea(5,20);
    add(text);
    public void text_appendText(String aa)
    System.out.println("I AM IN A_a");
    text.append(aa);
    text.revalidate();
    revalidate();
    /*public static void main(String ags[])
    A_a a = new A_a();
    JFrame frame=new JFrame();
    frame.getContentPane().add(a);
    frame.pack();
    frame.addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent e) { System.exit(0); }
    frame.setSize(200,200);
    frame.show();
    }and then I am using other class B_b which is an applet carries a exitsing panel (A_a) inside it .
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class B_b extends JApplet
    public A_a a;
    public void init()
    a=new A_a();
    getContentPane().add(a);
    public void text_appendText(String aa)
    final String aaa =aa;
    new Thread(new Runnable()
    public void run()
    a=new A_a();
    a.setBackground(new java.awt.Color(255,200,200));
    System.out.println("I AM IN B_b");
    a.text.append(aaa);
    a.text.revalidate();
    getContentPane().remove(a);
    resize(500,500);
    }).start();
    }and the I am using the second applet C_c in which by performing a button action the old panel A_a should get removed and replace the new panel D_a (which is not here )in the applet B_b with all other components(namely button , text fields etc)
    import javax.swing .*;
    import java.awt.*;
    import java.awt.event.*;
    import java.applet.*;
    import java.util.*;
    public class C_c extends JApplet implements ActionListener
    JButton jbt;
    JTextArea jta;
    public void init()
    getContentPane().setLayout(new FlowLayout());
    jbt=new JButton("Click me");
    jbt.addActionListener(this);
    getContentPane().add(jbt);
    jta=new JTextArea(5,20);
    getContentPane().add(jta);
    public void actionPerformed(ActionEvent ae)
    Enumeration e = getAppletContext().getApplets();
    Applet applets = null;
    while(e.hasMoreElements())
    applets=(Applet)e.nextElement();
    if ( applets instanceof B_b)
    System.out.println("I AM CLASS C_c");
    ((B_b)applets).text_appendText(jta.getText());
    ((B_b)applets).remove());
    ((B_b)applets).getContentPane().add(D_d);
    }

  • Problem with focus on applet  - jvm1.6

    Hi,
    I have a problem with focus on applet in html page with tag object using jvm 1.6.
    focus on applet work fine when moving with tab in a IEbrowser page with applet executed with jvm 1.5_10 or sup, but the same don't work with jvm1.6 or jvm 1.5 with plugin1.6.
    with jvm 1.5 it's possible to move focus on elements of IEbrowser page and enter and exit to applet.
    i execut the same applet with the same jvm, but after installation of plugin 1.6, when applet gain focus don't release it.
    instead if i execute the same applet with jvm 1.6, applet can't gain focus and manage keyevent, all keyevent are intercepted from browser page.
    (you can find an example on: http://www.vista.it/ita_vista_0311_video_streaming_accessibile_demo.php)
    Any idea?
    Thanks

    Hi piotrek1130sw,
    From what you have described, I think the best approach would be to restore the original IDT driver, restart the computer, test that driver, then install the driver update, and test the outcome of installing the newest driver.
    Use the following link for instructions to recovery the ITD driver using Recovery Manager. Restoring applications and drivers.
    Once the driver is restored, restart the computer and test the audio. If the audio is good you can continue to use this driver, or you can reinstall the update and see what happens. IDT High-Definition (HD) Audio Driver.
    If installing the newest driver causes the issue to occur but the recovered driver worked, I suggest recovering again.
    If neither driver works I will gladly follow up and provide any assistance I can.
    Please let me know the outcome.
    Please click the Thumbs up icon below to thank me for responding.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Please click “Accept as Solution” if you feel my post solved your issue, it will help others find the solution.
    Sunshyn2005 - I work on behalf of HP

  • I am having a strange problems on the Data entry Forms

    A form that has been used since 2005 in an old version of HFM 3.51 was migrated to SYstem 11.1.2.1 in January of 2012 and has been working since then. Suddenly we start having some strange problems. Our response time has been very slow and I am wondering if there were some problems in any of the services. Maybe a service did not start properly related to the WEB forms.
    We entered a number in one of the cell to be: 348336349 as soon as we hit enter, the number was formatted to 348,336,349 but when I submit the number it came back as 3. I tried it several times and it did not work, I checked the scaling and that was set blank. One of my user tried it and it did not work. I tried looking into the Preferences and my screen froze. In the meantime one of my user was able to enter the number and was able to refresh it as well. Then she enter another number on a different cell and the same problem occurred it seemed as if it truncated all the digits except for the left most digit, we are unable to figure out how to resolve this issue. The number entereed in the cell is 826,251,218 it stores 8 and loses the rest of the 8 digits. I right click and checlk the properties and it says that it has stored 8 instead of 826,251,218.
    Following is the DEF script. Does anyone has any ideas, I am wondering if I have to restart the services..
    ReportType=WebForm
    ReportLabel=Aging_Receivables
    ReportDescription=Aging Receivables
    Instructions=Please make sure you set up your point of view (POV) appropriately. Business Unit (BU): AG, CE and Other_BU. Brand: Case, NH and Other_Brand.
    BackgroundPOV=S#Actual.Y#2011.P#Jan.w#YTD.V#<Entity Currency>.I#[ICP None].C2#SERVICED.C3#GL_INPUT.C4#Input
    SelectablePOVList=S{[Hierarchy]}.Y{[Hierarchy]}.P{[Third Generation]}.E{[Hierarchy]}.C1{[Base]}.C2{[Hierarchy]}.C3{[Base]}.C4{GL.[Hierarchy]}
    C1=A#Current
    C2=A#0_To_30
    C3=A#Total_Current
    C4=A#31_To_60
    C5=A#61_To_90
    C6=A#91_To_120
    C7=A#121 Plus
    C8=A#Total_Past_Due
    C9=A#Total_Aging_Rec
    C10=A#Current_OffBook
    C11=A#Past_Due_OffBook
    C12=A#T_Aging_Rec_OffBook
    C13=A#Total_MP_Aging_Rec
    C14=A#Aging_Rec_Diff
    R1=C1#_Retail
    R2=C1#_Wholesale_Tot
    R3=C1#_Wholesale
    R4=C1#_Wholesale_Natl
    R5=C1#_Wholesale_Othr
    R6=C1#_Credit_Card
    R7=C1#_Specialized_Lending
    R8=C1#_Marine
    R9=C1#_Soris
    R10=C1#_Other
    R11=C1#_Material
    R12=C1#Sup_Product
    FormInputBoxLength=23
    PrintNumRowsPerPage=33
    PrintNumDataColsPerPage=8
    ShowLabels=False
    ShowDescriptions=True
    SuppressColHeaderRepeats=False
    Edited by: user8267293 on Aug 8, 2012 12:41 PM
    Edited by: user8267293 on Aug 8, 2012 12:43 PM

    Hi,
    Did you find a way to solve your problem ? We have exactly the same for one application and we are using the same version of HFM : 11.1.2.1.
    This problem is only about webforms. We can correctly input data through Data Grids or Client 32.
    Thank you in advance for your answer.

  • Computer slower and a few other strange problems since upgrading to SL

    Hi all,
    About a month ago, I upgraded my mid-2009 MBP to SL. I'm now on 10.6.1. Ever since the upgrade, my computer's been somewhat slower than it was when I ran Leopard (although many people I know say their machines are faster). I did restart several times at one point, and that seemed to speed it up, although it still experiences delays I didn't have before. I've also had a bunch of strange issues:
    1) Safari is most noticeably slow, especially when using something like Top Sites on Safari 4. I alleviated this problem somewhat by setting new tabs to open a blank window rather than Top Sites, but even so, Safari is generally slower, gives me 'pinwheels' often, and also is less stable.
    2) The other day, I restarted to find that all fonts except system fonts had been mysteriously deactivated. As a designer, I rely heavily on my many fonts, which I manage using Linotype FontExplorer.
    3) Today, I opened my computer up after having it sleeping in a backpack, and it had turned off. It was not out of battery; it had just turned off for no apparent reason.
    4) Judging by Activity Monitor, RAM is being used somewhat more heavily by the system, contrary to the advertisements of a 'lighter' footprint for SL as compared to Leopard. However, according to Activity Monitor (which I check frequently), the processor does not appear to be getting taxed any more heavily than under Leopard, which makes the sluggishness more inexplicable.
    5) Yesterday, I could not get my computer to recognize my Time Machine backup disc. After restarting, it worked, but this is a pain.
    I appreciate any advice I can get. Does anyone else have similar problems or solutions? Or is the general consensus that these are SL bugs that Apple will work out by about 10.6.4 or so?
    Thanks,
    Nathan
    Message was edited by: nateeanes

    I began this thread awhile ago, but the essence of it is that I had a number of strange problems, although mostly my computer was just slower, when upgrading from Leo to SL.
    I've now wiped my HD and re-installed SL. It seems faster, although there are still a few issues:
    1) iWork (Pages, Numbers) has very weird coloring. All the text looks light blue and/or cyan, and I can't fix it.
    2) Although initially Safari worked great, lately it's been going back to its habits of being slow and showing strange things like chopping up the 'Top Sites' view, i.e. rendering it in an off way.
    3) Adobe CS3 will not install properly. I get them loaded up, but when I try to launch a program, I get an error that says "licensing for this product has stopped working". I cannot get to the 'activate' page, even though I uninstalled and deactivated CS3.
    In the interest of full disclosure, I did restore my home account after clean installing SL-- maybe I should have brought the files over folder by folder rather than bringing back my whole home folder with its settings? I wonder if I accidentally brought over Adobe's FLEXnet folder too.
    Also, does anyone know if Adobe CS3 can cause these problems with Safari and other programs? It just seems that the whole machine was slower after installing CS3, even though I wasn't running the programs.
    Any help is appreciated.
    Nate

  • Submitting a form with enter key causing strange problems

    I am having a very strange problem with a webapp I am currently developing. I am using JSF 1.2 along with Facelets and RichFaces. I have coded a workflow/wizard 4-step process, and on some pages I have 4 submit buttons that all call different actions on the page. The users thought it would be useful to have the enter key submit the form, so I followed some online resources to trap a keypress using javascript, looking for the enter keycode and calling document.getElementById("elementName").click(). This works fine most of the time. Sometimes, though, it seems as if an entire new session is being created, and odd behavior starts happening. For example, my page will only include 2 of the 4 facelets on the screen -or- I will get NullPointerExceptions for objects that I know have been created in the session bean I am currently using -or- I will get a duplicate form Id after trying to re-submit the page. Could the javascript click simulation not be submitting all of the form elements or is the enter key also acting like its default action (the form submission) in addition to the "click"? I'm really at my wit's end here (plus it's nearly 3 AM, that never helps things). All of the buttons being clicked are standard h:commandButtons. There is some setTimeout logic included to disable the buttons on the page to prevent double clicks (I cannot disable them onsubmit because disabled buttons don't pass the right values, perhaps that's causing it, but if so, clicking the buttons with the mouse would cause that issue too, right?)
    I am not posting the code (yet), but if anyone wants to take a look see and see if I am doing something really abhorrently wrong, I'm more than willing to, I'm just curious if anyone has had problems regarding javascript submission of forms via the click() method. Clicking the button does not exhibit this type of behavior. Just as a side note: I am doing different things with the enter key depending if a modal window is open (the enter key closes the modal if it's up, and if not, it submits the form via a button click).
    Any help is much appreciated, if anyone has any inkling about where I should start looking for answers it would be really helpful.
    Thank you.

    edfrost wrote:
    Could the javascript click simulation not be submitting all of the form elements or is the enter key also acting like its default action (the form submission) in addition to the "click"?My guess is the second of these. You need to suppress the event handling after programmatically clicking the button.

  • Strange problems on Macbook Pro over past year...

    I'm about to do an erase and install after having numerous strange problems on my mid 2009 17" Macbook Pro (Leopard) over the past year, some of which I have opened threads for on these forums.
    They are listed bellow to see if anyone wants to give their final two cents as to what is causing them. They may or might not be related.
    1) I recently found the "Unknown" user classifications at second from top in the user priveleges for the main Macintosh HD folder and "Local Work" – which is my main folder for work.
    http://discussions.apple.com/thread.jspa?threadID=2741617&tstart=0
    2) Last Summer I had some very strange login problems which were well documented in this very long winding thread here:
    http://discussions.apple.com/thread.jspa?threadID=2485199&tstart=0
    3) Can't access iTunes store due to this error code -54. Thread opened here:
    http://discussions.apple.com/thread.jspa?threadID=2653733&tstart=0
    4) Some proceses I've seen in the activity monitor that are possibly a little sketchy are as follows:
    - "netsessionmac1" ... Akamai playing about?
    - "TaskManagerDaemo" ... with "Root" user, ... sounds a bit vague and possible malware according to google?
    5) In Skype I get constant warnings of other computers trying to connect from Little Snitch and Virus Barrier. I get so many of them one after they other pausing skype that I can only use Skype with Little Snitch off. I can only use it late at night also as there seems to be more attempts being blocked in virus barrier during the day that I can't even get past the login:
    Some examples in screen grabs:
    http://oi56.tinypic.com/xkwwtf.jpg
    http://oi55.tinypic.com/2v2w941.jpg
    And other examples of the hundreds of different IP addresses I've had asking to access computer on some obscure 4 digit port:
    http://whatismyipaddress.com/ip/86.178.52.58
    http://whatismyipaddress.com/ip/94.168.76.16
    http://whatismyipaddress.com/ip/94.171.116.123
    http://whatismyipaddress.com/ip/92.235.196.125
    http://whatismyipaddress.com/ip/92.239.25.70
    http://whatismyipaddress.com/ip/192.168.0.1
    http://whatismyipaddress.com/ip/92.235.208.101
    http://whatismyipaddress.com/ip/92.236.252.132
    http://whatismyipaddress.com/ip/85.15.190.49
    ... etc
    6) I have to constantly open and close Mail after it hangs on sending. Says there is a connection problem on port 110 or whatever, but words fine as soon as I open again. This problem happens particularly when I want to send from my 2nd or 3rd POP or IMAP other than my normal one.
    7) Slow Safari/Firefox and internet.
    8) I got this strange warning about my IP changing recently when downloading a file:
    http://oi53.tinypic.com/2z4b77o.jpg
    9) My internet cuts out for large periods of time while the other PC desktop in my house works perfectly fine.
    Well, any last suggestions much appreciated. Many thanks.
    Message was edited by: Scottishengineer

    I suppose your expanding battery problem could have caused some or all of these problems, but most of them sound like software issues.
    If I were you I'd try a few things:
    1. boot from your snow leopard install disk and repair your startup disk with disk utility.
    2. repeat the repairs until no repairs are reported (the toilet paper principle).
    3. repair permissions again.
    4. if the problems persist, trash the preferences files for the misbehaving apps.
    5. if the problems persist, delete the misbehaving apps and reinstall them.
    6. it the shutoffs persist, try a PMU reset.
    7. a PRAM reset would probably be a good idea too.
    8. if none of that works, archive and reinstall.
    there is a freeware utility called applejack that will also do most of this.
    Details on all of these will be readily available with a google search.

  • Creative zen : vision M 30gb strange problem

    ,Creative zen : vision M 30gb strange problem. Hi people,
    My mp3 player is 2 and a half years old. A few months ago he didn't charge anymore. ?I thought i could repair it by buying a new battery and install him in my mp3.
    Afther a few ours of ?assembling it was ready for charging a thought..
    I used the usb charger and de sync adapter...
    the morning after, my mp3 is not charged and only showing me a little red stripe in de battery (right top) i can listen music but only for a few minutes...
    Also my PC does noet see my MP3
    tested on :
    windows xp service pack 3?
    vista?
    windows 7?
    please help me
    Stijn van Vilsteren?
    DUTCH?
    i am sorry for my pore english !

    Squipy wrote:
    Hi, I stopped using this MP3 for about 2 or so years because I bought a new one. I decided to start using it again and downloaded all the required software but as soon as I unplugged the MP3 from the power outlet, the player died. I can't get it to start up without plugging it into a power outlet. I think it has rechargable battery? Why didn't it recharge itself?
    My second enquiry is about the capacity of the player. When my player was empty, I went into "Information" and it said Total Space: 28GB and Free Space: 2GB. Why is free space only 2GB? Shouldn't it be 28 as well?
    Thanks in advance!
    The battery will only last about 3yrs regardless of use.You will need to change it. Did you scroll down to see the album,picture,track counts? Did you partition part of the dri've for removable storage. You can find instructions to open here ? http://www.youtube.com/watch?v=_Drkr...e=channel_page & ? the battery here(very easy to do) http://cgi.ebay.com/Original-Creative-ZEN-Vision-M-30gb-Battery-LPCS285385_W0QQitemZ400028645679QQcmdZViewItemQQpt ZOther_MP3_Player_Accessories?hash=item40002864567 9&_trksid=p39.c0.m4&_trkparms=72%3A205|66%3A4|65%3 A2|39%3A|240%3A38|30%3A0|293%3A|294%3A200

  • Short code causes a strange problem - About the list again -- please read!

    Hi again people. Maybe you remember my project - has a list, that you can search thru using a text field. During the work I got stuck on a strange problem ( Again :-( ) My app has one text field, one combo box, one list and a text field once more. The code should do the following ->
    *1. Load the list, no problem with that.*
    *2. Show the elements of the list, that match the selected group in the combo box,no problem.*
    *3. Search thru the list using the text field,no problem.*
    4. When the user selects an element from the list, it should display its info in the second text field. This also works fine, but when after looking at info of one of the elements the things on numbers 2 and 3 ( look up! ) stop working. I must say that everything works fine until user selects an element from the list. I couldnt understand this kind of behavior so I am asking you to help me please.
    The code is very simple:
    import javax.swing.*;
    import javax.swing.event.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    class the_window extends JFrame implements DocumentListener, ItemListener, ListSelectionListener {
        FileReader reader;
        String data_base[][];
        String first_pass[];
        int number_of_elements;
        DefaultListModel dflm = new DefaultListModel();
        JList list;
        JTextField text_field = new JTextField();
        JTextField info_field = new JTextField();
        String groups[] = {"1. group" , "2. group"};
        JComboBox groups_cmbx = new JComboBox(groups);
        the_window(){
            super("the Window!");
            JPanel panel = new JPanel(null);
            Container c = this.getContentPane();
            c.add(panel);
            text_field.setBounds(10,10,170,25);
            text_field.getDocument().addDocumentListener(this);
            panel.add(text_field);
            groups_cmbx.setBounds(10,45,170,25);
            groups_cmbx.addItemListener(this);
            panel.add(groups_cmbx);
            list = new JList(dflm);
            list.setBounds(10,90,170,190);
            list.setFixedCellHeight(20);
            list.addListSelectionListener(this);
            panel.add(list);
            info_field.setBounds(10,280,170,25);
            panel.add(info_field);
            load_the_base();
            refresh();
            this.setSize(190,350);
            this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            this.setResizable(false);
            this.setVisible(true);
        public void itemStateChanged(ItemEvent e){
            refresh();
        public void valueChanged(ListSelectionEvent e){
            String str = (String) dflm.getElementAt(list.getSelectedIndex());
            int index = 0;
            for(int i = 0; i < number_of_elements; i++){
                if(str.equals(data_base[0])){
    index = i;
    break;
    info_field.setText(data_base[index][1]);
    private void load_the_base(){
    String data = "";
    try{
    reader = new FileReader("data.txt";);
    int r = 0;
    while((r = reader.read()) != -1){
    char c = (char) r;
    data += c;
    reader.close();
    }catch(IOException e){}
    first_pass = data.split(";");
    number_of_elements = first_pass.length;
    data_base = new String[number_of_elements][];
    for(int i = 0; i<number_of_elements; i++){
    data_base[i] = first_pass[i].split("#");
    private void refresh(){
    String search_str = text_field.getText();
    int selektovano = groups_cmbx.getSelectedIndex();
    dflm.clear();
    for(int i = 0; i < number_of_elements; i++){
    int grupa = Integer.parseInt(data_base[i][2]);
    if(grupa == selektovano){
    String at_the_moment = data_base[i][0]; // if you change this to String at_the_moment = data_base[i][1]; it works perfectly
    if(at_the_moment.startsWith(search_str)){
    dflm.addElement(at_the_moment);
    public void changedUpdate(DocumentEvent e){
    refresh();
    public void removeUpdate(DocumentEvent e){
    refresh();
    public void insertUpdate(DocumentEvent e){
    refresh();
    public class Main {
    public static void main(String[] args) {
    JFrame f = new the_window();
    Now, can you please tell me whats wrong with this?
    For the "data.txt" make a new text file using *notepad* and copy the following line into the document:
    _1. element#1. info#0;2. element#2. info#0;3. element#3. info#1;4. element#4. info#1;5. element#5. info#1;_                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    Darryl.Burke wrote:
    Keith, thanks for making that readable. So here's the diagnosis -
    In the refresh() method, calling defaultListModel.clear() results in a valueChanged(...) event in which this method calldefaultListModel.getElementAt(list.getSelectedIndex())results in the exception noted, as getSelectedIndex returns -1, the list being empty... you can't getElementAt(-1).
    I haven't analyzed all the code nor checked whether is now works as desired, but this small change to valueChanged counters the exception being thrown.   public void valueChanged(ListSelectionEvent e) {
    infoField.setText(""); // do this unconditionally
    if (list.getSelectedIndex() != -1) {
    String value = (String)defaultListModel.getElementAt(list.getSelectedIndex());
    for(int i = 0; i < numFields; i++){
    if(value.equals(matrix[0])){
    infoField.setText(matrix[i][1]);
    break;
    db
    Yea! You were right! I didnt think that calling *list_model.clear();* will result in calling *valueChanged()* ........
    That was some *clear()* thinking :-) Thank you!
    corlettk wrote:
    I cleaned up some variable & method names (tut tut), imports (very naighty), and some thread stuff... but it remains fundamentally the same codeIs it so important to "clean" the imports? How much does it slow down the loading time? Should I do this on all my projects, because they are all "very naighty"?
    ps. Thanks to all that gave some help to answering this strange question :-)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Maybe you are looking for