Thursday, October 31, 2019

Depression Paper Essay Example | Topics and Well Written Essays - 750 words

Depression Paper - Essay Example In the United States of America alone, 60% of suicide cases sprang out of clinical depression. Alarmingly, statistics show that 3.4% of people suffering from unipolar disorder do commit suicide. A person suffering from unipolar disorder loses appetite and subsequently weight; takes no interest in anything whatsoever; feelings of worthlessness and regret are prevalent; insomnia develops; and the person may display poor memory, lack of focus and introverted behavior. Unipolar order is diagnosed by the patient’s own experiences as well as behavioral changes and disorders observed and reported by family. There are no tests as such but behavioral analysis techniques are employed in diagnosis. If not treated at an early age, it may worsen the condition subsequently affecting the patient’s physical and mental health. Bipolar disorder is also known by its common name as manic-depressive disorder or in short as manic depression. Sufferers of manic disorder experience weird burst s of energy resulting in hyper moods. On the other hand, they may also experience bouts of depression. In rare cases, an individual may be the target of both types of symptoms. These moods may be buffered by what is termed normal behavior. However, in some individuals, one type of mood is followed by the opposite resulting in continuous ups and downs. This is clinically termed rapid cycling, the alternating between two â€Å"poles†, hence the name. In extreme cases, bouts of manic depression may cause delusional behavior as well as hallucinatory experiences. There are further categories of this disorder to better help diagnose cases. The diagnosis for bipolar disorder is similar to the former kind: self-reported symptoms or symptoms and behavioral abnormalities reported by friends or family are analyzed. Clinical analysis entails sessions with a psychologist. The difference between the two is thus obvious: unipolar disorder causes patients to lose all taste for life; and bipo lar disorder causes its patients to have mood swings, sometimes causing unpleasant experiences. There are two main theories concerning what causes unipolar disorder. The first theory, the biopsychsocial model, states that clinical depression may be caused by biological, psychological and social causes, as the name hints. The other theory, diathesis stress model argues that a pre-existing anomaly (or diathesis) is triggered by distressing stimulus resulting in unipolar disorder. This anomaly can be either hereditary or generic, or acquired through experience. Very similarly, the roots of bipolar disorder in a patient may be genetic though outside stimulus is also a major cause. A patient’s environment plays a large part in the ailment taking hold. A person’s environment or repetitive exposure to disturbing situations may act as catalyst in the ailment fully taking hold. Physiological abnormalities or deficiencies, particularly the size and shape of the brain may also ca use bipolar disorder. Medication is largely used for treating both types of disorder. For unipolar disorder, antidepressants are prescribed to patients as well as psychotherapy. In some cases, electric shocks (electroconvulsive therapy or ECT) as also administered under a general anesthetic. The type of psychotherapy also varies depending upon the severity of the case as well as the age bracket of the patient. Children and young people are normally given CBT or cognitive behavioral therapy sessions. According to

Tuesday, October 29, 2019

Stasiland Essay Essay Example for Free

Stasiland Essay Essay â€Å"This society, it was built on lies†¦Ã¢â‚¬  Why does Funder find it so difficult to uncover the truth? In writing Stasiland, Funder is intent on finding out the truth of the East German regime. She interviews various people that either worked for the Stasi, or had a run in with them, in order to discover the facts about what really happened during the time of the GDR. Uncovering the truth becomes difficult for Funder, as she realizes that the entire operation was built on â€Å"lie after lie after lie. † The Stasi went to extreme lengths to cover up what was really happening to the people in their custody. The story of Miriam Weber includes different examples of the Stasi either lying about their actions or keeping them concealed. After Miriam attempted to climb over the Berlin Wall, she was interrogated and deprived of sleep until she told the interrogator a story about a fake underground escape organisation that told her how to get over the Wall. The Stasi could have then charged her for Deception of the Ministry, but they didn’t, in order to hide the fact that they wouldn’t let Miriam sleep, which was classed as torture. Another possible lie that the Stasi kept was the death of Miriam’s husband, Charlie. Charlie dies in Stasi custody and according to them he had taken his own life, but the Stasi could not tell her how he had hung himself. It was clear that the Stasi even ran the funeral agency, as they insisted that there would be no laying out of the body and that it will have to be cremated, as if to cover up and destroy the evidence of how Charlie really died. The Stasi went to a substantial amount of trouble to hide the truth. Funder finds it extremely difficult to uncover the truth. She hears the numerous stories of different characters, but some these characters don’t really know what the truth is, and others may be too scared to let the truth out. The victims of the Stasi don’t know how extensive the investigations into their own lives were, and the only way for them to find out is to read their own file, which has been destroyed. The people who were members of the Stasi seem to explain to Funder about what really happened behind the closed doors of the GDR, but they don’t reveal any truths that are not already known. They don’t want to expose who they are, or their secrets of how horribly intrusive and malicious they were, because they are scared of their victims getting revenge on them. This becomes clear when Funder goes to interview von-Schnitzler, to find that he has his wife’s maiden name on his door, rather than his own name.

Sunday, October 27, 2019

Improving Resource Allocation for Data Center Overbooking

Improving Resource Allocation for Data Center Overbooking M.Ponmani Bharathi, C.Sindhuja, S.Vaishnavi, Ms.A.Judith Arockia Gladies Abstract Overbooking becomes feasible because user applications tend to overestimate their resources and requirements, that tends to utilize only a fraction of the allocated resources. Overbooking has to be carefully planned in order not to impact application performance. Resource utilization and Data centres utilization can be used in this overbooking scheduler. Data send can send from sources to destination via node. Resource utilization and allocated capacity can be increased by 50% with acceptable performance degradation. Fuzzy logic functions are used to check each overbooking decisions and estimate it. Changing the acceptable level of risk is depending on the current status of the cloud data centres. The suggested approach is extensively evaluated using a combination of simulations and experiments executing real cloud applications with real-life available workloads. Our results show a 50% increment at both resource utilization and capacity allocated with acceptable performance degradati on and more stable resource utilization over time. Keywords: Proportional Integral Derivative (PID), Mitigation algorithm, Greedy algorithm 1. Introduction Authors Data set for overbooking levels. It is collections of some Services and work loading data. The data that represents the collection of fields that will be returned when the data set query runs on the data source. Dataset fields represent the data from a data connection. A field can represent either numeric or non-numeric data. Main features provided by cloud is elasticity, allows users to dynamically adjust resources allocations depending on their current needs. The objective is to make an efficient use of available resources, overestimating the required capacity results in poor resource utilization. Factors contributing to lower the Data Centre Utilization: cloud provides predefined VM Sizes, which have fixed amount of CPU, memory Disk Etc. A set of distributed PID controllers are implemented to avoid performance degradation and to increase and keep the utilization evenly distributed among the servers. Overbooking addresses the utilization problems that cloud data centres face due to the elastic nature of cloud services. Overbooking has to be carefully planned in order not to impact application performance. It present an overbooking framework that performs admission control decisions based on fuzzy logic risk assessments of each incoming service deployment request. If delay beyond slack on critical path is initiated, then the completion time of the project may get delayed. Resource levelling is a method for smoothing a schedule that attempts to minimize the fluctuations in requirements for resources when the project completion time is fixed. Users are usually bad at estimating the requirements of their applications. This low resource utilization is a big concern for cloud data centred providers as data centres consume l ot of energy and are being used in a rather inefficient way. Energy consumption does not decrease linearly with resource usage. One way cloud providers can mitigate these resource utilization problems is by overbooking. The overbooking techniques always expose the infrastructure to a risk of resource congestion upon unexpected situations and consequently to SLA violations. This leads to: Overestimating the required capacity results in poor resource utilization. Lower income from consumers. The contrary, underestimating may lead to performance degradation and/or crashes. Overbooking is to address the utilization problems that cloud data centres face due to the elastic nature of cloud services. Overbooking has to be carefully planned in order not to impact application performance. It present an overbooking framework that performs admission control decisions based on fuzzy logic risk assessments of each incoming service deployment request. A set of distributed PID controllers are implemented to avoid performance degradation and to increase and keep the utilization evenly distributed among the servers. Overbooking within cloud data centres to increase resource utilization in a safe and balanced way. The cloud paradigm also introduces new obstacles for efficient resource management. The very large scale and multi-tenant nature of cloud infrastructures offers great potential for efficient multiplexing of different services. Our initial work on this problem include scheduling for better server utilization and admission control for capacity planning, getting an initial understanding of the overbooking problem and the risk evaluation, respectively. Cloud applications do not use the same amount of hardware resources all the time. This low resource utilization is a big concern for cloud data centred providers as data centres consume lot of energy and are being used in a rather inefficient way. One way cloud providers can mitigate these resource utilization problems is by overbooking. Figure 1 Overbooking Fuzzy Risk Assessment 2. Mitigation Algorithm for Reducing Service Level Mitigation method is used to avoid sun expected misbehaviors, such as reducing the service level of some services to avoid performance degradation. This Algorithm is used to collocate, reducing the performance degradation when overbooking. This algorithm also clear traffics for data center overbooking utilization. Proportional Integral Derivative (PID) controller is a generic control loop feedback mechanism. PID calculates the differences between the measured and desired set points attempts to minimize it by reading the control input.PID involves three parameter, Present error(P), Accumulated error(I), Prediction of error may occur (D). 1. Data Collection Dataset for overbooking levels is a collection of some Services and work loading data. The data that representing the collection of fields that will return when the dataset queries runs on the data source. Dataset fields represent the data from a data connection. A field can represent either numeric or non-numeric data. 2. Overbooking Overbooking is techniques used as a solution to poor resource utilization in cloud data centres. Overbooking is mainly used to handle the data centred resource utilization problems and overbooking. An implemented an autonomic overbooking framework. An autonomic framework that provides better application performance, avoiding over passing total capacity at any of the dimensions will be provided. 3. Resources Utilizations It determines the shortest project schedule with the limited resources available. 4. Schedule with collocation It presents a greedy approach that perform traffic-aware VM placement to increase the rate of accepted requests. It avoid repeating poor performance and to increase the chances of good collocations. VMs are suitable to be collocated for improved utilization and stable performance. 5. Prediction method The prediction step calculates a rough approximation of the desired quantity. The corrector step refines the initial approximation using another means. Overbooking system as well as admission control techniques when dealing with elastic services need insight in future resource usage. Service requirements to avoid performance degradation due to overloaded physical resources. 3. Distribution of PID Controller PID controlled this fact motivates the use of feedback to adjust the level of risk that the overbooking system is willing to face over time. We also evaluate the distributed controller approach when the data centre size is reduced to 128 cores. Furthermore, choosing an acceptable risk threshold has an impact on data centred utilization and performance. High thresholds result in higher utilization but the expense of exposing the system to performance degradation, whilst using lower values leads to lower but safer resource utilization. When overbooking CPU and I/O capacity, and a more realistic approach for the memory. The rationale for this is that problems resulting from CPU or I/O congestion are less critical than the ones coming from running out of memory. Therefore, the different risk degrees presented can be combined according to the situation, considered capacity dimensions, knowledge about the incoming service, etc. The risk assessment module gets no feedback about the current status and behaviour of the system, the current workload mixture, the data centre size, etc. In order to address this issue, we propose here a control theory approach that dynamically (re)adjusts risk thresholds depending on the system behaviour and the desired utilization n levels, allowing the admission control to learn over time depending on current system behaviour. PID Controller works properly if the performance is measured at the data centre level, obtaining a smooth utilization fluctuations (close enough to the target one) for each congested capacity dimension. However, the utilization of each server may vary from the accumulated utilization – even after applying load balancing techniques. This effect cannot be totally avoided as load imbalance is also caused by the current workload characteristics. To reduce load imbalance we propose a distributed controller approach where each physical server has its own PID controllers, one for each capacity dimension. 4. Related Techniques Mathematical models for SaaS providers to satisfy customers by leasing Cloud resources from multiple IaaS providers. It proposes three innovative admission control and scheduling algorithms for profit maximization by minimizing cost and maximizing customer satisfaction level. It demonstrates effectiveness of the proposed models and algorithms through an extended evaluation study by varying customer and provider side parameters to analyze which solution suits best in which scenario to maximize SaaS providers profit using actual IaaS data from Amazon and Go Grid. An extensive evaluation to study and analyze which solution suits best in which scenario to maximize SaaS provider’s profit. In-house hosting can increase administration and maintenance costs whereas renting from an IaaS provider can impact the service quality due to its variable performance. Dynamic consolidation of virtual machines (VMs) is an effective way to improve the utilization of resources and energy efficiency in cloud data centres. The problem of host overload detection by maximizing the mean inter migration time under the specified QoS goal based on a Markov chain model. Through simulations with workload traces from more than a thousand Planet Lab VMs, we show that our approach outperforms the best benchmark algorithm and provides approximately 88 percent of the performance of the optimal offline algorithm. The data center efficiency is been improved and more enterprises are been to consolidate the existing system. All system resources and centralizing resource management allow increasing overall utilization and lowering management costs. Server consolidation has emerged as a promising technique to reduce the data centre energy cost. We also present a distinguished analysis of an enterprise server workload from the perspective of consolidation and finding characteristics for it. Then observing a significant inherent for power savings if consolidation is performed using off-peak values for application demand. An implementation of the methodologies in a consolidation planning tool and provide a comprehensive evaluation study of the proposed methodologies. The size applications by an off-peak metric and place correlated applications together; there is a high risk of SLA capacity violation. If consolidation is performed by reserving the maximum utilization for each application, the application may require capacity equal to the size of its current entitlements. As per the size of the cloud increases, the anticipation that all workloads paralyze scale up to their maximum demands. In this observation multiplexing is allowed to access cloud resources among multiple workloads, resource information have been improved. Hosting virtualized loads such that available physical capacity is smaller than the sum of maximal demands of the workloads is referred to as over-commit or over-subscription. It computationally and storage efficiently, while maintaining sufficient accuracy. It is simple method of estimating total effective nominal demand of a cloud and uses it for capacity sizing and placement reservation plan that is compliant with SLA. 5. Conclusion Overbooking has to be carefully planned in order not to impact application performance. A set of distributed PID controllers are implemented to avoid performance degradation and to increase and keep the utilization evenly distributed among the servers. Feedback control is used to adapt the level of overbooking (risk threshold) that the cloud data centre has tolerating capacity. The utilization technique of data centre is not only increased in overall but also harmonized across hardware capacity dimensions and servers. A set of distributed PID controllers are implemented to avoid performance degradation and to increase and keep the utilization evenly distributed among the servers. References [1] A. Ali-Eldin, J. Tordsson, and E. Elmroth, â€Å"An adaptive hybrid elasticity controller for cloud infrastructures,† in Proc. of Network Operations and Management Symposium (NOMS), 2012, pp. 204–212. [2] A. Sulistio, K. H. Kim, and R. Buyya, â€Å"Managing cancellations and no-shows of reservations with overbooking to increase resource revenue,† in Proc. of Intl. Symposium on Cluster Computing and the Grid (CCGrid), 2008, pp. 267–276. [3] X. Meng, C. Isci, J. Kephart, L. Zhang, E. Bouillet, and D. Pendarakis,â€Å"Efficient resource provisioning in compute clouds via VM multiplexing,† in Proc. Intl. Conference of Autonomic Computing (ICAC), 2010, pp. 11–20. [4] Y. C. Lee and A. Y. Zomaya, â€Å"Energy efficient utilization of resources in cloud computing systems,† The Journal of Supercomputing, vol. 60, no. 2, pp. 268–280, 2012. [5] L. A. Barroso and U. Holzle, â€Å"The case for energy-proportional computing,† Computer, vol. 40, no. 12 pp. 33–37, 2007. [6] C. Mastroianni, M. Meo, and G. Papuzzo, â€Å"Probabilistic consolidationof virtual machines in self-organizing cloud data centers,† IEEE Transactions on Cloud Computing, vol. 1, no. 2, pp. 215–228, 2013. [7] T. Wo, Q. Sun, B. Li, and C. Hu, â€Å"Overbooking-based resource allocation in virtualized data center,† in Proc of 15th IEEE International Symposium on Object/Component/Service-Oriented Real-Time Distributed Computing Workshops (ISORCW), 2012, pp. 142–149. [8] L. Larsson, D. Henriksson, and E. Elmroth, â€Å"Scheduling and monitoring of internally structured services in cloud federations,† in Proc. of IEEE Intl. Symposium on Computers and Communications (ISCC), 2011, pp. 173–178. [9] D. Breitgand, Z. Dubitzky, A. Epstein, O. Feder, A. Glikson, I. Shapira, and G. Toffetti, â€Å"Pulsar: An adaptive utilization accelerator for iaas clouds,† in IEEE International Conference on Cloud Engineering (IC2E), 2014. [10] M. Dobber, R. van der Mei, and G. Koole, â€Å"A prediction method for job runtimes on shared processors: Survey, statistical analysis and new avenues,† Performance Evaluation, vol. 64, no. 7-8, pp. 755–781, 2007. M. Ponmani Bharathi, currently studying B.E. computer science and engineering in ultra college of Engineering and Technology for women at Madurai C sindhuja, currently studying B.E. computer science and engineering in ultra college of Engineering and Technology for women at Madurai S.vaishnavi, currently studying B.E. computer science and engineering in ultra college of Engineering and Technology for women at Madurai Ms.A.Judith Arockia Gladies received her bachelor’s degree (B.Tech-Bachelor of Information Technology) from Raja College of engineering and Technology, Madurai, and affiliated to Anna University, Chennai, and then did her Master Degree in computer science and engineering from Raja College Of Engg and Tech, Madurai. She is currently working as an Asst Prof in Ultra College of Engg Tech for Women, Madurai.

Friday, October 25, 2019

Nuggets of Wisdom :: essays research papers

Nuggets of Wisdom   Ã‚  Ã‚  Ã‚  Ã‚  My family and I often take vacations during the summer for relaxation, or to visit family, etcetera. On one such vacation, I learned a valuable lesson. Parents were created to teach their children little nuggets of common sense, but it is up to the children to listen.   Ã‚  Ã‚  Ã‚  Ã‚  We were visiting the Central American country of Honduras. It was a bright, sunny, and hot summer day. Taking a break from sight seeing, and the heat, we took refuge in a tropical style restaurant for lunch. It was a two-story restaurant over the ocean. Along the walls, there were beautiful green foliage that plump, colorful flowers sprung from. Also, throughout the restaurant were wooden poles, painted blue, that hammocks were hung on.   Ã‚  Ã‚  Ã‚  Ã‚  The waiter escorted my family and I to our table on the second floor. My parents sat at the table, but I chose a nearby hammock. The hammock was next to the open side of the restaurant. As I lay there, I began to study the ocean. I looked down and watched as the waves rippled, broke, and crashed to the shore. A salt-water smell permeated through the restaurant. A nearby fan oscillated back and forth, blowing a refreshing breeze across my face. All these elements caused me to relax, and slowly I began to sway in the hammock.   Ã‚  Ã‚  Ã‚  Ã‚  Soon after I got in that comfortable position, the waiter delivered the meal. My parents had ordered fish, and had begun nibbling. Since I was not hungry, I only ordered a drink, which I took back to the hammock to sip on. I began to sway, more vigorously than before, and I closed my eyes to enjoy the sounds. My father looked up from his meal and watched as I swung back and forth. He raised an eyebrow, and with a glint of humorous, wisdom in his eyes my father said, â€Å"David, that hammock is loose. Rock too hard, and you will go flying.† Of course, I paid him no attention. I was thirteen years old, and thirteen year olds know everything.   Ã‚  Ã‚  Ã‚  Ã‚  Acting as a typical teenager, I began to swing once more despite my father’s warning. My head was in the clouds, as I watched the waves, and the birds. How could something go wrong when everything was so perfect? I did not notice the creaking noise the rope made as its knot came lose. Nor did I realize what was happening when my drink hit the floor causing the glass to break with a deafening sound.

Thursday, October 24, 2019

Chapter 3 The Knight Bus

Harry was several streets away before he collapsed onto a low wall in Magnolia Crescent, panting from the effort of dragging his trunk. He sat quite still, anger still surging through him, listening to the frantic thumping of his heart. But after ten minutes alone in the dark street, a new emotion overtook him: panic. Whichever way he looked at it, he had never been in a worse fix. He was stranded, quite alone, in the dark Muggle world, with absolutely nowhere to go. And the worst of it was, he had just done serious magic, which meant that he was almost certainly expelled from Hogwarts. He had broken the Decree for the Restriction of Underage Wizardry so badly, he was surprised Ministry of Magic representatives weren't swooping down on him where he sat. Harry shivered and looked up and down Magnolia Crescent. What, was going to happen to him? Would he be arrested, or would he simply be outlawed from the wizarding world? He thought of Ron and Hermione, and his heart sank even lower. Harry was sure that, criminal or not, Ron and Hermione would want to help him now, but they were both abroad, and with Hedwig gone, he had no means of contacting them. He didn't have any Muggle money, either. There was a little wizard gold in the money bag at the bottom of his trunk, but the rest of the fortune his parents had left him was stored in a vault at Gringotts Wizarding Bank in London. He'd never be able to drag his trunk all the way to London. Unless†¦ He looked down at his wand, which he was still clutching in his hand. If he was already expelled (his heart was. now thumping painfully fast), a bit more magic couldn't hurt. He had the Invisibility Cloak he had inherited from his father — what if he bewitched the trunk to make it feather-light, tied it to his broomstick, covered himself in the cloak, and flew to London? Then he could get the rest of his money out of his vault and†¦begin his life as an outcast. It was a horrible prospect, but he couldn't sit on this wall forever, or he'd find himself trying to explain to Muggle police why he was out in the dead of night with a trunk full of spell books and a broomstick. Harry opened his trunk again and pushed the contents aside, looking for the Invisibility Cloak — but before he had found it, he straightened up suddenly, looking around him once more. A funny prickling on the back of his neck had made Harry feel he was being watched, but the street appeared to be deserted, and no lights shone from any of the large square houses. He bent over his trunk again, but almost immediately stood up once more, his hand clenched on his wand. He had sensed rather than heard it: someone or something was standing in the narrow gap between the garage and the fence behind him. Harry squinted at the black alleyway. If only it would move, then he'd know whether it was just a stray cat or — something else. â€Å"Lumos,† Harry muttered, and a light appeared at the end of his wand, almost dazzling him. He held it high over his head, and the pebble-dashed walls of number two suddenly sparkled; the garage door gleamed, and between them Harry saw, quite distinctly, the hulking outline of something very big, with wide, gleaming eyes. Harry stepped backward. His legs hit his trunk and he tripped. His wand flew out of his hand as he flung out an arm to break his fall, and he landed, hard, in the gutter. There was a deafening BANG, and Harry threw up his hands to shield his eyes against a sudden blinding light†¦ With a yell, he rolled back onto the pavement, just in time. A second later, a gigantic pair of wheels and headlights screeched to a halt exactly where Harry had just been lying. They belonged, as Harry saw when he raised his head, to a triple-decker, violently purple bus, which had appeared out of thin air. Gold lettering over the windshield spelled The Knight Bus. For a split second, Harry wondered if he had been knocked silly by his fall. Then a conductor in a purple uniform leapt out of the bus and began to speak loudly to the night. â€Å"Welcome to the Knight Bus, emergency transport for the stranded witch or wizard. just stick out your wand hand, step on board, and we can take you anywhere you want to go. My name is Stan Shunpike, and I will be your conductor this eve–â€Å" The conductor stopped abruptly. He had just caught sight of Harry, who was still sitting on the ground. Harry snatched up his wand again and scrambled to his feet. Close up, he saw that Stan Shunpike was only a few years older than he was, eighteen or nineteen at most, with large, protruding ears and quite a few pimples. â€Å"What were you doin' down there?† said Stan, dropping his professional manner. â€Å"Fell over,† said Harry. â€Å"‘Choo fall over for?† sniggered Stan. â€Å"I didn't do it on purpose,† said Harry, annoyed. One of the knees in his jeans was torn, and the hand he had thrown out to break his fall was bleeding. He suddenly remembered why he had fallen over and turned around quickly to stare at the alleyway between the garage and fence. The Knight Bus's headlamps were flooding it with light, and it was empty. â€Å"‘Choo lookin' at?† said Stan. â€Å"There was a big black thing,† said Harry, pointing uncertainly into the gap. â€Å"Like a dog†¦but massive†¦Ã¢â‚¬  He looked around at Stan, whose mouth was slightly open. With a feeling of unease, Harry saw Stan's eyes move to the scar on Harry's forehead. â€Å"Woss that on your ‘ead?† said Stan abruptly. â€Å"Nothing,† said Harry quickly, flattening his hair over his scar. If the Ministry of Magic was looking for him, he didn't want to make it too easy for them. â€Å"Woss your name?† Stan persisted. â€Å"Neville Longbottom,† said Harry, saying the first name that came into his head. â€Å"So — so this bus,† he went on quickly, hoping to distract Stan, â€Å"did you say it goes anywhere?† â€Å"Yep,† said Stan proudly, â€Å"anywhere you like, ‘long it's on land. Can't do nuffink underwater. â€Å"Ere,† he said, looking suspicious again, â€Å"you did flag us down, dincha? Stuck out your wand ‘and, dincha?† â€Å"Yes,† said Harry quickly. â€Å"Listen, how much would it be to get to London?† â€Å"Eleven Sickles,† said Stan, â€Å"but for firteen you get ‘ot chocolate, and for fifteen you get an ‘ot-water bottle an' a toofbrush in the color of your choice.† Harry rummaged once more in his trunk, extracted his money bag, and shoved some gold into Stan's hand. He and Stan then lifted his trunk, with Hedwig's cage balanced on top, up the steps of the bus. There were no seats; instead, half a dozen brass bedsteads stood beside the curtained windows. Candles were burning in brackets beside each bed, illuminating the wood-paneled walls. A tiny wizard in a nightcap at the rear of the bus muttered, â€Å"Not now, thanks, I'm pickling some slugs† and rolled over in his sleep. â€Å"You ‘ave this one,† Stan whispered, shoving Harry's trunk under the bed right behind the driver, who was sitting in an armchair in front of the steering wheel. â€Å"This is our driver, Ernie Prang. This is Neville Longbottom, Ern.† Ernie Prang, an elderly wizard wearing very thick glasses, nodded to Harry, who nervously flattened his bangs again and sat down on his bed. â€Å"Take ‘er away, Ern,† said Stan, sitting down in the armchair next to Ernie's. There was another tremendous BANG, and the next moment Harry found himself flat on his bed, thrown backward by the speed of the Knight Bus. Pulling himself up, Harry stared out of the dark window and saw that they were now bowling along a completely different street. Stan was watching Harry's stunned face with great enjoyment. â€Å"This is where we was before you flagged us down,† he said. â€Å"Where are we, Ern? Somewhere in Wales?† â€Å"Ar,† said Ernie. â€Å"How come the Muggles don't hear the bus?† said Harry. â€Å"Them!† said Stan contemptuously. â€Å"Don' listen properly, do they? Don' look properly either. Never notice nuffink, they don'.† â€Å"Best go wake up Madam Marsh, Stan,† said Ern. â€Å"We'll be in Abergavenny in a minute.† Stan passed Harry's bed and disappeared up a narrow wooden staircase. Harry was still looking out of the window, feeling increasingly nervous. Ernie didn't seem to have mastered the use of a steering wheel. The Knight Bus kept mounting the pavement, but it didn't hit anything; lines of lampposts, mailboxes, and trash cans jumped out of its way as it approached and back into position once it had passed. Stan came back downstairs, followed by a faintly green witch wrapped in a traveling cloak. â€Å"‘Ere you go, Madam Marsh,† said Stan happily as Ern stamped on the brake and the beds slid a foot or so toward the front of the bus. Madam Marsh clamped a handkerchief to her mouth and tottered down the steps. Stan threw her bag out after her and rammed the doors shut; there was another loud BANG, and they were thundering down a narrow country lane, trees leaping out of the way. Harry wouldn't have been able to sleep even if he had been traveling on a bus that didn't keep banging loudly and jumping a hundred miles at a time. His stomach churned as he fell back to wondering what was going to happen to him, and whether the Dursleys had managed to get Aunt Marge off the ceiling yet. Stan had unfurled a copy of the Daily Prophet and was now reading with his tongue between his teeth. A large photograph of a sunken-faced man with long, matted hair blinked slowly at Harry from the front page. He looked strangely familiar. â€Å"That man!† Harry said, forgetting his troubles for a moment. â€Å"He was on the Muggle news!† Stanley turned to the front page and chuckled. â€Å"Sirius Black,† he said, nodding. â€Å"‘Course ‘e was on the Muggle news, Neville. Where you been?† He gave a superior sort of chuckle at the blank look on Harry's face, removed the front page, and handed it to Harry. â€Å"You oughta read the papers more, Neville.† Harry held the paper up to the candlelight and read: BLACK STILL AT LARGE Sirius Black, possibly the most infamous prisoner ever to be held in Azkaban fortress, is still eluding capture, the Ministry of Magic confirmed today. â€Å"We are doing all we can to recapture Black,† said the Minister of Magic, Cornelius Fudge, this morning, â€Å"and we beg the magical community to remain calm.† Fudge has been criticized by some members of the International Federation of Warlocks for informing the Muggle Prime Minister of the crisis. â€Å"Well, really, I had to, don't you know,† said an irritable Fudge. â€Å"Black is mad. He's a danger to anyone who crosses him, magic or Muggle. I have the Prime Minister's assurance that he will not breathe a word of Black's true identity to anyone. And let's face it — who'd believe him if he did?† While Muggles have been told that Black is carrying a gun (a kind of metal wand that Muggles use to kill each other), the magical community lives in fear of a massacre like that of twelve years ago, when Black murdered thirteen people with a single curse. Harry looked into the shadowed eyes of Sirius Black, the only part of the sunken face that seemed alive. Harry had never met a vampire, but he had seen pictures of them in his Defense Against the Dark Arts classes, and Black, with his waxy white skin, looked just like one. â€Å"Scary-lookin' fing, inee?† said Stan, who had been watching Harry read. â€Å"He murdered thirteen people?† said Harry, handing the page back to Stan, â€Å"with one curse?† â€Å"Yep,† said Stan, â€Å"in front of witnesses an' all. Broad daylight. Big trouble it caused, dinnit, Ern?† â€Å"Ar,† said Ern darkly. Stan swiveled in his armchair, his hands on the back, the better to look at Harry. â€Å"Black woz a big supporter of You-Know-‘Oo,† he said. â€Å"What, Voldemort?† said Harry, without thinking. Even Stan's pimples went white; Ern jerked the steering wheel so hard that a whole farmhouse had to jump aside to avoid the bus. â€Å"You outta your tree?† yelped Stan. â€Å"‘Choo say ‘is name for?† â€Å"Sorry,† said Harry hastily. â€Å"Sorry, I — I forgot –â€Å" â€Å"Forgot!† said Stan weakly. â€Å"Blimey, my ‘eart's goin' that fast†¦Ã¢â‚¬  â€Å"So — so Black was a supporter of You-Know-Who?† Harry prompted apologetically. â€Å"Yeah,† said Stan, still rubbing his chest. â€Å"Yeah, that's right. Very close to You-Know-‘Oo, they say†¦anyway, when little ‘Arry Potter got the better of You-Know-‘Oo† — Harry nervously flattened his bangs down again — â€Å"all You-Know-‘Oo's supporters was tracked down, wasn't they, Ern? Most of 'em knew it was all over, wiv You-Know-‘Oo gone, and they came quiet. But not Sirius Black. I ‘eard he thought ‘e'd be second-in-command once You-Know-‘Oo ‘ad taken over. â€Å"Anyway, they cornered Black in the middle of a street full of Muggles an' Black took out ‘is wand and ‘e blasted ‘alf the street apart, an' a wizard got it, an' so did a dozen Muggles what got in the way. ‘Orrible, eh? An' you know what Black did then?† Stan continued in a dramatic whisper. â€Å"What?† said Harry. â€Å"Laughed,† said Stan. â€Å"Jus' stood there an' laughed. An' when reinforcements from the Ministry of Magic got there, ‘e went wiv em quiet as anyfink, still laughing ‘is ‘ead off. ‘Cos ‘e's mad, inee, Ern? Inee mad?† â€Å"If he weren't when he went to Azkaban, he will be now,† said Ern in his slow voice. â€Å"I'd blow meself up before I set foot in that place. Serves him right, mind you†¦after what he did†¦Ã¢â‚¬  â€Å"They ‘ad a job coverin' it up, din' they, Ern?† Stan said. â€Å"‘Ole street blown up an' all them Muggles dead. What was it they said ‘ad ‘appened, Ern?† â€Å"Gas explosion,† grunted Ernie. â€Å"An' now ‘e's out,† said Stan, examining the newspaper picture of Black's gaunt face again. â€Å"Never been a breakout from Azkaban before, ‘as there, Ern? Beats me ‘ow ‘e did it. Frightenin', eh? Mind, I don't fancy ‘is chances against them Azkaban guards, eh, Ern?† Ernie suddenly shivered. â€Å"Talk about summat else, Stan, there's a good lad. Them Azkaban guards give me the collywobbles.† Stan put the paper away reluctantly, and Harry leaned against the window of the Knight Bus, feeling worse than ever. He couldn't help imagining what Stan might be telling his passengers in a few nights' time. â€Å"‘Ear about that ‘Arry Potter? Blew up ‘is aunt! We ‘ad ‘im ‘ere on the Knight Bus, di'n't we, Ern? ‘E was tryin' to run for it†¦Ã¢â‚¬  He, Harry, had broken wizard law just like Sirius Black. Was inflating Aunt Marge bad enough to land him in Azkaban? Harry didn't know anything about the wizard prison, though everyone he'd ever heard speak of it did so in the same fearful tone. Hagrid, the Hogwarts gamekeeper, had spent two months there only last year. Harry wouldn't soon forget the look of terror on Hagrid's face when he had been told where he was going, and Hagrid was one of the bravest people Harry knew. The Knight Bus rolled through the darkness, scattering bushes and wastebaskets, telephone booths and trees, and Harry lay, restless and miserable, on his feather bed. After a while, Stan remembered that Harry had paid for hot chocolate, but poured it all over Harry's pillow when the bus moved abruptly from Anglesea to Aberdeen. One by one, wizards and witches in dressing gowns and slippers descended from the upper floors to leave the bus. They all looked very pleased to go. Finally, Harry was the only passenger left. â€Å"Right then, Neville,† said Stan, clapping his hands, â€Å"whereabouts in London?† â€Å"Diagon Alley,† said Harry. â€Å"Righto,† said Stan. â€Å"‘Old tight, then.† BANG. They were thundering along Charing Cross Road. Harry sat up and watched buildings and benches squeezing themselves out of the Knight Bus's way. The sky was getting a little lighter. He would lie low for a couple of hours, go to Gringotts the moment it opened, then set off — where, he didn't know. Ern slammed on the brakes and the Knight Bus skidded to a halt in front of a small and shabby-looking pub, the Leaky Cauldron, behind which lay the magical entrance to Diagon Alley. â€Å"Thanks,† Harry said to Ern. He jumped down the steps and helped Stan lower his trunk and Hedwig's cage onto the pavement. â€Å"Well,† said Harry. â€Å"‘Bye then!† But Stan wasn't paying attention. Still standing in the doorway to the bus) he was goggling at the shadowy entrance to the Leaky Cauldron. â€Å"There you are, Harry,† said a voice. Before Harry could turn, he felt a hand on his shoulder. At the same time, Stan shouted, â€Å"Blimey! Ern, come ‘ere! Come ‘ere!† Harry looked up at the owner of the hand on his shoulder and felt a bucketful of ice cascade into his stomach — he had walked right into Cornelius Fudge, the Minister of Magic himself. Stan leapt onto the pavement beside them. â€Å"What didja call Neville, Minister?† he said excitedly. Fudge, a portly little man in a long, pinstriped cloak, looked cold and exhausted. â€Å"Neville?† he repeated, frowning. â€Å"This is Harry Potter.† â€Å"I knew it!† Stan shouted gleefully. â€Å"Ern! Ern! Guess ‘oo Neville is, Ern! ‘E's ‘Arry Potter! I can see ‘is scar!† â€Å"Yes,† said Fudge testily, â€Å"well, I'm very glad the Knight Bus picked Harry up, but he and I need to step inside the Leaky Cauldron now†¦Ã¢â‚¬  Fudge increased the pressure on Harry's shoulder, and Harry found himself being steered inside the pub. A stooping figure bearing a lantern appeared through the door behind the bar. It was Tom, the wizened, toothless landlord. â€Å"You've got him, Minister!† said Tom. â€Å"Will you be wanting anything? Beer? Brandy?† â€Å"Perhaps a pot of tea,† said Fudge, who still hadn't let go of Harry. There was a loud scraping and puffing from behind them, and Stan and Ern appeared, carrying Harry's trunk and Hedwig's cage and looking around excitedly. â€Å"‘Ow come you di'n't tell us ‘oo you are, eh, Neville?† said Stan, beaming at Harry, while Ernie's owlish face peered interestedly over Stan's shoulder. â€Å"And a private parlor, please, Tom,† said Fudge pointedly. â€Å"‘Bye,† Harry said miserably to Stan and Ern as Tom beckoned Fudge toward the passage that led from the bar. â€Å"‘Bye, Neville!† called Stan. Fudge marched Harry along the narrow passage after Tom's lantern, and then into a small parlor. Tom clicked his fingers, a fire burst into life in the grate, and he bowed himself out of the room. â€Å"Sit down, Harry,† said Fudge, indicating a chair by the fire. Harry sat down, feeling goose bumps rising up his arms despite the glow of the fire. Fudge took off his pinstriped cloak and tossed it aside, then hitched up the trousers of his bottle-green suit and sat down opposite Harry. â€Å"I am Cornelius Fudge, Harry. The Minister of Magic.† Harry already knew this, of course; he had seen Fudge once before, but as he had been wearing his father's Invisibility Cloak at the time, Fudge wasn't to know that. Tom the innkeeper reappeared, wearing an apron over his nightshirt and bearing a tray of tea and crumpets. He placed the tray on a table between Fudge and Harry and left the parlor, closing the door behind him. â€Å"Well, Harry,† said Fudge, pouring out tea, â€Å"you've had us all in a right flap, I don't mind telling you. Running away from your aunt and uncle's house like that! I'd started to think†¦but you're safe, and that's what matters.† Fudge buttered himself a crumpet and pushed the plate toward Harry. â€Å"Eat, Harry, you look dead on your feet. Now then†¦You will be pleased to hear that we have dealt with the unfortunate blowing-up of Miss Marjorie Dursley. Two members of the Accidental Magic Reversal Department were dispatched to Privet Drive a few hours ago. Miss Dursley has been punctured and her memory has been modified. She has no recollection of the incident at all. So that's that, and no harm done.† Fudge smiled at Harry over the rim of his teacup, rather like an uncle surveying a favorite nephew. Harry, who couldn't believe his ears, opened his mouth to speak, couldn't think of anything to say, and closed it again. â€Å"Ah, you're worrying about the reaction of your aunt and uncle?† said Fudge. â€Å"Well, I won't deny that they are extremely angry, Harry, but they are prepared to take you back next summer as long as you stay at Hogwarts for the Christmas and Easter holidays.† Harry unstuck his throat. â€Å"I always stay at Hogwarts for the Christmas and Easter holidays,† he said, â€Å"and I don't ever want to go back to Privet Drive.† â€Å"Now, now, I'm sure you'll feel differently once you've calmed down,† said Fudge in a worried tone. â€Å"They are your family, after all, and I'm sure you are fond of each other — er — very deep down.† It didn't occur to Harry to put Fudge right. He was still waiting to hear what was going to happen to him now. â€Å"So all that remains,† said Fudge, now buttering himself a second crumpet, â€Å"is to decide where you're going to spend the last two weeks of your vacation. I suggest you take a room here at the Leaky Cauldron and†¦Ã¢â‚¬  â€Å"Hang on,† blurted Harry. â€Å"What about my punishment?† Fudge blinked. â€Å"Punishment?† â€Å"I broke the law!† Harry said. â€Å"The Decree for the Restriction of Underage Wizardry!† â€Å"Oh, my dear boy, we're not going to punish you for a little thing like that!† cried Fudge, waving his crumpet impatiently. â€Å"It was an accident! We don't send people to Azkaban just for blowing up their aunts!† But this didn't tally at all with Harry's past dealings with the Ministry of Magic. â€Å"Last year, I got an official warning just because a house-elf smashed a pudding in my uncle's house!† he told Fudge, frowning. â€Å"The Ministry of Magic said I'd be expelled from Hogwarts if there was any more magic there!† Unless Harry's eyes were deceiving him, Fudge was suddenly looking awkward. â€Å"Circumstances change, Harry†¦We have to take into account†¦in the present climate†¦Surely you don't want to be expelled?† â€Å"Of course I don't,† said Harry. â€Å"Well then, what's all the fuss about?† laughed Fudge. â€Å"Now, have a crumpet, Harry, while I go and see if Tom's got a room for you.† Fudge strode out of the parlor and Harry stared after him. There was something extremely odd going on. Why had Fudge been waiting for him at the Leaky Cauldron, if not to punish him for what he'd done? And now Harry came to think of it, surely it wasn't usual for the Minister of Magic himself to get involved in matters of underage magic? Fudge came back, accompanied by Tom the innkeeper. â€Å"Room eleven's free, Harry,† said Fudge. â€Å"I think you'll be very comfortable. just one thing, and I'm sure you'll understand†¦I don't want you wandering off into Muggle London, all right? Keep to Diagon Alley. And you're to be back here before dark each night. Sure you'll understand. Tom will be keeping an eye on you for me.† â€Å"Okay,† said Harry slowly, â€Å"but why?† â€Å"Don't want to lose you again, do we?† said Fudge with a hearty laugh. â€Å"No, no†¦best we know where you are†¦I mean†¦Ã¢â‚¬  Fudge cleared his throat loudly and picked up his pinstriped cloak. â€Å"Well, I'll be off, plenty to do, you know†¦Ã¢â‚¬  â€Å"Have you had any luck with Black yet?† Harry asked. Fudge's finger slipped on the silver fastenings of his cloak. â€Å"What's that? Oh, you've heard – well, no, not yet, but it's only a matter of time. The Azkaban guards have never yet failed†¦and they are angrier than I've ever seen them.† Fudge shuddered slightly. â€Å"So, I'll say good-bye.† He held out his hand and Harry, shaking it, had a sudden idea. â€Å"Er — Minister? Can I ask you something?† â€Å"Certainly,† said Fudge with a smile. â€Å"Well, third years at Hogwarts are allowed to visit Hogsmeade, but my aunt and uncle didn't sign the permission form. D'you think you could –?† Fudge was looking uncomfortable. â€Å"Ah,† he said. â€Å"No, no, I'm very sorry, Harry, but as I'm not your parent or guardian –â€Å" â€Å"But you're the Minister of Magic,† said Harry eagerly. â€Å"If you gave me permission†¦Ã¢â‚¬  â€Å"No, I'm sorry, Harry, but rules are rules,† said Fudge flatly. â€Å"Perhaps you'll be able to visit Hogsmeade next year. In fact, I think it's best if you don't†¦yes†¦well, I'll be off. Enjoy your stay, Harry.† And with a last smile and shake of Harry's hand, Fudge left the room. Tom now moved forward, beaming at Harry. â€Å"If you'll follow me, Mr. Potter,† he said, â€Å"I've already taken your things up†¦Ã¢â‚¬  Harry followed Tom up a handsome wooden staircase to a door with a brass number eleven on it, which Tom unlocked and opened for him. Inside was a very comfortable-looking bed, some highly polished oak furniture, a cheerfully crackling fire and, perched on top of the wardrobe — â€Å"Hedwig!† Harry gasped. The snowy owl clicked her beak and fluttered down onto Harry's arm. â€Å"Very smart owl you've got there,† chuckled Tom. â€Å"Arrived about five minutes after you did. If there's anything you need, Mr. Potter, don't hesitate to ask.† He gave another bow and left. Harry sat on his bed for a long time, absentmindedly stroking Hedwig. The sky outside the window was changing rapidly from deep, velvety blue to cold, steely gray and then, slowly, to pink shot with gold. Harry could hardly believe that he'd left Privet Drive only a few hours ago, that he wasn't expelled, and that he was now facing two completely Dursley-free weeks. â€Å"It's been a very weird night, Hedwig,† he yawned. And without even removing his glasses, he slumped back onto his pillows and fell asleep.

Tuesday, October 22, 2019

Double Click for TListView

Implementing On Item Click / Double Click for TListView Delphis TListView control displays a list of items in columns with column headers and sub-items, or vertically or horizontally, with small or large icons. As do most Delphi controls, the TListView exposes the OnClick and OnDblClick (OnDoubleClick) events. Unfortunately, if you need to know what item was clicked or double clicked you cannot simply handle the OnClick / OnDblClick events to get the clicked item. The OnClick (OnDblClick) event for the TListView is fired whenever the user clicks the control - that is whenever the click occurs somewhere inside the client area of the control. The user can click inside the list view, BUT miss any of the items. Whats more, since list view can change its display depending on the ViewStyle property, the user might have clicked on an item, on an item caption, on an item icon, nowhere, on an item state icon, etc. Note: the ViewStyle property determines how items are displayed in the list view: the items can be displayed as a set of movable icons, or as columns of text. ListView.On Item Click ListView.On Item Double Click To be able to locate the clicked (if there is one) item when the OnClick event for the list view is fired, you need to determine what elements of the list view lie under the point specified by the X and Y parameters - that is the location of the mouse at the moment of click. The TListiews GetHitTestInfoAt function returns information about the specified point in the list view’s client area. To make sure the item was clicked (or double clicked) you need to call the GetHitTestInfoAt and react only if the click event occurred on an actual item. Heres an example implementation of the ListView1s OnDblClick event: //handles ListView1s On Double Click procedure TForm.ListView1DblClick(Sender: TObject) ; var   Ã‚  hts : THitTests;   Ã‚  ht : THitTest;   Ã‚  sht : string;   Ã‚  ListViewCursosPos : TPoint;   Ã‚  selectedItem : TListItem; begin   Ã‚  //position of the mouse cursor related to ListView   Ã‚  ListViewCursosPos : ListView1.ScreenToClient(Mouse.CursorPos) ;   Ã‚  //double click where?   Ã‚  hts : ListView1.GetHitTestInfoAt(ListViewCursosPos.X, ListViewCursosPos.Y) ;   Ã‚  //debug hit test   Ã‚  Caption : ;   Ã‚  for ht in hts do   Ã‚  begin   Ã‚  Ã‚  Ã‚  sht : GetEnumName(TypeInfo(THitTest), Integer(ht)) ;   Ã‚  Ã‚  Ã‚  Caption : Format(%s %s | ,[Caption, sht]) ;   Ã‚  end;   Ã‚  //locate the double-clicked item   Ã‚  if hts [htOnIcon, htOnItem, htOnLabel, htOnStateIcon] then   Ã‚  begin   Ã‚  Ã‚  Ã‚  selectedItem : ListView1.Selected;   Ã‚  Ã‚  Ã‚  //do something with the double clicked item!   Ã‚  Ã‚  Ã‚  Caption : Format(DblClcked : %s,[selectedItem.Caption]) ;   Ã‚  end; end; In the OnDblClick (or OnClick) event handler, read the GetHitTestInfoAt function by providing it with the location of the mouse inside the control. To get the location of the mouse related to the list view, the ScreenToClient function is used to convert a point (mouse X and Y) in screen coordinates to local, or client area, coordinates. The GetHitTestInfoAt return a value of THitTests type. The THitTests is a set of THitTest enumerated values. The THitTest enumeration values, with their description, are: htAbove - above the client area.htBelow - below the client area.htNowhere - inside the control, but not on an item.htOnItem - on an item, its text, or its bitmap.htOnButton - on a button.htOnIcon - on an icon.htOnIndent - on the indented area of an item.htOnLabel - on a label.htOnRight - on the right side of an item.htOnStateIcon - on a state icon or bitmap associated with an item.htToLeft - to the left of the client area.htToRight - to the right of the client area. If the result of the call to GetHitTestInfoAt is a subset (Delphi sets!) of [htOnIcon, htOnItem, htOnLabel, htOnStateIcon] you can be sure the user clicked on the item (or on its icon / state icon). Finally, if the above is true, read the Selected property of the list view, it returns the first selected item (if multiple can be selected) in the list view. Do something with the clicked / double clicked / selected item ... Be sure to download the full source code to explore the code and learn by adopting it.