Href type of jump functionality in Flex 4
I'm trying to implement a functionality that allows user to click on a button and the application scrolls down to a predefined position...
kind of like <a href="#Chap9"> in HTML
verticalScrollPosition property of a container allows changing y coordinate of the origin of the viewport. This part works but the application's scrollbar doesn't move as the new value is assigned to verticalScrollPosition property.
Any idea how to access the application's scrollbar and move it to a specific position using ActionScript?
Yea, that doubled the speed but still I sense a delay between 0.5-1 second. I can accept the delay in the first opening of the window but in the consecutive openings it should be faster The window contain just 1 skinned image 8 skinned checkboxes and 10 labels+textinputs. I tried cacheAsBitmap for whole the component but it didnt make difference.
Similar Messages
-
Question on the parameter type of DLL functions
Question on the parameter type of DLL functions
I am trying to develop an interface to control a laser with LV8.2 I am planing to use the VI “Call Library Function Node” to call the DLL and set the exact same parameters of functions in the DLL.
According to the DLL manual of the laser, there are six functions. One of the prototypes is: function getstatuspointer : pointer. I don't know how to set this parameter for the function. Is there anyone who can give some hints? Thanks!
BTW :The following is a description of the function:
This function returns a 32 bit pointer to the STATUS data structure (Tstatusrec). In the 32 bit DLL, every application is using its own copy of the data structure (local
memory). The data structure is a packed structure. "packed" means that the fields in the structure are not aligned on word or double-word boundaries.
Tstatusrec = packed record
size : word;
initstat : byte;
queuefill : byte;
anzapp16 : word; (not used)
anzapp32 : word;
anzdock16 : word; (not used)
anzdock32 : word;
dll16ver : tchararray; (not used)
dll32ver : tchararray;
excimerver : tchararray;
excimer : TExcimerStatus;
end;Hi Jack,
This is a good starting point when using Call Library Function node. Check out this Help Page
Van L
NI Applications Engineer -
Hi,
I have something here which takes some time for the
HTTPService to communicate with an external server that hosts the
database. The only issue here is that when I would like to change
the view state to see the information, the application cannot
handle it on the DataGrid due to the time lapse.
In programming languages, there is a function called sleep
that I can stop the program till certain stage is committed. In
Flex, I tried to use setInterval(1000) to commit 10 seconds to put
the program to sleep, but most manuals require me to apply
setInterval with a function or two. Could I just do
setInterval(1000) for my program to sleep for 10 seconds instead of
waiting for it to apply to another function in Flex?
Thanks in advance.
AliceHi,
As Dmitri mentioned, you should listen to the result event of
the HTTPService. HTTPService calls to the server are asynchronous,
so HTTPService will dispatch a result event when the response from
the server is received.
Please find more details on how to listen for result and
fault events of the HTTPService at the URL below.
http://livedocs.adobe.com/flex/3/html/data_access_2.html#193905
You can also have a look at concept called Binding in Flex.
This will allow you to bind your DataGrid to a ArrayCollection and
when the ArrayCollection is modified, your DataGrid will reflect
the changes. Please find more details on Binding at the URL below.
http://livedocs.adobe.com/flex/3/html/databinding_1.html
Hope this helps. -
Revision: 5604
Author: [email protected]
Date: 2009-03-26 14:00:26 -0700 (Thu, 26 Mar 2009)
Log Message:
Ensuring qualified class names are used in type selector cache keys for Flex 4 applications.
QE: Yes, this should address style issues for test cases that contain two different components with the same local name.
Dev: No
Doc: No
Checkintests: Pass
Modified Paths:
flex/sdk/trunk/frameworks/projects/framework/src/mx/styles/StyleProtoChain.asRemember that Arch Arm is a different distribution, but we try to bend the rules and provide limited support for them. This may or may not be unique to Arch Arm, so you might try asking on their forums as well.
-
Procedure parameter of type returned by function
Hi there
I want to know if it's possible to pass a parameter to procedure of type returned by function
Something like that
pocedure test(x in varchar2
,y in my_function(param)
)Definitely don't fullish yourself ;-)
AFAIK you cannot declare a variable based on the return type of a function.
Perhaps though you are looking for SUBTYPEs.
SQL> SET SERVEROUTPUT ON;
SQL> DECLARE
2 SUBTYPE subtype_name IS VARCHAR2 (30) NOT NULL;
3
4 PROCEDURE procedure_name (
5 parameter_name IN subtype_name)
6 IS
7 BEGIN
8 DBMS_OUTPUT.PUT_LINE (parameter_name);
9 END;
10
11 FUNCTION function_name (
12 parameter_name IN DATE)
13 RETURN subtype_name
14 IS
15 BEGIN
16 RETURN TO_CHAR (parameter_name, 'DAY');
17 END;
18
19 BEGIN
20 procedure_name (function_name (SYSDATE));
21 END;
22 /
THURSDAY
PL/SQL procedure successfully completed.
SQL> -
Oracle OER Asset Type vs Asset Function
I've just begun populating our Oracle Enterprise Repository (11.1.1.4.0), and I have a query about values used for Asset Type and Asset Function ...
When I submit a Service asset, it appears in the editor under Submitted, Pending Review
Once Accepted, it moves to Submitted, Under Review
and once reviewed, updated and registered it moves to the "Registered" folder
BUT, the Registered folder contains a range of sub-folders which correspond to the values of AssetFunction
I'd prefer to see sub-folders based on AssetType - i.e. Services, Applications, Interfaces etc.
Does anybody have any comments ?
Thanks,
PD.Hi Dom,
Thanks again for your response. I do indeed have the situation you describe ... coarse-grained services calling finer-grained services.
I have recorded both types of service in OER as Service assets (using different values of Asset Function to differentiate between the two types of Service), and I've created References/Is Referenced By relationships between the Services.
That works well for Services with a single operation, but if the target Service is a Data Service with a range of CRUD-type operations I can currently only record the relationship between the calling service and the target Data Service.
There is no indication of which operation(s) the calling Service uses.
This is what I was referring to as fine-grained impact analysis.
I could change the meta-model to add an Operation asset and model the relationships that way, but are there other options that you're aware of ?
Thanks,
Pete. -
Order types and their functionality
Hi,
I have the following requirement,
I need a order type for where its quantity gets reduced when a sales order is created with reference to this order type? IS there any order type other than contracts to handle this functionality??
Thanks
KeshiKeshni,
There is no such order type with this functionality. Also it is not even advisable to reduce the order quantity once the subsequent order is made, as this will have lot of implications in copy control, Reference status of the document etc. However this functionality is already inbuilt in SAP. Once an order is created with reference to a contract, we can make another order referencing that contract only for the remaining quantity. You have to explore this functionality little bit and accordingly design your requirement as per the standard functionality provided by SAP.
Hope this helps you.
You can reward if this helps you -
Pass TestStand error type directly into function parameter
Hi,
I am using TestStand 4 and Labwindows CVI 8.5.
I wonder if it is possible to pass Standard Step error type into CVI function parameters.
I think it would be more simple to pass one parameter instead of passing Error code, Error occurred state and Error message into function prototype.
I tried to use tsErrorDataType struct defined into tsutil.h into my function prototype.
In TestStand, I pass Step error type into function parameter but it does not work.
TestStand displays an error meaning parameters does not match function prototype.
Thank you for your help.Hi Tartempion,
In order to pass the TestStand Error Container as one parameter to a function in a CVI DLL, you must use a struct that is typedef'ed and create an .fp file that is included as a type library for the DLL. When you create a .fp file to add to a DLL, the DLL will not build unless all structs/enums are typedef'ed. Thus, I wouldn't advise using the tsutil.h because you would have to go through and typedef every single struct and enum in the header file.
Instead, you can simply create a typedef'ed struct in your projects header file and create an .fp file with the struct specified as a data type. Then in TestStand, when you call the function you would need to ensure that the parameter is of Category "C Struct", and type "Error". The attached zip file contains a CVI 8.5 project that demonstrates this along with a TestStand 4.0 sequence file that demonstrates how to pass the parameter to the function by reference. In case you run into trouble creating the .fp file please refer to the following KnowledgeBase. The instructions are for enums but easily correspond to structs as well:
TestStand and LabWindows/CVI Enumeration Data Types
Hope this helps!
Manooch H.
National Instruments
Attachments:
PassTSError.zip 19 KB -
Specify two conditions for button type: pl/sql function body return boolean
Hello,
Can anyone help me out with this issue.
I am using Oracle APEX 3.2 version.
I have page zero select list with submit items P0_ITEM1, P0_ITEM2, P0_ITEM3
and i also have a button on page zero. Now I want to make this button conditional
like only show the button only when all the three items are selected. For this I am having the below condition which is working perfectly fine.
Type: PL/SQL function returning boolean.
RETURN NVL(:P0_ITEM1,'%'||'null%') != '%'||'null%' AND
NVL(:P0_ITEM2,'%'||'null%') != '%'||'null%' AND
NVL(:P0_ITEM3,'%'||'null%') != '%'||'null%' ;Now I want to add one more condition to the button --
the condition is that, the buttton should be displayed only on the pages 1,2,3,4
so can anyone please help me out how do i change the code to include the additional condition.
thanks,
Orton
Edited by: orton607 on Jul 28, 2010 2:02 PMTry:
Type: PL/SQL function returning boolean.
RETURN NVL(:P0_ITEM1,'%'||'null%') != '%'||'null%' AND
NVL(:P0_ITEM2,'%'||'null%') != '%'||'null%' AND
NVL(:P0_ITEM3,'%'||'null%') != '%'||'null%' AND
:app_page_id in (1, 2, 3, 4);http://download.oracle.com/docs/cd/E17556_01/doc/user.40/e15517/concept.htm#sthref156 -
What are different vru types and their functions
Dear experts,
what are different vru types and their functionsHi,
just hit the Help button in "Network VRU Explorer" in ICM Configuration Manager.
If you wish to see even more details, take a look at the following article:
http://www.ciscopress.com/articles/article.asp?p=1822061&seqNum=2
HTH
G. -
Problem when calling a return type BOOLEAN SQL Function in a package
Hi All,
I am having problem when trying to call a SQL function in a package with return type BOOLEAN
The SQL function signature is as follows
CREATE OR REPLACE PACKAGE RMSOWNER.ORDER_ATTRIB_SQL ****
FUNCTION GET_PO_TYPE_DESC(O_error_message IN OUT VARCHAR2,
I_PO_TYPE IN VARCHAR2,
O_PO_TYPE_DESC IN OUT VARCHAR2)
RETURN BOOLEAN;
Following is my java code
+CallableStatement cs3 = conn.prepareCall("{?=call ORDER_ATTRIB_SQL.GET_PO_TYPE_DESC(?,?,?)}");+
+cs3.registerOutParameter(1, java.sql.Types.BOOLEAN);+
+cs3.registerOutParameter(2, java.sql.Types.VARCHAR);+
+cs3.registerOutParameter(4, java.sql.Types.VARCHAR);+
+cs3.setString(2, "");+
+cs3.setString(3, "ST");+
+cs3.setString(4, "");+
+ResultSet rs3 = cs3.executeQuery();+
I get the following exception, i tried changing the sql type(registerOutParameter) from boolean to bit but i still getting this exception.
But when i call any other functions with return type other than boolean they work perfectly fine.
Please can anyone help me fix this issue, i am not sure if its anything to do with vendor JDBC classes?
+java.sql.SQLException: ORA-06550: line 1, column 13:+
+PLS-00382: expression is of wrong type+
+ORA-06550: line 1, column 7:+
+PL/SQL: Statement ignored+
+ at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)+
+ at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)+
+ at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288)+
+ at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:743)+
+ at oracle.jdbc.driver.T4CCallableStatement.doOall8(T4CCallableStatement.java:215)+
+ at oracle.jdbc.driver.T4CCallableStatement.executeForRows(T4CCallableStatement.java:954)+
+ at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1168)+
+ at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3316)+
+ at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3422)+
+ at oracle.jdbc.driver.OracleCallableStatement.execute(OracleCallableStatement.java:4394)+
#####Hello People!
There is another workaround!!
See the example below:
private String callBooleanAPi(String tableName,String apikey,String dtInicio,String dtFim,String comando) throws SQLException {
CallableStatement cs = null;
String call = "";
String retorno = null;
try {
if(comando.equalsIgnoreCase("INSERT")){
call = "declare x BOOLEAN; y varchar2(2);begin x :=PKG.INSERT(?,?,?,?,?); if x then y := 'S'; else y :='N'; end if; ? := y;end;";
} else if(comando.equalsIgnoreCase("UPDATE")){
call = "declare x BOOLEAN; y varchar2(2);begin x := PKG.UPDATE(?,?,?,?,?); if x then y := 'S'; else y :='N'; end if; ? := y;end;";
} else if(comando.equalsIgnoreCase("DELETE")){
call = "declare x BOOLEAN; y varchar2(2);begin x := PKG.DELETE(?,?,?,?,?); if x then y := 'S'; else y :='N'; end if; ? := y;end;";
cs = conn.prepareCall(call);
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
SimpleDateFormat sdfToSqlDate = new SimpleDateFormat("yyyy-MM-dd");
java.util.Date dataInicialVigencia =null;
java.util.Date dataFinalVigencia = null;
Date dtInicialFormatada =null;
Date dtFinalFormatada = null;
if(dtInicio != null && !dtInicio.equals("")){
dataInicialVigencia = sdf.parse(dtInicio);
dtInicio =sdfToSqlDate.format(dataInicialVigencia);
dtInicialFormatada = Date.valueOf(dtInicio);
if(dtFim != null && !dtFim.equals("")){
dataFinalVigencia = sdf.parse(dtFim);
dtFim =sdfToSqlDate.format(dataFinalVigencia);
dtFinalFormatada = Date.valueOf(dtFim);
cs.setString(1, tableName);
cs.setString(2, apikey);
cs.setDate(3, dtInicialFormatada );
cs.setDate(4, dtFinalFormatada );
cs.registerOutParameter(5, java.sql.Types.VARCHAR);
cs.registerOutParameter(6, java.sql.Types.VARCHAR );
cs.execute();
retorno = cs.getString(6);
System.out.println( cs.getString(5));
} catch(SQLException e){
throw new SQLException("An SQL error ocurred while calling the API COR_VIGENCIA: " + e);
} catch(Exception e){
Debug.logger.error( "Error calculating order: " + id, e );
} finally {
if (cs != null) {
cs.close();
cs = null;
return retorno;
As you can see the CallableStatement class acepts PL/SQl blocks.
Best Regards. -
Invalid stored Object Types with Constructor Function
hi folks,
i created a stored object type on database 10.2. but it is invalid.
it has a constructor function and a number of member functions.
SQLPlus the only feddback is
Warning: Type Body is compiled with errors.
Toad 9.0.0 gives no error message.
how can i find out what kind of error there is? and where?
thx for help
joergIn SQL*Plus, when you get a warning that you've created an object with compilation errors, you can type
SQL> show errorsto see the list of errors.
Justin -
How to pass table type variable into function from SQL*PLUS ?
How to pass a table type variable from sql*plus prompt into a function ?
Thanx in advance.Krishna,
Do you mean like this?SQL> DECLARE
2 TYPE t_tbl IS TABLE OF VARCHAR2(20);
3 l_sample_tbl t_tbl;
4
5 FUNCTION print_contents ( p_tbl IN t_tbl )
6 RETURN VARCHAR2
7 IS
8 l_string VARCHAR2(1000);
9 BEGIN
10 FOR i IN 1..p_tbl.COUNT LOOP
11 IF (i = 1) THEN
12 l_string := p_tbl(i);
13 ELSE
14 l_string := l_string || ', ' || p_tbl(i);
15 END IF;
16 END LOOP;
17 RETURN (l_string);
18 END print_contents;
19
20 BEGIN
21 l_sample_tbl := t_tbl();
22 l_sample_tbl.EXTEND;
23 l_sample_tbl(1) := 'one';
24 l_sample_tbl.EXTEND;
25 l_sample_tbl(2) := 'two';
26 l_sample_tbl.EXTEND;
27 l_sample_tbl(3) := 'three';
28 l_sample_tbl.EXTEND;
29 l_sample_tbl(4) := 'four';
30 l_sample_tbl.EXTEND;
31 l_sample_tbl(5) := 'five';
32 DBMS_OUTPUT.PUT_LINE(print_contents(l_sample_tbl));
33 END;
34 /
one, two, three, four, five
PL/SQL procedure successfully completed.
SQL> HTH,
T. -
How to call the built in functions from flex?
I want to use some of the Built in functions like the twelvesprints.getActivityOwnerId() in flex. From the java example i could make out that we needed to import some classes to do this but was unable to find them for flex.
You can download the SWC file for Flex Method app here:
https://sandbox.12sprints.com/FlashMethodLib.swc
Java samples are located at
https://streamwork.com/api/Java.zip
Method exaples are available at:
https://streamwork.com/api/methods/com.streamwork.hello_world.zip
https://streamwork.com/api/methods/com.streamwork.constants.zip
https://streamwork.com/api/methods/com.streamwork.using_arrays.zip
com.streamwork.testFlash -
i succeed to implement the initial prototype for function structure in c#
but i do not know how to integrate in F#
i make c# library's function to accept template T, for F# to pass type expression into it.
but how to write in c# to make template like type expression,
in Addvaluetoeachitem
hope make function structure depend on left or right, i got twisted in my mind when integrating into F#
if translate c# into F# , how to write for this class?
func1(func1(param1, param2), param2) etc
if i define funcvalue as
type expr =
| And of expr * expr
| Or of expr * expr
expr[] funcvalues = new expr[] {And, Or, And, Or, And, Or, And}
int[] values = new int[] { 1, 2, 3, 4, 5, 6, 7 };
got some error when translate member value and constructor into F#
// Learn more about F# at http://fsharp.net
// See the 'F# Tutorial' project for more help.
open System.Collections.Generic
type expr =
| And of expr * expr
| Or of expr * expr
| Param1
type BinaryTree =
let mutable value = 0
let left : BinaryTree = null
let right : BinaryTree = null
let mutable dict : Dictionary<int, BinaryTree> = new Dictionary<int, BinaryTree>();
member this.Load(tree : BinaryTree, values : int[], index : int) =
this.value = values.[index];
if index * 2 + 1 < values.Length then
this.left = new BinaryTree(values, index * 2 + 1)
if index * 2 + 2 < values.Length then
this.right = new BinaryTree(values, index * 2 + 2)
new() = BinaryTree(values : int[]) : this(values, 0) { }
//public BinaryTree(int[] values) : this(values, 0) { }
new() = BinaryTree(values : int[], index : int)
let dict = new Dictionary<int, BinaryTree>()
Load(this, values, index)
member this.Visit(tree : BinaryTree) =
dict.Add(dict.Count, tree);
member this.ChangeToString(m : List<int>) : String =
let result = "";
for i in m do
result = result + i.ToString()
result
member this.CopyList(queue : Queue<List<int>>) : Queue<List<int>> =
let mutable newqueue : Queue<List<int>> = new Queue<List<int>>();
if queue != null then
while (queue.Count > 0) do
let source : List<int> = queue.Dequeue()
let destination : List<int> = new List<int>();
for a in source do
destination.Add(a);
newqueue.Enqueue(destination)
for m in newqueue do
queue.Enqueue(m);
newqueue
member this.IsAscending(m : List<int>) : bool =
let mutable result = true
let mutable prev : int = 0
for i in m do
if prev > i then
result <- false
prev <- i
result
member this.Addvaluetoeachitem(queue : Queue<List<int>>, value : int, maxlimit : int, ref Dictionary<String , List<int>> allpath, Boolean IsBackUp, T func1, T param1, T param2, Dictionary<T, T> allfunctionstructure, Queue<List<T>> funcqueue, Boolean LeftOrRight) : Queue<List<int>>=
let newqueue : Queue<List<int>> = new Queue<List<int>>()
if queue != null then
while queue.Count > 0 do
List<int> path = queue.Dequeue();
//List<T> func = funcqueue.Dequeue();
let mutable afteradd = false
if path.Count < maxlimit then
path.Add(value);
afteradd <- true
if path.Count = maxlimit && afteradd = true && IsBackUp = false then
if IsAscending(path) = true then
if allpath.ContainsKey(ChangeToString(path)) = false then
allpath.Add(ChangeToString(path), path)
newqueue.Enqueue(path);
if queue = null then
let mutable path : List<int> = new List<int>();
let mutable afteradd = false
if path.Count < maxlimit then
path.Add(value)
afteradd <- true
if path.Count == maxlimit && afteradd == true && IsBackUp = false then
if IsAscending(path) = true then
if allpath.ContainsKey(ChangeToString(path)) = false then
allpath.Add(ChangeToString(path), path)
newqueue.Enqueue(path)
else
if queue.Count = 0 then
let mutable path : List<int> = new List<int>();
let mutable afteradd = false
if path.Count < maxlimit then
path.Add(value)
afteradd <- true
if path.Count = maxlimit && afteradd = true && IsBackUp = false then
if IsAscending(path) == true then
if allpath.ContainsKey(ChangeToString(path)) = false then
allpath.Add(ChangeToString(path), path)
newqueue.Enqueue(path)
newqueue
member this.Deepfirst(tree : BinaryTree, ref queuepath : Queue<List<int>>, backpath : Queue<List<int>>, maxlimit : int, ref allpath : Dictionary<String, List<int>>, func1 : expr, param1 : expr, param2 : expr, allfunctionstructure : Dictionary<expr, expr>, ref queuefunc : Queue<List<expr>>, LeftOrRight : bool) : Queue<List<int>>=
queuepath = Addvaluetoeachitem(queuepath, tree.value, maxlimit, ref allpath, false, func1, param1, param2, allfunctionstructure, queuefunc, LeftOrRight);
//path.Add(tree.value);
Queue<List<int>> newpath = new Queue<List<int>>();
newpath = CopyList(queuepath);
Queue<List<int>> newpath2 = new Queue<List<int>>();
newpath2 = CopyList(queuepath);
backpath = Addvaluetoeachitem(backpath, tree.value, maxlimit, ref allpath, false, func1, param1, param2, allfunctionstructure, queuefunc, LeftOrRight);
//Queue<List<int>> backpathx = new Queue<List<int>>();
Queue<List<int>> backpathx = backpath;//Addvaluetoeachitem(backpathx, tree.value, maxlimit, ref allpath, false);
Queue<List<int>> newpathx = new Queue<List<int>>();
newpathx = CopyList(queuepath);
Queue<List<int>> backpath1 = backpathx;
if tree.left != null then
newpathx = Deepfirst(tree.left, ref newpath, newpathx, maxlimit, ref allpath, func1, param1, param2, allfunctionstructure, ref queuefunc, false) // Left
if tree.value = 1 then
Console.WriteLine("")
Visit(tree)
for m in queuepath do
newpath2.Enqueue(m)
let mutable backpath2 : Queue<List<int>> = newpathx
if tree.right != null then
newpathx = Deepfirst(tree.right, ref newpath2, newpathx, maxlimit, ref allpath, func1, param1, param2, allfunctionstructure, ref queuefunc, true) // Right
if tree.value = 1 then
Console.WriteLine("")
if newpathx != null then
return newpathx
if backpath2 != null then
return backpath2
if backpath1 != null then
return backpath1
if backpath != null then
return backpath
else
return backpath
[<EntryPoint>]
let main argv =
printfn "%A" argv
0 // return an integer exit code
BinaryTree<int> b = new BinaryTree<int>(values);
Queue<List<int>> queuepath = new Queue<List<int>>();
Queue<List<int>> backpath = null;
Queue<List<int>> queuefunc = new Queue<List<int>>();
Dictionary<String, List<int>> allpath = new Dictionary<String, List<int>>();
Dictionary<int, int> allfunctionstructure = new Dictionary<int, int>();
int a3 = 0;
int b3 = 0;
int c3 = 0;
queuepath = b.Deepfirst(b, ref queuepath, backpath, 3, ref allpath, a3, b3, c3, allfunctionstructure, ref queuefunc, false);
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace testTable
public class BinaryTree<T>
public int value;
BinaryTree<T> left;
BinaryTree<T> right;
public Dictionary<int, BinaryTree<T>> dict;
public BinaryTree(int[] values) : this(values, 0) { }
BinaryTree(int[] values, int index)
dict = new Dictionary<int, BinaryTree<T>>();
Load(this, values, index);
public void Visit(BinaryTree<T> tree)
dict.Add(dict.Count, tree);
public String ChangeToString(List<int> m)
String result = "";
foreach (int i in m)
result = result + i.ToString();
return result;
public Queue<List<int>> CopyList(Queue<List<int>> queue)
Queue<List<int>> newqueue = new Queue<List<int>>();
if (queue != null)
while (queue.Count > 0)
List<int> source = queue.Dequeue();
List<int> destination = new List<int>();
foreach (int a in source)
destination.Add(a);
newqueue.Enqueue(destination);
foreach (List<int> m in newqueue)
queue.Enqueue(m);
return newqueue;
public Boolean IsAscending(List<int> m)
Boolean result = true;
int prev = 0;
foreach (int i in m)
if (prev > i)
result = false;
prev = i;
return result;
public Queue<List<int>> Addvaluetoeachitem<T>(Queue<List<int>> queue, int value, int maxlimit, ref Dictionary<String , List<int>> allpath, Boolean IsBackUp, T func1, T param1, T param2, Dictionary<T, T> allfunctionstructure, Queue<List<T>> funcqueue, Boolean LeftOrRight)
Queue<List<int>> newqueue = new Queue<List<int>>();
if (queue != null)
while (queue.Count > 0)
List<int> path = queue.Dequeue();
//List<T> func = funcqueue.Dequeue();
Boolean afteradd = false;
if (path.Count < maxlimit)
path.Add(value);
afteradd = true;
if (path.Count == maxlimit && afteradd == true && IsBackUp == false)
if( IsAscending(path) == true)
if(allpath.ContainsKey(ChangeToString(path)) == false)
allpath.Add(ChangeToString(path), path);
newqueue.Enqueue(path);
if (queue == null)
List<int> path = new List<int>();
Boolean afteradd = false;
if (path.Count < maxlimit)
path.Add(value);
afteradd = true;
if (path.Count == maxlimit && afteradd == true && IsBackUp == false)
if (IsAscending(path) == true)
if (allpath.ContainsKey(ChangeToString(path)) == false)
allpath.Add(ChangeToString(path), path);
newqueue.Enqueue(path);
else
if (queue.Count == 0)
List<int> path = new List<int>();
Boolean afteradd = false;
if (path.Count < maxlimit)
path.Add(value);
afteradd = true;
if (path.Count == maxlimit && afteradd == true && IsBackUp == false)
if (IsAscending(path) == true)
if (allpath.ContainsKey(ChangeToString(path)) == false)
allpath.Add(ChangeToString(path), path);
newqueue.Enqueue(path);
return newqueue;
public Queue<List<int>> Deepfirst(BinaryTree<T> tree, ref Queue<List<int>> queuepath, Queue<List<int>> backpath, int maxlimit, ref Dictionary<String, List<int>> allpath, T func1, T param1, T param2, Dictionary<T, T> allfunctionstructure, ref Queue<List<T>> queuefunc, Boolean LeftOrRight)
//if (path.Count < maxlimit)
queuepath = Addvaluetoeachitem(queuepath, tree.value, maxlimit, ref allpath, false, func1, param1, param2, allfunctionstructure, queuefunc, LeftOrRight);
//path.Add(tree.value);
Queue<List<int>> newpath = new Queue<List<int>>();
newpath = CopyList(queuepath);
Queue<List<int>> newpath2 = new Queue<List<int>>();
newpath2 = CopyList(queuepath);
backpath = Addvaluetoeachitem(backpath, tree.value, maxlimit, ref allpath, false, func1, param1, param2, allfunctionstructure, queuefunc, LeftOrRight);
//Queue<List<int>> backpathx = new Queue<List<int>>();
Queue<List<int>> backpathx = backpath;//Addvaluetoeachitem(backpathx, tree.value, maxlimit, ref allpath, false);
Queue<List<int>> newpathx = new Queue<List<int>>();
newpathx = CopyList(queuepath);
Queue<List<int>> backpath1 = backpathx;
if (tree.left != null)
newpathx = Deepfirst(tree.left, ref newpath, newpathx, maxlimit, ref allpath, func1, param1, param2, allfunctionstructure, ref queuefunc, false); // Left
if (tree.value == 1)
Console.WriteLine("");
Visit(tree);
if (backpath1 != null)
Boolean afteradd = false;
if (backpath1.Count < maxlimit)
backpath1.Add(tree.value);
afteradd = true;
if (backpath1.Count == maxlimit && afteradd == true)
allpath.Add(backpath1);
foreach (List<int> m in queuepath)
newpath2.Enqueue(m);
Queue<List<int>> backpath2 = newpathx;
if (tree.right != null)
newpathx = Deepfirst(tree.right, ref newpath2, newpathx, maxlimit, ref allpath, func1, param1, param2, allfunctionstructure, ref queuefunc, true); // Right
if (tree.value == 1)
Console.WriteLine("");
//Queue<List<int>> newpath3 = new Queue<List<int>>();
//newpath3 = CopyList(queuepath); // 2 -> 1 -> 3 1(2,3) difficult case
//return newpath3;
if (newpathx != null)
return newpathx;
if(backpath2 != null)
return backpath2;
if (backpath1 != null)
return backpath1;
if (backpath != null)
return backpath;
else
return backpath;
public void Load(BinaryTree<T> tree, int[] values, int index)
this.value = values[index];
if (index * 2 + 1 < values.Length)
this.left = new BinaryTree<T>(values, index * 2 + 1);
if (index * 2 + 2 < values.Length)
this.right = new BinaryTree<T>(values, index * 2 + 2);
computing nightmareThis builds, and fixes the most egregious style issues
open System
open System.Collections.Generic
type expr =
| And of expr * expr
| Or of expr * expr
| Param1
[<AllowNullLiteral>]
type BinaryTree(values : int[], index : int) =
let value = values.[index]
let left = if index * 2 + 1 < values.Length then
BinaryTree(values, index * 2 + 1)
else null
let right = if index * 2 + 2 < values.Length then
BinaryTree(values, index * 2 + 2)
else null
let dict : Dictionary<int, BinaryTree> = new Dictionary<int, BinaryTree>();
new(values : int[]) = BinaryTree(values, 0)
member this.Value with get() = value
member this.Left with get() = left
member this.Right with get() = right
member this.Visit(tree : BinaryTree) =
dict.Add(dict.Count, tree);
static member ChangeToString(m : List<int>) : String =
String.Join(String.Empty, m)
static member CopyList(queue : Queue<List<int>>) : Queue<List<int>> =
let newqueue = Queue<List<int>>();
if queue <> null then
while (queue.Count > 0) do
let source : List<int> = queue.Dequeue()
let destination : List<int> = new List<int>();
for a in source do
destination.Add(a);
newqueue.Enqueue(destination)
for m in newqueue do
queue.Enqueue(m);
newqueue
static member IsAscending(m : List<int>) : bool =
m
|> Seq.pairwise
|> Seq.forall (fun (x,y) -> y > x)
static member Addvaluetoeachitem(
queue : Queue<List<int>>,
value : int,
maxlimit : int,
allpath : Dictionary<String , List<int>> byref,
isBackUp : Boolean,
func1 : 'T,
param1 : 'T,
param2 : 'T,
allfunctionstructure : Dictionary<'T, 'T>,
funcqueue : Queue<List<'T>>,
leftOrRight : Boolean) : Queue<List<int>>=
let newqueue : Queue<List<int>> = new Queue<List<int>>()
if queue <> null then
while queue.Count > 0 do
let path = queue.Dequeue();
let afteradd = path.Count < maxlimit
if afteradd then
path.Add(value)
if path.Count = maxlimit && afteradd && (not isBackUp) then
if BinaryTree.IsAscending(path) then
if allpath.ContainsKey(BinaryTree.ChangeToString(path)) = false then
allpath.Add(BinaryTree.ChangeToString(path), path)
newqueue.Enqueue(path);
if (queue = null) || (queue.Count = 0) then
let path = List<int>();
let afteradd = path.Count < maxlimit
if afteradd then
path.Add(value)
if path.Count = maxlimit && afteradd && (not isBackUp) then
if BinaryTree.IsAscending(path) then
if not <| allpath.ContainsKey(BinaryTree.ChangeToString(path)) then
allpath.Add(BinaryTree.ChangeToString(path), path)
newqueue.Enqueue(path)
newqueue
member this.Deepfirst(tree : BinaryTree,
queuepath : Queue<List<int>> byref,
backpath : Queue<List<int>> byref,
maxlimit : int,
allpath : Dictionary<String, List<int>> byref,
func1 : expr, param1 : expr, param2 : expr,
allfunctionstructure : Dictionary<expr, expr>,
queuefunc : Queue<List<expr>> byref,
leftOrRight : bool) : Queue<List<int>>=
queuepath <- BinaryTree.Addvaluetoeachitem(queuepath, tree.Value, maxlimit, ref allpath, false, func1, param1, param2, allfunctionstructure, queuefunc, leftOrRight);
let newpath = BinaryTree.CopyList(queuepath);
let newpath2 = BinaryTree.CopyList(queuepath);
backpath <- BinaryTree.Addvaluetoeachitem(backpath, tree.Value, maxlimit, ref allpath, false, func1, param1, param2, allfunctionstructure, queuefunc, leftOrRight);
let backpathx = backpath;
let mutable newpathx = BinaryTree.CopyList(queuepath);
let backpath1 = backpathx;
if tree.Left <> null then
newpathx <- this.Deepfirst(tree.Left, ref newpath, ref newpathx, maxlimit, ref allpath, func1, param1, param2, allfunctionstructure, ref queuefunc, false) // Left
if tree.Value = 1 then
Console.WriteLine("")
this.Visit(tree)
for m in queuepath do
newpath2.Enqueue(m)
let backpath2 = newpathx
if tree.Right <> null then
newpathx <- this.Deepfirst(tree.Right, ref newpath2, ref newpathx, maxlimit, ref allpath, func1, param1, param2, allfunctionstructure, ref queuefunc, true) // Right
if tree.Value = 1 then
Console.WriteLine("")
if newpathx <> null then
newpathx
else if backpath2 <> null then
backpath2
else if backpath1 <> null then
backpath1
else backpath
Maybe you are looking for
-
How to use a result adapter ????
Hi all, I try to use a result adapter. I use the result adapter wich is in the walkthrough of this marvelous documentation :-( I just make some adaptations,very simple, but nothing work, the result is always an empty page. If someone could give me a
-
Hi All, I am new to sap-abap programming .Can any one of you tell me the SAP standards that are to be followed while writing an abap program ? Also can I use joins for the four tables at once . I heard that this would have performance issues so we ll
-
Stream 7 Sleep Mode Kills WiFi
Ok, This is going to sound Strange but here it goes. Got a new stream 7, connected it to my wifi (802.11 g/n). When the tablet is awake and running it works great, wireless works great, etc. When it goes to sleep however, my wifi in the house for all
-
Extracting Audio from M2P files
I did a forum search and only came across one other post for this. The QT Player will recognize the M2P file and place the right icon on it.. but won't open the file unless it is re-named to a .m2v or .mpg file. It then plays fine within the QT Playe
-
I have Mediacom as my isp. I am about to purchase a cable modem. I recently purchase an iMac with and i7 processor. I am a recent Apple convert ..... and, not a techie. However, I still have an old windows system in the house which I will still be