Using Tab Expansion
Command-line shells often provide a way to complete the names of long files or commands automatically, speeding up command entry and providing hints. Windows PowerShell allows you to fill in file names and cmdlet names by pressing the Tab key.
Note:
Tab expansion is controlled by the internal function TabExpansion. Since this function can be modified or overridden, this discussion is a guide to the behavior of the default Windows PowerShell configuration.
To fill in a filename or path from the available choices automatically, type part of the name and press the Tab key. Windows PowerShell will automatically expand the name to the first match that it finds. Pressing the Tab key repeatedly will cycle through all of the available choices.
The tab expansion of cmdlet names is slightly different. To use tab expansion on a cmdlet name, type the entire first part of the name (the verb) and the hyphen that follows it. You can fill in more of the name for a partial match. For example, if you type get-co and then press the Tab key, Windows PowerShell will automatically expand this to the Get-Command cmdlet (notice that it also changes the case of letters to their standard form). If you press Tab key again, Windows PowerShell replaces this with the only other matching cmdlet name, Get-Content.
You can use tab expansion repeatedly on the same line. For example, you can use tab expansion on the name of the Get-Content cmdlet by entering:
PS> Get-Con<Tab>
When you press the Tab key, the command expands to:
PS> Get-Content
You can then partially specify the path to the Active Setup log file and use tab expansion again:
PS> Get-Content c:\windows\acts<Tab>
When you press the Tab key, the command expands to:
PS> Get-Content C:\windows\actsetup.log
Note:
One limitation of the tab expansion process is that tabs are always interpreted as attempts to complete a word. If you copy and paste command examples into a Windows PowerShell console, make sure that the sample does not contain tabs; if it does, the results will be unpredictable and will almost certainly not be what you intended.
Posted in: Software| Tags: PowerShell Expansion Control Internal Function TabExpansion Configuration Sligntly actsetup IntendHow to: Enable Local Cache (Code) (Velocity)
To programmatically enable local cache when creating your cache client, you must make sure the localCache parameter in the DataCacheFactory class constructor is equal to true. For more information about the application configuration settings, see Application Configuration Settings (Velocity).
Note
These procedures assume that you have already prepared your development environment and set references to the "Velocity" assemblies, and so on. For more information, see How to: Prepare the Development Environment (Velocity)
To create a cache client that has local cache enabled
Create an array of DataCacheServerEndPoint objects to specify the cache hosts for the client.
Configure your cache hosts by assigning the cache host array from the previous step to the servers parameter of the DataCacheFactory constructor. Note: For performance reasons, we recommend that you minimize the number of DataCacheFactory objects created in a cache-enabled application. Store the DataCacheFactory object in a variable available to all parts of the application that use cache clients.
Configure your cache client type by assigning a true or false value to the routingClient parameter of the DataCacheFactory constructor. Use the true value for a routing client, or a false value for a simple client.
Enable local cache by assigning a true value to the localCache parameter of the DataCacheFactory constructor.
(optional) Configure your cache client for cache notifications by using the DataCacheFactory constructor with the following additional parameters.
syncPolicy: Use the DataCacheLocalCacheSyncPolicy enumeration to choose how locally cached objects are invalidated. Use TimeoutBased to indicate that a time-out value should be used or NotificationBased to indicate that cache notifications will be used. For more information, see Cache Clients and Local Cache (Velocity).
localCacheTimeout: Use this parameter to specify the number of seconds that an object will remain in local cache before it is invalidated. This parameter is ignored if syncPolicy is set to NotificationBased.
pollInterval: Use this parameter to specify the interval of frequency, in seconds, that the cache client will check with the cache cluster for cache notifications. The default value is 300 seconds. Note: Local cache is not required for cache notifications. For more information, see Cache Notifications (Velocity).
Use the GetCache method to obtain an instance of the routing client.
Posted in: C# and .NET| Tags: Velocity CTP CTP 3 .NET 4.0 Cache Microsoft Application Configuration Code client parameter enable local localcacheHow to: Get Started with a Simple Client (Code) (Velocity)
When you programmatically configure your cache client, the configuration settings are passed to the DataCacheFactory class constructor.
Note
For performance reasons, we recommend that you minimize the number of DataCacheFactory objects created in a cache-enabled application. Store the DataCacheFactory object in a variable available to all parts of the application that use cache clients.
The cache client type is defined by the routingClient parameter in the DataCacheFactory class constructor. For a simple client, the routingClient parameter must be false. For more information about the application configuration settings, see Application Configuration Settings (Velocity).
Note
These procedures assume that you have already prepared your development environment and set references to the "Velocity" assemblies, and so on. For more information, see How to: Prepare the Development Environment (Velocity)
To configure a simple client programmatically
Create an array of DataCacheServerEndpoint objects to specify the cache hosts for the client.
Configure your cache hosts by assigning the cache host array from the previous step to the servers parameter of the DataCacheFactory constructor.
Select a simple client type by assigning a false value to the routingClient parameter of the DataCacheFactory constructor.
Configure local cache by assigning a true or false value to the localCache parameter of the DataCacheFactory constructor. Use the true value to enable local cache or a false value to disable local cache.
Use the GetCache method to obtain an instance of the routing client.
Posted in: C# and .NET| Tags: Velocity CTP CTP 3 .NET 4.0 Cache Microsoft Configuration Code client class datacachefactory constructor configure simpleHow to: Get Started with a Routing Client (Code) (Velocity)
When you programmatically configure your cache client, the configuration settings are passed to the DataCacheFactory class constructor.
Note
For performance reasons, we recommend that you minimize the number of DataCacheFactory objects created in a cache-enabled application. Store the DataCacheFactory object in a variable available to all parts of the application that use cache clients.
The cache client type is defined by the routingClient parameter in the DataCacheFactory class constructor. For a routing client, the routingClient parameter must be true. For more information about the application configuration settings, see Application Configuration Settings (Velocity).
Note
These procedures assume that you have already prepared your development environment and set references to the "Velocity" assemblies, and so on. For more information, see How to: Prepare the Development Environment (Velocity)
To configure a routing client programmatically
Create an array of DataCacheServerEndpoint objects to specify the cache hosts for the client.
Configure your cache hosts by assigning the cache host array from the previous step to the servers parameter of the DataCacheFactory constructor.
Select a routing client type by assigning a true value to the routingClient parameter of the DataCacheFactory constructor.
Configure local cache by assigning a true or false value to the localCache parameter of the DataCacheFactory constructor. Use the true value to enable local cache, or a false value to disable local cache.
Use the GetCache method to obtain an instance of the routing client.
Posted in: C# and .NET| Tags: Velocity CTP CTP 3 .NET 4.0 Cache Microsoft Configuration Code client class datacachefactory constructor configure routing