How to use random access file to access file in disk?

I have tried to use random access file stream to access the some files saved in disk, but not very successful. I want to know how I can find a particular file in the disk with file locator or sth else.
Suggestion is highly welcomed, if you have codes to put, I will test it.

The scenerao is:
create a randomAccessfile
write 100 blank records( for future use)
open this file
write data to the records inside file
close the file.
I will try to put a testing code for you later on.

Similar Messages

  • How to use Connection Pool in ADF ear file creaion from jDev 10.1.3

    Hi,
    We are developing big application in ADF with 10 different modules. We are creating ear file with data source setting.
    How to use connection pool while creating ear file from jDev. Connection pool is alreday created in Application Server 10g.
    What all the setting we need do to make use of connection pool while creating ear file jDev.
    Thanks

    User,
    If you are using ADF Business Components, you can right-click each application module, select "configurations" and edit the configuration you are using. On the initial page of the configuration dialog, you can specify to use either a JDBC URL or a Datasource - you just need to choose Datasource and then provide the name by which to access it.
    John

  • Okay so I set up my Time Capsule already and is now backing up 2 of my iMacs. Works great. What I want to know is how to use the TC to directly store files? I want to do this to delete some files but still have them on the TC for future reference..

    Okay so I set up my Time Capsule already and is now backing up 2 of my iMacs. Works great. What I want to know is how to use the TC to directly store files? I want to do this to delete some files on iMac 20inch but still have them on the TC for future reference..eg some movies on iTunes. I want to directly save them on the drive so I can delete them from iTunes and gain some storage. (Ps on iMac 20 inch (it's almost full - 320 GB) when I enter time machine, a tab comes up on finder which reads "Time Machine backups" it's able to be ejected like a disc or a connected device. On the iMac 20 inch, I dragged some files onto there as if using it like a hard drive. Is this the correct method? Then I went to my 27inch iMac and saw the "Time Machine Backups" hoping to see the files I dragged from the 20inch iMac. But the files were not there except a folder that said "Backups.backupdb". Can someone help me?

    It's not a good idea to use a network disk for both Time Machine backups and other things.  By design Time Machine will eventually consume all the space on its output disk, which will then cause problem for your other files.  I'd store those other files on an external disk connected to the Time Capsule.  The problem with that is that Time Machine will only back up files that are local to your Mac.  That means that you'll only have one copy of the files on or attached to your Time Capsule.
    By the way, you've been misled by poor field labeling on this forum into typing a large part of your message into the field intended for the subject.  In the future just type a short summary of your post into that field and type the whole message into the field below that.

  • How to use Xerces to validate an XML file against a DTD

    Hi, can anybody tell me how to use Xerces to validate an XML file against a DTD. its urgent. post some sample code. it would be helpful for my project. isupposed to use SAX parser(Xerces)
    Thanx in advance

    Come on, I googled "xerces validate" and the first link is the Xerces FAQ:
    http://xerces.apache.org/xerces-j/faq-general.html
    And of course "how to validate" is a Xerces FAQ. Help yourself by doing a little research instead of waiting for other people.

  • How To Use Client Side Certificate to access the SOAP service

    HI,
    I am client side and need to access a remote SOAP server side using a certificate.
    I don't know how to add the certificate in my Java code, although I can get it using X509Certificate. The following is my code.
    Thanks for any help
    public class Dash911 {
    public static void main(String args[]) throws IOException {
    try {
         //I have a Cert class that generate the cert          
    X509Certificate certificate = (new Cert()).getCertificate();
    String targetURI= "http://schemas.ecs.telefinity.com/webservices/postal/";
    String methodName = "FindStreet";
    String encodingStyleURI = Constants.NS_URI_SOAP_ENC;
    Vector params = new Vector();
         String[] names = {"Westcorp", "35805"};
         params.addElement(new Parameter("names", names.getClass(), names, null));
         String endpointURL = "https://prototype.test.telefinity.com/integrationprovisioning/postal.asmx";
         makeCall(targetURI, methodName, encodingStyleURI, null, params, endpointURL);
         } catch (Throwable t) {
         }//main          
    Thanks a lot

    Keystore or Truststore may be rigtht the same file, the matter is how you use it
    at each time: if you need to authenticate yourself (no matter wether you are a
    server or a client), you will have to initiate your SSLcontext with such file
    managed by TrustManager. On the other hand, you just do same but
    indicating your file is shall be managed by a KeyManager.

  • How to cut random frames in a video file

    Hi,
    I want to know how we can cut random frames in a video file using JMF? Please help!
    thanks in advance.

    Thanks for the answer, Is there any other way to do this using som plugins ot tools?

  • How to use same object in another vi file.

    Hi i am new to OOP in labview.
    How to use (ACCESS) same Object in multiple VI fiels in labview.
    in c# if we use same name space , then we can acces the object .
    i dont know how to use it in labview.
    and also i need to know , how to use oop in large applications

    Well LVOOP tries to be this...
    And the Actor Framework tries to be this... Using some of LabVIEW's object oriented components.
    You can have LVOOP without Actor Framework, but you can't have the Actor Framework without LVOOP.  You can however have other actor based designs without LVOOP but honestly few go this route because classes help force the developer to work inside the constructs of the design.
    Also quit yelling so much.  And before you try taking on LabVIEW's object oriented designs (and Actor for crying out loud) I'd suggest taking some beginner training which can be found at the bottom of this page.
    https://decibel.ni.com/content/docs/DOC-40451

  • How to use multiple table in single control file?

    Hi,
    How to use multiple table and data file in sigle control file? I have a four table and four csv file i mean data file for that. I am running concurrent program to load the data from csv file to custom table. based on my input data file name, it has to take automatically from one control file.
    Can anyone share with me how can i acheive this?
    Thanks

    Hi,
    Can't we acehive like below. I don't this exactly corrcect.
    OPTIONS (SKIP=1)
    LOAD DATA
    INFILE << file name 1 >>
    APPEND INTO TABLE XXCZ_VA_SAMPLE1
    FIELDS TERMINATED BY "," OPTIONALLY ENCLOSED BY '"' TRAILING NULLCOLS
         PARENT_ITEM               "TRIM(BOTH FROM :PARENT_ITEM)"
    LOAD DATA
    INFILE << file name 2 >>
    APPEND INTO TABLE XXCZ_VA_SAMPLE2
    FIELDS TERMINATED BY "," OPTIONALLY ENCLOSED BY '"' TRAILING NULLCOLS
         ITEM_NUMBER               "TRIM(BOTH FROM :ITEM_NUMBER)"
    )Edited by: orasuriya on Sep 14, 2009 3:03 AM

  • How to use multi queries inside the RTF file

    Hi all,
    I develope a data source in report developer 10g, and use it to create the RTF files... I have some files wich contains more than 1 query. how can I refer to the fileds in the other queries in side the RTF file, because it's bring the filed from the first query by default??
    ThanX in advance

    ThankX DD
    But that wont work for my case. the problem that I have actually is in RTF.
    for example:
    I have 3 qeuries. A,B & C. A: contains the employee data. B: his Earnings and C: his Deductions.
    in the RTF file it shows me only A contents. wich means it's not entring B & C loops, notice I add <?for-each:B_GROUP_NAME?> and same for C also.
    all my other reports wich have single qeury worked fine.
    Regards to all,
    Message was edited by:
    Adam Ali

  • How to use the applet to upload the file ?

    I am facing a problem that , I don't know how to use applet to upload the file to server .
    I have the code to upload the file by using servlet .
    However , I want to use applet to upload the file .But , the format of servlet I have used is "multipart/form-data"
    but applet can not do so , I think it is the header of the data . I don't know what can I do .....
    Can anyone give me some suggestion or coding to write the file upload by using applet ?
    Besides , using the socket are there any other choices ?
    thx a lot !!!!

    Well, to upload files you need to
    Server App - running on the webserver
    1. Open a socket
    (Study the classes Socket, InputStream, OutputStream in the Java API)
    2. Wait for connection.
    3. Open FileOutputStream
    3. Read data from InputStream, Write to FileOutputStream
    4. Close InputStream and FileOutputStream
    Applet
    1. Open a filedialog (Swing, AWT)
    2. Open file (FileInputStream)
    3. Connect to uploadServer (steps described above)
    4. Read FileInputStream, write OutputStream
    5. Close File and Socket
    This is just simpl and basic terms get you on the right track
    Jonas

  • How to use Terminal to Find or Locate files without extensions?

    I'm conversant with the cli, but not a power-user.  I've discovered a fairly large number of audio files, across dozens of sometimes nested folders, that (somehow) lost their '.aif' extension and now appear as Unix Executable Files.  Upon appending said files with the proper extension, they are perfectly normal audio aif's.
    My Problem: using the Terminal, how can I search a directory tree to find those files *without* an extension, discriminating between files and folders, and then append the correct extension to only the files?
    I've tried a number of queries, mostly built around the idea of using 'filename.*', but for some reason searching for an extension omission (as opposed to a specified string) isn't so simple. 
    The following: ls -al *.
    Brings up 'No such file or directory'
    And the following ls -al .*
    Brings up files AND directories
    I need o discriminate between files and directories, finds all files without extensions, and rename them with the appropriate extension.
    Can anyone help?
    Best, Tom

    The following will find files without a file extension in the current working directory and any sub-directories->
    find . -type f ! -name "*.*"
    If you are confident that the files found are the appropriate audio file (in this case aif) then you could->
    find . -type f ! -name "*.*" -exec mv {} {}.aif \;

  • How to use certain entries from a txt file as metadata?

    So during my plugin development I stumbled on a problem.
    I have created a txt file for each picture telling me who's in the photos. So the first column in the file shows all the names that appear in the photo.
    I want to add those names into LR for each photo. I thought using them as metadata would be a good idea. Then I could let the user enter a name of some person and create a smart collection having all photos with that person in them.
    But putting it into practice isn't that easy.
    So I started with the classic metadata definition:
    metadataFieldsForPhotos = {
      id = 'Person',
      title = 'Person'
      dataType = 'string',
      searchable = true,
      browsable = true,
    Now I don't know how to actually read only the column entries of the txt file and displaying all the names appearing in it. Another problem is that each photo has its own txt file in "nameofphoto.jpg.txt" So LR must know which txt file belongs to a photo.
    I know my question isn't very specific but it would be great if someone could help...

    Thank you for the reply. Reading the file how I wanted worked fine and I chose to use keywords, as you suggested.
    So now I tried to add the keywords to the pictures and I get:
    "LrCatalog:withWriteAccessDo: could not execute action 'keywordProvider'. It was blocked by another write access call, and no timeout parameters were provided."
    There's my function so far:
    function Finder.findPerson(smartCollectionName)
         local catalog = LrApplication.activeCatalog()
         local photos = catalog:getMultipleSelectedOrAllPhotos()
           LrTasks.startAsyncTask( function()
                for i=1,#photos do
                     local photo = photos[i]
                     local photopath = photo:getRawMetadata("path")
                     local photoname = photo:getFormattedMetadata("fileName")
                     local folderpath = string.sub(photopath, 1, string.len(photopath) - string.len(photoname))
                     local metadataPath = folderpath .. "\.metaface\\" .. photoname .. ".txt"
                     local text = LrFileUtils.readFile(metadataPath)
                     local metadataValues = stringSplit(text)
                     for i = 0, #metadataValues do
                          catalog:withWriteAccessDo( "keywordProvider", function()
                               local keywords = catalog:createKeyword(metadataValues[i])
                               photos:addKeyword(keywords)
                          end)
                     end
               end
          end)
    end
    So what am I doing wrong?

  • MacOS how to use standard UNIX behavior for new files

    Hi,
    I have one problem. then i create new files and folders on my Mac, they get group owner from parant. How can i say to OS that it should get group owner for new files from user GID? same as it works on UNIX/Linux?
    How it works on Mac:
    MacOS:/ napetrov$ mkdir -p /tmp/new_dir
    MacOS:/ napetrov$ id
    uid=34148(napetrov) gid=45956(users)
    MacOS:/ napetrov$ ls -al /tmp/new_dir
    total 0
    drwxr-xr-x 2 napetrov wheel 68 Aug 13 19:06 .
    drwxrwxrwt 14 root wheel 476 Aug 13 19:06 ..
    How it works on linux:
    -bash-3.2$ mkdir -p /tmp/new_dir
    -bash-3.2$ id
    uid=34148(napetrov) gid=45956(users)
    -bash-3.2$ ls -al /tmp/new_dir
    total 20
    drwxr-xr-x 2 napetrov users 4096 Aug 13 19:01 .
    drwxrwxrwt 22 root root 12288 Aug 13 19:01 ..
    Message was edited by: napetrov

    napetrov, there are two varieties of UNIX behavior regarding the group of a newly created file. The first variety, which Linux uses, comes from System V UNIX — where the file is created with the group ID of the creating user. The second variety, which Mac OS X uses, comes from BSD UNIX — where the file is created with the group ID of the directory in which it is located.
    In some UNIXes that come with the System V behavior by default, the BSD behavior can be applied to a particular directory by setting the directory‘s “setgid” bit. However, it is rare for a UNIX that comes with the BSD behavior by default to provide a way to allow the System V behavior for a particular user. To my knowledge, Mac OS X does not provide a way to allow the System V behavior for a particular user; thus, I’d recommend the explicit use of chgrp to set the group ID of a newly created file to that of the creating user, if that behavior is what your application needs.

  • How to Use Associated App to open a file in Linux command line?

    Hi all,
    I know in windows i call always run:
    Runtime.exec("start aPicture.jpg");in order to use the default picture viewer to view the pictures
    Runtime.exec("start aEmail.eml");in order to use the default email viewer to view the .eml file
    is there a simular command in linux as well? does it depend on different distributions as well?
    thank you.

    is there a simular command in linux as well? does it
    depend on different distributions as well?In linux it's different because the handling is done by the desktop environment. KDE has it's own file associations and Gnome has it's own. There might be some way to start a file like that, but you first need to see which DE is installed (if any) and start it using that DE's method.
    But I don't know how to do it, even though most likely it's possible.
    Sincerely,
    Jussi

  • How to use requestScope in faces-config.xml file?

    a managed-bean need get value from request as its property
    so i configure the manged-bean as below:(use requestScope object)
    <managed-bean>
    <description>this is for item test bean.</description>
    <managed-bean-name> item </managed-bean-name>
    <managed-bean-class> test.Item </managed-bean-class>
    <managed-bean-scope> request </managed-bean-scope>
    <managed-property>
    <property-name>id</property-name>
    <value-ref>requestScope.id</value-ref>
    </managed-property>
    </managed-bean>
    but it didnot work.
    after i restart tomcat with above configure file, it report
    HTTP Status 404 error.
    and seemed that the context donot start...
    if i change the line
    <value-ref>requestScope.id</value-ref>
    to:
    <value>7</value>
    then everything will be OK...but this isnot fit my require.
    any body can help me?
    I use JSF 1.0 beta.

    Rather than starting a new thread, I thought I'd just add on to this one, since it already lays the grounds for my question. I'm using the
    I noticed that my setId() method is being called once during the ApplyRequestValuesPhase, and then again in the UpdateModelValuesPhase. The first time, it sets the ID to null, despite the fact that I'm posting an id to the page. When it comes around the second time, it sets the id properly, and the data is loaded from the database and everything works great. If I'm not posting anything to the page, it is only hit once and the value is null.
    Normally I wouldn't fuss over such small things like this, but there's a bit of a probelm. I have a few buttons which are rendered based on this id. If the id is zero (i.e. null or empty string is passed into the setId() method), I want the add button to appear, else I want the update/delete/cancel buttons to appear. If any of these buttons are false after the ApplyRequestValuesPhase, the button's action will not be executed. In other words, when I'm editing an entry and I press the update button the life cycle goes a little like this...
    Object constructed
    ApplyRequestValuesPhase calls setId(null),add button to be rendered, update/delete/cancel to not be rendered
    // the call to save() is not queued up! (save() is the method associated with the action of my update button)
    UpdateModelValuesPhase calls setId("34"), data loaded from database, add button is not to be rendered, update/delete/cancel are to be rendered
    Since save() is never called, it renders the data loaded from the database, and the update/delete/cancel buttons are shown. So, from the user's perspective... nothing happened other than a page refresh. A.k.a. the update button is broken!
    I can, of course, choose to not update the boolean flags which determine if the buttons are rendered or not when setId() is called with a null. Since the default is to render everything (which was a decision specifically to avoid the buttons not being rendered in the early stages of the JSF life cycle, and the action not being executed). That works when I post an id to the page because it's called a second time and the correct buttons are rendered. The problem is when no parameters are given... it isn't called a second time, so it renders all buttons when I only want it to render the add button.
    So how can I get the values to post during the ApplyRequestValuesPhase? I thought that would be how it would work, but apparently not. Anyone know why it explicitly sets the id to null the first time aroud?
    Here's all you should need...
        <managed-bean>
            <managed-bean-name>dropdownEntry</managed-bean-name>
            <managed-bean-class>org.dc949.bugTrack.DropdownEntry</managed-bean-class>
            <managed-bean-scope>request</managed-bean-scope>
            <managed-property>
                <property-name>id</property-name>
                <value>#{param.id}</value>
            </managed-property>
        </managed-bean>
        public void setId(String id) {
            try {
                this.id = Long.parseLong(id);
                load();  // loads data from DB
            } catch(Exception e) {
                if(id != null && !id.equals(""))
                    log.warn("Unable to convert id from String to long ("+id+")", e);
            if(id != null) {  // this was my solution while I was frusterated that my save method wasn't being called
                if(this.getIdAsLong() == 0) {
                    this.showAdd = true;
                    this.showUpdate = false;
                    this.showDelete = false;
                } else {
                    this.showAdd = false;
                    this.showUpdate = true;
                    this.showDelete = true;
                        <t:div>
                            <h:commandButton id="add" value="Add dropdown entry"
                                             rendered="#{dropdownEntry.showAddButton}"
                                             action="#{dropdownEntry.save}" />
                            <h:commandButton id="update" value="Update dropdown entry"
                                             rendered="#{dropdownEntry.showUpdateButton}"
                                             action="#{dropdownEntry.save}" />
                            <h:commandButton id="delete" value="Delete dropdown entry"
                                             rendered="#{dropdownEntry.showDeleteButton}"
                                             action="#{dropdownEntry.deleteDropdownEntry}" />
                            <h:commandButton id="cancel" value="Cancel"
                                             rendered="#{dropdownEntry.showUpdateButton}"
                                             action="#{dropdownEntry.reset}" immediate="true" />
                        </t:div>I could, and probably will get rid of the showDeleteButton flag and isShowDeleteButton() method and make it like the cancel button since these update/delete/cancel will always be shown/hidden together.
    Edit: Now I feel like a fool. A little clean and build, and it's working perfectly. If any one of the above people read this, I thank you for your help from years past. <img class="emoticon" src="images/emoticons/happy.gif" border="0" alt="" />
    Edited by: AdamNichols on Apr 18, 2008 9:57 PM

Maybe you are looking for