11. Persistence. The use of files, streams and serialization for storing object model data

Size: px
Start display at page:

Download "11. Persistence. The use of files, streams and serialization for storing object model data"

Transcription

1 11. Persistence The use of files, streams and serialization for storing object model data

2 Storing Application Data Without some way of storing data off-line computers would be virtually unusable imagine a Word Processor which forced you to complete a document and print it in a single session who d use it? Most programs involve several types of data Status information e.g. index of current item in a list Convenience information e.g. location and size of main window (just another type of status information) Object Model data the state of every live object in a running program Some or all of this can be saved, either in a single site or spread among any of the available storage mechanisms

3 Storage Mechanisms Windows Registry Part of the operating system (files owned by the O/S) Good for storing small amounts of data Files Standard way of persisting information Can be highly structured or very simple, depending on data being stored XML Files again, but based on standards that make it possible for different systems to share the data Databases Very structured and with a lot of program overhead, but very efficient for saving large amounts of data (we will cover this in detail next chapter)

4 The Registry The Windows Registry is a large text database, that stores data in a hierarchical structure Application data is stored in a tree structure typically The application name is the top level e.g. MyProgram A section name to group related items of data together e.g. RecentFiles A key name, that specifies a name and a single item of data e.g. File1= C:\MyData\Datafile1.dat The registry is an operating-system wide resource, and so must be treated with care NO STORING LARGE AMOUNTS OF DATA, because potentially every program in windows will use the registry Use only the standard functions GetSetting() and SaveSetting() for reading and writing

5 e.g. Saving a form s size and position in the registry Private Sub frmregistry_load(byval sender As System.Object, _ ByVal e As System.EventArgs) _ Handles MyBase.Load Me.Left = CInt(GetSetting("RegDemo", "Position", "Left", _ CStr(Me.Left))) Me.Top = CInt(GetSetting("RegDemo", "Position", "Top", _ CStr(Me.Top))) Me.Width = CInt(GetSetting("RegDemo", "Size", "Width", _ CStr(Me.Width))) Me.Height = CInt(GetSetting("RegDemo", "Size", "Height", _ CStr(Me.Height))) End Sub Private Sub frmregistry_closing(byval sender As Object, _ ByVal e As System.ComponentModel.CancelEventArgs) _ Handles MyBase.Closing SaveSetting("RegDemo", "Position", "Left", CStr(Me.Left)) SaveSetting("RegDemo", "Position", "Top", CStr(Me.Top)) SaveSetting("RegDemo", "Size", "Width", CStr(Me.Width)) SaveSetting("RegDemo", "Size", "Height", CStr(Me.Height)) End Sub

6 File Storage All computer data (including registry data, database data) is stored in files if it needs to be persisted Various device types (Disks, Hard Disks, CD-R/Ws, Mag-Tape, Flash cards etc.) have data stored in them by the OS/ File System, so that all appear the same to a program simple File devices There are only 4 basic operations to worry about when using files Opening a file prepares it for Read and Write operations Reading from a file extracts an item of data and moves on to prepare to read the next item Writing to a file inserts new data at the end of the file Closing a file files that are open are vulnerable to corruption. Closing a file puts it into a safe state

7 Files and Streams Because of the way a file works we can think of it as having a flow of data Data is read from a file in exactly the same order it was written to it The name used to indicate this is a stream (although streams can also be to a network, memory, a modem or other devices) In.NET, most files are treated as streams StreamReader class defines objects that know how to read from a stream StreamWriter class defines objects that know how to read from a stream Data sent to a stream can be ambiguous, because there is no automatic way to separate one item from the next e.g. save 10, 20, 30 and 40, and it will be written as all crunched together To deal with this, we use delimiters to mark the end of each item of data CSV Comma Separated Variables, so the 4 numbers are saved as 10, 20, 30, 40 Other delimiters (e.g. Tab, Space) can be used instead, but comma is normal

8 Structured Data and Streams Saving Objects to a stream brings new problems How to separate the individual object member fields How to separate the different objects Best approach is to precede each object with a header, indicating its class do this for EVERY class, including individual member variables When reading objects from a stream, start by reading the header, then create the object and read the data into it (up to the next header) This process is called Serialization Stream Class Object BankAccount Name : String Address : String AccountNo : Long Balance : Decimal :BankAccount Joe Bloggs 1 High St., Sometown BANKACCOUNT~STRING Joe Bloggs~STRING 1High St.,Sometown~LONGINT ~DECIMAL Note ~ is used as a header prefix in this example

9 Serialization There are two ways to do serialization in.net Write Load() and Save() methods for each class, including code to handle structure (collections etc.) Use the.net <Serializable()> attribute and the BinaryFormatter or XMLFormatter class to store the data The first of these is likely to produce output that is easier for a human to read, but involves a lot of work The second requires less work, but produces Binary or XML output. Binary can be difficult to fix if the data gets corrupted; XML contains a lot of redundant information.

10 XML Serialization in general is not based on any specific standards All programs/programmers/environments have their own variations, based on ease of programming, efficiency (in storage) and other preferences This makes it difficult to exchange data between programs Two programs written by the same programmers can share data without too much difficulty, but What about programs written by different programmers, in different languages, or for different environments (e.g..net and Linux) XML was created as a standard way of serializing data into files XML uses plain text, so no problems about binary compatibility XML documents are self-describing, so the content of a document is easy to interpret XML is not a rigid language, but a format that allows new types of document to be designed easily so that their content is described adequately for any given domain (e.g. finance, CAD) within the rules of XML

11 XML Format and Rules An XML document has a tree structure with a single root node (e.g. customer) Each element of data is encolsed in an opening and a closing tag <tag>data</tag> Null data can be represented by an empty pair of tags <tag></tag> or an empty tag <tag/> Elements can be nested, but this must be done correctly e.g. <x><y>data</y></x>, not <x><y>data</x></y> Tag names are case-sensitive e.g. <Tag> is not the same as <TAG> or <tag> Elements can have attributes, which appear within the opening tag as a name and value the value must be in quotes <customer ID= > <name>fred Bloggs</name> <address> <street>25 Glen Road</street> <town>ayr</town> <postcode>ka11 1BG</postcode> </address> <lastorderdate>17/12/2002</lastorderdate> < /> </customer> Note empty tag

12 System.XML The System.XML namespace in.net provides a number of classes for reading, writing and formatting XML Use XmlTextWriter class to create a XML document The XmlDocument class is used to read data from a Xml file, and provides methods for extracting elements and attributes The XmlNode class is used to accept single nodes extracted from a XmlDocument or create new nodes Since a XML element can be a complex item containing collections and hierarchy, a XmlNode can house anything from an entire XML document to a single element containing one item of data

13 XML and Object Models Best approach is to provide each class in an application with methods for dealing with XML data WriteXML() method can be used to pack the class member data into a XML element and return it as a string An overloaded New() method can be created to accept an XmlNode as a parameter, and construct an object from it Using this approach, even complex hierarchies can be dealt with easily in an application, since each class that needs to be persisted to and retrieved from XML can fend for itself

14 Example XML-Aware class Class Subject Private mvarcode As String Private mvartitle As String Private mvarmark As Integer Public Sub New(ByVal code As String, _ ByVal title As String, _ ByVal mark As Integer) mvarcode = code mvartitle = title mvarmark = mark End Sub Public Sub New(ByVal subjectnode As XmlNode) Dim Code As String, Title As String, Mark As Integer mvarcode = subjectnode.attributes("code").value mvartitle = subjectnode.item("title").innertext mvarmark = _ CType(subjectNode.Item("Mark").InnerText, Integer) End Sub continues Public Sub WriteXML(ByVal writer As XmlWriter) With writer.writestartelement("subject").writeattributestring("code", mvarcode).writeelementstring("title", mvartitle).writeelementstring("mark", _ mvarmark.tostring()).writeendelement() End With End Sub End Class WriteXML() method serializes object to a XmlWriter Constructor creates an object from data in a XML node

15 Comparing persistence methods Registry Easy, good for small amounts of data only, text only Files Primitive, efficient, good for lots of data where structure does not change e.g. plain text, tables, possible to have random access Serialization More support from.net, possible to store simple or complex data structures, can be automated (using <Serializable()> attributes) or handcoded (for human-readable structured output) XML Inefficient (can be more mark-up than data), but best for data interchange due to self-descriptive nature All of the above Limitations in dealing with VERY LARGE data sets, where all can not be held in main memory. Primitive file handling with Binary Access files can be used to provided access to small amounts of data from a large file, but coding is difficult and requires use of ancillary structures (indexes) to make it work

16 Summary Programs that are expected to create significant outputs need some persistence mechanism Should distinguish between data stored for convenience (e.g. recent files) and data stored for more strategic purposes Files are the basis of saving all computer data The registry is a set of files for storing small amounts of data about the computer, its configuration and applications Simple file handling can be used for simple data More complex data must use more structured files object models require serializing XML is a form of serialization where data is stored embedded in descriptive tags, which makes the data easy to move to other systems All forms of data storage have some limitations, either in scope (registry), convenience (files), complexity (serialization) or storage efficiency (XML)

Lab 6: Making a program persistent

Lab 6: Making a program persistent Lab 6: Making a program persistent In this lab, you will cover the following topics: Using the windows registry to make parts of the user interface sticky Using serialization to save application data in

More information

Unit Title: Files, Streams and Serialization. Software Development Unit 9. Files, Streams and Serialization

Unit Title: Files, Streams and Serialization. Software Development Unit 9. Files, Streams and Serialization Software Development Unit 9 Files, Streams and Serialization Aims Most computer systems rely on the long-term storage of data to make them workable. In this Unit, we look at a number of mechanisms provided

More information

Chapter 14: Files and Streams

Chapter 14: Files and Streams Chapter 14: Files and Streams Files and the File and Directory Temporary storage Classes Usually called computer memory or random access memory (RAM) Variables use temporary storage Volatile Permanent

More information

CS708 Lecture Notes. Visual Basic.NET Object-Oriented Programming. Implementing Client/Server Architectures. Part (I of?) (Lecture Notes 5A)

CS708 Lecture Notes. Visual Basic.NET Object-Oriented Programming. Implementing Client/Server Architectures. Part (I of?) (Lecture Notes 5A) CS708 Lecture Notes Visual Basic.NET Object-Oriented Programming Implementing Client/Server Architectures Part (I of?) (Lecture Notes 5A) Professor: A. Rodriguez CHAPTER 1 IMPLEMENTING CLIENT/SERVER APPLICATIONS...

More information

Learning VB.Net. Tutorial 19 Classes and Inheritance

Learning VB.Net. Tutorial 19 Classes and Inheritance Learning VB.Net Tutorial 19 Classes and Inheritance Hello everyone welcome to vb.net tutorials. These are going to be very basic tutorials about using the language to create simple applications, hope you

More information

VARIABLES. 1. STRINGS Data with letters and/or characters 2. INTEGERS Numbers without decimals 3. FLOATING POINT NUMBERS Numbers with decimals

VARIABLES. 1. STRINGS Data with letters and/or characters 2. INTEGERS Numbers without decimals 3. FLOATING POINT NUMBERS Numbers with decimals VARIABLES WHAT IS A VARIABLE? A variable is a storage location in the computer s memory, used for holding information while the program is running. The information that is stored in a variable may change,

More information

OVERLOADING METHODS AND CONSTRUCTORS: The Ball Class

OVERLOADING METHODS AND CONSTRUCTORS: The Ball Class OVERLOADING METHODS AND CONSTRUCTORS: The Ball Class Create a Ball Demo program that uses a Ball class. Use the following UML diagram to create the Ball class: Ball - ballcolor: Color - ballwidth, ballheight:

More information

Section 7 The BASIC Language II

Section 7 The BASIC Language II Dates Section 7 The BASIC Language II The Date class holds a date (between January 1 st, 0001 and December 31 st, 9999) combined with a time (between 0:00:00 and 23:59:59) Constructors of the Date class

More information

Microsoft XML Diff 1.0 and XML Patch 1.0

Microsoft XML Diff 1.0 and XML Patch 1.0 Microsoft XML Diff 1.0 and XML Patch 1.0 Microsoft XML Diff 1.0 and XML Patch 1.0 The XmlDiff is a class used to compare two XML documents, detecting additions, deletions and other changes between XML

More information

Universal Format Plug-in User s Guide. Version 10g Release 3 (10.3)

Universal Format Plug-in User s Guide. Version 10g Release 3 (10.3) Universal Format Plug-in User s Guide Version 10g Release 3 (10.3) UNIVERSAL... 3 TERMINOLOGY... 3 CREATING A UNIVERSAL FORMAT... 5 CREATING A UNIVERSAL FORMAT BASED ON AN EXISTING UNIVERSAL FORMAT...

More information

Lecture 10 OOP and VB.Net

Lecture 10 OOP and VB.Net Lecture 10 OOP and VB.Net Pillars of OOP Objects and Classes Encapsulation Inheritance Polymorphism Abstraction Classes A class is a template for an object. An object will have attributes and properties.

More information

To get started with Visual Basic 2005, I recommend that you jump right in

To get started with Visual Basic 2005, I recommend that you jump right in In This Chapter Chapter 1 Wading into Visual Basic Seeing where VB fits in with.net Writing your first Visual Basic 2005 program Exploiting the newfound power of VB To get started with Visual Basic 2005,

More information

CS201 Some Important Definitions

CS201 Some Important Definitions CS201 Some Important Definitions For Viva Preparation 1. What is a program? A program is a precise sequence of steps to solve a particular problem. 2. What is a class? We write a C++ program using data

More information

DRAWING AND MOVING IMAGES

DRAWING AND MOVING IMAGES DRAWING AND MOVING IMAGES Moving images and shapes in a Visual Basic application simply requires the user of a Timer that changes the x- and y-positions every time the Timer ticks. In our first example,

More information

Objectives. After completing this topic, the students will: Understand of the concept of polymorphism Know on How to implement 2 types of polymorphism

Objectives. After completing this topic, the students will: Understand of the concept of polymorphism Know on How to implement 2 types of polymorphism Polymorphism Objectives After completing this topic, the students will: Understand of the concept of polymorphism Know on How to implement 2 types of polymorphism Definition Polymorphism provides the ability

More information

Manipulating XML in Visual Basic

Manipulating XML in Visual Basic XML in Visual Basic https://msdn.microsoft.com/en-us/library/bb384833(d=printer).aspx 1 of 1 03.09.2016 10:21 XML in Visual Basic Visual Studio 2015 Visual Basic provides integrated language support that

More information

Weiss Chapter 1 terminology (parenthesized numbers are page numbers)

Weiss Chapter 1 terminology (parenthesized numbers are page numbers) Weiss Chapter 1 terminology (parenthesized numbers are page numbers) assignment operators In Java, used to alter the value of a variable. These operators include =, +=, -=, *=, and /=. (9) autoincrement

More information

Chapter 1 Getting Started

Chapter 1 Getting Started Chapter 1 Getting Started The C# class Just like all object oriented programming languages, C# supports the concept of a class. A class is a little like a data structure in that it aggregates different

More information

RTL Reference 1. JVM. 2. Lexical Conventions

RTL Reference 1. JVM. 2. Lexical Conventions RTL Reference 1. JVM Record Transformation Language (RTL) runs on the JVM. Runtime support for operations on data types are all implemented in Java. This constrains the data types to be compatible to Java's

More information

CSC Web Technologies, Spring Web Data Exchange Formats

CSC Web Technologies, Spring Web Data Exchange Formats CSC 342 - Web Technologies, Spring 2017 Web Data Exchange Formats Web Data Exchange Data exchange is the process of transforming structured data from one format to another to facilitate data sharing between

More information

ucalc Patterns Examine the following example which can be pasted into the interpreter (paste the entire block at the same time):

ucalc Patterns Examine the following example which can be pasted into the interpreter (paste the entire block at the same time): [This document is far from complete but discusses some pattern essentials. Check back for more in the future; ask questions for clarity] ucalc Patterns ucalc patterns represent a key element of all current

More information

What we already know. more of what we know. results, searching for "This" 6/21/2017. chapter 14

What we already know. more of what we know. results, searching for This 6/21/2017. chapter 14 What we already know chapter 14 Files and Exceptions II Files are bytes on disk. Two types, text and binary (we are working with text) open creates a connection between the disk contents and the program

More information

d-file Language Reference Manual

d-file Language Reference Manual Erwin Polio Amrita Rajagopal Anton Ushakov Howie Vegter d-file Language Reference Manual COMS 4115.001 Thursday, October 20, 2005 Fall 2005 Columbia University New York, New York Note: Much of the content

More information

Introduction to File Systems

Introduction to File Systems Introduction to File Systems CS-3013 Operating Systems Hugh C. Lauer (Slides include materials from Slides include materials from Modern Operating Systems, 3 rd ed., by Andrew Tanenbaum and from Operating

More information

APPLICATION LAYER APPLICATION LAYER : DNS, HTTP, , SMTP, Telnet, FTP, Security-PGP-SSH.

APPLICATION LAYER APPLICATION LAYER : DNS, HTTP,  , SMTP, Telnet, FTP, Security-PGP-SSH. APPLICATION LAYER : DNS, HTTP, E-mail, SMTP, Telnet, FTP, Security-PGP-SSH. To identify an entity, the Internet used the IP address, which uniquely identifies the connection of a host to the Internet.

More information

CPS122 Lecture: From Python to Java

CPS122 Lecture: From Python to Java Objectives: CPS122 Lecture: From Python to Java last revised January 7, 2013 1. To introduce the notion of a compiled language 2. To introduce the notions of data type and a statically typed language 3.

More information

Lab 4: Adding a Windows User-Interface

Lab 4: Adding a Windows User-Interface Lab 4: Adding a Windows User-Interface In this lab, you will cover the following topics: Creating a Form for use with Investment objects Writing event-handler code to interact with Investment objects Using

More information

Preface... (vii) CHAPTER 1 INTRODUCTION TO COMPUTERS

Preface... (vii) CHAPTER 1 INTRODUCTION TO COMPUTERS Contents Preface... (vii) CHAPTER 1 INTRODUCTION TO COMPUTERS 1.1. INTRODUCTION TO COMPUTERS... 1 1.2. HISTORY OF C & C++... 3 1.3. DESIGN, DEVELOPMENT AND EXECUTION OF A PROGRAM... 3 1.4 TESTING OF PROGRAMS...

More information

What is PHP? [1] Figure 1 [1]

What is PHP? [1] Figure 1 [1] PHP What is PHP? [1] PHP is an acronym for "PHP: Hypertext Preprocessor" PHP is a widely-used, open source scripting language PHP scripts are executed on the server PHP is free to download and use Figure

More information

Procedures in Visual Basic

Procedures in Visual Basic Procedures in Visual Basic https://msdn.microsoft.com/en-us/library/y6yz79c3(d=printer).aspx 1 of 3 02.09.2016 18:50 Procedures in Visual Basic Visual Studio 2015 A procedure is a block of Visual Basic

More information

CS112 Lecture: Working with Numbers

CS112 Lecture: Working with Numbers CS112 Lecture: Working with Numbers Last revised January 30, 2008 Objectives: 1. To introduce arithmetic operators and expressions 2. To expand on accessor methods 3. To expand on variables, declarations

More information

Teiid Designer User Guide 7.5.0

Teiid Designer User Guide 7.5.0 Teiid Designer User Guide 1 7.5.0 1. Introduction... 1 1.1. What is Teiid Designer?... 1 1.2. Why Use Teiid Designer?... 2 1.3. Metadata Overview... 2 1.3.1. What is Metadata... 2 1.3.2. Editing Metadata

More information

Else. End If End Sub End Class. PDF created with pdffactory trial version

Else. End If End Sub End Class. PDF created with pdffactory trial version Dim a, b, r, m As Single Randomize() a = Fix(Rnd() * 13) b = Fix(Rnd() * 13) Label1.Text = a Label3.Text = b TextBox1.Clear() TextBox1.Focus() Private Sub Button2_Click(ByVal sender As System.Object, ByVal

More information

Mobile Computing Professor Pushpendra Singh Indraprastha Institute of Information Technology Delhi Java Basics Lecture 02

Mobile Computing Professor Pushpendra Singh Indraprastha Institute of Information Technology Delhi Java Basics Lecture 02 Mobile Computing Professor Pushpendra Singh Indraprastha Institute of Information Technology Delhi Java Basics Lecture 02 Hello, in this lecture we will learn about some fundamentals concepts of java.

More information

Unit Title: Objects in Visual Basic.NET. Software Development Unit 4. Objects in Visual Basic.NET

Unit Title: Objects in Visual Basic.NET. Software Development Unit 4. Objects in Visual Basic.NET Software Development Unit 4 Objects in Visual Basic.NET Aims This unit proceeds to the heart of object-oriented programming, introducing the mechanisms for creating new classes of object, defining their

More information

Functional Requirements Guidelines

Functional Requirements Guidelines Functional Requirements Guidelines Introduction for software development This guidance provides descriptions of the content of the top-level headings in a functional requirements document for software

More information

CPS122 Lecture: From Python to Java last revised January 4, Objectives:

CPS122 Lecture: From Python to Java last revised January 4, Objectives: Objectives: CPS122 Lecture: From Python to Java last revised January 4, 2017 1. To introduce the notion of a compiled language 2. To introduce the notions of data type and a statically typed language 3.

More information

Cpt S 122 Data Structures. Introduction to C++ Part II

Cpt S 122 Data Structures. Introduction to C++ Part II Cpt S 122 Data Structures Introduction to C++ Part II Nirmalya Roy School of Electrical Engineering and Computer Science Washington State University Topics Objectives Defining class with a member function

More information

H2 Spring B. We can abstract out the interactions and policy points from DoDAF operational views

H2 Spring B. We can abstract out the interactions and policy points from DoDAF operational views 1. (4 points) Of the following statements, identify all that hold about architecture. A. DoDAF specifies a number of views to capture different aspects of a system being modeled Solution: A is true: B.

More information

Q.1. (a) [4 marks] List and briefly explain four reasons why resource sharing is beneficial.

Q.1. (a) [4 marks] List and briefly explain four reasons why resource sharing is beneficial. Q.1. (a) [4 marks] List and briefly explain four reasons why resource sharing is beneficial. Reduces cost by allowing a single resource for a number of users, rather than a identical resource for each

More information

1. Lexical Analysis Phase

1. Lexical Analysis Phase 1. Lexical Analysis Phase The purpose of the lexical analyzer is to read the source program, one character at time, and to translate it into a sequence of primitive units called tokens. Keywords, identifiers,

More information

To enter the number in decimals Label 1 To show total. Text:...

To enter the number in decimals Label 1 To show total. Text:... Visual Basic tutorial - currency converter We will use visual studio to create a currency converter where we can convert a UK currency pound to other currencies. This is the interface for the application.

More information

IMPORTING CUSTOM FORMAT FILES

IMPORTING CUSTOM FORMAT FILES IMPORTING CUSTOM FORMAT FILES TRIMBLE ACCESS SOFTWARE 2014 Revision A Contact information Geospatial Division 10368 Westmoor Drive Westminster CO 80021 USA www.trimble.com Copyright and trademarks 2005-2014,

More information

Form Adapter Example. DRAFT Document ID : Form_Adapter.PDF Author : Michele Harris Version : 1.1 Date :

Form Adapter Example. DRAFT Document ID : Form_Adapter.PDF Author : Michele Harris Version : 1.1 Date : Form Adapter Example DRAFT Document ID : Form_Adapter.PDF Author : Michele Harris Version : 1.1 Date : 2009-06-19 Form_Adapter.doc DRAFT page 1 Table of Contents Creating Form_Adapter.vb... 2 Adding the

More information

Microprocessors & Assembly Language Lab 1 (Introduction to 8086 Programming)

Microprocessors & Assembly Language Lab 1 (Introduction to 8086 Programming) Microprocessors & Assembly Language Lab 1 (Introduction to 8086 Programming) Learning any imperative programming language involves mastering a number of common concepts: Variables: declaration/definition

More information

Chapter 2 Exploration of a Visual Basic.Net Application

Chapter 2 Exploration of a Visual Basic.Net Application Chapter 2 Exploration of a Visual Basic.Net Application We will discuss in this chapter the structure of a typical Visual Basic.Net application and provide you with a simple project that describes the

More information

Lua Framework. Version , Georges Dimitrov

Lua Framework. Version , Georges Dimitrov Lua Framework Version 1.1 2015, Georges Dimitrov Contents Introduction...2 Installation...2 LuaReader Basics...3 Representation of Lua values in MoonSharp... 3 Executing Lua scripts with MoonSharp... 3

More information

MIB BROADCAST STREAM SPECIFICATION

MIB BROADCAST STREAM SPECIFICATION MIB BROADCAST STREAM SPECIFICATION November 5, 2002, Version 1.0 This document contains a specification for the MIB broadcast stream. It will be specified in a language independent manner. It is intended

More information

File Handling Programming 1 C# Programming. Rob Miles

File Handling Programming 1 C# Programming. Rob Miles 08101 Programming 1 C# Programming Rob Miles Files At the moment when our program stops all the data in it is destroyed We need a way of persisting data from our programs The way to do this is to use files

More information

Java Programming Tutorial 1

Java Programming Tutorial 1 Java Programming Tutorial 1 Every programming language has two defining characteristics: Syntax Semantics Programming Writing code with good style also provides the following benefits: It improves the

More information

Short Notes of CS201

Short Notes of CS201 #includes: Short Notes of CS201 The #include directive instructs the preprocessor to read and include a file into a source code file. The file name is typically enclosed with < and > if the file is a system

More information

Assoc. Prof. Dr. Marenglen Biba. (C) 2010 Pearson Education, Inc. All rights reserved.

Assoc. Prof. Dr. Marenglen Biba. (C) 2010 Pearson Education, Inc. All rights reserved. Assoc. Prof. Dr. Marenglen Biba Laboratory Session: Exercises on classes Analogy to help you understand classes and their contents. Suppose you want to drive a car and make it go faster by pressing down

More information

2 nd Week Lecture Notes

2 nd Week Lecture Notes 2 nd Week Lecture Notes Scope of variables All the variables that we intend to use in a program must have been declared with its type specifier in an earlier point in the code, like we did in the previous

More information

CS 2316 Exam 2 Practice ANSWER KEY

CS 2316 Exam 2 Practice ANSWER KEY CS 2316 Exam 2 Practice ANSWER KEY Signing signifies you are aware of and in accordance with the Academic Honor Code of Georgia Tech. Calculators and cell phones are NOT allowed. This is a Python programming

More information

Fundamentals. Fundamentals. Fundamentals. We build up instructions from three types of materials

Fundamentals. Fundamentals. Fundamentals. We build up instructions from three types of materials Fundamentals We build up instructions from three types of materials Constants Expressions Fundamentals Constants are just that, they are values that don t change as our macros are executing Fundamentals

More information

CS201 - Introduction to Programming Glossary By

CS201 - Introduction to Programming Glossary By CS201 - Introduction to Programming Glossary By #include : The #include directive instructs the preprocessor to read and include a file into a source code file. The file name is typically enclosed with

More information

Fourth Shift Transactional Interface Fourth Shift Release 7.50

Fourth Shift Transactional Interface Fourth Shift Release 7.50 Fourth Shift Transactional Interface Fourth Shift Release 7.50 Fourth Shift Help 2008, Release 7.50 2008 SoftBrands, Inc. All rights reserved This documentation is copyrighted and all rights are reserved.

More information

CS433 Homework 6. Problem 1 [15 points] Assigned on 11/28/2017 Due in class on 12/12/2017

CS433 Homework 6. Problem 1 [15 points] Assigned on 11/28/2017 Due in class on 12/12/2017 CS433 Homework 6 Assigned on 11/28/2017 Due in class on 12/12/2017 Instructions: 1. Please write your name and NetID clearly on the first page. 2. Refer to the course fact sheet for policies on collaboration.

More information

Principles of Operating Systems

Principles of Operating Systems Principles of Operating Systems Lecture 24-26 - File-System Interface and Implementation Ardalan Amiri Sani (ardalan@uci.edu) [lecture slides contains some content adapted from previous slides by Prof.

More information

7. Inheritance & Polymorphism. Not reinventing the wheel

7. Inheritance & Polymorphism. Not reinventing the wheel 7. Inheritance & Polymorphism Not reinventing the wheel Overview Code Inheritance Encapsulation control Abstract Classes Shared Members Interface Inheritance Strongly Typed Data Structures Polymorphism

More information

Chapter 7 File Access. Chapter Table of Contents

Chapter 7 File Access. Chapter Table of Contents Chapter 7 File Access Chapter Table of Contents OVERVIEW...105 REFERRING TO AN EXTERNAL FILE...105 TypesofExternalFiles...106 READING FROM AN EXTERNAL FILE...107 UsingtheINFILEStatement...107 UsingtheINPUTStatement...108

More information

FILE SYSTEMS. CS124 Operating Systems Winter , Lecture 23

FILE SYSTEMS. CS124 Operating Systems Winter , Lecture 23 FILE SYSTEMS CS124 Operating Systems Winter 2015-2016, Lecture 23 2 Persistent Storage All programs require some form of persistent storage that lasts beyond the lifetime of an individual process Most

More information

CheckBook Pro 2 Help

CheckBook Pro 2 Help Get started with CheckBook Pro 9 Introduction 9 Create your Accounts document 10 Name your first Account 11 Your Starting Balance 12 Currency 13 We're not done yet! 14 AutoCompletion 15 Descriptions 16

More information

Java How to Program, 10/e. Copyright by Pearson Education, Inc. All Rights Reserved.

Java How to Program, 10/e. Copyright by Pearson Education, Inc. All Rights Reserved. Java How to Program, 10/e Education, Inc. All Rights Reserved. Each class you create becomes a new type that can be used to declare variables and create objects. You can declare new classes as needed;

More information

VARIABLES. Aim Understanding how computer programs store values, and how they are accessed and used in computer programs.

VARIABLES. Aim Understanding how computer programs store values, and how they are accessed and used in computer programs. Lesson 2 VARIABLES Aim Understanding how computer programs store values, and how they are accessed and used in computer programs. WHAT ARE VARIABLES? When you input data (i.e. information) into a computer

More information

Chapter. Web Applications

Chapter. Web Applications Chapter Web Applications 144 Essential Visual Basic.NET fast Introduction Earlier versions of Visual Basic were excellent for creating applications which ran on a Windows PC, but increasingly there is

More information

Oli Language Documentation

Oli Language Documentation Oli Language Documentation Release 0.0.1 Tomas Aparicio Sep 27, 2017 Contents 1 Project stage 3 2 Document stage 5 2.1 Table of Contents............................................. 5 2.1.1 Overview............................................

More information

XML for Java Developers G Session 2 - Sub-Topic 1 Beginning XML. Dr. Jean-Claude Franchitti

XML for Java Developers G Session 2 - Sub-Topic 1 Beginning XML. Dr. Jean-Claude Franchitti XML for Java Developers G22.3033-002 Session 2 - Sub-Topic 1 Beginning XML Dr. Jean-Claude Franchitti New York University Computer Science Department Courant Institute of Mathematical Sciences Objectives

More information

Design Of Human Computer Interfaces Assignment 1- Hello World. Compliance Report

Design Of Human Computer Interfaces Assignment 1- Hello World. Compliance Report Design Of Human Computer Interfaces Assignment 1- Hello World Compliance Report Prepared for: Skip Poehlman Prepared By: K C Course: SE 4D03 Date: September 30, 2008 Contents 1. Code Listing a. Module

More information

PDSA Property Builder

PDSA Property Builder PDSA Property Builder Creating properties for a class involves creating both a private variable and then the corresponding property get/set statements. This process can be made much easier by using the

More information

UC Export Folders Version 3.5 for Worksite 8.x, 9.x x86

UC Export Folders Version 3.5 for Worksite 8.x, 9.x x86 UC Export Folders Version 3.5 for Worksite 8.x, 9.x x86 Exports folders and subfolders directly from workspaces, tabs and folders Filter documents and email messages Integrated into Filesite and Desksite

More information

Fast, Flexible (and Inefficient?) Message Parsing

Fast, Flexible (and Inefficient?) Message Parsing Fast, Flexible (and Inefficient?) Message Parsing Randolph M. Jones Soar Technology, Inc. rjones@soartech.com Soar Workshop, June 2005 Challenges We see increasing demand for interactive intelligent agents

More information

COMP 110 Project 1 Programming Project Warm-Up Exercise

COMP 110 Project 1 Programming Project Warm-Up Exercise COMP 110 Project 1 Programming Project Warm-Up Exercise Creating Java Source Files Over the semester, several text editors will be suggested for students to try out. Initially, I suggest you use JGrasp,

More information

Learning VB.Net. Tutorial 10 Collections

Learning VB.Net. Tutorial 10 Collections Learning VB.Net Tutorial 10 Collections Hello everyone welcome to vb.net tutorials. These are going to be very basic tutorials about using the language to create simple applications, hope you enjoy it.

More information

B.H.GARDI COLLEGE OF MASTER OF COMPUTER APPLICATION. Ch. 1 :- Introduction Database Management System - 1

B.H.GARDI COLLEGE OF MASTER OF COMPUTER APPLICATION. Ch. 1 :- Introduction Database Management System - 1 Basic Concepts :- 1. What is Data? Data is a collection of facts from which conclusion may be drawn. In computer science, data is anything in a form suitable for use with a computer. Data is often distinguished

More information

Learning VB.Net. Tutorial 17 Classes

Learning VB.Net. Tutorial 17 Classes Learning VB.Net Tutorial 17 Classes Hello everyone welcome to vb.net tutorials. These are going to be very basic tutorials about using the language to create simple applications, hope you enjoy it. If

More information

IMS1906: Business Software Fundamentals Tutorial exercises Week 5: Variables and Constants

IMS1906: Business Software Fundamentals Tutorial exercises Week 5: Variables and Constants IMS1906: Business Software Fundamentals Tutorial exercises Week 5: Variables and Constants These notes are available on the IMS1906 Web site http://www.sims.monash.edu.au Tutorial Sheet 4/Week 5 Please

More information

UNIT 1: PROGRAMMING ENVIRONMENT

UNIT 1: PROGRAMMING ENVIRONMENT UNIT 1: PROGRAMMING ENVIRONMENT 1.1 Introduction This unit introduces the programming environment for the Basic Digital Signal Processing course. It gives a brief description of the Visual Basic classes

More information

Coding Standards for Java

Coding Standards for Java Why have coding standards? Coding Standards for Java Version 1.3 It is a known fact that 80% of the lifetime cost of a piece of software goes to maintenance; therefore, it makes sense for all programs

More information

File Systems: Fundamentals

File Systems: Fundamentals File Systems: Fundamentals 1 Files! What is a file? Ø A named collection of related information recorded on secondary storage (e.g., disks)! File attributes Ø Name, type, location, size, protection, creator,

More information

11. Arrays. For example, an array containing 5 integer values of type int called foo could be represented as:

11. Arrays. For example, an array containing 5 integer values of type int called foo could be represented as: 11. Arrays An array is a series of elements of the same type placed in contiguous memory locations that can be individually referenced by adding an index to a unique identifier. That means that, for example,

More information

DEVELOPING OBJECT ORIENTED APPLICATIONS

DEVELOPING OBJECT ORIENTED APPLICATIONS DEVELOPING OBJECT ORIENTED APPLICATIONS By now, everybody should be comfortable using form controls, their properties, along with methods and events of the form class. In this unit, we discuss creating

More information

Mr.Khaled Anwar ( )

Mr.Khaled Anwar ( ) The Rnd() function generates random numbers. Every time Rnd() is executed, it returns a different random fraction (greater than or equal to 0 and less than 1). If you end execution and run the program

More information

How to Validate DataGridView Input

How to Validate DataGridView Input How to Validate DataGridView Input This example explains how to use DR.net to set validation criteria for a DataGridView control on a Visual Studio.NET form. Why You Should Use This To add extensible and

More information

Teiid Designer User Guide 7.7.0

Teiid Designer User Guide 7.7.0 Teiid Designer User Guide 1 7.7.0 1. Introduction... 1 1.1. What is Teiid Designer?... 1 1.2. Why Use Teiid Designer?... 2 1.3. Metadata Overview... 2 1.3.1. What is Metadata... 2 1.3.2. Editing Metadata

More information

File Systems: Fundamentals

File Systems: Fundamentals 1 Files Fundamental Ontology of File Systems File Systems: Fundamentals What is a file? Ø A named collection of related information recorded on secondary storage (e.g., disks) File attributes Ø Name, type,

More information

FileSearchEX 1.1 Series

FileSearchEX 1.1 Series FileSearchEX 1.1 Series Instruction Manual document version: 1.1.0.5 Copyright 2010 2018 GOFF Concepts LLC. All rights reserved. GOFF Concepts assumes no responsibility for errors or omissions in this

More information

Objectives. In this chapter, you will:

Objectives. In this chapter, you will: Objectives In this chapter, you will: Become familiar with functions, special symbols, and identifiers in C++ Explore simple data types Discover how a program evaluates arithmetic expressions Learn about

More information

Revision for Final Examination (Second Semester) Grade 9

Revision for Final Examination (Second Semester) Grade 9 Revision for Final Examination (Second Semester) Grade 9 Name: Date: Part 1: Answer the questions given below based on your knowledge about Visual Basic 2008: Question 1 What is the benefit of using Visual

More information

PROGRAMMING ASSIGNMENT: MOVIE QUIZ

PROGRAMMING ASSIGNMENT: MOVIE QUIZ PROGRAMMING ASSIGNMENT: MOVIE QUIZ For this assignment you will be responsible for creating a Movie Quiz application that tests the user s of movies. Your program will require two arrays: one that stores

More information

File Management. COMP3231 Operating Systems. Kevin Elphinstone. Tanenbaum, Chapter 4

File Management. COMP3231 Operating Systems. Kevin Elphinstone. Tanenbaum, Chapter 4 File Management Tanenbaum, Chapter 4 COMP3231 Operating Systems Kevin Elphinstone 1 Outline Files and directories from the programmer (and user) perspective Files and directories internals the operating

More information

for (i=1; i<=100000; i++) { x = sqrt (y); // square root function cout << x+i << endl; }

for (i=1; i<=100000; i++) { x = sqrt (y); // square root function cout << x+i << endl; } Ex: The difference between Compiler and Interpreter The interpreter actually carries out the computations specified in the source program. In other words, the output of a compiler is a program, whereas

More information

Birkbeck (University of London)

Birkbeck (University of London) Birkbeck (University of London) MSc Examination Department of Computer Science and Information Systems Internet and Web Technologies (COIY063H7) 15 Credits Date of Examination: 3 June 2016 Duration of

More information

XDS An Extensible Structure for Trustworthy Document Content Verification Simon Wiseman CTO Deep- Secure 3 rd June 2013

XDS An Extensible Structure for Trustworthy Document Content Verification Simon Wiseman CTO Deep- Secure 3 rd June 2013 Assured and security Deep-Secure XDS An Extensible Structure for Trustworthy Document Content Verification Simon Wiseman CTO Deep- Secure 3 rd June 2013 This technical note describes the extensible Data

More information

BT OneBillPlus CD-ROM Technical Guide (Private Circuits) File 6

BT OneBillPlus CD-ROM Technical Guide (Private Circuits) File 6 BT OneBillPlus CD-ROM Technical Guide (Private Circuits) File 6 Issue 3.0 Page 1 of 19 Table of Contents 1. Welcome...3 2. Introduction...3 3. What is delivered?...3 4. How is it delivered?...3 5. Technical

More information

Advanced Programming Using Visual Basic 2008

Advanced Programming Using Visual Basic 2008 Building Multitier Programs with Classes Advanced Programming Using Visual Basic 2008 The OOP Development Approach OOP = Object Oriented Programming Large production projects are created by teams Each

More information

Instruction manual Scale Monitor

Instruction manual Scale Monitor Instruction manual Scale Monitor Table of contents 1. Requirements... 3 2. Communication settings... 4 3. Protocol... 4 3.1. Defining a new protocol... 4 3.1.1. Processing method - fixed length... 6 3.1.2.

More information

CMPS 12A Introduction to Programming Lab Assignment 7

CMPS 12A Introduction to Programming Lab Assignment 7 CMPS 12A Introduction to Programming Lab Assignment 7 In this assignment you will write a bash script that interacts with the user and does some simple calculations, emulating the functionality of programming

More information

Page. No. 1/15 CS201 Introduction to Programmming Solved Subjective Questions From spring 2010 Final Term Papers By vuzs Team

Page. No. 1/15 CS201 Introduction to Programmming Solved Subjective Questions From spring 2010 Final Term Papers By vuzs Team Page. No. 1/15 CS201 Introduction to Programmming Solved Subjective Questions From spring 2010 Final Term Papers By vuzs Team Question No: 1 ( Marks: 2 ) Write a declaration statement for an array of 10

More information

Version 1.0 March 15, 2017

Version 1.0 March 15, 2017 March 15, 2017 Carlson Field to Finish New Mexico Land Surveyors Contents Introduction... 3 Carlson Survey Field to Finish... 3 Data for input to Field to finish... 3 Formats... 3 Manufacturers... 3 The

More information