Monday, October 21, 2019

How to Manipulate INI files from Delphi

How to Manipulate INI files from Delphi INI files are text-based files used for storing an applications configuration data. Even though Windows recommends using the Windows Registry to store application-specific configuration data, in many cases, youll find that INI files provide a quicker way for the program to access its settings. Windows itself even uses INI files;  desktop.ini  and boot.ini  being just two examples. One simple use of INI files  as a status saving mechanism would be to save the size and location of a form if you want a form to reappear at its previous position. Instead of searching through a whole database of information to find the size or location, an INI file is used instead. The INI File Format Initialization or Configuration Settings file (.INI) is a text file with a 64 KB limit divided into sections, each containing zero or more keys. Each key contains zero or more values. Heres an example: [SectionName] keyname1value ;comment keyname2value Section names are enclosed in square brackets and must begin at the beginning of a line. Section and key names are case-insensitive (the case doesnt matter), and cannot contain spacing characters. The key name is followed by an equal sign (), optionally surrounded by spacing characters, which are ignored. If the same section appears more than once in the same file, or if the same key appears more than once in the same section, then the last occurrence prevails. A key can contain string, integer, or boolean value.​ Delphi IDE uses the INI file format in many cases. For example, .DSK files (desktop settings) utilize the INI format. TIniFile Class Delphi provides the TIniFile class, declared in the inifiles.pas unit, with methods to store and retrieve values from INI files. Prior to working with the TIniFile methods, you need to create an instance of the class: uses inifiles; ... var   Ã‚  IniFile : TIniFile; begin   Ã‚  IniFile : TIniFile.Create(myapp.ini) ; The above code creates an IniFile object and assigns myapp.ini to the only property of the class - the FileName property - used to specify the name of the INI file you are to use. The code as written above looks  for the myapp.ini file in the \Windows directory. A better way to store application data is in the applications folder - just specify the full pathname of the file for the Create method: // place the INI in the application folder, // let it have the application name // and ini for extension: iniFile : TIniFile.Create(ChangeFileExt(Application.ExeName,.ini)) ; Reading From INI The TIniFile class has several read methods. The ReadString reads a string value from a key, ReadInteger. ReadFloat and similar are used to read a number from a key. All read methods have a default value that can be used if the entry does not exist. For example, the ReadString is declared as: function ReadString(const Section, Ident, Default: String): String; override; Write to INI The TIniFile has a corresponding write method for each read method. They are WriteString, WriteBool, WriteInteger, etc. For example, if we want a program to remember the name of the last person who used it, when it was, and what the main form coordinates were, we might establish a section called Users, a keyword called Last, Date  to track the information, and a section called Placement  with keys Top,  Left,  Width, and Height. project1.ini   [User]   LastZarko Gajic   Date01/29/2009   [Placement]   Top20   Left35   Width500   Height340 Note that the key named Last holds a string value, Date holds a TDateTime value, and all keys in the Placement section hold an integer value. The OnCreate event of the main form is the perfect place to store the code needed to access the values in the applications initialization file: procedure TMainForm.FormCreate(Sender: TObject) ; var   Ã‚  appINI : TIniFile;   Ã‚  LastUser : string;   Ã‚  LastDate : TDateTime; begin   Ã‚  appINI : TIniFile.Create(ChangeFileExt(Application.ExeName,.ini)) ;   Ã‚  try   Ã‚  Ã‚  Ã‚  //if no last user return an empty string   Ã‚  Ã‚  Ã‚  LastUser : appINI.ReadString(User,Last,) ;   Ã‚  Ã‚  Ã‚  //if no last date return todays date   Ã‚  Ã‚  Ã‚  LastDate : appINI.ReadDate(User, Date, Date) ;   Ã‚  Ã‚  Ã‚  //show the message   Ã‚  Ã‚  Ã‚  ShowMessage(This program was previously used by LastUser on DateToStr(LastDate));   Ã‚  Ã‚  Ã‚  Top : appINI.ReadInteger(Placement,Top, Top) ;   Ã‚  Ã‚  Ã‚  Left : appINI.ReadInteger(Placement,Left, Left);   Ã‚  Ã‚  Ã‚  Width : appINI.ReadInteger(Placement,Width, Width);   Ã‚  Ã‚  Ã‚  Height : appINI.ReadInteger(Placement,Height, Height);   Ã‚  finally   Ã‚  Ã‚  Ã‚  appINI.Free;   Ã‚  end; end; The main forms OnClose event is ideal for the Save INI part of the project. procedure TMainForm.FormClose(Sender: TObject; var Action: TCloseAction) ; var   Ã‚  appINI : TIniFile; begin   Ã‚  appINI : TIniFile.Create(ChangeFileExt(Application.ExeName,.ini)) ; try   Ã‚  Ã‚  Ã‚  appINI.WriteString(User,Last,Zarko Gajic) ;   Ã‚  Ã‚  Ã‚  appINI.WriteDate(User, Date, Date) ;   Ã‚  Ã‚  Ã‚  with appINI, MainForm do   Ã‚  Ã‚  Ã‚  begin   Ã‚  Ã‚  Ã‚  Ã‚  Ã‚  WriteInteger(Placement,Top, Top) ;   Ã‚  Ã‚  Ã‚  Ã‚  Ã‚  WriteInteger(Placement,Left, Left) ;   Ã‚  Ã‚  Ã‚  Ã‚  Ã‚  WriteInteger(Placement,Width, Width) ;   Ã‚  Ã‚  Ã‚  Ã‚  Ã‚  WriteInteger(Placement,Height, Height) ;   Ã‚  Ã‚  Ã‚  end;   Ã‚  finally   Ã‚  Ã‚  Ã‚  appIni.Free;   Ã‚  end; end; INI Sections The EraseSection erases an entire section of an INI file. ReadSection and ReadSections fill  a TStringList object with the names of all sections (and key names) in the INI file. INI Limitations Downsides The TIniFile class uses the Windows API  which imposes a limit of 64 KB on INI files. If you need to store more than 64 KB of data, you should use the TMemIniFile. Another problem might arise if you have a section with more than 8 K value. One way to solve the problem is to write your own version of the ReadSection method.

Sunday, October 20, 2019

How to Write a Financial Case Study

How to Write a Financial Case Study How to Write a Financial Case Study A financial case study is important in that it helps the finances student as well as financial practitioners in the mastery of the elements described in financial planning standards. The procedure used in writing a financial case study is one of the simplest to follow. This is primarily because it basically consists of specified figures, hence, simplicity. The initial step in the writing of a financial case study involves evaluating a client’s financial situation and identifying specific goals as well as stating the objective of the case study, which might be to avoid the mismanagement of funds for a particular individual or an organization, for example. The second step is to determine the main areas that are to be addressed in a financial plan. Later, the writing of a plan will include the methods that will be used in order to maintain cash flow while minimizing its wastage. The fourth step is the identification of any additional data that could be useful in the establishment of a financial plan. Lastly, various strategies are utilized and recommendations given in the financial plan to satisfactorily address the user’s needs. It is of crucial importance to follow the careful structure of a financial case study when composing its draft or outline. This will affect the logic and flow of narration in the paper. No matter which topic you select to explore, no structural component can be omitted. It is sometimes also important to receive feedback from your supervisor or scientific advisor on the initial stage of researching. This will help to direct your work in an appropriate manner. Additionally, be certain to proofread, edit, and double-spellcheck your composed paper before submitting it. A poorly written paper containing mistakes and other flaws will hardly earn a high grade. Finally, be aware of plagiarism! This is a very serious issue that may lead to major negative consequences affecting your academic career. Properly cite all sources used in your financial case study to ensure that you have not stolen somebodys words, ideas, or research, be it in print, online, or in some other format. Composing a financial case study is quite a complicated matter, so one can sometimes find it difficult to handle especially if one lacks time, skills, and subject knowledge. Still, this is not a reason to lose heart. You can always depend on the professional help of a custom writing company. These days, you may choose one from a wide range of online agencies and entrust your financial case study to their writers. Do not doubt that your paper will be composed and submitted to you by a given deadline and according to your specified requirements. Academic writers at can provide you with quality Finance case study help starting at $13/page. We guarantee non-plagiarized custom case studies with timely delivery.

Saturday, October 19, 2019

Check instruction Essay Example | Topics and Well Written Essays - 250 words

Check instruction - Essay Example 324). Islam had spread wide across the horn of Africa and the countries that lie north within two generations. Islam has been in African continent for many years since the formation of Arabian Peninsula. Although Sunni makes up the largest number of African Muslims, the complexity of African Islam is revealed in May schools of thought. Islam is not stagnant; it is constantly undergoing changes forced by economic, social and political conditions surrounding it. African Islam is commonly adapted to beliefs and cultural context of the local’s orthodoxies. Additions, both global and local; dimensions, are posed by Islam. The African Muslims mainly belong to the Sunni denomination. Despite this domination, a significant number of both the Shias and Ahmadiyya are also present. Many Sufis are known to be syncretic, and they practice Sufism with traditional folklore beliefs. Salafism is new, and it has started spreading in Africa due to many organizations and

Welfare and Poverty in America Essay Example | Topics and Well Written Essays - 1250 words

Welfare and Poverty in America - Essay Example This is because of the particular socio political situation exists in that country. For an understanding of the welfare measures and poverty in America, we have to discuss the history of America from its existence. America was a land of large animals. Human beings entered this land for hunting these animals. The first people reached North America did not realized that they had crossed into a new continent. They had been following hunting entertainment which their ancestors had for thousands of years, along the Siberian coast and then across the land bridge. It takes thousands of years for North Americans to construct a new land which is now known as United States. Evidence of early life in North America continues to be found. Little of it, however, can be reliably dated before 12,000 B.C.; a recent discovery of a hunting lookout in northern Alaska, for example, may date from almost that time. So too may the finely crafted spear points and items found near Clovis, New Mexico. It is believed that life was established in North and South America prior to 10,000 BC. Slowly people started agricultural practices in this land. The Native Americans started cultivating corn, squash and beans in 8,000 BC in Central Mexico. Slowly this had spread to northern parts. Adenans are said to be the first Native American group. They construct shelter around 600 BC. Of late these Adenans were replaced by various groups called Hopewellians. There centre of activities were around Southern Ohio. These groups are considered to be traders and exchanged tools and materials in wide range of area. By A D 500, These Hopewellians disappeared and appeared Mississippians. They had expertise in hunting, foraging, trading, and agriculture for their food and supplies. Influenced by the thriving societies to the south, they evolved into complex hierarchical

Friday, October 18, 2019

An Option to Overcome Water Scarcity and Environmental Issues Essay

An Option to Overcome Water Scarcity and Environmental Issues - Essay Example However, â€Å"75 percent† of water derives from Northern parts whereas â€Å"80 percent† demand occurs from Southern and coastal California (2). Thus, it transpires that if the resourcing from Northern part is stopped, Southern California will have a water crisis. The population of California, estimated at â€Å"38 million in January 2008† is predicted to climb up to â€Å"59.5 million by 2050† (2). Therefore, in the future, the demand of water for Southern California will multiply. Thus, there is a need to assess the water requirements as well as finding solutions to resolve problem in areas that face scarcity. Two Faulty Arguments on Wasting Water: Water, though a natural resource that humans get easily and sometimes freely, is a very precious element for attaining progress in all areas including economic development. However, people tend to ignore this fact and do not care to preserve water or use their water resources sparingly. Thus, most people make a faulty assumption that paying water bills bestows on them the right to waste water. This argument is not tenable as there are many people who confront the acute shortage of water and they can perhaps subsist on the droplets that others unnecessarily waste. People think that water is an element that is abundantly available on earth and, therefore, they possess the discretion to use it as much as they want. This contention is not correct as resources, no matter how abundant they may appear, will exhaust through overconsumption. Increasing population is a major concern in all countries across the globe, with increased age expectancy as a result of advanced technologies in healthcare and medicine. Thus, people need to acknowledge the demand of future generations before using water beyond a reasonable limit. Besides, several emerging threats such as climate changes and global warming can cause severe draughts in the future. Thus, people must take into account these factors before pres uming that they can waste water as it is abundantly available at the moment. The Need for Replacing Lawns with Xeriscaped Gardens: Lawns need regular watering, mowing, manicuring and fertilizing for their upkeep and maintenance. Besides, to keep them safe from pests and other insects, they also demand the use of pesticides at frequent intervals. The government or local authorities, on many occasions, impose restrictions on the use of water as a result of drought conditions. On such occasions it becomes extremely difficult for people to maintain their lawns. Thus, the maintenance of lawns entails major concerns both in terms of scarcity as well as wastage of water. Research evidence suggests that a yard size of 25 x 40 consumes up to â€Å"1000 gallons of water† in summers (Ratliff 40). The same research also finds that lawns in the US consume over â€Å"70 million pounds of pesticides† in their tending and some of it â€Å"seeps into groundwater,† posing threat to both humans and wildlife (40). Lawn mowers also cause air pollution. Thus, when one considers the problems entailing from lawn maintenance, it appears that such landscaping, while provides homes an aesthetic appeal, comes with a lot negative impact on human life. Therefore, several environmentalists argue that lawns symbolize â€Å"wasteful disregard for the biosphere† (40). On the other hand, many people support the concept of natural landscaping, which, they believe, has many advantages. Proponents of this concept contend it reduces water wastage as well as the usage of pesticides considerably. Sandra Walk, a landscape architect, never installs turfs and she promotes the use of

Data Analyses Research Paper Example | Topics and Well Written Essays - 750 words

Data Analyses - Research Paper Example Almost 95 % a vast majority turned out to be as a full time student with only 5 % studying as part time students. When question was asked regarding their drinking habit on campus 48 respondents out of 58 said that they don’t drink on campus however 9 respondents said they rarely drink on campus where as only 1 respondent said that he/she drink occasionally. When respondents were asked regarding bar on campus and how would it affect the school’s social atmosphere and help in reducing the stress amongst students? The answers were of split nature few endorsing it few going against it and few chose air of finality or stayed neutral. The facts and figures regarding this question are, 17 respondents strongly opposing the idea of campus on bar on the other hand 11 respondents were strongly supporting this idea. Furthermore 6 respondents believe that its impacts would not turn out to be fruitful so they opposed it by demonstrating and marking no in questionnaire however 20.7 % (12 respondents) were unsure so they remained neutral. The final 12 respondents out of 58 were confident that bar on campus will help students to reduce stress and there is no harm in it. 16 students out of 58 were confident about allowing 2 drinks per day which also makes them majority, however 15 respondents believe that only one drink should be allowed per day, 11 respondents have different ideas they believe that this intake should be raise up to 3 drinks per day while 13 respondents were against all restriction claiming that there should be no limit on drinking per day for students. There were quite a few alternatives that come across while performing research. The first and foremost was that the school should focus on promoting sports and other extracurricular activities rather than opening bar on campus as this will shift students focus towards other things, another alternative was regarding

Thursday, October 17, 2019

Meth Study Essay Example | Topics and Well Written Essays - 750 words

Meth Study - Essay Example Hence in a long term user of methamphetamine, there is the likelihood of having experienced methamphetamine in its various forms (Christophersen, 2000) Methamphetamine can be administered through several routes inclusive of smoking, snorting, orally and intravenously using its crystalline form (Methamphetamine Information: history of methamphetamine). Effects of methamphetamine use could vary depending on the route of administration. For example when crystalline form of methamphetamine is used intravenously, there is a rapid increase in blood pressure. Repeated intravenous use of methamphetamine could thus enhance the risk of arteriosclerosis (Berankova, Habrdova, Balikova & Strejc, 2005) These two factors increase the relevance of the history of the misuse of methamphetamine in a long term user, in studies related to methamphetamine misuse. This is the main limitation in methamphetamine misuse studies, as reliable history may not be available. According to Colfax (2005), confusion is demonstrated by individuals addicted to methamphetamine. This means that reliable history of misuse cannot be got from the concerned individual. Tests and analysis of blood and urine are not capable of providing sufficient information relating to the history of the misuse. This limitation on the availability of sufficient and reliable information makes it difficult to correlate reliably the results available to the toxic effects demonstrated by the long term use of methamphetamine (Berankova, Habrdova, Balikova & Strejc, 2005) Ferri (2006), points out that methamphetamine has a highly and almost immediate addictive nature. Animal studies confirm the highly addictive nature of methamphetamine and indicate the effects of the long term use of methamphetamine. Results from animal findings have led to the hypothesis that long term use of methamphetamine causes reduction in the dopaminergic activity. This drop in dopaminergic activity is believed to be due the