Retrieving the key from hashtable
Hi Friends,
I want to retrieve the corresponding key of a value that i'm retrieve. Can any one tell me how to do that. Please quick...
ThNKS IN ADVANCE...
regards,
Prakash
Or easier than that, use the BiMap implementation from Google Collections: http://google-collections.googlecode.com/svn/trunk/javadoc/index.html?http://google-collections.googlecode.com/svn/trunk/javadoc/com/google/common/collect/package-summary.html
Edited by: fw9189 on Oct 30, 2007 2:36 AM
Edited by: fw9189 on Oct 30, 2007 2:37 AM
Similar Messages
-
How can I get keys from Hashtable in the same order?
Hello, everyone.
I have a Hashtable containing key-value pairs, I need to get the keys in the same order as I use
method put(key,value) to save the key-value pairs. But I can only find Hashtable.keys() to fetch the keys in form of Enumeration and when retrieve the keys from the Enumeration,they are not in the original order!
The following is my code:
Hashtable ht = new Hashtable();
ht.put("Name","Harry Bott");
ht.put("Gender","Male");
ht.put("Age","25");
String[] Items = new String[ht.size()];
Enumeration e = ht.keys();
int i = 0;
while(e.hasMoreElements()) {
Items[i++] =(String)(e.nextElement());
The Items contains the keys but they are not in the original order.
Does anyone know how to get the keys from a Hashtable in the same order when they're put?
Thank you!yeah, another solution is to stored keys on a Collection at the same time you put them on the HashMap with its values.
Then when ur going to retrieve objects from the Map u iterate the Collection that has the ordered keys and use them. -
How do i retrieve the serialnumber from an existing Adobe Acrobat x installation
Hi there!
i've 30 Licenses bought for Adobe Acrobat X but i do not know, which key is used for which installation!
i need a scriptable solution to retrieve the key either from registry or files.
i want to inventor my installations and assign the correct computer to the licenses.
thanx in advcance,
best regards,
JörgThx for your answer!
BUT:
i do not need a program, that has to be installed...
i want to run a script, which extracts the serial, that i entered during setup. if Belarc is able to read this info, there should be an other way too! -
How to retrieve the values from a LinkedList
Hello,
I have just put this question in java programming forums by mistake...I think that it should be here ...
I have created a LinkedList to store the results of a query to a database.
These reasults are decimal numbers and then I want to sum all these numbers to be able to make the average.
But when I try to retrieve the values of the Linked List I always receive an incopatible types error..
Here is an extract of my code in a jsp page.
LinkedList Average = new LinkedList();
String Media = rst.getString(10);
Average.add(Media);
int Size = Average.size();
double Sum = 0.0;
for (int i=0; i<=Size; i++)
double Result = Average.get(i)
Sum = Sum + Result;
}If I try to retrieve the value of only one node from the list , I can just putting <%=Average.get(i)%>...but..how can I retrieve all the values (they are decimal numbers) to be able to add them?If you want to sum all the values, is there any reason you just don't retrieve the sum from the database rather than the list of values?
anyway
List average = new LinkedList();
while (rst.next()){
// retrieve the number:
String mediaString = rst.getString(10);
Double media = Double.valueOf(mediaString);
// or maybe like this if it is a number in the database
Double media = new Double(rst.getDouble(10));
average.add(media);
doubleSum = 0.0;
for (Iterator it = average.iterator(); it.hasNext(); ){
Double result= (Double) it.next();
doubleSum += result.doubleValue();
} -
How to retrieve the values from a table if they differ in Unit of Measure
How to retrieve the values from a table if they differ in Unit of Measure?
If no data is read
- Insure that you use internal code in SELECT statement, check via SE16 desactivating conversion exit on table T006A. ([ref|http://help.sap.com/saphelp_nw70/helpdata/en/2a/fa0122493111d182b70000e829fbfe/frameset.htm])
If no quanity in result internal table
- There is no adqntp field in the internal table, so no quantity is copied in itab ([ref|http://help.sap.com /abapdocu_70/en/ABAPINTO_CLAUSE.htm#&ABAP_ALTERNATIVE_1@1@]).
- - Remove the CORRESPONDING, so quantity will fill the first field adqntp1. ([ref|http://help.sap.com/abapdocu_70/en/ABENOPEN_SQL_WA.htm])
- - Then loop at the internal table and move the quantity when necessary to the 2 other fields.
* Fill the internal table
SELECT msehi adqntp
INTO TABLE internal table
FROM lipso2
WHERE vbeln = wrk_doc1
AND msehi IN ('KL','K15','MT').
* If required move the read quantity in the appropriate column.
LOOP AT internal_table ASSIGNING <fs>.
CASE <fs>-msehi.
WHEN 'K15'.
<fs>-adqnt2 = <fs>-adqnt1.
CLEAR <fs>-adqnt1.
WHEN 'MT'.
<fs>-adqnt3 = <fs>-adqnt1.
CLEAR <fs>-adqnt1.
ENDCASE.
ENDLOOP.
- You could also create another table with only fields msehi and adqntp and then collect ([ref|http://help.sap.com/abapdocu_70/en/ABAPCOLLECT.htm]) the data to another table.
Regards,
Raymond -
How to retrieve the values from PL/SQL table types.
Hi Every one,
I have the following procedure:
DECLARE
TYPE t1 IS TABLE OF emp%ROWTYPE
INDEX BY BINARY_INTEGER;
t t1;
BEGIN
SELECT *
BULK COLLECT INTO t
FROM emp;
END;
This procedure works perfectly fine to store the rows of employee in a table type. I am not able to retrieve the values from Pl/SQL table and display it using dbms_output.put_line command.
Can anybody help me please!!!!!
Thanks
Ahmed.You mean, you can't add this
for i in t.first..t.last loop
dbms_output.put_line(t(i).empno||' '||t(i).ename||' '||t(i).job);
end loop;or you can't add this
set serveroutput onor maybe, you are working in third party application where dbms_output is not applicable at all?
You see, not able like very similar it is not working - both are too vague...
Best regards
Maxim -
Is there a simple way to retrieve the data from a resultset using JavaBean?
I have a result set from a select * from users where userid = xxx statement. However, at the moment I have had to hard code the remainder of the code to get the data from each column as I need the column name as well as its data.
I had read somewhere using java beans and reflection it is easier. But i do not know know how.
Is there a simple way to retrieve the data from a result set ?
thanks in advance-
kgWell, it is not really simple. But there are Open Source components to simplify it for you. See e.g http://www.must.de/Jacompe.htm - de.must.dataobj.DataObject and its subclasses. Feel free to contact me if you have any questions: [email protected]
-
Is it possible to retrieve the data from maintainance view?
Hi experts,
Am facing one problem.
Is it possible to retrieve the data from Maintainance View ,If yes how?
IF it is not possible then Y?
While am trying to retrieve data from maintainance view it's showing message like
"it is not a database view or table".
Can u pls give me ans.
Thanks&Regards,
Arun.Hi Arun,
It is not possible to retrieve the data from Maintenance view. Maintenance View is different and Database View is different.
Maintenance view : Maintenance view permits you to maintain the data of an application object together.The data is automatically distributed in the underlying database tables.
A standardized table maintenance transaction is provided (SM30), permitting you to maintain the data from the base tables of a maintenance view together.
In other words, Maintenance views enable a business-oriented approach to looking at data, while at the same time, making it possible to maintain the data involved. Data from several tables can be summarized in a maintenance view and maintained collectively via this view. That is, the data is entered via the view and then distributed to the underlying tables by the system.
Database View: Data about an application object is often distributed on several database tables. A database view provides an application-specific view on such distributed data.A database view is automatically created in the underlying database when it is activated.Database views implement an inner join.If the database view only contains a single table, the maintenance status can be used to determine if data records can also be inserted with the view. If the database view contains more than one table, you can only read the data.
Database views should be created if want to select logically connected data from different tables simultaneously. Selection with a database view is generally faster than access to individual tables. When selecting with views, you should also ensure that there are suitable indexes on the tables contained in the view.
Hope this helps.
Please reward if useful.
Thanks,
Srinivasa -
Hi there,
When I'm trying to manage spaces in SAP Business Objects Explorer 4.1 SP04, I'm getting the following error:
Failed to retrieve the data source list.
There was an error while retrieving the universes from the CMS (Central Management Server). (PS 20003)
For input string: "false"
I've already restart Explorer servers (Explorer Exploration Server, Explorer Indexing Server, Explorer Master Server and Explorer Search Server) and rebooted the server where Explorer is installed.
Nothing seems to fix this error message. I'm not able to create new spaces because I cant access the sources:
I'd appreciate some help !
Thanks in advanceHI Pavan,
Admin is on the Administrators Group, which as Full Control on the Explorer Application
I think this worked on the day the Explorer was installed (past week).
Since them never worked. -
No data Exists error while retrieving the data from a table
Hi Everyone!
I am getting "No Data Exists" error while retrieving the data from a table....where i need to check...if possible please give me example link.....please help me regarding thisHi !
thanks for ur response...
I have written vo.executeQuery for the table...My page is running but i m not getting the data....I have to select two LOV's and when I click on Go button the data has to display in the table...After the selection of LOV's when I click on Go in the table "No data exists" message is appearing...the table has the data and the query is also executing...please give info where i did the mistake.... -
I recently lost my iphone to which had of alot purchased music on it, but when i've come to retrieve the music from my itunes and the music is not there? The purchases show on my history but the music is nowhere? How can i get my purchases back please?
By any chance, did you have the Find My iPhone app installed prior to it being stolen?
Reporting a lost or stolen Apple product
Hopefully you had your iTunes purchases backed up to an external source such as an external drive or CD's? -
How to retrieve the data from Website and Upload it in SAP table?
Dear ABAPers,
I want to retrieve the data from website and upload the same in SAP Database Table is that possible.Please help me.It is very Urgent.
Thanks & Regards,
Ashok.Dear Abhishek,
Thanks for your reply.But my requirement is not met.
If i execute the program it should retrieve the data from particular website.
Thanks & Regards,
Ashok. -
How to retrieve the data from SAP-BAPI by using VB Code
Hi ,
I am new to BAPI.
V have created an application in Visual Basic with the following fields
EmpNo , EmpName, Addr1, Addr2, City and Phone (Only for Test)
We have written the code for SAVING the data into SAP. Already we have
constructed a table with the respective fields in SAP.
For that we ourself created our own BAPI Structure / Function Group /
Function Module/ Business Object - RELEASED related elements.
1)Established the connection successfully.
2)Stored the data into SAP Successfully and v r in need of
3)HOW TO RETRIEVE THE DATA FROM SAP (USING GETLIST.....GETDETAIL....)
Following is the code :
'BAPI Structure : ZBAPIEMP
'Function Group : ZBAPIEMP
'Function Module : ZBAPI_EMP_CREATEFROMDATA
'Business Object : ZBAPIEMP
'Function Module : ZBAPI_EMP_GETLIST
Dim bapictrl As Object
Dim oconnection As Object
Dim boEmp As Object
Dim oZEmp_Header As Object
Dim oImpStruct As Object
Dim oExpStruct As Object
Dim oreturn As Object
Dim x As String
Private Sub Form_Load()
Set bapictrl = CreateObject("SAP.BAPI.1")
Set oconnection = bapictrl.Connection
oconnection.logon
Set boEmp = bapictrl.GetSAPObject("ZBAPIEMP")
Set oZEmp_Header = bapictrl.DimAs(boEmp, "CreateFromData", "EmployeeHeader")
Set oImpStruct = bapictrl.DimAs(boEmp, "GetList", "EmployeeDispStruct")
End Sub
Private Sub cmdSave_Click()
oZEmp_Header.Value("EMPNO") = txtEmpNo.Text
oZEmp_Header.Value("EMPNAME") = txtEmpName.Text
oZEmp_Header.Value("ADDR1") = txtAddr1.Text
oZEmp_Header.Value("ADDR2") = txtAddr2.Text
oZEmp_Header.Value("CITY") = txtCity.Text
oZEmp_Header.Value("PHONE") = txtPhone.Text
boEmp.CreateFromData EmployeeHeader:=oZEmp_Header, Return:=oreturn
x = oreturn.Value("Message")
If x = "" Then
MsgBox "Transaction Completed!..."
Else
MsgBox x
End If
End Sub
Private Sub cmdView_Click()
End Sub
COULD ANYBODY GUIDE ME, HOW TO RETRIEVE THE DATA FROM BAPI, FOR THE WRITTEN CODE.I didn't seen any other answers but here's how it's been done previously in our organization for a custom BAPI. In this example, we give material and language to return the part description. It's not specific to your project but may give you ideas..
-Tim
Option Compare Database
Dim SAPLOGIN As Boolean
Dim FunctionCtrl As Object
Dim SapConnection As Object
Sub SAPLOGOUT()
On Error GoTo LogoutFehler
SapConnection.logoff
SAPLOGIN = False
Exit Sub
LogoutFehler:
If Err.Number = 91 Then
Exit Sub
Else
MsgBox Err.Description, vbCritical, "Fehler-Nr." & CStr(Err.Number) & " bei SAP-Logout"
End If
End Sub
Function SAPLOG() As Boolean
'Verbindungsobjekt setzen (Property von FunctionCtrl)
Set FunctionCtrl = CreateObject("SAP.Functions")
Set SapConnection = FunctionCtrl.Connection
'Logon mit Initialwerten
SapConnection.Client = "010"
SapConnection.Language = "EN"
SapConnection.System = "PR1"
SapConnection.SystemNumber = "00"
'SapConnection.Password = ""
SapConnection.GroupName = "PR1"
SapConnection.HostName = "168.9.25.120"
SapConnection.MessageServer = "168.9.25.120"
If SapConnection.Logon(0, False) <> True Then 'Logon mit Dialog
Set SapConnection = Nothing
DoCmd.Hourglass False
MsgBox "No connection to SAP R/3 !"
SAPLOGIN = False
SAPLOG = False
Exit Function
End If
SAPLOG = True
End Function
Function MatDescr(MatNr As String)
Dim func1 As Object
Dim row As Object, X As Integer, ErsteNr As String
Dim DatensatzZähler As Long
Dim RowField(1 To 50, 0 To 1) As String, RowLine As Long
If Not SAPLOGIN Then
If Not SAPLOG() Then
MsgBox "No connection to SAP !", 16
SAPLOGOUT
Exit Function
End If
End If
' Instanziieren des Function-Objektes
Set func1 = FunctionCtrl.Add("Z_BAPI_READ_MAKT")
' Export-Paramter definieren
func1.exports("MATNR") = MatNr
func1.exports("SPRAS") = "EN"
DoEvents
If Not func1.call Then
If func1.exception <> "" Then
MsgBox "Communication Error with RFC " & func1.exception
End If
DoCmd.Hourglass False
SAPLOGOUT
Exit Function
Else
MatDescr = func1.imports("MAKTX")
End If
If MatDescr = "" Then
MatDescr = "PART NO. NOT FOUND"
End If
End Function -
Choose the key from the allowed namespace
Hi All,
I am using SAP HR practice system and I am getting this error "Choose the key from the allowed namespace" while trying to Define Generation rules for Quota type selection in Time Management.
Error message as below; Can some one please guide me how to resolve this.
I also tried saving without clicking on save or green button but by pressing enter nothing worked.
Choose the key from the allowed namespace
Message no. SV019
Diagnosis
You have attempted to create an entry and have used a key which is not in your namespace.
This can cause problems in later upgrades because the entry could be overwritten by an import, or overwrite an existing entry.
Procedure
Check your entry and try to enter a key value from your namespace.
You can display the namespace definition with RDDKOR54.
If you must use the key entered, document your change so that it can be repeated after an upgrade or release change if necessary. If you put the data in a change request, you can export it before an upgrade or release change, and import it again afterwards.
Best Regards
RaskiiRaskii,
When you are trying to clear a warning message in SAP, press enter. That's not intuitive. The natural tendency is to continue to press save.
So the sequence of events is:
- change the data
- press the save button
- receive a warning error message
- press enter, and continue to press enter until you are notified that the change has been saved
This will work if it's truly a warning message.
Regards,
Howard -
Execution stops after retrieving the factory from the ServletContext while
Hi,
I just started working with Quartz, so I am clueless as to why I am getting this error. This is my first time tying to integrate Quartz 1.6.0 in a web app. I am using the JSF Framework. Although I have added the necessary jars I am still getting the error above: servlet.jar not loaded. If you follow the java code and server output you can see that after retrieving the factory from the ServletContext there is no further execution . Following is the definition of the class used for scheduling:
Quartz Version: 1.6.0
IDE : Netbeans 5.0
AppServer: Tomcat 5.5
*************************************** JAVA CODE *************************************
* BirthdayScheduler.java
* Created on May 20, 2008, 5:24 PM
package com.csg.cs.cscomwebdev.servlet.timer;
import java.io.*;
import java.net.*;
import java.util.Date;
import javax.servlet.*;
import javax.servlet.http.*;
import org.quartz.JobDetail;
import org.quartz.SchedulerException;
import org.quartz.SimpleTrigger;
import org.quartz.impl.StdSchedulerFactory;
import org.quartz.Scheduler;
* @author Arijit Datta
* @version
public class BirthdayScheduler extends HttpServlet {
/** Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods.
* @param request servlet request
* @param response servlet response
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
out.close();
/** Handles the HTTP <code>GET</code> method.
* @param request servlet request
* @param response servlet response
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
/** Handles the HTTP <code>POST</code> method.
* @param request servlet request
* @param response servlet response
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
/** Returns a short description of the servlet.
public String getServletInfo() {
return "Short description";
public void init()
System.out.println(" ------------ STARTTING JOB --------------");
// Retrieve the ServletContext
ServletContext theApplicationsServletContext = this.getServletContext();
// Retrieve the factory from the ServletContext
StdSchedulerFactory factory =(StdSchedulerFactory)theApplicationsServletContext.getAttribute("QuartzFactory Servlet.QUARTZ_FACTORY_KEY");
System.out.println(" ------------ FACTORY GOT --------------");
try {
// Retrieve the scheduler from the factory
Scheduler scheduler = factory.getScheduler();
System.out.println(" ------------ SCHEDULER GOT --------------");
// Start the scheduler
scheduler.start();
System.out.println(" ------------ SCHEDULER STARTED --------------");
//Creating a job
JobDetail birthdayJobDetail = new JobDetail("birthdayReminderJob", scheduler.DEFAULT_GROUP, BirthdayReminderJob.class );
System.out.println(" ------------ JOB CREATED --------------");
//Creating a trigger
SimpleTrigger birthdayJobtrigger = new SimpleTrigger("birthdayReminderTrigger",scheduler.DEFAULT_GROUP, new Date(),null,SimpleTrigger.REPEAT_INDEFINITELY, 60L * 1000L);
System.out.println(" ------------ TRIGGER CREATED --------------");
//Scheduling the job
scheduler.scheduleJob(birthdayJobDetail,birthdayJobtrigger );
System.out.println(" ------------ JOB SCHEDULED --------------");
} catch (SchedulerException ex) {
System.out.println(ex.getMessage());
} ************************************* SECTION OF WEB.XML ************************
<servlet>
<description>Quartz Initializer Servlet</description>
<servlet-name>QuartzInitializer</servlet-name>
<servlet-class>org.quartz.ee.servlet.QuartzInitializerServlet</servlet -class>
<init-param>
<param-name>shutdown-on-unload</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>start-scheduler-on-load</param-name>
<param-value>true</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>BirthdayScheduler</servlet-name>
<servlet-class>com.csg.cs.cscomwebdev.servlet.timer.BirthdayScheduler< /servlet-class>
<load-on-startup>1</load-on-startup>
</servlet> *********************************** SERVER OUTPUT *******************************
Using CATALINA_BASE: C:\Documents and Settings\165171\.netbeans\5.0\jakarta-tomcat-5.5.9_base
Using CATALINA_HOME: D:\Program Files\netbeans-5.0\enterprise2\jakarta-tomcat-5.5.9
Using CATALINA_TMPDIR: C:\Documents and Settings\165171\.netbeans\5.0\jakarta-tomcat-5.5.9_base\temp
Using JAVA_HOME: C:\Program Files\Java\jdk1.5.0_02
May 20, 2008 7:27:13 PM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8084
May 20, 2008 7:27:13 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 766 ms
May 20, 2008 7:27:13 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
May 20, 2008 7:27:13 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/5.5.9
May 20, 2008 7:27:13 PM org.apache.catalina.core.StandardHost start
INFO: XML validation disabled
May 20, 2008 7:27:14 PM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(D:\Java Programs\cs\CSCOMWEBDEV\build\web\WEB-INF\lib\servlet.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
log4j:WARN No appenders could be found for logger (org.apache.catalina.session.ManagerBase).
log4j:WARN Please initialize the log4j system properly.
------------ STARTTING JOB --------------
------------ FACTORY GOT --------------
May 20, 2008 7:27:15 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8084
May 20, 2008 7:27:15 PM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
May 20, 2008 7:27:15 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/32 config=null
May 20, 2008 7:27:15 PM org.apache.catalina.storeconfig.StoreLoader load
INFO: Find registry server-registry.xml at classpath resource
May 20, 2008 7:27:16 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 2802 ms Can anybody please help out? Where exactly am I going wrong?
Thanks a lot!
ADYour stop condition is "continue if true". This means that, unless you press the button, the while loop will stop after one iteration.
First, you should change the termination condition to "stop if true".
Then you should make the stop button "latch when released" (right-click..mechanical action). Else you don't have a well defined state after the program stops.
You should decide on a reasonable loop rate and enter it for the wait control. (beter use a diagram constant if the value is always the same).
Why do you need to continue reading in a loop? Are you expecting the response to change over time?
Do you want to keep appending to the string indicator or only show the latest characters received?
Maybe you also need a wait between the writing and reading?
Delete the ms timer value indicator, it is completely useless.
Do you get any error codes?
Don't use the run continous button. Use the plain run button.
What device are you communicating with? Do you have documentation?
LabVIEW Champion . Do more with less code and in less time .
Maybe you are looking for
-
MacBook Pro 13' Early 2011: Still Slow After 16GB RAM Upgrade
Hi, I have a MacBook Pro 13' Early 2011 running Yosemite. After the RAM upgrade to 16GB, the speed of the computer is still not satisfactory, having some lag times in launching softwares and startup. Please suggest me what to do. Below is the report.
-
Using Mac Mini, Time Machine and External Hard Drives as a Backup Server
Hello... I own a graphic design studio and have been looking for a long time to create/buy a no-thinker backup system for my macs. I have 4 workstations that I would like to backup to one central "server". So what I was thinking was buying a Mac Mini
-
what to do, and what happened, how can I get a replacment, I live in bahrain.
-
HT1688 how can i tell if my iPhone 4s is unlocked?
How can i tell if my iPhone 4s is unlocked?
-
If I have an order that requires 85 hours of production, and the work center responsible only has available capacity of 14 hours per day, how can I divide up the order in a Capacity Leveling Planning Table (CM22)? When I dispatch the order, it automa