Path based data structure
I need to create a path based data structure which not only will map path keys to values, but also allow me to specify a partial path and retrieve a listing of all keys that 'descend' from that path. The values for each path will be various primitive and Collecions values. I'm implementing this as a generic data cache, so access time is critical.
I was thinking of designing my own, but was wondering if the API might come with something useful that does most of this work already? I'd want a solution that draws from the J2SE rather than additional libraries.
Mark McKay
http://www.kitfox.com
If I understand you correctly you're looking for some tree like, or some directory like
structure? You could use a Map for a single path component, storing all the keys
and their associated sub-path components. The values for each path component
could be stored in a List (or a Set if you don't want duplicates). Something like this:public class PathComponent {
private static PathComponent root= new PathComponent();
public static PathComponent getRoot() { return root; }
private Map subDirs= new HashMap();
private List values= new LinkedList();
private PathComponent getPath(String[] path, int depth) {
if (depth == path.length)
return this;
PathComponent sub= subDirs.get(path[depth++]);
return (sub == null)?null:sub.getPath(path, depth);
public PathComponent getPath(String[] path) { return getPath(path, 0); }
public List getValues() { return values; }
// etc. etc.
}kind regards,
Jos
Similar Messages
-
Is there a Java API for Tree data structure?
Hi,
I am wondering is there any Java API to work on Tree based data structure.
I could read in some forums / sites that teach me how to create tree based objects using collection.
But I wanted to know is there any core java API that can be used directly for tree based operations. (like binary tree or other type of trees)
Please comment on this doubt.Headed using google and other stuff not found one.
Suggestion: Why not start building the one, its a good idea to do that, isn't it. -
Dynamic subject based on data structure (JD Edwards)
In JD EDwards TR 8.98.3.0 it should be possible to create a dynamic email subject based on a data structure that is connected to a report definition. I have managed to create the data strucure with two elements (DOCO and DESC), this data structure is connected to a report definition in which I have stated that the subject must contain the first element (DOCO): Purchase order &1.
In the report definition I mapped the element DOCO from the data structure to the XML-element that contains the order number.
Unfortunately the e-mail does contain the statis text "purchase order" but it doesn't contain the order number (DOCO) from the XML-file.
Can anyone give me a hint for what I have done wrong?In JD EDwards TR 8.98.3.0 it should be possible to create a dynamic email subject based on a data structure that is connected to a report definition. I have managed to create the data strucure with two elements (DOCO and DESC), this data structure is connected to a report definition in which I have stated that the subject must contain the first element (DOCO): Purchase order &1.
In the report definition I mapped the element DOCO from the data structure to the XML-element that contains the order number.
Unfortunately the e-mail does contain the statis text "purchase order" but it doesn't contain the order number (DOCO) from the XML-file.
Can anyone give me a hint for what I have done wrong? -
Data structure for web-based discussion forum
Hello all. I have begun work on a discussion board forum but have not yet decided upon a data structure for the hierarchy of messages to be left on a board. Any one have any thoughts or experience in this matter? My first thought was to implement a basic linked list in which every reply to a message would be a new child of a node. This would require I use recursion in some areas for counting and finding messages but I was also thinking that this way I can store each thread object in a simple fashion using serialization.
SJTHE STANDARS DIRECTORY STRUCTURE IS :-
PROJECT FOLDER
|
|---------->WEB-INF
|------> web.xml file
|-------> classes (folder to keep java files)
|-------> lib (folder to keep jar files) -
Relationship between Dynamic Memory Heap and Heap Data Structure
This question is not strictly related to Java, but rather to programming in general, and I tend to get better answers from this community than any where else.
Somehow, my school and industry experience have somehow not given me the opportunity to explore and understand heaps (the data structure), so I'm investigating them now, and in particular, I've been looking at applications. I know they can be used for priority queues, heap sorts, and shortest path searches. However, I would have thought that, obviously, there must be some sort of relationship between the heap data structure, and the dynamic memory heap. Otherwise, I can think of no good reason why the dynamic memory heap would be named "heap". Surprisingly, after searching the web for 90 minutes or so, I've seen vague references, but nothing conclusive (trouble seems to be that it's hard to get Google to understand that I'm using the word "heap" in two different contexts, and similarly, it would not likely understand that web authors would use the word in two different contexts).
The Java Virtual Machine Spec is silent on the subject, as "The Java virtual machine assumes no particular type of automatic storage management system, and the storage management technique may be chosen according to the implementor's system requirements."
I've seen things like:
[of dynamic memory] "All the blocks of a particular size are kept in a sorted linked list or tree (I extrapolate that sorted tree could imply heap)"
[of dynamic memory] "The free and reserved areas of memory are maintained in a data structure similar to binary trees called a heap"
[of dynamic memory] "This is not related to the heap data structure"
[of dynamic memory] "Not to be confused with the data structure known as a "heap"
[of data structure] "Not to be confused with the dynamic memory pool, often known as TheHeap"
At this point, I've come to surmise that some (but not all) memory management algorithms use heaps to track which (pages? blocks? bytes?) of memory are used, and which are not. However, the point of a heap is to store data so that the max (or min) key is at the root of the heap. But we might want to allocate memory of different sizes at different times, so it wouldn't make sense to key on the amount of available memory in a particular region of the free store.
I must assume then that there would be a different heap maintained for each size of memory block that can be allocated, and the key must have something to do with the attractiveness of the particular memory block in the heap (perhaps the lowest address, resulting, hopefully, in growing the free store space less often, leaving more space for the stack to grow, or perhaps keyed based on the fragmentation, to hopefully result in less fragmentation, and therefore more efficient use of the memory space, or perhaps based on page boundaries, keeping as much data in the same page as possible, etc).
So at this point, I have a few questions I've been unable to resolve completely:
1. Am I correct that the heap was so named because (perhaps at one point in time), a heap is/was commonly used to track the available memory in the free store?
2. If so, would it be correct that there would be a heap per standard block size?
3. Also, at what level of granularity would a heap typically be used (memory page, memory blocks, individual words (4-bytes))?
4. What would be the most likely property one would use as a key. That is, what makes the root item on the heap ideal?
5. Would a industrial strength system like the jvm use a (perhaps modified or tuned) heap for this sort of task, or would this typically be too naive for an real world solution today?
Any insight would be awesome!
Thanks,
A.jschell wrote:
I think you are not only mixing terms but domains.
For starters the OS allocs memory. Applications, regardless of language, request memory from the OS and use it in various ways.
There are many variations of the term "heap" like the following.
[http://en.wikipedia.org/wiki/Heap_(data_structure)]
[http://en.wikipedia.org/wiki/Dynamic_memory_allocation]
A java VM will request memory from the OS (from a 'heap') and use it in its application 'heap' (C/C++) and then create the Java 'heap'. There can be variations of that along the way that can and likely will include variations of how each heap is used, potentially code that creates its own heap, and potentially other allocators which use something which is not a heap.This last part, I find a bit confusing. By "use something which is not a heap", do you mean the heap data structure, or the dynamic memory pool meaning of heap? If the former, then you would be implying that it would be common for a heap data structure to be used to manage the heap dynamic memory pool. If the latter, what would this "something which is not a heap" be? The best definition of "heap" I've found simply states that it is a pool of memory that can be dynamically allocated. If there is some other way of allocating dynamic memory, then it would suggest that the previous definition of "heap" is incomplete.
>
So to terms.
1. Am I correct that the heap was so named because (perhaps at one point in time), a heap is/was commonly used to track the available memory in the free store?Which 'heap'? The VM one? It is probably named that because the implementors of the Sun VM were familar with how C++ and Smalltalk allocated memory.Okay, but that begs the question, was the heap in C++ and/or Smalltalk so named for the above queried reason?
>
2. If so, would it be correct that there would be a heap per standard block size?Not sure what you are referring to but probably a detail of the implementation. And since there are different levels the question doesn't mean much.
However OS allocations are always by block if that helps. After that it requires making the question much, much more specific.
3. Also, at what level of granularity would a heap typically be used (memory page, memory blocks, individual words (4-bytes))?Again not specific enough. A typical standard implementation of heap could not be at the word level. And it is unlikely, but not impossible, that variations would support word size allocations.
The VM heap might use word boundaries (but not size), where the application heap certainly does (word boundary.)My understanding of it is that the application would request blocks from the OS, and then something like malloc would manage the memory within the allocated blocks. malloc (or whatever equivalent Java uses) would have to keep track of the memory it has allocated somehow, and I would think it would have to do this at the word level, since it's most commonly going to allocate memory at the word level to be references to other objects, etc.
So I guess my question here would really be, if the dynamic memory heap is so named because there has been a memory management strategy that relied upon a heap data structure (which I've found no proof, but have found some suggestive literature), then would that probably have applied at the OS Page Fault level, tracking allocated blocks, or would that have applied at the malloc level, allocating individual words as necessary?
>
4. What would be the most likely property one would use as a key. That is, what makes the root item on the heap ideal?"Key" is not a term that will apply in this discussion.
You appear to be referring to strategies for effective allocation of memory such as allocations from different regions by size comparison.
It is possible that all levels might use such an allocator. General purpose applications do not sort allocations though (as per your one reference that mentions 'key'.) Sorry, I got the term "key" from an article I read regarding heaps, that indicates that a "key" is used to sort the elements, which I guess would be a more generalized way to make a heap than assuming a natural ordering on the elements in the heap. I'm not sure if the terminology is standard.
>
5. Would a industrial strength system like the jvm use a (perhaps modified or tuned) heap for this sort of task, or would this typically be too naive for an real world solution today?Again too indefinite. The Sun VM uses a rather complicated allocator, the model for which originated after years of proceeding research certainly in Smalltalk and in Lisp as well, both commercially and academically.
I am sure the default is rules driven either explicitly or implicitly as well. So it is self tuning.
There are command line options that allow you to change how it works as well.I guess perhaps I could attempt to clarify my initial question a bit.
There is a 1:1 correspondence between the runtime stack, and a stack data structure. That is, when you call a function, it pushes a stack frame onto the runtime stack. When you return from a function, it pops a stack frame from the runtime stack. This is almost certainly the reasons the runtime stack is named as it is.
The question is, is there or has there ever been a 1:1 correspondence between some aspect of the dynamic memory heap or how it is managed, and a heap data structure? If so, it would explain the name, but I'm a bit puzzled as to how a heap data structure would be of assistance in creating or managing the dynamic memory heap. If not, on the other hand, then does anybody know where the name "heap" came from, as it applies to the dynamic memory pool?
A. -
Simple Transformation to deserialize an XML file into ABAP data structures?
I'm attempting to write my first simple transformation to deserialize
an XML file into ABAP data structures and I have a few questions.
My simple transformation contains code like the following
<tt:transform xmlns:tt="http://www.sap.com/transformation-templates"
xmlns:pp="http://www.sap.com/abapxml/types/defined" >
<tt:type name="REPORT" line-type="?">
<tt:node name="COMPANY_ID" type="C" length="10" />
<tt:node name="JOB_ID" type="C" length="20" />
<tt:node name="TYPE_CSV" type="C" length="1" />
<tt:node name="TYPE_XLS" type="C" length="1" />
<tt:node name="TYPE_PDF" type="C" length="1" />
<tt:node name="IS_NEW" type="C" length="1" />
</tt:type>
<tt:root name="ROOT2" type="pp:REPORT" />
<QueryResponse>
<tt:loop ref="ROOT2" name="line">
<QueryResponseRow>
<CompanyID>
<tt:value ref="$line.COMPANY_ID" />
</CompanyID>
<JobID>
<tt:value ref="$line.JOB_ID" />
</JobID>
<ExportTypes>
<tt:loop>
<ExportType>
I don't know what to do here (see item 3, below)
</ExportType>
</tt:loop>
</ExportTypes>
<IsNew>
<tt:value ref="$line.IS_NEW"
map="val(' ') = xml('false'), val('X') = xml('true')" />
</IsNew>
</QueryResponseRow>
</tt:loop>
</QueryResponse>
</tt:loop>
1. In a DTD, an element can be designated as occurring zero or one
time, zero or more times, or one or more times. How do I write the
simple transformation to accommodate these possibilities?
2. In trying to accommodate the "zero or more times" case, I am trying
to use the <tt:loop> instruction. It occurs several layers deep in the
XML hierarchy, but at the top level of the ABAP table. The internal
table has a structure defined in the ABAP program, not in the data
dictionary. In the simple transformation, I used <tt:type> and
<tt:node> to define the structure of the internal table and then
tried to use <tt:loop ref="ROOT2" name="line"> around the subtree that
can occur zero or more times. But every variation I try seems to get
different errors. Can anyone supply a working example of this?
3. Among the fields in the internal table, I've defined three
one-character fields named TYPE_CSV, TYPE_XLS, and TYPE_PDF. In the
XML file, I expect zero to three elements of the form
<ExportType exporttype='csv' />
<ExportType exporttype='xls' />
<ExportType exporttype='pdf' />
I want to set field TYPE_CSV = 'X' if I find an ExportType element
with its exporttype attribute set to 'csv'. I want to set field
TYPE_XLS = 'X' if I find an ExportType element with its exporttype
attribute set to 'xls'. I want to set field TYPE_PDF = 'X' if I find
an ExportType element with its exporttype attribute set to 'pdf'. How
can I do that?
4. For an element that has a value like
<ErrorCode>123</ErrorCode>
in the simple transformation, the sequence
<ErrorCode> <tt:value ref="ROOT1.CODE" /> </ErrorCode>
seems to work just fine.
I have other situations where the XML reads
<IsNew value='true' />
I wanted to write
<IsNew>
<tt:value ref="$line.IS_NEW"
map="val(' ') = xml('false'), val('X') = xml('true')" />
</IsNew>
but I'm afraid that the <tt:value> fails to deal with the fact that in
the XML file the value is being passed as the value of an attribute
(named "value"), rather than the value of the element itself. How do
you handle this?Try this code below:
data l_xml_table2 type table of xml_line with header line.
W_filename - This is a Path.
if w_filename(02) = '
open dataset w_filename for output in binary mode.
if sy-subrc = 0.
l_xml_table2[] = l_xml_table[].
loop at l_xml_table2.
transfer l_xml_table2 to w_filename.
endloop.
endif.
close dataset w_filename.
else.
call method cl_gui_frontend_services=>gui_download
exporting
bin_filesize = l_xml_size
filename = w_filename
filetype = 'BIN'
changing
data_tab = l_xml_table
exceptions
others = 24.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif. -
Help with exporting forms based data to Excel 2007
I have a user who is attempting to export forms based data to Microsoft Excel 2007 and when he attempts this he receives a message stating that Windows does not recognise this file type (tsv). I am not too familiar with Office 2007 so I am unable to direct this users as to how to correct this issue.
Is someone able to give me the navigation path to help me to assist this user? thanksDid you verify the file type from Windows Explorer?
1) Right click on My Computer > Explore
2) Go to Tools > Folder Options
3) Click on File Types tab
4) Check if TSV file is defined there or not. If it is not there, click on New and add the File Extension -
SSIS - Loop through files from a file path based on the value in the variable
Experts,
I have a requirement where I'll be loading multiple files in to a SQL server table and archive the files when loaded. However, the challenge is , the file path should be dynamic based on the value of a variable (say, @ProductName).
For example: If I am running the package for variable @ProductName="Product", the file path would be "\\....\Src\Product", in that case the ForEachLoop will loop through all the files in that folder, load them to the table and Archive
the files to the "\\....\Src\Product\Archive" folder.
Similarly, if the @ProductName="Product_NCP", the foreachloop container should loop through files in the "\\....\Src\Product_NCP" folder, load them to the table and archive them to the ""\\....\Src\Product_NCP\Archive"
folder.
Any suggestions? I should be able to run the package manually just by passing the "@Product" value, create Archive folder if it doesn't exist, load the data and archive the files.Yes
1. Have a variable inside SSIS to get folder path. Set path based on your rule using an expression
like
(@[User::ProductName] == "Product" ? "\\....\Src\Product" : (@[User::ProductName] == "Product_NCP" ? \\....\Src\Product_NCP:..))
similary archive
(@[User::ProductName] == "Product" ? "\\....\Src\Product\Archive" : (@[User::ProductName] == "Product_NCP" ? "\\....\Src\Product_NCP\Archive" :..))
Please Mark This As Answer if it solved your issue
Please Vote This As Helpful if it helps to solve your issue
Visakh
My Wiki User Page
My MSDN Page
My Personal Blog
My Facebook Page -
Urgent! Need help in deciding data structure to use
Hi all,
I need to implement a restaurant system by which a customer can make a reservation.
I was wondering whether vector would be able to be store such an object, The thing is I don't want a complex data structure. just sumthin simple cos i hardly have anytime left to my submission. sighz...
The thing is I need to able to search based on 2 properties of an object. Eg. I need to search for a reservation based on the customer name and the date he reserved a table.
But I am totally clueless how to search thru a vector based on 2 properties of the object... Would really appreciate some help. Like an example how to so so based on my program. Feelin so lost...This is all I have so far:
class AddReservation
static BufferedReader stdin = new BufferedReader (new InputStreamReader(System.in));
//Main Method
public static void main (String[]args)throws IOException
String custName, comments;
int covers, date, startTime, endTime;
int count = 0;
//User can only add one reservation at a time
do
//Create a new reservation
Reservation oneReservation=new Reservation();
System.out.println("Please enter customer's name:");
System.out.flush();
custName = stdin.readLine();
oneReservation.setcustName(custName);
System.out.println("Please enter number of covers:");
System.out.flush();
covers = Integer.parseInt(stdin.readLine());
oneReservation.setCovers(covers);
System.out.println("Please enter date:");
System.out.flush();
date = Integer.parseInt(stdin.readLine());
oneReservation.setDate(date);
System.out.println("Please enter start time:");
System.out.flush();
startTime = Integer.parseInt(stdin.readLine());
oneReservation.setstartTime(startTime);
System.out.println("Please enter end time:");
System.out.flush();
endTime = Integer.parseInt(stdin.readLine());
oneReservation.setendTime(endTime);
System.out.println("Please enter comments, if any:");
System.out.flush();
comments = stdin.readLine();
oneReservation.setComments(comments);
count++;
while (count<1);
class Reservation
private Reservation oneReservation;
private String custName, comments;
private int covers, startTime, endTime, date;
//Default constructor
public Reservation()
public Reservation(String custName, int covers, int date, int startTime, int endTime, String comments)
this.custName=custName;
this.covers=covers;
this.date=date;
this.startTime=startTime;
this.endTime=endTime;
this.comments=comments;
//Setter methods
public void setcustName(String custName)
this.custName=custName;
public void setCovers(int covers)
this.covers=covers;;
public void setDate(int date)
this.date=date;
public void setstartTime(int startTime)
this.startTime=startTime;
public void setendTime(int endTime)
this.endTime=endTime;
public void setComments(String comments)
this.comments=comments;
//Getter methods
public String getcustName()
return custName;
public int getCovers()
return covers;
public int getDate()
return date;
public int getstartTime()
return startTime;
public int getendTime()
return endTime;
public String getComments()
return comments;
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
class searchBooking
static BufferedReader stdin = new BufferedReader (new InputStreamReader(System.in));
public static void main (String[]args)throws IOException
int choice, date, startTime;
String custName;
//Search Menu
System.out.println("Search By: ");
System.out.println("1. Date");
System.out.println("2. Name of Customer");
System.out.println("3. Date & Name of Customer");
System.out.println("4. Date & Start time of reservation");
System.out.println("5. Date, Name of customer & Start time of reservation");
System.out.println("Please make a selection: ");
//User keys in choice
System.out.flush();
choice = Integer.parseInt(stdin.readLine());
if (choice==1)
System.out.println("Please key in Date (DDMMYY):");
System.out.flush();
date = Integer.parseInt(stdin.readLine());
else if (choice==2)
System.out.println("Please key in Name of Customer:");
System.out.flush();
custName = stdin.readLine();
else if (choice==3)
System.out.println("Please key in Date (DDMMYY):");
System.out.flush();
date = Integer.parseInt(stdin.readLine());
System.out.println("Please key in Name of Customer:");
System.out.flush();
custName = stdin.readLine();
else if (choice==4)
System.out.println("Please key in Date (DDMMYY):");
System.out.flush();
date = Integer.parseInt(stdin.readLine());
System.out.println("Please key in Start time:");
System.out.flush();
startTime = Integer.parseInt(stdin.readLine());
else if (choice==5)
System.out.println("Please key in Date (DDMMYY):");
System.out.flush();
date = Integer.parseInt(stdin.readLine());
System.out.println("Please key in Name of Customer:");
System.out.flush();
custName = stdin.readLine();
System.out.println("Please key in Start time:");
System.out.flush();
startTime = Integer.parseInt(stdin.readLine());
}Please stop calling your questions urgent. Everybody's question is urgent to them. Nobody's are urgent to the people who are going to answer them. Calling your questions urgent suggests that you think they are more important than others' (They're not.) and will only serve to irritate those who would help you. It won't get your questions answered any sooner.
-
Open ended data structure for retrieving SQL data
I have a flex project that reads data from a database and
sends it to my flex app to display in a chart. I need to do this in
Actionscript since I have to dynamically create different charts
based on the database definitions. Up til now, I have inserted the
data for each series into a separate
ArrayList(java)/ArrayCollection(flex) in this way:
BindingUtils.bindProperty(lineSeries, "dataProvider", series,
"pointList");
lineSeries.xField="point1";
lineSeries.yField="point2";
The series variable is a custom Actionscript/Java object
which contains an ArrayCollection called pointList. And the array
is made up of custom DataObjects with two fields, point1 &
point2.
But in the new paradigm, I'd basically like to create a big
array of arrays similar to a database table and then just point the
xField to one column, and the yField to another column. Anyway, it
seems like the problem is that my point1 and point2 in the current
implementation are variable names, but with this new dynamic
structure, I won't be able to create variables on the fly. So how
do I let flex know to look at column 3, for example for the yField?
The attached code is from the Flex documentation and is an example
of what I'd like to emulate (except I need to do it in
actionscript). I'd like to be able to select "month" or "amount",
etc. But coming from the Java side, there is no way for me to name
the array contained in each column.I guess I wasn't clear enough. I am actually serializing a
java object and mapping it to an actionscript object via blazeDS. I
know about how the objects translate, for example for
ArrayCollections in flex, I use ArrayLists in java. The problem is
that I'm not sure how to get the associative aspects of the arrays
in flex into my java data structures in a way that will translate
to the way flex can define arrays, such as Month:"January".
It seems that in flex, you can create an Array and assign it
an element like {month:"January", amount:"450"} and it will create
an Object with variables for month and amount. But I don't know how
to do this on the fly in Java (or in Actionscript for that matter)
when I have no way of knowing beforehand how many variables my
object will need. Each series will need an x and y, though usually
the x will be dates which are the same for each series. So if I had
10 series sharing an axis, I'd need 11 variables in my object-
date, series1, series 2...series 10. -
How to access data structures in C dll from java thru JNI?
We have been given API's( collection of C Functions) from some vendor.
SDK from vendor consist of:
Libpga.DLL, Libpga.h,Libpga.lib, Along with that sample program Receiver.h (i don't know its written in C or C++), I guess .C stnads for C files?
Considering that I don't know C or C++ (Except that I can understand what that program is doing) & i have experience in VB6 and Java, In order to build interface based on this API, I have two option left, Use these dll either from VB or Java.
As far as I know, calling this DLL in VB requires all the data structures & methods to be declared in VB, I guess which is not the case with Java (? I'm not sure)
I experiemnted calling these function from Java through JNI, and I successfully did by writting wrapper dll. My question is whether I have to declare all the constants & data structures defined in libpga.h file in java, in order to use them in my java program??
Any suggesstion would be greatly appreciated,
Vini1. There are generators around that claim to generate suitable wrappers, given some dll input. I suggest you search google. Try JACE, jni, wrapper, generator, .... Also, serach back through this forum, where there have been suggestions made.
2. In general, you will need to supply wrappers, and if you want to use data from the "C side" in java, then you will need java objects that hold the data. -
Error in creating New Data Structures
Hi Gurus,
I tried creating new data structure in the R3 server using RSO2. I was planning to use the Purchasing Table (EKBE). But when I tried saving the structure this error occured/showed.
Invalid Extract sturcture template EKBE of Datasource MM_EKBE
Diagnosis:
You have tried to generate an extract structure with template structure EKBE. This was not successful, because the template structure references quantity or currency fields, for example the field name MENGE from another table.
Procedure:
Generate a view or a DDIC structure based on the template structure, which does not contain the unstupported fields.
- I have no idea what the problem is and what i should do based on the procedure. If anyone can help it would be much appreciated. Thank you in advance
- KITHi Kristian,
The table EKBE has quantity and currency field refernceing field from other table to define them.
You need to include these refenced filed in the structure you add in the data source as the template.
To do this create a custom dictionary object view.
In the view include the refernce currency and quantity field from the reference table.
Also create a join between EKBE and the refernece table using the data elements that are the same.
For example, for quantity key figures in EKBE the unit of measure would be sourced by menge from MARA.
So you need to have table MARA included in the view.
The join would be on the material in EKBE and material in MARA.
You will find reference quantity and currency tab in the table definition in the Reference currency/quantity tab in the table definition.
You need to do this for all your quantity and currency references.
Once that is done use the ZVIEW to create your data source.
Hope it helps,
Best regards,
Sunmit. -
Lock and wait free data structures...???
Hi - I am developing an application that requires multi-threading. We are testing this on CentOS 5, 64 BIT, running on Intel Quad Core machines, with 8 GB RAM (3 of them). I am using a III party tool to create a datagrid, and have 2 more machines in the federation to monitor performance.
Java collections/synchronized collections has restriction on multithreading. If thread1 performs puts or removes objects in collection (Tree, Map, List, Set), thread2 cannot iterate. Thread2 can iterate only if it acquires synchronized lock on collection this implies thread1 has to wait till iteration is over. This introduces latency. If without acquiring lock thread2 does iteration, then concurrent modification thread exception arises.
For real time application like financial markets (multiple thread based application) every microsecond/millisecond matters.
For workaround at present we have customized sun code by masking modCount and expectedCount. This means check for concurrent modification is disabled. But not quite sure this is correct approach. Other option was multiple buffering.
Other option is lock and waits free data structures which I am interested.
Any ideas on this???
cheers - MuraliIt depends on what is acceptable to you.
If you are only iterating and not removing any objects through the iterator, then there are two concerns;
1. Iterator skips some elements.
2. Iterator iterates to non-existent elements causing NPE.
You can also copy the datastructure. Then iterate over the copy.
You can also do "copy on write." This causes a copy only when the datastructure is modified and those iterators already created are not affected. This is the technique I use.
Eliminating locks is not the objective. Locking is very quick. Its the contention that you want to eliminate. COW can do this nicely in my experience. Depends on your requirements.
P.S. Try assigning duke dollars to the question and you will probably get more viewers. -
How can I set the Lock Model and data structure ?
Hi ,
I just have two questions about JE:
1) Is there some method for me to set the lock mode level , such as record lock, page lock and database lock in JE?
2) I learned that there are Btree and Hash,etc , data structures , How can I set the data structure when using JE ?
Thanks in advance !
ChrisI think you're confusing our DB (C-based product) with JE. JE does not have lock mode levels, page locks (it does not have pages), or database locks. JE only has the BTREE method, it does not have the HASH method. For JE, please be sure to reference the JE doc page:
http://www.oracle.com/technology/documentation/berkeley-db/je/index.html
--mark -
*** PLEASE DO NOT REPLY TO THIS POSTING UNLESS
*** YOU KNOW EXACTLY WHAT I AM TALKING ABOUT
*** AND HAVE SOLUTION AT THE READY.
*** NO SWING TREE FYIs PLEASE...doesn't apply.
*** NO UI JAVASCRIPTS .. I HAVE THOSE.
I need a properly constructed multiway
(m-way, general, n-ary, etc.) data structure
implementation that uses non-ui
dependent/associated classes. This is know as the
first child/next sibling data structure used in
Filesystems (similiar to a BTree).
I am using many delimited strings, similiar to a
directory/file structure path but the string is a
software project hierarchy.
[a string is structured like this]
root|branch|...|branch|leaf
[Process]
1) the strings are fetched from DB by servlet.
2) servlet feeds strings into data structure
to eliminate duplicates and place in proper location.
3) servlet uses contents of data structure to
construct links that are coupled with the infamous
ui-tree script.
If you know your data structures and have an implementation
that won't take me 6 days to modify for it to work I would
appreciate your assistance. I am creating on my own as we
speak but one from a more experienced java programmer would
be better.
Thank You,
KevinSounds like one hell of a frustrated programmer over there - all those capitals an'all..
If I understand you correctly, I don't think you'd take six days to implement this; just split your string by the separator;
String[] split(String path, char sep, char esc) {
String[] result = new String[0];
int o = 0;
int i; for (i=0; i<path.length(); ++i) {
char c = path.charAt(i);
if (c == esc) {
++i;
continue;
if (c == sep) {
String substring = path.substring(o, i);
String[] newresult = new String[result.length+1];
System.arraycopy(result, 0, newresult, 0, result.length);
newresult[result.length] = substring;
result = newresult;
o = i+1;
}Then have a java.util.Hashtable as root, with all names in it pointers to either more Hashtables (nodes), or Strings (leaves). If it really does not get anymore complex than that (data associated with leaves, for example), you don't really have to use anything more complex than 'instanceof' here.
Then start looping over all your String[] split paths, retrieve all nodes, if it's a String and you have a child for it, then convert it to a Hashtable, it it's a Hashtable trod along, if it isn't there create a String (unless you know you have an extra child, in which case you create a Hashtable).
When you're ready to retrieve, just enumerate your root Hashtable, casting to String all the keys, examining all the values; if they are Hashtable, then recurse. If they're Strings, do your Thing (TM).
Maybe you are looking for
-
Cost center integration with HR - logical system for CRT inconsistent
Hi there, we are distributing Cost centers from our SAP ERP system to another SAP HR system via ALE [COSMAS01 basic type]. The cost center created in target system contains information about source system logical system name - table CSKS, field LOGSY
-
Selecting WAV files in iTunes for AAC conversion
I've been told in another thread by Ed, a Windows iTunes user, that I can select a WAV song file in the iTunes library, right-click it, and the "Advanced" menu will have the "Convert Selection to XXX (whatever you designate in preferences)" option. H
-
Hi All, We need to add field into CM21.Through structure 'CYUSER' and IMG setting(t-code:CY38), i did let user defined field appears in CM21 layout. But question is it's empty, how can i get the field data successfully? Need I select data through enh
-
I forgot my security questions and i dont have a rescue email
I forgot my security questions and i didn't provide a rescue email adress what can i do?
-
How do I close apps that are running in the background. You used to double press the button, and then press and hold to allow the "x" to come up, so you could close them down.