Tuesday, March 17, 2020

Save a Web Page as HTML or MHT Using Delphi

Save a Web Page as HTML or MHT Using Delphi When working with Delphi, the TWebBrowser component allows you to create a customized Web browsing application or to add Internet, file and network browsing, document viewing, and data downloading capabilities to your applications. How to Save a Web Page from TWebBrowser When using Internet Explorer, you are allowed you to view the source HTML code of a page and to save that page as a file on your local drive. If you are viewing a page that you wish to keep, go to the File/Save As ... menu item. In the dialog box that opens, you have several file types offered. Saving the page as a different filetype will affect how the page is saved. The TWebBrowser component (located on the Internet page of the Component Palette) provides access to the Web browser functionality from your Delphi applications. In general, youll want to enable saving of a web page displayed inside a WebBrowser as an HTML file to a disk. Saving a Web Page As a Raw HTML If you only want to save a web page as a raw HTML you would select Web Page, HTML only (*.htm, *.html). It will simply save the current pages source HTML to your drive intact. This action will NOT save the graphics from the page or any other files used within the page, which means that if you loaded the file back from the local disk, you would see broken image links. Heres how to save a web page as raw HTML using Delphi code: uses ActiveX; ... procedure WB_SaveAs_HTML(WB : TWebBrowser; const FileName : string) ; var   Ã‚  PersistStream: IPersistStreamInit;   Ã‚  Stream: IStream;   Ã‚  FileStream: TFileStream; begin   Ã‚  if not Assigned(WB.Document) then   Ã‚  begin   Ã‚  Ã‚  Ã‚  ShowMessage(Document not loaded!) ;   Ã‚  Ã‚  Ã‚  Exit;   Ã‚  end;   Ã‚  PersistStream : WB.Document as IPersistStreamInit;   Ã‚  FileStream : TFileStream.Create(FileName, fmCreate) ;   Ã‚  try   Ã‚  Ã‚  Ã‚  Stream : TStreamAdapter.Create(FileStream, soReference) as IStream;   Ã‚  Ã‚  Ã‚  if Failed(PersistStream.Save(Stream, True)) then ShowMessage(SaveAs HTML fail!) ;   Ã‚  finally   Ã‚  Ã‚  Ã‚  FileStream.Free;   Ã‚  end; end; (* WB_SaveAs_HTML *) Usage sample: //first navigate WebBrowser1.Navigate(http://delphi.about.com) ; //then save WB_SaveAs_HTML(WebBrowser1,c:\WebBrowser1.html) ; Notes The IPersistStreamInit and IStream interfaces are declared inside the ActiveX unit.The web page is saved as a raw HTML to the WebBrowser1.html file on the root folder of the C drive. MHT: Web Archive, Single File When you save a Web page as Web archive, single file (*.mht) the web document gets saved in the Multipurpose Internet Mail Extension HTML (MHTML) format with a .mht file extension. All relative links in the Web page are remapped and the embedded content is included in the .mht file, rather than being saved in a separate folder (as the case is with Web Page, complete (*.htm, *.html)). MHTML enables you to send and receive Web pages and other HTML documents using e-mail programs such as Microsoft Outlook, and Microsoft Outlook Express; or even your custom Delphi email sending solutions. MHTML enables you to embed images directly into the body of your e-mail messages rather than attaching them to the message. Heres how to save a webpage as a single file (MHT format) using Delphi code: uses CDO_TLB, ADODB_TLB; ... procedure WB_SaveAs_MHT(WB: TWebBrowser; FileName: TFileName) ; var   Ã‚  Msg: IMessage;   Ã‚  Conf: IConfiguration;   Ã‚  Stream: _Stream;   Ã‚  URL : widestring; begin   Ã‚  if not Assigned(WB.Document) then Exit;   Ã‚  URL : WB.LocationURL;   Ã‚  Msg : CoMessage.Create;   Ã‚  Conf : CoConfiguration.Create;   Ã‚  try   Ã‚  Ã‚  Ã‚  Msg.Configuration : Conf;   Ã‚  Ã‚  Ã‚  Msg.CreateMHTMLBody(URL, cdoSuppressAll, , ) ;   Ã‚  Ã‚  Ã‚  Stream : Msg.GetStream;   Ã‚  Ã‚  Ã‚  Stream.SaveToFile(FileName, adSaveCreateOverWrite) ;   Ã‚  finally   Ã‚  Ã‚  Ã‚  Msg : nil;   Ã‚  Ã‚  Ã‚  Conf : nil;   Ã‚  Ã‚  Ã‚  Stream : nil;   Ã‚  end; end; (* WB_SaveAs_MHT *) Sample usage: //first navigate WebBrowser1.Navigate(http://delphi.about.com) ; //then save WB_SaveAs_MHT(WebBrowser1,c:\WebBrowser1.mht) ; Note The _Stream class is defined in ADODB_TLB unit that you probably already have created. The IMessage and IConfiguration interfaces code from cdosys.dll library. CDO stands for Collaboration Data Objects - object libraries designed to enable SMTP Messaging. The CDO_TLB is an auto-generated unit by Delphi. To create it, from the main menu select Import Type Library, select C:\WINDOWS\system32\cdosys.dll then click the Create unit button. No TWebBrowser You could rewrite the WB_SaveAs_MHT procedure to accept an URL string (not TWebBrowser) to be able to save a web page directly no need to use the WebBrowser component. The URL from WebBrowser is retrieved using the WB.LocationURL property.

Sunday, March 1, 2020

The Greedy Triangle Teaches Kids About Geometry

The Greedy Triangle Teaches Kids About Geometry This sample lesson plan uses the book The Greedy Triangle to teach about the attributes of two-dimensional figures. The plan is designed for second-grade and third-grade students, and it requires a 45-minute period for two  days. The only supplies needed are: The book The Greedy Triangle by Marilyn BurnsSeveral sheets of poster paper The objective of this lesson plan is for  students to learn that shapes are defined by their attributes- specifically the number of sides and angles they have.  The key vocabulary words  in this lesson are  triangle,  square,  pentagon,  hexagon, side and  angle. Common Core Standards Met This lesson plan satisfies the following Common Core standards in the Geometry category and Reason With Shapes and Their Attributes sub-category.   2.G.1. Recognize and draw shapes having specified attributes, such as a given number of angles or a given number of equal faces. Identify triangles, quadrilaterals, pentagons, hexagons, and cubes.3.G.1. Understand that shapes in different categories (e.g., rhombuses, rectangles, and others) may share attributes (e.g., having four sides), and that the shared attributes can define a larger category (e.g., quadrilaterals). Recognize rhombuses, rectangles, and squares as examples of quadrilaterals, and draw examples of quadrilaterals that do not belong to any of these subcategories. Lesson Introduction Have students imagine that they are triangles and then ask them several questions. What would be fun? What would be frustrating? If you were a triangle, what would you do and where would you go? Step-by-Step Procedure Create four large pieces of chart paper with the headings â€Å"Triangle,† â€Å"Quadrilateral,† â€Å"Pentagon† and â€Å"Hexagon.† Draw examples of these shapes at the top of the paper, leaving lots of room to record student thoughts.Keep track of student responses in the lesson introduction on the four large pieces of paper. You will continue to add responses to this as you read the story.Read the story The Greedy Triangle to the class. Split the lesson over two days to go through the story gradually.As you read the first section of the book about the Greedy Triangle and how much he likes being a triangle, have students retell sections from the storys include fit into the space near people’s hips and be a piece of pie. Have students list more examples if they can think of any.Continue to read the story and add to the list of student remarks. If you take your time with this book to get lots of student thoughts, you will likely need two days for th e lesson.At the end of the book, discuss with the students why the triangle wanted to be a triangle again. Homework and Evaluation Have students write an answer to this prompt: What shape would you like to be and why? Students should use all of the following vocabulary words to create a sentence: AngleSideShape They should also include two of the following terms: TriangleQuadrilateralPentagonHexagon Example answers include: â€Å"If I were a shape, I would want to be a pentagon because it has more sides and angles than a quadrilateral.† â€Å"A quadrilateral is a shape with four sides and four angles, and a triangle has only three sides and three angles.†

The Greedy Triangle Teaches Kids About Geometry

The Greedy Triangle Teaches Kids About Geometry This sample lesson plan uses the book The Greedy Triangle to teach about the attributes of two-dimensional figures. The plan is designed for second-grade and third-grade students, and it requires a 45-minute period for two  days. The only supplies needed are: The book The Greedy Triangle by Marilyn BurnsSeveral sheets of poster paper The objective of this lesson plan is for  students to learn that shapes are defined by their attributes- specifically the number of sides and angles they have.  The key vocabulary words  in this lesson are  triangle,  square,  pentagon,  hexagon, side and  angle. Common Core Standards Met This lesson plan satisfies the following Common Core standards in the Geometry category and Reason With Shapes and Their Attributes sub-category.   2.G.1. Recognize and draw shapes having specified attributes, such as a given number of angles or a given number of equal faces. Identify triangles, quadrilaterals, pentagons, hexagons, and cubes.3.G.1. Understand that shapes in different categories (e.g., rhombuses, rectangles, and others) may share attributes (e.g., having four sides), and that the shared attributes can define a larger category (e.g., quadrilaterals). Recognize rhombuses, rectangles, and squares as examples of quadrilaterals, and draw examples of quadrilaterals that do not belong to any of these subcategories. Lesson Introduction Have students imagine that they are triangles and then ask them several questions. What would be fun? What would be frustrating? If you were a triangle, what would you do and where would you go? Step-by-Step Procedure Create four large pieces of chart paper with the headings â€Å"Triangle,† â€Å"Quadrilateral,† â€Å"Pentagon† and â€Å"Hexagon.† Draw examples of these shapes at the top of the paper, leaving lots of room to record student thoughts.Keep track of student responses in the lesson introduction on the four large pieces of paper. You will continue to add responses to this as you read the story.Read the story The Greedy Triangle to the class. Split the lesson over two days to go through the story gradually.As you read the first section of the book about the Greedy Triangle and how much he likes being a triangle, have students retell sections from the storys include fit into the space near people’s hips and be a piece of pie. Have students list more examples if they can think of any.Continue to read the story and add to the list of student remarks. If you take your time with this book to get lots of student thoughts, you will likely need two days for th e lesson.At the end of the book, discuss with the students why the triangle wanted to be a triangle again. Homework and Evaluation Have students write an answer to this prompt: What shape would you like to be and why? Students should use all of the following vocabulary words to create a sentence: AngleSideShape They should also include two of the following terms: TriangleQuadrilateralPentagonHexagon Example answers include: â€Å"If I were a shape, I would want to be a pentagon because it has more sides and angles than a quadrilateral.† â€Å"A quadrilateral is a shape with four sides and four angles, and a triangle has only three sides and three angles.†

The Greedy Triangle Teaches Kids About Geometry

The Greedy Triangle Teaches Kids About Geometry This sample lesson plan uses the book The Greedy Triangle to teach about the attributes of two-dimensional figures. The plan is designed for second-grade and third-grade students, and it requires a 45-minute period for two  days. The only supplies needed are: The book The Greedy Triangle by Marilyn BurnsSeveral sheets of poster paper The objective of this lesson plan is for  students to learn that shapes are defined by their attributes- specifically the number of sides and angles they have.  The key vocabulary words  in this lesson are  triangle,  square,  pentagon,  hexagon, side and  angle. Common Core Standards Met This lesson plan satisfies the following Common Core standards in the Geometry category and Reason With Shapes and Their Attributes sub-category.   2.G.1. Recognize and draw shapes having specified attributes, such as a given number of angles or a given number of equal faces. Identify triangles, quadrilaterals, pentagons, hexagons, and cubes.3.G.1. Understand that shapes in different categories (e.g., rhombuses, rectangles, and others) may share attributes (e.g., having four sides), and that the shared attributes can define a larger category (e.g., quadrilaterals). Recognize rhombuses, rectangles, and squares as examples of quadrilaterals, and draw examples of quadrilaterals that do not belong to any of these subcategories. Lesson Introduction Have students imagine that they are triangles and then ask them several questions. What would be fun? What would be frustrating? If you were a triangle, what would you do and where would you go? Step-by-Step Procedure Create four large pieces of chart paper with the headings â€Å"Triangle,† â€Å"Quadrilateral,† â€Å"Pentagon† and â€Å"Hexagon.† Draw examples of these shapes at the top of the paper, leaving lots of room to record student thoughts.Keep track of student responses in the lesson introduction on the four large pieces of paper. You will continue to add responses to this as you read the story.Read the story The Greedy Triangle to the class. Split the lesson over two days to go through the story gradually.As you read the first section of the book about the Greedy Triangle and how much he likes being a triangle, have students retell sections from the storys include fit into the space near people’s hips and be a piece of pie. Have students list more examples if they can think of any.Continue to read the story and add to the list of student remarks. If you take your time with this book to get lots of student thoughts, you will likely need two days for th e lesson.At the end of the book, discuss with the students why the triangle wanted to be a triangle again. Homework and Evaluation Have students write an answer to this prompt: What shape would you like to be and why? Students should use all of the following vocabulary words to create a sentence: AngleSideShape They should also include two of the following terms: TriangleQuadrilateralPentagonHexagon Example answers include: â€Å"If I were a shape, I would want to be a pentagon because it has more sides and angles than a quadrilateral.† â€Å"A quadrilateral is a shape with four sides and four angles, and a triangle has only three sides and three angles.†

Thursday, February 13, 2020

Octavan Construction Inc Case Study Example | Topics and Well Written Essays - 750 words

Octavan Construction Inc - Case Study Example Octavans reporting policies are pretty acceptable and would be beneficial to the company in the long term so the only suggestion to make here is that they should stick with these policies even if they are trouble some at the beginning The working capital and the debt to equity ratio has been on the decline which shows that that company is not doing so good on the assets front, the debt to equity ratio has declined and that is not a good sign because the value of the assets has been on the decline and liabilities have grown considerably which is not a good sign for any company, even creditors such as Broadmoor County Bank have started to believe that the company is in trouble and are trying to secure there loans against securities that were not deemed necessary before. Since the company has changed its depreciation method the company will now experience a total change in the depreciation expense and accumulated depreciation, which would definitely have a good effect on the assets beca use the current method which was employed by the company was depreciating the assets too quickly and was unrealistic for the company to use and hence it is a good move to change the depreciation method of the company and this will reap positive out come for the company. The second change that is being implemented by the company is that they have changed the method of long term billing from absolute method to the percentage-of-completed project which initially increases costs but in the long term would help the company build on steadily because there would be a better matching of the costs and revenues which would lead to a better financial report in the bigger picture. Ans 2. Octavans reporting policies are pretty acceptable and would be beneficial to the company in the long term so the only suggestion to make here is that they should stick with these policies even if they are trouble some at the beginning because they would definitely lead to an improvement in the company's financial books. The company shouldn't have placed as collateral its current assets because these assets are the blood line of the company and since octavan is already facing a declining working capital and a debt to equity ratio it is not advisable that this step be taken. Ans 3, The Company has changed the depreciation method due to the non effectiveness of the previous (MACRS) method due to which the company had to face considerable reporting problems but now the company has switched to a more effective and a reporting friendly method, known as the double depreciation method. For long term contracts the company will now be using the percentage-of-completed work to match the expenses and revenues in a better manner. American Physical and Social Programs For Children Inc. Ans1. The implications of such a policy are very clear, because the operations of the company are focused primarily on children activities and as the case points out that the major business period for the company was from September to June it is a good policy to have a June 30th as the end of all financial activities because by then the company would have had completed one major cycle on the business front, plus all the major expenses and liabilities have been realized by that period and the company knows what exactly is expected of it since the major part of its revenue has been earned during that period it can easily match the expenses against the revenues using the matching principle, it is also an excellent policy to do so because companies need to make their financial statement when they consider they would come out the best and given the circumstances that the company operates in it has clearly realized what the best period for preparing financial statements is. Also, using Jun e the 30th as the basis for making the financial reports gives the advantage of having a summer camp during the summer vacations, but more importantly this gives them the time to incorporate the revenues of the summer into the financial books because people have to pay in advance (march) for the summer camp and this is an added advantage of havi

Saturday, February 1, 2020

A review of an article (Carr) Essay Example | Topics and Well Written Essays - 250 words

A review of an article (Carr) - Essay Example tiveness to companies has greatly declined causing a necessity for the top managements strategically to evaluate their position on IT investment (Carr, 2003). Numerous correspondences cited on this article closely relate IT with previous technologies in terms of their growth but most importantly, they have likened IT to infrastructural technology (Carr, 2003). There are great similarities that exist between their characteristics considering their share ability nature since they offer more value than when they are customized. IT is best suitable when partnered with other firms in order to yield the highest level of results exemplified by early technologies like Electricity and rail transportation, which is the very nature of IT (Carr, 2003). The article further argues that for a technology to be competitive it must be owned and should be able to differentiate an organization from their competitors. This is not so with IT because many companies have the ability to reproduce on the shelf similar products to serve similar purpose. Additionally the cost of IT products has drastically gone down therefore almost all organization can afford the IT investments eliminating the uniqueness that IT can offer for competitiveness. Therefore, the article concludes that for companies to be able to rely on IT as a strategic goal to competitiveness, they should consider changing their overall perspective. They should endeavor to reduce the costs invested in IT through evaluating the returns that IT investments offer. Companies should ensure that they get longer IT value and should not always rush to upgrade their IT resources without doing a need assessment because not all IT investment bring equal financial returns (Carr,

Friday, January 24, 2020

Creation or Evolution? :: social issues

Creation or Evolution? How was the earth created? This is a question that has puzzled humans for ages. There are two main theories that explain how the earth was formed. These are the theories of evolution and creation. The creation theory is divided into various groups. The most accepted creation theory is the one of the biblical creationists. Biblical creation and evolution are very different, and both have indicators as to their authenticity. In evolution life is seen as having resulted by natural processes only. The theory suggests that in the past there were extended intervals of stability which ended with a mass extinction and the sudden appearance of a new species. This process occured without the intervention of supernatural forces or dieties. Nearly all modern scientists who are not Evangelical Christians believe in evolution. Biblical creationists are also called literal creationists, because they interpret the two Genesis accounts of creation in the Bible literally and believe that the Bible is without error. They believe that the "day" mentioned in Genesis 1 signifies a normal 24 hour day. According to this creation the universe was established in six days. Biblical creationists interpret most sedimentary rocks as products of Noah's flood. The majority believes that the earth is under 10,000 years of age. Some believe 4004 BC was the year of creation. The person who proposed the methods by which natural processes cause the evolution of the species was Charles Darwin. He used natural selection to explain how evolution worked. Darwin's old teacher said evolution would "brutalize" us as human beings and sink us "into a lower grade of degradation" than any time in recorded history. He was partially correct. The fact that many people think they evolved from monkeys has made morale in the world lower. However, to say that it has been the cause for the decline of society is ridiculous. Yes, war and crime has been higher in this century than in any other, but it is ceartainly not because of the theory of evolution. A theory can not start a war or commit a crime. People can. How can you prove creation or evolution? You can not prove them scientifically. The only one you could prove is creation, because of the Bible. If you believe that the Bible is without error, then you must believe that God created everything. Creation is much harder to support scientifically.