Categories
Computer Technologies and O/S

FIT9018: Week 4

This weeks lecture was a continuation of ‘Operating System II: File Management”. Most of the concepts covered in this weeks lecture I had looked at in last weeks review.

Some of the new points introduced were:

  • When a file is accessed it has four id’s (I assume an example is real and sudo):
    • a real user id
    • an effective user id
    • a real group id
    • an effective group id
  • Standard Input, Output, Error – Every time a shell is started. 3 files are opened automatically:
    • stdin, (keyboard), 0
    • stdout, (screen), 1
    • sterr, (screen), 2
  • Example of how inode numbers and logical directory structures work.
  • How rwx Permissions work with directories: (Pearl of the Week)
    • Read- Processes can list names and subdirectories within directory
    • Write- Processes can alter the directory (create and remove files). To modify files write permission must be applied to the file.
    • Excecute- Allows the user to cd into the directory. To open a file or excerpter a program a user must have execute permission on all directories leading to the files absolute path name.
  • Hard and Soft(Symbolic) Links
  • Locks (not covered in detail yet)

Pearl of the week: vi/vim text editor

$ vi myfile
$ vim myfile

In the tut we worked with vi/vim text editor which is a tool I had struggled with before and had never bothered to read the tutorials on.

It turns out that it is a damn good editor as it is very very quick and easy once one becomes even moderately sufficient (2-3 hr tutorial). One of the primary advantages is that it runs within a command prompt environment so can be used via SSH with ease.

Some of the handy commands learnt in the tutorial are:

  • i -> insert mode
  • : -> comand mode
  • esc -> back to normal mode
  • CTRL + G -> End of the doc
  • /prase -> find phrase
  • n -> next phrase down
  • N -> next phrase up
  • :%s/word1/word2/gc -> replace all word1 with word2, gc adds confirmation for each occurance
  • u -> undo
  • d -> delete
  • put -> put was what just deleted
  • v -> visual select
  • w -> word (dw -> delete word)
  • $ -> end of line (d$ delete from cursor to end of line)
  • :set tabstop=2 -> set tab distance to 2
  • :set number -> show line numbers
  • :set nonumber -> hide line numbers
  • :1,4d -> delete lines 1,2,3,4

There are a great deal many useful examples of these which i shall add in as I use them.

Categories
Random

Getting iPhone working on Linux (without jailbreaking)

Steps to Using iTunes and iPhone on Ubuntu (using windows virtual machine)

  1. Install git, with the following command: sudo apt-get install git-core
  2. Install iPhone connectivity the driver with the following command: git clone git://github.com/dgiagio/ipheth.git
  3. Install VitualBox PUEL (http://www.virtualbox.org/wiki/Linux_Downloads) , ensure it is PUEL, no OSE Edition
  4. Install Samba and share Music folder (instructions: https://help.ubuntu.com/9.04/serverguide/C/samba-fileserver.html)
  5. Open Sun Virtual Box, create a virtual machine (ensure in vm settings USB is enabled and iPhone filter selected).
  6. Install iTunes on the vm and access your songs through shared folder.

All up takes about 2 hrs max and is the easiest way to get your iPhone working on Ubuntu without jail breaking.

Categories
Database Technology

FIT9019: Week 4

Unfortunately I missed Manoj’s 4th lecture, the notes however are online and I will run through a summary of them.

Part 1: Normalization

Data normalization is required to ensure that a relational database will perform UPDATE, CREATE and DELETE queries without anomalies (loss of data integrity).

The process of normalization has numerous levels (1st Normal Form [1NF], 2NF, 3NF, BCNF, 4NF, 5NF) which will be shown below. Prior to running through each level, the terminology for dependencies must be clarified.

Functional Dependence: A relationship between two attributes each value of A is associated with exactly 1 value of B, ie; ID is a determinant of Name. Partial Key dependencies are determinant relationships between two or more non-primary key attributes(leading to update anomalies). Transitive Key dependencies occur when an attribute is more immediately identified be a non-Primary Key attribute/s (leading to update anomalies).

1NF: Ensuring atmoic values in the relation by removing unnecessary attributes, separating relations if repeating values occur.

CUSTOMER (cust-id, surname, initials,{order-no, order-date})
//{} signify repeating values.

Now in 1NF :

CUSTOMER(cust-id, surname, initials)
ORDER(cust_id, order-no, order-date)

2NF: Remove partial key dependencies (ensure primary key is in its minimal form and partially dependent attributes are removed to an alternate relation). Ie:

ORDER-LINE(order_number, product_no, description, number-ordered)
// As above, the description attribute is dependent only on product_no
making it a partial key dependency.

Now in 2NF:

ORDER-LINE(order_number, product_no, number-ordered)
ORDER-LINE(product_no, description)

3NF: Remove transitive keys dependencies.

ORDER(order-no, order-date, cus-id, name, street, suburb)
//name, street and suburb transitively dependent on cus-id

Now in 3NF (Transitive dependency removed by creating new relation):

ORDER(order-no, order-date, cus-id)
CUSTOMER(cus-id, name, street, suburb)
// new relation added to eliminate transitive dependency.

Boyce-Codd Normal Form [BCNF]: 3NF + only a single candidate key for each relation.

4NF: No non-trivial multi-valued dependencies. *

5NF: No join dependencies. *

* It seems we will not be covering 4NF and 5NF in this subject although other lecturers have mentioned they are the most prevalent in the business world.

That brought to a close the section on Normalization, next up was ER/EER -> Relational Model. Again as I did not attend this lecture I will just simply run through a summary of Manoj’s slides.

Inputs: ER/EER diagrams -> Outputs: relational schemas

Properties of Relations:

  • Each relation has a unique name..
  • Each tuple is unique
  • Attributes names are meaningful
  • Order of attributes is immaterial
  • Order of tuples is immaterial
  • entries are atomic (single valued)

Types of entities -> Regular(Strong), Weak, Associative(Composite).

In preparation for the transition from ER model to relation schema, the ER model must be expanded from conceptual to logical level. This involves removal of M:N relationships (Unary, Binary or Ternary) and recognition of Primary Key.

There was much more detail in this lecture but I will await the next presentation to elaborate further.