Categories
Computer Technologies and O/S

FIT9018: Week 5

5th Week Lecture – Virtual Memory

Andy Cheng’s lecture this week was a whirlwind tour over the definition and major issues of Virtual Memory.

source: http://en.wikipedia.org/wiki/File:Virtual_memory.svg

Virtual Memory enables programs running on an O/S to interact with what to them is a contiguous memory source. That is, program instructions and resources can be loaded to Virtual Memory addresses and a program can easily access them with logical addresses. The illustration above shows a simplified concept of Virtual Memory.

There are two major implementations for Virtual Memory:

Categories
Database Technology

FIT9019: Week 5

Database Design III – Boyce Codd Normal Form, presented by Manoj Kathpalia, alerted me to the value of revising the text book. It seems I do not have a clear grasp of some of the characteristics of each Normal form. Must ensure to remember that for a relation to be in BCNF every functional dependency must be a candidate key, this is best illustrated graphically:

source: Database Systems, Cornell and Rob, 2009

So, although the iPhone pic of the text book is a bit blurry, it can be seen that a sneaky dependency from a non-candidate key attribute to another attribute will cause update anomalies and refrain the table from achieving BCNF.

Most of the lecture was focused on ensuring that everyone understood the process of 1NF -> 2NF -> 3NF -> BCNF. I have already made a detailed post on this process which can be viewed here.

Our tutorial was 2 hours of toying with MicroSoft Access. I came into it with an open attitude, but after about 90 minutes I was lost in the world of GUI fluff that is Access. I am sure that with time it is something that one could learn to use with more efficiency, but with superior performing Open Source alternatives (ie: LAMP bundle) I cannot ever see myself working on an Access database by choice.

Pearl of the Week: Avoid Microsoft Access.

I plan to review the text book over the next week to ensure that my current perception of each aspect of the subject is in fact valid. Particularly important is to rote learn definitions for 1NF, 2NF, 3NF, BCNF, Functional Dependency, Transitive Key Dependency(3NF), Partial Dependency (2NF) and Non-Key Partial Dependencies (BCNF).

Categories
Systems Analysis and Design

FIT9030: Week 5

Week 5 is here and we started the week with the lecture, tutorial double of Systems Analysis and Desgin(by David Grant). I missed the first 10 minutes of the lecture, which I guess involved some revision of the previous weeks lecture on Analysis Models.

The week 5 lecture titled “Traditional or Structured Approach to Analysis”… I think the title should be amended to ‘Structured or Object-Oriented Approach to Analysis“.

Source: FIT9030 week 5 lecture slide
Categories
Foundations of Programming

FIT9017: Week 4

Week 4’s lecture by Judy got slightly deeper into the concept, design and implementation of objects. Again, I am finding that these lectures are moving very slowly and feel that prospective students should be given a chance (if they want) to demonstrate that they are not complete novices. However, this from an administrative point of view would probably be impossible and running through an introductory class will ensure that all the basic concepts (and more importantly, conventions) are clearly understood. So the only thing to do is get good marks and have a point to argue from for next semester.

The lecture started of defining the terms Abstraction and Modularization referencing their relevance to programming with a simple clock program. I felt this was valuable but could have been so much more valuable if we had gone a few steps further and show the practical applications for modularization and decoupling by making the clock program work and re-using the modules in different examples. In this example, Class Diagrams and Object Diagrams where covered (straight out of bluej).

Next came Primitive Types vs Object Types, specifically the differences in memory allocation (objects reference). I guess this will be a more interesting point when programming in C and the Garbage collector does not destroy unreferenced variables. Formal Parameters, Actual Arguments, Internal and External method calls followed, these were all consistent with what I have seen previously  and now feel very intuitive. The only point where I felt uncomfortable was where methods contained local variables with the same name as their Formal Parameters, necessitating the need for this.variable = variable notation. Seems much easier to me to avoid double naming.

The really key topic covered in the lecture and in the tutorials was the coding conventions: 70.40.214.44/Java_coding_standards.pdf

I need to update my existing habits to meet these standards (definitely a good thing).. means alot more indenting.

I will start reading through the text book more for this subject and continuing my own Java development. This should suffice until next semester or the 3rd when I hope we have the chance to do some challenging implementations.

Pearl of the Week: My first attempt at using Java Objects and a MySQL DB, hope to learn how wrong it is in the near future.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/**
Constructs a Book with bookID.
@param ID the Book ID number
*/

public Book(int ID)
throws SQLException, IOException, ClassNotFoundException
{
SimpleDataSource.init();
Connection conn = SimpleDataSource.getConnection();
try
{
java.sql.PreparedStatement
stat = conn.prepareStatement("SELECT * FROM books WHERE book_ID = ?");
stat.setInt(1, ID);
ResultSet rs = stat.executeQuery();
rs.next();
title = rs.getString("title");
author = rs.getString("author");
total = rs.getInt("total_pages");
current = rs.getInt("current_page");
path = rs.getString("path");
date = rs.getString("date");
genre = rs.getString("genre");
notes = rs.getString("notes");
}
finally
{
conn.close();
}
}

Haha there already a few bit there that are breaking format conventions already…. D:

Note, for some reason the code box is automatically removing indentation. The code box was made using a WordPress plugin: http://kpumuk.info/projects/wordpress-plugins/codecolorer/

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.

Categories
Systems Analysis and Design

FIT9030: Week 4

David spent the first 30 minutes or so of todays lecture completing the left over slides from last week on Requirements Gathering [PADIS]. Joint Application Design Sessions was the first topic, whereby the key stakeholders get together in a ‘war room’ (there is to be no fighting in the war room) with the required resources to fact-find, model, create policy and verify activities. That is to, complete the Analysis phase of the System Development Life Cycle in the space of a day or two.

Next we moved onto Vendor Solutions, this is an aspect of Systems Analysis that I think will become more and more prevalent in the coming years with Open Source programs on the rise along with those who are able to customize the packages sufficiently to make them a superior option. David mentioned that a 60-65% fit for a businesses’ System Requirements is sufficient to make an out of box solution work although his argument was supported only by a single anecdote.

The Requirements Gathering lecture came to a close with the Validation of Requirements (which is best conducted with near working prototypes) and a summary of the Analysis Phase:

  • Gather information (review documents, current practices, conduct interviews, prototyping, questionnaires, JAD sessions, Vendor Solutions)
  • Define System Requirements
  • Prioritize Requirements
  • Prototype (feasibility and discovery)
  • Generate and evaluate alternatives
  • Review with management

This weeks lecture was titled Beginning Analysis, this was somewhat confusing as I thought Requirement Gathering was part of the Analysis phase. The topics of the lecture:

  • Analysis Models
  • Events (OO Systems are event driven)
    • Simplistically, an occurrence at a time and place(to trigger all System Processing). Events can be divided into External(ie: customer orders warhead), Temporal(Time) and State(eg: status/qty). See Event Table below
  • Objects and System Requirements
    • Things (Customer, Employee, Supplier, Order, Item, Account) = Objects, Properties/Characteristics/Relationships = Attributes, Behaviors = Methods
  • UML
    • The standard modeling technique for OO

We skipped through the last two of the items above, Dave mentioned we would cover these in more detail next week.

In the tutorial we completed the interview for our assignments which will now enable us to complete an Event Table for the Employee Testing System Assignment. Apparently our interview went very well (I think this was a successful chance for Dave to give students some positive re-enforcement prior to attempting the assignments).

Categories
Foundations of Programming

FIT9017: Week 3

Judy Sheard’s third week lecture continued on the introduction to Java and programming as a whole. Although all of the concepts covered were very basic some of the terminology needs to be learned, particularly for when in the work place and the need to communicate arises. So, a summary of the terms covered and their contextual definitions:

  • Selection – if construct, 3 components: condition,consequent, alternative. if(keyword) (condition){consequent}else{alt}
  • relational operator –  ==, !=, <, >, <=, =>  result of these operators is a boolean TRUE/FALSE
  • boolean expression –  using one of the above operators.
  • compound statement – multiple lines in consequent block.
  • nested if – if within and if construct.
  • logical operators – !, && , || NOT, AND, OR can be used in conjunction with boolean expressions.
  • switch statement – can be used to neaten cascading if statements (compiles as cascading ifs however) ideal for day of the week statements etc. Can only be used with int and char expression evaluations.
  • shorthand arithmetic operators – a += 1; a -=1; a *=2; a /=3; a %=5; //reassign a with the result of the operators. a++; ++a; b–; –b; // if ++, — is after the variable then the arithmetic will be applied after the entire statement.
  • local variables –  variables within methods which exist only as long as the method is being executed.
  • base input –  using scanner method to read from keyboard

Precedence rule for evaluating expressions (JAVA):

  1. Parenthesis
  2. Unary Operators (++, –, !)
  3. Binary Arithmetic Operators (*, /, %, +, -)
  4. Relational Operators (<, >, <=, =>, ==, !=)
  5. Logical Operators ( &&, ||)
  6. Shorthand arithmetic ( =, +=, -=, *=, /=, %=) // these ones are evaluated right to left.

When in doubt of any of the above its much easier just to use parenthesis…

Pearl of the week: (I was always under the impression that a leap year is simple every 4th year, this is not the case however)

Algorithm for leap years:

if (year modulo 4 is 0) and (year modulo 100 is not 0) or (year modulo 400 is 0)
       then is_leap_year
else
       not_leap_year

Hope all banking systems have this correctly coded otherwise the 2100 bug might turn out to be more exciting than y2k.

The tut again was simply a revision of the lecture with the chance to ask question and get explanations. We are getting the assignment outline this week, Judy has said it is not really challenging…

if (year modulo 4 is 0) and (year modulo 100 is not 0) or (year modulo 400 is 0)
       then is_leap_year
else
       not_leap_year
Categories
Computer Technologies and O/S

FIT9018: Week 3

Andy Cheng presented the lecture titled “Operating Systems II: File Management” this week. In basis File Management systems allow users to store information in units called files, File systems provide a logical view for the user whilst hiding the physical view which is not interpretable by the average human.

  • Ordinary Files – executable, text, source code, etc.
  • Directories – contain Ordinary files and subdirectories (assist with Logical View)
  • Special Files – represent devices and other advanced file types.

We did not get into the file types in detail during the lecture or the tut however the file type and their characters (which can be view using ls -l):

  • – -> regular file
  • d -> directory file
  • b -> buffered special file (ie: disk drive)
  • c -> unbuffered special file (ie: terminal)
  • l -> symbolic link
  • p -> pipe
  • s -> socket

Absolute and Relative paths, self explanatory.

The lecture was cut short as we had to spent some time finishing the previous weeks slides so we did not really get into the chmod analysis which is responsible for permissions (I have had experience with this command as it is important on Unix based hosting for updating write permissions on config files). Basically the command is divided into User/Group/Others -> read, write and execute. A quick hand way for setting permissions is:

The octal (0-7) value is calculated by adding up the values for each digit

read = 4 ,write = 2, execute = 1,
User (rwx) = 4+2+1 = 7
Group(rx) = 4+1 = 5
World (rx) = 4+1 = 5
chmode mode = 0755

$ chmod 755 myfile – would be the command.

Pearl of the week: In all Unix operating systems all entities are treated as files (I assume this is related to the monolithic kernel design)

In the tut we got into working with the shell, a summary of some of the commands we covered below:

  • Print working directory -> pwd
  • Tab completes file name (or to fork where multiple possible values occur)
  • chmod

My favored site with listings of shell commands is: http://ss64.com/bash/ I find it the quickest and easiest for learning and look up.

To get better at command-line interface the key is regular practice. I am currently running Ubuntu on my home pc, but rarely use the shell unless testing programs. It is a good habit to get into using it.

After doing some practice it appears that using wildcard for the ls command is not very useful for find particular files in subdirectories. For example if you wanted to find all of the .ape files in your My Music folder, ls -R *.mp3 would not work. Instead one would need to use:

find ~/My Music/ -regex ".*\(mp3\)$" //find all .mp4 files
find -regex ".*\(.ape\|\.mp4\)$"  //find all .ape and .mp4 in relative directory and subdirectories