From 8f5488706c5ce1f5de15dc0dd49a5bd502be0814 Mon Sep 17 00:00:00 2001 From: Jet Hughes Date: Sat, 7 May 2022 12:44:09 +1200 Subject: [PATCH] update --- content/_index.md | 1 - content/daily_notes/2022-05-05.md | 6 +- content/daily_notes/2022-05-06.md | 39 ++++++++ ...ogramming.md => 15-dynamic-programming.md} | 0 content/notes/17-data-access.md | 95 +++++++++++++++++++ .../notes/analysis-of-recursive-algorithms.md | 5 +- content/notes/cosc-201-lectures.md | 3 +- content/notes/cosc-202-lectures.md | 3 +- content/notes/info-201-lectures.md | 1 + content/private/templates/DailyTemplate.md | 2 +- 10 files changed, 145 insertions(+), 10 deletions(-) create mode 100644 content/daily_notes/2022-05-06.md rename content/notes/{17-dynamic-programming.md => 15-dynamic-programming.md} (100%) create mode 100644 content/notes/17-data-access.md diff --git a/content/_index.md b/content/_index.md index e50cbe4ac..28a320e2c 100644 --- a/content/_index.md +++ b/content/_index.md @@ -15,7 +15,6 @@ title: "Jet Hughes" # 3 Projects -- [bug-tracker](notes/bug-tracker.md) - # 5 Independent Learning diff --git a/content/daily_notes/2022-05-05.md b/content/daily_notes/2022-05-05.md index 5620c4fc6..e6ac445d0 100644 --- a/content/daily_notes/2022-05-05.md +++ b/content/daily_notes/2022-05-05.md @@ -10,13 +10,13 @@ The Notorious Byrd Brothers - The Byrds - spotify:album:5UI2X5VAmgu9xrlXDd5U7B - [ ] use 1001 albums api - [ ] 11:00 Cosc201 Lecture - [ ] 12:00 Info201 Lab 8 -- [ ] 13:00 Info201 Lecture +- [x] 13:00 Info201 Lecture ## Lecture/Labs - [x] 11:00 Cosc202 Lecture -- [ ] 12:00 Cosc201 Lab -- [ ] 12:00 Info203 Tutorial +- [x] 12:00 Cosc201 Lab +- [x] 12:00 Info203 Tutorial - [ ] 16:00 Info201 Lecture ## Assignments diff --git a/content/daily_notes/2022-05-06.md b/content/daily_notes/2022-05-06.md new file mode 100644 index 000000000..e13bc8dcb --- /dev/null +++ b/content/daily_notes/2022-05-06.md @@ -0,0 +1,39 @@ +[2022-05-05](daily_notes/2022-05-05) << [daily-notes](notes/daily-notes.md) >> [2022-05-07](daily_notes/2022-05-07) + +--- + +# 06-05-22 + +Planet Rock: The Album - Afrika Bambaataa - spotify:album:3qX0GugLujpIodkT6r06hf + +## Todos +- [ ] use 1001 albums api +- [ ] 11:00 Cosc201 Lecture +- [ ] 12:00 Info201 Lab 8 +- [ ] 13:00 Info201 Lecture +- [ ] 16:00 Info201 Lecture +- [ ] info 202 api's lecture + +## Lecture/Labs + +- [ ] 09:00 Cosc202 Lab 7yhbn ,9 +- [ ] 11:00 Cosc201 Lecture +- [x] 12:00 Info201 Lab + +## Assignments +- Mobile app + - Brainstorming + +## Projects +- python ai weekly review + +## Links + +### cosc 202 + +[lab book](https://cosc202.cspages.otago.ac.nz/lab-book/COSC202LabBook.pdf) + +### info 201 + +- [cousework tiddlywiki](https://isgb.otago.ac.nz/infosci/INFO201/labs_release/raw/master/output/info201_labs.html#) +- [Assignments tiddlywiki](https://open.spotify.com/album/23DJ3KNE5JXi61G31T2Kni?si=-zZEHXIxT2qOEN6_Ns5C5Ql) \ No newline at end of file diff --git a/content/notes/17-dynamic-programming.md b/content/notes/15-dynamic-programming.md similarity index 100% rename from content/notes/17-dynamic-programming.md rename to content/notes/15-dynamic-programming.md diff --git a/content/notes/17-data-access.md b/content/notes/17-data-access.md new file mode 100644 index 000000000..de3ffa6d1 --- /dev/null +++ b/content/notes/17-data-access.md @@ -0,0 +1,95 @@ +--- +title: "17-data-access" +aliases: +tags: +- info201 +- lecture +sr-due: 2022-05-08 +sr-interval: 3 +sr-ease: 250 +--- + +[revision questions](https://i.imgur.com/mPmQ28v.png) + + +Most infosystems require persistent data. e.g., +- save to file +- save to database +Some systems require several persistent data stores. e.g., multiple databases. + +# File based + +doesn't scale well + +- demlimited text e.g., CSV TSV + - easy to create and process + - portable + - lowest common denominator +- structured text e.g., JSON, XML, YAML + - many tools for querying and transforming data + - portable also +- Serialiased data Structures (*usually* binary) + - more compact + - easy to do + - single user only + - no automatic failure recovery + - no querying + - versioning issues + - no standards + - less portable + +# Databases +- managed by DBMS + - usually SQL based + - also noSQL for unstructured big data +- advantages + - multi user support + - transactions (failure recovery) + - (centralised) constraints and referntial integrity + - flexible and ad-hoc querying + * manage large data + + +# Database APIs +- most dbmss have a native datbase api + - usually proprietry and limited to just that product + - often the only option for noSQL dbmss +- also generic database apis + - work with multiple dbmss + - same code works with any supported dbms +- for sql dbmss + - ODBC microsoft + - JDBC java + - DB-API python + - PDO php + - DBI perl + +# How to manage persistent data access +1. domain objects interact directly with the data store + - write to file or send sql statements + - not easy to change +2. domain objects interact with data store via a mediator + - either standalone class or implementation of a data access interface + - data access objects DAOs + - encapsulates all access to persistent data + +# Designing DAOs +- general rule: one DAO per "logical unit" of data access +- many DAOs are just for one class e.g., `PatronDAO` +- some involve many classes + - things like header/lines objects are always managed together + - complex operations that join multiple tables or domain classes +- different use cases (features) use different sets of DAOs e.g., + - add, find, edit patron ⇒ `PatronDAO` + - lend items ⇒ `LoanDAO`, `ItemDAO`, `PatronDAO` +- object construction and deconstruction coded into DAOs + +## Multiple implementation of the same DAO +[DAO versions](https://i.imgur.com/UZzffto.png) + +# JDBC for sql +- [jdbc slide](https://i.imgur.com/Dy79jcM.png) +- [jdbs slide what is does](https://i.imgur.com/NAr95En.png) +- [jdb issues](https://i.imgur.com/WR7qUae.png) +- [alternatives](https://i.imgur.com/rYhiX8o.png) +- [jdbi](https://i.imgur.com/OcNKIfH.png) diff --git a/content/notes/analysis-of-recursive-algorithms.md b/content/notes/analysis-of-recursive-algorithms.md index 82ed007aa..4a67ab9a2 100644 --- a/content/notes/analysis-of-recursive-algorithms.md +++ b/content/notes/analysis-of-recursive-algorithms.md @@ -8,7 +8,7 @@ tags: - inductive approach is esential for understanding time-complexity of resursive algorithms ## 1 Proof by induction -[[Induction]] +[induction](notes/induction.md) Find a (positive integer) _parameter_ that gets smaller in all recursive calls Prove inductively that "for all values of the parameter, the result computed is correct" To do that: @@ -17,7 +17,7 @@ To do that: ## 2 Examples ### 2.1 Quicksort -[[divide and conquer]] algorithm +[divide-and-conquer](notes/divide-and-conquer.md) algorithm sorts a range in an array (a group of elements between some lower index, $lo$ inclusive and some upper index $hi$ exclusive) as follows: - If length of range $(hi - lo)$ is at most 1 -> do nothing - otherwise, choose a pivot p (e.g., the element at $lo$) and: @@ -109,7 +109,6 @@ $\ \ \ \ \ \ \ \ \ = C+D\times(n-1)$ $\therefore$ By induction it's true for all $n>=1$ - $P(n)$ is the time for evaluating $fibPair(n)$ using this algorithm. This analysis gives: $P(1) = C$ diff --git a/content/notes/cosc-201-lectures.md b/content/notes/cosc-201-lectures.md index d0347b93d..a46eae063 100644 --- a/content/notes/cosc-201-lectures.md +++ b/content/notes/cosc-201-lectures.md @@ -13,4 +13,5 @@ links: [[notes/cosc-201]] - [11-sets-maps-trees](notes/11-sets-maps-trees.md) - [12-binary-search-tree-operations](notes/12-binary-search-tree-operations.md) - [13-bst-traversals-and-balance](notes/13-bst-traversals-and-balance.md) -- [14-balancing-bsts](notes/14-balancing-bsts.md) \ No newline at end of file +- [14-balancing-bsts](notes/14-balancing-bsts.md) +- [15-dynamic-programming](notes/15-dynamic-programming.md) \ No newline at end of file diff --git a/content/notes/cosc-202-lectures.md b/content/notes/cosc-202-lectures.md index 649a3ee9c..08c89ae64 100644 --- a/content/notes/cosc-202-lectures.md +++ b/content/notes/cosc-202-lectures.md @@ -16,4 +16,5 @@ links: [cosc-202](notes/cosc-202.md) - [13-code-librarires](notes/13-code-librarires.md) * - [15-containers](notes/15-containers.md) -- [16-compilers](notes/16-compilers.md) \ No newline at end of file +- [16-compilers](notes/16-compilers.md) +- [17-linkers-and-loaders](notes/17-linkers-and-loaders.md) \ No newline at end of file diff --git a/content/notes/info-201-lectures.md b/content/notes/info-201-lectures.md index 80859f8bc..1ebefb499 100644 --- a/content/notes/info-201-lectures.md +++ b/content/notes/info-201-lectures.md @@ -18,4 +18,5 @@ links: [[notes/info-201]] - - [15-from-models-to-code-and-back](notes/15-from-models-to-code-and-back.md) - [16-reverse engineering](notes/16-reverse%20engineering.md) +- [17-data-access](notes/17-data-access.md) diff --git a/content/private/templates/DailyTemplate.md b/content/private/templates/DailyTemplate.md index c386584da..f060f6db8 100644 --- a/content/private/templates/DailyTemplate.md +++ b/content/private/templates/DailyTemplate.md @@ -4,7 +4,7 @@ # <% tp.date.now("DD-MM-YY") %> -<% tp.user.getAOTD() %> +<% tp.user.album() %> ## Todos