Wednesday, March 18, 2020

Commodore Isaac Hull in the War of 1812

Commodore Isaac Hull in the War of 1812 Born March 9, 1773, in Derby, CT, Isaac Hull was the son of Joseph Hull who later took part in the American Revolution.  In the course of the fighting, Joseph served as an artillery lieutenant and was captured in 1776 following the Battle of Fort Washington. Imprisoned in HMS Jersey, he was exchanged two years later and assumed command of a small flotilla on Long Island Sound.   Following the end of the conflict, he entered the merchant trade sailing to the West Indies as well as whaling.   It was through these endeavors that Isaac Hull first experienced the sea.   Young when his father died, Hull was adopted by his uncle, William Hull. Also a veteran of the American Revolution, he would earn infamy for surrendering Detroit in 1812.   Though William wished his nephew to obtain a college education, the younger Hull desired to return to sea and, at age fourteen, became a cabin boy on a merchant vessel. Five years later, in 1793, Hull earned his first command captaining a merchant ship in the West Indies trade.   In 1798, he sought out and obtained a lieutenants commission in the newly re-formed US Navy.   Serving aboard the frigate USS Constitution (44 guns), Hull earned the respect of Commodores Samuel Nicholson and Silas Talbot.   Engaged in the Quasi-War with France, the US Navy sought out French vessels in the Caribbean and Atlantic.   On May 11, 1799, Hull led a detachment of  Constitutions sailors and marines in seizing the French privateer Sandwich near Puerto Plata, Santo Domingo. Taking the sloop Sally into Puerto Plata, he and his men captured the ship as well as a shore battery defending the harbor.   Spiking the guns, Hull departed with the privateer as a prize. With the end of the conflict with France, a new one soon emerged with the Barbary pirates in North Africa.   Barbary Wars Taking command of the brig USS Argus (18) in 1803, Hull joined Commodore Edward Prebles squadron which was operating against Tripoli.   Promoted to master commandant the following year, he remained in the Mediterranean.   In 1805, Hull directed  Argus, USS Hornet (10), and USS Nautilus (12) in supporting US Marine Corps  First Lieutenant Presley OBannon during the Battle of Derna.   Returning to Washington, DC a year later, Hull received a promotion to captain.   The next five years saw him oversee the construction of gunboats as well as command the frigates USS Chesapeake (36) and USS President (44).   In June 1810, Hull was appointed captain of Constitution and returned to his former ship.   After having the frigates bottom cleaned, he departed for a cruise in European waters.   Returning in February 1812, Constitution was in the Chesapeake Bay four months later when news arrived that the War of 1812 had begun.         Ã‚   USS Constitution Exiting the Chesapeake, Hull steered north with the goal of rendezvousing with a squadron that Commodore John Rodgers was assembling. While off the coast of New Jersey on July 17, Constitution was spotted by a group of British warships that included HMS Africa (64) and the frigates HMS  Aeolus (32), HMS Belvidera (36), HMS Guerriere (38), and HMS Shannon (38). Stalked and pursued for over two days in light winds, Hull used a variety of tactics, including wetting down the sails and kedge anchors, to escape.   Reaching Boston, Constitution quickly resupplied before departing on Aug. 2. Moving northeast, Hull captured three British merchantmen and obtained intelligence that a British frigate was operating to the south. Sailing to intercept, Constitution encountered Guerriere on Aug. 19. Holding his fire as the frigates neared, Hull waited until the two ships were only 25 yards apart. For 30 minutes Constitution and Guerriere exchanged broadsides until Hull closed on the enemys starboard beam and toppled the British vessels mizzen mast. Turning, Constitution raked Guerriere, sweeping its decks with fire. As the battle continued, the two frigates collided three times, but all attempts to board were turned back by determined musket fire from each ships marine detachment. During the third collision, Constitution became entangled in Guerrieres bowsprit. As the two frigates separated, the bowsprit snapped, jarring the rigging and leading to Guerrieres fore and main masts falling. Unable to maneuver or make way, Dacres, who had been wounded in the engagement, met with his officers and decided to strike Guerrieres colors to prevent a further loss of life. During the fighting, many of Guerrieres cannon balls were seen to bounce off Constitutions thick sides leading it to earn the nickname Old Ironsides. Hull attempted to bring Guerriere into Boston, but the frigate, which had suffered severe damage in the battle, began to sink the next day and he ordered it destroyed after the British wounded were transferred to his ship. Returning to Boston, Hull and his crew were hailed as heroes.   Leaving the ship in September, Hull turned command over to Captain William Bainbridge.   Later Career Traveling south to Washington, Hull first received orders to assume command of the Boston Navy Yard and then the Portsmouth Navy Yard.   Returning to New England, he held the post at Portsmouth for the remainder of the War of 1812. Briefly taking a seat on the Board of Navy Commissioners in Washington beginning in 1815, Hull then took command of the Boston Navy Yard.   Returning to sea in 1824, he oversaw the Pacific Squadron for three years and flew his commodores pennant from USS United States (44). Upon completing this duty, Hull commanded the Washington Navy Yard from 1829 to 1835.   Taking leave after this assignment, he resumed active duty and in 1838 received command of the Mediterranean Squadron with the ship of the line USS Ohio (64) as his flagship. Concluding his time abroad in 1841, Hull returned to the United States and due to ill health and increasingly advanced age (68) elected to retire. Residing in Philadelphia with his wife Anna Hart (m. 1813), he died two years later on February 13, 1843. Hulls remains were buried in the citys Laurel Hill Cemetery.   Since his death, the US Navy has named five vessels in his honor.   Sources: Biographies in Naval History: Isaac HullHeritage History: Isaac Hull

Monday, March 2, 2020

Programming SQLite in C Tutorial Two

Programming SQLite in C Tutorial Two This tutorial is the second in a series on programming SQLite in C. SQLite stores a collection of tables in a single file database, usually ending in .db. Each table is like a spreadsheet, it consists of a number of columns and each row has values. If it helps, think of each row as being a struct, with the columns in the table corresponding to the  fields in the struct. A table can have as many rows as will fit on a disk. There is an upper limit but its huge 18,446,744,073,709,551,616 to be precise. A table can have up to 2,000 columns or if you recompile the source, you can max it to an awesome 32,767 columns. The SQLite API To use SQLite, we need to make calls to the API. You can find an introduction to this API on the official Introduction to SQLite C/C Interface web page. Its a collection of functions and easy to use. First, we need a handle to the database. This is of type sqlite3 and is returned by a call to sqlite3_open( filename, **ppDB). After that, we execute the SQL. Lets have a slight digression first though and create a usable database and some tables using SQLiteSpy. (See the previous tutorial for links to that and the SQLite Database Browser). Events and Venues The database about.DB will hold three tables to manage events at several venues. These events will be parties, discos, and concerts and will take place at five venues (alpha, beta, charlie, delta, and echo). When you are modeling something like this, it often helps to start with a spreadsheet. For simplicities sake, Ill just store a date not a time. The spreadsheet has three columns: Dates, Venue, Event Type and about ten events like this. Dates run from 21st to 30th of June 2013. Now SQLite has no explicit date type, so its easier and faster to store it as an int and the same way that Excel uses dates (days since Jan 1, 1900) have int values 41446 to 41455. If you put the dates in a spreadsheet then format the date column as a number with 0 decimal places, it looks something like this: Now we could store this data in one table and for such a simple example, it would probably be acceptable. However good database design practice requires some normalization. Unique data items like venue type should be in its own table and the event types (party etc) should also be in one. Finally, as we can have multiple event types at multiple venues, ( a many to many relationship) we need a third table to hold these. The three tables are: venues - holds all five venueseventtypes - holds all three event typesevents - holds the date plus venue id plus event type id. I also added a description field for this event eg Jims Birthday. The first two tables hold the data types so venues have names alpha to echo. Ive added an integer id as well and created an index for that. With the small numbers of venues (5) and event types (3), it could be done without an index, but with larger tables, it will get very slow. So any column that is likely to be searched on, add an index, preferably integer The SQL to create this is: The index on the events table has date, id-event, the event type, and venue. That means we can query the event table for all events on a date, all events at a venue,all parties etc and combinations of those such as all parties at a venue etc. After running the SQL create table queries, the three tables are created. Note Ive put all that sql in the text file create.sql and it includes data for populating some of the three tables. If you put ; on the end of the lines as Ive done in create.sql then you can batch and execute all the commands in one go. Without the ; you have to run each one by itself. In SQLiteSpy, just click F9 to run everything. Ive also included sql to drop all three tables inside multi-line comments using /* .. */ same as in C. Just select the three lines and do ctrl F9 to execute the selected text. These commands insert  the five venues: Again Ive included commented out text to empty tables, with the delete from lines. Theres no undo so be careful with these! Amazingly, with all the data loaded (admittedly not much) the entire database file on disk is only 7KB. Event Data Rather than build up a bunch of ten insert statements, I used Excel to create a .csv file for the event data and then used the SQLite3 command line utility (that comes with SQLite) and the following commands to import it. Note: Any line with a period (.) prefix is a command. Use .help to view all commands. To run SQL just type it in with no period prefix. You have to use double blackslashes \\ in the import path for each folder. Only do the last line after the .import has succeeded. When SQLite3 runs the default separator is a : so it has to be changed to a comma before the import. Back to the Code Now we have a fully populated database, lets write the C code to run this SQL query which returns a list of parties, with description, dates and venues. New to SQL? Read What is SQL? This does a join using the idvenue column between the events and venues table so we get the name of the venue not its int idvenue value. SQLite C API Functions There are many functions but we only need a handful. The order of processing is: Open database with sqlite3_open(), exit if have error opening it.Prepare the SQL with sqlite3_prepare()Loop using slqite3_step() until no more records(In the loop) process each column with sqlite3_column...Finally call sqlite3_close(db) Theres an optional step after calling sqlite3_prepare where any passed in parameters are bound but well save that for a future tutorial. So in the program listed below the pseudo code for the major steps are: The sql returns three values so if sqlite3.step() SQLITE_ROW then the values are copied from the appropriate column types. Ive used int and text. I display the date as a number but feel free to convert it to a date.​ Listing of Example Code