Thursday, December 26, 2019
Multithreaded Delphi Database Queries With dbGo (ADO)
By design, a Delphi application runs in one thread. To speed up some parts of the application you might want to decide to add several simultaneous paths of execution in your Delphi application. Multithreading in Database Applications In most scenarios, database applications you create with Delphi are single threadedââ¬âa query you run against the database needs to finish (processing of the query results) before you can fetch another set of data. To speed up data processing, for example, fetching data from the database to create reports, you can add an additional thread to fetch and operate on the result (recordset). Continue reading to learn about the 3 traps in multithreaded ADO database queries: Solve: CoInitialize was not called.Solve: Canvas does not allow drawing.Main TADoConnection cannot be used! Customer Order Scenario In the well-known scenario where a customer places orders containing items, you might need to display all the orders for a particular customer along the total number of items per each order. In a normal single threaded application you would need to run the query to fetch the data then iterate over the recordset to display the data. If you want to run this operation for more than one customer, you need to sequentially run the procedure for each of the selected customers. In a multithreaded scenario you can run the database query for every selected customer in a separate threadââ¬âand thus have the code execute several times faster. Multithreading in dbGO (ADO) Lets say you want to display orders for 3 selected customers in a Delphi list box control. type à à TCalcThread class(TThread)à à private à à à à procedure RefreshCount;à à protected à à à à procedure Execute; override;à à public à à à à ConnStr : widestring; à à à à SQLString : widestring; à à à à ListBox : TListBox; à à à à Priority: TThreadPriority; à à à à TicksLabel : TLabel; à à à à Ticks : Cardinal; à à end; This is the interface part of a custom thread class we are going to use to fetch and operate on all the orders for a selected customer. Every order gets displayed as an item in a list box control (ListBox field). The ConnStr field holds the ADO connection string. The TicksLabel holds a reference to a TLabel control that will be used to display thread executing times in a synchronized procedure. The RunThread procedure creates and runs an instance of the TCalcThread thread class. function TADOThreadedForm.RunThread(SQLString: widestring; LB:TListBox; Priority: TThreadPriority; lbl : TLabel): TCalcThread;var à à CalcThread : TCalcThread; begin à à CalcThread : TCalcThread.Create(true) ; à à CalcThread.FreeOnTerminate : true; à à CalcThread.ConnStr : ADOConnection1.ConnectionString; à à CalcThread.SQLString : SQLString; à à CalcThread.ListBox : LB; à à CalcThread.Priority : Priority; à à CalcThread.TicksLabel : lbl; à à CalcThread.OnTerminate : ThreadTerminated; à à CalcThread.Resume; à à Result : CalcThread; end; When the 3 customers are selected from the drop down box, we create 3 instances of the CalcThread: var à à s, sg: widestring; à à c1, c2, c3 : integer; begin à à s : SELECT O.SaleDate, MAX(I.ItemNo) AS ItemCount à à à à à à à FROM Customer C, Orders O, Items I à à à à à à à WHERE C.CustNo O.CustNo AND I.OrderNo O.OrderNo ; à à sg : GROUP BY O.SaleDate ; à à c1 : Integer(ComboBox1.Items.Objects[ComboBox1.ItemIndex]) ; à à c2 : Integer(ComboBox2.Items.Objects[ComboBox2.ItemIndex]) ; à à c3 : Integer(ComboBox3.Items.Objects[ComboBox3.ItemIndex]) ; à à Caption : ; à à ct1 : RunThread(Format(%s AND C.CustNo %d %s,[s, c1, sg]), lbCustomer1, tpTimeCritical, lblCustomer1) ; à à ct2 : RunThread(Format(%s AND C.CustNo %d %s,[s, c2, sg]), lbCustomer2, tpNormal,lblCustomer2) ; à à ct3 : RunThread(Format(%s AND C.CustNo %d %s,[s, c3, sg]), lbCustomer3, tpLowest, lblCustomer3) ; end; Traps and Tricks With Multithreaded ADO Queries The main code goes in the threads Execute method: procedure TCalcThread.Execute;var à à Qry : TADOQuery; à à k : integer; beginà à inherited;à à CoInitialize(nil) ; //CoInitialize was not called à à Qry : TADOQuery.Create(nil) ;à à try// MUST USE OWN CONNECTION // Qry.Connection : Form1.ADOConnection1; à à à à Qry.ConnectionString : ConnStr; à à à à Qry.CursorLocation : clUseServer; à à à à Qry.LockType : ltReadOnly; à à à à Qry.CursorType : ctOpenForwardOnly; à à à à Qry.SQL.Text : SQLString; à à à à Qry.Open; à à à à while NOT Qry.Eof and NOT Terminated do à à à à begin à à à à à à ListBox.Items.Insert(0, Format(%s - %d, [Qry.Fields[0].asString,Qry.Fields[1].AsInteger])) ; à à à à à à //Canvas Does NOT Allow Drawing if not called through Synchronize à à à à à à Synchronize(RefreshCount) ; à à à à à à Qry.Next; à à à à end;à à finally à à à à Qry.Free; à à end; à à CoUninitialize() ; end; There are 3 traps you need to know how to solve when creating multithreaded Delphi ADO database applications: CoInitialize and CoUninitialize must be called manually before using any of the dbGo objects. Failing to call CoInitialize will result in the CoInitialize was not called exception. The CoInitialize method initializes the COM library on the current thread. ADO is COM.You *cannot* use the TADOConnection object from the main thread (application). Every thread needs to create its own database connection.You must use the Synchronize procedure to talk to the main thread and access any controls on the main form.
Wednesday, December 18, 2019
What Makes A Good Manager - 3150 Words
1.0 Introduction ââ¬â What it takes to be a good manager? Becoming an efficient and effective manager is an extremely challenging role especially in todayââ¬â¢s challenging business environment and during times of economic downturn. According to Aaron G.A. (2006), leadership is correlated to organizational and employee performance as leaders influence employees to help achieve organizational goals. Managers need to adopt a continuous learning attitude, personally aware of own strengths and weaknesses and practicing high emotional intelligence in order to be a sustainable competent manager. According to Mcgregorââ¬â¢s theory, Theory-X managers perceive employees to have a tendency to avoid work, while Theory-Y manager gives employees flexibility and empowerment this in return helps develop employeesââ¬â¢ decision making skills (McGregor, D. (1960)). When manager is managing a complex mixture of workforce, they will also need to have the flexibility to switch roles. This means besides being self-aware of the weaknesses and understanding the behavior of employees that they are managing, managers need to constantly monitor their self-development plan to ensure there are improvement in personal growth and prepare for future career development. As weââ¬â¢re moving towards a new market trend, every organization is emphasizing on innovation of ideas to improve business strategy and creation of new technology. Manager should also continuously acquire new skills and knowledge to keep themselvesShow MoreRelatedWhat Makes A Good Manager?1053 Words à |à 5 PagesWhat makes people successful? To gain satisfaction in your career is to know yourself and know what you want. Greatest role in the firm s manager or the company s success. Why is this so? The simple reason that he/she is a planner, supervisor and responsible for the firm s worker comes to successfully implement what determines the profitability of the firm. Some people are born leaders, others are further studying the art of management. What should be the manager? Many of these qualities of aRead MoreWhat Makes a Good Manager978 Words à |à 4 Pagesconducts, supervises or manages a business or household affairs is known as manager. According to the Oxford English Dictionary (2010), Manager is the person responsible for controlling or administering an organization or group of staff. However, there is a big difference between being a manager and being a ââ¬Å"goodâ⬠manager. A good manager should have some very basic qualities. He or she must have a strong communication skills, good imagination, high level of energy, problem solving skills, different typeRead MoreWhat Makes A Good Manager?1147 Words à |à 5 Pagesa set of skills and competencies which make shape that person into what is he. What defines a person is his personality and this personality shapes a managerââ¬â¢s effectiveness in a workplace. I feel that maintainin g a positive work ethic is always a choice for anyone and itââ¬â¢s certainly not a result of the personality type. There are certain traits for every personality and those traits show the true person. Like for example, I feel that in a workplace a manager needs a certain set of skills and needsRead MoreWhat Makes a Good Manager1009 Words à |à 5 PagesWhat Makes a Good Manager? I have had a total of 6 managers over the course of 21 years. By now I have a very solid idea of which qualities a good manager should possess. I have run from one extreme to the other, my worst manager was fired for stealing, and my best manager has been promoted 4 times since I last worked there, and is an outstanding asset to the company. The basic understanding that a manager needs to have is an objective view. This is extremely difficult to do as emotionsRead MoreWhat Makes A Good Manager?1046 Words à |à 5 Pagesdecades. When Jack Welch was asked, ââ¬Å"What makes a good manager?â⬠, this was his response: ââ¬Å"I prefer the term ââ¬Å"business leader.â⬠Good business leaders create a vision, articulate the vision, passionately own the vision, and relentlessly drive it to completion. Above all else, though, good leaders are open. They go up, down, and around their organization to reach people. They donââ¬â¢t stick to the established channels. Theyââ¬â¢re informal. Theyââ¬â¢re straight with people. They make a religion out of being accessibleRead MoreWhat Makes A Good Manager?1310 Words à |à 6 Pagesa set of skills and competencies which make shape that person into what is he. What defines a person is his personality and this personality shapes a managerââ¬â¢s effectiveness in a workplace. I feel that maintaining a positive work ethic is always a choice for anyone and itââ¬â¢s certainly not a result of the personality type. There are certain traits for every personality a nd those traits show the true person. Like for example, I feel that in a workplace a manager needs a certain set of skills and needsRead MoreA Better Manager : What Makes A Good Manager?1417 Words à |à 6 PagesA Better Manager 1 Conflict is when you are coming into a disagreement or an argument that may arise. As a manager in a workforce, that manager should always expect to have some sort of conflict; whether it is with other managers or subordinates that work under that management. There is very difference situation in which makes a good manager versus what makes a bad manager. For instance, most successful managers come from life experience such as learning the techniques of handlingRead MoreWhat Makes A Good Manager Or Good Leader?2046 Words à |à 9 PagesPrinciples of Management What qualities are needed to be a good manager or good leader? There are many differing theories and approaches to defining and understanding management and what makes up a good leader. Some theories believe that individuals were born with a natural instinct to manage or lead people, while other theories believe it is a learned skill through education and or developed the skills over years of experience. Whereas leadership appears and looks differently for everyone, thereRead MoreWhat Makes a Good and a Bad Manager?837 Words à |à 3 PagesIntroduction Why do some individuals become good managers while others do not? Lack of good managerial skills contributes to poor management. The issue is that these individuals have not developed the required skills and behavior because they had not had any formal training on managerial skills. In most cases, people are promoted into managerial positions but they are not offered right support and development to fulfill their duties adequately. Most corporate professionals will find themselves inRead Moremanagement style essay973 Words à |à 4 PagesHCS/325 August 26, 2014 Jennie Anderson Management Style Paper Many people believe they can either be a good or great manager. The actual reality to this is some people are actually not fit to be a manager either because they do not know what to do or because they do not know how to handle themselves. Throughout this paper, management styles will be discussed, and the qualities of a good manager. Management Management is usually the people that hold the business together. Whether it is making
Monday, December 9, 2019
Elements of Romantic Poetry Essay Example For Students
Elements of Romantic Poetry Essay Romanticism, according to these poets mainly was all about unabashed emotions. Wordsmith in his preface to the lyrical ballads defined romantic poetry as the spontaneous overflow of powerful feelings These poets wrote mostly about Nature, William Wordsmith wrote about supernaturalism, believing in freedom and spontaneous creativity not order and imitation. He also emphasizes the omnipotence of the use of meter in poetry (which he views as one of the key features that differentiates poetry from prose) Canadian, a famous writer, defines Romanticism in A History of English Literature as, The Romantic spirit can be fined as an accentuated predominance of emotional life, provoked or directed by the exercise of imaginative vision, and in its turn stimulating or directing such exercise. Romantic poetry has many characteristics, with nature being the foremost element. Nature for them is a wellspring of inspiration, satisfaction and happiness. It is vital to note that all the romantic poets differed in their views about nature. Wordsmith is considered the great lover of nature. Wordsmith recognized nature as a living thing, teacher, god and everything. He was the true adorer of nature. Keats describes his love for nature in a simple poem the cricket and the grasshopper. He describes how during the warmth of the night you can hear the cricket chirping and it is a soothing sound. He describes the whistling of the kettle, Shells, another romantic poet views nature entirely from a different aspect. Where Wordsmith gives more off philosophical touch to nature, shells describes nature, its intellectual aspect. John Keats, another nature lover, adored nature for its sensuousness and beauty, not for its intellectual aspect or philosophical nature. In his poem ode to autumn he describes the autumn season, going deep into the nature, connecting it with real life, in awe of it. In his poem he describes autumn as Season of mists and mellow fruitfulness! Close bosom-friend of the maturing sun; Conspiring with him how to load and bless With fruit the vines that round the thatch-eaves run Escapism is another characteristic very evident in the poetry in the romantic era. Escapism is a term, which implies a writers failure to face the agonies of real life and take shelter somewhere else instead of fighting against the odds. Since most of the toes at that time wrote for the people, about the everyday miseries, they themselves too were inflicted upon by these miseries. They used this world as a sanction, as an escape from their everyday life. A very good example of this would be of John Keats who describes his feelings in Ode to Nightingale as Away! Away! For I will fly to thee,Not charioted by Bacchus and his parks, But on the viewless wings of Poesy. In this poem he mentions wanting to fly away with the nightingale. Melancholy is another aspect in the poems of the romantic era. The poets Just wanted to give vent o their feelings and emotions so that they ease their minds. They wanted to take a load of their minds. Or sometimes the poets Just talk about their reflections in life, keeping it simple. In Robert frosts poem stopping by the woods on a snowy evening, he reflects on his life. He implies even though when he turns old he must keep his promises in his last few lines. He says even though the woods are attractive in a sense he has liabilities to the outside world too, as he says woods are lovely, dark and deep, But I have promises to keep, And miles to go before I sleep, And miles to go before I sleep. The Morals or encouragement is also a part of the elements of the romantic poetry. .ucb6739b3928f4fe732421cbef44be5d5 , .ucb6739b3928f4fe732421cbef44be5d5 .postImageUrl , .ucb6739b3928f4fe732421cbef44be5d5 .centered-text-area { min-height: 80px; position: relative; } .ucb6739b3928f4fe732421cbef44be5d5 , .ucb6739b3928f4fe732421cbef44be5d5:hover , .ucb6739b3928f4fe732421cbef44be5d5:visited , .ucb6739b3928f4fe732421cbef44be5d5:active { border:0!important; } .ucb6739b3928f4fe732421cbef44be5d5 .clearfix:after { content: ""; display: table; clear: both; } .ucb6739b3928f4fe732421cbef44be5d5 { display: block; transition: background-color 250ms; webkit-transition: background-color 250ms; width: 100%; opacity: 1; transition: opacity 250ms; webkit-transition: opacity 250ms; background-color: #95A5A6; } .ucb6739b3928f4fe732421cbef44be5d5:active , .ucb6739b3928f4fe732421cbef44be5d5:hover { opacity: 1; transition: opacity 250ms; webkit-transition: opacity 250ms; background-color: #2C3E50; } .ucb6739b3928f4fe732421cbef44be5d5 .centered-text-area { width: 100%; position: relative ; } .ucb6739b3928f4fe732421cbef44be5d5 .ctaText { border-bottom: 0 solid #fff; color: #2980B9; font-size: 16px; font-weight: bold; margin: 0; padding: 0; text-decoration: underline; } .ucb6739b3928f4fe732421cbef44be5d5 .postTitle { color: #FFFFFF; font-size: 16px; font-weight: 600; margin: 0; padding: 0; width: 100%; } .ucb6739b3928f4fe732421cbef44be5d5 .ctaButton { background-color: #7F8C8D!important; color: #2980B9; border: none; border-radius: 3px; box-shadow: none; font-size: 14px; font-weight: bold; line-height: 26px; moz-border-radius: 3px; text-align: center; text-decoration: none; text-shadow: none; width: 80px; min-height: 80px; background: url(https://artscolumbia.org/wp-content/plugins/intelly-related-posts/assets/images/simple-arrow.png)no-repeat; position: absolute; right: 0; top: 0; } .ucb6739b3928f4fe732421cbef44be5d5:hover .ctaButton { background-color: #34495E!important; } .ucb6739b3928f4fe732421cbef44be5d5 .centered-text { display: table; height: 80px; padding-left : 18px; top: 0; } .ucb6739b3928f4fe732421cbef44be5d5 .ucb6739b3928f4fe732421cbef44be5d5-content { display: table-cell; margin: 0; padding: 0; padding-right: 108px; position: relative; vertical-align: middle; width: 100%; } .ucb6739b3928f4fe732421cbef44be5d5:after { content: ""; display: block; clear: both; } READ: Lord of the Rings-Return of the King EssayAs Robert frost writes in his the road not taken, that he followed a path which wasnt much treaded upon. He teaches us in this poem that there are always different routes and different choices in life, and it isnt necessary that we follow the same path others do. He teaches us to have a sense of differentiation and uniqueness to be the first one to initiate something, setting an example to follow. Imagination is another important element. S. T Coleridge, in his very famous poem Kabul Khan splays a magnificent work of imagination. This poem is solely about the great conqueror Kabul Khans imaginary palace. The poet talks about the river flowing beside his awe inspiring palace. He talks about the fertile lands, about greenery, about the sacred river hitting hard against the rocks. Alpha, the sacred river, ran Through caverns measureless to man Down to a sunless sea. So twice five miles of fertile ground With walls and towers were girdled round; And there were gardens bright with sinuous rills, Where blossomed many an incense-bearing tree; And here were forests ancient as the hills, Enfolding sunny spots of greenery. Where He further goes on to describing Kabul Khan as a powerful warrior saying And all who heard should see them there, And all should cry, Beware! Beware! His flashing eyes, his floating hair! Supernaturalism is another important feature of romantic poetry. Most of the romantic poets used supernatural elements in their poetry. Supernaturalism is a unique trait of romantic poets. They used supernatu ralism not Just for the creation o horror and awe; rather, they used it for the pleasure of the reader. Samuel Coleridge is the leading romantic poet in this regard. His poem, Kabul Khan is the most romantic poem in the history of English literature. It is completely the product of his imagination. The whole poem is a collection of supernatural elements. Subjectivity and idealization about women and children were two other elements. Most poems did not contain only one element, they contained a blend of many elements. Kabul khan, for example, contained imagination, melancholy and supernaturalism. The poems of this era were for pleasure for knowledge of the past and for moral lessons. There is much to learn from this golden era, much to ponder upon.
Monday, December 2, 2019
Raising Finance Essay Example
Raising Finance Essay Raising Finance Source of finance Description of source of finance Advantages Disadvantrages Personal sources Peronal sources tend to be the first form of finance used by very small firms. And important personal source of finance is the savings that the entrepreneur accumulated before starting up the business. #Savings are a cheap form of finance as they do not involve paying any interest. #1Jsing savings enables the owner to keep control of the business. This is especially valuable to those owners who are choosing to run a business partly so they can enjoy the independence it gives them. Setting up a new business is always risky. With high failure rates among new businesses, there is a good chance that an entrepreneur will quickly lose savings that have taken a long time to accumulate. #Many entrepreneurs do no have sufficient savings to finance a new business. Older people are more likely to have accumulate savings but it is often the young who have the most innovative ideas Ordinary share capital Ordinary Share Capital are the resources supplied to the company (equity capital) through the issuance of ordinary shares. Ordinary shares refer to certificates/ ecurities enabling owners to possess a portion of the company through contributing to the equity capital of the company in the primary stock exchange market, i. e. first- hand trading of shares. Ordinary Share Capital also contribute to a part of the shareholders funds #Shareholders have the right to vote #Shareholders have the ability to elect the board of directors #Shareholders are able to buy as many new stocks as possible #Share prices fluctuate a lot, which short term oriented investors find very distressing. Some companies go broke, and due to the occasional dishonest auditor you wont be able to see it coming. Therefore you need to diversify a lot, though this is easyto do since you can buy small amounts of shares. #Shares require analysis and hard work if you are going todo better than average. Venture capital Venture Capital is the capital provided by firms of professionals who invest alongside management in young,rapidly growing compan ies have the potential for high growth. We will write a custom essay sample on Raising Finance specifically for you for only $16.38 $13.9/page Order now We will write a custom essay sample on Raising Finance specifically for you FOR ONLY $16.38 $13.9/page Hire Writer We will write a custom essay sample on Raising Finance specifically for you FOR ONLY $16.38 $13.9/page Hire Writer Thus a Venture Capitalist (VC) may provide theseed capital for unproven ideas, products or technology-oriented firms. The VC may also invest in a firm unableto raise finance through conventional means. Venture capitalists provide companies with ongoing strategic, operational and financial advice. They will typically have nominee directors appointed to the companys board and often become intimately involved with the strategic direction of the company. Venture capitalists can introduce the company to an extensive network of strategic partners both domestically and internationally and may also identify potential acquisition targets for the business and facilitate the acquisition. #Most venture capitalists seek to realise their investment in a company in three to five years. If an entrepreneurs capital may not be appropriate. #Venture capitalists are typically more sophisticated and may drive a harder bargain. Venture capitalists are more likely to want to influence the strategic directi on of the company. #Venture capitalists are more likely to be interested in taking control of the company if the management is unable to drive the business. Loan capital such as bank loans Loan capital may be obtained from a bank or finance company as long-term loans, or from debt-equity investors in the form of debentures or preferred stock (preference hares), and is usually secured by a fixed and/or floating charge on the companys assets. Unlike debt capital, it does not include short-term loans (such as overdraft). Also called borrowed capital. #A bank loan can be secured quickly; in less than an hour, a qualified borrower can complete a bank loan transaction. #A bank loan can be used in a number of ways; money can be borrowed for many large-ticket items, such as furniture, vehicles or home renovations. #Some loans carry a prepayment penalty, preventing the borrower from paying the note off early without incurring extra cost. There are a number of limitations on the transaction. Good credit is often required to borrow money, and there are stipulations on how the money can be used. Borrowing too much money can lead to decreased cash flow and payments can even overtake income in some cases; this is why many loan payments are limited to a certain percentage of a borrowers income. Bank overdrafts Bank overdraft) a short term loan taken out by a company or individual that is normally repayable on demand. #A bank loan can be secured quickly; in less than an hour, a qualified borrower can complete a bank loan transaction.
Subscribe to:
Posts (Atom)