|
Storing information - III Keyboard buffer
The keyboard buffer is a small area of memory which stores keystrokes that we type till these are interpreted by the operating system and applications. This area is automatically managed by the operating system. Some languages allow you to stuff characters in the keyboard buffer programmatically.
You can use Sendkeys in VB and the Keyboard command in VFP to achieve this. Sendkeys allows one application to send a specified set of keystrokes to another application.
Here is an example:
(Run this as a VBA procedure in Word 97.)
Dim ReturnValue, I ' Run Calculator. ReturnValue = Shell("CALC.EXE", 1) ' Activate the Calculator. AppActivate ReturnValue ' Set up counting loop. For I = 1 To 100 ' Send keystrokes to Calculator SendKeys I & "{+}", True Next I ' Get grand total. SendKeys "=", True ' Send ALT+F4 to close Calculator. SendKeys "%{F4}", True You can also specify the size of this buffer (also called the typeahead buffer) in VFP using the command:
Set typeahead to The default value here is 20 (VFP6), maximum is 30000.
Interestingly, some bar code scanner programs directly stuff the keyboard buffer with the values scanned. This, when co-ordinated with a data entry form, eliminates manual typing.
Video buffer (DirectDraw)
Until recently fast graphics or games with complex scenes were created using MSDOS. This was because, using DOS you could directly write information to the video buffer on the VGA cards.
In Windows, similar functionality is now available using DirectX SDK.
DirectDraw is only one component of the DirectX 5 SDK. DirectDraw was designed for speed; it lets you access the hardware at its most basic level, bypassing the multiple layers normally associated with Windows-based graphics. This makes DirectDraw ideal for game-based programming, where the emphasis is on creating smooth graphics and rendering them to the screen as fast as possible.
Programming using DirectX requires an SDK that is available with a Microsoft Developer Network subscription.
This type of programming is typically used by high performance CAD, CAM, graphics, animation and gaming applications.
External storage devices
This is the most common method of storing information on a persistent or temporary basis. The most common external storage devices are hard disks. However many more storage devices are now available--ZIP drives, flash memory cards, static memory, etc.
It is important to note that some of the temporary storage also occurs on hard disks or similar devices.
Some simple examples are the temporary files created by operating systems, applications, database queries (temporary tables), etc that are stored in the hard disk till they are deleted.
One common problem is that when your application or the machine terminates abnormally, these supposedly temporary files are not deleted. You need to manually remove them to reclaim the space occupied by them.
Most applications and development tools allow you to specify a temporary-files directory. This directory should be shared in a predefined location like \temp. This makes cleanup of temporary files easy.
In-Memory database (COM+) - IMDB
This is an interesting combination of permanent storage and temporary storage. Getting or storing information from hard disks is substantially slower than accessing it from RAM. Therefore, IMDB allows you to keep selected tables in RAM. You can read as well as update these tables. The advantage is that IMDB is that it is about 300 times faster than its hard disk equivalent because of very high access speeds of memory.
IMDB is a part of next version of COM (Component Object Model) called COM+, which will be a part of the Windows 2000 operating system.
Any database table can be used in IMDB to make it memory resident. Your application can then communicate and refer to the IMDB-based table rather than the base data table.
The table can be updated and also be used by multiple users. The IMDB engine will manage all updates automatically. The base tables will be updated using the standard transaction model provided by its data engine. Thus using IMDB for performance sensitive application is a very good option because it provides drastic improvements in performance.
Although a table marked for IMDB is alive only in RAM, it does store changes to the disk storage. Therefore, it has been considered as a mixed storage device.
For more information related to IMDB usage, please refer to the Microsoft web site and search on IMDB or COM+.
Tagging using XML
XML is a notational tag-based language like HTML. HTML is primarily used for describing how things are to be displayed on a web page. XML describes the information contained in the page rather than its appearance.
XML can be a part of a saved page or it can be generated at runtime by creating relevant tags. Therefore, it is a tool available for temporary or permanent data storage.
XML is all about metadata and the idea that certain groups of people have similar needs for describing and organising the data they use. Like HTML, XML is a set of tags and declarations-- but rather than being concerned with formatting information on a page, XML focuses on providing information about the data itself and how it relates to other data.
This is an example where data regarding inventory information is stored as XML.
12983 SEAT SUPPORT 1 BIN 242 General Aerospace http://commerce.general-aerospace.com
XML markup provides a way to identify, exchange, and process any kind of data. The world has many terabytes of information distributed across a vast sea of incompatible information repositories. XML provides the mechanism for exchanging chunks of data with these entities in a mutually understood fashion. Because DTDs (Document Type Definitions) describe distinct collections of XML markup for different data sets, XML markup isn't a single conglomeration of elements where every new element adds to an ever-expanding list. Instead, DTDs enable the creation of an infinite number of distinct vocabularies.
Using XML, you will be able to customise the presentation of the queried data in a fashion most useful to the person making the query. Accounting can view a general ledger output; sales, a bar chart of results by salesperson for the last four quarters; marketing, a pretty pie chart of sales by segment, etc. Once the data has been sent, it can be re-compiled without having to re-access the server. For instance, let's say that the sales team wants to see breakouts by region instead of by salesperson. Just as important, you will be able to compile that information even if it exists on separate databases (as long as the databases use similar data attributes).
MS Message Queue
This is a new method of building applications that do not fail, if MSMQ is implemented.
When you send mail message to another person, the server may not be available. The message stays in the original message database till the other server is available. The delivery is guaranteed even if the network is temporary unavailable and so on.
Message Queueing services (MSMQ) technology enables applications running at different times to communicate across heterogeneous networks and systems that may be temporarily offline. Within an MSMQ enterprise, applications send messages to queues and read messages from queues. These messages are not e-mail messages. These can be transactions that are requested by one machine to another machine. The following illustration shows how a queue can hold the messages used by both sending and receiving applications.
MSMQ is to be used under the following circumstances.
When you have disconnected users-such as when your sales force is working remotely. When guaranteed delivery is important-stockbrokers, for example, may lose millions of dollars if their order entry applications lose even a single order. When you need concurrent execution-when you want to fire off lots of requests for work without dealing with difficult tasks like thread management. When you need to log activity-your actions through MSMQ are automatically journaled. That's good for maintaining audit trails and recovering data. Communications are synchronous when the sender of a request must wait for a response from the receiver of the request before performing other tasks. The time that the sender must wait is completely dependent on the time it takes for the receiver to process the request and return a response.
With asynchronous communications-available through MSMQ-senders make requests to receivers and can then move on to other tasks immediately. If a response is expected back from the receiver, it is up to the original sender to decide when it will actually look for and process the response. Most important, there is no need for a guarantee that receivers will process requests within any particular period of time. In fact, with asynchronous communications, there are no requirements that receivers even be running in order for a sender to initiate a request.
Storing information from an application Registry The registry is a hierarchical storage database that is maintained by the operating system (Windows 95/98/NT). This database is used by the operating system for managing various tasks and to store various types of information. It is also available to developers for using Registry API calls to create storage areas, and store information under various keys.
There are four key stores called Hives. There are multiple root keys available here. To view the registry, you need to use the registry editor (Regedit.exe).
Entry point Use HKEY_CLASSES_ROOT Registry entries subordinate to this key define types (or classes) of documents and the properties associated with those types. Shell and COM applications use the information stored under this key. HKEY_CURRENT_CONFIG Contains information about the current hardware profile of the local computer system. The information under HKEY_CURRENT_CONFIG describes only the differences between the current hardware configuration and the standard configuration. Information about the standard hardware configuration is stored under the Software and System keys of HKEY_LOCAL_MACHINE. HKEY_CURRENT_CONFIG is an alias for HKEY_LOCAL_MACHINE\System\Current ControlSet\HardwareProfiles\Current. This key was introduced in Windows 95 and Windows NT version 4.0. HKEY_CURRENT_USER Registry entries subordinate to this key define the preferences of the current user. These preferences include the settings of environment variables, data about program groups, colours, printers, network connections, and application preferences. HKEY_DYN_DATA Windows 95/98: Registry entries subordinate to this key allow you to collect performance data. HKEY_LOCAL_MACHINE Registry entries subordinate to this key define the physical state of the computer, including data about the bus type, system memory, and installed hardware and software. HKEY_PERFORMANCE _DATA Windows NT/2000: Registry entries subordinate to this key allow you to access performance data. The data is not actually stored in the registry; the registry functions cause the system to collect the data from its source. HKEY_USERS Registry entries subordinate to this key define the default user configuration for new users on the local computer and the user configuration for the current user.
|