Name and int using a String

Hi everybody,
ive got a class that creates a new int. i want the name of the int to be a parameter that i can send into the class. so for example:
public testObject(String intName)
then in my main I could say:
testObject grader = new testObject(gradeOne);
and the testObject class would make a new int called gradeOne.
does anybody know how i could accomplish this?

Well you can hava a java.util.Map that maps Strings (for the names) to Integers (for the values).
You could encapsulate that map within another class if you feel that helps the design, and provide a method that expresses the relationship pretty easily, e.g.,:
public class NamedInts {
  private Map mapping = new HashMap();
  public void addNumber(String name, int value) {
    mapping.put(name, Integer.valueOf(value));
  // other methods, presumably, as well
}Is that what you meant?

Similar Messages

  • Find product name and version using JNDI

    Is there any consistent way to find the directory servers product name and version using JNDI. Our software is being used with iPlanet 5.1 and SunOne Directory Server and I need to distinguish between them. Currently I use some code (see below) to look for an object under o=Netscape root branch. But the object I am looking for is apparently (so my sys admin tells me) created as part of the administration server install.
    public static String[] getNetscapeFamilyDirectoryServerDetails(String ldapHost, int ldapPort, String principalDN, String principalPassword) throws NamingException {
    try {
    NamingEnumeration result = performLdapQuery("ldap://" + ldapHost + ":" + ldapPort,"o=NetscapeRoot?nsproductname,nsproductversion?sub?(&(objectclass=nsApplication)(cn~=Directory))",principalDN,principalPassword);
    if (result.hasMore()) {
    SearchResult sr = (SearchResult)result.next();
    Attribute attribute = sr.getAttributes().get("nsproductname");
    String productName = (String)attribute.get();
    attribute = sr.getAttributes().get("nsproductversion");
    String productVersion = (String)attribute.get();
    return new String[]{productName,productVersion};
    catch (Exception e) {
    if (e instanceof NamingException) {
    throw (NamingException)e;
    return null;
    }

    SELECT i.instance_name, i.host_name, f.release_name RELEASE, i.version, k.patch_level FROM
    v$instance i, fnd_product_groups f, fnd_product_installations k WHERE
    UPPER(SUBSTR(i.instance_name, 1, 4)) = UPPER(SUBSTR(f.applications_system_name, 1, 4)) AND
    k.application_id = '200';

  • How to find Mobile device OS name and version using Flex?

    is there anyway to get device information like OS name and version using flex 4.5.1 or 4.6 SDK. i am developing a project in Flex which needs to identify the end user mobile platform like Android, iOS.. and its version like Android means 2.1,2.2,etc..
    Anyone can help me on this?

    I don't know that there is a proprietary driver. In fact, I'm sure there isn't because I never installed one. I figured there was some code file somewhere that dealt with keyboards. Yes, I have dealt with the developer, they say to tell Apple there is a problem. I have been putting it off and waiting to update since 10.6.3, so the problem is getting a little old. Do I even know there is a problem? I'm not sure what this means. I do know that when I update my operating system past 10.6.2 my keyboard no longer works, and I have to use a stock Apple keyboard to run a time machine reinstall. Why else would I be going through this?

  • My phone was stolen, I have moved it in lost mode,but I can see that whoever has it,is changing phone name and can use it until I activate lost mode again.Can I do it permanently? How can I cancel ICloud back for the stolen phone,it blocks Cloud memory?

    My phone was stolen, I have moved it in lost mode,but I can see that whoever has it,is changing phone name and can use it until I activate lost mode again.Can I do it permanently? How can I cancel ICloud back for the stolen phone, as I cannot delete the stolen phone backup (says that backup is being in use) and this is keeping memory occupied in the Cloud and I cannot back-up the other devices.

    http://support.apple.com/kb/ht2526

  • How to get Cookie Name and Value Using HttpGetterCallback - CE 7.3

    Hi All,
    We are migrating from Netweaver 7.0 to 7.3. We are facing a issue when migrating the custom login module from 7.0 to 7.3.
    Since WebCallback is deprecated and not to be used in Netweaver 7.3, we are finding difficulties in getting the cookie name and value. Please find below our coding for getting the cookie value using HttpGetterCallback. We are not getting the cookie name and value, Kindly let us know if we are implementing the HttpGetterCallback correctly.
    HttpGetterCallback httpGetCookieCallback = new HttpGetterCallback();
    httpGetCookieCallback.setType(HttpCallback.COOKIE);
    Callback] callbks = new Callback[ { httpGetUrlCallback, httpGetCookieCallback };
    callbackHandler.handle(callbks);
    requestUrl = (String) httpGetUrlCallback.getValue();
    Cookie] cookies = (Cookie [) httpGetCookieCallback.getValue();
    if (cookies != null) {
    for (int i = 0; i < cookies.length; i++) {
    location.debugT("Cookies name " + cookies.getName()
    + " - value "
    + cookies.getValue());
    Thanks and Regards,
    Saravanan

    Try This-
            Cookie cookiesArray[] = request.getCookies();
         Cookie currentCookie = null;
         String currentCookieName = "";
         String cookieValue = "dummycookie";
         int cookieArrayLength = cookiesArray.length;
         for (int i = 0; i < cookieArrayLength; i++) {
              currentCookie = cookiesArray<i>;
              currentCookieName = currentCookie.getName();
              cookieValue = currentCookie.getValue();
    Regards,
    Atul

  • Getting Asset Name and ID using postgreSQL command line

    Hi,
    I`m excited by the possibility of getting/putting Annotations from/to FCSvr from command:
    /Library/Application\ Support/Final\ Cut\ Server/Final\ Cut\ Server.bundle/Contents/Resources/sbin/fcsvr_run psql px pxdb -c "select * from pxtcmdvalue;"
    Using grep and awk (print) it`s possible to extract individual fields. But first I need to identify
    Assets Names with Assets ID`s.
    Anyone know how to get from command line an asset name from ID and vice versa?
    In other words: If I grep for the ID and awk for the 3, 4, and 5 column I can extract TCIN, TCOUT and the Annotations from that Asset ID. But I want to know what Asset is and write to a text file with the asset name and not the asset ID.
    The syntax would be more or less like this:
    For each ID on the pxtcmdvalue (first column is entityID) get from FCSvr (or from db) the AssetName the columns with TCIN, TCOUT and Value of Annotations. Put (append if more than one entries) this on a tabulated text file named after AssetName.
    I`m sorry for not being so "program write" like, but I try! ahaah
    Thanks!

    Hey guys,
    Thank you very much for all this help! Especially fbm! Thanks a lot!
    Regarding inserting into annotation I could manage to do that , as I`ve said, I`m stubborn! hehehehe
    with this command you can insert an annotation (ONE with each command) into a clip:
    /Library/Application\ Support/Final\ Cut\ Server/Final\ Cut\ Server.bundle/Contents/Resources/sbin/fcsvr_run psql px pxdb -c "INSERT INTO pxtcmdvalue VALUES (72, 1527, '00:35:41;09/(30000,1001)', '00:36:28;24/(30000,1001)', 'if works I`ll be very happy!', 1, '2009-03-15 19:31:15.839795-03');"
    Of course, remembering to change all things inside single quotes.
    The only catch is that you`ll have to know the entityid for the asset in question. Of course, looking into fbm post above it`s possible to "translate" the entityid into the ASSETID, but I don`t know how to parse this inside the parentheses. Maybe letting the "72" (in my case) entityid as "entityid" and outside the parentheses translating with INNER JOIN???
    We`re almost there!! I`m glad that this is here, opened to every one that wants to adventure into FCSRV "dark" side!
    Just remember, this is NOT supported by APPLE! I`m testing this on a test FCSRV installed on a mini (yes I could "hack" into the "detecting hardware" and disable to manage to install).
    Just one more thing: I`ve read somewhere that the pxatommap table has ALL that FCSRV could provide (and of course yours custom md). I`m trying to get ALL this fields to each asset. I`ve tried the command:
    /Library/Application\ Support/Final\ Cut\ Server/Final\ Cut\ Server.bundle/Contents/Resources/sbin/fcsvr_run psql px pxdb -c "SELECT * FROM pxatommap INNER JOIN pxmdvalue ON pxatommap.id = pxmdvalue.fieldid"
    But it`s very messy and it`s not for one asset.
    Thanks again you all that took the time to post to help others like me!
    Regards!

  • Determining the browser name and version using an applet

    hi all,
    can we determine the version and the name of the browser using an applet. If it can be done then plz can anyone tell me how to do it.
    Thanx

    Hello trogan,
    >>How do I access the class name and method of an exception within my program? Pretty basic stufff I know, but can't seem to do so.
    Since you post your question to this forum, I assume that the exception is thrown by your .NET application, in .NET, as far as I know, an exception is represented by a Type in actual, since it is a type and I assume that you catch the exception as :
    try
    catch(exceptionobject e)
    //process excetion
    we can use
    reflection to get all information from the instance “e”of the exception.
    For your second question, it seems to be related the usage of Visual Studio, I suggest that you could post it to
    Visual Studio forum.
    Regards.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How to output variable names and units used in binary file

    My colleague will be giving me binary files (*.dat) generated from within LabView. There are over 60 variables (columns) in the binary output file. I need to know the variable names and units, which I believe he already has set up in LabView. Is there a way for him to output a file containing the variable name and unit, so that I'll know what the binary file contains? He can create an equivalent ASCII file with a header listing the variable name, but it doesn't list the units of each variable.
    As you can tell I am not a LabView user so I apologize if this question makes no sense.
    Solved!
    Go to Solution.

    Hi KE,
    an ASCII file (probably csv formatted) is just text - and contains all data that is (intentially) written to. There is no special function to include units or whatever!
    Your collegue has to save those information the same way he saves the names and the values...
    (When writing text files he could use WriteTextFile, FormatIntoFile, WriteToSpreadsheetFile, even WriteBinaryFile could be used...)
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • Rename Model Name and ID using Excel

    Hi everyone,
    after deployed a tabular model in Analysis Services from an Excel file using "Restore from Power Pivot..."
    I connected to the cube with Excel and I could notice that the name of the cube is "Model"
    I would like to change it using Excel. I found only one solution using visual studio, then script the database and modify the text file manually.
    I think it should be a better way.
    Have you any ideas? Any comment will be highly appreciated.
    Kind Regards,

    Paul, is this still an issue?
    Thanks!
    Ed Price, Azure & Power BI Customer Program Manager (Blog,
    Small Basic,
    Wiki Ninjas,
    Wiki)
    Answer an interesting question?
    Create a wiki article about it!

  • I changed my Apple ID name and d using my PC and was already verified.

    I changed my Apple ID name  using my PC and was already verified.
    How do I update the Icloud account settings in my Iphone5 and Ipad
    with my new Apple ID without loosing my photos as noted in the prompt when I tried to delete account.
    My old Apple ID Account name is greyed and cannot be edited in my devices.
    And still prompts for a password with my old Apple ID in the prompt message.

    Hi Gracious1,
    The article below will explain how to import your photos onto your Windows computer from your iPhone & iPad:
    iOS: Importing personal photos and videos from iOS devices to your computer
    This all important article about backing up your iOS devices may be helpful as well:
    iOS: How to back up
    I hope this information helps ...
    - Judy

  • Show user´s name and lastname using XML Form Builder

    Hello
    I created a XML project with XML Form Builder and i have to show user´s name an lastname in RenderListItem form.Can anybody help me,please? Thanks

    Hi Unai,
    check out the description by Patricio in this thread:
    https://forums.sdn.sap.com/click.jspa?searchID=78716&messageID=1616027
    Hope this helps,
    Robert

  • Fetching session names from repository using Informatica SDK

    Hi guys, I'm using the Informatica SDK to create a java application that accesses the Informatica repository. I'm having a bit of an issue while trying to fetch the names of already created sessions from the Informatica Repository. I'm able to connect to the repo without any issues and have been able to add sources, targets, mappings, sessions, workflows, etc... and save them directly afterwards. However, when I try to fetch the session names from a folder in the repository, I get the following error: Mon Jul 27 15:03:01 PDT 2015  Severity:DEBUG  ThreadID:14 Running the pmrep process in the working directory: [C:\Informatica\9.6.1\clients\PowerCenterClient\client\bin].Mon Jul 27 15:03:01 PDT 2015  Severity:DEBUG  ThreadID:14 Running the command [listobjects -o session  -f "TechOps" -s .].Mon Jul 27 15:03:01 PDT 2015  Severity:DEBUG  ThreadID:14 Running the command [exit].Mon Jul 27 15:03:01 PDT 2015  Severity:DEBUG  ThreadID:14 Parsing the output of the ListObjects command for each folder.Mon Jul 27 15:03:01 PDT 2015  Severity:DEBUG  ThreadID:14 The following errors occurred while running the ListObjects command: [Failed to read repository connection information. Please first connect to the repository using the connect command.Failed to execute listobjects.].The following errors occurred while running the ListObjects command: [Failed to read repository connection information. Please first connect to the repository using the connect command.Failed to execute listobjects.].com.informatica.powercenter.sdk.mapfwk.exception.RepoOperationException: The following errors occurred while running the ListObjects command: [Failed to read repository connection information. Please first connect to the repository using the connect command.Failed to execute listobjects.].at com.informatica.powercenter.sdk.mapfwk.core.Folder.fetchSessionNamesFromRepository(Unknown Source)at com.informatica.powercenter.sdk.mapfwk.core.Folder.fetchSessionNamesFromRepository(Unknown Source)at com.mars.Main.main(Main.java:170) This doesn't really make sense to me as I'm able to connect to the repo fine to add and save changes. Here's my code for fetching: // Create a list of session names and store the namesList<String> sessionNames = null;try {      sessionNames = folder.fetchSessionNamesFromRepository();} catch (RepoOperationException e) {      // TODO Auto-generated catch block      e.printStackTrace();} catch (MapFwkReaderException e) {      // TODO Auto-generated catch block      e.printStackTrace();} // Print the list of session namesfor (int i = 0; i < sessionNames.size(); i++) {System.out.println("Session " + i + " is " + sessionNames.get(i));} I've confirmed that the folder object works fine as I can add and save other objects to that folder in the repo. The other thing is that if I go to the Informatica path on my drive and run the pmrep command followed by the command for fetching session names, it works fine. Any help on this would be greatly appreciated. Thanks

    Hi Shruti,
    Instead of doing the following when setting the font attributes:
    FontImpl fnt = (FontImpl)res.getFont();
    fnt.getDecoration().setTextColor(c1);
    res.setFont(fnt);
    Try doing this instead:
    res.getAttributes().setForeground(c1);
    res.getFont().setSize(10);
    Hope this helps.
    Regards,
    Dan

  • Business Objects parameters names to configure using JAVA SDK for report generation

    Post Author: christof
    CA Forum: JAVA
    Hello All, I have created a small set of reports which need to be generated from a Java application.The Crystal Reports configuration was relatively easy for the parameters as you have control over their names but is this also the case in Business Objects. For some reports I have created parameters linked to a user prompt. What would the parameters name be that I should use in the Java application.Is this then just the prompt text or should we use e.g. a number e.g parameter 1,.. Kind Regards,

    Post Author: Ted Ueda
    CA Forum: JAVA
    Hello Christof,If you're referring to the Crystal Report parameters via code, then you would refer to them by their parameter name, and not their prompt string.I note that, with BusinessObjects (now called Desktop Intelligence), prompts were referred to by their prompt string.Sincerely,Ted Ueda

  • Application Name and URI extraction through wmi

    Does anyone know how to extract BizTalk application name and URI using WMI (C#)? 
    Thanks in advance.

    Hi Pratibha,
    Above code will only get you the application status or application collection class not the Application NAME(S). To get name of the BizTalk application, you
    need to use “Name” property of
    ExplorerOM.Application
    You cannot get BizTalk application name using WMI. Because Application concepts was first introduced in BizTalk 2006 onwards and WMI class to access the BizTalk
    was introduced in BizTalk 2004 and WMI classes were not updated after that.
    But as suggested you can use
    ExplorerOM
    to access the BiZtalk application name. Following will get you the list of applications in a string. You can update it to get the specific application or
    list of applications as shown below.
    private string GetBTSApplicationNames()
    // connect to the local BizTalk Management database
    Microsoft.BizTalk.ExplorerOM.BtsCatalogExplorer catalog = new Microsoft.BizTalk.ExplorerOM.BtsCatalogExplorer();
    string sAppNames = String.Empty;
    try
    //connection string to BizTalk management database
    catalog.ConnectionString = "SERVER=.;DATABASE=BizTalkMgmtDb;Integrated Security=SSPI";
    //Loop thru the list of applications. Here I am appending it to a string, you can do as your requirment.
    foreach (Microsoft.BizTalk.ExplorerOM.Application application in catalog.Applications)
    sAppNames += application.Name.ToString()+ " ,";
    catch (Exception ex)
    //Handle exception
    System.Diagnostics.EventLog.WriteEntry("AppError", ex.ToString());
    catalog.DiscardChanges();
    throw ex;
    return sAppNames;
    If this answers your question please mark it accordingly. If this post is helpful, please vote as helpful by clicking the upward arrow mark next to my reply.

  • Extract cluster element names and values automatically

    Dear Labview forum,
    I would like to extract cluster element names and values automatically
    without prior knowledge of the cluster element size or contents.
    I am able to extract the names but have some trouble with the values.  (see attached VI)
    I wish to write each the cluster element name and value in a string, and then write the string to a new line in a file.
    Regards,
    Jamie
    Using Labview version 8.0
    Attachments:
    extract cluster element names and values automatically.vi ‏14 KB

    This can become arbitrarily complex, because a cluster can contain many types of data, even other clusters, arrays, typedefs, etc. So getting a "value" of an element is not as easy as you might think. There is a reason you get a variant.
    If all cluster elements are simple numerics you can use "variant to data" with the correct type. The attached shows a few possibilities. Modify as needed.
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    extract_cluster_element_names_and_values_automaticallyMOD.vi ‏23 KB

Maybe you are looking for

  • Does leopard save when I back upon external hardrive?

    Hi, I am upgrading my hardrive and I cant find the leopard installation CD I baught last year. If I back up my whole system using time machine and an external hard drive, does the OS save to and can it be put back onto the macbook when I change my ha

  • HP Pavilion dv6-3023sy: Recovery problems. Help me!

    I have a problem with Recovery: After that: Insert Recovery Media ... Help me, please ... And if you can, please in Russian This question was solved. View Solution.

  • Link to QT videos and display in media holder on same CF page

    I am using a learning object which I downloaded from Macromedia many years ago. The white paper which came with it was very usueful in parts but did not cover this problem. One of the interactions which I was never able to get to work as given was fo

  • Mountain Lion slow to find computers on network

    I'm on a University network and we have several computers that are networked in our set of buildings. It used to be that when I opened up the finder window the list of "Shared" would have several computers listed in it as well as an "All" selection.

  • Are there any firmaware updates for time capsule?

    Are there any firmware updates for Time Capsule/Time machine? I just had a new hybrid (SSD and spinning disk) drive (750 GB) installed on my MacBook Pro and used Boot Kamp to partition it and run Windows xp. Now, my previously working Time Machine wo