When is a def assigned to his constant value in a derived class ?
Hi ,
I encountered some strange thing in my app when using a def in a derived class from abstract base class. (dived by zero exception)
I point it out here using a small code snippet which reflects the problem in my app:
public abstract class Base{
public var varBase;
public class BaseDerived extends Base{
def const = 1;
var temp : Double;
public override var varBase on replace{
temp = varBase / const;
println("{const}");
function run(){
var test = BaseDerived {varBase:10};
println ("{test.temp}");
result is:
0
InfinityI assumed that all "defs" will already be assigned before any single use in the code when creating an object. If I put the "def" in the base class all works fine. But apparently this is not case when implementing an abstract class and use a def in that class.
What am I missing here ?
thanks
Guy
I changed the code to:
public mixin class Base {
public var varBase;
init { println("Base Init"); }
postinit { println("Base PostInit"); }
public class BaseDerived extends Base {
def constant = 1;
var temp: Double;
init { println("BaseDerived Init"); }
postinit { println("BaseDerived PostInit"); }
public function showVar(msg: String) {
println("# BaseDerived ({msg})");
println("VarBase: {varBase}");
println("Constant: {constant}");
println("Temp: {temp}");
public override var varBase on replace {
showVar("Before computation");
temp = varBase / constant;
showVar("After computation");
function run() {
var test = BaseDerived { varBase: 10 };
test.showVar("Created test");
}The output of abstract class:
# BaseDerived (Before computation)
VarBase: 10.0
Constant: 0 --> BAD
Temp: 0.0
# BaseDerived (After computation)
VarBase: 10.0
Constant: 0
Temp: Infinity
Base Init
BaseDerived Init
Base PostInit
BaseDerived PostInit
# BaseDerived (Created test)
VarBase: 10.0
Constant: 1
Temp: Infinity --> NOK and replace not newly triggeredWhile the mixin base class indeed solves it:
# BaseDerived (Before computation)
VarBase: 10.0
Constant: 1 --> constant here already been assigned
Temp: 0.0
# BaseDerived (After computation)
VarBase: 10.0
Constant: 1
Temp: 10.0
Base Init
BaseDerived Init
Base PostInit
BaseDerived PostInit
# BaseDerived (Created test)
VarBase: 10.0
Constant: 1
Temp: 10.0 --> OKThanks for the quick goodies !
I just need to read something on what "mixin" differs from abstract.
cheers
Guy
Similar Messages
-
I am trying to export data to an excel spreadsheet from Labview 6.1 using Activex Automation, then plot a chart in excel using this data. I can successfully move the data and can build the chart, but I can only assign one of the data axis (either the XValues, or the Values (ie Y values) property of the class, depending which I set first). I get a message "Exception occured in Microsoft Excel, Unable to set the Values property of the Series class." with an error code of -2146827284. See example code in case I have done anything stupid. Anyone got any ideas?
Attachments:
excel_activex_test.vi 82 KBRobert, thanks for responding. I was aware of the excel size limits but I don't think this is the issue here. The code I attached before tries to set first "XValues" to A2:A5 and then "Values" to c2:c5 (well within the range of excel I think ;-) ). I have attached this again and also added an image of the diagram with probes on the key places. It always succeeds on the first "set" function, and then fails on the next one. Just to confuse things it works fine if I set the "XValues" and "Values" to an array of integers. I am running Labview 6.1 on windows XP with Office XP installed as well.
Gavin
Attachments:
Write_Table_and_Chart_to_XL.llb 226 KB
excel_test_run.jpg 231 KB -
Assigning constant value to Account Derivation Rule for FA
Hi,
I have the following requirement for SLA in FA
Requirement :
Cost of Removal Gain should pick the segment1(balancing segment) value from Asset Assignment screen and rest all segments from Book level when the CC <> 'XXXX' (particular CC) and A/C <> 'XXXXXX' (particular a/c).
I have created a custom ADR, in which i had mapped the Expense Account Code Combination identifier for balancing segment. But i am unable to put the condition(where the CC <> 'XXXX' (particular CC) and A/C <> 'XXXXXX' (particular a/c)) in the condition screen.
How can i map the above condition in ADR?
Thanks in advance
Regards
RajkamalHi
In COPA Derivation rules you can only map characteristic.. i mean you can derive only Characteristic values not for Value fields.
Value fields are normally mapped with SD conditions or GL accounts.
If you want to manipulate or recalculate the values flowing into value fields you need to use enhancements.
In this step you can set up system enhancements which are not supported in the standard R/3 System. These so-called "standard enhancements" can be used in the following areas of Profitability Analysis as below.
Derivation of characteristic values (COPA0001)
Valuation (COPA0002)
Direct postings to profitability segments (COPA0003)
Currency translation (COPA0004)
Actual data update (COPA0005)
Hope this helps
Regards
Venkat -
Constant values and encapsulation
Hi All,
lookat the code below:
class Test{
public static final int flag = 10;
Public static void main(String args[])
System.out.println(i);
}here the constant value i is used inside the same class.
Now generally, we use to make separate java file for all constant values and get the values:
For example:
class UIConstants{
public static final int flag = 10;
}and call this constants values where ever neccessary:
class Test{
Public static void main(String args[])
System.out.println(UIConstants.flag);
}In most of the the time, i have seen second case is used, but it avoids the encapsulation concepts, since making variable private to public.
What is the advantages of making in this way?or is there any other reason for using this way?Are they thread-safe? No! Not by default anyway.Anything immutable and final is thread safeAs long as the immutable object really is internally
immutable and has no operations that have
side-effects on objects outside of the object.
COuld you shed some light on this.
For example even a final immutable PrintStream (which
system.out and system.err are not... see
System.setOut()) is not necessarily threadsafe
because two threads could be writing to the same
stream at the same time.I didnot know PrintStreams were immutable -
How to Assign a Constant Value to a Dim. Member when pulling Master Data?
BPC Gurus:
I am trying load Vendor and Customer Master data into BPC dimension. My Dimesnion has memebrs: ID, EVDESCRIPTION, PARENTH1, TYPE. I have successfully pulled the ID and the description from 0CUSTOMER and 0VENDOR. However, I
need to have a ttext value for 'PARENTH1' and 'TYPE'. For Customers, I want to add a FIXED value "'CUSTOMER' for every
Customer ID pulled in and also for "TYPE", I want a value of "CUSTOMER". When I maintainthe Dimension, I want to see
th followingvalues:
ID EVDESCRIPTION PARENTH1 TYPE
0000000001 WALMART CUSTOMER CUSTOMER
0000000002 TARGET CUSTOMER CUSTOMER
and so ON
Since we have Vendor Numbers in the same Diemsnion, when I pull Vendors, I need to have similar values as:
ID EVDESCRIPTION PARENTH1 TYPE
0000005050 ABC Supply Inc. VENDOR VENDOR
0000005051 BASF VENDOR VEDOR
and so ON
How can assign a Fixed value to the member Propert? Can I achieve it in Conversion file....?
( My atempts failed...).
Any suggestion recommendation would be gretaly appreciated.
Munna.Hi,
For adding fixed values to the properties, you can use the transformation file. In the mapping section, you can specify a constant value. This value will be written to properties of all the members while importing master data. However, for parenth, its a bit different. First thing is that, you need to have a member called CUSTOMER, then only you can have CUSTOMER in the parenth column. Even if you add it and use the mapping section for this purpose, then it will write CUSTOMER to parenth for all the members (even to CUSTOMER member). And this will be wrong. So, you will need to write it manually.
Hope you got the idea. -
Assigning a Constant Value for Target Revenue
Hello all,
I have a scenario where I need to assign a Constant value, say 10000, for my Target revenue Key Figure at the Info Cube level. This value should always be 10000. Please advice.
Your valuable suggestions will be greatly appreciated. I will be assigning points as a way of expressing thanks.
Best Regards,
Deepthi.HI Deepti,
Today I faced same issue and I read your thread.
I saw the responses given by others and I feel its a shallow solution hardcoding the key figure to a constant value..because key figure is meant to change.
I solved it by altering the Aggregation level in an key figure infoobject.
The Aggregation must read MIN..Exception aggregation may be SUM..
and the characteristic on which aggregation must the infoobject that determines the unique value of the Infoobject..eg GJAHR/MONAT from R/3.
This will give the result as (where Target is the non-aggregated Key figure)
Plant Year Target Document No Production value
110 2004 1000000 1 10
110 2005 2000000 20 20
110 2004 1000000 2 15.
200 2005 40000 100 50
110 2005 2000000 21 23
The target value here depends only on Plant and Year..and stays constant for the unique combination of the 2.
U dont need to change the BEx status of any key figure..
I know the forum post I am putting is of no use..but someday someone who needs an answer urgently please do read this. -
Revision: 12878
Revision: 12878
Author: [email protected]
Date: 2009-12-11 19:07:40 -0800 (Fri, 11 Dec 2009)
Log Message:
When sub-components don't have a tabIndex and when VideoPlayer instance does, assigned tabIndex to each inner-component to ensure that they appear in the correct tab order with other components on the stage.
QE notes: none
Doc notes: none
Bugs: n/a
Reviewer: Gordon
Tests run: checkintests
Is noteworthy for integration: no
Modified Paths:
flex/sdk/trunk/frameworks/projects/spark/src/spark/accessibility/VideoPlayerAccImpl.asMichael,
"Michael Caughey" <[email protected]> wrote in message news:413f0af6$1@mail...
If I'm doing something wrong what is it? Obviously there is something
different about how I configured my environment a year ago.What happens if you bring down ms02?
Regards,
Slava Imeshev -
Unloading point is not copied from PR -PO,when i change account assignment
Hi All,
unloading point is not copied from PR -PO,when i change account assignment from 'K' to 'F' in PO. unloading point field should be in display for both 'K' & 'F' Account assignment category in SPRO because we r using this field to acknowledge my thirty party planning system.
Thanks in advance
Vengal RaoHave a look at SAP note <a href="https://service.sap.com/sap/support/notes/734273">734273</a>
-
My husband went to update his phone this morning and when he did he lost all his contacts how can he get them back
Thanks, but I checked iCloud and it has none of them.
If it backed up to my laptop, that died and I just got the new computer. The one that's crashed won't even boot, so there's no way to even tell if it was syncing the contacts along with all the phone photos. Literally happened at the same time - it was because I had the new computer that I was finally able to pull the photos off the phone and make room for the upgrade. It had refused to upgrade for lack of space for some time.
I had thought it was set to sync to iCloud but it vanished from BOTH my phone and the cloud. That's why I'm so angry about it. -
SEM CPM - Dump when i tried to assign a variable
Hi Gurus,
Im working with SEM-CPM and i facing the following issue:
When i tried to assign a CPM variable in design mode it show up the following DUMP (during the preview of the Frame) :
"MESSAGE_TYPE_X" C- "ADD_DATA_TO_BUFFER"
Does anybody knows how can i fix this ?
RegardsHola Marco,
Estoy desarrollando en Management Cockpit unos frames y me está pasando el mismo error que en tu caso.
Podrías ayudarme en como solucionarlo?
Saludos -
Assigning constant value in transformation rules
Hi,
I want assign the constant value USD for the infoobject 0currency in transformation rules but I cant see any option avaible
How can the constant value be assigned ?
Thanks,
SanyHi Sany,
1. Go to Your Transformation
A (Source) -> B(Target)
X ( Field) - > 0CURRENCY (Info object)
2. Right click on the Info object and select Rule Details
3. New pop-up window will be displayed there you will find option Direct assignment by default.Select constant and assign the Constant value as USD.
4. Make sure there should not be any object at the bottom.
Regards
Ram
Assign points if useful -
Why shared variable generates events when I write constant value?
Hello all,
I'm using LV 8.5 with DSC packet.
I modified "DSC Events Demo".vi and made a test. I noticed that only variable which work okay is double typed. Why this code generate events all the time when I write constant values to shared variables? Double is okay, but string and boolean types not work okay. Is there any other people how have noticed same symption?
Attachments:
modified_dsc_event_demo1.zip 391 KBYou may get an initial event on startup which is normal. Also make sure that you have not enabled timestamp change events.
-
When I tried to assign a photo for a contact app shut down !
Dear Team,
When I tried to assign a photo to a contact by choosing the contact name and then edit and then add photo both choices ( take photo - choose existing photo ) shuts the Phone app down and show the home screen !!
Please advice ..
Im using iphone 3g 16gb
and when I tried opening an image and choose to assign it to a contact it works.
sorry for my englishHave you tried a reset (page 34 of the manual)?
Restore (page 141)?
http://manuals.info.apple.com/enUS/iPhone_UserGuide.pdf -
how can i do with labview program,when i have 20 different values,and 1 want to add it with constant value.and how to get the results?
Why do the 20 values have to be different? The same code should work even if some are equal.
What do you mean by "get the result"? The result is available at the output terminal and all you need is a wire to get it where you need it. That could be an indicator, another operation, or even a hardware device.
What is the data type of the 20 values? An array? A cluster? A bunch of scalars? A waveform? Dynamic data?
LabVIEW Champion . Do more with less code and in less time . -
Restore me when I'm trying to fill his next character
. The disk you are attempting to use is full
If I have 20 GB of memory.
thank you.Hi and welcome to Apple Discussions.
Irrespective of your iTunes downloads you are going to run into serious problems with only 1GB of free space. The general recommendation on these forums is that one should have 10% free space as a minimum or 15% as an ideal.
Having as little as 1GB could result in system corruption or, at worst, HD damage. I recommend that you free up some space as a matter of urgency.
If you would like any guidance on what is safe to remove post back but a good starter, often neglected, is to empty your Trash.
Good luck,
Adrian
Maybe you are looking for
-
Can i import "all images" into iphoto to create a new library?
somehow about 4000 photos out of 10000 disappeared when I moved to the newest iphoto and attached my external hard drive with the old iphoto library to it and switched between libraries using alt to open it. i was unable to get iphoto to see the mis
-
Creating a Zone with ufs?
Hi all, When you create a zone though Ops Center does it try and format the file system as ZFS? Can you make a Zone with a UFS? Thanks, Shawn
-
Does iBook recognize external TV resolution using VGA cable?
I'm planning to connect my iBookG4 (firmware already hacked allowing the usage of extended screens) to a big widescreen LCD TV. The TV supplys both HDMI and VGA connectors, but I know I won't be able to use HDMI, since the iBook has VGA output only.
-
I accidentally deleted a text conversation, is there a way to retreive this ?
I accidentally deleted a text conversation. Is there a way to retrieve this?
-
MSAccess - ERROR 429: ActiveX can't create object
I am trying to migrate an access database to Oracle9i. I am using AccessXP(2002). I have versions of my database in Access97/2000/2002 formats. When I try to execute the OMWB2000.MDE Export command against the access2000 database I specified, I get t