Very simple Hashtable question

Ok, this might be a very dumb one, but I can't spot the error. After seeing numerous examples of a hashtable, I tried the following:
Hashtable p = new Hashtable();
p.put ("Alberta", "ab");
But I keep getting the following error:
<identifier> expected
p.put ("Alberta", "ab");
Can anyone tell me what I'm doing wrong???

It's not a problem with hashtables, specificly. you can't add elements to an hash or a vector or perform another routine outside a method or a constructor. there is no way that
that operation can be executed during compiling.
regards

Similar Messages

  • Very simple jstl question

    I for the life of me have not been able to find the answer to this very simple question, googling and looking at various documentation. What is the difference between accessing properties using $ or #? Is there a difference?
    Thanks

    Read on this excellent explanation about the unified EL: http://java.sun.com/products/jsp/reference/techart/unifiedEL.html

  • Very Simple C question - reading input parameters/flags... [SOLVED]

    This is an extremely simple question. Please forgive me for being a noob. I am writing an application in C (with GCC) called GAPE and need to be able to pass it parameters through a shell script (/usr/bin/gape) that can determine how it runs. To start with easy stuff, I want the end-user to be able to type "gape -V" to output the version of the program. How do I do that? I understand that I need to put the shell script in /usr/bin...where should I put the actual gcc-compiled gape application? Or do I even need a shell script? Can I just put the GAPE binary in /usr/bin and pass parameters to it directly? If so, how do I do that in C? Any help is greatly appreciated.
    Last edited by tony5429 (2008-03-10 12:00:21)

    include <stdio.h>
    main(int argc, char *argv[])
    int i;
    for(i = 1; i < argc; i++) //argc = the number of arguments
    printf("param nr %d: %s\n", i, argv[i]); // argv[i] contain the arguments, with 0 being the program name (anyone may correct me here)
    [jaqob@p238 c++-egna]$ ./a.out 1 2 3
    param nr 1: 1
    param nr 2: 2
    param nr 3: 3
    [jaqob@p238 c++-egna]$ ./a.out -h -V -zxvf
    param nr 1: -h
    param nr 2: -V
    param nr 3: -zxvf
    A very simple program that prints the parameters
    And yes, you can put the program in /usr/bin/ without a shellscript
    Last edited by JaQoB (2008-03-05 18:09:34)

  • Very simple cfselect question

    Hi,
    I have a really noob question; what is the easiest way to
    output the values of a cfselect dropdown to a cfoutput tag on the
    same page?
    I am only interested in puting the values of the dropdown
    into the cfoutput tag when the user selects on a dropdown item .
    Thanks for your time.

    Thanks for the quick reply!
    I think what i meant to say with the code i posted is that i
    am perfectly happy with validating the form on the server AND i
    have added a submit button to my form (its just not in the code i
    posted) and the form is "in fact" validating to my CF8 server.
    However where I am stuck is that I am not sure if there is still is
    tricky server behavors or other code that i need to add to the form
    or page itself.
    In the code i posted before i still only recieve the first
    output selection regardless if the submit button is pressed the
    value of "50" always appears/reappears.
    I am still new to CF and i like it a lot but it is a little
    puzzling that for such a ultra-simple task as what im stuck with i
    hope that i dont need to write reams and reams of code to do this.
    Thank you in advance.

  • Very simple network question

    Forgive my stupidity asking this question...
    I have an iBook G4 and two Windows PCs (one W2K, one XP) all happily sharing a wi-fi network using Airport Express.
    I am about to dash out to the shops to buy a USB printer so that we can all print wirelessly, using iFelix's fab website for guidance. My incredibly dumb question is this: do I need to establish any kind of network before embarking on the printer-sharing project, or, by the very fact that we are all sharing a wi-fi network, are we already three "networked" computers??
    I don't want to share any files between the computers, just a printer. Is there anything I need to do beforehand to create a network, or are we already one??
    iBook G4   Mac OS X (10.3.9)   Window XP, Windows 2000, AirPort Express

    Sanhodo: there are reports of problems with windows sharing a printer to a wireless iBook. You should read iFelix guide to wireless printing (run a google search), it will shed some light on the subject.
    JFYI, the setup of Claudine is completely different from yours, since she will connect the printer to THE ROUTER, not to a computer --which is your case-- and therefore she will avoid the problems of windows printer sharing...

  • Very simple XML question

    1. I have a simple table with a clob to store an unlimited number of contacts as follows ....
    CREATE TABLE MY_CONTACT (USER_id NUMBER, All_Contacts SYS.XMLTYPE );
    2. I inserted 1 user with 2 contacts as follows :
    INSERT INTO MY_CONTACT
    VALUES(1, sys.XMLType.createXML('<?xml version="1.0"?>
    <CONTACT>
    <CONTACTID ID="1">
    <FNAME>John</FNAME>
    <MI>J</MI>
    <LNAME>Doe</LNAME>
    <RELATIONSHIP> </RELATIONSHIP>
    <ADDRESS>
    <STREET>1033, Main Street</STREET>
    <CITY>Boston</CITY>
    <STATE>MA</STATE>
    <ZIPCODE>02118</ZIPCODE>
    </ADDRESS>
    </CONTACTID>
    <CONTACTID ID="2">
    <FNAME>Carl</FNAME>
    <MI>J</MI>
    <LNAME>Davis</LNAME>
    <RELATIONSHIP>Son</RELATIONSHIP>
    <ADDRESS>
    <STREET>1033, Main Street</STREET>
    <CITY>San Francisco</CITY>
    <STATE>CA</STATE>
    <ZIPCODE>06456</ZIPCODE>
    </ADDRESS>
    </CONTACTID>
    </CONTACT>'));
    --- 1 row inserted .
    I have the the following issues :
    3. When I run the following :
    select A.All_Contacts.extract('/CONTACT/CONTACTID/@ID').getnumberval() ID,
    A.All_Contacts.extract('/CONTACT/CONTACTID/FNAME/text()').getstringval() FNAME,
    A.All_Contacts.extract('/CONTACT/CONTACTID/LNAME/text()').getstringval() LNAME
    from MY_CONTACT A ;
    I was hoping this query would return :
    ID FNAME
    1 John
    2 Carl
    But instead, I am getting : .... How do I fix the query to get the results I am looking for ( above) ?
    ID FNAME
    12 JohnCarl
    4. I have another query :
    select A.All_Contacts.extract('/CONTACT/CONTACTID/@ID').getnumberval() ID,
    A.All_Contacts.extract('/CONTACT/CONTACTID/FNAME/text()').getstringval() FNAME,
    A.All_Contacts.extract('/CONTACT/CONTACTID/LNAME/text()').getstringval() LNAME
    from MY_CONTACT A
    where
    A.All_Contacts.extract('/CONTACT/CONTACTID/@ID').getstringval() = 1;
    that returns no rows at all !!!
    How do I get the query to return only the first set of values for CONTACTID ID=1 ? :
    ID FNAME
    1 John
    I hope this is easy to fix - my aim is to store up to ten contacts in the clob, but I cant't even get it to work with just 2 contacts ...
    Any help would be greatly appreciated.
    Thanks !!!

    If you are on 10g (I think at least 10.2.x.x) or greater, then you can also use the following. I prefer XMLTable over the table(xmlsequence()) structure.
    SELECT cid, fname, lname
      FROM MY_CONTACT A,
           XMLTABLE('CONTACT/CONTACTID'
                    PASSING A.All_contacts
                    COLUMNS
                    cid    NUMBER PATH '@ID',
                    fname  VARCHAR2(20) PATH 'FNAME',
                    lname  VARCHAR2(20) PATH 'LNAME')
    WHERE cid = 1;
          

  • Very Simple Numbers Question

    Hi all,
    I am recently converted from the PC world...
    I am trying to create a simple line graph in numbers. I have a data set that consists of about a dozen columns containing summary data from 1955 - 2007. The first column 'A' contains the year, and all subsequent columns contain the yearly variable value.
    I am trying to creat a simple line graph of each variable from year to year (i.e the first column, year, is my horizontal (x) axis, and what ever other variable -or column- is my verticle (y) axis.
    I have done this (and am doing this) quite easily in excel, but I have spend the better part of an evening trying to figure it out in numbers ('08 or '09).
    I looked at the online manuals and tutorials, but they were of no help.
    Any assistance will be most welcome.
    Many Thanks,
    Bryan

    Select the cells with dates and totals > Toolbar > Chart > Line chart > the table will have the axis the wrong way around for what you want so click the black box on the table with III on to change it to ☰.
    Open Inspector > Chart to set up the chart the way you want.
    The User Guide is available under Help on the Numbers Menu Bar,
    S.

  • Very simple Parameter question in Eclipse

    I simply want to create a report where a user can pick a date range at runtime.  I designed a simple report, added parameter fields and ran it in the designer.  It prompted me for dates and I filled them in.  The report ran in the designer just fine.  When I publish the report to the Apache Tomcat web site, I want the prompts to pop up for the user so they can pick the date range.  There are no parameters that pop up and the parameter panel shows NO parameters.  Can someone point me to a document or process that will allow me to prompt the user for these dates?  I am invoking the report from the JSP that is generated by the plugin.

    Are you passing paramete values in your code? If you do not then it will automatically asks for parameters.
    Regards,
    Tejaswini

  • Very simple Strings Question

    Hi All:
    I am stuck with a small situation, I would appreciate if someone can help me with that. I have 2 strings:
    String 1 - "abc"
    String 2 - "I want to check if abc is in the middle"
    How can I check if the string 1 "abc" is in the middle of the string 2. I mean the String 2 does not start with "abc" and it does not end with "abc", I want to check if it is somewhere between the string.
    Thanks,
    Kunal

    int i = s2.indexOf(s1);
    if((i > 0) && ((i + s1.length()) < s2.length())) {
       // somewhere in the middle
    } else if(i == 0) {
       // start
    } else if((i + s1.length()) == s2.length()) {
       // end
    } else if(i == -1) {
       // nowhere
    }

  • Very simple connection question

    New user here - about to begin learning how to use Logic Studio. I'm working on a MacBook Pro and would like to know how I'd go about being able to connect a synth, or mini disc etc. with it's stereo phono outputs, to my laptop. I'd need some kind of interface. Can anyone suggest something?

    Thanks. I'll be using a Korg Triton, and just now and then I may have that with me without my laptop, so may create stuff on it using it's own sequencer that I then want to play/record into Logic when I can, to do further work on it. I bought an Edirol UA-25 interface the other day - yet to plug it all in, but I guess that's gonna do that job?

  • A very simple voicemail question - please help!

    Hi
    My iphone 3G cuts into voicemail after only 3 rings, which isn't enough time to get it out of my pocket let alone answer!!
    How do I lengthen the amount of rings before it goes to voicemail. I've tried everything (seemingly) and there doesn't seem to be any voicemail settings anywhere on the phone.
    Many thanks

    This is controlled by your carrier, not the phone. Most carriers have a max of about 30 seconds they can set before going to voicemail. Call your carrier and ask them to extend the time to voicemail.

  • One very simple quick question please

    I am needing to admin one computer from remote sites. As the admin computer will have different IP addresses each time I work, I don't imagine this will be a problem. However, which IP address should I use for the one client. The client machine is connecting through Qwest DSL, and has an external IP and a local IP. When I use the admin computer at the same location as the client, the external IP match and the local IP are different. How do I get to the correct machine when I am imagining that all of the Qwest DSL connected computers on the same node will have the same external IP. Can I "stack" IP's? - e.g. 123.111.11.182, 222.222.222.255 ?
    Thanks in advance for all of your help.
    Al

    Normally you use the externally-facing IP address Qwest will assign to the modem, or the IP address the router picks up if a router is in use. If a router is in use, you may also have to open the appropriate ports for ARD and forward them to the client's internal IP address.

  • Very simple html5 quiz runs very slow on android 4

    I created a very simple 10 question, no pictures, no transitions, and no audio (which I can't get to work anyway when exported as html5 for android) html5 app built with phonegap.  I tried everything that was suggested by other developers, and I can't get a simple quiz to run even with a poor framerate.   I get about 5 to 10 fps. 
    Has anybody successfully built an APP that runs OK on Androids running KitKat?
    Thanks

    I'd recommend profiling the application with Adobe Scout to see what's going on, then optimizing based on those results.
    http://gaming.adobe.com/technologies/scout/

  • Simple query question

    hi all,
    I have a XMLType table with one column - I have presently one row, in my column xmlsitedata I have stored one large xml file.The schema definition is given below:
    <?xml version="1.0" encoding="UTF-8" ?>
    - <xs:schema elementFormDefault="qualified" attributeFormDefault="unqualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
    - <xs:element name="siteList">
    - <xs:complexType>
    - <xs:sequence>
    <xs:element name="site" type="siteType" minOccurs="0" maxOccurs="unbounded" />
    </xs:sequence>
    </xs:complexType>
    </xs:element>
    - <xs:complexType name="siteType">
    - <xs:sequence>
    <xs:element name="nameEn" type="xs:string" />
    <xs:element name="nameFr" type="xs:string" />
    </xs:sequence>
    <xs:attribute name="code" type="xs:string" />
    </xs:complexType>
    </xs:schema>
    I have executed the query below:
    select x.XMLSITEDATA.extract('/siteList/site/nameEn/text()').getCLOBVal() "stName" from wsitelist x;
    and I get all english names of some 200 locations, however, there is 1 row selected and all names show up on one row. How do I split them into 200 or whatever rows?
    Thanks,
    Kowalsky

    Have a look at the answer provided in the following thread.
    very simple XML question
    This may solve your problem.
    use xmlsequence.
    Alvinder

  • This is a very simple question,but I don't know.Please me.Thank you!

    I am a Chinese student in a university.I have a very simple question to ask.
    I have writed a EJB module,and I have deployed to Weblogic8.1 successfully.
    1.Now I want to write a client program.Is it necessary that the client program is packaged in the EJB package.For example ,the EJB package is Beans,is "package Beans " or "import Beans.*" necessary in my client program.
    2.If I only know the EJB interfaces,that means the EJB module is writed by other programer.I want to know how I can write the client program.How can I call EJB module's method writed by other programer.Could you give me a simple example?
    Thank you very much.

    I have writed a EJB module,and I have deployed to
    Weblogic8.1 successfully.:-)
    1.Now I want to write a client program.Is it
    necessary that the client program is packaged in the
    EJB package.For example ,the EJB package is Beans,is
    "package Beans " or "import Beans.*" necessary in my
    client program.You need not package your client with the EJB. It can be a JSP/servlet or a stand-alone application.
    2.If I only know the EJB interfaces,that means the
    EJB module is writed by other programer.I want to
    know how I can write the client program.How can I
    call EJB module's method writed by other
    programer.Could you give me a simple example?
    import java.util.*;
    import javax.naming.*;
    import javax.rmi.PortableRemoteObject;
    import examples.*;
    class TestEJBHello {
        public static void main(String[] args) {
            Context context   = null;
            Object object     = null;
            // Hashtable for environment properties.
            Hashtable env = new Hashtable();
            env.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
            env.put(Context.PROVIDER_URL, "t3://localhost:7001");
            HelloHome home            = null;
            HelloWorld hello          = null;
            try {
                context     = new InitialContext(env);
                object      = context.lookup("HelloWorldTest");
                System.out.println(" JNDI Looked up >>> " +object);
                home        = (HelloHome)PortableRemoteObject.narrow(object, HelloHome.class);
                hello       = home.create();
                System.out.println(hello.hello());
            } catch(Exception e) {
                e.printStackTrace();
            } finally {
                close(context);        // Closes the initial context.
        private static void close(Context context) {
            try {
                context.close();
                System.out.println("*** Context closed. ***");
            } catch (NamingException namingException) {
                namingException.printStackTrace();
            } catch(Exception exception) {
                exception.printStackTrace();
    }Here's a sample client app code I use for a HelloWorld EJB. You need to have a EJB client JAR containing the home and remote interfaces in the classpath during compile time and runtime.
    x

Maybe you are looking for

  • Validation Error when updating Feature work item to completed state?

    We are on the latest version of TFS 2013 and have customized process templates based off of the Scrum template. We have a custom workflow for the Feature work item type. I get an error when trying to update the state to custom done state of "Prod Dep

  • ABAP Objects template for HR programs

    Is there a template to use Objects in HR programs the way we had with HR-macros ? It used to be like this when using PNP LDB: <b>INITIALIZATION</b> <i><initialize buffer></i> <b>START-OF-SELECTION</b> <i><initial setup></i> <b>GET PERNR rp-provide-fr

  • Error found in Communication channel monitoring ( component monitoring)

    Hi Experts,     When i executed the RFC from R3, i got the below error in runtime work bench. please help me out if any one knows, i already gone throug some of sdn linke, but i am not able to get exact solution. com.sap.aii.af.rfc.RfcAdapterExceptio

  • Not able to download SAP NetWeaver 7.0 (2004s) Trial Version - Full Java Ed

    Hello people, I have been trying to download the SAP NetWeaver 7.0 (2004s) Trial Version - Full Java Edition. There are two files to download, - Developer Workplace 7.0 SP14SR3 Java Server Evaluation (4.214.608.965 bytes) - Developer Studio 7.0 SP14S

  • How to get needed files for a PCI-5124 after a computer upgrade

    A LabView program that uses a high-speed digitizer PCI-5124 (software P/N 500783T-00 version 2.8.1) was written under LabView 7.  The computer was replaced with a new one with LabView 8.2.  We installed the digitizer board in the new computer and ins