Spotlight search dialog fails to display

Mac OS X Spotlight

Spotlight occasionally fails to display the search dialogue when activate. This incorrect behaviour can easily be fixed.

Spotlight is activated by pressing Cmd-Spacebar or clicking the Spotlight icon on the menu bar. This brings up a search dialogue (or sheet, in Mac OS X lingo) where the keywords are entered. However, on occasions this dialogue is not displayed although the user input is recognised and processed.

The way to fix is is to delete or rename com.apple.systemuiserver.plist located under
~/Library/Preferences.

Then, restart the computer.

How to use multiple triggers in RIFE

RIFE has a concept of inheritance whereby an element (or controller) inherits the behaviour of another. This comes in handy when certain actions need to be performed before the requested element is executed, for example, password protected pages that are accessible only if the user is authenticated.

To support inheritance, RIFE provides child triggers, which are inputs or cookies. Those are checked by the engine to determine whether a child element can be executed or not based on some business logic. Child triggers are defined in the structure of the inherited element.

In the above example, authid is declared as the child trigger. The implementation, *example.Login*, needs to contain the childTriggered(String name, String[] values) method which is called automatically to determine the child element should be executed or not.

As can be seen, the developer is responsible for checking what child trigger is being passed. Also, raw access to the element context information is prohibited within this method since the developer could otherwise corrupt the execution flow along the inheritance path. Also, childTriggered is called separately for each child trigger.

Multiple child triggers can be declared for an inherited element. If the check depends on each one separately, it is straightforward to implement childTriggered. However, if the check involves a combination of those, for example, if a cookie value needs to be validated against a query string parameter, the task becomes slightly more complicated.

To cater cases such as the latter one, the order of declaration of child triggers in the element structure becomes important. Say, one has to implement the hypothetical scenario as above.

Here, the username cookie value needs to match that in the current session identified by authid. However, since the engine calls childTriggered separately for each child trigger, the outcome of processing username needs to be retained until authid has been processed.

The engine, by default, executes a child element if childTriggered returns true for at least one of the child triggers. The trick is to order the declarations of those in the same order as you wish them to be processed and NOT to return true until the last trigger is.

This is possible by using a field of the element class to store a value that is used by the two childTriggered calls. The code for given example could be like this:

RIFE element inheritance removes the burden of implementing this kind of security checks from the developer. It also makes the code cleaner because one does not have to write the logic in each element, which would otherwise result in a complex [Java] inheritance hierarchy.