As mentioned in JavaCard 2.2 APIs documents here, selectingApplet() is a method that is used by the applet process() method to distinguish the SELECT APDU command which selected this applet, from all other SELECT APDU commands which may relate to file or internal applet state selection and it returns true if this applet is being selected.
My question is that Why we need this method? and even more general : Why the selected applet need to receive SELECT-applet commands? I think the only entity that need to know SELECT-applet APDUs is JCRE.
I suggest the below scenario :
JCRE receive the APDU command from the CAD
Check it to see if it is a SELECT APDU command or not.
If it is not a SELECT APDU command, It sends the received APDU to the process() method of selected Applet. and the selected applet interpret and execute it (using switches and if expressions and no need to use selectingApplet() method)
if it is a SELECT APDU command, check the length of the Data Field of the command to see if it is a SELECT File or it is a SELECT Applet.
if it is SELECT File command, JCRE send it to the process() method of selected applet again. but if it is a SELECT Applet coomand, JCRE invoke deselet() method of currently selected applet and then invoke select() method of the new requested applet. and after receiving True, make it selected and wait for next APDU command.(and even no need to send the previous SELECT-Applet APDU command to process() method of this new selected applet)
What is wrong with the above implementation? and what is the advantages of current implementation in JC 2.2 (that sends all the receive APDUs to the process() method of currently selected applet and the selectingApplet() distinguish different SELECT commands)
I think the current implementation providing a vulnerability! if a programmer implement his/her applet in a way that its process() method writes all of received APDUs in EEPROM, the he/she can retrieve AID of some other installed applets on the card. is this right?
You can use SELECT to distinguish between default selection after an ATR (a Global Platform option) and normal selection though SELECT. In other words, distinguish between being in the MF or application DF. The method select() will be called in both cases.
Furthermore, SELECT where P1 is different from 04 may return (FCI/FCP) data to the terminal. The runtime would not know what to return, as that is application specific.
selectingApplet() is very useful as you can immediately see that the Applet actually got (re-)selected with this method. If the applet gets reselected you may want to do some internal housekeeping, but you certainly don't want to return a status word indicating an error. An error would indicate that the APDU failed and this is inconsistent with the fact that the applet was selected by the runtime.
Regarding your last point: no.
Because of the APDU is a valid AID of another applet, the JCRE will recognize that fact and not direct it to the current applet but deseclect the current applet and select the other applet referenced by the AID and call selectingApplet().
The selectingApplet() method is the only way that the applet knows it got selected in just this current APDU.
For example, it can be used to reset some file pointers or reset Securemessaging and other authentication status.
edit: i was referring to the default applet template, that goes like this:
process(){
if(selectingApplet()){
return;
}
So actually the method is just returning a boolean and in fact the normal process method is called but immidiatly terminated/finished or whatever.
On the other hand, select() method can be overwritten by the applet which will be called the first time its gets selected. There are no major diffrences between them(that i know) except that select gets called prior and can deny selection of th applet thus is more powerful(Might be useful for Interapplet communication)
Related
I want to create a button factory that creates buttons by a specific configuration as parameters. The button have to emit a signal if there is pressed. I can't find any method to add that functionality programatically.
I know, that i can add buttons by the editor and add that function to it by a script. But with a factory, i don't need to add every button by my self.
Big thanks!
Buttons emit a signal when they are pressed, it is called "pressed". That is not a functionality you need to add.
Perhaps what you need is something else? The Godot editor is built on the same API as your game, so you can do from code virtually anything the editor can do… such as…
You can add a script from code
If you need to add a signal, the usual way is to attach a script that has the signal declared and the logic to emit it.
If you have such script created, you can load or preload it in your code, and then attach the script to the Object you want (with set_script). There is also a get_script method to retrieve it. And a "script_changed".
And yes, you can create scripts from code too. Create a GDScript object, set its source_code, and reload it. Then you can attach it to an Object just as if you had loaded it.
By the way, the script is a Resource which is why you can load it or preload it. See also ResourceLoader. It also means that you can save it with ResourceSaver. However, I remind that resource paths aren't always writable.
You can add signals from code
Yes, you can add dynamically signals from code. I mean custom signals that are not declared in a script, and that could be added at any moment. To do that you call add_user_signal on the Object. You can check with has_user_signal (use has_signal if you don't care if it was added with add_user_signal or not). And no, there is no remove method for these. So use these sparingly and with intent.
By the way, you can get an Array of all signals on an object with get_signal_list.
You can emit signals from code
You do that you can call emit_signal.
And you can call it on other objects too (I mean, you don't have to call emit_signal from an script attached to the Object that has the signal, it can be from a different one).
You can manage connections from code
I also remind you that you can connect a signal with the connect method. See also disconnect and is_connected.
Oh, and you can query the connections with get_incoming_connections and get_signal_connection_list (Here is an example, it also demonstrates get_signal_list). No, you don't need to worry about disconnecting the signals when freeing the object. Godot takes care of that.
And you can block signals too
You can have an object block its signals with set_block_signals, and check with is_blocking_signals. I - personally - haven't used this, never had the necessity. I just mentioning it for completeness sake.
I am trying to enter a password into a Citrix window using global send key events and the username works fine, but I cannot send a password as is. My guess is that I would need to create individual key events for each special character, but that would reveal too much of the password in the design of the action.
Is there another approach?
I don't know how it is specifically with Citrix, but I do know RDP blocks certain SendKey events as a security precaution. In either case, you should be able to leverage AutoHotKey via command-line to get around it.
So you need first to create the object to accept the pass that will be inserted into the field. In the start of the object insert the pass as text, do all the required steps and in the process collect the dynamic pass and import it into the object (when you create the action by assigning the right business object, that you created already). Hope I made my self clear.
Then in the Global Send Keys Events action put the variable of the pass you want to type and that is it.
Used "^%{L}" for performing cntrl+Alt+L in BluePrism but the required window is not opening up, the command is working fine in general when executed manually.
First of all, you need to make sure that you are following the appropriate steps to send keys to an application. The recommendation is to first activate the application (this ensures the keys are sent to the proper application), then use a wait stage (this ensures that BluePrism is sending the keys at the right time; i.e. when the application is ready to accept keys), then use the navigation stage on the root application where the send keys is located, something like this:
(If you are typing in a specific field in the window, then use an additional Focus navigation stage on the Field itself before sending keys).
Within the navigation stage, you have two possible options to send keys:
Global Send Keys
Global Send Key Events
Global Send Keys
You can find the official guide (section 10.2) on the BluePrism portal. It doesn't really detail the sending of combination keys for Global Send Keys, but you really have to do it like this:
^(%l)
Do note that if you send ^(%L), this is similar to sending Ctrl+Alt+Shift+L. The parens indicate that for the keying of %l, Shift is held down. The above is equivalent to ^(%(l)). Normal keys do not require braces either, and they cause issues if used in Global Send Key Events (i.e. {L} means Shift+L in Global Send Keys, but will give you an error in Global Send Key Events).
The relevant part of the guide:
So what you were doing with ^%{L} didn't really make sense to BluePrism. It was probably sending Ctrl+Alt, then separately Shift+L (I cannot really confirm this, but this is my guess following testing on BluePrism which definitely show it doesn't work, however).
Global Send Key Events
You can find the documentation in the same guide and section I linked earlier. This time, it does show exactly how to send combination keys, so for your case, the other option with Global Send Key Events will be:
<{CTRL}<{ALT}l>{ALT}>{CTRL}
I don't really like Global Send Key Events because it's longer to type and you have to be careful about more things, but essentially, it becomes easier if you type the opening and closing syntax before proceeding with the next key. For example to do the above, it's easier to first type <{CTRL}>{CTRL}, then insert the ALT part in the middle: <{CTRL}<{ALT}>{ALT}>{CTRL}, then insert the l (do note here that l and L are equivalent here, which is also weird considering that they are not in Global Send Keys).
I presume that it's a GLOBAL SEND KEY EVENT value that you're looking for.
This is shift+I action value:
"<{SHIFT}I>{SHIFT}"
I would try for ctrl+Alt+L maybe something like this:
"<{CTRL}{ALT}L>{CTRL}"
the "<" & ">" is Push down & Release
Global Send Keys is going to send the keys to whatever application has focus on screen, so I would recommend:
Set focus on the desired window by either using a Navigate stage to "Activate Application" or "Global Mouse Click".
Use Global Send Keys
Keep in mind that a Global Mouse Click could again result in something unexpected as its sending the event directly to the screen, and another application/window might be covering the area you've just clicked.
For more info on Global Send Keys and Global Send Keys Event I would read the BluePrism manual for this: Send Keys and Send Key Events
It might also be worthwhile studying some surface automation principles as it can help get you a better understanding of what these Global actions are doing: Introduction to Surface Automation
Activate the application using navigate stage.
Add a 1sec wait between activate and send keys.
Use global send keys event. <{ctrl}<{alt}L>{alt}>{ctrl}
Ensure you are using the root element in Application Modeller (the first at the top of the list) and not any of the child elements. Use a navigate stage with that element and either Global Send Key or Global Send Key Event action. The syntax "^%{L}" is otherwise correct, although you don't say what is it that you are trying to automate (Excel, Word, IE, Citrix...??).
Try to use Global SendKey instead of G.S.Events. I.e. SHIFT+HOME = "+({HOME})"
regular brackets needed for blue prism to understand where to release Shift ("+").
I have created an Xpage to allow the administrator to input a single Notes Document (They are Contracts) ID into an edit box and press a button to delete the Contract. The delete calls an Agent passing the Contract ID. Below is the button script and then the relevant part of the Agent. What is happening is only the first character is being passed to the Agent, i.e if the Contract ID is 9MXCB4 only "9" is being passed as the Agent message box prints this to the log. What am I doing wrong here? If I hard code a Contract ID after the message box the Contract is processed correctly.
Button code
ag = database.getAgent("DeleteOneContract");
noteid = getComponent("ContractIDDelete").getValue()
ag.run(noteid)
Part of Agent code
Dim runAgent As NotesAgent
Dim deleteID As Variant
deleteID = runAgent.Parameterdocid
MsgBox "Input is " & deleteID
'If line below is uncommented it processes the Contract correctly
'deleteID = "9MXCB4"
' Rest of agent process
....
Note that I have also tried runAgent.Target and runAgent.Query
Just tested that and when I pass it a valid NoteID, the agent reads it just fine. I don't think you can pass any other value than a NoteID to the agent this way.
An alternative might be to use the agent.runWithDocumentContext(doc) method and retrieve the document before sending it to the agent.
I believe that the note ID parameter has to actually be a hexidecimal number in string form. It doesn't have to line up with an actual note ID in the database, but it can only contain 0-9 and A-F (with presumably a cap on size).
To add an extra thought on Jesse's and Mark's correct answers: from AJF's question we cannot tell whether the Xpage is bound to an actual NotesDocument object, or whether it is a (temporary) stand-alone page. In that case, of course, agent.runWithDocumentContext won't work.
But unless you have a good reason to perform the rest of your task using a LotusScript coding: why use an agent in the first place? Why not perform the deletion directly using SSJS code? On the Xpages side of the process you most probably will have to start with SSJS code very similar to Mark's example, but then why not go ahead and finish it off with two or three more lines?
In fact I try to avoid calling agents directly from my Xpages driven applications, due to performance issues, and because I don't like my code to be scattered all over the place.
The below diagram is based on an android application. When the application loads the user is given 3 button to select add, update and Search. On click on add button the user is given an option to add a new user or add a new item. When the user selects the add item option he enters the required data. Once the data is entered the system check if all the values are entered is correct. if it is correct it is saved if not the user is asked to re-enter the values.One the data is saved the user is asked to write the asset id to an NFC tag.
The same process is applied for update section.
In the search the user is given 2 option to either search the asset through text or by tapping the NFC device onto the NFC tag to search the desired item from the database.
I wanted to know if the sequence diagram I have done is correct.
I would remove the Choose an Option messages. The machine does not trigger anything at the actor. It's the actor who decides. So the initial message always comes from the actor.
The Return Result is implicit with the dotted line. Instead describe what is being returned.
Finally (and most important) you do not use objects but classes in your SD. Always (!) use objects since its an object which communicates, not a class.