How to check if nativemenu already exists?
In my simple example below, everytime you click on the link to reload the page, a new nativemenu is created along with the one that was already there... Click the HOME-INDEX link multiple times and you will see multiple copies of same menu pop up along the top.
How can I check to see if the menu already exists, so that it is NOT recreated everytime?
Using Air 1.5 on Win XP Pro.
Thanks
INDEX.HTML FILE;
<html>
<head>
<title>index.html example</title>
<script type="text/javascript" src="includes/AIRAliases.js"></script>
<script type="text/javascript" src="includes/AIRMenuBuilder.js"></script>
<script type="text/javascript">
var MainMenu = air.ui.Menu.createFromXML("source/MainMenu.xml");
air.ui.Menu.setAsMenu(MainMenu);
</script>
</head>
<body>
<h1>index.html example</h1>
<br>
<a href="index.html">HOME-INDEX</a>
</body>
</html>
SOURCE/MAINMENU.XML FILE:
<?xml version="1.0" encoding="utf-8" ?>
<root>
<menuitem label="File">
<menuitem label="Close" onSelect="doFileClose"/>
</menuitem>
<menuitem label="Help">
<menuitem label="About" onSelect="doHelpAbout"/>
</menuitem>
</root>
I have not been able to figure out how to determine if the meny already exists or not, but I did come across using this:
var _MainMenu = air.ui.Menu.createFromXML("source/MainMenu.xml");
air.ui.Menu.setAsMenu(_MainMenu, true); //2nd paramter is Overwrite=true
instead of this:
var _MainMenu = air.ui.Menu.createFromXML("source/MainMenu.xml");
air.ui.Menu.setAsMenu(_MainMenu);//No second parameter specified, so assumes Overwrite=false
Adding the 2nd 'true' parameter still causes the menu to be created everytime, but it will OVERWRITE the previous menu, so there will only ever be one instance of the menu.
Depending on the size of the menu, it would probably be less cpu intensive to just use somekind of IF statement to determine if it already existed, but if that does not exist, then this is the only alternative I can find right now.
Thanks
Similar Messages
-
How to check if file already exist in application server?
Hi there,
Does anyone know a quick way to check if a file has already exists in an application server?
Thanks in advance.
Cheers.Call the function PFL_CHECK_OS_FILE_EXISTENCE.
Best regards Jack
FUNCTION PFL_CHECK_OS_FILE_EXISTENCE.
""Lokale Schnittstelle:
*" IMPORTING
*" FULLY_QUALIFIED_FILENAME LIKE TPFHT-PFFILE
*" EXPORTING
*" FILE_EXISTS LIKE BTCH0000-CHAR1
OPEN DATASET FULLY_QUALIFIED_FILENAME FOR INPUT.
IF SY-SUBRC EQ 0.
FILE_EXISTS = 'X'.
CLOSE DATASET FULLY_QUALIFIED_FILENAME.
ELSE.
CLEAR FILE_EXISTS.
ENDIF.
ENDFUNCTION. -
How to check if Message already exists in the queue and if message is processing currently
Hi everyone
I am new to Azure and worked on adding messages to the queue through workerrole1. Worker role 2 pulls them out from queue and processing them and de-queing them.
Worker role1 runs method gets called after every 10 seconds and puts messages in queue
CloudQueueMessage
message = newCloudQueueMessage(oAzureWorker.WorkerInstanceOf
+ "_"+ oAzureWorker.AgentId.ToString()
+ "|"+ ExecutionId.ToString());
queue.AddMessage(message);
Worker role2 runs method gets called after every 10 seconds too and checks the queue like this
foreach
(CloudQueueMessagemessage
inqueue.GetMessages(20,
TimeSpan.FromMinutes(5)))
// Process all (20) messages in less than 5 minutes, deleting each message after processing.
// Process message
queue.DeleteMessage(message);
Following are my questions
1) How do I check in worker role1 if the message is already in queue, Because I don't want to queue it back again if its not yet processed and is in the queue already
2) How do I check in worker role1 if the message is currently processing. Because I don't want to queue it back again.
3) How do I make sure that ALL the messages get processed in the order they are inserted. I know Queue is FIFO, but I know if the message gets delayed in processing another instance can pick it up, even if it gets picked up by another instance, I want to
make sure that the order remains.
Right now the instances of both these worker roles are 1, in the future when we increase them, I don't want them to queue the same messages multiple times or queue them if the message is already in process mode.Hi Sarah,
I agree to the Frank's suggestion. Why you need to burden the worker role 1 to check if the message really sits on the queue or not? You can do this simply in your code before pushing it on queue instead querying queue.
All you need to do on worker role 1 is - push the message on the queue and forget as the entire queue design in azure is designed from asynchronous processing.
About worker role 2 - Use the GetMessage method which hides retrieved message's from other clients and hence makes sure that only one client is processing it at a time. If processing is successful - delete the message. if it is not - the message will be
visible anyways after the mentioned time provided in the GetMessage method.
I agree that when you will increase number of instances of your worker role 1 which might insert duplicates in the queue - in that case - you might need to introduce the shared entity (like database) and let all instances communicate through it to avoid
the duplication of messages on queue.
Bhushan | http://www.passionatetechie.blogspot.com | http://twitter.com/BhushanGawale -
How do I make my already existing check boxes on a (PDF Document) checkable - So I can check and uncheck them on PDF Expert or Annotate 101.
I am using ADOBE Acrobat PRO with millions of options, but no easy "here is how to do the one thing you want to do" anywhere within reason.
Please help me.
Thank YouCan you check and uncheck the boxes in Acrobat?
-
Please help me how to check a material does existed group code in system (w
Hi all,
Please help me...
I have inputted quantity for tx MC 94 but when I input them into tx MC94, I met a message " Structure not yet maintained for this conbination characterstics". Step by step to show a error message as below:
Step 1: Launch MC 94
step 2: Enter Planning
Step 3: Enter Prod.Code. Material (ex: enter material code :0101010260008, this code is existed Prod.Code )
Step 4: Click on "Inactive Version " button
==> A error message is showed.
Please help me how to check a material does existed group code in system (which table to check it)?
How to record the message" Structure not yet maintained for this conbination characterstics" to catch up it in my program?
Thank in advance.Karenloria,
1. Check in MC8C, which Infostructure is used for Planning type "Planning" or the one you are entering in the intial screen of MC94.
2. Using transaction MC63 for the infostructure identified in step 1, check the planning hierarchy maintained. If this product is not maintined maintain using MC62.
You can also check using SE16 transction the current infostructe records(Plan) for the table name = infostructure identified in step 1.
Regards,
Prasobh -
JavaScript: How to check if a file exists.
Hello Everybody,
Can you tell me how to check if a file exists using JavaScript and Internet Explorer.
Browsing on this website I could read about the command "f.exists()" and it was necessary to include "java.io.*".
Should I use this same command and should I include the same files? Or are there other files and other commands?
Thanks in advance.sorry ya. there is no command to check whether a file exists using javascript. The following code says the object name and value. But it can't say whether the file exists in the harddisk or .. Javascript cannot access database and system resources. If the file exists or not can be checked through the application (ASP, CFML, ..) you are using.
-
How to check whether a file exist in the program folder or not?
Hi guys,
how to check whether a file exist in the program folder or not? Let is say i recieve a file name from user then i want to know if the file is there not and act on that base.
abdulLook at the class java.io.File and the .exists() method:
http://java.sun.com/j2se/1.4/docs/api/java/io/File.html -
How can we check the data already exists in database
hi friends
i am trying create one procedure to add customers in database with customer id as input parameter..but if in the database customer detail already exists than i would like to update that detail and if its not in the database than i would like to add that detail in the databse...how could i do this ...
any help wpould be appreciate
thanks
rommyHi,
If your requirement is to insert in one table and if the record exists insert into other table the merge statement doesn't work
Example (please check the column name and parameter names). I don't put commit or rollback because I don't know if you control the transaction inside this procedure or outside it.
CREATE OR REPLACE PROCEDURE add_cust(I_CUST_ID IN VARCHAR2,
I_CUST_F_NAME IN VARCHAR2,
I_CUST_L_NAME IN VARCHAR2,
I_CUST_ADD IN VARCHAR2,
I_CUST_CITY IN VARCHAR2,
I_CUST_STATE IN VARCHAR2,
I_CUST_ZIP IN VARCHAR2,
I_CUST_DOB IN DATE,
I_CUST_ IN VARCHAR2,
I_CUST_ACCT_TYPE IN VARCHAR2,
I_START_BAL IN NUMBER) IS
BEGIN
INSERT INTO CUSTOMERS C
(CUST_ID,
CUST_F_NAME,
CUST_L_NAME,
CUST_ADD,
CUST_CITY,
CUST_STATE,
CUST_ZIP,
CUST_DOB,
CUST_)
VALUES
(I_CUST_ID,
I_CUST_F_NAME,
I_CUST_L_NAME,
I_CUST_ADD,
I_CUST_CITY,
I_CUST_STATE,
I_CUST_ZIP,
I_CUST_DOB,
I_CUST_);
EXCEPTION
WHEN DUP_VAL_ON_INDEX THEN
INSERT INTO CUSTOMER_ACCT
(CUST_ID,
CUST_ACCT_NO,
cust_acct_type)
VALUES
(I_CUST_ID,
CUST_ACCT_SEQ.NEXTVAL, -- CUST_ACCT_SEQ is a sequence, isn't?
I_CUST_ACCT_TYPE);
END add_cust;Regards, -
How to check whether portal user exists or not using UM API.
Hi Experts,
Let us say i need to create an user account "PortalUser",i know how to create an user,setting first name,lastname,password for that.
but here before creating the portal user, i need to check whether that user exists or not.If user already exists ,then i need to skip the below for creating the user.
IUserFactory userFact = UMFactory.getUserFactory();
IGroupFactory groupFact = UMFactory.getGroupFactory();
IRoleFactory roleFact = UMFactory.getRoleFactory();
IUser tuser = userFact.getUserByLogonID("PortalUser");
IUserMaint newUser = userFact.newUser("PortalUser");
newUser.setFirstName("PortalUser");
newUser.setLastName("Test");
newUser.setEmail("PortalUser.Testatgmaildotcom");
//Locale PortalLanguage = new Locale(Lang.toLowerCase(), "");
Locale PortalLang=new Locale("en");
newUser.setLocale(PortalLang);
newUser.save();
newUser.commit();
IUserAccount userAcc = UMFactory.getUserAccountFactory().newUserAccount("PortalUser", newUser.getUniqueID());
userAcc.setPassword("test1test$");
userAcc.save();
userAcc.commit();
Thanks in advance.
Thanks
Sony.Hi,
Try this code,
IUserFactory factory = UMFactory.getUserFactory();
IUser user = factory.getUserByLogonID(userId);
lastName = user.getLastName();
firstName = user.getFirstName();
refer this pdf,its very helpful
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/events/webinars-nw-rig/using%20the%20user%20management%20api%20with%20ep%20applications%20-%20webinar%20powerpoint.pdf
Regards,
Sunaina Reddy T -
How to check if the path exists and if not, create it
I'm trying to check if the path given by the user already exists. In case it doesn't, I'd like to create a folder with name given in the same directory.
Let's say path_1: "C:\folder1" and path_2: "C:\folder2", and suppose that folder1 exists but folder2 doesn't. Then if the path given by the user is the path_1, then ok, nothing happens, but if it is the path_2, then the programm should realize that it doesn't exist in C:\ and should ask you whether you want to create it or not.
I know how to do that for files, but not for folders!
Thanks in advancehi guys,
i`m new at this so im gonne prob. ask a noob`s question...
i have the same issue as in the title.
but when i run :
int a,b,c,d,folderexist=-1;
switch (event)
case EVENT_COMMIT:
GetCtrlVal (panelHandle, PANEL_NAME, name);
folderexist = GetFileAttrs (name, &a, &b, &c, &d);
if (folderexist==-1)
MakeDir (name);
sprintf...........
else.......
if the folder do exists it works perfectly.
if it doesnt - it breaks the run and gives me the message :
NON-FATAL RUN-TIME ERROR: "NewScap.c", line 317, col 27, thread id 0x00001B98: Library function error (return value == -1 [0xffffffff]).
(and mark the getfileattrs line in blue)
and when i check the "folderexits" value it shows 2!? not 1 not 0 not even -1, but 2...
can somone please help ?
thanks
Adi. -
How to check if the table exists in teh database
Hi,
I am using MS Acess and how do i check using the query if the table already exist in the db?
What is the exact query. Can any one help me.
Thanks
DeeptiThis will do it for you and print out the results using JDOM. - %
package database;
import org.jdom.Document;
import org.jdom.Element;
import org.jdom.output.XMLOutputter;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
public class TableLister
public static final String DRIVER = "sun.jdbc.odbc.JdbcOdbcDriver";
public static final String DATABASE = "jdbc:odbc:DRIVER={Microsoft Access Driver (*.mdb)};DBQ=C:\\Documents and Settings\\Michael\\My Documents\\Projects\\Java\\Forum\\data\\DataConnection.mdb";
public static final String USERNAME = "admin";
public static final String PASSWORD = "";
public static void main(String[] args)
Connection conn = null;
ResultSet tables = null;
String driver = "";
try
driver = ((args.length > 0) ? args[0] : DRIVER);
String url = ((args.length > 1) ? args[1] : DATABASE);
String username = ((args.length > 2) ? args[2] : USERNAME);
String password = ((args.length > 3) ? args[3] : PASSWORD);
Class.forName(driver);
conn = DriverManager.getConnection(url, username, password);
DatabaseMetaData meta = conn.getMetaData();
// Bring back ALL tables and views, including SYSTEM tables.
tables = meta.getTables(null, null, null, null);
ResultSetMetaData rsmd = tables.getMetaData();
int numColumns = rsmd.getColumnCount();
List columnNames = new ArrayList();
for (int j = 0; j < numColumns; ++j)
columnNames.add(rsmd.getColumnName(j + 1));
Element root = new Element("tables");
int tableCount = 0;
while (tables.next())
Element table = new Element("table");
table.setAttribute("id", Integer.toString(++tableCount));
for (int j = 0; j < numColumns; ++j)
Element column = new Element((String) columnNames.get(j));
column.setText(tables.getString((String) columnNames.get(j)));
table.addContent(column);
root.addContent(table);
conn.close();
Document doc = new Document(root);
XMLOutputter outputter = new XMLOutputter(" ", true);
System.out.println(outputter.outputString(doc));
catch (ClassNotFoundException e)
System.err.println("Couldn't load JDBC driver class " + driver);
e.printStackTrace();
catch (SQLException e)
System.err.println("SQL state: " + e.getSQLState());
System.err.println("SQL error: " + e.getErrorCode());
e.printStackTrace();
catch (Exception e)
e.printStackTrace();
finally
close(tables);
close(conn);
public static void close(Connection c)
try
if (c != null)
c.close();
catch (SQLException e)
e.printStackTrace();
public static void close(Statement stmt)
try
if (stmt != null)
stmt.close();
catch (SQLException e)
e.printStackTrace();
public static void close(ResultSet result)
try
if (result != null)
result.close();
catch (SQLException e)
e.printStackTrace();
} -
How to test Resource account already exist
Hi,
I am creating new createResourceAccount workflow. In my form user enters resource account Id and other information. I want to check, whether given resource acccountId already exist in the resource. If so I would like to display some error in the form. How can I check this. Where as we have to funcionality to test Ligthouse account exist or not.
My resource is Oracle.
I appriciate your help.
thanks
Neopal.Hi vinhant,
Thanks for your reply. I tried listResourceObjects but it doesn't work. If you have any code sample, could you post it.
thanks
Neopal. -
How to check if a constraint existed in the table and drop it?
Hi all,
I want to drop a constraint from a table. I do not know if this constraint already existed in the table. So I want to check if this exists first.
Below is my query:
DECLARE
itemExists NUMBER;
BEGIN
itemExists := 0;
SELECT COUNT(CONSTRAINT_NAME) INTO itemExists
FROM ALL_CONSTRAINTS
WHERE UPPER(CONSTRAINT_NAME) = UPPER('my_constraint');
IF itemExists > 0 THEN
ALTER TABLE my_table DROP CONSTRAINT my_constraint;
END IF;
END;
Here is the error I got when I executed the above query:
ORA-06550: line 11, column 5: PLS-00103: Encountered the symbol "ALTER" when expecting one of the following: ( begin case declare exit for goto if loop mod null pragma raise return select update while with <an identifier> <a double-quoted delimited-identifier> <a bind variable> << continue close current delete fetch lock insert open rollback savepoint set sql execute commit forall merge pipe purge
Please help me with this!
Greatly appreciate!
Khoi LeYes, I also tried to put the pl-sql in the Execute Immediate. However, the error still remains
EXECUTE IMMEDIATE 'DECLARE
itemExists NUMBER;
BEGIN
itemExists := 0;
SELECT COUNT(CONSTRAINT_NAME) INTO itemExists
FROM ALL_CONSTRAINTS
WHERE UPPER(CONSTRAINT_NAME) = UPPER('my_constraint');
IF itemExists > 0 THEN
ALTER TABLE my_table DROP CONSTRAINT my_constraint;
END IF;
END';
I execute the above code via running the batch file.
Here is the error after I ran the batch file:
ORA-06550: line 11, column 5:
PLS-00103: Encountered the symbol "ALTER" when expecting one of the following:
( begin case declare exit for goto if loop mod null pragma
raise return select update while with <an identifier>
<a double-quoted delimited-identifier> <a bind variable> <<
continue close current delete fetch lock insert open rollback
savepoint set sql execute commit forall merge pipe purge
The symbol "lock was inserted before "ALTER" to continue.
ORA-06550: line 11, column 53:
PLS-00103: Encountered the symbol "DROP" when expecting one of the following:
. , @ in <an identifier>
<a double-quoted delimited-identifier> partition subpartition
ORA-06512: at line 2117
I can not manually drop it. I need to do this via running an update script file.
Is there a different way to accomplish this?
Thank you very much! -
How to check if function module exist
Hi All!
Does anyone know how to check if function module, which name is provided by the user, exists?
I have to execute a function but when user provides a incrrect name - i receive a short dump. I would like to chceck if this function exists before execution and if not - warn user with message box.
Thanks
TomekREPORT z_tmtest MESSAGE-ID zz.
PARAMETER: a_fname LIKE tfdir-funcname.
PERFORM test_fun_exist USING a_fname.
FORM test_fun_exist *
Test FM Exists
FORM test_fun_exist USING f_funcname LIKE tfdir-funcname.
CALL FUNCTION 'OM_FUNC_MODULE_EXIST'
EXPORTING
function_module = f_funcname
EXCEPTIONS
not_existent = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE e001.
ENDIF.
ENDFORM. -
How to check if a tuple exists
Hello everybody,
I want to check in a pl/sql-tgrigger if a tuple exists in a table.
The logical idea is something like that:
IF :new.firstname NOT IN (SELECT firstname FROM customer) THEN
dosth;
END IF;
This construct is unfortunately not possible ;-)
What is the correct way to solve my problem?
Thanks in advanceHello,
I understood your question in the following way
a) you want to check the firstname is
already existed or not
b) if not exists you want to execute
a procedure "dosth"
If I understood properly, follow the given method
Step 1: set feedback off
Step 2: alter table customer add unique(firstname);
Step 3: create or replace view customer_v
as select * from customer;
Step 4:
create or replace trigger exists_check
instead of insert on customer_v for each row
begin
insert into customer(firstname)
values(:new.firstname);
dosth;
exception
when dup_val_on_index then
dbms_output.put_line('Already Exists');
end;
Step 5: insert into customer_v(firstname)
values('scott');
(if "scott" already exists the trigger displays the message otherwise executes the procedure "dosth")
If any wrong in my understanding, please explain the question clearly.
Regards
Sailaja
Maybe you are looking for
-
Adobe Flash Player not installing after downloading
Windows Vista Firefox 25.0.1 Flash Player 11.3 My Firefox browser has a red symbol that says "Outdated Adobe Plug-in" Block or continue allowing? Or another time it says to update. It takes me to the download centre, I download the flash, install it
-
Install Back office on WLS 10.3.5
Hi All, I want to create a Domain and then a managed server. On this managed server I want to install OR-Back Office. I need to do all of this in silent mode(command prompt.) i know i can create domain using unpack command from command prompt but don
-
Detail Project Plan for R12.1 upgrade
Dear Experts, Let me update you that I have been appointed as a Project Manager for one of the R12.1 upgrade project. Can you guys help me in preparing the R12.1 upgrade detail project project plan ? Regards Mohammed.
-
Updating to Tiger...RAM issue
hi I only have 128mb of ram in my emac and tiger says you need 256mb. Stupid question, but if i get tiger regardless of this, will it mess up my emac because i wont have enough RAM? what would happen if i installed it? Please reply
-
Help needed for WiFi connection problem
Hello My wife's iPad2 with current iOS 8.3 sometimes will not connect to Wi-Fi - any ideas on how to correct the problem? It's inconsistent! Thanks for any thoughts about this. David