Saving the state of an application - db, file, object?

Hi, this is a general programming question,
I don't understand when to use databases, files or just save objects to save a state of an application. If you can point me to a tutorial, that would be very helpful. Here I have specified my problem.
I am creating a personal finance application. I am planning to have a month-object, which saves all my transactions for the month.
I could create a database for all the transactions, and I guess it would be quite easy to get all the data from the database so that every time I start my application I would see my current financial situation.
My questions is if there are other options for this.
1. Writing to a file
- What kind of a file can I write? Is it my own xml-style text-file from which I have to search for every data by an algorithm I have created myself?
2. Objects.
- I know I can save the state of an object to a file, which doesn't seem too complicated. When should I use this option.
Thank you for any help on this question.

I don't understand when to use databases, files or just save objects to save a state of an application. If you can point me to a tutorial, that would be very helpful.I doubt there's a good tutorial covering that, though I'd be delighted to be proven wrong.
Here I have specified my problem.Excellent. This is what's known as "asking the right questions" :-)The XMLEncoder and XMLDecoder classes can be used to translate objects to and from XML files.
The ObjectOutputStream and ObjectInputStream classes can be used to translate objects into and out of binary files.
You could also, naturally, create your own file format(s) and translators.
Finally you can use a database. You could use JDBC directly, or you could use one of the Object Relational Mapping (ORM) tools instead.
Which to use?
If you want to keep it simple go for the XML encoders. They're easy to use and you can read the file format.
If you think you're likely to want to perform some complicated operations on the data, and particularly if you anticipate accumulating more data than will conveniently fit in memory at the same time, then consider using a database.
You shouldn't use an ORM tool until you're very confident with JDBC so I'd rule that out for now.
Given that you're asking this question at all, I would suggest the XML encoders for now.
Thanks for asking the right sort of question - too many users pick a technology then demand that we help them use it without ever considering if it's actually appropriate. You're being smart. Well done.

Similar Messages

  • Creating a Mavericks USB boot drive after the horse has bolted.  Can I create a bootable USB drive from my iMac after installing Mavericks without saving the Install OS X Mavericks.app file?  Do I need to re- download the whole 5.29 Gb again?

    Creating a Mavericks USB boot drive after the horse has bolted.  Can I create a bootable USB drive from my iMac after installing Mavericks without saving the Install OS X Mavericks.app file?  Do I need to re- download the whole 5.29 Gb from the App Store again?  My problem is my 4Gb/month allowance on a 12 month contract.  I cannot purchase a data block from my ISP and although my speed is theoretically slowed to 64k after reaching my 4Gb, it actually ceases to download in reality.

    HI tasclix, it depends what you mean by an OS X boot drive.
    If you want a recovery disk from which you can reinstall (by re-downloading) or recover from a time machine backup, then nbar is correct.
    If, however, you want to boot and run the OS X installer from the USB drive (so that you don't need to download again), then you will need a copy of "Install OS X  Mavericks.app"; see this article:
    http://support.apple.com/kb/HT5856
    Before downloading again, search your system to see if the installer is still there - it's usually in the /Applications folder unless it has been deleted, but check your whole system for it anyway, you never know, you might still have it somewhere.
    Message was edited by: SilverSkyRat

  • Where can I download the SOA Order Booking Application Zip files

    the URL of Zip files is http://www.oracle.com/technology/soa/,which is descriped in SOA suite developer's guide,but I can not find it.where can I download the SOA Order Booking Application Zip files,thanks

    The doc:
    http://download-uk.oracle.com/docs/cd/B31017_01/core.1013/b28937/toc.htm
    the zip:
    http://www.oracle.com/technology/software/tech/webservices/index.html
    SOA Overview
    http://orasoa.blogspot.com/2007/05/newbie-getting-started-with-oracle-soa.html

  • Saving the currently watched video to a file

    Hi All,
    I wanted to know if there is any way in SMP to save the video that is currently being viewed to a file? (or save the video segments in case of dynamic streaming, and make a video out of it). I basically want to compare the "watched video" to the original video and do some analysis on the observed performance.
    I thought it might be good to start a new thread for this. My initial post was here: http://forums.adobe.com/thread/707393?tstart=0
    Thanks much for the help.
    SR

    The source you can modify is in OSMF core framework not in SMP. Also, the application must be a stand along player such as an AIR application. A Flash based application cannot store the frames to a file.
    For http dynamic streaming, OSMF downloads each fragment and send it to the Flash Player. What you want is to store the fragments in files. You can take a look at HTTPStreamingF4FIndexHandler. It has two methods of your interest: getFileForTime and getNextFile. It is quite clear at the source where you can get the URLs to the fragments and go from there.
    -Wei Zhang
    Senior Computer Scientist
    Adobe Systems, Inc.
    [email protected]

  • Saving the web content to a pdf file

    How do I save the web content which is basically a report to a pdf file?

    There are a number of options. If you are familiar with XSL-FO, you can use Apache's FOP to produce PDF. You can use i-Text to work with java objects that generate PDF elements. I believe there are also additional offerings. However, both of the above are free.
    - Saish

  • Saving the output of java programs in files

    How I do save the output of a program to a MS - DOS file ?

    import java.io.*;
    use FileOutputStream /BufferedOutputStream class.....
    read tutorials or books about JAVA on these technology
    U can find many examples in this site too

  • Why is it that when I saved the waveform of my acquired signal into a wav file, the output waveform of my saved file turn out to be different from my input signal?

    Hi all,
    I am currently doing a heart sound analyzer project. I acquired signal using NI USB 6008 continuosly. My program is able to saved the acquired signal into a wave file. But when I browse open the saved file, the output waveform did not look the same as the acquired input signal and also the sound of the heartbeat captured cannot be heard from the loud speaker though I have saved the file as a wav file. I am not sure if the method i use to save the acquired data as a wav file is correct.  I have attach the print screen of the differences of the output I have notice and the program I have created. I would be glad if anyone here is able to troubleshoot my program.
    Thanks. 
    Attachments:
    heart sound analyzer.zip ‏257 KB

    Hi Brett Burger,
    Thanks for your reply. For your information, I have set the sampling rate as 10000 as for the sound format, I have set the bits per sample as 16 bit, the rate as 11025 and the sound quality as mono. I tried using your method by changing the sampling rate as 8K but still my program encounter the same problem.
    I wish to also create a button that is able to generate a preformatted report that contains VI documentation, data the VI returns, and report properties, such as the author, company, and number of pages only when I click on the button.  I have created this in my program, but I am not sure why is it not working. Can you help troubleshoot my program. Or do you have any samples to provide me. Hope to hear from you soon.
    Many thanks.
    Regards,
    min
    Attachments:
    Heart Sounds1.vi ‏971 KB

  • Windows domain controller in a virtual machine: how dangerous is saving its state for a short period of time?

    I have a Windows Server 2012 R2 virtualization cluster. All the hosts are connected to an external storage system, and virtual machines' files are stored on external volumes (CSVs). All the hosts and virtual machines are a part of the same AD domain
    (mixed Windows Server 2012 RTM / 2008 R2 domain controllers). All the domain controllers are running in the virtual machines on the hosts of this cluster.
    To prevent problems when all the hosts are turned off and then on simultaneously (for example, because of a power failure) all the domain controller VM files has been placed on local disks of the virtualization hosts (not on the Cluster Shared
    Volumes). As Hyper-V services don't depend on other Windows Server services (except its networking components), it means that my domain controllers can always start, providing the virtualization host can start at all. However, it also means
    that those DCs cannot be (quickly) migrated to other hosts while their current hosts are being rebooted. So if I need to reboot a virtualization host to install new updates, for example, I have to shut down the corresponding DC, reboot the host
    and wait for the DC to finish cold boot and come back online. It means some interruption of service for our users, which, in turn, requires me to perform the reboots late in night.
    The downtime can be significantly decreased by saving the state of the VM in which the DC is running. However, all the articles I've found on the Internet strongly recommend against it. I'm trying to understand why this recommendation was issued in the first
    place. However, I'm unable to find a clear explanation. I've found some statements that saving state of a DC can cause serious AD replication problems because of tombstoning, and that the password of a DC computer account may be changed
    while the DC itself stays in the saved state, which could prevent the DC from connecting to the domain after its state has been restored. However, those considerations are non-significant when we discuss a short-time
    (5 to 10 minutes) saved state.
    I work with AD and virtualization long time, and I fail to see any danger in saving state of a DC for several minutes. In my opinion, after its state has been restored it would simply replicate all the AD changes from other DCs, and that's all.
    What's your opinion?
    Evgeniy Lotosh
    MSCE: Server infractructire, MCSE: Messaging

    Hello,
    as stated in "http://technet.microsoft.com/en-us/library/virtual_active_directory_domain_controller_virtualization_hyperv(v=ws.10).aspx"
    Operational Considerations for Virtualized Domain Controllers
    Domain controllers that are running on virtual machines have operational restrictions that do not apply to domain controllers that are running on physical machines. When you use a virtualized domain controller, there are some virtualization software features
    and practices that you should not use:
    Do not pause, stop, or store the
    saved state of a domain controller
    in a virtual machine for time periods longer than the tombstone lifetime of the forest and then resume from the paused or saved state.
    This may sound as it is supported to store it for shorter times and use it.
    BUT recommendation also from the Hyper-V Program manager in
    http://blogs.msdn.com/b/virtual_pc_guy/archive/2008/11/24/the-domain-controller-dilemma.aspx recommends against using them.
    Also best practices
    http://blogs.technet.com/b/vikasma/archive/2008/07/24/hyper-v-best-practices-quick-tips-2.aspx
    Best regards
    Meinolf Weber
    MVP, MCP, MCTS
    Microsoft MVP - Directory Services
    My Blog: http://blogs.msmvps.com/MWeber
    Disclaimer: This posting is provided AS IS with no warranties or guarantees and confers no rights.
    Twitter:  

  • Preview starts saving the changes in pdf doc and leads to freezing

    I was reading a book in preview and i did some highighting work in the ebook.
    Preview started saving the document(showing increasing number of file saving 2,then 3.....so on it went till 8)
    this actvity did not gave me any access to my document to scroll and study furthur and all of a sudden the fans started spining at the max speed,preview consuming at aroung 1.45gb of ram(i checked it from activity monitor)
    as a result i had to force close preview
    this proccess repeated everytime i opened the ebook(3-4 times i tried).
    Can anyone help me out of this problem or i should think of adobe pdf reader rather than the preview.
    Here is a snapshot it took while it was showing saving 2 documents

    I was reading a book in preview and i did some highighting work in the ebook.
    Preview started saving the document(showing increasing number of file saving 2,then 3.....so on it went till 8)
    this actvity did not gave me any access to my document to scroll and study furthur and all of a sudden the fans started spining at the max speed,preview consuming at aroung 1.45gb of ram(i checked it from activity monitor)
    as a result i had to force close preview
    this proccess repeated everytime i opened the ebook(3-4 times i tried).
    Can anyone help me out of this problem or i should think of adobe pdf reader rather than the preview.
    Here is a snapshot it took while it was showing saving 2 documents

  • Application Mime File Type Preferences

    I'm stumped!
    I've gone through the entire user preferences, application support files, and library files and still cannot locate which file is containing the settings for mime type application association with .php files.
    I am having an issue with Firefox only downloading .php files instead of displaying them in the firefox browser. The .php files continue to be associated with the dreamweaver extension and icon and continue to to tell firefox to download instead of rendering.
    I was so frustrated, I did a clean install onto another hard drive (OS X 10.3.9 drive 2)and was able to get firefox to work on the new system os. Again, I have trashed all the dreamweaver files, trashed all the firefox files and settings and even after doing a reinstall of firefox I continue to get the same issue on the older install 1 os x (10.3.9 drive 1). Drive 1 has all my precious files, years of settings and other data that I want to keep. I just want firefox to render .php pages off my local drive instead of trying to download them.
    Can anyone help me find the file I need to trash to make this happen? What am I missing?
    Thanks,
    Frank Beier
    Findlay, Ohio

    File and application associations are set using the Get Info window by selecting the file and pressing COMMAND-I. Settings are controlled in the Open With section. You can also use the freeware preference pane RCDefaultApp (www.versiontracker.com or www.macupdate.com.)

  • How to get the current directory as File object

    Hi guys,
    i want to get the current working directory as a file object.
    plz help me on that if there are any standard methods present for this.

    new File(".");

  • Application-defined or Object-defined error

    Hello,
    When I open Input schedule through open dynamic templates I get the following error message
    Application-defined or Object-defined error
    Version : BPC 7.0
    SP05
    Request your guidance.
    Thanks,
    Ramsiva

    I have experienced much the same problem which I have documented in details here:
    Excel Spreadsheet being opened in preview mode by some machines
    (Note that I am only surmising the preview mode is the problem as I get the exact same error if I open it on the Development machine in preview mode).
    My only workaround at the moment is to open the spreadsheet on the target machine and then replace the vba code and save the file locally (Copy Paste), or apply a digital certificate to the existing VBA code, although the latter only seems to work sometimes.
    If I fix the problem on the target machine and then copy, open and close the file on the development machine when the file is sent back to the target machine the problem occurs again.
    I have ruled out emailing being the problem as I have copied the file instead of emailing. 
    The development machine had a number of Office applications and Windows 7 updates applied around the time that the problem occurred, i.e. one day everything is fine, the next day it is impossible to run a new spreadsheet on certain machines.
    The highlighted error is also with a .select statement but I isolated the code and put it into a test spreadsheet and that ran okay so it seems to be a more subtle problem.
    It doesn't happen on all the machines and I can't see any pattern as to what machines it works on and those it doesn't. They are mostly Windows 7 64bit running Office 2010 and 2013, seems to be about 50/50 split as to working and not working. 
    I've ensured that the Windows Updates are up to date on all the problem machines.
    I think it is the same problem and it helps knowing that someone else has experienced the same thing in order that I don't think I'm going crazy but it's a major problem for me and none of the suggestions so far seem to be close to explaining what is going
    on.
    If anyone wants samples in order to investigate the problem I am more than happy to send them the spreadsheets. 

  • Statement and ResultSet Interface type of Object

    Hi,
    Can any one explains me where exactly (in which Class) the implementation of the Statement and ResultSet Interface type of Object Instance be created
    Regards
    Krishna

    I dont really understand what you are trying to ask but:
    Your JDBC driver has concrete implementations of Statement and Resultset. If you want to know what classes are being used try something like:Connection con = ??;
    Statement st = con.createStatement();
    ResultSet rs = st.executeQuery( "???" );
    System.out.println( "Connection class: " + con.getClass().getName() );
    System.out.println( "Statement  class: " + st.getClass().getName() );
    System.out.println( "ResultSet  class: " + rs.getClass().getName() );

  • File objects in jar file

    Hi!
    Is their some kind of way one can use File objects in a jar file plz? I have a project which is complete and working well on the IDE but now that I have jarred it, i've come to realize that apparently file objects do not relate well with .jar files. The problem is that the program makes a lot of file manipulations and changing everything to getResource, InputStream etc would be very lengthy. So there's absolutely no way in which one can use File objects in jar files?
    Any help would be very much appreciated!
    Thanks and regards,
    Krt_Malta

    You can use the java.net.JarURLConnection class (use file:/// when creating the URL) to get a URL to a jar entry, create a URI from the URL, and then create a File object on the URI.
    Or use java.util.jar.JarFile methods and its associated classes to get jar entry contents.
    While you can use these approaches to create File objects from a jar, they are not any easier than what's already been mentioned.
    And all you can do is read or delete a jar - jar entries can't be rewritten.

  • To Save in Lookout the State file from the application

    I need that the program loads the variable values when start up like when it was written or designed. Also, I need that a autotuning process in the application loads and saves by program the values found for 4 valuables, so when the application is started up again, will hold the result of the last autotuning and all the rest like when was written the application. I think to save the State File aafter the autotuning can be a way.
    How get this? Other ways?

    JTJams is absolutely right! You don't want to depend on the state file for mission-critical settings. DataTable and the XLS file is a good approach.
    Having said that, would like to add the following for completeness: the state file can be used for not-so-critical settings. As you know, the L4T file gets saved automatically; every hour by default. You can however make this as low as 1 minute. It also gets saved when the process is closed.
    One trick you can do (as explained in the online help), for a particular process whose state you want to preserve: bring the process to the right state, go into its properties and uncheck the "Save state file every..." check-box. Close the process thus saving its L4T file. Now, change the file-permissions
    on this L4T to read-only. From now on the process gets loaded with this state.
    My two cents..
    Regards,
    Khalid

Maybe you are looking for