Tuesday, March 17, 2020

Understanding and Processing Keyboard Events in Delphi

Understanding and Processing Keyboard Events in Delphi Keyboard events, along with mouse events, are the primary elements of a users interaction with your program. Below is information on three events that let you capture a users keystrokes in a Delphi application: OnKeyDown, OnKeyUp and OnKeyPress. Down, Up, Press, Down, Up, Press... Delphi applications can use two methods for receiving the input from the keyboard. If a user has to type something in an application, the easiest way to receive that input is to use one of the controls that automatically responds to keypresses, such as Edit. At other times and for more general purposes, however, we can create procedures in a form that handle three events recognized by forms and by any component that accepts keyboard input. We can write event handlers for these events to respond to any key or key combination the user might press at runtime. Here are those events: OnKeyDown - called when any key on the keyboard is pressedOnKeyUp - called when any key on the keyboard is releasedOnKeyPress - called when a key corresponding to an ASCII character is pressed Keyboard Handlers All the keyboard events have one parameter in common. The Key parameter is the key on the keyboard and is used to pass by reference of the value of the pressed key. The Shift parameter (in the OnKeyDown and OnKeyUp procedures) indicates whether the Shift, Alt, or Ctrl keys are combined with the keystroke. The Sender parameter references the control that was used to call the method. procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState) ; ... procedure TForm1.FormKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState) ; ... procedure TForm1.FormKeyPress(Sender: TObject; var Key: Char) ; Responding when the user presses shortcut or accelerator keys, such as those provided with menu commands, does not require writing event handlers. What Is Focus? Focus is the ability to receive user input through the mouse or keyboard. Only the object that has the focus can receive a keyboard event. Also, only one component per form can be active, or have the focus, in a running application at any given time. Some components, such as TImage, TPaintBox, TPanel and TLabel cannot receive focus. In general, components derived from TGraphicControl are unable to receive focus. Additionally, components that are invisible at run time (TTimer) cannot receive focus. OnKeyDown, OnKeyUp The OnKeyDown and OnKeyUp events provide the lowest level of keyboard response. Both OnKeyDown and OnKeyUp handlers can respond to all keyboard keys, including function keys and keys combined with the Shift, Alt, and Ctrl keys. The keyboard events are not mutually exclusive. When the user presses a key, both the OnKeyDown and OnKeyPress events are generated, and when the user releases the key, the  OnKeyUp event is generated. When the user presses one of the keys that OnKeyPress does not detect, only the  OnKeyDown event occurs, followed by the  OnKeyUp event. If you hold down a key, the OnKeyUp event occurs after all the OnKeyDown and OnKeyPress events have occurred. OnKeyPress OnKeyPress returns a different ASCII character for g and G, but OnKeyDown and OnKeyUp do not make a distinction between uppercase and lowercase alpha keys. Key and Shift Parameters Since the Key parameter is passed by reference, the event handler can change Key so that the application sees a different key as being involved in the event. This is a way to limit the kinds of characters that the user can input, like to prevent users from typing alpha keys. if Key in [a..z] [A..Z] then Key : #0 The above statement checks whether the Key parameter is in the union of two sets: lowercase characters (i.e. a  through z) and uppercase characters (A-Z). If so, the statement assigns the character value of zero to Key to prevent any input into the Edit component, for example, when it receives the modified key. For non-alphanumeric keys, WinAPI virtual key codes can be used to determine the key pressed. Windows defines special constants for each key the user can press. For example, VK_RIGHT is the virtual key code for the Right Arrow key. To get the key state of some special keys like TAB or PageUp, we can use the GetKeyState Windows API call. The key status specifies whether the key is up, down, or toggled (on or off - alternating each time the key is pressed). if HiWord(GetKeyState(vk_PageUp)) 0 then ShowMessage(PageUp - DOWN) else ShowMessage(PageUp - UP) ; In the OnKeyDown and OnKeyUp events, Key is an unsigned Word value that represents a Windows virtual key. In order to get the character value from Key,  we use the Chr function. In the OnKeyPress event, Key is a Char value that represents an ASCII character. Both OnKeyDown and OnKeyUp events use the Shift parameter, of type TShiftState, a set flags to determine the state of the Alt, Ctrl, and Shift keys when a key is pressed. For example, when you press Ctrl A, the following key events are generated: KeyDown (Ctrl) // ssCtrl KeyDown (CtrlA) //ssCtrl A KeyPress (A) KeyUp (CtrlA) Redirecting Keyboard Events to The Form To trap keystrokes at the form level instead of passing them to the forms components, set the forms KeyPreview property to True (using the Object Inspector). The component still sees the event, but the form has an opportunity to handle it first - to allow or disallow some keys to be pressed, for example. Suppose you have several Edit components on a form and the Form.OnKeyPress procedure looks like: procedure TForm1.FormKeyPress(Sender: TObject; var Key: Char) ; begin if Key in [0..9] then Key : #0 end; If one of the Edit components has the Focus,  and the  KeyPreview property of a form is False, this code will not execute. In other words, if the user presses the 5 key, the 5 character will appear in the focused Edit component. However, if the KeyPreview is set to True, then  the forms OnKeyPress event is executed before the Edit component sees the key that is pressed. Again, if the user has pressed the 5 key, then it assigns the character value of zero to Key to prevent numerical input into the Edit component.

Saturday, February 29, 2020

Free sample - Social Psychology. translation missing

Social Psychology. Social PsychologyIn the field of health psychology, an understanding on how biology, behavior and social context influence an individual’s or group’s health or illness is taken into account. In the last decade, the applicability of health psychology has been advanced and utilized the more, resulting in an increase in doubts cast by critics as to the importance and usefulness of cognitive psychology. Particular models that address memory aspects of visual and verbal information processing with minimal acknowledgement of any sensory modalities have come under heavy criticism. However, research in olfactory memory literature has rapidly expanded since the 1970’s and has risen beyond conventional memory research. Therefore, the literature herein examines principally on the Proustian characteristics of smell and the relationship between olfactory memory and other closely related types of memory. It is key to note that findings from research conducted on olfaction has been consequently used as a base for theories in other fields though caution must be applied so as not to base these general theories on narrowly researched databases. The chief objectives of the study are to investigate the relationship between olfaction and memory and the most remembered olfactory stimuli through a literature review of various articles. In Baddeley’s 1992 fifteenth Bartlett lecture; he expressed a long-standing commitment expressed by most experienced psychologists in devising theories aimed at encompassing data from diverse sources. He expressed that a theory in health psychology should be economical while giving a plausible account of existing findings that bring into light new discoveries in this field. These discoveries should in turn mold the theory through a â€Å"gradual, cumulative modification of the theory.† He further suggested that models should be applied over a wide range of situations or fields; that is scope rather than precision. This notwithstanding, research carried on the basis of findings presented from the Ebbinghaus and Bartlett traditions concentrates chiefly on verbal rather than visual cognition. However, there has been little contemporary support in literature such as in Morris Gruneberg, 1994 which attempted to inspect whether theories and models in human memory, in referen ce to modality, relate to memory phenomena in other sensory modalities such as touch, taste, or smell. Comprehensive reviews carried out on olfactory cognition and its influence by the conven ­tional memory literature such as Richardson Zucco, 1989 and Schab, 1991 shows an interesting analysis and relation to new research areas. The relationship between olfaction and memory can best be illustrated by perception of smell and the triggering of a long-forgotten event. A perfume may remind someone of a long forgotten person. Research carried out by Engen in 1987 claimed that odor memory does not trigger short-term memory which has been contradicted by the 1997 White and Treishman report. Although evidence of olfactory primacy under which stimuli presented at the beginning of a study is best remembered through rehearsal, the report provides a strong base in evidence presented for recency in olfaction. White and Treisman argued on the basis that olfactory memory is a result of individuals assigning assign verbal meanings to olfactory stimuli. The study further claims that olfactory sense is a crucial sense in animals. This is further supported by evidence presented on the existence of peripheral olfactory memory in imprinted salmon which was carried out by Nevitt et. al in 1994. The study found out that the  "remark honing ability of salmon relies on olfactory cues though its cellular basis is unknown.† The role of peripheral olfactory receptors in odorant memory retention was done through imprinting Coho salmon with phenyl ethyl alcohol. This study verified that there was an increased preference for phenyl ethyl alcohol in salmon adults, therefore proving that some â€Å"component of the imprinted olfactory home stream memory appears to be retained peripherally.† The most remembered olfactory stimuli were investigated by Rabin Cain in 1984. The findings showed that memory was enhanced by familiarity and identifiability. Learning processes have been found to imprint olfaction especially in animals. Frances Darling and Burton Slotnick 1994 research in rats showed that they quickly learnt â€Å"to avoid licking at a drinking tube containing an odorant and quinine hydrochloride†. Learning was quickly in response to the combination of odor and taste stimuli. Therefore, it was inferred the brain can be equipped with an olfactory memory mechanism. Rats had the capability to locate food through olfactory memory further supports the existence of an olfactory memory.    References Baddeley, A. (1992). The Fifteenth Bartlett Lecture. Quarterly Journal of Experimental Psychology , 44, 1-31. G A Nevitt, A. H. (1994). Evidence for a peripheral olfactory memory in imprinted salmon. Seattle: Department of Zoology, University of Washington. Morris, P. E. (1994). Theoretical Aspects of Memory. London: Routledge. Rabin, M. D. (1984). Odor recognition: Familiarity, identifiability, and encoding consistency. J. Exp. Psychol.

Free sample - Social Psychology. translation missing

Social Psychology. Social PsychologyIn the field of health psychology, an understanding on how biology, behavior and social context influence an individual’s or group’s health or illness is taken into account. In the last decade, the applicability of health psychology has been advanced and utilized the more, resulting in an increase in doubts cast by critics as to the importance and usefulness of cognitive psychology. Particular models that address memory aspects of visual and verbal information processing with minimal acknowledgement of any sensory modalities have come under heavy criticism. However, research in olfactory memory literature has rapidly expanded since the 1970’s and has risen beyond conventional memory research. Therefore, the literature herein examines principally on the Proustian characteristics of smell and the relationship between olfactory memory and other closely related types of memory. It is key to note that findings from research conducted on olfaction has been consequently used as a base for theories in other fields though caution must be applied so as not to base these general theories on narrowly researched databases. The chief objectives of the study are to investigate the relationship between olfaction and memory and the most remembered olfactory stimuli through a literature review of various articles. In Baddeley’s 1992 fifteenth Bartlett lecture; he expressed a long-standing commitment expressed by most experienced psychologists in devising theories aimed at encompassing data from diverse sources. He expressed that a theory in health psychology should be economical while giving a plausible account of existing findings that bring into light new discoveries in this field. These discoveries should in turn mold the theory through a â€Å"gradual, cumulative modification of the theory.† He further suggested that models should be applied over a wide range of situations or fields; that is scope rather than precision. This notwithstanding, research carried on the basis of findings presented from the Ebbinghaus and Bartlett traditions concentrates chiefly on verbal rather than visual cognition. However, there has been little contemporary support in literature such as in Morris Gruneberg, 1994 which attempted to inspect whether theories and models in human memory, in referen ce to modality, relate to memory phenomena in other sensory modalities such as touch, taste, or smell. Comprehensive reviews carried out on olfactory cognition and its influence by the conven ­tional memory literature such as Richardson Zucco, 1989 and Schab, 1991 shows an interesting analysis and relation to new research areas. The relationship between olfaction and memory can best be illustrated by perception of smell and the triggering of a long-forgotten event. A perfume may remind someone of a long forgotten person. Research carried out by Engen in 1987 claimed that odor memory does not trigger short-term memory which has been contradicted by the 1997 White and Treishman report. Although evidence of olfactory primacy under which stimuli presented at the beginning of a study is best remembered through rehearsal, the report provides a strong base in evidence presented for recency in olfaction. White and Treisman argued on the basis that olfactory memory is a result of individuals assigning assign verbal meanings to olfactory stimuli. The study further claims that olfactory sense is a crucial sense in animals. This is further supported by evidence presented on the existence of peripheral olfactory memory in imprinted salmon which was carried out by Nevitt et. al in 1994. The study found out that the  "remark honing ability of salmon relies on olfactory cues though its cellular basis is unknown.† The role of peripheral olfactory receptors in odorant memory retention was done through imprinting Coho salmon with phenyl ethyl alcohol. This study verified that there was an increased preference for phenyl ethyl alcohol in salmon adults, therefore proving that some â€Å"component of the imprinted olfactory home stream memory appears to be retained peripherally.† The most remembered olfactory stimuli were investigated by Rabin Cain in 1984. The findings showed that memory was enhanced by familiarity and identifiability. Learning processes have been found to imprint olfaction especially in animals. Frances Darling and Burton Slotnick 1994 research in rats showed that they quickly learnt â€Å"to avoid licking at a drinking tube containing an odorant and quinine hydrochloride†. Learning was quickly in response to the combination of odor and taste stimuli. Therefore, it was inferred the brain can be equipped with an olfactory memory mechanism. Rats had the capability to locate food through olfactory memory further supports the existence of an olfactory memory.    References Baddeley, A. (1992). The Fifteenth Bartlett Lecture. Quarterly Journal of Experimental Psychology , 44, 1-31. G A Nevitt, A. H. (1994). Evidence for a peripheral olfactory memory in imprinted salmon. Seattle: Department of Zoology, University of Washington. Morris, P. E. (1994). Theoretical Aspects of Memory. London: Routledge. Rabin, M. D. (1984). Odor recognition: Familiarity, identifiability, and encoding consistency. J. Exp. Psychol.

Free sample - Social Psychology. translation missing

Social Psychology. Social PsychologyIn the field of health psychology, an understanding on how biology, behavior and social context influence an individual’s or group’s health or illness is taken into account. In the last decade, the applicability of health psychology has been advanced and utilized the more, resulting in an increase in doubts cast by critics as to the importance and usefulness of cognitive psychology. Particular models that address memory aspects of visual and verbal information processing with minimal acknowledgement of any sensory modalities have come under heavy criticism. However, research in olfactory memory literature has rapidly expanded since the 1970’s and has risen beyond conventional memory research. Therefore, the literature herein examines principally on the Proustian characteristics of smell and the relationship between olfactory memory and other closely related types of memory. It is key to note that findings from research conducted on olfaction has been consequently used as a base for theories in other fields though caution must be applied so as not to base these general theories on narrowly researched databases. The chief objectives of the study are to investigate the relationship between olfaction and memory and the most remembered olfactory stimuli through a literature review of various articles. In Baddeley’s 1992 fifteenth Bartlett lecture; he expressed a long-standing commitment expressed by most experienced psychologists in devising theories aimed at encompassing data from diverse sources. He expressed that a theory in health psychology should be economical while giving a plausible account of existing findings that bring into light new discoveries in this field. These discoveries should in turn mold the theory through a â€Å"gradual, cumulative modification of the theory.† He further suggested that models should be applied over a wide range of situations or fields; that is scope rather than precision. This notwithstanding, research carried on the basis of findings presented from the Ebbinghaus and Bartlett traditions concentrates chiefly on verbal rather than visual cognition. However, there has been little contemporary support in literature such as in Morris Gruneberg, 1994 which attempted to inspect whether theories and models in human memory, in referen ce to modality, relate to memory phenomena in other sensory modalities such as touch, taste, or smell. Comprehensive reviews carried out on olfactory cognition and its influence by the conven ­tional memory literature such as Richardson Zucco, 1989 and Schab, 1991 shows an interesting analysis and relation to new research areas. The relationship between olfaction and memory can best be illustrated by perception of smell and the triggering of a long-forgotten event. A perfume may remind someone of a long forgotten person. Research carried out by Engen in 1987 claimed that odor memory does not trigger short-term memory which has been contradicted by the 1997 White and Treishman report. Although evidence of olfactory primacy under which stimuli presented at the beginning of a study is best remembered through rehearsal, the report provides a strong base in evidence presented for recency in olfaction. White and Treisman argued on the basis that olfactory memory is a result of individuals assigning assign verbal meanings to olfactory stimuli. The study further claims that olfactory sense is a crucial sense in animals. This is further supported by evidence presented on the existence of peripheral olfactory memory in imprinted salmon which was carried out by Nevitt et. al in 1994. The study found out that the  "remark honing ability of salmon relies on olfactory cues though its cellular basis is unknown.† The role of peripheral olfactory receptors in odorant memory retention was done through imprinting Coho salmon with phenyl ethyl alcohol. This study verified that there was an increased preference for phenyl ethyl alcohol in salmon adults, therefore proving that some â€Å"component of the imprinted olfactory home stream memory appears to be retained peripherally.† The most remembered olfactory stimuli were investigated by Rabin Cain in 1984. The findings showed that memory was enhanced by familiarity and identifiability. Learning processes have been found to imprint olfaction especially in animals. Frances Darling and Burton Slotnick 1994 research in rats showed that they quickly learnt â€Å"to avoid licking at a drinking tube containing an odorant and quinine hydrochloride†. Learning was quickly in response to the combination of odor and taste stimuli. Therefore, it was inferred the brain can be equipped with an olfactory memory mechanism. Rats had the capability to locate food through olfactory memory further supports the existence of an olfactory memory.    References Baddeley, A. (1992). The Fifteenth Bartlett Lecture. Quarterly Journal of Experimental Psychology , 44, 1-31. G A Nevitt, A. H. (1994). Evidence for a peripheral olfactory memory in imprinted salmon. Seattle: Department of Zoology, University of Washington. Morris, P. E. (1994). Theoretical Aspects of Memory. London: Routledge. Rabin, M. D. (1984). Odor recognition: Familiarity, identifiability, and encoding consistency. J. Exp. Psychol.

Thursday, February 13, 2020

International Trade and Financial Markets Assignment

International Trade and Financial Markets - Assignment Example For instance, assume UK can experience vast harvest of grapes as compared to Brazil. On the other hand, Brazil thrives in rubber production than any other country. The concept of comparative advantage, therefore, requires the UK to engage more resources in producing grapes. On the other hand, Brazil would better engage in the mass production of rubber. The two countries would, therefore, export their abundant products to the foreign markets. That is; rubber would be exported to the UK and grapes would be exported to Brazil. The mentioned exchange process is referred to as the international trade, which is regulated by trade policies (Suranovic 2012). Trade policies are rules that regulate the exchange of goods, services and other assets between two or more countries. Trade policies also encompass the tax rules, government incentives, and subsidies. The flow of goods, services, and other assets from one country to another is significant for the following reasons: first, it improves economic and social ties between countries. Second, international trade avails a wide variety of goods and services for the consumers. It therefore, enhances the consumer sovereignty, which is the free will of the customers to consume products and services of their interest. Third, international trade improves a country’s economic performance among other importance. The paper seeks to present a critical evaluation of the appropriateness of the trade policies in the United Kingdom (Trade Policy 2015). The link between the United Kingdom and the international communities, specially the developing countries, is based on the following: the export and import of goods and services between UK and the developing countries, the investments activities in the developing countries, relocation to and from development countries, and offering aid to developing countries. The goods exported to the UK from the developing countries in the year 2014

Saturday, February 1, 2020

Consumer Behavior phenomenon analysis Essay Example | Topics and Well Written Essays - 750 words

Consumer Behavior phenomenon analysis - Essay Example Through such analysis, it is the hope of this author that the reader will gain a more definitive and firm understanding with regards to the taxi application market and the way in which new startups are seeking to rapidly integrate and provide needed services for consumers within a given market. By utilizing this particular market as a microcosm of the way in which consumer interaction with given good service takes place in the way through which consumer demands as a two-way street upon the way in which marketers engage consumers, the reader will be able to come away with a more profound and delineated understanding of the way through which the process take place in a new and expansive market. The first question that will be discussed is with regards to the ultimate benefit that the consumer retains from integrating with the given service. Both articles references the fact that taxi apps have come to be a way through which the consumer’s life is greatly simplified and the proce ss of ordering a cab to a specific geographic location does not require an individual to be physically present upon the telephone with a dispatcher. In this way, the different start up firms that have sought to provide services via a web enabled and mobile platform have sought to fulfill the consumer’s needs through decreasing the barriers that had traditionally existed for people to call taxis. Similarly, with regards to why consumers ultimately consume the product/service offered, this can be understood with regards to the inelastic demand for transportation services. Whereas it is true that there is somewhat of an inelastic demand with regards to taxi service within various parts of the world, the social and cultural determinants of a particular region are the most powerful factors in helping to delineate whether or not taxi demand is considered a luxury item or standard expense. For instance, within the United States, taxi fare, depending on the city, is not considered as an essential complement of transportation; however, within various parts of Europe and Asia, transportation is very much something that individuals integrate with on a daily basis and come to rely upon as a fundamental service (Mance 1). In this way, the young startups that have been discussed within the articles in question focus upon the means through which marketers can seek to interact with the consumer in order to maximize the level of integration with the service. This is of course done via a number of mechanisms to include aggressive online advertising, sleek and streamlined interaction with the web interface, benefits of service and specific discounts based upon region, and a rapid push to dominate specific markets. Due to the fact that these young startups are ultimately enable, at least at the current juncture, to integrate with the broader market as a whole, and instead focus upon regional and geographic focus in order to engage the highest market share. The process itse lf is indicative of many of the processes that more established firms within the market currently make. However, what is unique about analyzing the competition and growth/development of the taxi applications is the fact that the nascent level of the current market allows for a clear delineation in the strategic approach and level of market outreach that each firm seeks to employ. As past business interaction has proven, the

Friday, January 24, 2020

Technology Use in the Mathematics Classroom Essay -- Education School

Technology Use in the Mathematics Classroom Technology is a growing field that affects every aspect of our everyday lives. When I look at centuries past, I am amazed at the technological advances this country has made. Just during my lifetime, computers, cell phones, digital cameras, and many other devices have become a huge part of everyday life. Not only is technology affecting every day life, but it is also making a huge impact on education, especially within the mathematic field. Computer programs are being created everyday to aid in the understanding of mathematical concepts. Calculators are replacing the pen and paper method of tabulating answers. The question that remains is, â€Å"Are the uses of technology helping or harming the classroom environment?† I do not have the answer to this question but from reading the National Council of Teachers of Mathematics (NCTM) Technology Principle and viewing the Mathematics Association of America website I can offer personal opinions on this issue. I agree with the Technology Principle when it states, â€Å"Technology should be used to enhance the classroom experience but should not be a replacement for basic understandings.† I believe that basic concepts (addition, subtraction, multiplication, etc.) should be taught by hand first, and then when these concepts are used to solve higherlevel math problems, a calculator may be used to speed the process along. If we, as a society, become too dependent on technological devices to solve math problems, we will be in trouble when computers crash or electricity. The basic mathematical concepts are so important for many life activities (paying bills, balancing check books, time management, etc.) and they should be learned without ... .... Each student has a different path in life. Some will continue their education with college and others will go straight to work, but either way they will need to be familiar with technology programs. In conclusion, I agree that technology needs to be used in the math classroom, but I strongly believe that it should not take the place of the pen and paper method. The basic concepts should be taught by hand and then calculators and computer programs should be brought into the classroom. The challenge as an educator is to balance the use of technology and the use of lecture. It is also a challenge to realize that each child is different and they all have different learning patterns, so each child deserves a fair chance to receive the kind of learning environment they need. I think these are the challenges that school systems and teachers will have to evaluate.