Read a property file and store it in a hashmap
Hi,
I have tried to read a property file and store it in a hashmap. The property-names should be stored in keys and the property-values (after = symbol) in values of the hashmap. any ideas? Is it possible to do this?
mandy2001ir wrote:
yes, but I need the hashmap for another reason. Actually I'm trying to use the properties file to have a dynamic hachmap. I don't want to change the code anytime I want to put a value in the hashmap. therefor I write the "keys" and "values" in a property file and change the property file. That's the reasn why we have property files, isn't it?What's a "dynamic hashmap"? There's no other kind! Whenever someone starts bandying around the word "dynamic" in contexts like this, it usually means there's a simple solution to their problem, that they haven't yet considered, or mistakenly don't believe is applicable to them, because of this "unique" need for something "dynamic". Trust me, you just need to load the file using a Properties object, and you're done. Properties extends Hashtable, which is virtually the same thing as a HashMap. Properties does exactly what you want it to. it's the very reason the class exists
Have you even looked at the javadoc for java.util.Properties yet? I'm betting not, because if you had, you'd know exactly what I meant. And since you haven't, I'm at a bit of a loss as to how you can so easily dismiss the class as useless, despite existing to do exactly what you need
Similar Messages
-
Read a XML file and store an element to a String
Hello,
I'm looking for a solution to load an XML file (see below), read all elements and store the first of them (the first "description" element) in a String variable.
Should I load the file in a Node variable?
What is the best solution?
The XML file looks like:
<document>
<typeOfWorkstation >
<item id="desktop">
<description>Desktop</description>
</item>
<item id="laptop">
<description>Laptop</description>
</item>
<item id="other">
<description>Other configuration</description>
</item>
</typeOfWorkstation>
</docuement>
All suggestions will be greatly appreciated
Thank you
Sylvainno example, uh? the tutorial is packed with code samples
this will get you started:
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
Document doc = db.parse(new File("c:/folder/data.xml")); -
How do I read from a file and store the information in an array?
Here is my problem:
I am going to have to use a bufferedReader to read a file containing information on 10 vehicles. And after I read that file I want to store the info in Vehicle [] V.
Where should I start?
Thanks
SteveThank you for the quick response.
As of right now our code is the same. Now I have to "parse" the information. What exactly do you mean?
My code is as follows:
while((str = br.readLine()) != null)
String[] tokenArray = str.split(" ");
for(int i = 0; i < tokenArray.length; i++)
System.out.print(" Token: " + tokenArray);
System.out.println("\n");
Is that what you mean by parsing?
I am not quite sure what e slpit(" ") is doing. Is there a better way?
And just to make sure I am understanding my own code, I am storing the information from the br in tokenArray. Followed by a series of print statements which output the info.Correct?
Thanks again,
Steve -
Need to read a XML file and store multilingual data
I am having an XML file which contains multiple records and each maybe in a different language .identified EN -english ES-Spanish etc
- <Document xmlns="http://www.xxxxx.com/ws/integration/toolkit/2011/05">
- <Attributes>
<Attribute name="duration">0:00:02.993</Attribute>
<Attribute name="count">47</Attribute>
<Attribute name="entity">Requisition</Attribute>
<Attribute name="mode">XML</Attribute>
<Attribute name="version">http://www.xxxx.com/ws/tee800/2009/01</Attribute>
</Attributes>
- <Content>
- <ExportXML xmlns="http://www.xxxxx.com/ws/integration/toolkit/2005/07/action/export">
- <record>
<field name="ContestNumber">120000002O</field>
<field name="JobInformation,JobType,Description">Standard</field>
<field name="JobFamily">ACCOUNTING/FINANCE</field>
<field name="JobInformation,Organization,Name">CHMS-DO NOT USE</field>
<field name="Country">USA</field>
<field name="State">Illinois</field>
<field name="City">Lake County</field>
<field name="Title_EN">TaTest1</field>
<field name="Title_es">TaTest1 translated to Espanol</field>
<field name="InternalDescription_EN">Humira marketing team - develop programs.</field>
<field name="InternalDescription_zhCN" />
<field name="InternalDescription_zhTW" />
<field name="InternalDescription_es">Development of marketing programs for </field>
<field name="ExternalDescription_EN">Marketing programs for core products</field>
<field name="ExternalDescription_zhCN" />
<field name="ExternalDescription_zhTW" />
<field name="ExternalDescription_es">Marketing core products - Spain</field>
<field name="URL_en">http://[ZONE]/careersection/[CAREER_SECTION]/jobdetail.ftl?lang=en&job=120000002O</field>
<field name="URL_zhCN" />
<field name="URL_zhTW" />
<field name="URL_es">http://[ZONE]/careersection/[CAREER_SECTION]/jobdetail.ftl?lang=es&job=120000002O</field>
<field name="PostedExternally">true</field>
<field name="PostedInternally">true</field>
<field name="EnglishActive">true</field>
<field name="SimplifiedChineseActive">false</field>
<field name="TraditionalChineseActive">false</field>
<field name="SpanishActive">true</field>
<field name="InternalBonusTracking" />
<field name="ExternalBonusTracking" />
<field name="POSTING_GRADE" />
<field name="SAP_Schedule">Full-time</field>
<field name="PostingDateExternal">2012-11-20</field>
<field name="PostingDateInternal">2012-11-20</field>
</record>
</ExportXML>
</Content>
</Document>
I need to store and retrieve data into a AL32UTF8 database without losing language attributed.
I am using DBMS_XMLDOM.getnodevalue (); to fetch the XML stored in a CLOB column
But the package returns VARCHAR2 .How do i return NVARCHAR2 so that i can store Multilingual data
DBMS_XMLDOM.GETNODEVALUE(
n IN DOMNode)
RETURN VARCHAR2;
Or is there an easier way around using XMLTYPE
Edited by: Rameshkumar T on Nov 27, 2012 6:14 AMdbms_lob.loadclobfromfile( v_xml_msg
, v_xml_bfile
, dbms_lob.getlength(v_xml_bfile)
, v_dest_offset
, v_src_offset
, NLS_CHARSET_ID('AL32UTF8')
, v_lang_context
, v_warning
SELECT message
INTO v_xml_clob
FROM gjb_xml_message gtmq
WHERE message_id = v_msg_id;
v_line_no := 1;
v_doc := dbms_xmldom.newDOMDocument(v_xml_clob);
v_line_no := 2;
v_nodes := dbms_xmldom.getElementsByTagName(v_doc, '*');
FOR i IN 0..dbms_xmldom.getlength(v_nodes)-1
LOOP
BEGIN
v_line_no := 3.0;
v_element_x := dbms_xmldom.makeelement(xmldom.item(v_nodes,i));
v_line_no := 3.1;
v_node := dbms_xmldom.item(v_nodes,i);
v_line_no := 3.2;
v_tag := dbms_xmldom.getNodeName(v_node);
v_line_no := 3.3;
v_node_2 := dbms_xmldom.getfirstchild(v_node);
v_line_no := 4.0;
v_node_map := DBMS_XMLDOM.getattributes (v_node);
FOR x in 0 ..DBMS_XMLDOM.getlength (v_node_map)- 1
LOOP
BEGIN
v_line_no := 4.1;
v_one_node := DBMS_XMLDOM.item (v_node_map, x);
v_line_no := 4.2;
v_attrname := DBMS_XMLDOM.getnodename (v_one_node);
v_line_no := 4.3;
v_attrval := DBMS_XMLDOM.getnodevalue (v_one_node);
IF v_attrval = 'ContestNumber' THEN
v_line_no := 4.4;
v_contest_num := v_tag_value;
v_rec_no := NULL;
IF v_load_type = 'I' THEN
v_rec_no := fn_get_job_id(v_contest_num);
END IF;
IF v_rec_no IS NULL THEN
SELECT seq_gjbjobid.NEXTVAL
INTO v_rec_no
FROM dual;
END IF;
END IF;
IF UPPER(v_tag) = 'FIELD' THEN
BEGIN
v_line_no := 5;
INSERT INTO gjb_xml_data
( message_id
, job_id
, tag_name
, col_name
, col_no
, tag_level
, tag_value
, tag_lang
, tag_value_clob
SELECT v_msg_id
, v_rec_no
, tag_name
, col_name
, col_no
, tag_level
, v_tag_value
, tag_lang
, v_tag_value_clob
FROM gjb_xml_tags gxt
WHERE tag_name = v_attrval;
v_tag_value := NULL;
v_tag_value_clob := NULL;Edited by: Rameshkumar T on Nov 27, 2012 8:27 AM -
In Vista, Applet isn�t able to read the property files
I�m working on internationalization; the Applet which I�m using wasn�t able to read the property files properly in windows Vista machine. But if I create a jar which contains all the classes and property files, Applet works fine.
This problem is only in Vista machine ,In XP the JVM is smart enough to read plain .property files and its works well without creating the jar
Is that related to any security enhancemence of vista over XP?
Below is a link about The Java Security Model break on Windows Vista
http://bugs.sun.com/view_bug.do?bug_id=6548078
I tried a simple ResourceBundle.getBundle() in my Applet in different ways but nothing work fine for me. It isn�t an issue related to path, I guess because I tried several ways like.
ResourceBundle labels = ResourceBundle.getBundle("LabelsBundle");
ResourceBundle labels = ResourceBundle.getBundle("LabelsBundle",currentLocale);
ResourceBundle labels = ResourceBundle.getBundle("com.test.LabelsBundle");
ResourceBundle labels = ResourceBundle.getBundle("com.test.LabelsBundle",currentLocale);The exception got in java console is
CONFIG: [2008-05-13 15:54:57.909]:(com.satm.insite.InsiteApplet$2@1696e4c):InisiteApplet: Exception: java.util.MissingResourceException: Can't find bundle for base name LabelsBundle, locale en
java.util.MissingResourceException: Can't find bundle for base name LabelsBundle, locale en
at java.util.ResourceBundle.throwMissingResourceException(Unknown Source)
at java.util.ResourceBundle.getBundleImpl(Unknown Source)
at java.util.ResourceBundle.getBundle(Unknown Source)
at com.satm.insite.InsiteApplet.displayValue(InsiteApplet.java:261)
at com.satm.insite.InsiteApplet.callme(InsiteApplet.java:296)
at com.satm.insite.InsiteApplet.initialize(InsiteApplet.java:327)
at com.satm.insite.InsiteApplet$2.run(InsiteApplet.java:235)
at com.satm.tools.languageTools.ThreadPool$ExceptionCatchingThread.run(ThreadPool.java:226)Is there any way to make it work in Windows Vista machine�? This could be a great help for me.
Thanks
RobertCrossposted:
http://forum.java.sun.com/thread.jspa?threadID=5295743&messageID=10250558#10250558
http://forum.java.sun.com/thread.jspa?threadID=5295742&messageID=10250556#10250556 -
Read multiple text files and sort them
I am trying to read multiple text files and store the data from the file in vector.
but for days. I am with no luck. anyone can help me out with it? any idea of how to sort them will be appreciated.
Below is part of the code I implemented.
public class packet {
private int timestamp;
private int user_id;
private int packet_id;
private int packet_seqno;
private int packet_size;
public packet(int timestamp0,int user_id0, int packet_id0,int packet_seqno0, int packet_size0)
timestamp = timestamp0;
user_id=user_id0;
packet_id=packet_id0;
packet_seqno=packet_seqno0;
packet_size=packet_size0;
public void setTime(int atimestamp)
this.timestamp=atimestamp;
public void setUserid(int auserid)
this.user_id=auserid;
public void setPacketid(int apacketid)
this.packet_id=apacketid;
public void setPacketseqno(int apacketseqno)
this.packet_seqno=apacketseqno;
public void setPacketsize(int apacketsize)
this.packet_size=apacketsize;
public String toString()
return timestamp+"\t"+user_id+"\t"+packet_id+"\t"+packet_seqno+"\t"+packet_size+"\t";
}Here is the data from part of the text files. ( the first column is timestamp, second is userid, third is packetid.....)
0 1 1 1 512
1 2 1 2 512
2 3 1 3 512
3 4 1 4 512
4 5 1 5 512
5 6 1 6 512
6 7 1 7 512
7 8 1 8 512
8 9 1 9 512
9 10 1 10 512
10 1 2 11 512
11 2 2 12 512
12 3 2 13 512
13 4 2 14 512
14 5 2 15 512
15 6 2 16 512
16 7 2 17 512Here's a standard idiom for object-list-sorting:
/* cnleafdata.txt *********************************************
0 1 1 1 512
1 2 1 2 512
2 3 1 3 512
3 4 1 4 512
4 5 1 5 512
5 6 1 6 512
6 7 1 7 512
7 8 1 8 512
8 9 1 9 512
9 10 1 10 512
10 1 2 11 512
11 2 2 12 512
12 3 2 13 512
13 4 2 14 512
14 5 2 15 512
15 6 2 16 512
16 7 2 17 512
import java.util.*;
import java.io.*;
public class Packet implements Comparable<Packet>{
private int timeStamp;
private int userId;
private int packetId;
private int packetSeqno;
private int packetSize;
public Packet(int timeStamp0, int userId0, int packetId0,
int packetSeqno0, int packetSize0) {
timeStamp = timeStamp0;
userId = userId0;
packetId = packetId0;
packetSeqno = packetSeqno0;
packetSize = packetSize0;
public Packet(String timeStamp0, String userId0, String packetId0,
String packetSeqno0, String packetSize0) {
this(Integer.parseInt(timeStamp0), Integer.parseInt(userId0),
Integer.parseInt(packetId0), Integer.parseInt(packetSeqno0),
Integer.parseInt(packetSize0));
public Packet(String[] a){
this(a[0], a[1], a[2], a[3], a[4]);
public void setTime(int aTimeStamp){
timeStamp = aTimeStamp;
public void setUserId(int aUserId){
userId = aUserId;
public void setPacketId(int aPacketId){
packetId = aPacketId;
public void setPacketSeqno(int aPacketSeqno){
packetSeqno = aPacketSeqno;
public void setPacketSize(int aPacketSize){
packetSize = aPacketSize;
public int getUserId(){
return userId;
public String toString(){
return String.format
("%2d %2d %2d %2d %4d", timeStamp, userId, packetId, packetSeqno, packetSize);
public int compareTo(Packet otherPacket){
return userId - otherPacket.getUserId();
/* main for test */
public static void main(String[] args){
String line;
ArrayList<Packet> alp;
alp = new ArrayList<Packet>();
try{
BufferedReader br = new BufferedReader(new FileReader("cnleafdata.txt"));
while ((line = br.readLine()) != null){
// if (! recordValid(line)){
// continue;
String[] ar = line.split("\\s");
alp.add(new Packet(ar));
catch (Exception e){
e.printStackTrace();
System.out.println("[original]");
for (Packet p : alp){
System.out.println(p);
System.out.println();
Collections.sort(alp);
System.out.println("[sorted by user ID]");
for (Packet p : alp){
System.out.println(p);
} -
How to read *.pdf files and store them in a database?
Dear programmers,
I have problem with reading *.pdf files and store them in a database.
can any one help me, please!
Is it possible to read more than one file from the local system and store them in a database.
thnaks in advance.
byeWhat "problem" are you encountering?
Depending on your choice of database software, it may or may not support the storage of binary large objects (BLOBs). -
How to read the data from Excel file and Store in XML file using java
Hi All,
I got a problem with Excel file.
My problem is how to read the data from Excel file and Store in XML file using java excel api.
For getting the data from Excel file what are all the steps i need to follow to get the correct result.
Any body can send me the code (with java code ,Excel sheet) to this mail id : [email protected]
Thanks & Regards,
Sreenu,
[email protected],
india,If you want someone to do your work, please have the courtesy to provide payment.
http://www.rentacoder.com -
How to read .html file and store values into oracle table from html file
Hi all ,
How to read .html file and store values into oracle table from html file using pl/sql
Please Help.....Hi,
Kindly find following sample html code ,i want to store every value in different column in database .
<html><body><p/>
<div style="position:absolute;top:47px;left:37px;font-family:'Times New Roman';font-size:10pt;white-space:nowrap;">
</div>
<div style="position:absolute;top:47px;left:680px;font-family:'Times New Roman';font-size:10pt;white-space:nowrap;">
</div>
<div style="position:absolute;top:94px;left:151px;font-family:'Times New Roman';font-size:1pt;white-space:nowrap;">
</div>
<div style="position:absolute;top:1080px;left:115px;font-family:'Times New Roman';font-size:8pt;white-space:nowrap;">4497743
</div>
<div style="position:absolute;top:1079px;left:442px;font-family:'Times New Roman';font-size:9pt;white-space:nowrap;"> Miclyn Express Offshore Pre-Quotation Disclosure
</div>
<div style="position:absolute;top:1079px;left:680px;font-family:'Times New Roman';font-size:9pt;white-space:nowrap;">
</div>
<div style="position:absolute;top:1079px;left:723px;font-family:'Times New Roman';font-size:9pt;white-space:nowrap;">page 5
</div>
<div style="position:absolute;top:1083px;left:151px;font-family:'Times New Roman';font-size:1pt;white-space:nowrap;">
</div>
<div style="position:absolute;top:107px;left:151px;font-family:'Times New Roman';font-size:10pt;white-space:nowrap;"><b>Attachment 2 ¿ indicative statement of 20 largest shareholders </b>
</div>
<div style="position:absolute;top:139px;left:262px;font-family:'Times New Roman';font-size:10pt;white-space:nowrap;"><b>Name </b>
</div>
<div style="position:absolute;top:131px;left:415px;font-family:'Times New Roman';font-size:10pt;white-space:nowrap;"><b>Number of Shares </b>
</div>
<div style="position:absolute;top:147px;left:458px;font-family:'Times New Roman';font-size:10pt;white-space:nowrap;"><b>Held </b>
</div>
<div style="position:absolute;top:131px;left:560px;font-family:'Times New Roman';font-size:10pt;white-space:nowrap;"><b>Percentage of </b>
</div>
<div style="position:absolute;top:147px;left:567px;font-family:'Times New Roman';font-size:10pt;white-space:nowrap;"><b>shares held </b>
</div>
<div style="position:absolute;top:179px;left:161px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">Macquarie Capital Group Limited 92,378,000
</div>
<div style="position:absolute;top:179px;left:531px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">
</div>
<div style="position:absolute;top:179px;left:618px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">34.00%r
</div>
<div style="position:absolute;top:179px;left:663px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">
</div>
<div style="position:absolute;top:212px;left:161px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">HSBC Custody Nominees (Australia)
</div>
<div style="position:absolute;top:227px;left:161px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">Limited
</div>
<div style="position:absolute;top:220px;left:464px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">36,458,220
</div>
<div style="position:absolute;top:220px;left:531px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">
</div>
<div style="position:absolute;top:220px;left:618px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">13.42%
</div>
<div style="position:absolute;top:220px;left:663px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">
</div>
<div style="position:absolute;top:260px;left:161px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">Ray Rider Limited 27,170,000
</div>
<div style="position:absolute;top:260px;left:531px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">
</div>
<div style="position:absolute;top:260px;left:618px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">10.00%
</div>
<div style="position:absolute;top:260px;left:663px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">
</div>
<div style="position:absolute;top:300px;left:531px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">
</div>
<div style="position:absolute;top:300px;left:625px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">7.96%
</div>
<div style="position:absolute;top:300px;left:663px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">
</div>
<div style="position:absolute;top:333px;left:161px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">National Australia Bank Custodian
</div>
<div style="position:absolute;top:348px;left:161px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">Services
</div>
<div style="position:absolute;top:341px;left:464px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">12,866,550
</div>
<div style="position:absolute;top:341px;left:531px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">
</div>
<div style="position:absolute;top:341px;left:625px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">4.74%
</div>
<div style="position:absolute;top:341px;left:663px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">
</div>
<div style="position:absolute;top:381px;left:161px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">Citigroup Nominees Pty Ltd 6,942,541
</div>
<div style="position:absolute;top:381px;left:531px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">
</div>
<div style="position:absolute;top:381px;left:625px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">2.56%r
</div>
<div style="position:absolute;top:381px;left:663px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">
</div>
<div style="position:absolute;top:421px;left:531px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">
</div>
<div style="position:absolute;top:421px;left:625px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">2.14%r
</div>
<div style="position:absolute;top:421px;left:663px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">
</div>
<div style="position:absolute;top:462px;left:161px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">UBS Securities Australia Ltd 4,806,760
</div>
<div style="position:absolute;top:462px;left:531px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">
</div>
<div style="position:absolute;top:462px;left:625px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">1.77%
</div>
<div style="position:absolute;top:462px;left:663px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">
</div>
<div style="position:absolute;top:494px;left:161px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">Merrill Lynch Equities (Australia)
</div>
<div style="position:absolute;top:510px;left:161px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">Limited
</div>
<div style="position:absolute;top:502px;left:472px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">4,325,000
</div>
<div style="position:absolute;top:502px;left:531px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">
</div>
<div style="position:absolute;top:502px;left:625px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">1.59%
</div>
<div style="position:absolute;top:502px;left:663px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">
</div>
<div style="position:absolute;top:550px;left:161px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">Equities Ltd
</div>
<div style="position:absolute;top:542px;left:472px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">4,150,000
</div>
<div style="position:absolute;top:542px;left:531px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">
</div>
<div style="position:absolute;top:542px;left:625px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">1.53%
</div>
<div style="position:absolute;top:542px;left:663px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">
</div>
<div style="position:absolute;top:575px;left:161px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">Bond Street Custodians Limited - A/C
</div>
<div style="position:absolute;top:590px;left:161px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">Institutional
</div>
<div style="position:absolute;top:583px;left:472px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">2,750,000
</div>
<div style="position:absolute;top:583px;left:531px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">
</div>
<div style="position:absolute;top:583px;left:625px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">1.01%
</div>
<div style="position:absolute;top:583px;left:663px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">
</div>
<div style="position:absolute;top:623px;left:161px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">Cogent Investment Operations Pty Ltd 2,599,321
</div>
<div style="position:absolute;top:623px;left:531px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">
</div>
<div style="position:absolute;top:623px;left:625px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">0.96%
</div>
<div style="position:absolute;top:623px;left:663px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">
</div>
<div style="position:absolute;top:663px;left:161px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">Skeet Nominees Pty Ltd 2,276,736
</div>
<div style="position:absolute;top:663px;left:531px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">
</div>
<div style="position:absolute;top:663px;left:625px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">0.84%
</div>
<div style="position:absolute;top:663px;left:663px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">
</div>
<div style="position:absolute;top:704px;left:161px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">Diederik de Boer 1,917,561
</div>
<div style="position:absolute;top:704px;left:531px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">
</div>
<div style="position:absolute;top:704px;left:625px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">0.71%
</div>
<div style="position:absolute;top:704px;left:663px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">
</div>
<div style="position:absolute;top:744px;left:161px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">Ecapital Nominees Pty Limited 1,594,736
</div>
<div style="position:absolute;top:744px;left:531px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">
</div>
<div style="position:absolute;top:744px;left:625px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">0.59%
</div>
<div style="position:absolute;top:744px;left:663px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">
</div>
<div style="position:absolute;top:777px;left:161px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">Neweconomy Com Au Nominees Pty 9
</div>
<div style="position:absolute;top:792px;left:161px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">Limited <900 Account>
</div>
<div style="position:absolute;top:784px;left:472px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">1,594,7360
</div>
<div style="position:absolute;top:784px;left:531px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">
</div>
<div style="position:absolute;top:784px;left:625px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">0.59%
</div>
<div style="position:absolute;top:784px;left:663px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">
</div>
<div style="position:absolute;top:825px;left:161px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">Sonray Capital Markets Pty Ltd 1,236,842
</div>
<div style="position:absolute;top:825px;left:531px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">
</div>
<div style="position:absolute;top:825px;left:625px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">0.46%
</div>
<div style="position:absolute;top:825px;left:663px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">
</div>
<div style="position:absolute;top:865px;left:161px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">Argo Investments Limited 1,050,000
</div>
<div style="position:absolute;top:865px;left:531px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">
</div>
<div style="position:absolute;top:865px;left:625px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">0.39%
</div>
<div style="position:absolute;top:865px;left:663px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">
</div>
<div style="position:absolute;top:905px;left:161px;font-family:'Times New Roman';font-size:11pt;white-space:nowrap;">Idameno (No 79) Nominees Pty Limited 724,210</div>
<div style="position:absolute;top:1103px;">
</body></html>
Thanks.......................... -
BufferedReader/FileWriter - read in a line and store it in a file
hi, I'm new in programming java, so I hope somebody can help me with the following question:
I've got a file that contains parameters, which change every second (the file updates itself every second)
Now I have to write a java Programm, that reads in a certain parameter of that file, and store it in another file, so that the file lists every read-in parameter (to show the changes of the parameter).
the following source shows a programm, that reads in the content of a text file and stores it in another file - every second. Please, could anyone be so kind, and help me to change the programm?
import java.io.*;
import java.util.Date;
public class readIn {
public static void main(String[] args) throws IOException {
for (int i = 1; i <= 5; ++i) {
System.out.println("Sleep at: " + new Date());
try
// ask currently executing Thread to sleep for 1000ms
Thread.sleep(1000);
catch(InterruptedException e)
System.out.println("Sleep interrupted:"+e);
if (args.length != 2)
System.err.println ("usage: pattern file");
System.exit (1);
String patt = args [0];
String fileIn = args [1];
try
LineNumberReader reader = new LineNumberReader
(new FileReader (fileIn));
String str;
while ((str = reader.readLine()) != null)
if (str.indexOf (patt) != -1)
int ln = reader.getLineNumber();
File inputFile = new File("logfile.txt");
File outputFile = new File("history.txt");
FileReader in = new FileReader(inputFile);
FileWriter out = new FileWriter(outputFile);
int c;
while ((c = in.read()) != -1)
out.write(c);
in.close();
out.close();
reader.close();
catch (IOException e)
System.err.println ("IO-Fehler beim Filtern");
e.printStackTrace();
System.out.println("Awoke at: " + new Date());
the logfile.txt contains words which change every second. I want to permanently read in the third line.
anatomy
animation
applet
application
argument
bolts
class
communicate
component
container
development
environment
exception
graphics
image
input
integrate
interface
Thank you very much for your immediate answer!!RandomAccessFile ??
aha, I took a look at the API but I have no idea how to work with it. If its quite easy, could you please be so kind and tell me ?? thanks ;) -
How can we locate the property file and read from it in .js page?
HI
I am having an static html page where in the url is hardcoded,so i wanted to read it from a property file and which can be done by using .js files
i wanted to know how to deal with property files in .js?
ThankxI assume you know that Java and JavaScript only share a name and they are both programming languages but little else.
You can load JavaScript in Java 6. However for questions on what the JavaScript should do I suggest you try a javascript forum. -
How can i read the text files and buffer the data in Vector?
hi. I have been running into this problem for days, but with no luck and losing right direction.
The problem is : I am trying to read a text file and buffer the data into a
Queue for each user.
the sample text file is as below:( 1st column is timestamp, 2nd is user_id, 3rd is packet_id, 4th is packet_seqno, 5th is packet_size)
0 1 1 1 512
1 2 1 2 512
2 3 1 3 512
3 4 1 4 512
4 5 1 5 512
5 6 1 6 512
6 7 1 7 512
7 8 1 8 512
8 9 1 9 512
9 10 1 10 512
10 1 2 11 512
11 2 2 12 512
12 3 2 13 512
13 4 2 14 512
14 5 2 15 512
15 6 2 16 512
16 7 2 17 512
17 8 2 18 512
18 9 2 19 512
19 10 2 20 512
20 1 3 21 512
21 2 3 22 512
22 3 3 23 512
23 4 3 24 512
24 5 3 25 512
25 6 3 26 512
26 7 3 27 512
27 8 3 28 512
28 9 3 29 512
29 10 3 30 512
30 1 4 31 512
31 2 4 32 512
32 3 4 33 512
33 4 4 34 512
34 5 4 35 512
35 6 4 36 512
36 7 4 37 512
37 8 4 38 512
38 9 4 39 512
39 10 4 40 512
40 1 5 41 512
41 2 5 42 512
42 3 5 43 512
43 4 5 44 512
44 5 5 45 512
45 6 5 46 512
46 7 5 47 512
47 8 5 48 512
48 9 5 49 512
49 10 5 50 512
50 1 6 51 512
51 2 6 52 512
52 3 6 53 512
53 4 6 54 512
54 5 6 55 512
55 6 6 56 512
56 7 6 57 512
57 8 6 58 512
58 9 6 59 512
59 10 6 60 512
60 1 7 61 512
61 2 7 62 512
62 3 7 63 512
63 4 7 64 512
64 5 7 65 512
65 6 7 66 512
66 7 7 67 512
67 8 7 68 512
68 9 7 69 512
69 10 7 70 512
70 1 8 71 512
71 2 8 72 512
What I wanna do is to read all the data above and buffer them in a queue for each user( there are only 10 users in total).
I already created a class called Class packet:
public class packet {
private int timestamp;
private int user_id;
private int packet_id;
private int packet_seqno;
private int packet_size;
/** Creates a new instance of packet */
public packet(int timestamp,int user_id, int packet_id,int packet_seqno, int packet_size)
this.timestamp = timestamp;
this.user_id=user_id;
this.packet_id=packet_id;
this.packet_seqno=packet_seqno;
this.packet_size=packet_size;
}then I wanna to create another Class called Class user which I can create a queue for each user (10 users in total) to store type packet information. the queue for each user will be in the order by timestamp.
any idea and sample code will be appreciated.Doesn't sound too hard to me. Your class User (the convention says to capitalize class names) will have an ArrayList or Vector in it to represent the queue, and a method to store a Packet object into the List. An array or ArrayList or Vector will hold the 10 user objects. You will find the right user object from packet.user_id and call the method.
Please try to write some code yourself. You won't learn anything from having someone else write it for you. Look at sample code using ArrayList and Vector, there's plenty out there. Post in the forum again if your code turns out not to behave. -
Error while reading a property file from a war.
Hi,
I am trying to read a property file which is available in the properties folder.
The piece of code that does this read is as follows.
InputStream is = ClassLoader.getSystemResourceAsStream("codemap.properties");
System.out.println("Reading file:"+is);
properties.load(is);
The "codemap.properties" file is available in the properties folder.
Following is my directory structure in the war file
sample.war
|
|
WEB-INF
|
|
classes
|
|
properties
|
|______ codemap.properties
Inside the war file I have WEB-INF and properties folder.
Inside WEB-INF i have the classes folder which has the classes
Inside the properties folder I have the codemap.properties file.
I am using Jboss. In the class path I have ./properties
I have also added this classpath in the manifest file.
Problem: The piece of code that I have written to read the property file is not able to locate the file and this it returns null.
I am not sure what i am missing here.
If anyone there have any solutions please let me know.
Thanks in Advance
Balaji.I think you've to change this line
InputStream is = ClassLoader.getSystemResourceAsStream("codemap.properties");with this.
InputStream is = ClassLoader.getSystemResourceAsStream("properties/codemap.properties");it is unable to find the path you specified. by default it'll check the WEB-INF directory. so you've to give the relative path to it.
Diablo -
How to slipt fields in a row of an external file and store in Table
Hi Experts,
I need to proces an External file and store into a table. Here need to Split the fields in a row and write as multiple rows of a table.
here i am giving the data sample ..
outlet1 type1 type2 type3
outlet2 type1 type3 type4 typ6 type7
The table should be as below.
outlet1 type1
outlet1 type2
outlet1 type2
outlet2 type1
outlet2 type3
outlet2 type4
outlet2 type6
outlet2 type7
Please give your suggesions and code sample that you have
Thankshi,
try with the below code. This code is as per data given by u in your first thread.
DATA : it_string TYPE TABLE OF string,
wa_string TYPE string,
BEGIN OF it_itab OCCURS 0,
f1(7),
f2(5),
END OF it_itab,
fld TYPE TABLE OF string,
wa TYPE string,
wa1 TYPE string,
cnt TYPE i VALUE 1.
data lin TYPE i.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = 'C:\Documents and Settings\User\Desktop\abc.txt'
filetype = 'ASC'
has_field_separator = 'X'
TABLES
data_tab = it_string
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
OTHERS = 17.
IF sy-subrc <> 0.
* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
BREAK-POINT.
LOOP AT it_string INTO wa_string.
cnt = 1.
SPLIT wa_string AT space INTO TABLE fld.
DESCRIBE TABLE fld LINES lin.
LOOP AT fld INTO wa.
cnt = cnt + 1.
IF cnt <= lin.
READ TABLE fld INTO wa INDEX 1.
IF sy-subrc = 0.
it_itab-f1 = wa.
ENDIF.
READ TABLE fld INTO wa1 INDEX cnt.
IF sy-subrc = 0.
it_itab-f2 = wa1.
ENDIF.
APPEND it_itab TO it_itab[].
ENDIF.
ENDLOOP.
ENDLOOP.
Thanks & Regards -
Parse files and store to "timeseries" for ouput to jpg/png?
Hi.
I am trying to parse through some dirs for known files and store the content + name of dir in a "timeseries" (the contents are csv and name of dir is string - hence "timeseries"), for later output to PNG.
The file structure will be:
dir1/filename.csv (together with other files)
dir2/filename.csv (together with other files)
dir3/filename.csv (together with other files)
My idea so far is:
public main {
JFreeChart ... createChart(createDataset);
private static createDataset {
traverse("my dirs and files");
TimeSeries series1 = new TimeSeries(name of dir1, data from file1);
TimeSeries series2 = new TimeSeries(name of dir2, data from file2);
etc....
private static createChart {
private static traverse(File dir) {
this method scans the dirs;
if file = "filename.csv" readFile();
private static readFile(file, path) {
read the data;
}I have come to a stop, because my method/idea would only return timeseries for the first dir/file over and over again.
Maybe I'm doing this awkwardly, but I'm very fresh at java.
Any inspiration would be appreciated.
Cheers,
ChotorThanks for answering.
Maybe I should clearify a bit.
I am already able to read csv files (thanks to opencsv). I can also travese directories looking for the correct file. I can even output timeseries to png thanks to JFreeChart.
The problem is stiching it all togheter, and more precisely passing data between methods.
When creating timeseries within my ceateDataset method, I am calling traverse, which then calls readData. I want these two (dir-name from traverse() and actual data from readData()) to be read into a new timeseries.
Maybe this could be solved differently...
We haven't covered this topic in my course yet. I'm fresh but eager. :)
Maybe you are looking for
-
Associated table type of the Table parameters in function module
Hi, If I want to select all the associated table types of the Table parameters used in a given function module in a report, how can that be done ? Thanks. Regards, Rajesh
-
DB installation fails at Update DB statistics
Hi, During DB installation at Update database statistics Installation error. Error shows that MTU- 03010 Execution of the command "/sapmnt/QMS/exe/brconnect '-u' '/' '-c' '-f' 'crsyn -o 'SAPQMS' finished with status TST_ERROR brconnect.log error /u
-
Servicegen doesn't support inheritance?
I have a method in a ejb class which returns class Product. The Product itself inherits class ProductBase. The ejb itself works ok. I then wrap the ejb with webservices, using servicegen to generate serialization class, and clientgen to generate clie
-
My iPad is currently in recovery mode. When i attempt to restore it through iTunes, I get an error message: "an unknown error has occured, error 40", Help is appreciated!
-
Business use of bypassing sourcing cockpit
Hi experts, In which scenario, 'process purchase order in draft' is used instead of sourcing cockpit? What are the benefits in such cases?Personally, I donot see much of any benefits here. Say, a shopping cart with three items have been ordered. If w