Excessive cpu upon reading serial

Hello!
I have created a program that reads in a message from a RS232 connection. the instrument sends the message every 30 seconds or so. 
it seems that after one reading of the message my program starts to use excessive cpu at higher than 50% levels. but this only happens when the reading case is active. in the reading case there is a file writer subvi, and in this one it shows that it only gets written to once per case, which is normal, which indicates that there is no infinite loop there, but I still experience a high CPU load.
This seems odd as I have a very very similar other program reading from rs485 that does not have this problem. 
I have tried to profile memory usage and higlight execution, but this seems to show nothing. 
I am using a windows Vista machine with loads of ram and cpu speed. I have attached my VI and a profiler log file.
Attachments:
ceil.vi ‏54 KB
ceilometer_memory.txt ‏110 KB

My first recommendation would be to not set the size of the buffer to 3993 bytes. Leave it at the default size of 4096. You don't want to fill up the buffer. I would probably make the buffer even larger since it gives you only 103 bytes of actual buffer between a full message waiting and the limit of the buffer. Try 8192.
I don't see any reason why should make the wait statement exactly 1664 ms just because that is how long it takes for the message to come in. You might be better off making the wait statement 30 seconds, the time between messages. However, based on some other changes that should be made, I would make it 1000 msec. That way there is some pause in the loop if needed, but the other changes will more effectively pace your loop.
Instead of reading bytes at port, since you know each message is exactly 3993, just read 3993 bytes. Make the timeout of the VISA port something larger than 30 seconds, perhaps 35-40.
A VISA read will wait until one of 3 things happen.
1. The requested number of bytes have been read.
2. The termination character has been read (if it has been enabled).
3. The timeout limit has been reached.
With a larger than 30 second timeout, you'll know that at least enough time was allotted for a complete message to come in even if you didn't happen to try the open the port and read the buffer until immediately after the last message came in.
The one problem with a serial communication scheme where you don't query for data and there is no disctinctive end of message character is that if you start reading the port in the middle of the first message, you really don't know where the message ends and the begining of the next message is. The trick is how to determine that you are reading the beginning of the message so that when you read 3993 bytes, you know you have a complete message, and not a mixed message.
I would open the port and configure it for a plenty large buffer (at least 4096 bytes if not 8192) and a 35-40 second timeout. In a loop, wait a second then read the bytes at port. If there are bytes, flush the port and repeat the loop. If there are zero bytes at the port, then it is probably safe to say you are in the dead time between messages, so exit the loop. Now you have an empty port and are in the dead time between messages, you can begin the real part of your program where you continually read the port and process the messages. Do that in a loop reading precisely 3993 bytes with the VISA read and process the string.

Similar Messages

  • Forte Partition using excessive CPU

    Dear All,
    I have an intermittent problem whereby a forte partition seems to be
    hogging excessive CPU but upon investigation doesn't appear to be doing
    anything.
    We can identify the partition and want to restart it with logging on the
    partition.
    Does anyone know what flags to set so that the problem can be diagnosed
    Regards
    Ceri Davies
    [email protected]

    Could you do us the honour of linking to this fix? I'm having the same problem; java using 100-120% CPU for some mystery process, even when every app has been quit. Googling it only points in the direction of coder sites and this thread, which whilst being 'fixed' doesn't actually offer one.

  • 10.9.4 excessive CPU usage

    And now a strange case...
    Installed 10.9.4 but it became unusable because of excessive CPU usage. Reverted back to 10.9.3 but now the problem persists!
    Basically, if connect the Ethernet cable the CPU increases and temp raises from 45C to 95C. As soon as I remove the Ethernet cable and stay on WiFi things go back to normal. I already have done the most obvious, i.e. reinstalling the OS from time machine, removing launch daemons and plug-ins, and fixing disk permissions. Check the details below. Any idea? It would be much appreciated. I'm getting nuts with this.
    Top Processes by CPU: (Ethernet not connected)
          41% Mail
          12% revisiond
          6% opendirectoryd
          5% WindowServer
          4% mtmd
    Top Processes by CPU: (Ethernet connected)
          47% ocspd
          47% apsd
          35% configd
          33% mDNSResponder
          20% networkd
    Full detais:
    EtreCheck version: 1.9.12 (48)
    Report generated 18 July 2014 11:45:23 NZST
    Hardware Information:
      MacBook Pro Intel Core i5, Intel Core i7 (Mid 2010)
      MacBook Pro - model: MacBookPro6,2
      1 2.4 GHz Intel Core i5 CPU: 2 cores
      8 GB RAM
    Video Information:
      Intel HD Graphics - VRAM: 288 MB
      NVIDIA GeForce GT 330M - VRAM: 256 MB
      LED Cinema Display 2560 x 1440
    System Software:
      OS X 10.9.3 (13D65) - Uptime: 0 days 0:5:13
    Disk Information:
      APPLE SSD TS128B disk0 : (121.33 GB)
      EFI (disk0s1) <not mounted>: 209.7 MB
      Macintosh HD (disk0s2) / [Startup]: 120.47 GB (13.11 GB free) (Low!)
      Recovery HD (disk0s3) <not mounted>: 650 MB
      MATSHITADVD-R   UJ-898 
    USB Information:
      Jmicron Corp. Usb production 1 TB
      EFI (disk2s1) <not mounted>: 209.7 MB
      EXTRA (disk2s2) /Volumes/EXTRA: 999.86 GB (301.61 GB free)
      Apple Inc. Display Audio
      Apple Inc. Display iSight
      Apple Inc. Apple LED Cinema Display
      Apple Computer, Inc. IR Receiver
      Apple Inc. Built-in iSight
      Western Digital  External HDD     500.11 GB
      TM (disk1s1) /Volumes/TM: 500.11 GB (110.12 GB free)
      Apple Inc. Apple Internal Keyboard / Trackpad
      Apple Internal Memory Card Reader
      Apple Inc. BRCM2070 Hub
      Apple Inc. Bluetooth USB Host Controller
    Gatekeeper:
      Anywhere
    Kernel Extensions:
      [not loaded] com.FTDI.driver.FTDIUSBSerialDriver (2.2.16) Support
      [not loaded] com.libusb.USB_Shield (6.0) Support
    Startup Items:
      Jaksta: Path: /Library/StartupItems/Jaksta
    Launch Daemons:
      [loaded] com.adobe.fpsaud.plist Support
      [loaded] com.microsoft.office.licensing.helper.plist Support
    User Login Items:
      smcFanControl
      Mail
    Internet Plug-ins:
      FlashPlayer-10.6: Version: 14.0.0.145 - SDK 10.6 Support
      QuickTime Plugin: Version: 7.7.3
      Flash Player: Version: 14.0.0.145 - SDK 10.6 Cannot contact Adobe
      Default Browser: Version: 537 - SDK 10.9
      OfficeLiveBrowserPlugin: Version: 12.3.6 Support
      SharePointBrowserPlugin: Version: 14.4.2 - SDK 10.6 Support
      iPhotoPhotocast: Version: 7.0 - SDK 10.8
    Audio Plug-ins:
      BluetoothAudioPlugIn: Version: 1.0 - SDK 10.9
      AirPlay: Version: 2.0 - SDK 10.9
      AppleAVBAudio: Version: 203.2 - SDK 10.9
      iSightAudio: Version: 7.7.3 - SDK 10.9
    iTunes Plug-ins:
      Quartz Composer Visualizer: Version: 1.4 - SDK 10.9
    3rd Party Preference Panes:
      None
    Time Machine:
      Skip System Files: NO
      Mobile backups: ON
      Auto backup: YES
      Volumes being backed up:
      Macintosh HD: Disk size: 112.20 GB Disk used: 99.99 GB
      Destinations:
      TM [Local] (Last used)
      Total size: 465.76 GB
      Total number of backups: 84
      Oldest backup: 2012-11-18 19:49:30 +0000
      Last backup: 2014-07-17 02:17:01 +0000
      Size of backup disk: Excellent
      Backup size 465.76 GB > (Disk size 112.20 GB X 3)
      Time Machine details may not be accurate.
      All volumes being backed up may not be listed.
    Top Processes by CPU:
          47% ocspd
          47% apsd
          35% configd
          33% mDNSResponder
          20% networkd
    Top Processes by Memory:
      254 MB mds_stores
      147 MB com.apple.IconServicesAgent
      115 MB Mail
      90 MB Dock
      74 MB Finder
    Virtual Memory Information:
      4.68 GB Free RAM
      1.99 GB Active RAM
      331 MB Inactive RAM
      1.01 GB Wired RAM
      187 MB Page-ins
      0 B Page-outs

    Please read this whole message before doing anything.
    This procedure is a test, not a solution. Don’t be disappointed when you find that nothing has changed after you complete it.
    Step 1
    The purpose of this step is to determine whether the problem is localized to your user account.
    Enable guest logins* and log in as Guest. Don't use the Safari-only “Guest User” login created by “Find My Mac.”
    While logged in as Guest, you won’t have access to any of your documents or settings. Applications will behave as if you were running them for the first time. Don’t be alarmed by this behavior; it’s normal. If you need any passwords or other personal data in order to complete the test, memorize, print, or write them down before you begin.
    Test while logged in as Guest. Same problem?
    After testing, log out of the guest account and, in your own account, disable it if you wish. Any files you created in the guest account will be deleted automatically when you log out of it.
    *Note: If you’ve activated “Find My Mac” or FileVault, then you can’t enable the Guest account. The “Guest User” login created by “Find My Mac” is not the same. Create a new account in which to test, and delete it, including its home folder, after testing.
    Step 2
    The purpose of this step is to determine whether the problem is caused by third-party system modifications that load automatically at startup or login, by a peripheral device, by a font conflict, or by corruption of the file system or of certain system caches.
    Please take this step regardless of the results of Step 1.
    Disconnect all wired peripherals except those needed for the test, and remove all aftermarket expansion cards, if applicable. Start up in safe mode and log in to the account with the problem. You must hold down the shift key twice: once when you turn on the computer, and again when you log in.
    Note: If FileVault is enabled, or if a firmware password is set, or if the startup volume is a Fusion Drive or a software RAID, you can’t do this. Ask for further instructions.
    Safe mode is much slower to start up and run than normal, with limited graphics performance, and some things won’t work at all, including sound output and Wi-Fi on certain models. The next normal startup may also be somewhat slow.
    The login screen appears even if you usually log in automatically. You must know your login password in order to log in. If you’ve forgotten the password, you will need to reset it before you begin.
    Test while in safe mode. Same problem?
    After testing, restart as usual (not in safe mode) and verify that you still have the problem. Post the results of Steps 1 and 2.

  • Mountain Lion Mail excessive CPU usage

    Evers since upgrading to ML 10.8 and 10.8.1, Mail heats the CPU up to 100% after a couple of minutes and remains like this forever. Absolutely reproducible. Mail is unusable for me.
    I have some 25.000 Mails in my Inbox. Sampling Mail  always reveals the same pattern. Looks like Mail is constantly iterating over my 25.000 emails and tries to layout them. Looks crazy to me.
    Here is an excerpt of the sample:
    Sampling process 3458 for 3 seconds with 1 millisecond of run time between samples
    Sampling completed, processing symbols...
    Analysis of sampling Mail (pid 3458) every 1 millisecond
    Process:         Mail [3458]
    Path:            /Applications/Mail.app/Contents/MacOS/Mail
    Load Address:    0x10e285000
    Identifier:      com.apple.mail
    Version:         6.0 (1486)
    Build Info:      Mail-1486000000000000~2
    Code Type:       X86-64 (Native)
    Parent Process:  launchd [158]
    Date/Time:       2012-09-03 10:39:43.345 +0200
    OS Version:      Mac OS X 10.8.1 (12B19)
    Report Version:  7
    +
    !   :   |
    + 828 __CFRunLoopDoObservers  (in CoreFoundation) + 369  [0x7fff848ec031]
    +
    !   :   |
    +   828 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__  (in CoreFoundation) + 23  [0x7fff848ec0c7]
    +
    !   :   |
    +
    802 __83-[NSWindow _postWindowNeedsDisplayOrLayoutOrUpdateConstraintsUnlessPostingDisabled]_block_ invoke_01208  (in AppKit) + 46  [0x7fff83afdc81]
    +
    !   :   |
    +
    ! 800 _handleWindowNeedsDisplayOrLayoutOrUpdateConstraints  (in AppKit) + 738  [0x7fff83535c3c]
    +
    !   :   |
    +
    ! : 800 ???  (in Mail)  load address 0x10e285000 + 0x2e467  [0x10e2b3467]
    +
    !   :   |
    +
    ! :   800 -[NSView displayIfNeeded]  (in AppKit) + 1830  [0x7fff83536703]
    +
    !   :   |
    +
    789 -[NSView _displayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:]  (in AppKit) + 4675  [0x7fff8356c79d]
    +
    !   :   |
    +
    | 789 -[NSThemeFrame _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectFor View:topView:]  (in AppKit) + 314  [0x7fff83570b73]
    +
    !   :   |
    +
    |   787 -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectFor View:topView:]  (in AppKit) + 5763  [0x7fff83572474]
    +
    !   :   |
    +
    |   + 786 -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectFor View:topView:]  (in AppKit) + 5763  [0x7fff83572474]
    +
    !   :   |
    +
    |   + ! 785 -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectFor View:topView:]  (in AppKit) + 5763  [0x7fff83572474]
    +
    !   :   |
    +
    |   + ! : 782 -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectFor View:topView:]  (in AppKit) + 5763  [0x7fff83572474]
    +
    !   :   |
    +
    |   + ! : | 774 -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectFor View:topView:]  (in AppKit) + 5763  [0x7fff83572474]
    +
    !   :   |
    +
    |   + ! : | + 773 -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectFor View:topView:]  (in AppKit) + 5763  [0x7fff83572474]
    +
    !   :   |
    +
    |   + ! : | + ! 767 -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectFor View:topView:]  (in AppKit) + 5763  [0x7fff83572474]
    +
    !   :   |
    +
    |   + ! : | + ! : 753 -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectFor View:topView:]  (in AppKit) + 817  [0x7fff83571122]
    +
    !   :   |
    +
    |   + ! : | + ! : | 751 -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:]  (in AppKit) + 2704  [0x7fff83573509]
    +
    !   :   |
    +
    |   + ! : | + ! : | + 751 -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:]  (in AppKit) + 1656  [0x7fff835730f1]

    This problem was solved.
    After a lot of frustration (restoring Lion backup and performing the update several times), I managed to have a stable installation without the problem of high CPU usage and high temperatures.
    It seems that the installation procedure has an issue, when your user directories are located in an external disk. In this particular case, after the installation of the server software, the two links in /Network/Servers directory, pointing to the / directory, do not get created, so you need to do that manually.
    That, in itself, was not causing my excessive CPU usage, but it didn't allow my users to log in the server. Thinking that this was the issue described in http://support.apple.com/kb/TS2938, I was running the command described in the previous link to fix the issue. That command (sso_util configure -r REALM_NAME -a diradmin afp) was what was killing my CPU.
    All is well, when it ends well, I guess.

  • "parentalcont" process using excessive CPU

    I noticed my iMac really struggling this evening with a web conference - the case heating up and the video connection dropping quite often.  I looked at Activity Monitor and the % User value at the bottom jumped to 25-30% every few seconds with nothing really running, but no processes in the list were showing high CPU use.  I used the "top" command in terminal and found that the process "parentalcont" was consuming excessive CPU cycles (it showed around 95% every few seconds).
    I just set up an account for my 6-year-old to play with her online disney games and what-not a few days ago and enabled parental controls.  Never used them before.  After going to "Preferences>Users" and disabling parental controls the problem went away.
    Anyone have any idea why parental controls would act this way?  When I'm not even logged in to the account that uses them?
    Thanks.

    "parentalcont" is what displays in the "COMMAND" column when using the "top" function in terminal.  That column appears to be limited to 12 characters so it is probably truncating the name. (e.g.  "Folder Actio" is another one listed).  This process doesn't show up at all in Activity Monitor.
    An update:  After some trial and error, I've found that the "Limit Applications" function of parental controls appears to be the culprit.  When I tell it to limit applications to "Up to 9+" the CPU use skyrockets after a 10-30 seconds, and the process shows its state as "stuck".
    Kind of a head-scratcher but I think the solution may be to just not use the "Limit Applications" feature.  All I really wanted was the Simple Finder and to block bad websites.

  • Creative Cloud using Excessive CPU

    Since an update early today (9/12/2013), the Creative Cloud executable is consuming excessive CPU.  It's basically using an entire 100% CPU of a core on an i7 6-core system.  At first it said I had updates in the task notification area, so I clicked on the notification, but no response occurred.  After several minutes of no response, I noticed the fans on my computer were running fast, which is unusual when the computer is sitting there idle.  I opened up process explorer to see what was going on.  I found the Create Cloud suite consuming an entire core's worth of CPU.  See snapshot.
    Is this app doing a busy-poll loop?
    is someone at Adobe listening? Please fix this problem ASAP!

    Hey,
    Have a look at http://forums.adobe.com/message/5469789#5469789
    Hope it helps.

  • Firefox 18.0.1 consuming excessive CPU--both in Standard and Safe Mode--when accessing Gmail

    Firefox 18.0.1 consumes excessive CPU--both in Standard and Safe Modes--when accessing Gmail (in Standard Mode). CPU consumption averages around 56% on my dual-CPU, Windows 7 desktop.
    The only way to stop this from happening it to open Gmail in "HTML" mode. When I open Gmail in Standard mode, a "Loading..." status shows at the top of the page. After about 30 seconds, a error window pops-up within the Gmail page saying that there is a performance problem and provides the option to load Gmail in a limited, "HTML" mode. Clicking the HTML Mode link solves the issue. I've been using Firefox for years and have never seen this issue until now.

    try this link
    *https://support.mozilla.org/en-US/kb/firefox-uses-too-many-cpu-resources-how-fix

  • Nook e-reader serial number produces error message 'not a valid serial number'

    Anyone know why my Nook e-reader serial number is not recognised when I try to register it?

    I've given up trying and found that I can download books onto my PC then onto the Nook.  Would have preferred to get them straight to the Nook but life's too short to be spending so much time making things work! Thanks for replying :-)

  • Writing and  Reading serialized Objects

    [code=java]
    /*hey guys i'm new to java and i have been given an exercise to make a cd collection, write it into a file and read the data back to the program.
    the program is suppose to show you a menu to select from where you can add, delete, view sort, CD's when you add a CD it must be written to a file as an Object and when you want to view CDs or search for a CD the program must read the CD objects from the file they have been written to and must return a cd nam, artist and release date. the code looks like it is writing the Cd to a file but when i try to read (view or search for a cd from the file it gives an error null). so i think i'm note reading the right way.
    thank you for helping .
    import java.io.Serializable;
    public class cd implements Serializable {
         //creating attributes
              private String cdname = null;
              private double price = 0.0;
              private String artist =null;
              private int ratings =0;
              private String genre=null;
              private String releaseDate =null;
         // creating an Empty constructor
              public cd(){
              public cd (String cdname,double price, int ratings, String genre, String artist, String releaseDate){
              this.cdname=cdname;
              this.price=price;
              this.artist=artist;
              this.ratings=ratings;
              this.genre=genre;
              this.releaseDate=releaseDate;
              public String getGenre(){
                   return genre;
              public void setGenre(String genre){
                   this.genre =genre;
              public String getArtist(){
                   return artist;
              public void setArtist(String artist){
                   this.artist=artist;
              public String getName(){
              return cdname;
              public void setName(String cdname){
              this.cdname = cdname;
              public Double getPrice(){
              return price;
              public void setPrice(double price){
              this.price = price;
              public String getReleaseDate(){
              return releaseDate;
              public void setReleaseDate(String releaseDate){
              this.releaseDate = releaseDate;
              public int getRatings(){
              return ratings;
              public void setRatings( int ratings){
              this.ratings = ratings;
    import java.util.*;
    public class hipHopCollection {
    ArrayList<cd> list = new ArrayList <cd> ();
    EasyIn ei = new EasyIn();
         private cd invoke;
         private int b;
         public void load()
              System.out.println(" You Entered " + b + " To Add A CD ");
              invoke = new cd();
              System.out.println("Please Enter A CD Name ");     
              invoke.setName(ei.readString());
              System.out.println("Please Enter A CD Price");
              invoke.setPrice(ei.readDouble());
              System.out.println("Please Give Ratings For The CD");
              invoke.setRatings(ei.readInt());
              System.out.println("Please Enter A CD release date ");
              invoke.setReleaseDate(ei.readString());
              System.out.println("Please Enter artist Name ");
              invoke.setArtist(ei.readString());
              System.out.println("Please Enter A CD Genre ");
              invoke.setGenre(ei.readString());
              list.add(invoke); // trying to add cd information to invoke.
         }// end of load
    // The following method should return the Object variable invoke that holds the cd INFO
         public Object getInvoke()
         return invoke;
         public int getB()
         return b;
         public void setB()
         b=ei.readInt();
         public void menu(){
              System.out.println("......................................................... ");
              System.out.println("Hi There Please Enter A Number For Your Choice");
              System.out.println(" Pess >>");
              System.out.println("1 >> Add A CD");
              System.out.println("2 >> View List Of CD's");
              System.out.println("3 >> Sort CD's By Price");
              System.out.println("4 >> Search CD By Name");
              System.out.println("5 >> Remove CD(s) By Name");
              System.out.println("0 >> Exit");
              System.out.println(".........................................................");
              System.out.print("Please Enter Chioce >> ");     
         }// end of menu
         public void GoodBye()
              System.out.println(" You Entered " + b + " To exit Good_bye" );
              System.exit(0);
         }//end of GoodBye
         public void PriceSort()
              System.out.println(" You Entered " + b + " To Sort CD(s) By price ");
              Collections.sort(list, new SortByPrice());
              for(cd s : list)
              System.out.println(s.getName() + ": " + s.getPrice());
         }// end of PriceSort
         public void NameSearch()
                   System.out.println(" You Entered " + b + " To Search CD(s) By Name ");
                   System.out.println("Please Enter The Name Of The CD You Are Searching For " );
                   String search = ei.readString();
                   for(int i=0; i<list.size();i++){
                   if(search.equalsIgnoreCase(list.get(i).getName() )){
                   System.out.println(list.get(i).getName() + " " + list.get(i).getPrice() + " " + list.get(i).getRatings() + " " + list.get(i).getGenre() );
    }//end of NameSearch
         public void ViewList()
                   System.out.println(" You Entered " + b + " To view CD(s) By Name ");
                   for(int i=0; i<list.size();i++)
                   System.out.println(list.get(i).getName() + " " + list.get(i).getPrice() + " " + list.get(i).getRatings() + " " + list.get(i).getGenre() );
         }// end of ViewList
         public void DeleteCd()
                   System.out.println(" You Entered " + b + " To Delete CD(s) By Name ");
                   System.out.println("Please Enter The Name Of The CD You Want to Delete ");
                   String search = ei.readString();
                   for(int i=0; i<list.size();i++)
                   if(search.equalsIgnoreCase(list.get(i).getName() ))
                   System.out.println(list.get(i).getName());
                   list.remove(i);
         }// end of DeleteCD
         public static void main(String[] args) {
         //creating an Instance of EasyIn by object ei. Easy in is a Scanner class for reading
              EasyIn ei = new EasyIn();
              ArrayList<cd> list = new ArrayList <cd> (); // creating an array cd list
              hipHopCollection call = new hipHopCollection();
              ReadWrite rw = new ReadWrite();
                   while (true){
                   call.menu();
                   call.setB();
                   //b = ei.readInt();
                   if(call.getB()==0)
                        call.GoodBye();
                   if(call.getB()==1)
                        call.load();
                        rw.doWriting();// trying to write the cd object to a file
                   if(call.getB()==2)
                   rw.doReading();// trying to read the cd object from a file
                   //call.ViewList();
                   if(call.getB()==3)
                   call.PriceSort();
                   if(call.getB()==4)
                        call.NameSearch();
                   if(call.getB()==5)
                        call.DeleteCd();
         }// end of while
    }// end of main
    }// end of class
    // importing all the packages that we will use
    import java.io.ObjectInputStream;
    import java.io.FileInputStream;
    import java.io.File;
    import java.io.FileNotFoundException;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.io.ObjectOutputStream;
    import java.io.OutputStream;
    import java.io.Serializable;
    public class ReadWrite {
    // these are all the attributes
         private String FileName ="CdCollections.dat";     
         private OutputStream output;
         private ObjectOutputStream oos;
         private FileOutputStream fos;
         private File file;
         private FileInputStream fis;
         private ObjectInputStream ois;
         //creating an empty constructor
         public ReadWrite()
         // we could initialise all the attributes inside this empty constructor
         //creating a constructor with arguments of a file name.
         public ReadWrite(File file)
              this.file=file;
              try
                   //Use a FileOutputStream to send data to a file called CdCollections.dat
                   fos = new FileOutputStream(file,true);
                   Use an ObjectOutputStream to send object data to the
                   FileOutputStream for writing to disk.
                   oos = new ObjectOutputStream (fos);
                   fis=new FileInputStream(file);
                   ois = new ObjectInputStream(fis);
              catch(FileNotFoundException e)
                   System.out.println("File Not Found");
              catch(IOException a)
                   System.out.println(a.getMessage());
                   System.out.println("Please check file permissions of if file is not corrupt");
         }// end of the second constructor
         //the following lines of code will be the accessors and mutators
         * @return the output
         public OutputStream getOutput() {
              return output;
         * @param output the output to set
         public void setOutput(OutputStream output) {
              this.output = output;
         * @return the objStream
         public ObjectOutputStream getOos() {
              return oos;
         * @param objStream the objStream to set
         public void setObjStream(ObjectOutputStream objStream) {
              this.oos = oos;
         public File getFile() {
              return file;
         public void setFile(File file) {
              this.file = file;
         public FileInputStream getFis() {
              return fis;
         public void setFis(FileInputStream fis) {
              this.fis = fis;
         public ObjectInputStream getOis() {
              return ois;
         public void setOis(ObjectInputStream ois) {
              this.ois = ois;
         // the following lines of code will be the methods for reading and writing
    the following method doWriting will write data from the hipHopCollections source code.
    that will be all the cd information.
    Pass our object to the ObjectOutputStream's
    writeObject() method to cause it to be written out
    to disk.
    obj_out.writeObject (myObject);
         public void doWriting()
              hipHopCollection call = new hipHopCollection();
    //creating an Object variable hold that will hold cd data from hipHopCollections invoke
              Object hold = call.getInvoke();// THI COULD BE THE PART WHERE I MADE A MISTAKE
              ReadWrite stream = new ReadWrite (new File(FileName));
              try
              Pass our object to the ObjectOutputStream's
              writeObject() method to cause it to be written out to disk.
              stream.getOos().writeObject(hold);
                   stream.getOos().writeObject(hold);
                   stream.getOos().close();
                   System.out.println("Done writing Object");
              catch (IOException e)
                   System.out.println(e.getMessage());
                   System.out.println("Program Failed To Write To The File");     
              finally
                   System.out.println("The program Has come To An End GoodBye");
         }// end of method DoWriting
    The following method is for reading data from the file written by the above method named
    DoWriting
    // PLEASE NOT THIS IS THE METHOD THAT GIVES ME NULL EXCEPTION
         public void doReading()
         ReadWrite read = new ReadWrite(new File(FileName));
              try{
                   //System.out.println("I AM NOW INSIDE THE TRY TO READ");
                   Object obj = read.getOis().readObject();
                   System.out.println("tried reading the object");
                   cd c = (cd)obj; // trying to cast the object back to cd type
                   System.out.println("I have typed cast the Object");               
                   System.out.println(c.getName());
                   System.out.println(c.getGenre());
                   System.out.println(c.getArtist());
                   System.out.println(c.getPrice());
                   System.out.println(c.getRatings());
                   System.out.println(c.getReleaseDate());
                   read.getOis().close();
              catch(ClassNotFoundException e)
              System.out.println(e.getMessage());
              System.out.println("THE CLASS COULD NOT BE FOUND");
              catch(IOException e)
              System.out.println(e.getMessage());// null
              System.out.println("WE COULD NOT READ THE DATA INSIDE THE FILE");
         }//end of method doReading
    }// end of class ReadWrite

    Cross posted
    http://www.java-forums.org/new-java/59965-writing-reading-serialized-java-object.html
    Moderator advice: Please read the announcement(s) at the top of the forum listings and the FAQ linked from every page. They are there for a purpose.
    Then edit your post and format the code correctly.
    db

  • Read Serial port @100 us

    Hi guys,
    I'd like to know if Labview can read serial port @ 100 microseconds?
    Is it necessary any specific HW for  that? What HW can I use to read at that rate?
    Regards
    Kito

    Take 5-10 minutes and explain your problem much better. Like this. I have an instrument xyz. This instrument use a ZZZ communication protocol, over a YYY link. In my Labview program I want to achieve this XXX. This is what I have done so far.
    Remember good questions draw good answers.
    Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
    (Sorry no Labview "brag list" so far)

  • Msi Z68 GD80 (G3) strange Cpu Temp.reading

    Hello all,this is my first post here.
    I just purchased an Msi Z68 GD80(G3) and I think I have strange cpu temp. reading as seen in the Hw monitor.My i5 2500k idle/load CPU temp. is equal or higher than core temps which is strange for an intel cpu,as an intel user for years I believe it should be 10-12C lower than core temps.(my previous mobo was giga p67 ud5 and never had this issue).Double checked my cpu cooler-spire thermax 2-no problems.Updated to last bios-no change-Any recommendations/solutions welcomed here.
    Rest of my system as follows:
    Asus gtx560
    4*2 gb gskill ddr3 ram
    1tb samsung hd
    high power 650w power supply     

    Have you checked what the CPU temp shows in BIOS just after start up ? How does that compare with the HW temp.
    HW Monitor's temp interpretation may just not be calibrated for the specific Fintek chip used on your MB. Maybe you want to check with the HW monitor home site as well.
    How do the temps compare with whats read/displayed in Speedfan, Real Temp or Core Temp ?
    If they are all similar, then it could just be a badly calibrated sensor on the board as well.
    Do some comparative testing and see if there are any differences at all.
    Also check with MSI technical to see if they are aware of a general tendency with regards to this, or whether a BIOS revision may have addressed such an issue. >>How to contact MSI.<<
    Just recheck your heatsink seating again and maybe even reseat the CPU and do a full socket pin inspection at the same time.

  • HP C410b, Windows XP SP3, is there a fix for svchost excessive cpu utilisation in wired network

    PC has ground to a halt because of excessive svchost cpu activity.  Seems to be searching for the printer all the time (even though static ip set).  I can manually stop the HP Network Services but every time I use the printer it starts again and the current driver set doesn't stop it again.  Is there a solution (new driver or workaround) or do I try USB to one PC and printer sharing?
    I'm annoyed by this, especially as other models seem to have had the same issue over a few years and the manuals are so simple as to be useless.

    PC has ground to a halt because of excessive svchost cpu activity.  Seems to be searching for the printer all the time (even though static ip set).  I can manually stop the HP Network Services but every time I use the printer it starts again and the current driver set doesn't stop it again.  Is there a solution (new driver or workaround) or do I try USB to one PC and printer sharing?
    I'm annoyed by this, especially as other models seem to have had the same issue over a few years and the manuals are so simple as to be useless.

  • AcroRd32.exe Goes to High CPU After Reader is Closed

    When I close Acrobat reader, the process AcroRd32.exe jumps up to high CPU usage, about 25% and stays there.  If there are several adobe reader windows open, this occurs upon closing the last reader window.  If I open reader again, then close, I get another stale AcroRd32.exe process and another +25% CPU usage, etc.  I have to kill the processes in Win7 task manager.
    I've tried downgrading from version 11 to version 10, with no success.  I've tried suggestions from this forum and other sites, such as
    edit->preferences->general, uncheck "show me messages...", check "don't show me messages..."
    edit->preferences->internet, uncheck "allow fast web viewing", uncheck "allow speculative downloading..."
    But no luck.  Still happening.
    It hasn't always been this way.  I suspect some interaction with a windows or browser update within the past month or so.
    This is really broken and really annoying.  Thank you!

    I have a customer with the same issue.  I've done all the standard fixes, like disable protected mode, stop messages, etc.  This is on a Citrix XenApp 6.5 server and the particular workstation is shared by many people using a common log on.  The users are all using Reader XI to view AutoCAD 2004 and SolidWorks 2014 drawings that have been printed to PDF.
    Anybody have any ideas because I'm out.

  • Flash: excessive CPU usage

    I'm on Mac OS X 10.5.7 and latest version of flash 10,0,32,18, and I notice that CPU usage is really excessive for pretty much any page that has even a small flash content embedded in Firefox 3.5.1. Just having for example a paused flash video uses 16% CPU constantly, and playing the video spikes the CPU usage from 56 to 76%.
    And this is on dual Xeon, 2.8 GHz, 8 core Mac Pro with nVIDIA GeForce 8800 GT 512 MB video card, and 32 GB of RAM. I can only imagine how really frustrated users on notebooks must be.
    I think flash is really reaching the tipping point where it is becoming unusable and it is really time to start looking into sane alternatives.

    I do agree.  Though, to be fair, people use the software that Adobe creates to create their own software that runs in the flash player.  The player can be as well written as it is possible to be, and still have this type of problem if independent developers write poor software.  This is not in Adobe's control.
    My note is that it is a known bug for player 10 to be excessively wasteful on the Mac platform, regardless of how well the program running is programmed.  This is a bug that they are currently working on fixing, to all publicly facing knowledge.
    The only way to truly get rid of this is to get the developers out there in the world educated in good programming habits. Actionscript 3 has done a lot in terms of pushing the community towards that goal, but bad practices are still extant.  People don't remove event listeners when they are finished with them.  People don't set variables to null for garbage collection.  Both of these are probably the biggest problems, leaving things in memory that you aren't even using anymore.  And there is nothing Adobe can do about it except attempt to educate the masses.

  • Apple Mail client app (version 8.0) using 100%+ of CPU upon using mail drop (13" R-MBP running Yosemite 10.10)

    Hello Support Community,
    I am having quite the interesting issue. I have read plenty of reports where users' Apple Mail app is using 100% of CPU. This did not start for me until I went to go use the new mail drop feature in Yosemite. I am running Yosemite (10.10) on my 13" Retina - MacBook Pro (flash storage, 8GB RAM, 2.4 dual-core Intel i5) and my Apple mail is version 8.0. I have tried 3 different mail services (2 gmail accounts and iCloud), all result in the same issue. I have also done a complete erase of the hard disk and a brand new install of Yosemite, the issue persists.
    As previously stated my mail app is using 100% upon, and only while, using the mail drop feature. If I force quit the mail app and allow it a minute, the mail app returns to using less than 1% of the CPU and the app and entire system resume normal function. Upon attempting to resend the same message that is placed in my outbox the CPU usage jumps to 50-80%. After a few seconds, the CPU usage will sometimes jump higher than 100%, ranging from 130% - 199%. All of these observations were made using Activity Monitor. Of course you can see my frustration, an app using this much CPU stops every process my Mac is doing (using safari, messages, iTunes etc.) - the whole computer locks up. Even force quitting is a difficult process to attempt.
    Does anyone have a fix for this? I am at a loss and have no idea what to do. I am a pretty tech savvy guy and have tried everything that I would've thought would fix this. Is there anyway this could be a hardware issue? I don't think so but... all possibilities need to be taken into consideration, even though that one seems outlandish. Upon creating a new user account with a separate user library (but same system library) I figured the OS was the problem. I can't narrow it down to being a specific mail provider, and it can't be my OS since I have now erased and reinstalled 10.10 twice. Thank you!

    I have this same issue.  It has been driving me insane, Mac Mail uses 100% CPU most of the time I use it, after every time I open the machine, or after a sleep or even mostly after a screen saver has locked me out.  It normally settles down after 5-15 minutes, but then happens every time again.  It is killing my battery.

Maybe you are looking for

  • How to populate a selectOneMenu?

    hello, I am working with JSF + managed beans. I want to populate my selectOneMenu with "name" and the value must be "code" (for example) from dataBase. (name : jack , value: 1) I searched on the web, but only what I found is like : <h:selectOneMenu i

  • Toshiba laptop A100/105 Sound problem....

    I get no sound out of my satellite notebook,,,,tried exterior speakers still nothing, so I gone into devise manager under volume adjustment, there was nothing there. Could this devise be turned off elswhere?

  • Move Central Instance to Another Server

    Hello expert, Now we have a distributed system: CI on server 1, DB on server 2. Now we want to move the CI to another server 3 without change the DB server. We get some information from link Move the central instance to another server in SAP We have

  • Pop-up in event structure halts execution

    If I place a pop-up subVI in an event case of an event structure and this pop-up subVI contains a while loop and a stop button that would stop this while loop (thereby closing the subVI), will other events declared in the event structure be handled o

  • How to connect LDAP though SSL

    Hi, I had successfully configured iDS4.1 to be a Naming Information Server, and I applied a Test cert to it which generated from Verisign. Now I would like to let all LDAP client connect to my LDAP server though the encrytion port 636, what should i