What is the simplest way to do reverse lookup at java Hashtable

Is there a way to reverse lookup, given the value and obtain the key?

Your best bet would be to design that in the first place instead of trying to use the original design for something it wasn't intended to do. For example, have a second hashtable where the values from the first hashtable are the keys and vice versa.

Similar Messages

  • What is the simplest  way to get a xml-file from 10g R2 -database ?

    Hi,
    I'm new in xml, there are so many tools to work with xml:
    what is the simplest way to get a xml-file from 10g R2 -database ?
    I have : 10g R2 and a xsd.file to describe the xml-structure
    thank you
    Norbert

    There is no automatic way to generate XML documents from an arbitary set of relational tables using the information contained in an XML Schema. Typically the easiest way to generate XML from relational data is to use the SQL/XML operators (XMLElement, XMLAGG, XMLAttribtues, XMLForest). There are many examples of using these operators in the forums You can validate the generated XML against the XML Schema by registering the XML Schema with XML DB and then using the XMLType.SchemaValidate() method

  • What is the simplest way to make a movie from BufferedImages?

    I have a 3d rendered animation from which I can grab BufferedImages of each frame. What is the simplest way I can create a movie from these images?
    I've seen the JpegImagesToMovie.java file and not only is it suprisingly overcomplicated, it requires me to change the code so that I can get images from memory rather than from files.
    Is there some simple way of creating a movie which requires a few statements? I'm also prepared to use QuickTime for Java. I don't care about the format, since I can just use any video converter to convert it to my desired video format.

    I recently came up with a simplified JpegImagesToMovie program. It generates QuickTime movies with a single video track output as a file. Input is a series of jpegs (currently as a list of file names, but easily modified to a take any form of jpeg data.) Since the compression used by the movie is JPEG, if you have an uncompressed image buffer, you'll need to convert that into jpeg data bytes with some quality setting. (Since its a movie file, go with something low if you have a lot of similar images.) This will even run without a full install of jmf--no native code is called (as far as I could tell..)
    Here is the source code, sorry about the formatting!
    import java.awt.Dimension;
    import java.io.File;
    import java.io.IOException;
    import java.io.RandomAccessFile;
    import java.net.URL;
    import java.util.Vector;
    import javax.media.Buffer;
    import javax.media.Format;
    import javax.media.MediaLocator;
    import javax.media.format.VideoFormat;
    import javax.media.protocol.ContentDescriptor;
    import javax.media.protocol.FileTypeDescriptor;
    import com.sun.media.multiplexer.video.QuicktimeMux;
    * This program takes a list of JPEG image files and converts them into a
    * QuickTime movie.
    * This was based on Sun's JMF Sample Code JpegImagesToMovie.java 1.3 01/03/13
    * This code is an attempt to reduce the complexity to demonstrate a very basic
    * JPEG file list to movie generator. It does not use a Manager or Processor
    * class, so it doesn't need to implement any event listening classes. One
    * advantage of this simplified class is that you can just link it with the
    * jvm.jar file. (you might also need to track down the com.ms.security library
    * stubs, use google. You'll need PermissionID.java and PolicyEngine.java.)
    * I tried to get it to generate AVI files without success.
    * These output files are could use further compression.
    * A Vector of jpeg image paths was one way to do this--the appropriate
    * methods can be overwritten to grab images from another source
    * --zip file, http, etc.
    * - Brad Lowe; Custom7; NuSpectra; 2/10/2005
    * The existing Copyright from Sun follows.
    * Copyright (c) 1999-2001 Sun Microsystems, Inc. All Rights Reserved.
    * Sun grants you ("Licensee") a non-exclusive, royalty free, license to use,
    * modify and redistribute this software in source and binary code form,
    * provided that i) this copyright notice and license appear on all copies of
    * the software; and ii) Licensee does not utilize the software in a manner
    * which is disparaging to Sun.
    * This software is provided "AS IS," without a warranty of any kind. ALL
    * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY
    * IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
    * NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN AND ITS LICENSORS SHALL NOT BE
    * LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
    * OR DISTRIBUTING THE SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR ITS
    * LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT,
    * INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER
    * CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF
    * OR INABILITY TO USE SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY
    * OF SUCH DAMAGES.
    * This software is not designed or intended for use in on-line control of
    * aircraft, air traffic, aircraft navigation or aircraft communications; or in
    * the design, construction, operation or maintenance of any nuclear facility.
    * Licensee represents and warrants that it will not use or redistribute the
    * Software for such purposes.
    public class SimpleMovie
    Vector images; // jpeg image file path list
    VideoFormat format; // format of movie to be created..
    // Sample code.
    public static void main(String args[])
    try
    // change imageDir to the location of a directory
    // of images to convert to a movie;
    String imageDir = "images";
    File d = new File(imageDir);
    SimpleMovie imageToMovie = new SimpleMovie();
    // change width, height, and framerate!
    // Excercise: Read width and height of first image and use that.
    imageToMovie.init(320, 240, 10.0f);
    imageToMovie.setFiles(d);
    File dest = new File("simple.mov");
    imageToMovie.createMovie(dest);
    System.err.println("Created movie " + dest.getAbsolutePath() + " "
    + dest.length() + " bytes.");
    } catch (Exception e)
    System.out.println(e.toString());
    e.printStackTrace();
    // return jpeg image bytes of image zIndex (zero-based index)
    public byte[] getImageBytes(int zIndex) throws IOException
    if (images == null)
    return null;
    if (zIndex >= images.size())
    return null;
    String imageFile = (String) images.elementAt(zIndex);
    // Open a random access file for the next image.
    RandomAccessFile raFile = new RandomAccessFile(imageFile, "r");
    byte data[] = new byte[(int) raFile.length()];
    raFile.readFully(data);
    raFile.close();
    return data;
    // Call this before converting a movie;
    // Use movie width, height;
    public void init(int width, int height, float frameRate)
    format = new VideoFormat(VideoFormat.JPEG,
    new Dimension(width, height), Format.NOT_SPECIFIED,
    Format.byteArray, frameRate);
    // Set up the files to process
    public void setFiles(Vector inFiles)
    images = inFiles;
    // point converter to jpeg directory. Only does one level,
    // but could recurse, but then sorting would be interesting..
    public void setFiles(File dir) throws Exception
    if (dir.isDirectory())
    if (images == null)
    images = new Vector();
    String l[] = dir.list();
    for (int x = 0; x < l.length; x++)
    if (l[x].toLowerCase().endsWith(".jpg"))
    File f = new File(dir, l[x]);
    images.addElement(f.getAbsolutePath());
    // Crank out the movie file.
    public void createMovie(File out) throws Exception
    if (format == null)
    throw new Exception("Call init() first.");
    String name = out.getAbsolutePath();
    QuicktimeMux mux = null; // AVI not working, otherwise would use
    // BasicMux
    if (out.getPath().endsWith(".mov"))
    mux = new QuicktimeMux();
    mux.setContentDescriptor(new ContentDescriptor(
    FileTypeDescriptor.QUICKTIME));
    } else
    throw new Exception(
    "bad movie file extension. Only .mov supported.");
    // create dest file media locator.
    // This sample assumes writing a QT movie to a file.
    MediaLocator ml = new MediaLocator(new URL("file:"
    + out.getAbsolutePath()));
    com.sun.media.datasink.file.Handler dataSink = new com.sun.media.datasink.file.Handler();
    dataSink.setSource(mux.getDataOutput()); // associate file with mux
    dataSink.setOutputLocator(ml);
    dataSink.open();
    dataSink.start();
    // video only in this sample.
    mux.setNumTracks(1);
    // JPEGFormat was the only kind I got working.
    mux.setInputFormat(format, 0);
    mux.open();
    // Each jpeg goes in a Buffer.
    // When done, buffer must contain EOM flag (and zero length data?).
    Buffer buffer = new Buffer();
    for (int x = 0;; x++)
    read(x, buffer); // read in next file. x is zero index
    mux.doProcess(buffer, 0);
    if (buffer.isEOM())
    break;
    mux.close();
    // close it up
    dataSink.close();
    // Read jpeg image into Buffer
    // id is zero based index of file to get.
    // Always starts at zero and increments by 1
    // Buffer is a jmf structure
    public void read(int id, Buffer buf) throws IOException
    byte b[] = getImageBytes(id);
    if (b == null)
    System.err.println("Done reading all images.");
    // We are done. Set EndOfMedia.
    buf.setEOM(true);
    buf.setOffset(0);
    buf.setLength(0);
    } else
    buf.setData(b);
    buf.setOffset(0);
    buf.setLength(b.length);
    buf.setFormat(format);
    buf.setFlags(buf.getFlags() | Buffer.FLAG_KEY_FRAME);
    }

  • What is the simplest way to get video from mini DV tapes into computer

    My computer has no firewire connection. What is the simplest way to get the video from my camera (JVC GR-D340EK) ?

    Mikeathome
    Thanks for the reply.
    The reason that I asked if this was a one time thing or not was related to my thoughts about asking you to look at the relative costs of have the DV data capture firewire done professional or by a friend versus going through looking for slots on your computer for a firewire card or purchasing a computer that still comes with a firewire port.
    We will be watching for further developments.
    Thanks.
    ATR

  • What is the simplest way to create slide show

    What is the simplest way to create a slide show ?  (Premiere Elements 12)

    saploe
    What computer operating system is your Premiere Elements 12 running on? Premiere Elements 12 Mac does not have a Slideshow option in its Elements Organizer 12. So, that situation would not yield the two choices of creating the slideshow in the Elements Organizer and taking it into Premiere Elements OR doing the whole project solely in Premiere Elements.
    What is going into this slideshow....photos (how many, original pixel dimensions), videos (formats and duration), etc?
    What is a description of your computer resources?
    How do you intent to export this slideshow...
    a. burn to DVD-VIDEO standard or widescreen on DVD disc
    b. burn to AVCHD format on DVD disc
    c. burn to Blu-ray disc format on Blu-ray disc
    d. to file saved to the computer hard drive?
    We will customize a reply based on the information that you supply.
    Thanks.
    ATR

  • What is the simplest way to remove duplicates on both iMac and iPad2?

    What is the simplest way to remove duplicate photos from both iMac &amp; iPad2?

    The implication here is that your music is only on the iPod, for if it is in iTunes, you need only do the restore. So you are really asking how you move the music from your iPod back into iTunes, so that when you restore it will go back to the iPod. Take a look at Para. 8 in this summary post I worked up.

  • TS1424 Can you help Plz? What is the simplest way to transfer my music from old computer to new.

    what is the simplest way to transfer my music in iTune from my old computer to the new plz.

    Move or copy the ENTIRE iTunes folder from the old computer to the new computer.

  • What is the best way to call SSH commands through Java technologies

    What is the best way to call SSH commands through Java technologies

    I don't think you can specify the password at the prompt using ssh. Plink has the -pw command option for passwords. What I did was except ssh to ask me and write the password programmatically through the outputStream I obtained from my Process object. I looked for "password: ", and then wrote the password with a trailing newline.
    Both plink and ssh will also ask if you trust the host if it is the first time you are connecting to it. So before just writing the password, check if the program wants verification from you: normally supplying "y" or "n". This should only have to happen the first time the client connects. It looks like thisPLINK:
    The server's host key is not cached in the registry. You
    have no guarantee that the server is the computer you
    think it is.
    The server's key fingerprint is:
    1024 f8:43:61:4c:a2:5b:77:be:5b:a7:bb:1f:f7:79:b3:b7
    If you trust this host, enter "y" to add the key to
    PuTTY's cache and carry on connecting.
    If you want to carry on connecting just once, without
    adding the key to the cache, enter "n".
    If you do not trust this host, press Return to abandon the
    connection.
    Store key in cache? (y/n)
    SSH:
    The authenticity of host '127.0.0.1 (127.0.0.1)' can't be established.
    RSA key fingerprint is e1:02:13:c8:52:c2:23:41:9b:5b:58:2c:18:e6:59:af.
    Are you sure you want to continue connecting (yes/no)?What I did was read character by character from the inputStream until I found things of interest ... like "password: ". You only need to search for this in your method which will launch the ssh or plink Process. Once you have verifyed yourself, you can just pass commands to the Process, which is an ssh connection.
    My suggestion is to read() each byte from the Process's inputStream and write it to stdout. Look and see what you need to be looking for so you can interactive with the program correctly. You can't use readLine here becuase when the ssh asks for the password it does not print a newline. I do know for sure, that ssh will simply print, "passowrd: ". Plink will print this as well if the -pw option is not supplied.

  • What is the simplest way to create a text on black background?

    I am new to In Design and want to make a simple design that is a yellow text with a black background. What is the easiest way to do that? I am on a PC running In Design CS4. This is on a computer at work so it may take awhile for me to get back to anybody who answers. Thanks in advance

    If you are a novice then iweb is a good place to start. It will allow you to create a site quickly with the minimum amount of work. You can then learn more as you go along if you want to. To publish you will need web space somewhere. Thats how I started and now I am studying web design with the Open University and am learning xhtml and CSS, then progressing to Java etc. Good luck and have fun - it is quite addictive once you start.

  • I want to load movies in to my iPad through itune in my pc that runs window XP. First of all I am not able to add the movies to the itune ,leave aside sync to iPad .can some one suggest what is the simplest way to load movies in my iPad.

    I have plenty of DVD which I load in my laptop and watch the movies while travel, however I am not able to do that in my iPad .
    I would appreciate some one guide me the simplest way of loading the movies in to my iPad. I tried the conventional procedure of loading/copying in to itune then sync to the iPad to load all movies in it, but failed to do the first step( not able to load /copy in itune) leave aside the sync to iPad next.
    Do I need to sellout some 20 odd $ to buy a conversion software that would help?
    Is it that Apple trying to make money by not making this simplest of thing possible by the user.( ref. windows, every thing is possible with little IQ of the user).
    If it is so , I would stop many of my friends to restrain from buying a device like this by spending some 1000$   ,rather look at a good Droid that is catching up so well.

    If you are the only user on your computer you probably don't have multiple user accounts set up and can disregard that.  If you are using iTunes 11 go to View>Show Sidebar.  Now see if your iPad appears under Devices on the left side when you connect it.  If it does, click on the name of your iPad on the left side and your iTunes sync settings options will appear in folders with tabbed headings to the right.
    If it doesn't appear on the left side, follow the troubleshooting steps shown in this article: http://support.apple.com/kb/TS1538.

  • What is the simplest way to convert to one page format?

    I have a large file set up as facing pages with the master pages having different margin settings. If I want to change so I will no longer be printing 2-sided output but rather 1-sided, what is the easiest way to change the file? Would I just delete one of the master pages and reset margins?
    Thanks,
    Richard

    Off the top of my head, enable layout adjustment before removing or modifying the master.
    Layout > Layout Adjustment
    Modify the right (?) master (margins).
    Verify changes to the live pages.
    The master does not explicity need to be removed.

  • What is the simplest way to make DVD now?

    For years I have used iDVD to distribute wedding videos. It was simple and have nice themed menus. What is the best way to do that now?  Can you still install iDVD or is something else better? I'm running 10.9.5 on a current Mac Book Pro.

    For years I have used iDVD to distribute wedding videos. It was simple and have nice themed menus. What is the best way to do that now?  Can you still install iDVD or is something else better? I'm running 10.9.5 on a current Mac Book Pro.

  • What is the right  way to display a table in Java web dynpro using a node.

    Hi experts,
      I am trying to show a node of cardinality 0...n as a table in an adobe form in Java web dynpro. But its not showing it properly. Can anybody please tell me what is the right way to display a table on adobe form using a node of cardinality 0...n or 1...n in Java Webdynpro.  In ABAP webdynpro, we can drag and drop a node of cardianlity 0...n or 1...n to  show as a table and it works fine. Is the same possible in Java webdynpro also. Please help.
    Thanks and Regards.
    Vaibhav Tiwari.

    Please refer to my post.. you will get the answer
    Dynamic Table -  same data repeating in all rows
    Special care should be taken in designing the context for table attribute.
    The attribute type singletone also plays a important role. I have this doubt from the beginning when you have reported this problem for the first time but finally you marked it as solved so i thought there might be some other issues but again when you reported that again i did some analysis.
    Now coming to final solution :
    For designing a table in adobe interactive form you have consider following
    You have to design the view context upto three level, I am explaining you the properties
    PDFDataSource (Parent Level1) - Cardinality 1:1 - Signetone -True - This is assigned to datasource
    TableList (Parent Level2) - Cardinality (1:1) - Signetone -True
    TableWrapper(Parent Level3) - Cardinality (0:n) - Signetone -True
    TableData (Parent Level4) - Cardinality (0:1) - Signetone - false (This is the main point)
    Then under TableData value node, you have to put all your table attributes.
    This Value Node name can be anything but hierarchy should be same as I have mentioned above.
    Please try out these steps and get back to me if you have any doubt.

  • What is the simplest way to invoke the command associated with an existing menu item from a plugin?

    Hey there,
    My specific task is to bring forward the "Swatches" window.  I want to initiate this from my plugin code (C++).  However, I may want to execute other menu items in the future, so understanding the simplest, most straightforward general mechanism would be great.
    I've pieced together a sequence that could work using the Menu and Interface suites, but it seems more complicated than it should be and requires knowledge of the localized name of the menu item (incomplete and uncompiled sample code below).  Is there a better way to do this?
    // Get the menu item handle by walking all items to find the swatches item
    long numMenuItems = 0;
    sAIMenu->CountMenuItems( &numMenuItems );
    AIMenuItemHandle menuItemHandle;
    ai::UnicodeString localizedItemName;
    for ( long menuItemIndex = 0; menuItemIndex < numMenuItems; ++menuItemIndex )
        sAIMenu->GetNthMenuItem( menuItemIndex, &menuItemHandle );
        sAIMenu->GetItemText( menuItemHandle, localizedItemName );
        if ( localizedItemName == “Swatches” )
            break;
    AIBoolean bchecked =false;
    sAIMenu->IsItemChecked( menuItemHandle,
                            &bchecked );
    if ( !bchecked )
       // Find the plugin responsible for adding and responding to the menu item
        SPPluginRef swatchPlugin;
        sAIMenu->GetMenuItemPlugin( menuItemHandle, &swatchPlugin );
       // Construct and send a message to the plugin instructing it to execute as if the menu item were invoke by the user
        AIMenuMessage message;
        sSPInterface->SetupMessageData( swatchPlugin, &message.d );
        message.menuItem = menuItemHandle;
        SPErr result;
        sSPInterface->SendMessage( swatchPlugin, kAIMenuCaller, kSelectorAIGoMenuItem, &message, &result );
        sSPInterface->EmptyMessageData( swatchPlugin, &message.d );
    Glen.

    That's a clever solution to a problem I'd never considered (but can see how others might need it) I can't think of a better way to invoke it though than what you're doing except maybe with some minor improvements. If you know the menu group, you can use AIMenuSuite::GetMenuGroupRange() to jump to that group in the overall list. Also, since menuitems seem extremely unlikely to change, you can probably cache the handle.
    Beyond that, the usual suggestion I'd make it is to at least explore actions. Try recording an action and see if it even picks up when you display the Swatches panel. I'm guessing it doesn't record stuff like that, but who knows?

  • What is the simplest way to make and upload video to YouTube?

    I’m a video novice trying to figure this out. We want to start making short customer testimonial videos and upload them to YouTube as part of a social media marketing campaign. I want to come up with a solution that is fast and easy, takes as little time as possible. On the recommendation of an associate I bought a Flip Video camera and that worked beautifully except for one problem, the audio volume of the recordings was ridiculously low. So am returning that.
    We have a Panasonic PV-GS65 and I can use that, but the only way I've figured out how to make a video there and get it onto my computer is to connect it to iMovie, let it play/load into iMovie, then from there I don’t know how to get it uploaded to YouTube but I'm guessing I have to do some formatting/compressing, then manually upload, and that is all way more hassle than I'm looking for.
    I LOVED the simplicity of the Flip Video approach. Shoot it, the camera directly in, select the video, push the upload button and it was done. If the audio quality was better I'd use that for sure.
    Any suggestions? If there’s something similar to Flip Video that I can buy cheap and use, I'll do it. If there’s an easy way to use our current camcorder, that’s fine too. But I can’t be messing around for 10-15 minutes trying to import, format and then upload this stuff. I have a business to run.
    Any suggestions would be GREATLY appreciated, thanks!

    that will work if necessary, but it still more steps and more time consuming than my ideal solution.
    Would love to find something that makes the process as simple as Flip Video does.
    Man, if their microphone was just a bit more sensitive, that solution would’ve been perfect.

Maybe you are looking for

  • Canvas and viewer won't display video correctly

    I have just reinstalled and then reinstalled 5.1.4. Picture plays on external video monitor but will not play in either canvas or viewer. RGB is set. Mirror on playback is set. Audio will play. Viewer will play on external monitor. Usually a still wi

  • How to send automatic mail and put attache file on batch file ?

    how to send automatic mail and put attache file on batch file ? START MAILTO:[email protected]?SUBJECT=PHONE%CALL^&BODY=Testing

  • Download and view file from db

    Hi! Is there any way to download the file from db and view its contents? Using webutil I can download the file to a specific location in the client machine. Since I don't know what type of file is (pdf, doc, txt...), I don't know how can I view the f

  • Recreating duty calculations for PO for changed Net price of an item.

    Dear Friends, i am trying to simulate the duty values for a PO by calling the FM's in the below said order. it is working fine, when i am simply passing the actual value of the item via structure (gfl_komp) shown below. My requirement is like, i want

  • How to view path code violations, LCV, other error intervals on single T1

    Hello - I am having an issue on one of our routers viewing errors in detail for example in the last 20 intervals. On our multilink circuits to view these errors I would do 'show controllers t1 0/0' or whatever T1 it is. This is a standalone T1 circui