2010/03/30

Data Base week9_4 Extra class


26/03/2010

 
Transaction Management
Concurrency Control

 
HW Research
Compare the features of Oracle and SQL Server, under the headings below:
  • Name three different programming interfaces that applications programmers can use to process data in each DBMS from external programs written in C++, Java, Visual Basic or other languages. 
  • For each DBMS, identify and name one query tool supplied with the DBMS and name the language it uses.
  • SQL Server and Oracle both provide similar data access tools. Consider an environment where both products are in use. What differences if any would we expect to see in physical database designs between the two products? How would this impact the data management role?
  • For each DBMS, name a feature to support distributing read-only data and additionally to support distributing data for updating remotely.
  • Describe THREE types of distributed update conflict problem that may occur, and one strategy used to manage this.
  • For each DBMS, name two logging and archiving features available to support database recovery and/or audit.
  • For each DBMS, describe what option(s) must be chosen to ensure log files are created.
  • Describe what implementation strategies would be required to ensure no data is lost in the event of a media failure. Your answer should refer to backup, recovery, audit.
  • Describe the options each DBMS has to support concurrent transaction processing. For each option, give the range of values available.
  • From your answers to part(i), state the options you would choose for consistent processing in each database if you were required to implement ACID (atomic, consistent, isolated and durable) transactions. 
  • Describe one consequence to the business of choosing options that fail to guarantee ACID transactions in a multi-user environment. 
 

2010/03/29

C# week10_1

29/03/2010

Sorting

 
 

namespace ConsoleApplication23

{

class Program

{

static void Main(string[] args)

{

Console.WriteLine("Please enter Annual increment");

string a = Console.ReadLine();

int j = int.Parse(a);

Employee.AnnualIncrement=j;

Console.WriteLine(j);

Employee[] e = new Employee[4];

e[0] = new Employee(1, "ABC", 100.00);

e[1] = new Employee(2, "AAA", 200.00);

e[2] = new Employee(3, "XYZ", 500.00);

e[3] = new Employee(4, "CMG", 300.00);


 

foreach (Employee m in e)

{

Console.WriteLine(m.EmployeeName);

}

Array.Sort(e, new Sorting());

 
 

 
 

foreach (Employee n in e)

{

Console.WriteLine(n.EmployeeName+ " " + n.Salary + " "+n.GetAnnualIncrement());


 

}

 
 

}

}

class Employee

{

public int EmployeeID;

public string EmployeeName;

public double Salary;

public static int AnnualIncrement;

 
 

public double GetAnnualIncrement()

{

double inc = Salary*AnnualIncrement/100;

return inc;

}

 
 

public Employee(int id, string name, double salary)

{

EmployeeID =id;

EmployeeName=name;

Salary = salary;

}

}

class Sorting : IComparer

{

 
 

public int Compare(object a, object b)

{

Employee em = (Employee)a;

Employee em1 = (Employee)b;

 
 

double increment = em.GetAnnualIncrement();

double increment1 = em1.GetAnnualIncrement();

 
 

if (increment > increment1)

{

return 10;

}

else

if (increment == increment1)

{

return 0;

}

else

{

return -10;

}


 

}

 
 

}

 
 

}

Data Base week9_3


24/03/2010

 
DataBase Architecture Presentation

 
Research
  1. A common businesses requirement is to limit or deny access to certain types of data. Explain why this is necessary. Refer to data access, security and privacy in your answer.
  2. Describe two ways using a DBMS can limit access to data. How completely does this meet typical business expectations to control data access, security and privacy?


  3. Business information is rarely for the use of one individual alone. Usually, a range of people in an organization would need to have access to each item of information. So, businesses strive to share access among appropriate groups.
    1. Give one outcome for business risk as shared access grows. What effect does introducing a security policy have on this outcome?
    2. authorized usersGive one outcome for business performance as shared access grows.
    3. Give one outcome for database management system performance as shared access grows.
  4. Define data integrity. Give one common cause of poor data integrity. Explain why this can present problems to businesses.
  5. Why does integrating flat file data in a database improve data integrity? Explain why this alone cannot guarantee data integrity.
  6. Provide one business benefit of integrating data in this way.
  7. Give three features of DBMS that are designed to improve reliable access to data in the event of system problems or failures. State how these lower the risk of data loss. 
  8. State how these features affect the reliability and risk of the business.


  9. Following are the five tasks performed by database administrators that aid in data management in an organization


TaskBusiness impactStrengths & weaknesses of the ways DBMS support these tasks
managing database structure    
controlling concurrent processing    
managing processing rights and responsibilities

  
    
developing database security    
providing for database recovery    
managing the DBMS

maintaining the data repository
    

 

 

2010/03/28

Data Base week9_2


23/03/2010

 
Exam Feed Back

 
Draw UML
Develop a UML Class Diagram for the following scenario. Use aggregation and /or composition where appropriate


 










Data Base week9_1

22/03/2010

 
 

Exam

Sum up understanding

Test

Format - NZQA

 
 

Next Test

UML

Question Form

about 5 Classes

XML

Script - tree diagram

Tree diagram - script

 
 

Draw UML class diagram

2010/03/26

C# week9_3

24/03/2010

 
 

Class Program

Making programming by myself

 
 

  1. Random number simple lotto

    namespace ConsoleApplication7

    {

    class Program

    {

    static void Main(string[] args)

    {

    Console.WriteLine("Please input number from 0-10");

    Random r = new Random();

    int j = r.Next(10);

    Console.WriteLine(j);

    string num = Console.ReadLine();

    int i = int.Parse(num);

     
     

    if (i == j)

    {

    Console.WriteLine("Frist Match!!");

    Console.WriteLine("Please input number from 0-10");

    string num1 = Console.ReadLine();

    int k = int.Parse(num1);

    i = i - 1;

    if (i == k)

    {

    Console.WriteLine("Conglaturations!! You will $1,000.00!!");

    }

    }

    else

    {

    Console.WriteLine("Do you want to play again? yes-1 no-0");

    string num2 = Console.ReadLine();

    int l = int.Parse(num2);

    while (l == 1)

    {

    Console.WriteLine("Please input number from 0-10");

    string num3 = Console.ReadLine();

    int m = int.Parse(num3);

    int n = r.Next(10);

    if (m == n)

    {

    Console.WriteLine("Frist Match!!");

    Console.WriteLine("Please input number from 0-10");

    string num4 = Console.ReadLine();

    int o = int.Parse(num4);

    m = m - 1;

    if (o == m)

    {

    Console.WriteLine("Conglaturations!! You will $1,000.00!!");

    }

    }

    else

    {

    Console.WriteLine("Do you want to play again? yes-1 no-0");

    string num4 = Console.ReadLine();

    int p = int.Parse(num4);

    while (p == 1)

    {

     
     

    }

    if (p == 0)

    {

    Console.WriteLine("Good bye");

    }

    }

     
     

    }

    if (l == 0)

    {

    Console.WriteLine("Good bye");

     
     

    }

    }

    }

    }

     
     

  2. Enter 1 Employee data and calculate tax and net salary

    namespace ConsoleApplication8

    {

    class Program

    {

    static void Main(string[] args)

    {

     
     

    Console.WriteLine("Please input Employee ID");

    string k = Console.ReadLine();

    int id = int.Parse(k);

    Console.WriteLine("Please input Employee Name");

    string name = Console.ReadLine();

    Console.WriteLine("Please input Employee Job");

    string job = Console.ReadLine();

    Console.WriteLine("Please input Employee Salary");

    string j = Console.ReadLine();

    double salary = double.Parse(j);

     
     

     
     

    Employee e=new Employee(id,name,job,salary);

    int taxrate = e.GetTaxRate();

    double tax = e.GetTax();

    double netsalary = e.GetNetTax();

    Console.WriteLine("Employee Details");

    Console.WriteLine("Employee ID:" + id);

    Console.WriteLine("Employee Name:" + name);

    Console.WriteLine("Employee Job:" + job);

    Console.WriteLine("Employee Salary:" + salary);

    Console.WriteLine("Employee Tax Rate:" + taxrate+"%");

    Console.WriteLine("Employee Tax:" + tax);

    Console.WriteLine("Employee Net Salary:" + netsalary);

     
     

    }

    }

    class Employee

    {

    int EmployeeID;

    string EmployeeName;

    string EmployeeJob;

    double Salary;

     
     

    public int GetTaxRate()

    {

    int taxrate = 0;

    if (Salary < 40000)

    {

    taxrate = 20;

    }

    if (40000 <= Salary & Salary < 60000)

    {

    taxrate = 25;

    }

    if (60000 <= Salary & Salary < 80000)

    {

    taxrate = 30;

    }

    if (80000 <= Salary)

    {

    taxrate = 40;

    }

    return taxrate;

    }

    public double GetTax()

    {

    double tax = 0;

    tax = Salary * GetTaxRate() / 100;

    return tax;

    }

    public double GetNetTax()

    {

    double nettax = 0;

    nettax = Salary - GetTax();

    return nettax;

    }

    public int GetID()

    {

    return EmployeeID;

    }

    public string GetName()

    {

    return EmployeeName;

    }

    public string GetJob()

    {

    return EmployeeJob;

    }

    public double GetSalary()

    {

    return Salary;

    }

    public Employee(int id, string name, string job, double salary)

    {

    EmployeeID = id;

    EmployeeName = name;

    EmployeeJob = job;

    Salary = salary;

    }

     
     

    }

    }

     
     

     
     

  3. Enter many Employees data and calculate tax and net salary

    namespace ConsoleApplication8

    {

    class Program

    {

    static void Main(string[] args)

    {

    ArrayList employee = new ArrayList();

     
     

    for (int i = 0; i < 2; i++)

    {

    Console.WriteLine("Please input Employee ID");

    string k = Console.ReadLine();

    int id = int.Parse(k);

    Console.WriteLine("Please input Employee Name");

    string name = Console.ReadLine();

    Console.WriteLine("Please input Employee Job");

    string job = Console.ReadLine();

    Console.WriteLine("Please input Employee Salary");

    string j = Console.ReadLine();

    double salary = double.Parse(j);

     
     

    Employee em = new Employee(id, name, job, salary);

    employee.Add(em);

    }

    foreach (Employee e in employee)

    {

    int id = e.GetID();

    string name = e.GetName();

    string job = e.GetJob();

    double salary = e.GetSalary();

    int taxrate = e.GetTaxRate();

    double tax = e.GetTax();

    double netsalary = e.GetNetTax();

    Console.WriteLine("Employee Details");

    Console.WriteLine("Employee ID:" + id);

    Console.WriteLine("Employee Name:" + name);

    Console.WriteLine("Employee Job:" + job);

    Console.WriteLine("Employee Salary:" + salary);

    Console.WriteLine("Employee Tax Rate:" + taxrate);

    Console.WriteLine("Employee Tax:" + tax);

    Console.WriteLine("Employee Net Salary:" + netsalary);


     

    }

    }

    }

    class Employee

    {

    int EmployeeID;

    string EmployeeName;

    string EmployeeJob;

    double Salary;

     
     

    public int GetTaxRate()

    {

    int taxrate = 0;

    if (Salary < 40000)

    {

    taxrate = 20;

    }

    if (40000 <= Salary & Salary < 60000)

    {

    taxrate = 25;

    }

    if (60000 <= Salary & Salary < 80000)

    {

    taxrate = 30;

    }

    if (80000 <= Salary)

    {

    taxrate = 40;

    }

    return taxrate;

    }

    public double GetTax()

    {

    double tax = 0;

    tax = Salary * GetTaxRate() / 100;

    return tax;

    }

    public double GetNetTax()

    {

    double nettax = 0;

    nettax = Salary - GetTax();

    return nettax;

    }

    public int GetID()

    {

    return EmployeeID;

    }

    public string GetName()

    {

    return EmployeeName;

    }

    public string GetJob()

    {

    return EmployeeJob;

    }

    public double GetSalary()

    {

    return Salary;

    }

    public Employee(int id, string name, string job, double salary)

    {

    EmployeeID = id;

    EmployeeName = name;

    EmployeeJob = job;

    Salary = salary;

    }

     
     

    }

    }

     
     

C# week9_2

Class Program

  1. Throw roll die 500 times and count how many times each face is shown

    namespace ConsoleApplication22

    {

    class Program

    {

    static void Main(string[] args)

    {

    int counter1 = 0;

    int counter2 = 0;

    int counter3 = 0;

    int counter4 = 0;

    int counter5 = 0;

    int counter6 = 0;

    Random r = new Random();

    for (int i = 0; i < 500; i++)

    {

    int num = r.Next(1,7);

     
     

    switch(num){

    case 1:

    counter1++;

    break;

    case 2:

    counter2++;

    break;

    case 3:

    counter3++;

    break;

    case 4:

    counter4++;

    break;

    case 5:

    counter5++;

    break;

    case 6:

    counter6++;

    break;

    }

    }

     
     

    Console.WriteLine("The sum of 1 face " + counter1);

    Console.WriteLine("The sum of 2 face " + counter2);

    Console.WriteLine("The sum of 3 face " + counter3);

    Console.WriteLine("The sum of 4 face " + counter4);

    Console.WriteLine("The sum of 5 face " + counter5);

    Console.WriteLine("The sum of 6 face " + counter6);

    }

    }

    }

     
     

  2. Throw roll die 6times and counts sum up them. Repeat this action 500times and count how many times total becomes 10.

    namespace ConsoleApplication22

    {

    class Program

    {

    static void Main(string[] args)

    {

     
     

    int counter = 0;

    Random r = new Random();

    for (int i = 0; i < 500; i++)

    {

    int sum = 0;

    for (int j = 0; j < 6; j++)

    {

    sum = sum+r.Next(1,6);

     
     

     
     

    }

    if (sum == 10)

    {

    counter++;

    }

    }

     
     

    Console.WriteLine("The sum of all faces"+counter);

    }

    }

    }

2010/03/25

C# week9_1

22/03/2010

 
 

ADO.NET

 
 

//Insert, Update, Select SQL command

 
 

namespace ConsoleApplication

{

class Program

{

static SqlConnection conn = null;

static void Main(string[] args)

{

SqlDataReader rdr;

try

{

conn = new SqlConnection("Data Source = Server ; Initial Catalog = DBname; Integrated Security = SSPI");

 
 

conn.Open();

SqlCommand cmd = new SqlCommand("INSERT INTO CATEGORY VALUES (12, 'Orange')", conn);

cmd.ExecuteNonQuery();

 
 

SqlCommand cmd1 = new SqlCommand("UPDATE CATEGORY SET CategoryName='Other' WHERE CategoryID=9", conn);

cmd1.ExecuteNonQuery();

 
 

 
 

SqlCommand cmd2 = new SqlCommand("SELECT * FROM CATEGORY", conn);

rdr = cmd2.ExecuteReader();

while (rdr.Read())

{

int ID = (int)rdr[0];

string Name = (string)rdr[1];

Console.WriteLine(ID + Name);

}

 
 

}

catch (Exception ex)

{

Console.WriteLine(ex.Message);

}

finally

{

conn.Close();

}

}

}

}

 
 

2010/03/22

Amazing at IT English words for me (私が驚いたIT用語?)

I haven't known following words, so I was confused during the class. But if I were a software engineer, I would have known many words:)

私が驚いたキーワードを紹介。エンジニアだったら当たり前だったのかもしれないけど。言葉のニュアンスがカタカナワードとは違う場合があるので難しい。 

General
  • Decimal  小数点のこと (two decimal places: 小数点第2位)
  • Hexadecimal (Base-16) 16進法
  • #(hash)  ハッシュと読む(イギリス英語だからなのかもしれないけど)
  • Numeric  数字の
  • Alphabetic アルファベットの
  • Upper case 大文字
  • Lower case 小文字
  • Pen drive USBメモリー
  • Dimension 次元(two dimensions: 2次元)

Database
  • Normalization 正規化
  • Integrity 完全性
  • Redundancy 余分なもの(Duplication 重複と同じような意味)
  • Assumption 前提条件
  • Cursor  カーソル(読めなかった。。。)   
  • Dynamic  (辞書だと)動的な
  • Static    (辞書だと)静的な
    • UMLのDynamic DiagramとStatic Diagramを見てなんとなく理解
      • Static Diagrams: Class diagram, Physical diagram
      • Dynamic Diagrams: Use case diagram, Interaction diagram, State diagram, Activity diagram
C#
  • Variable  変数(最初3WeeksぐらいValuableだと思ってたのですごく混乱してた^^;)
  • Increment 足し算
  • Decrement 引き算 
  • Polymorphism 多態性(このあたり和訳の限界がある気が。。。) 
  • Inheritance 継承
  • Interface インターフェース(さすがに和訳はあきらめたのか?)
発音も日本とは異なる場合があるので、NZはイギリス英語だからDatabaseはダータベース、Datatypeはダータタイプ。他にもSQLはシークエル、Linuxはライナックスとまあこんな感じなので、知ってる話だったとしても、あーこれのことってわかるまでに時間がかかる。
英語うまくなりたいなー^^

SDI1 week8_2


19/03/2010


 

UML

Use Case Notation

include
exclude

 
Homework

Draw use case from scenario

2010/03/21

SDI1 week8_1


16/03/2010


 

UML (Unified Modelling Language)

UML is a standard language for specifying, visualizing, constructing, and documenting the artefacts of software systems, as well as for business modelling and other non-software systems.
If we define a new system verbally, each project member understands slightly different system. These differences affect project progress, so we have to define system visually.

 

UML diagrams

UML includes 6 types of diagram.
-          Use case diagram
-          Class diagram
-          Interaction diagram
-          State diagram
-          Activity diagram
-          Physical diagram

 

Use case diagram

Use case diagram is helpful in exposing requirements and planning the project. During the initial stage of a project most use cases should be defined, but as the project continues more might become visible.

Exam Schedule

Subject

Exam date

Exam time

Exam

Open/Close

Status

Feed Back

Required

Description

7.403

C#

13/04 Tue

01:30-03:40

Theory Test

Open Book

  

16/04

2:00 PM

100P

  

7.403

C#

15/04 Thu

09:00-01:15

Practical Test

Open Book

  

19/04

2:00 PM

100P

  

7.407

DB

16/04 Fri

09:00-01:15

Practical Test

Close Book

  

21/04

2:00 PM

100P

  

7.407

DB

20/04 Tue

01:00-03:10

Theory Test Part1-A

Close Book

  

26/04

12:00 PM

100P

  

7.407

DB

22/04 Thu

09:00-11:10

Theory Test Part1-B

Close Book

  

26/04

12:00 PM

100P

  

7.408

DB

19/03 Fri

09:00-12:15

Theory & Practical Test Part1

Close Book

Finish

23/03

9:00AM

100P

ERD

Anomaly

Normalization

Integrity

7.408

DB

01/04 Thu

09:00-12:15

Theory & Practical Test Part2

Close Book

  

06/04

9:00 AM

100P

  

7.426

SDI1

19/04 Mon

09:00-11:10

Theory Test

Close Book

  

  

40P?

  

 
 

 
 

 
 

Waterfall Model

I saw my Google Analytics and found the  key word of "waterfall model".
So, I write waterfall model briefly:)

Waterfall Model
a) Requirements
Activity
·         Define this system
·         Set project scope and grand design
Document
- Project proposal
- Project Definition
b)   Analysis
Activity
·        Gather and document business requirements
                                                         Document
- Analysis report




c)  Design
       Activity
·         Design UI and technical architecture
 Document
- UI design
- Network and system architecture and design
- Software and Database architecture and design
d)      Implementation
     Activity
·         Build technical architecture
·         Build the database and programs
 Document
- System test plan
- Program code
- System documentation
e)      Testing
Activity
·         Perform the testing of the system
·         Write the test conditions
                                             Document
- Test results


f)       Deployment
     Activity
·         Train Users and write user document
·         Install the system
 Document
- Clients acceptance agreements
- Project closure report
g)      Maintenance
Activity
·         Build a help desk
·         Provide an environment to support system changes
·         Maintain and enhance the computer system
                                             Document
- Training manual
- Change request form



UA-9417263-1