Simple Array Dimensioning question
Hey all,
What is the easiest way to dynamically set the array dimension of an array? I have a method that returns an object array of type Project. The array size of the returned object varries depending on what parameters are passed. I do not know how to declare the object that calls the method. Can you help me? Thanks.
DetailedProject[] test = new DetailedProject[5];
test = myBudgetDAO.getProjects("2006","O&M","25","109","98");
Would I still be able to call the same method with different parameters? Yes. All you say is that the method is returning an array.
The size of the array matters not to your main program, just that the method returns an array of the appropriate objects.
Something in your getProjects method you must be declaring/creating an array. Look at that code.
The getProjects method must know how many to create if it is returning the correctly sized array.
An alternative is instead of using an array, to use a List (eg ArrayList) which dynamically resizes itself, and you don't need to set inital capacity.
Similar Messages
-
A few simple (?) dimension questions...
Hi, I have a few really simple dimension questions that I just can't figure out in OWB (which I'm just now starting to play with):
1) I'm trying to create a dimension that has no levels or any hierarchy. In the BI tool, I just want this dimension to act as a "pick list" for one of 8 values (DW data snapshot dates for the last 8 weeks...) Users won't summarize by this dimension, or ever have more than 1 week selected at a time. How can I set this type of dimension up?
2) Somewhat related to #1 - just to get something working, I set up a "time in weeks" dimension not as a time dimension, just as a normal user dimension. I then added a single "weeks" level with a surrogate key (using "key" instead of "id"), short desc (as the business key), and long description. Set up a mapping from my source table, everything worked fine. The strange thing I've notcied is that the relational table produced has both a "week_key" column and a "dimension_key" column. How can I get rid of the "dimension_key" column - its just an exact duplicate of the lowest level key column? Note - we will have a dimension table with over 1.3 BILLION rows in our warehouse - so duplicating this column does add a significant amount of overhead - this isn't just an academic problem.
3) related to building this "test" dimension - my source table has 8 records in it. Whenever I run the ETL to populate the dimension table, the surrogate keys end up being key values 9 - 16 instead of 1 - 8. Note this is even if I reset the sequence number to 1 before I start, etc. My understanding is that Oracle uses a variable width number field when storing data - so having this dimension with values 1-8 instead of 9-16 saves approx a byte for every fact table record (which we're predicting will be in the range of 20 - 50 BILLION rows). How can I force the dimension to start numbering at 1?
Thanks in advance,
ScottHi
Reg #2, I do not think we can get rid of the "dimension key". It looks like OWB is creating this column as a default Primary Key and hence is not possible to remove this. May be if we build the base Table for dimension as a normal relational table, which will allow us to define our own keys, and then build the "Dimension" using AWM on this relation table may resolve the issue of having duplicate primary keys. Its only a thougt, have not tested though.
rgds
Mahesh -
hi,
I am having difficulties with this very simple array (following). I want to store data through a while loop which is why I tried with a very simple example. And it doesn't work. The data is erased every loop, and i must set the dimension of the array (100 for this example) to get something or my array stays at 0... but I won't know it in my VI.
Thanks for the help!
Solved!
Go to Solution.Since you are using Replace array element the element needs to exist prior to rewriting the element.
Here are two examples in on shot:
The upper one uses autoindexing, this has the disadvantage that you don't have the data until the loop is finished.
The lower one uses append array element and feedback notes.
Ton
Message Edited by TonP on 06-29-2009 11:24 AM
Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas
LabVIEW, programming like it should be!
Attachments:
AppendAutoIndex.png 3 KB -
HELP: Run-time array dimension in LabVIEW formula node
I need to dimension an array at run time within a formula node as follows:
int32 i,N;
N = sizeOfDim(inputArray,0);
float64 outputArray[N];
for (i = 0; i outputArray[i] = myfunction(inputArray[i]);
However, LabVIEW complains "Formula Node: index list expected". On the
other hand, if I say
float64 outputArray[1000];
LabVIEW is perfectly happy. But that's not what I need to do! Is there
an alternative
way of accomplishing my goal?
BTW, I've tried calculating N outside the formula node and then
presenting it as
an input with the same results. I've got a bad feeling that run time
array dimensioning
just isn't allowed.
TIA,
HughCan't you just use the Initialize Array function outside the formula node and pass that instead?
-
Array dimensions when converting from a cluster
Hello,
I am a beginner Labview programmer. Right now I am working on a VI
that converts a portion of cluster data to an array of tables. The
cluster is loop tunneled into a for loop then unbundled. I then build
it into a 2D array. When I hand the data back out of the for loop the
array dimensions are the same size. i.e. If the 2D arrays were 2x7 and
2x6 going in then going out I have both as 2x7's. This happens right
at the exiting loop tunnel (I suppose when it initializes the 3D
array). This places zeros in the last row of my 2x6 array. Can anyone
suggest a fix. Thanks a bunch.
Peter.Hi, Peter:
I think you want to have an array of different row sizes. I think it's impossible in LabView. At least using only arrays and without clusters.
And as all rows have the same number of elements, undefined elements get default value. In case of numerics, zeros.
You could create an array of cluster elements, and each element be an array 2D. Then each element can be an array of different sizes.
But that's just what you had at start.
Aitortxo.
Aitortxo. -
On the front panel is an array of dbl. I want to only allow the user to select four (0-3) using the index display. How can I limit the index display?
Solved!
Go to Solution.
Attachments:
Array dimensions.vi 6 KBYou can hide the index display, then make a seperate control where you can set entry limits. Use a value change event on it to set the "index values" property to scroll the array. Make the upper limit of the control dependent on the size of the array and the number of elements visible.
For example, if the array is size=4 and the display is size=3, only allow 0..1 on the control using data entry limits.
You could even wrap the entire thing into an xcontrol. The advantage of an xcontrol is the fact that is also work in edit mode.
Message Edited by altenbach on 02-01-2010 09:35 AM
LabVIEW Champion . Do more with less code and in less time . -
In my code, i have two arrays. one for storing names and another to store a set of grades. The problem im having is defining the array dimensions.
The info is read in from a txt file so do i have to count the number of lines in the file in order to set the dimensions?Use HashMap with [name(key) : grade(value)] pairs.
You don't need the total number of them beforehand.
Raw arrays should not be used as application's first
class data in a serious
Java project. Use java.util.Collection/Map family of
data structures instead.While I would tend to agree with the above suggestion, here's another idea for you:
if you use an ArrayList, you don't have to set the dimesion before hand. And if you're bent on using an array (as opposed to an ArrayList), there is a method of the List interface that returns an array (it's called toArray). So you could add everything to a LinkedList (faster than adding to an ArrayList), and get the contents back as an array.
But again, I recommend the HashMap approach.
- Adam -
Simple X-fi Question, Please Help
!Simple X-fi Question, Please HelpL I've been looking for an external sound card that is similar to the 2002 Creative Extigy and think I may found it in the Creative X-Fi. I have some questions about the X-fi though. Can the X-fi:
1. Input sound from an optical port
2. Output that sound to 5. surround- Front, surround, center/sub
3. Is the X-Fi stand-alone, external, and powered by a USB or a wall outlet (you do not need a computer hooked up to it)
Basically I want to connect a TosLink optical cable from my Xbox to the X-Fi. That will deli'ver the sound to the X-Fi. Then I want that sound to go to a 5. headset that is connected to the X-fi via 5. front, surround, and center/sub wires. The X-Fi has to be stand-alone and cannot be connected to a PC to do this.
Thank you for your help.The connector must match, and the connector polarity (plus and minus voltage) must match. Sorry, I don't know if the positive voltage goes on the inside of the connector or the outside. Any wattage of 12 or more should be adequate.
Message Edited by toomanydonuts on 01-10-2008 01:29 AM -
Hi, I am new to LabView, however I have programmed in various languages to a moderate level.
I have attached the vi that I am working on to test a simple array.
All I want it to do for just now so I can get my head around LabView arrays is simply add the string to the array each time the button is pressed.
So each time the button is pressed I want to add an new element to the array. So after say 10 presses there should be 10 elements
Regards,
jmcall10
Attachments:
array-test.vi 9 KBSome general suggestions:
Use latch action boolean (right-click..mechanincal action). This way it is true until read by the code, the reverts autoamtically back to false (no need for the local variable).
Your sequence structure has no purpose. Adding to the array is basically instantaneous, so you can add the delay outside. The execution order does not matter.
Pachi: Your Current VI has no wait unless you press the button, meaning it spins like crazy, consuming all CPU while doing nothing. The wait should be outside the case.
Pachi: You need to initalize the shift register, else it remembers the data from previous runs.
Pachi: It is much less efficient to add to the beginning of the array. I recommend to add the new element to the end.
Here's a quick draft...
(personally, I would use an event structure, but this should get you started).
LabVIEW Champion . Do more with less code and in less time .
Attachments:
AddToArray.png 25 KB -
Exchange 2013 Public Folders Array Dimensions Have Exceeded Supported Range
Hello,
I have another odd issue for public folders on Exchange 2013. I am working with an environment with a bit over 3000 Public Folders and we are having some issues where some users are not able to access the public folder. When I try to change the permissions
to those folders I get the error of:
"Array Dimensions Have Exceeded Supported Range"
The environment is a 2 Node DAG with all components installed on each server. The latest Roll Up has been in stalled on both servers as well.
Thanks in Advance
JoeUpdate the thread if you find the resolution...
Cheers,
Gulab Prasad
Technology Consultant
Blog:
http://www.exchangeranger.com Twitter:
LinkedIn:
Check out CodeTwo’s tools for Exchange admins
Note: Posts are provided “AS IS” without warranty of any kind, either expressed or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose. -
Hi,
For the following declaration I am getting "Array Dimension Too Big" error with Forte C Compiler on Solairs 8.
double try[23200][23000];
What is the mx dimension possible? and Where do I find such info on boundary conditions??
Regards,
GurudattaHi There,
The legal limit of the array is whatever the hardwareand swap space will support.
You are asking for 8*23000*20000 bytes /1024/1024 = 3509.52 megabytes = 3.43 gigabytes.
You are declaring this much allocation locally via
automatic array in your example. You'll have to define a stack this size (hardly practical).
If you ask for this much memory with malloc() which is a much better idea, you'll still need to have enough swap.
You can also do mmap(...,MAP_NORESERVE,...) in which case you may not even need the swap to support it.
It all depends on what you are doing and why.
.....jagruti
Developers Technical Support
Sun Microsystems, http://www.sun.com/developers/support -
Simple Crop tool question... how do I save the crop section?
Hi,
I have a very simple crop tool question. I'm a photoshop girl usually... so Illustrator is new to me. When I select the crop section I want... how do I save it?... if I select another tool in the tool panel, the crop section disappears and I can't get it back when I re-select Crop tool. If I select Save as... it saves the whole document...and not just my crop section.
Like I said, simple question...but I just don't know the secret to the Illustrator crop tool.
Thanks!
YzzaEither press the Tab key or F key.
-
A Simpler, More Direct Question About Merge Joins
This thread is related to Merge Joins Should Be Faster and Merge Join but asks a simpler, more direct question:
Why does merge sort join choose to sort data that is already sorted? Here are some Explain query plans to illustrate my point.
SQL> EXPLAIN PLAN FOR
2 SELECT * FROM spoTriples ORDER BY s;
PLAN_TABLE_OUTPUT
| 0 | SELECT STATEMENT | | 998K| 35M| 5311 (1)| 00:01:04|
| 1 | INDEX FULL SCAN | PKSPOTRIPLES | 998K| 35M| 5311 (1)| 00:01:04|
---------------------------------------------------------------------------------Notice that the plan does not involve a SORT operation. This is because spoTriples is an Index-Organized Table on the primary key index of (s,p,o), which contains all of the columns in the table. This means the table is already sorted on s, which is the column in the ORDER BY clause. The optimizer is taking advantage of the fact that the table is already sorted, which it should.
Now look at this plan:
SQL> EXPLAIN PLAN FOR
2 SELECT /*+ USE_MERGE(t1 t2) */ t1.s, t2.s
3 FROM spoTriples t1, spoTriples t2
4 WHERE t1.s = t2.s;
Explained.
PLAN_TABLE_OUTPUT
| 0 | SELECT STATEMENT | | 11M| 297M| | 13019 (6)| 00:02:37 |
| 1 | MERGE JOIN | | 11M| 297M| | 13019 (6)| 00:02:37 |
| 2 | SORT JOIN | | 998K| 12M| 38M| 6389 (4)| 00:01:17 |
| 3 | INDEX FAST FULL SCAN| PKSPOTRIPLES | 998K| 12M| | 1460 (3)| 00:00:18 |
|* 4 | SORT JOIN | | 998K| 12M| 38M| 6389 (4)| 00:01:17 |
| 5 | INDEX FAST FULL SCAN| PKSPOTRIPLES | 998K| 12M| | 1460 (3)| 00:00:18 |
Predicate Information (identified by operation id):
4 - access("T1"."S"="T2"."S")
filter("T1"."S"="T2"."S")I'm doing a self join on the column by which the table is sorted. I'm using a hint to force a merge join, but despite the data already being sorted, the optimizer insists on sorting each instance of spoTriples before doing the merge join. The sort should be unnecessary for the same reason that it is unnecessary in the case with the ORDER BY above.
Is there anyway to make Oracle be aware of and take advantage of the fact that it doesn't have to sort this data before merge joining it?Licensing questions are best addressed by visiting the Oracle store, or contacting a salesrep in your area
But I doubt you can redistribute the product if you aren't licensed yourself.
Question 3 and 4 have obvious answers
3: Even if you could this is illegal
4: if tnsping is not included in the client, tnsping is not included in the client, and there will be no replacement.
Tnsping only establishes whether a listener is running and shouldn't be called from an application
Sybrand Bakker
Senior Oracle DBA -
Max array dimension for Speedy 33?
Hi all,
Does any body know what the max array dimension for Speedy 33? I am able to create 1-row arrays, but not arrays more than 1 rows..
Thanks so much in advance!
~CassiopeaThere is a really good knowledge base article on our website that discusses in detail how arrays are handled using LabVIEW DSP and how you should use them. It has exactly what you're looking for.
How Can I Be Successful With Arrays In the LabVIEW DSP Module?
Good luck with your application!
Nick R
NI -
Simple Design Analysis Question before designing dimensions and facts
Hi I have a simple question ... (I think its simple)
Suppose that i have the following staging table with the following columns:
Student_Name | RollNo | Test_Date | Subject-Taken
with data such as
Kevin |123|12-4-2010|Physics
now suppose that I want to design a cube on the basis of the above table so that I can succesfully get the result of a query such as
List the names of all those students who took the test b/w 12-4-2010 to 12-5-2010 of the Subject Physics
Here what i need to know what dimensions/Levels would u set and what would be our fact?
I think that one dimension would be time ( but i am not sure how i would accommodate and handle duration... any idea )
would it be wise to make each column a dimension ??? for example the student_nanme a dimension and details of the student its attributes??
Anyways the main thing is what bothers me is looking at the query we see that we are required 3 things the name of the student , the TestDate and subject taken so if i make the 3 columns the dimension i am still not sure that i would be able to acomodate the query properly...any ideas on how to approach and handle these situations
Edited by: Johnacandy on Dec 14, 2010 9:26 AMScoobySi wrote:
Yes I mean Time dimension, however in a DW you will have many Time dimensions, instead of creating a physical object for each you use a ROLE. If you edit a dimension in OWB you'll see that you can specify a ROLE on the first tab.
Thanks for the great explaination... could you explain the process of roles a little more that will really save me some time... furthermore u stated
+ "instead of creating a physical object for each you use a ROLE" +
The way i create dimensions is right clicking dimensions and selecting dimension.... for a standard dimension
however incase of a time dimension i use a wizard... I am still a bit confused about "Physical objects" ... Id really really appreciated it if you can clarify this up...
as discussed before one dimension would be Student and other would be subject
and 3rd one would be TEST_DATE with role ?? and should that be a time_dimension or a standard dimension with a role defined ???
Maybe you are looking for
-
Argh! I am attempting to set up Mail to access my Gmail and my work email, hosted by Yahoo. I got it all to work flawlessly at home. Here at the office, no good. Mail is unable to connect to any mail servers at either Yahoo or Gmail. It always times
-
From Which table Production resource/tool number can be retried
Hi Friends, In SAP Query I am Using MAPL,PLAS, PLPO, PLKO, I want to retrieve Production resource/tool number PLFHD-FHMNR, can any one tell in which table it is storing the value.. & what link condition I need to use to retrieve thisfield.. Transacti
-
Hi, While writing the text at the header and item level in a PO its not getting transfered to SRM. The segment E1EDKT2 which contains the text details is not generating. Please advise. Thanks, Manu
-
Lookup Options in SOA11g.
Hi , I have a requirement to create a lookup like below , and access the same in SOA 11g BPEL / Mediator process. This Should be dynamic in nature, so that business users can modify / add the lookup values at runtime. Level------AppName 1---------A 2
-
Hp pavillion g6 notebook pc windows 8, graphics card
Hi there, I got one of these laptops and it is incredible, I am very happy with it. I just wanted to know if the graphics card was upgradable, and if so what to? (hp pavillion g6 notebook pc windows 8). Thanks a lot, Dave {Personal Information Remove