Another big question!

Hi,
I'm sort of new to Java so I'll need some help on this one. I'm not new to programming, though. My question is how do you open a file in java for reading and writing. I want to be able to attach the file input stream to the data input stream so I can read stuff like integers, characters, booleans, strings, ascii characters, etc. How do I do this! Maybe a sample of code will be more clear...
Input...
File PollDB = new File("QvtfPoll.db");
FileInputStream FileIn = new FileInputStream(PollDB);
DataInputStream Input = new DataInputStream(System.in);
int YesCount = Input.readInt();
int NoCount = Input.readInt();
bool SaidYes = Input.readBoolean();
FileIn.close();
Output...
PollDB.delete();
PollDB.createNewFile();
FileOutputStream FileOut = new FileOutputStream(PollDB);
DataOutputStream Output = new DataOutputStream(System.out);
YesCount++;
NoCount++;
Output.writeInt(YesCount);
Output.writeInt(NoCount);
Output.writeBoolean(false);
Output.flush();
FileOut.close();
So you see, that's what I did. But my program freezes. What should I do?

This is not the right forum for your question. Try the regular "Java Programming" forum.
However, that code does look reasonable, except for using System.out in the second part. And naming variables with an initial capital letter will drive other Java programmers nuts.
When you repost this in the other forum, make sure to give details on exactly where it freezes and any other relevant symptoms. (Also check out the [c0de] tag for posting code snippets.)
-slj-

Similar Messages

  • The Big question...

    I am currently running windows XP, using a 20” Phillips flat screen as my monitor. I have no issues what so ever with this monitor using XP. I am running from the VGA out on my laptop (company PC, IBM) straight into my monitor. TV DVI is type DVI-I.
    I want a Mac Mini!!! So… The big question is.. Will I be able to use this monitor? As stated above, I have no issues with XP. The Mini comes with a mini DVI to VGA adapter. Shouldn’t I be able to plug right into this adapter and go using the cable I already have?
    Thanks much!
      Mac OS X (10.4.9)  

    Welcome to Apple Discussions!
    Indeed, given the presence of a VGA connector on the monitor and the DVI/VGA supplied with the mini, you should be able to plug the two things together and have them work with no problem. Unfortunately, without knowing the exact model of screen and there being someone posting here that has tried the same combination, it's impossible to tell you with absolute certainty that it will work - very high probability, but not certainty.
    How readily the combination works depends to a great extent on whether the display outputs a standard signal which identifies it and the settings it requires, such that the mini can detect it. If it does, it'll work and offer you a range of suitable and compatible settings. If it doesn't, you may need to use a third-party utility such as SwitchResX - which isn't easy but many have used with success.
    If the display also has DVI input, that's another option too of course.

  • I wanna make a ingame-purchase. . But i have a big question.

    Hello guys, Kindly help me out with this big question..
    I want to make a in-game purchase of 'Heros O&C' Cause i wanna make purchase.. I secretly make another iTunes acc.
    iTunes acc is mine, but App Store is under my dad account.
    So if I make the purchase, will it notified my dad too about the purchase ?
    Kindly reply me asap ! Thank you very much

    Thanks for the help. But now i have a problem.. 'The Purchase Could Not be Completed' I encounter this problem.. i tried contacting.. but they give me link to my problems that did not helped me.. Do you have any idea how to make purchasable again?

  • Preloader and Document Class BIG question (yeap please help)

    Hy,
    I know that this its a question posted many, many times, but
    after searching the net, reading a lot of books and searching this
    forum too, I cant get out with a solution. If I'd say for sure
    there is no possibility to create something like this, I just go
    back to old methods but is not the scope of Adobe with AS3 to
    encourage the use of OOP principle or not?
    The problem:
    I have a single fla file (AS3) with a single frame on
    timeline, frame that its there when you will create the file with
    flash. In the library I have different symbols, that for simplicity
    are only jpg image, (BitmapData) checked for export for
    ActionScript and exported on frame one. An external .as file called
    DocumentClass its off course my Document Class
    This its all that I want to do with the fla, the goal its to
    create, animate etc. only with AS3 in external classes, no timeline
    script. I don't want to load external files, XML, or else in this
    movie. I just want a single swf after compilation, no additional
    files.
    Ok, how do I create a preloader that will take care of
    starting the logic after the whole swf its loaded and in the same
    time shows the user a percentage or a load bar or something that
    its not the blank screen when the swf its downloading. I want to do
    this without another swf that load this swf, or timeline scripts,
    or place all the content on second frame and then gotoAndStop to
    the third frame. All this are not solution but cheap tricks, that
    are against all this OOP principle that I just continue to read in
    books and here from guru programmers.
    The big question is:
    It is possible to create a preloader, when use a document
    class with your fla? And if yes, how?
    I know that the Document Class its not instantiated if its
    not fully loaded, if that's true when the document class will be
    fully loaded? maybe after the whole movie its loaded? And, if its
    true, it will never show a percentage bar "while" the movie its
    loaded. And if that's true WHY use a document class anyway?
    Thank you for reading this and I really wait to get some
    answer.

    I am pretty sure you cannot do self preloader with one frame
    and all the objects in the library. I guess the key here is
    one-frame design. Screen refreshes (renders) only when all the
    scripts in the frame are executed - this is a very important thing
    to understand about how Flash works. Yes, you can force screen
    refresh with updateAfterEvent() method but it is attached to a
    handful of events only (MouseEvent and TimerEvent) but, again, all
    this functionality is available only after first frame scripts are
    executed. Thus, it seems like the only way to create preloader from
    within SWF is to use multiple frames and set library objects to
    load in later (not first) frame.
    quote:
    And if that's true WHY use a document class anyway?
    Well, preloader is the last thing that would be on my mind in
    terms of using AS3 ability to link DocumentClass to the top movie.
    This feature allows for very sophisticated architectural
    approaches. It has no connection to preloader as to any other
    features developer wants to implement. Neither it depends on or
    negates timeline. As a matter of fact, although I love one-frame
    applications, I find on numerous occasions that my application
    would be more efficient if I used several (at least two) frames.
    gotoAndStop is not deprecated. It is a valid MovieClip class'
    method. After all, having only one frame doesn't mean not having
    frames at all - there is one already. Frames are fundament of
    Flash. AS3 did introduce frameless entities like Sprite, etc. but
    it doesn't mean that frames are going anywhere.
    I would agree that timeline code is inferior to
    classed/packaged (read: better organized) code but, still, how is
    it not OOP? Frame is an Object, right? Why using timeline is cheap
    and not a solution?
    On a side note, I see too many times how some authors (and
    managers) are pushing their agenda (or close mindedness) onto their
    audience with no real substantiation. Claiming that timeline in
    Flash is not valid architectural decision from OOP standpoint is
    totally wrong. As wrong as strict adherence to design patterns. I
    don't think there is sharply defined "right" or "wrong" in
    programming. One finds the best optimal solution. The goal is to
    create something that works fine. Unless, of course, the process is
    the goal - but very few of us can afford focusing on the process.

  • Another newb question: multiple virtual servers

    Hi, I have yet another ignorant question. I have several unrelated web projects that I am working on, and I would like to be able to set up a virtual server for each one for testing purposes, such as: http://project1, http://project2, http://project3. Can someone tell me if this is doable, and if there are any tutorials/resources on this for someone who has 0 experience running a web serer? Sorry for being so ignorant!

    Yes, it is doable.
    You can setup virtual server either by IP or by name.
    If you have one IP, and want to set them up by name (ex. http://project1, http://project2, http://project3) you can do so easily with this type of configuration:
    <virtual-server>
        <name>mydomain</name>
        <http-listener-name>http-listener-1</http-listener-name>
        <host>*.mydomain.com</host>
        <document-root>/www/domain</document-root>
      </virtual-server>
      <virtual-server>
        <name>myotherdomain</name>
        <http-listener-name>http-listener-1</http-listener-name>
        <host>*.myotherdomain.com</host>
        <document-root>/www/myotherdomain</document-root>
      </virtual-server>
    ....The important part here is that
    a) all virtual servers share the same HTTP listener
    b) which virtual server serves the request depends on the $HOST request header send by the client. Sun Web Server does the matching for you. It will match $HOST vs. the virtual server's host attribute. Depending on which site you connect to the right virtual server will be used.
    c) if the $HOST request header does not match any of the virtual servers, then the default virtual server defined in the HTTP listener will be used.
    To create a virtual server, use the Admin GUI, access the configuration, and then add new virtual server. Or use the following CLI command.
    wadm> create-virtual-server --config=myconfig --http-listener-name=http-listener-1 --document-root=/www/docs/myserver.com --host-pattern=myserver.com --log-file=../logs/myserver.com-error_logs myserverHost pattern will be used for matching. Some of this elements might be optional.
    Hope that helps. And keep the questions coming :D
    Edit: Also check the documentation
    Using Virtual Servers in SJS Web Server 7.0

  • Another simple questions

    Hello friends:
    Another simple question: I need to learn things about Oracle on my desktop.
    My machine runs Windows 98. Oracle has some desktop product of its Database Line?
    For example: Oracle Personal?
    And Oracle Lite? What's the main difference between Oracle Personal and
    Oracle Lite?
    Thank You
    Gracias
    Ing. Pablo Romero
    CORDOBA ARGENTINA

    1. I didn't know the answer to your first question, but I googled it and it says the item is the in-call audio boost.
    http://forums.crackberry.com/f71/flag-icon-47659/
    2. isn't this setting determined by the carrier? So it's not a setting in the phone, but when you call in to your voicemail you can change your options?

  • Battery Big Question Mark Symbol

    My pre plus has suddenly developed a battery big question mark symbol. Any advice?
    Post relates to: Pre Plus p100ueu (02)

    Battery symbol with a question mark indicates no battery present in the device. You can try cleaning the battery contacts with a pencil eraser, or replacing the battery. 

  • BIG QUESTION Q MARK from Quick Time

    Hi, I need some help. I get the question mark in the QT logo. I tried everything posted before.
    I tried the System Folder.
    I tried the QT preference.
    I 'unmarked' the flash thingy.
    I installed the Flash 9.
    I used the Disk Utilities.
    I got the Preference Treatment.
    And still get the big question Mark in the QT logo.
    What other solution do you have?
    Thank you.
    Memo Uribe

    Peacekeeper227, To Apple Discussions.
    Which browser & version are you using?
    Quit QuickTime.
    Open User (Home)/Library/Preferences and delete any .plist file with QuickTime in its name. Don't worry as a new one will be created.
    Open System Preferences/QuickTime and see if the window and tabs work as they should.
    The following post should be helpful also: http://discussions.apple.com/thread.jspa?threadID=779076&tstart=0
    ===================
    If you are using Safari then I suggest that you check out Safari 2.0 Help Webpages aren't working (indicated by boxes with question marks)
    Good luck!
    P.S. Thank you for listing your troubleshooting solutions. It was very helpful.

  • Big question mark where iPhoto is

    Hey I just bought a new iMac and I M new to iMac but when I first got the computer
    Set up everything was fine but after I installed the applications disk and snow leopard there's a big question mark at the bottom where iPhoto should be and I can't open iPhoto. Any ideas on what to do?

    Then you need to re-install the apps:
    To re-install iPhoto
    1. Put the iPhoto.app in the trash (Drag it from your Applications Folder to the trash)
    2. Go to HD/Library/Receipts and remove any pkg file there with iPhoto in the name
    3. Re-install.
    If you purchased an iLife Disk, then iPhoto is on it.
    If iPhoto was installed on your Mac when you go it then it’s on the System Restore disks that came with your Mac. Insert the first one and opt to ‘Install Bundled Applications Only.
    For help re-installing iWeb, check on that forum.
    Regards
    TD

  • Big Question Mark

    We turned on our iMac this morning and there is just a big question mark on a folder. We are not able to do anything on the computer - it appears to be frozen.
    What should we do?

    Hi
    Insert the installer Disk that came with the mac (the gray one), reboot and hold down the C key. At the language screen click the right arrow. At the next screen select Disk utility from the Utilities Menu. Can you see the internal hard drive any more?
    If you can't the drive has failed and you need to replace it. If you don't have a backup you've lost all your data unless you want to pay for a Data Recovery Specialist and see if they can get the data off for you.
    If you can see the hard drive select the Repair Disk option. Hopefully this might get things working again.
    This is a question that has been asked many many times before. You could browse the forum for further options as to what to do thereafter. One useful resource is Apple's own User Tips Forum which is here:
    http://discussions.apple.com/forum.jspa?forumID=599
    Browse this forum and you should find more pertinent advice.
    Tony

  • BIG QUESTION-MARK ERROR on quicktime

    Re: My Quicktime does not play any more. It gives a BIG QUESTION MARK at the middle of the screen with no error message at all...I have a new computer with Windows XP. Since I downloaded the new version of Quicktime 7, the free download one, this problem started. It was fine previously.
    Any suggetion for remedy
    Thank you
      Windows XP  

    I found the response as below but where do you find "QuickTime Control Panel" as per the below response and "Browser" option. I looked around.its not in the QT menu... If this process does not work where do you find "free Flash Player ". Please assist.
    Thanks
    It's not a QuickTime problem or issue.
    You need to install Flash Player to view Flash Video formats. Once you've installed the free Flash Player restart your browser and try the pages again.
    If they still show a Q with a ? mark in it you'll need to open the QuickTime Control Panel and click the "Browser" tab. Click the MIME Settings button at the bottom of that window.
    Remove the check mark under "Miscellaneous" that says Flash Media.
    Quit and restart your browser.

  • Big Question on JSP

    hello jsp coders...i have a big question for you all it goes as follows.
    I have been developing e-commerce/web solutions using the java programming language through applets..that perform high end client/server..e-commerce solutions, and there has not been any problems encountered so far.
    Now the java J2EE platform has a lot of resources for web developers..e.t.c..one of which is the JSP or JavaServer pages and Servlets..now having gone through these latest technologies..i want to ask java/jsp gurus..whether there is a gain in moving to jsp from java applets...what benefits/advantages would one benefit from such migration...plus all the additionalities...and also any sun resource/technical documentation/tutorial/books that specifies more on jsp.
    I would really appreciate it.
    Thanks in advance.

    When you move from a client/server system design to an intranet/web-based design sans-applets, you get these benefits:
    1. No software to load on the client computers!!!
    2. Users can access their applications from any computer.
    3. The user should/might/could see a speed increase.
    These 3 reasons, above all others, was why we decided to remove applets from all of our web pages.
    The downside is that you are stuck with using only html input fields, list boxes, etc. No more fancy JTables. You will also need to get jiggy with JavaScript.
    P.

  • BIG Question regarding INIT Loads..I am scratching my head for past 2 days

    Hello All,
    I have one big question regarding the INIT load. Let me explain you my question with an example:
    I have a datasource say 2LIS_02_ITM for which I ran the setup tables on JAN 2008. The setup table is filled with say 10,000 records. After that we are running Delta loads everyday till today (almost 30,000 records). Everything is going fine.
    Imagine I lost a delta (delta failed and did'nt I do a repeat delta for 3 days, by then next delta came), Hence I am planning to do a Init load again without deleting / filling the setup tables. Now my question is :
    1) Will I get the 10,000 records which got filled initially in the setup tables or will I get 40,000 records (that 10,000  + 30,000 records)
    2) If it bring 40,000 how is that possible as I hav'nt filled the setup tables?
    3) Is it each time I need to fill the setup tables to start the Init load.
    Waiting for your guidance.........

    Yes...to answer your question
    But...agin I will suggest not to go by that method. Only one delta had failed so why do you want to wipe away the timestamp of the last init just becasue of 1 delta failure? it is possible to correct it
    First of all  i hope you have stopped the process chain or put a hold to Delta jobs
    Now, To answer your doubt, about the status red ..See you mark the status red in each of the the data target before delting the failed request from there (I usually do not just delete the requests frm data targets - I mark them red and then delte it to be safe).
    Do not forget to delete subsequent requests afterthe failed delta (agin I always mark them red  before doing so)
    Regarding the actual reuest itself...you need not mark it red in the monitor..You have got to correct this request and successful - it will automatically turn green.
    If after successfully correcting the request, it still does not turn green, you can set qm status green. The next delta will recognize this a successful request and bring in the next delta (this happens in cases where you have the infopackage in a process chian when it shows green because subsequent processes were not completed etc).
    Let me know in case you have any questions.

  • Re: another build question! (sorry lol)

    Hi all
    right, after days and days of researching all the excellent articles on here ive had to write a post! So apologies for going over old ground
    Im going to build a new CS5.5 rig (having had a guts full of Apple and their FCPX fiasco its back to pc!)
    so although i appreciate the 990x o'c is prob best option, bang for  buck is leading me down the sandybridge i7 2600k o'c option on p67 mobo with 16gb of ram (option to take to 32 down the line when the chips are out)
    anyway, im sorted on chip mobo (msi big bang marshal p67), nivida 570 etc , its the drives im struggling on!! Im edit avchd video and some after effects, small amount of 3d, and in FCP i always transcoded everything to prores. Now on cs5.5 it looks like real time performance is possible with high end hardwear.
    So mobo, ram, and chip aside, my HDD config im unsure on, ive not really got the cash to go crazy with raid controllors etc, but understand need for seperate drives, etc and tbh might even go downt he cineform route as a prores alternative (prob avoiding hassles of drive speed with avchd)
    im thinking as the SSD's are now dropping in price and the ocz are producing these 500 mb r/w speed sata 6 120gb drives for a reasonable price, would 3 of these drives (one for os, one for media , one for scracth disk ) be a good set up or is it a waste of cash and should i raid 0 from bios/mobo?
    I appreicate that 120 gb drives for media etc are small, but i would take project media from another much large backup drive and just use the 3x ssd set up as working disks for editing & os? once project over, clear out drives to larger back up and start new project!
    Its either that or i go SSD as bootdrive, but some sort of cheap raid set up for my scratch disk, media drives? prob is if i do that, from what ive read (brain dead now) i would be best off with 2 x raid 0 as scratch disk and orginal media respectively when workign with avchd
    HOWEVER, on my mobo there are only 4 sata 6 ports, so if i use one for ssd boot drive, and then im left with 3 x sata 6 ports and another 4 x sata 3 ports to raid on? how does this work? any point in getting the sata 6 drives as one would be stripped with a sata 6 drive plugged into a sata 3 port (this was my reasoning behind using 3 small sata 6 ssd's plugged to the sata 6 ports  and rest of sata 3 ports as storage and backups!
    confused lol!! I just want the overclocked sandybridge system with decent gpu card, as much ram as possible at present, but im thinking my bottleneck will be in the HDD config! any suggestions are much appreicated! im not that techy so whilst have read all the articles am more confused now (plus normally a mac user, so its out of the box configuration usually!) for what its worth looking to purchase something from scan uk in terms of parts! total build cost including a reasonable screen £2,000
    many thanks

    You have a limited budget, especially in the UK, but then don't we all?
    Going for the 980X will triple the cost of the CPU, but even when editing AVCHD material the gains are not sizable enough IMO to justify that cost differential. Add to that you will need 24 GB instead of 16 GB and that carries an additional price tag. Both factors will easily move you out of budget range if you want to have a number of disks and possibly a raid controller.
    Did you read my article To Raid or not to Raid, that is the question. It can be found under the Overview tab at the top of the page? (Currently responding from abroad on my notebook and not having the bookmarks available for easy linking). http://forums.adobe.com/thread/525263
    With media and projects I would advise against a raid0, because of the lack of redundancy. For pagefile, media cache and previews (scratch disks) raid0 is quite OK. They will be recreated if needed. The performance gain from a raid0 for media and projects over a parity raid is easily offset by the time spent on making backups. For parity raids do not use WD Caviar Blacks, but look at the Hitachi 7K3000 line of disks.
    The question of Sandy Bridge versus the old X58 platform is essentially one of 'which limitations are acceptable to me'.
    The Sandy Bridge is a great processor and at least the equal to the old i7-9xx quad cores. However, the platform, the chipset, has its shortcomings in terms of PCIe lanes. Whether that is relevant to you, only you can decide. But hey, we would be in serious trouble if Intel did not manage some progress in two years time from the i7-920 to the i7-2600K. So of course the i7-2600K shows much more potential than the almost retired 920, it is the chipset for the Sandy Bridge that is 'flawed' in comparison to the X58, but that is no surprise, since the Sandy Bridge is a 'middle-of-the-road' platform and the X58 was a 'high performance' platform.
    BFTB-wise I think that within your budget limits, you should look at the i7-2600K, but with the best disk setup you can afford.

  • Another BW question about filter in the query definition

    Hi ,
    I have another question about filter in the query definition.
    <u>Question:</u>
    Which of the following objects can be filtered in the query definition?
    A. characteristic
    B. Key figure
    C. Structure
    D. Units
    E. Hierarchy
    My answer is A,B,D,E.
    The answer in the book is A,B,D
    Can anybody tell me which one is wrong?
    Thanks in advance,
    Liu Jia

    HI
    1.The answer could be A,B,D.you can not apply filters on hierarchies
    2.Whenever there is a change in Attribute data(like Location,Num etc...)that has to be reflected in all aggregates of the cube.Thsi can be done by running "ATTRIBUTE CHANGE RUN".
    sri

Maybe you are looking for

  • Animated GIF's not working 5310

    I've tried to use some animated GIF's for screensavers, but I'm not getting the animation !! They work OK in windows. Can someone confirm what size and format they need to be for my 5310 XpressMusic Thanks Solved! Go to Solution.

  • File count is incorrect

    I have a windows 7 Pro desktop that is up to date. Attached to it is a RAID 5 hardware array that has 5x1GB drives. It contains a large number of files that are roughly 200-300 MB in size spread through about 7000 subdirs. If I search for the files i

  • IPhone 3GS has stopped recording video - please help

    Hi - I have recently updated my iPhone to iOS 5...... I don't know if my problem is related to that fact - but yesterday the iPhone stopped recording video..... It has been recording video fine recently (after the up-date) - but now when I click onto

  • Problem in activating Process chain in Quality after transport

    Hi All, We have moved a set of process chain to Quality system. When tried to activate the Process chain it is showing error in DTP. The DTP name is same as in the Dev system. So, we tried moving the DTP alone in another transport request. Still the

  • Delivery date and loading date is same

    Hello , Issue decription: The system calculating delivery=loading date , though the route is maintained for 9 days trasit days. This problem is with only one routeA. When i have created SO for material M123 with route "B" shipping Point 0001, the sys