Help with SUN JNDI tutorial example

HI guys there's an example of how to bound an object along with its codebase in the sun jndi tutorial
import javax.naming.*;
import javax.naming.directory.*;
import java.util.Hashtable;
* Demonstrates how to bind a Serializable object to a directory
* with a codebase.
* (Use Unbind to remove binding.)
* usage: java SerObjWithCodebase <codebase URL>
class SerObjWithCodebase {
public static void main(String[] args) {
     if (args.length != 1) {
     System.err.println("usage: java SerObjWithCodebase <codebase URL>");
     System.exit(-1);
     String codebase = args[0];
     // Set up environment for creating initial context
     Hashtable env = new Hashtable(11);
     env.put(Context.INITIAL_CONTEXT_FACTORY,
     "com.sun.jndi.ldap.LdapCtxFactory");
     env.put(Context.PROVIDER_URL, "ldap://localhost:389/o=JNDITutorial");
     try {
     // Create the initial context
     DirContext ctx = new InitialDirContext(env);
     // Create object to be bound
     Flower f = new Flower("rose", "pink");
     // Perform bind and specify codebase
     ctx.bind("cn=Flower", f, new BasicAttributes("javaCodebase", codebase));
     // Check that it is bound
     Flower f2 = (Flower)ctx.lookup("cn=Flower");
     System.out.println(f2);
     // Close the context when we're done
     ctx.close();
     } catch (NamingException e) {
     System.out.println("Operation failed: " + e);
So in therory you should be able to retrieve an object in through doing a look up, and then cast it... but in this approach the client that performs the look up shouldn't need to include the class definition of the object that is being retrieved, because it's being included in the code base of the context, but then how do you avoid compilation errors such:
SerObjWithCodebase.java:73: cannot resolve symbol
symbol : class Flower
location: class SerObjWithCodebase
Flower f2 = (Flower)ctx.lookup("cn=Flower");
in the client code that is attepting to perform the look up?... is there a work-around for this problem? please let me know, thanks in advance.

As far as I am aware, there is no possible way to compile or execute code without the client knowing it's definition.
The client will always need the class definition if it want's to use it.
If you don't want this coupling, then you could look at using an EJB container (which still requires the client to have skeleton code) or using something like web services

Similar Messages

  • Help with  running sun jndi tutorial example LookUp.class

    I am learning JNDI,and when I run LookUp.java available in JNDI TUTORIAL ,souce code here:
    * @(#)Lookup.java     1.3 99/08/12
    * Copyright 1997, 1998, 1999 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.
    import javax.naming.Context;
    import javax.naming.InitialContext;
    import javax.naming.NamingException;
    import java.util.Hashtable;
    class Lookup {
    public static void main(String[] args) {
         // Check that user has supplied name of file to lookup
         if (args.length != 1) {
         System.err.println("usage: java Lookup <filename>");
         System.exit(-1);
         String name = args[0];
         // Identify service provider to use
         Hashtable env = new Hashtable(11);
         env.put(Context.INITIAL_CONTEXT_FACTORY,
         "com.sun.jndi.fscontext.RefFSContextFactory");
         try {
         // Create the initial context
         Context ctx = new InitialContext(env);
         // Look up an object
         Object obj = ctx.lookup(name);
         // Print it out
         System.out.println(name + " is bound to: " + obj);
         // Close the context when we're done
         ctx.close();
         } catch (NamingException e) {
         System.err.println("Problem looking up " + name + ": " + e);
    after I compiled it sucessfully,I typed
    java LookUp d:/test.java ,error message shown following:
    Problem looking up LookUp.java: javax.naming.NoInitialContextException: Cannot i
    nstantiate class: com.sun.jndi.fscontext.RefFSContextFactory [Root exception is
    java.lang.ClassNotFoundException: com.sun.jndi.fscontext.RefFSContextFactory]
    please help me!

    Read the Preparations chapter of the tutorial.
    It tells you to download and install the file
    system service provider from
    http://java.sun.com/products/jndi/#download

  • Run client execution problem  when running Sun J2EE tutorial example

    Hi,
    I'm trying to run the Sun J2EE tutorial example, CartApp.
    When come to run the client application I got the following error:
    The command:
    E:\Dev\src\J2EE_J2EE_tutorial\examples\ears>runclient -client CarApp.ear -name CartClient -textauth
    The error:
    Application threw an exception:java.io.IOException: CarApp.ear does not exist
    The deployment complete without error.
    I tried to the the APPCPATH to :
    set APPCPATH=E:\Dev\src\J2EE_J2EE_tutorial\examples\ears\CartAppClient.jar
    set APPCPATH=CartAppClient.jar
    On both set, it gave the same error above.
    Did someone known the problem I have ?
    Thnaks

    hi ,
    I think u have given other disply name to your J2EE client ,
    Anyway check disply name of J2EE client through deploytool.
    u have to use that display name to access the j2ee client .
    suppose ur j2ee client displyname is testclient, u can use:
    runclient -client ConverterApp.ear -name testclient
    hope this will help u,
    babu.

  • Is it a bug in Sun's Tutorial example!!!!

    Hello everybody! I donno whether the following Tutorial example code is buggy or not but it won't run under j2sdk 1.4.2 and also under 1.5 as smoothly as Tutorial says(only the 1st line prints but not all). You can find the code:
    http://java.sun.com/docs/books/tutorial/essential/io/dataIO.html
    And the file name is:
    DataIODemo
    Does anyone know how to make it work?
    Thanks.
    --DM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    The author made a "bonehead" error - s/he hardcoded a newline character ('\n') when writing the invoice1.txt file. Since this is a UNIX/Linux character, it will not cause an error when run there - BUT - when run on an OS that doesn't use that convention - Windows, etc - it results in an incorrectly written file.
    This illustrates a code portability problem; don't hardcode!
    I leave as an exercise for the reader the correction of the format of the total dollar amount.
    A corrected copy is below. //********* preceeds changes. Compare with the original to see the differences.
    import java.io.*;
    public class DataIODemo
        public static void main(String[] args)
            throws IOException
            // write the data out
            DataOutputStream out  = new DataOutputStream(new
                FileOutputStream("invoice1.txt"));
            double[] prices       = {19.99, 9.99, 15.99, 3.99, 4.99};
            int[] units           = {12, 8, 13, 29, 50};
            String[] descs        = {"Java T-shirt",
                "Java Mug",
                "Duke Juggling Dolls",
                "Java Pin",
                "Java Key Chain"};
            char lineSep          = System.getProperty("line.separator").charAt(0);
            for (int i = 0; i < prices.length; i++)
                out.writeDouble(prices);
    out.writeChar('\t');
    out.writeInt(units[i]);
    out.writeChar('\t');
    out.writeChars(descs[i]);
    out.writeChar(lineSep);
    out.close();
    // read it in again
    DataInputStream in = new DataInputStream(new
    FileInputStream("invoice1.txt"));
    double price;
    int unit;
    StringBuffer desc;
    double total = 0.0;
    try
    while (true)
    price = in.readDouble();
    in.readChar();
    // throws out the tab
    unit = in.readInt();
    in.readChar();
    // throws out the tab
    char chr;
    desc = new StringBuffer(20);
    while ((chr = in.readChar()) != lineSep)
    desc.append(chr);
    System.out.println("You've ordered " +
    unit + " units of " +
    desc + " at $" + price);
    total = total + unit * price;
    } catch (EOFException e)
    System.out.println("For a TOTAL of: $" + total);
    in.close();

  • Need help with order booking tutorial

    Hi
    I am new to OracleFusion.
    Started Learning By practising OrderBooking tutorial for 10g.
    I am practising parellel branching in the tutorial .
    I ve invoked Rapid distributors service in branch 1 of the flow activity.
    and
    i ve invoked Select manufacturing service in branch 2 of flow activity.
    I ve deployed order booking service,rapid distributed service,select manufacturing service in the server.
    Select manufacturing service is an asynchronous service .for this service to be complete it requires user to manually set price for the item ordered.
    So I accesed SelectManufacturinUI in browser as instructed in book.The problem is tht it is directing me to login page where User id and password should be submitted.
    In the tutorial no info is given regarding login details fot this page.Hence i am not able to set price for order.
    So the Select manufacturing service is not completed ..hence i am not able to move further in the tutorial..
    Kindly help with this..if any one has faced same prblm
    thanks

    Hi
    I got the answer. Just posting it so that it helps someone
    User id i tried : jcooper
    password : Bpel console startup password

  • Please help with Sun Java System Communications Sync crashe with IEx 7.x

    Dear All!
    Recently i've upgrade my IExplorer to 7.x version. After that i began to have problems with Communications Sync (latest version). When i try to sync Outlook 2003 with the server (SSL connection/ self signed certificate) the Comm Sync asks if i want to allow to open connection with wrong certificate (happed only after installing IEx 7.x) and then when i press YES it crashes.
    Any help on how to fix this problem is appriciated.
    Konstantin
    P.S.: Adding a self signed certificate to IEx DB and adding the website to the trusted websites list did not help.

    Hi,
    Not sure how much we can help with this issue - especially if you are already running the latest version of the sync tool. About all I can offer is to uninstall your current sync software and reinstall the latest public version:
    http://sunsolve.sun.com/private-cgi/getpatch.pl (search for patch #124734).
    If that doesn't help I suggest you log a sun support case for this (assuming you have a sun support contract that is).
    Regards,
    Shane.

  • Trouble With Web Services Tutorial Examples

    I am having trouble getting the Web Services Tutorial examples to run.
    For example, when I compiled the hello1 example, and tried to run it, I got a directory listing. All the directory listing contained was the dukewaving.gif file.
    When I tried to run hello2, I got something similar. This time though, there were two jsp files in the listing. By clicking on the first one, I was able to run the application.
    Now I can't run the bookstore1 example. I went back a second time, to be sure that I was following the instructions exactly as written. I am gettng an HTTP Status 404 - Servlet BookStoreServlet is not available.
    I don't know why this is happening. There were no errors when I ran the Ant targets, and the WAR file did get copied to the webapps directory.
    I would be very grateful for any help. I am very new to Java and am finding this very frustrating.
    Thank You,
    Chrissy

    This is what's in my log file. Why is the servlet being marked as unavailable?
    2004-03-13 21:11:37 Manager: deploy: Deploying web application at '/bookstore1'
    2004-03-13 21:11:37 Manager: Uploading WAR file to C:\jwsdp-1.3\webapps\bookstore1.war
    2004-03-13 21:11:37 Manager: Extracting XML file to C:\jwsdp-1.3\conf\Catalina\localhost\bookstore1.xml
    2004-03-13 21:11:37 Manager: install: Installing context configuration at 'file:/C:/jwsdp-1.3/conf/Catalina/localhost/bookstore1.xml' from 'jar:file:/C:/jwsdp-1.3/webapps/bookstore1.war!/'
    2004-03-13 21:13:47 Marking servlet BookStoreServlet as unavailable

  • Need help with online book shop example!

    hi everyone!
    i am tryin and completing the online book catalog example given in sap help but i'm facin a prob with the internal table authors.can anybody tell mye the exact way to declare and use it in the program.its quite diff to describe the exact situation but i think the experienced ones will be able to understand my prob.
    eagerly waitin
    regards
    sachin

    if the navigation between pages are not working, the reason could be that the code in oninputprocessing is not maintained properly. if you just copy paste the code from the online tutorial it should work.
    navigation between pages not working? -
    to resolve this place HTTP break point in the code in oninputprocessing and run your application, click the button to navigate to other page, watch in the debugger as to whats going wrong.
    Regards
    Raja

  • Help with EJB & JNDI

    I am getting following error while compiling EJB session client
    javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
         at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
         at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
         at javax.naming.InitialContext.getURLOrDefaultInitCtx(Unknown Source)
         at javax.naming.InitialContext.lookup(Unknown Source)
         at client.SimpleSessionClient.main(SimpleSessionClient.java:20)
    My session client code is
    package client;
    import java.util.Hashtable;
    import beans.*;
    import javax.naming.Context;
    import javax.naming.InitialContext;
    import javax.rmi.PortableRemoteObject;
    import javax.ejb.*;
    import javax.naming.spi.InitialContextFactory;
    import javax.naming.NamingException;
    public class SimpleSessionClient {
         public static void main(String[] args) {
              try {
                   Context jndiContext = new InitialContext();
                   Object ref = jndiContext.lookup("ejb/beans.SimpleSession");
                   SimpleSessionHome home = (SimpleSessionHome)PortableRemoteObject.
                   narrow(ref, SimpleSessionHome.class);
                   SimpleSession simpleSession = home.create();
                   for (int i=0; i<args.length; i++) {
                        String returnedString = simpleSession.getEchoString(args);
                        System.out.println("Sent String:" + args[i] +", " +
                                  "recieved string" + returnedString);
              } catch(Exception e) {
                   e.printStackTrace();
    I have include j2ee.jar in the classpath too and I could deploy the EJB home and remote interface as well as Bean class in sun application server.
    Any help wuld be appreciated.
    Rashmi

    I am using Sun App server for deploying EJB. In the same system, I am running eclipse where I run the EJB client with JNDI to connect to EJB component.
    If this is not the right way, please suggest. I am trying to do this for the first time and completely clueless. I have tried to include different jar files in my classpath and even I am in the process of downloading websphere in case that could help me.

  • Can someone help with a OpenCV DLL example?

    OpenCV is an Open Source computer vision library released by intel.  It is very handy for face reconition.  There is a third party group called HyTek automation that created a commercial LV OpenCV wrapper called IVision, nice by if you just want to use a few of the features it would be nice to see some examples to help those of us simply expirimenting.  To that end there was a guy on the code project site that created a free OpenCV DLL wrapper that seems to have made all the constructors public inside the DLL so LV should be able to access them.  Here is the link
    to the code project page:
    http://www.codeproject.com/KB/cs/Intel_OpenCV.aspx
    Here is the link to the Google OpenCV Page
    http://code.google.com/p/opencvdotnet/
    Here is the link to the OpenCV WIKI Page
    http://opencvlibrary.sourceforge.net/FaceDetection
    Here is a link to some OpenCV Programming Referance Info
    http://www.cs.iit.edu/~agam/cs512/lect-notes/opencv-intro/index.html
    Here is the OpenCV Yahoo Page, Includes Emgu (another wrapper, not all public constructors, so LV may not be able to use Emgu DLL)
    http://tech.groups.yahoo.com/group/OpenCV/
    I was hoping someone could help by creating an example that shows a facal reconiton and possibly showing how to pull that area out to allow it to be saved as a seperate file.  I have been expirimenting with it but am unsure if all the flags and memory need to be setup as shown on the WIKI link.
    Also wanted to point folks to the Treemap DLL example,  this is free microsft control that is really neat for interperating data at a glance
     http://forums.ni.com/ni/search?board_id=170&submitted=true&q=treemap
    Best Regards
    Tim C.
    1:30 Seconds ARRRGHHH!!!! I want my popcorn NOW! Isn't there anything faster than a microwave!
    Attachments:
    cv100.zip ‏1831 KB

    If this is for the sake of learning to do this kind of stuff, then I do not want to discourage you here.
    But if it is about getting Vision analysis to work, the IMAQ Vision library is a better way to go about this, and if you insist on using OpenCV as core library and do not want to spend as much money, the IVision library is another possibility. They both ain't free but you do get good value for what you pay for, especially with the IVision library.
    Rolf Kalbermatter
    Message Edited by rolfk on 09-10-2009 09:35 AM
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • Please, help with Live Audio/Video example from jmf solutions

    Hello,
    I�m desperate looking for a solution for a particular problem.
    I�m trying to feed JMF with an AudioInputStream generated via Java Sound, so that I can send it via RTP. The problem is that I don�t know how to properly create a DataSource from an InputStream. I know the example Live Audio/Video Data from the jmf solutions focuses on something similar.
    The problem is that I don�t know exactly how it works, os, the question is, how can I modify that example in order to use it and try to create a proper DataSource from the AudioInputStream, and then try to send it via RTP?
    I think that I manage to create a DataSource and pass it to the class AVTransmit2 from the jmf examples, and from that DataSource create a processor, which creates successfully, and then find a corresponding format and try to send it, but when i try to send it or play it I get garbage sound, so I�m not really sure whether I create the DataSource correctly or not, as I�ve made some changes on the Live Audio/Video Data from the jmf solutions to construct a livestream from the audioinputstream. Actually, I don�t understand where in the code does it construct the DataSource from the livestream, from an inputStream, because there�s not constructor like this DataSource(InputStream) neither nothing similar.
    Please help me as I�m getting very stuck with this, I would really appreciate your help,
    thanks for your time, bye.

    import javax.media.*;
    import javax.media.format.*;
    import javax.media.protocol.*;
    import java.io.IOException;
    import javax.sound.sampled.AudioInputStream;
    public class LiveAudioStream implements PushBufferStream, Runnable {
        protected ContentDescriptor cd = new ContentDescriptor(ContentDescriptor.RAW);
        protected int maxDataLength;
        protected int vez = 0;
        protected AudioInputStream data;
        public AudioInputStream audioStream;
        protected byte[] audioBuffer;
        protected javax.media.format.AudioFormat audioFormat;
        protected boolean started;
        protected Thread thread;
        protected float frameRate = 20f;
        protected BufferTransferHandler transferHandler;
        protected Control [] controls = new Control[0];
        public LiveAudioStream(byte[] audioBuf) {
             audioBuffer = audioBuf;
                      audioFormat = new AudioFormat(AudioFormat.ULAW,
                          8000.0,
                          8,
                          1,
                          Format.NOT_SPECIFIED,
                          AudioFormat.SIGNED,
                          8,
                          Format.NOT_SPECIFIED,
                          Format.byteArray);
                      maxDataLength = 40764;
                      thread = new Thread(this);
         * SourceStream
        public ContentDescriptor getContentDescriptor() {
         return cd;
        public long getContentLength() {
         return LENGTH_UNKNOWN;
        public boolean endOfStream() {
         return false;
         * PushBufferStream
        int seqNo = 0;
        double freq = 2.0;
        public Format getFormat() {
             return audioFormat;
        public void read(Buffer buffer) throws IOException {
         synchronized (this) {
             Object outdata = buffer.getData();
             if (outdata == null || !(outdata.getClass() == Format.byteArray) ||
              ((byte[])outdata).length < maxDataLength) {
              outdata = new byte[maxDataLength];
              buffer.setData(audioBuffer);          
              buffer.setFormat( audioFormat );
              buffer.setTimeStamp( 1000000000 / 8 );
             buffer.setSequenceNumber( seqNo );
             buffer.setLength(maxDataLength);
             buffer.setFlags(0);
             buffer.setHeader( null );
             seqNo++;
        public void setTransferHandler(BufferTransferHandler transferHandler) {
         synchronized (this) {
             this.transferHandler = transferHandler;
             notifyAll();
        void start(boolean started) {
         synchronized ( this ) {
             this.started = started;
             if (started && !thread.isAlive()) {
              thread = new Thread(this);
              thread.start();
             notifyAll();
         * Runnable
        public void run() {
         while (started) {
             synchronized (this) {
              while (transferHandler == null && started) {
                  try {
                   wait(1000);
                  } catch (InterruptedException ie) {
              } // while
             if (started && transferHandler != null) {
              transferHandler.transferData(this);
              try {
                  Thread.currentThread().sleep( 10 );
              } catch (InterruptedException ise) {
         } // while (started)
        } // run
        // Controls
        public Object [] getControls() {
         return controls;
        public Object getControl(String controlType) {
           try {
              Class  cls = Class.forName(controlType);
              Object cs[] = getControls();
              for (int i = 0; i < cs.length; i++) {
                 if (cls.isInstance(cs))
    return cs[i];
    return null;
    } catch (Exception e) {   // no such controlType or such control
    return null;
    and the other one, the DataSource,
    import javax.media.Time;
    import javax.media.protocol.*;
    import java.io.IOException;
    import java.io.InputStream;
    import javax.sound.sampled.AudioInputStream;
    public class CustomDataSource extends PushBufferDataSource {
        protected Object [] controls = new Object[0];
        protected boolean started = false;
        protected String contentType = "raw";
        protected boolean connected = false;
        protected Time duration = DURATION_UNKNOWN;
        protected LiveAudioStream [] streams = null;
        protected LiveAudioStream stream = null;
        public CustomDataSource(LiveAudioStream ls) {
             streams = new LiveAudioStream[1];
             stream = streams[0]= ls;
        public String getContentType() {
         if (!connected){
                System.err.println("Error: DataSource not connected");
                return null;
         return contentType;
        public byte[] getData() {
             return stream.audioBuffer;
        public void connect() throws IOException {
          if (connected)
                return;
          connected = true;
        public void disconnect() {
         try {
                if (started)
                    stop();
            } catch (IOException e) {}
         connected = false;
        public void start() throws IOException {
         // we need to throw error if connect() has not been called
            if (!connected)
                throw new java.lang.Error("DataSource must be connected before it can be started");
            if (started)
                return;
         started = true;
         stream.start(true);
        public void stop() throws IOException {
         if ((!connected) || (!started))
             return;
         started = false;
         stream.start(false);
        public Object [] getControls() {
         return controls;
        public Object getControl(String controlType) {
           try {
              Class  cls = Class.forName(controlType);
              Object cs[] = getControls();
              for (int i = 0; i < cs.length; i++) {
                 if (cls.isInstance(cs))
    return cs[i];
    return null;
    } catch (Exception e) {   // no such controlType or such control
    return null;
    public Time getDuration() {
         return duration;
    public PushBufferStream [] getStreams() {
         return streams;
    hope this helps

  • Help with simple XML reading example using StAX

    Please, could somebody help me with this issue?
    Or, could somebody point me to a comprehensive StAX tutorial?
    thanks!
    I have prepared a simple sample that looks like 'homework', but this newbie task is getting me crazy...
    I just want to store in the object Shop[] shopsArray; the next XML file, using StAX:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <shops>
        <shop>
             <name>Amazon</name>
            <code>AMZ</code>
            <url>www.amazon.com</url>
            <product>
                <book>
                    <name>Core JSF</name>
                    <code>cojsf</code>
                    <price>136</price>
                    <pages>333</pages>
                </book>
            </product>
            <product>
                <book>
                    <name>Java forr Dummies</name>
                    <code>jfd</code>
                    <price>68</price>
                    <pages>400</pages>
                </book>
            </product>
            <product>
                <video>
                    <name>Braveheart</name>
                    <code>brvh</code>
                    <price>15</price>
                    <duration>3h</duration>
                </video>
            </product>
        </shop>
         <!-- <shop>Other types of shops</shop> -->
    </shops>Having the related classes below:
    public class Shop {
         String name;
         String code;
         String url;
         Product[] productsArray;
    public class Product {
         String name;
         String code;
         String price;
    public class Book extends Product {
         String pages;
    public class Video extends Product {
         String duration;
    }

    [http://vtd-xml.sf.net|http://vtd-xml.sf.net] While I am not an expert on StAX, I think you may be interested in vtd-xml to simplify coding as it
    supports random access and XPath
    http://vtd-xml.sf.net

  • Help with a YouTube Tutorial

    Hi,
    Hope you're doing well.
    I'm using the following tutorial to learn create a realistic beer bottle (w/beer inside it):
    http://www.youtube.com/watch?v=pRkgWSWJYUc
    At around 13:30, the instructor does something that I've gone over several times but cannot seem to get what he's doing. He's draws a shape around the bottle with the pen tool, plays with it a little to get the shape he wants and goes into the path window and loads it as a selection. Once selected he goes back into the layers panel, says he is going to add an additional layer mask to the layer (there is already one on it), then says oops and clicks off and is somehow able to still create some sort of mask where the shape he just created is masked revealing the beer underneath without actually creating an additional mask using the add vector mask button.
    I do everything up until that point correctly but am not sure where I am going wrong. It may just be as simple as de-selecting when I am not supposed to or not locking a layer or something.
    You help would be greatly appreciated.
    Thanks very much!

    I had followed-up your answer with the question why it then wasn't allowing me to use the pen tool for the shape he creates next without it automatically filled and then I realized it's because I wasn't choosing the pen tool in paths mode.

  • Need help with Image Gallery tutorial.

    Hi all,
    No response from Apex Listener Forum...moved here....
    Apex Listener - 2.0.2.133.14.47
    Apex             - 4.2.2.00.11
    When running Image Gallery application as per tutorial, page just show a blank screen with no image upload button.
    Am using Firefox 22.0 and Chrome 28.0.1500.72.
    Firebug does not display any script error.
    Had recreated tutorial on apex.oracle.com with same result as above.
    http://apex.oracle.com/pls/apex/f?p=4550:1:::::F4550_P1_COMPANY:HANAMIKE
    Workspace: HANAMIKE
    Username: [email protected]
    Password: yesla
    Using username= resteasy_admin, Password=resteasy_admin to run on apex.oracle.com.
    Had modified tutorial JS below :
    var workspace_path_prefix = 'resteasy';     =>  var workspace_path_prefix = 'hanamike';
    Another odd problem was when trying out the RESTFUL service as per tutorial when clicking the 'TEST' button, encountered error 404.
    Problem due to extra workspace name in URL as below:
    http://apex.oracle.com/pls/apex/hanamike/hanamike/gallery/images/
    Had to manually modify it to:
    http://apex.oracle.com/pls/apex/hanamike/gallery/images/
    Notice that the Listener version on apex.oracle.com is:
    APEX_LISTENER_VERSION
    2.0.3.165.10.09
    Thanks in advance.
    Zack
    Message was edited by: Zack.L

    Hi Zack,
    Thanks for providing the login credentials to your workspace.  I took a look at your RESTful Service and associated application, and noticed that there was something missing - the "Upload Image" button! So it looks like the 'Create the Gallery Application' section is missing a step to create a HTML region, with region template "Button Region without Title", and with its region source set to the following:
    <a class="button" id="upload-btn">Upload Image</a>
    You'll see in the JS that there's a reference to #upload-btn, but no such object existed on your page.  I created a copy of your app, which includes this new HTML region, and you'll see that I've uploaded an image as a demo.  I've contacted the APEX Listener team re the missing instruction, so that will hopefully be rectified in the next release.  Apologies for the confusion, but hopefully you're back on track now.  As for the behaviour you've noticed with the URL generated by the 'Test' utility, thanks for bringing this to our attention.  I'll do some further investigation there, and log a bug if required.
    Regards,
    Hilary

  • Need help with a very simple example.  Trying to reference a value

    Im very new to Sql Load and have created this very simple example of what I need to do.
    I just want to reference the ID column from one table to be inserted into another table as DEV_ID.
    Below are my: 1) Control File, 2) Datafile, 3) Table Description, 4) Table Description
    1) CONTROL FILE:
    LOAD DATA
    INFILE 'test.dat'
    APPEND
    INTO TABLE p_ports
    FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
    DEV_id REF(CONSTANT 'P_DEVICES',NAME),
    NAME FILLER ,
    PORT_NO
    2) DATAFILE:
    COMM881-0326ES09,6
    3) TABLE DESCRIPTION:
    SQL> describe p_ports
    Name Null? Type
    ID NOT NULL NUMBER(10)
    DEV_ID NOT NULL NUMBER(10)
    PORT_NO     NUMBER(3)

    hi,
    i managed to do this for my app. (think i referred to viewTransitions sample code and modified quite a bit)
    i can't remember this well cos i did this quite a while back, but i will try to help as much as possible
    1) from the appdelegate i initialize a root controller (view controller class)
    2) this root controller actually contains two other view controllers, let's call it viewAController and viewBController, for the screens which u are going to toggle in between. and there's also a function, let's call it toggleMenu, which will set the menus to and fro. i copied this whole chunk from the sample code. it actually defines the code on what to do, i.e. if current view is A switch to B and vice versa.
    3) inside the controller files, you need to implement the toggleMenu function too, which basically calls the rootController's toggleMenu
    4) we also need viewA and viewB files(view class)
    5) need to add the .xib files for the respective views and link them up to the controller class. i did not use the .xib files for ui layout though, because of my app's needs. however, it will not work properly without the .xib files.
    5) inside the view class of both views, i.e. viewA.m and viewB.m, you need to create a button, that will call the toggleMenu function inside the respective controller class.
    it will look something like this:
    [Button addTarget:ViewAController action:@selector(toggleMenu:) forControlEvents:UIControlEventTouchUpInside];
    so the flow is really button (in view)-> toggleMenu(viewController) -> toggleMenu(rootController)
    i'm sorry it sounds pretty hazy, i did this part weeks before and can't really remember. i hope it helps.

Maybe you are looking for

  • How can you connect Ipod to a linux system?

    Bought our study abroad student an Eee PC computer that will work well in his home country of Africa. My boys got Ipods for Christmas and I gave him one too. We are unable to find a way to get it to connect to his linux system. Is is possible?? It is

  • Base Value not changing in MIGO Excise Tab

    Dear Gururs, We are using MIGO to capture & Post Excise Invoice for our Import PO (PO type ZIMP). the problem is, when we change the qty in MIGO Qty tab, corresponding base value is not getting update in Excise tab. Please suggest a solution.

  • Update - 4.3.2 - 4.2.1 ?

    How could i avoid updating to 4.3.2 and update to 4.2.1 -- Currently, i have 4.1, but i want to update to 4.2.1 but, itunes makes you update latest update! Help me - In need!

  • Re: How long to fix a fault?

    Hi I reportred a fault on Thursday as my services was supposed to be up and running by wednesday and now it is sunday and nothing has happened and i was told on the phone that it would be resolved by monday. I got a phone call saying that there cant

  • Not able to switch the theme in Apex

    Hi, I want to switch the theme in my apex application. I had created a new theme from the apex repository but when i am trying to switch it is giving me error from some templates type. Can anybody help me to fix this issue. Thanks Saurabh