The in-built length variable
The length variable we see in arrays and everywhere is built in some inbuilt class of java.. but where???? i tried to find it but cudnt get to it in any classses// tried searchin in java.lang package... can anyone tell me where the lenght variable is defined in java?????????????????
its urgent plzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
If you expect clear answers, it makes sense to give clear questions.
Well sir thanks alot... not only will i learn about java here but i guess will also get better with my language and typing which was getting destroyed because of chatting sites... anyways i understand the importance of being proffesional as just finished my engineering and now looking for a job desparately... so i hope imporving not only with java but things like proper and clear writing will help my career... thank you sir and about the link you sent me...
I checked that and when from the src.zip folder i opened the java files.. i tired to find that length vairable.. i found a lenght variable in Array.java file in the lang package in reflect folder . but that vairable was a parameter so it that all.. i mean is that the same variable that springs up everywhere??? i mean in the explanation you sent it was written the array file has a public final lenght field but it wasn't there...hope iam clear with what excatally i want to ask.. guidance regarding this will really help me become better and answer questions in the class i go to.. thank you!!!
here is the code i found in java file
public static Object newInstance(Class<?> componentType, int length)
throws NegativeArraySizeException {
return newArray(componentType, length);
Message was edited by:
power-extreme
Similar Messages
-
Hi everybody,
I'm looking for tips, pointers,directions... to be able to perform this operation in TS 4.0 sequence Editor, if it's even possible...
I'm managing a test system with a "home-made" virtual instruments abstraction Layer complementary to IVI classes for instruments which do not have classes defined, customizing the sequence editor accordingly for developpers of my department.
So basically when the instrument is IVI, the developper uses the built-in IVI step-type type and when it is not, he uses the the custom step types that I developped for this particular class of instruments.
However there are classes where I do have both IVI and specific drivers available and I do need to use both in the test sequence.
For example let's say there are two sources of DC power available in the testbench, one being a programmable IVI compliant DC power supply, and the other one composed of fixed "blocks" of DC power supply managed by externals relays and you need to use them both in the test sequence.
What I would like to be able to do in the sequence editor is inserting the appropriate step type at edit time just by selecting the source of power supply (by a ring or enum for eg), and if the first ressource is selected, it inserts IVI step type, and if the second ressource is chosen, it inserts the appropriate custom step type.
Any Ideas on how to accomplish this ?
Regards,
Cyril
Cyril Bouton
Active LabVIEW Developper
Solved!
Go to Solution.Hello Cyril,
Here is an idea that could be done:
You could create a dynamic step by having a step that holds all the properties for both configurations (the superset of the necessary variables) and an extra one that indicates which 'mode' the step is in. Then you create the main Edit substep in whichever language you desire. That substep window will then have a box/dropdown/etc. at the top you can use to choose between modes A & B. When the user changes the value, you would dynamically change the rest of the window to contain the appropriate properties for mode A or B. You then copy the property values in that window to the Step properties, and copy the mode to your variable and you can run the step in that mode. When the step then runs, it checks the mode variable, and depending on its value, it will run the step in mode A or B.
Now we could add a dialog that allows us to choose when we put a step down but we should still allow the user to change later via the Edit substep we create.
I don't think we can create something that inserts a completely different step, but we can have one step that has the ability to do both and we can pick which one we execute. Also note we still don't have the ability to edit the Panels for a step, so we have to use a new window that we call from our Edit substep to complete the step.
Hope this helps.
Regards,
Olivier L. | Certified LabVIEW Developer -
Probleme changing the value of a variable in movieclip from my scene
Hello,
i have a probleme changing the value of a variable in movieclip from my scene. i explain: I have combobox on my scene containing categories, and in the scene i load an xml file containing links to php files that work with the combobox.
Also on the scene i have a movieclip "filmstrip", inside this movieclip on the first frame i have a script loading the php file selected in the scene . i use a load() function with a variable "theUrl" inside like this : T.load(theUrl);.
In my scene i want to change the value of "theUrl" inside the movieClip filmstrip. I tried filmstrip.theUrl = url; But it doesnt work
the xml file
<?xml version="1.0" encoding="ISO-8859-1"?>
<slideshow>
<area title1="10 Last updated" link1="link1.php"/>
<area title1="special" link1="link2.php"/>
</slideshow>
here is the code on my scene:
var link1:Array = new Array();
var LINK:String;
var url:String;
var whoOn:Number;
whoOn=0;
var x:XML = new XML();
x.ignoreWhite = true;
x.onLoad = function(success) {
var photos:Array = this.firstChild.childNodes;
for (i=0; i<photos.length; i++) {
_root.link1.push(photos[i].attributes.link1);
url=link1[whoOn];
filmstrip.theUrl=url;//<<--HERE
x.load("category.xml");
var cbListener:Object = new Object();
cbListener.change = function(event_obj:Object) {
trace(select.selectedItem.label);
if (select.selectedItem.label == "Last updated") {
whoOn=0;
} else if (select.selectedItem.label == "Special") {
whoOn=1;
url=link1[whoOn];
filmstrip.theUrl=url; //<<-----HERE
select.addEventListener("change",cbListener);
here is the code inside the movie clip "filmstrip"
var T:XML = new XML();
T.ignoreWhite = true;
T.onLoad = function(xml) {
etc etc etc }
T.load(theUrl); //<<---HERE it still undefinedYESSSS . Thanks you very much Kglad it wotk i put all in a function inside the filmstrip function Tload(theUrl){etc ect}and in the root i call it like this filmstrip.Tload(theUrl); and it works
code in the root var link1:Array = new Array();
var LINK:String;
var url:String;
var whoOn:Number;
whoOn=0;
var x:XML = new XML();
x.ignoreWhite = true;
x.onLoad = function(success) {
var photos:Array = this.firstChild.childNodes;
for (i=0; i<photos.length; i++) {
_root.link1.push(photos[i].attributes.link1);
url=link1[whoOn];
theUrl=url;
filmstrip.Tload(theUrl);//<<--HERE
x.load("category.xml");
var cbListener:Object = new Object();
cbListener.change = function(event_obj:Object) {
trace(select.selectedItem.label);
if (select.selectedItem.label == "Last updated") {
whoOn=0;
} else if (select.selectedItem.label == "Special") {
whoOn=1;
url=link1[whoOn];
theUrl=url;
filmstrip.Tload(theUrl);//<<-----HERE
select.addEventListener("change",cbListener); -
How to get the size/maximum length of an varchar?
Hello,
Is there a (Oracle-)function determining the size/max.length on an varchar2-column/-variable in PL/SQL? E.g. like SIZEOF(myVar), SIZE(myVar) in other languages...
Regards,
MartinNuerni wrote:
Karthick,
Your solution is interesting. I'm thinking of writing my own function (but it handles table's columns only - no PL/SQL-declared variables of varchar-type)...
It seems there's no Oracle-character-function available returning such numeric values....
...could be an enhancement for further releases :-) ?!In my experience everytime you need to think about defined length you have a logical problem in you database design.
Of Cause you define how large a column value could be ant set those values accordingly.
But since you define that, your also implement it in the code.
Everytime the code needs to look at columns sizes or length restrictions, something is wrong.
Maybe tell us the whole picture and it would be possible to find other ways of improvement.
Also remember that you can declare variables with a column type in pl/sql.
v_salary emp.sal%type;
Edited by: Sven W. on Sep 24, 2008 12:42 PM -
How to put the column name and variable value in the alert message.
Dear,
how can i put the column name and variable value in the alert message text. i want to display an alert which tell the user about the empty textboxes. that these textboxes must be filled.
Regards:
Muhammad Nadeem
CHIMERA PVT. LTD.
LAHORE
[email protected]Hello,
The name of the item that fires the current trigger is stored in the :SYSTEM.TRIGGER_ITEM system variable.
The value contained in this item can be retrived with the Name_In() built-in
value := Name_In( 'SYSTEM.TRIGGER_ITEM') ;
LC$Msg := 'The item ' || :SYSTEM.TRIGGER_ITEM || ' must be entered' ;
Set_Alert_Property('my_alert_box', ALERT_MESSAGE_TEXT, LC$Msg ) ;
Ok := Show_Alert( 'my_alert_box' ) ;
...Francois -
When we use the neew operator to make an array which method is called by the new operator and the length variable in arrays resides in which class
What?
-
SAP PP: In BOM how to where to maintain the details like Length, Width and Quantity
Dear All,
In SAP PP where to maintain the details like Length, Width, Quantity of the material for production information.
Eg:
Client will procure a material of 10milli meter Thickness Mild Steel material of fixed dimensions lets say 4meters x 4Meters
{so the material dimensions are 4000Milli Meter (Length) x 4000Milli Meter (Height) x 10milli meter (Breadth) Mild steel Sheet}
For production the above plate is to cut into desired sizes as per the drawings given by Design Department of "N" no qtys.
(let say in drg for the component the desired sizes are 1000Milli Meter (Length) x 1000Milli Meter (Height) x 10milli meter (Breadth) of 4Nos}
In BOM where all we can maintain the above details. The same details wants to send it to production for their quick reference.
Also how the system will calculate the weight automatically for procuring of raw material with the above details.
Note: Purchase department will procure the full length as i mentioned above but not the desired lengths to be produce for production.
Pls let me know if any further information required for the solution to suggest.
rgds,
VKUMAR AHi,
You can use two options...
1. Classification...create characteristics like length, height and breadth with CT04, assign these chars to class (CL01) and assign this class to your raw material in classification view in material master (MM02). When you receive the material from vendor during GR enter the values for characteristics. (activate Batch management).
Now when you create the Production Order, in the components for this raw material, assign the batch..
When this is issued against the Production order , production people can see the details of values in the batch...
2. Try to explore the option of variable size item concept during creation of BOM..
Thanks
Kumar -
How to increase the charecteristic description length Copa report
Hi All
I built a copa report with material and customer as characteristics for a drill down report. Unfortunately, the total description of the material is not showing up in the report. Is there any way that we can increase the description field length, so that the users can see the whole description of the material.
Thanks in advanceHi,
You can make a Z copy of the report you are asking for.
In this Z copy, you can ask your ABAPer to increase the length of the Material Decsription Field,i.e., to change only one field and keep the rest as it is.
Hope this is helpful. -
Display the NAME of a variable
What's the solution to display the name of a variable :
For example, if I have :
int iVar = 2;
I just want to display "iVar" and not the contents.
Thanks.if you need to get the fields names for any class you can use reflection, some like this.
import java.lang.reflect.*;
public class field1 {
private double d;
public static final int i = 37;
String s = "testing";
public static void main(String args[])
try {
Class cls = Class.forName("MyClass");
Field fieldlist[]
= cls.getDeclaredFields();
for (int i
= 0; i < fieldlist.length; i++) {
Field fld = fieldlist;
System.out.println("name
= " + fld.getName());
System.out.println("decl class = " +
fld.getDeclaringClass());
System.out.println("type
= " + fld.getType());
int mod = fld.getModifiers();
System.out.println("modifiers = " +
Modifier.toString(mod));
System.out.println("-----");
catch (Throwable e) {
System.err.println(e);
the result is:
=================
name = d
decl class = class field1
type = double
modifiers = private
name = i
decl class = class field1
type = int
modifiers = public static final
name = s
decl class = class field1
type = class java.lang.String
modifiers =
good luck -
Snippet: "query" the chart history length programmatically
Would have posted to this thread, but was concerned that the misspelled subject might keep it from being found by future searches.
I have a brute force, inelegant, very mildliy tested workaround for programmatically determining the history length of a waveform chart. In my app, I have a single chart on my gui that is meant to display history from any one of several duplicate test stations. To help accomplish this, I wanted each station to have its own lossy queue whose size is equal to the chart history length. Then, whenever the user chooses to look at a different station's data, I can simply copy the entire contents of the lossy queue over to the chart.
Here's how I "query" the chart history length programmatically:
Note: Some of this feels a little dubious, but it has seemed to give correct results so far. Specifically, several of the XScale properties seem to refer to the graphical rendering of the scale rather than an index # to the history data. Can't guarantee this'll work for all combos of other properties -- I tested with a fairly generic, nearly straight from the box waveform chart.
-Kevin PIntaris wrote:
Hmm, any reason why you can't just do this?
If you don't modify the Array, it's just copying a pointer, right? Or does this operation automatically make a copy of the data and induce horrendous performance problems?
That doesn't actually do what I need. The "History" data array size works its way up from 0 to History Length as the app runs and data is written. It *is* bounded, but until I fill the chart all the way up, this method won't reveal what that bound is. I need to size up those lossy queues at the beginning of the program, before any data has been written to the chart.
As to the other comments so far:
- I chose charts over graphs to get some of the built-in features of charts for real time monitoring rather than having to manage them myself. Things like zooming the X range, horizontal scrolling to show different segments of the history, that kind of thing.
- just absorbed the followup comment about writing a dummy oversized array to the chart before running the quoted snippet above. Yeah, that oughta work. I just don't like the general case of not knowing how big a pre-write I need to do. I guess it wouldn't be too bad to loop while writing the same big-but-not-crazy-big array until the History size is smaller than the # of samples written.
The main hitch I see in that approach is that I'd like this to be a reusable utility vi, but a subvi that works by filling up the History would need prior knowledge of the chart datatype. (Just thinking out loud here, overall it does kinda feel cleaner than the stuff I was doing with the scale properties.)
FWIW, a little more testing led me to modify and simplify my snippet b/c the previous one might leave the X scale looking different on exit than it appeared originally. Seems like a side effect of the way those properties are kinda more about the display of scale information than about actual index #'s. Anyhow, here's v2, but hopefully someone else has a better generic v3 they can offer:
-Kevin P -
What's the difference between global variables and instance variables?
hi im just a biginner,
but what is the difference between these two?
both i declare them above the constructor right.
and both can access by any method in the class but my teacher said
global variables are not permitted in java....
but i don't know what that means....and i got started to confuse these two types,,
im confusing.......
and why my teacher said declaring global variables is not permitted,,,,,,
why.....instance variables are kindof like Global variables. I'm not surprised you are confused.
The difference is not in how they are declared, but rather in how they are used.
There are two different "styles" of programming
- procedural programming.
- object oriented programming.
Global variables are a term from Procedural programming.
In this style of programming, you have only one class, and one "main" procedure. You only create one instance of the class, and then "run" it.
There is one thread of control, which goes through various methods/procedures to accomplish your task.
In this style of programming instance variables ARE "global" variables. They are accessible to all methods. There is only one instance of the class, and thus only one instance of the variables.
Global variables are "bad" BECAUSE you can change them in any method you like. Even from places that shouldn't have to. Also if you use the same name as a global variable and a local variable, you can cause great trouble. This can lead to very subtle bugs, as the procedures interact in ways you don't expect.
The preferred method in procedural programming is to pass the values as parameters to the methods, and only refer to the parameters, and local variables. This means that you can track exactly what your method is doing, and what it affects. It makes it simpler to understand. If you use global variables in your methods, it becomes harder to understand.
So when are instance variables not global variables?
When you are actually using the class as an Object, rather than just a program to run. If you are creating multiple instances of an object, all with different values for their instance variables, then they are not global variables. For instance you declare a Person object with an attribute "firstname". Your "main" program then creates many instances of the Person object, each with their own "firstname"
I guess at the end of all this, it comes down to definitions.
Certainly you can write procedural code in java. You can treat your instance variables, for all intents and purposes like global variables.
I can only think to show a sort of example
public class Test1
User[] users;
public void printUsers(){
// loop through and print all the users
// uses a global variable
for(int i=0; i<users.length; i++){
users.printUser();
public void printUsers(User[] users){
// preferred method - pass it the info it needs to do the job
for(int i=0; i<users.length; i++){
users[i].printUser();
public Test1(){
User u1 = new User("Tom", 20);
User u2 = new User("Dick", 42);
User u3 = new User("Harry", 69);
users = new User[3];
users[0] = u1;
users[1] = u2;
users[2] = u3;
printUsers();
printUsers(users);
public static void main(String[] args)
new Test1();
class User{
String firstName;
int age;
public User(String name, int age){
this.firstName = name;
this.age = age;
public void printUser(){
// here they are used as instance variables and not global variables
System.out.println(firstName + " Age: " + age);
Shit thats a lot of typing, and I'm not even sure I've explained it any good.
Hope you can make some sense out of this drivel.
Cheers,
evnafets -
Can we use the value of a variable in an alert message
I have a variable in forms6i. I want to use the value of this variable in an alert message. How is this possible?
Gul wrote:
I have a variable in forms6i. I want to use the value of this variable in an alert message. How is this possible?Try
DECLARE err_txt VARCHAR2(200) t;
al_id ALERT;
al_button Number;
BEGIN
al_id := FIND_ALERT('My_Error_Alert');
SET_ALERT_PROPERTY(al_id, alert_message_text, 'Hello how are you mr. variable '||:variable_name );
al_button := SHOW_ALERT( al_id );
END; Hope it works..
Hamid -
How to find the value of a variable in other program
How to find the value of a variable in other program say I am in a FM and this FM is being called in from other program and I want to know some of the variable details of the program from the FM itself. Imagine if this is a txn. and I need to know the details from some of the programs while executing the same transaction
Regards
VinHi Vinayak,
you will be having your first program values in internal table or some variables,
when you are calling the second program you wii use like this,
SUBMIT <Second Program Name> USING SELECTION-SCREEN '1000'
WITH s_emp(second program select-options) IN t_emp(first program variables)
WITH p_chk EQ t_chk
WITH p_r1 EQ t_r1
WITH p_month EQ t_month
WITH s_cust1 IN t_cust1
WITH p_r2 EQ t_r2
WITH s_cust2 IN t_cust2
WITH s_week IN t_week
AND RETURN.
you have pas like this to get your first program details. -
How I can transfer data from the database into a variable (or array)?
I made my application according to the example (http://corlan.org/2009/06/12/working-in-flash-builder-4-with-flex-and-php/). Everything works fine. I changed one function to query the database - add the two parameters and get the value of the table in String format. A test operation shows that all is ok. If I want to display this value in the text area, I simply drag and drop service to this element in the design mode
(<s:TextArea x="153" y="435" id="nameText" text="{getDataMeanResult.lastResult[0].name}" width="296" height="89" />).
It also works fine, just a warning and encouraged to use ArrayCollection.getItemAt().
Now I want to send the value to a variable or array, but in both cases I get an error: TypeError: Error #1010: A term is undefined and has no properties..
How can I pass a value from the database into a variable? Thank you.
public var nameTemp:String;
getDataMeanResult.token = authors.getDataMean(arrayOfNumber[0], dir_id);
nameTemp = getDataMeanResult.lastResult[0].name;
public var nameArray:Array = new Array();
for (var i:uint=o; i<3; i++){
getDataMeanResult.token = authors.getDataMean(arrayOfNumber[i], dir_id);
nameArray[i] = getDataMeanResult.lastResult[0].name;
And how i can use syntax highlighting in this forum?Astraport2012 wrote:
I have to go back to the discussion. The above example works fine when i want to get a single value of the database. But i need to pass an array and get an array, because i want to get at once all the values for all pictures tooltips. I rewrote the proposed Matt PHP-script and it works. However, i can not display the resulting array.
yep, it won't work for Arrays, you'll have to do something slightly more intelligent for them.
easiest way would be to get your PHP to generate XML, then read that into something like an ArrayList on your HTTPService result event (depends what you're doing with it).
for example, you could have the PHP generate XML such as:
<pictures>
<location>test1.png</location>
<location>test2.png</location>
<location>test3.png</location>
<location>test4.png</location>
<location>test5.png</location>
<location>test6.png</location>
</pictures>
then you'll read that in as the ResultEvent, and perform something like this on it
private var tempAC:ArrayList = new ArrayList
protected function getStuff_resultHandler(event:ResultEvent):void
for each(var item:Object in event.result.pictures)
var temp:String = (item.@location).toString();
tempAC.addItem(temp);
in my example on cookies
http://www.mattlefevre.com/viewExample.php?tut=flash4PHP&proj=Using%20Cookies
you'll see an example of how to format an XML structure containing multiple values:
if($_COOKIE["firstName"])
print "<stored>true</stored>";
print "<userInfo>
<firstName>".$_COOKIE["firstName"]."</firstName>
<lastName>".$_COOKIE["lastName"]."</lastName>
<userAge>".$_COOKIE["userAge"]."</userAge>
<gender>".$_COOKIE["gender"]."</gender>
</userInfo>";
else
print "<stored>false</stored>";
which i handle like so
if(event.result.stored == true)
entryPanel.title = "Welcome back " + event.result.userInfo.firstName + " " + event.result.userInfo.lastName;
firstName.text = event.result.userInfo.firstName;
lastName.text = event.result.userInfo.lastName;
userAge.value = event.result.userInfo.userAge;
userGender.selectedIndex = event.result.userInfo.gender;
depends on what type of Array you're after
from the sounds of it (with the mention of picture tooltips) you're trying to create a gallery with an image, and a tooltip.
so i'd probably adopt something like
<picture>
<location>example1.png</location>
<tooltip>tooltip for picture #1</tooltip>
</picture>
<picture>
<location>example2.png</location>
<tooltip>tooltip for picture #2</tooltip>
</picture>
<picture>
<location>example3.png</location>
<tooltip>tooltip for picture #3</tooltip>
</picture>
etc...
or
<picture location="example1.png" tooltip="tooltip for picture #1"/>
<picture location="example2.png" tooltip="tooltip for picture #2"/>
<picture location="example3.png" tooltip="tooltip for picture #3"/>
etc... -
Not able to get the value of ODI Variable when i pass thru Option
Hi,
I have ODI variable called prev_etl_run_date which will hold the last successful etl run date. I want to use the value of this variable in one of my KM step.
But i don’t want to use directly in my KM. So I passed the variable name thru KM Option.
I intend to use the variable’s value in the KM step, as shown below:
<%=odiRef.getOption("MY_OPTION_1")%>
Here I am expecting the value of the variable, but here I am only getting the variable name only.
Is there any substitution method available in ODI KM , please help me to solve this issue.
Thanks
nidhiODI options are not intended for run time parameters. They are like design choices or debugging flags or parameters that can be specified in code template. Previous ETL run time stamp is hardly a design choice.
On the other hand, it is really a bad practice to put a variable inside KM directly. That creates a dependency that you can easily avoid by putting a filter using that variable in the interface.
Maybe you are looking for
-
Flow management System in OBIEE
Hi, I want to create a Flow management System in OBIEE. Does anyone have idea how to accomplish this using OBI tool.
-
Possible to change default downloader speed displaying rate from KBps to Mbps?
I'm pretty tired of doing the calculations from KBps to Mbps (speeds advertised for internet connections). No one deals in KB for most stuff downloaded on the net. More in the order of MB. However, it would be easier to see how well its performing in
-
HT201210 the device cannot be found when trying to restart apple tv by laptop and usb
Trying to restart Apple TV by using usb and laptop with windows vista via Itunes. Get error message that "device cannot be found" after clicking the button "restart" as instructed. You can see the apple tv icon when it is connected but get the error
-
Dashboard Drill Down in Chart with Tab-Linking
Dear All, after searching a lot i couldn't find a thread discussing these requirements. i have 3 views in 3 tabs in one dashboard, i want to drill down from chart in Tab 1 to the Tab 2 which contain the result in a detailed level. is this kind of dri
-
Importing Quicktime .move file into iMovieHD
I have been successfully pulling the files off a DVD using DVDxDV, and using that to export to Quicktime in .mov NTSC format. Then I can import into iMovie HD. It's been fine, but I have one file now that will not import. When i try to import it, it