Proper Use of States
I have a question about how to properly use states.
I am developing an application that requires login.
I have two primary states, Authenticated and Unauthenticated. Once the user authenticates successfully, they are taken from the Unauthenticated state to the Authenticated state.
Under the Authenticated state, I have a menu bar. When a menu item on the menubar is clicked, the application switches to a sub-state of the authenticated state that contains a TitleWindow with the content that I want to display. When the user clicks the close button of the TitleWindow, the application switches back to the Authenticated state.
For those of you that know, is this proper use of States in Flex?
As you can see in this sample code, the big factor is the size of the first view in the ViewStack. All the other views "might" be limited based on the size of the first view.
The first view does not have to necessarily display first, that can happen programmatically, so at startup you could set the ViewStack selectedIndex to something other than 0.
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
verticalGap="20" horizontalAlign="center">
<mx:LinkBar dataProvider="{vs1}"/>
<mx:ViewStack id="vs1">
<mx:VBox label="One" width="300" height="200" backgroundColor="0xFFFFFF"/>
<mx:VBox label="Two" width="600" height="400" backgroundColor="0x00FF00"/>
<mx:VBox label="Three" width="150" height="100" backgroundColor="0x0000FF"/>
</mx:ViewStack>
<mx:Spacer height="50"/>
<mx:LinkBar dataProvider="{vs2}"/>
<mx:ViewStack id="vs2">
<mx:VBox label="One" width="600" height="400" backgroundColor="0xFFFFFF"/>
<mx:VBox label="Two" width="300" height="200" backgroundColor="0x00FF00"/>
<mx:VBox label="Three" width="150" height="100" backgroundColor="0x0000FF"/>
</mx:ViewStack>
</mx:Application>
If this post answers your question or helps, please mark it as such.
Greg Lafrance - Flex 2 and 3 ACE certified
www.ChikaraDev.com
Flex / AIR Development, Training, and Support Services
Similar Messages
-
Proper using of index for parallel statement execution
Hi all,
I've created index for my table
CREATE INDEX ZOO.rep184_med_arcdate ON ZOO.rep184_mediate(arcdate);It was before I started to think about parallel statement execution. As far as I've heard I should alter my index for proper using with parallel hint. Could you please suggest the way to go?marco wrote:
Hi all,
I've created index for my table
CREATE INDEX ZOO.rep184_med_arcdate ON ZOO.rep184_mediate(arcdate);It was before I started to think about parallel statement execution. As far as I've heard I should alter my index for proper using with parallel hint. Could you please suggest the way to go?when all else fails Read The Fine Manual
http://download.oracle.com/docs/cd/E11882_01/server.112/e17118/sql_elements006.htm#autoId63 -
Proper use of END-OF-SELECTION event in report programme
Hi,
If we will write "WRITE" statements in side START-OF-SELECTION then it will help me to display the output.Then what is the need of END-OF-SELECTION .
Can any body please tell me the <b>proper use of END-OF-SELECTION event in report programme.</b>This is the last of the events called by the runtime environment to occur. It is triggered after all of the data has been read from the logical database, and before the list processor is started.
<b>In report programs using LDB for every value selected the program issues the output, to control this you would use END-OF-SELECTION.</b> Now if you call your output in this event, the output is made only after all the values are selected as per the selection criteria.
suppose while coding, u need a logic like below:
if a condition is satisfied continue with the report
and if not satisfied, then display a message and end the report.
then u can code like below.
start-of-slection.
if a = <condition>.
do the following.......
else.
stop.
end-of-selection.
write: 'THIS IS END'.
stop command triggers end-of-slection from anywhere.
I hope it helps.
Best Regards,
Vibha
*Please mark all the helpful answers -
Proper use of location in metadata
I'm building my library of images now with LR and want to get started on the right foot. I store on CD. In Metadata "Location" I have entered the CD volume name as a way of identifying where the images are stored. But now I am wondering if the Metadata "Source" under workflow would be a better place to record the CD name such as "2007_03_08b" Can someone point me down the correct path so I don't regret my actions after thousands of images later? Thanks
<blockquote><span style="font-size: 90%><i>In Metadata "Location" I have entered the CD volume</i></span></blockquote>The IPTC metadata location is intended to store the physical location the shot was taken (as in "Museum", "City Hall", "Home"). It is also recommended to fill out the other location fields (Country, State, City) to make proper use of the Location Metadata Browser.<br /><br />Alexander.<br><span style="font-size: 75%; color: #408080">-- <br>Canon EOS 400D (aka. XTi) • 20" iMac Intel • 12" PowerBook G4 • OS X 10.4 • LR 1 • PSE 4</span>
-
Proper use of stacked sequence structure
Hello
I have been reading this forum up and down, trying to figure out what the proper use of a stacked sequence struckture is.
The reason i ask was that almost evryone in this forum thinks it is miss used / and or hides code. And that there is berrer ways of doing it.
I ask this question, wondering what is the PROPER use of SSS?
attached is the code so you can see what i am doing. As you will see, the code in the SSS are all the same for each frame, only channel number and numeric indicator is different, making upscaling more efficiant.
Faster readings is not an issue since i will be slowing it down later on, so we get a visual value evry 5-10 seconds or so.
keep in mind i am a novice at LabView, and all input is much appreciated.
Attachments:
r read 1ch.vi 52 KBTorbH wrote:
I tried using array as you showed, but i fail to get it to work properly, well it works as it should but i want it to be able to stop with a button, when i did that only channels 202 - 206 stopped. 201 kept going.
The reason for me to have this opportunity is that later i will connect channels 207-212. and they also will need to be started/stopped seperatly.
Put the stop button inside of the loop. The button is read with the terminal. The terminal is read outside of the loop, so it will have the same value for every iteration of your loop. By moving the terminal inside of the loop, your terminal will be read every iteration and you can therefore abort the loop.
TorbH wrote:
Also, frome here on out, how would i go ahead and use the data? Can i in a "state machine" use several for loops to perform the same tasks as i had in my previous version?
A state machine is actually just a single loop. You can use a state macine with other loops, you just need to be careful of how you pass the data around.
State Machine
Producer/Consumer
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines -
Using prepared statements in java
Hi
I have question on proper usage of prepared statements.
PreparedStatement ps;
public methoda(){
ps=conn.prepareStatement(sqlQry);
ps.setInt(1,2);
ps.execute();
In the above case I am creating new references to prepared statement (ps)each time I invoke methoda. So am I still using the advantage of prepared statements that is prepare a statement once and execute it multiple times. Or in the above case, the DB knows that this has been executed before and does not prepare it second time and just executes it.
thanksThe database stores execution plans for previous statements that were executed. So even tho you create a new PreparedStatement each time, it will still be an improvement.
Even if you don't use prepared statements those plans are cached. Problem is that you must reuse the exact same sql to get the benefit.
So if you do
select password from users where user="dave";
a hundred times, the database most likely will only create the plan once.
Problem is of course, that
select password from users where user="yelapa";
is a completely different sql statement sofar as the database knows.
Thus, the value of Prepared statements.
select password from users where user=?
is what the database sees no matter what user is running it. -
Can we use Loop Statement for Ranges
Hi Friends,
I have a range say R_Range. I need to loop at each line item and get the values in another range R_New_Range, i have to count the number of items in R_new_range. How is it possible.
I know range is nothing but an internal table. So we can direcly use Move statements or so ...,
But my question is .....
My R_range has values as below
'I' 'EQ' '001'
'I' 'EQ' '002'
'I' 'BT' '003' '007'
'I' 'EQ' '008'
I have to move all these values to R_New_range and my count of items should be '8'.
How can i do that????????
Expecting ur answers....
Thanks in advance
Cheers,
R.Kripa.hey friends,
Its nice to see the replies.... but i think i had confused u all with the question
Now i'll explain u all in detail ....
See i have 15000 projects ( eg., AAA111... ) and 100 GL accounts ( eg., 123443... ) .....
I have to get the costs from COSS and COSP tables for all the projects - GL account combinations which leads to some 1500000 entries ..... So it is giving me a SQL Dump "DBIF_RSQL_INVALID_RSQL" .........
Description of the Dump is
Error in the module RSQL accessing the database interface
An exception occurred. This exception is dealt with in more detail below
. The exception, which is assigned to the class 'CX_SY_OPEN_SQL_DB', was
neither
caught nor passed along using a RAISING clause, in the procedure
"GET_COSP_COSS" "(FORM)"
Since the caller of the procedure could not have expected this exception
to occur, the running program was terminated.
The reason for the exception is:
The SQL statement generated from the SAP Open SQL Statement violates a
restriction imposed by the database system used in R/3.
Possible errors:
o The maximum size of an SQL statement has been exceeded.
o The statement contains too many input variables.
o The space needed for the input data exceeds the available memory.
o ...
You can usually find details in the system log (SM21) and in the
developer trace of the work process (ST11).
If an error occurs the developer trace often informs you about the
current restrictions.
So now i want to fine tune the program so that the execution works perfectly and get me the values for all the data 1500000 :-|
Now :
My Projects are stored in the form of a range R_Range
I have to loop at this range and then process 100 records at a time and then again take other 100 records .... i'll count till 100 records by getting loopaing at the range and for each loop pass i'll increment the counter ....
I am clear till this .....
If record consist of 'EQ' option .... then ofcourse we can consider the total record to be 1 record and we can add 1 to counter ......
But if the record consist of 'BT' option ...... then how can we loop that and get the number of -low numbers in that range and add to my counter ????
Hope iam clear with my question
If not do revert back ....
Thanks in advance for the replies
Cheers,
R.Kripa.
My Doubt is .... -
If we use DML statement in function then that function can be used inside s
if we use DML statement in function then that function can be used inside select query or any DML query?
select f from t2;I think you meant to query t1.
It works if the function is an autonomous transaction:
create or replace function f return number
is
PRAGMA AUTONOMOUS_TRANSACTION;
begin
update t1 set c=2;
commit;
return 1;
end;
select f from t1But as Billy said why would you want to do DML this way. And this is not the way autonomous procedures should be used either.
An an answer to an interview question though nothing wrong with it. -
How do we use if statement in labview?moreover can i use if statement inside for loop?
how do we use if statement in labview?moreover can i use if statement inside for loop?
The if statement in LabVIEW is the Case structure. You can find that on the Structures palette right next to the For Loop. If you're still on the same subject about terminating a for loop early, then what you do is enclose your functions inside the loop with a case statment and make one of the case's empty except for one or more constants that you might have to wire. Hopefully, the attached picture will explain what I mean. Also, as I mentioned in one of your other posts, I think this technique is not as good as using a while loop. The array in the attached example is the same size no matter what and you may have to handle stripping extra or invalid elements.
Attachments:
For_Loop_with_Case.jpg 21 KB -
Can I use if statement in SQL???
Hello everyone.
I know that this is a silly question. The answer is no. Instead I should use decode function.
But what if I dont know all possible outcomes, can I still use decode function?
Also, I have created a view, in the where clause i want to use if statement. Is it possible to do?
Thanks in advance,
Sonyahere is the view that I created:
create or replace view import_shipment2
( order_no, cust_no,ORDER_SUFFIX,ship_addr1,ship_addr2, city,state,ZIP,country, terms_cd,shipvia_cd,
freight_cd, shipto_cdoehead,shipto_cdshipto,ship_name,ship_attn,order_status, org_unit_id, order_date,
estship_dt,confirm_status,gross_inv_value,phone,total_line_no,total_qty_order,total_qty_shipped,
total_qty_backordered,service,hold_cd,invno)
as select
to_char(c.order_no)||'_'||c.ORDER_SUFFIX, c.cust_no,c.ORDER_SUFFIX,d.ship_addr1,
d.ship_addr2, b.city, b.state, b.zip_code,b.country, d.terms_cd,d.shipvia_cd,d.freight_cd, d.shipto_cd,b.shipto_cd,
nvl(d.ship_name,b.shipto_attn), nvl2(d.ship_attn,b.shipto_attn,e.contact),d.order_status, d.org_unit_id,
d.order_date, d.estship_dt, c.confirm_status, f.gross_inv_value ,nvl(d.shipto_recip_phone ,g.phone_no),
sum(c.line_no),sum(c.qty_order),sum(c.qty_shipped),sum(c.qty_bo),d.shipvia_cd ,d.hold_cd,d.invno
from shipto_test b, oehead_test d,oedetl_test c, oesummary_test f ,CONTACT_MASTER_TEST e ,CONTACT_PHONE_TEST g
where c.order_no=d.order_no
and b.cust_no=d.cust_no
and b.shipto_cd=d.shipto_cd
and d.cust_no=f.cust_no
and d.order_no=f.order_no
and d.org_unit_id in ('110','120')
and e.cust_no=d.cust_no
and e.shipto_cd= d.shipto_cd
and d.order_status in ('J','S')
and g.contact_id=e.contact_id
and g.phone_type='Business'
Group by
to_char(c.order_no)||'_'||c.ORDER_SUFFIX, c.cust_no,c.ORDER_SUFFIX,d.ship_addr1,
d.ship_addr2, b.city, b.state, b.zip_code,b.country, d.terms_cd,d.shipvia_cd,d.freight_cd, d.shipto_cd,b.shipto_cd,
nvl(d.ship_name,b.shipto_attn), nvl2(d.ship_attn,b.shipto_attn,e.contact),d.order_status, d.org_unit_id,
d.order_date, d.estship_dt, c.confirm_status, f.gross_inv_value ,nvl(d.shipto_recip_phone ,g.phone_no),
d.shipvia_cd ,d.hold_cd,d.invno;
I need to do the validation of the g.phone_type. Does phone number exist at all in table?
How do I all PL/SQL to this view??
Thanks once agin,
Sonya -
Can we use Perform statement in start routine ,Form and endform.
Hi,
Can we use Perform statement in start routine ? Then write the ABAP code between Form and Endform.
Example : Can I use Perform ABC in start routine. Then define ABC at the end of start routine.
Form ABC,
......<ABAP> code .....
Endform.Hi,
In BI 7.0 we have start routines defined using Class where you might be able to create your own performs, but in case of BW3.5 Start routines are defined using Form so there I don't think it will allow you to create one more form.
But you can surely try both the approaches.
Reards,
Durgesh. -
Can we use return statement in procedure?
Can we use return statement in procedure or we can use more than one return statement in procedure?
HamidHelal wrote:
NOReally? Did you at least test it? You can use RETURN in procedure or in anonymous PL/SQL block. The only restriction is you can't specify return value:
SQL> begin
2 dbms_output.put_line('Before return');
3 return;
4 dbms_output.put_line('After return');
5 end;
6 /
Before return
PL/SQL procedure successfully completed.
SQL> create or replace
2 procedure p1
3 is
4 begin
5 dbms_output.put_line('Before return');
6 return;
7 dbms_output.put_line('After return');
8 end;
9 /
Procedure created.
SQL> exec p1;
Before return
PL/SQL procedure successfully completed.
SQL> begin
2 dbms_output.put_line('Before return');
3 return 99;
4 dbms_output.put_line('After return');
5 end;
6 /
return 99;
ERROR at line 3:
ORA-06550: line 3, column 5:
PLS-00372: In a procedure, RETURN statement cannot contain an expression
ORA-06550: line 3, column 5:
PL/SQL: Statement ignored
SQL> create or replace
2 procedure p1
3 is
4 begin
5 dbms_output.put_line('Before return');
6 return 99;
7 dbms_output.put_line('After return');
8 end;
9 /
Warning: Procedure created with compilation errors.
SQL> show err
Errors for PROCEDURE P1:
LINE/COL ERROR
5/9 PL/SQL: Statement ignored
5/9 PLS-00372: In a procedure, RETURN statement cannot contain an
expression
SQL> SY. -
When to use prepared statement in java?
Hi all,
If we have query like select * from {tablename} (Here tablename is the variable) then will the use of prepared staement improve the performance? My guess is use of statement in this case is a better option rather than prepared statement as the tablename may change for every other query.I think are not useful if tablename changes.They are useful only when the where clause has dynamic values.cantor wrote:
Are you sure that your approach is possible? The next example causes exception for me.
PreparedStatement ps = conn.prepareStatement("select * from ?");
ps.setString(1, "TABLE_NAME");
ps.executeQuery();
I didn't say that he should solve it in that way. He should create one prepared statement like this "select a, b, c from tablename1" and another prepared statement when he wants to execute "select d, e, f from tablename2"
>
And as I understand, this code will not improve perfomance (and even will not work). As I said it can.
Prepared statements make possible usage compiled queries inside DB. When DB gets prepared statement call, it need to parse it only once. And it can collect some statistic to improve execution plan. But when table name is not specified, this approach will not work.Yes it might. There are database drivers that can cache prepared statements and it's isn't likely that he executes that query on more than e.g. 20 tables?
The database can also cache compiled statements in a cache.
Kaj -
Is it possible to skip the screen in BDC using IF statement.
Hi Friends,
I have written a report using BDC for tcode CO11 thru recording using CALL TRANSACTION.
Case 1:
If I go to transaction CO11 (screen number 100) and give the order number which has more than 1 operations to be partially confirmed and press ENTER a pop-up screen (screen number 140) appears where in I need to select the operation number and after selecting the required operation number it automatically takes me to another screen (screen number 150).
Case 2:
If I go to transaction CO11 (screen number 100) and give the order number which has only 1 operation to be partially confirmed and press ENTER it directly takes me to screen 150 skiping screen 140.
When I enter the order number which has more than 1 operations to be partially confirmed on my selection screen, my code is working fine as needed.
But, when I enter the order number which has 1 operation to be partially confirmed on my selection screen, it is giving me error in my BDCMSGCOLL saying that the screen 140 doesn't exist.
Is there any way, Can I skip screen 140 using IF statement?
My thoughts:
1. calling screen 100.
After calling screen 100, I have put the pop-up operation numbers in an ITAB.
DESCRIBE table lines ITAB <variable>.
At NEW <order-field>.
IF <variable> = 1.
2. calling screen 140. "I need some help here to skip the screen 140
" Will this logic work?
ENDIF.
ENDAT.
3. calling screen 150.
Rest everything is working fine.
Will my above logic works correctly? I would appreciate if someone could help me with this.
Thanks in Advance.Hi,
Try something like this:
1. Call Screen 100.
Check if screen 140 needs to be called depending on your custom logic. Lets say you populate a variable as 'X' if it needs to be called.
Then write:
if valiable = 'X'.
Call screen 140.
Enter Screen 140 details.
endif.
Call screen 150.
Here the 'Call Screen' is nothing but the code you extracted after BDC recording.
Thanks.
Ravi' -
Using Select statement in IF condition?
hi all,
Can i use select statement in IF COndition in pl sql ?
eg like- if( select 1 from ASD) then
end if;There is no way to do any kind of select statement inside if conditions.
Why don't test simple cases like this first?
An example to show it.
SQL> begin
2 if exists (select 1 from dual) then
3 dbms_output.put_line('ok');
4 end if;
5 end;
6 /
if exists (select 1 from dual) then
ERRORE alla riga 2:
ORA-06550: line 2, column 5:
PLS-00204: function or pseudo-column 'EXISTS' may be used inside a SQL
statement only
ORA-06550: line 2, column 2:
PL/SQL: Statement ignored
SQL> begin
2 if ( (select count(*) from dual) > 0 ) then
3 dbms_output.put_line('ok');
4 end if;
5 end;
6 /
if ( (select count(*) from dual) > 0 ) then
ERRORE alla riga 2:
ORA-06550: line 2, column 8:
PLS-00103: Encountered the symbol "SELECT" when expecting one of the following:
( - + case mod new not null others <an identifier>
<a double-quoted delimited-identifier> <a bind variable> avg
count current exists max min prior sql stddev sum variance
execute forall merge time timestamp interval date
<a string literal with character set specification>
<a number> <a single-quoted SQL string> pipe
<an alternatively-quoted string literal with character set specification>
<an alternativ
ORA-06550: line 2, column 33:
PLS-00103: Encountered the symbol ")" when expecting one of the following:
. , @ ; for <an identifier>
<a double-quoted delimited-identifier> group having intersect
minus order partition start subpartition union where connect
SQL> begin
2 if ( 0 in (select count(*) from dual) ) then
3 dbms_output.put_line('ok');
4 end if;
5 end;
6 /
if ( 0 in (select count(*) from dual) ) then
ERRORE alla riga 2:
ORA-06550: line 2, column 12:
PLS-00405: subquery not allowed in this context
ORA-06550: line 2, column 2:
PL/SQL: Statement ignoredBye Alessandro
Maybe you are looking for
-
HT201272 im trying to figure out how to get purchaches on a app
you see i bought a app over a year ago, lost everything on my computer due to virus. I had to wipe the entire hard drive. so i lost all my itunes and all my apps and had to start over. well i got the purchaced app back and all the stuff i bought on t
-
Sorry if this has been posted elsewhere but I've recently started to get some weird characters when opening an Ultrabeat instrument (see attached screenshots). /Users/neilmorgan/Desktop/Screen shot 2010-12-27 at 16.53.59.png /Users/neilmorgan/Desktop
-
Oracle 9i and windows 2003 R2 installation issues
Hi All, I have a windows 2003 R2 server with oracle 9.2.0.8 installed both OS and DB are 32bit. The server has 12gb ram and I therefore use AWE and /PAE, however when ever the number of connections exceeds >60 memory errors start to appear and sessio
-
Downloading albums in lossless format
how do you download albums in lossless format? If there is a setting for it I cant find it...the edit/preferences/advanced setting is for importing music not downloading any help would be appreciated because apple tech support is no help
-
Guyz, I configured webutil 6 month before and its working fine till date the only problem with window title. i didnt change anything in formweb.cfg file i use the below code for MDI_FORMS_WINDOW. SET_WINDOW_PROPERTY(FORMS_MDI_WINDOW,WINDOW_STATE,MAXI