Friday, March 20, 2020

Motives for European Expansion 15th and 16th century essays

Motives for European Expansion 15th and 16th century essays Europeans had many reasons to risk their live in a really long voyage across the Atlantic Ocean. Many new technological advancements such as the cannons, new ships, magnetic compass and the astrolabe- helped make the trip something possible. Eventually Captains didnt have the money to afford this. So they had to appeal to kings to sponsor their trip. To get the Monarchs sponsorship of the trip Captains had to somehow appeal to him the idea is worth while. So they had to come up with motives. The ottomans had taken part of practically all the border of East Europe with Asia impeding trade. This meant they had to find an alternative trade route. What they tried then is to go west and find India. There major profits from trading with India were spices... This is what they wanted to from India and also found in America. Spices added flavour and variety to their foods and served as preparation for medicines. Portugal took the lead in the Spice Trade with Prince Henry as a massive sponsor of voyages. Europeans wanted to spread religion. This wasnt the most important reason for the majority. Although for some Kings such as Queen Isabella it was a really important reason. The desire to Christianize Muslims after their attempt to unite Europe under one religion with the 30 years war... The most important reason for European Expansion was clearly wealth. This has been the reason under every movement, war or law made in history. It brought you money and power Spain had under his control more land than any other country except possibly Portugal. Money, material wealth and Trade were the key. Then came the rivalry between the Countries if Portugal came from an expedition with 2 new countries discovered, lots of gold... Then Spain would go in search of 2 bigger countries with more wealth. The Dutch also took part in some expeditions; and created the Dutch East Indian Company which controlled big part of Europeans eco ...

Wednesday, March 4, 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.