IST311 Chapter13.NET Files (Part2)

Size: px
Start display at page:

Download "IST311 Chapter13.NET Files (Part2)"

Transcription

1 IST311 Chapter13.NET Files (Part2) using System; using System.Collections.Generic; using System.ComponentModel; using System.IO; using System.Linq; using System.Net; using System.Net.Sockets; using System.Text; using System.Threading.Tasks; using System.Xml; using System.Xml.Serialization; namespace Draft13 class Program static void Main(string[] args) //Experiment01(); // reading & writing text files //Experiment02(); // reading & interpreting data //Experiment03(); // serializing XML data //Experiment04(); // serialize a list of person objects //Experiment05(); // de-serialize a list of Person objects //Experiment06(); // merge two files //Experiment07(); // Problem //Experiment08(); // the using(...) clasuse //Experiment10(); // convert byte[] <-> string //Experiment11(); // files - random access mode Console.ReadLine(); //Main ///////////////////////////////////////////////////////////////////// private static void Experiment10() // converting char[], byte[], string char[] chararray = new char[] 'H', 'E', 'L', 'L', 'O' ; string strvalue = new string(chararray); Console.WriteLine(strValue.Length + " " + strvalue); char[] chararray2 = "Hello world".tochararray(); string strvalue2 = new string(chararray2); Console.WriteLine( strvalue2.length + " " + strvalue2); string str = "123".PadRight(20); Console.WriteLine( str.length + "***" + str + "***"); byte[] bytearray = Encoding.ASCII.GetBytes("Hola mundo"); string strfrombytes = Encoding.ASCII.GetString(byteArray); Console.WriteLine( bytearray ); Console.WriteLine( strfrombytes);

2 // //////////////////////////////////////////////////////////////////////////////////////// private static void Experiment11() //PART1. Craete the random file. FileStream randomfile = null; randomfile = new FileStream(@"c:\temp\randomDatFile.dat", FileMode.Create); Console.WriteLine("Done with random file"); catch (IOException e) Console.WriteLine("error " + e.message); return; finally randomfile.close(); //PART2. reopen the file, add records randomfile = new FileStream(@"c:\temp\randomDatFile.dat", FileMode.Open); catch (Exception e) Console.WriteLine("ERROR " + e.message); // Write ten RECORDS. Each record consists of 40 chars, begins with a key (3digits) // then some data, last symbol is "0". for (int i = 0; i < 10; i++) String strrec = ((100 + i) + " rest of the data record goes here").padright(39) + "0"; randomfile.write(encoding.ascii.getbytes(strrec), 0, 40); catch (IOException exc) Console.WriteLine(exc.Message); return;

3 //RANDOMLY junk around the file Byte[] bytearray = new byte[40]; ; randomfile.seek(0, SeekOrigin.Begin); // seeking first record Console.WriteLine("First record is: \t" + Encoding.ASCII.GetString(byteArray) ); randomfile.seek(0, SeekOrigin.Begin); // seeking second record Console.WriteLine("Second record is: \t" + Encoding.ASCII.GetString(byteArray)); //traverse the random file int offset; for (int i = 0; i < 10; i++) //for(int i=9; i>= 0; i--) //for(int i=0; i< 10; i+=2) offset = 40 * i; randomfile.seek(offset, SeekOrigin.Begin); Console.WriteLine("Record at location 0 is \t 1", i, Encoding.ASCII.GetString(byteArray)); //apply a 'logical delete' to a record at given position int posrecordtodelete = 7; offset = 40 * posrecordtodelete; randomfile.seek(offset, SeekOrigin.Begin); // seeking record Console.WriteLine("Before deleting \t" + Encoding.ASCII.GetString(byteArray)); bytearray[39] = (byte)'1'; //change last byte Console.WriteLine("After marking \t" + Encoding.ASCII.GetString(byteArray)); randomfile.seek(offset, SeekOrigin.Begin); // seeking record randomfile.write(bytearray, 0, 40); //write changed record back to disk randomfile.seek(offset, SeekOrigin.Begin); // seeking record //read record Console.WriteLine( "After deleting \t" + Encoding.ASCII.GetString(byteArray) ); Console.WriteLine(); catch (IOException exc) Console.WriteLine(exc.Message); Console.WriteLine(); randomfile.close();

4 private static void Experiment07() //Exmaples: //DirectoryInfo info = new DirectoryInfo("."); //DirectoryInfo info = new DirectoryInfo(@"c:/temp"); DirectoryInfo info = new DirectoryInfo(@"c:/"); // // find all files in given directory string result = info.fullname + "\n\n" + "File Names".PadRight(40) + "Size".PadLeft(20) + "\n"; foreach (FileInfo myfile in info.getfiles("*.*")) result += myfile.name.padright(40) + myfile.length.tostring().padleft(20) + "\n"; Console.WriteLine(result); // list all sub-directories under given folder foreach (DirectoryInfo mydir in info.getdirectories()) result += "DIR... " + mydir.name + "\n"; Console.WriteLine(result); //look for a particular file, make a copy, finally delete the original if (File.Exists(@"c:/temp/mergedfile.txt")) File.Delete(@"c:/temp/mergedfile.txt"); Console.WriteLine(@"Done with copy-delete see mergedfile_copy.txt");

5 private static void Experiment06() //merge two files put results in a new file StreamReader infile1 = new StreamReader(@"c:/temp/mergingfile1.txt"); StreamReader infile2 = new StreamReader(@"c:/temp/mergingfile2.txt"); StreamWriter outfile = new StreamWriter(@"c:/temp/mergedfile.txt"); string line1 = infile1.readline(); string line2 = infile2.readline(); while (line1!= null && line2!= null) if (line1.compareto(line2) <= 0) outfile.writeline(line1); line1 = infile1.readline(); else outfile.writeline(line2); line2 = infile2.readline(); while (line1!= null) outfile.writeline(line1); line1 = infile1.readline(); while (line2!= null) outfile.writeline(line2); line2 = infile2.readline(); infile1.close(); infile2.close(); outfile.close(); Console.WriteLine("Merging done...");

6 private static void Experiment05() XmlDocument doc = new XmlDocument(); doc.load(@"c:/temp/mycsfile3.xml"); foreach (XmlNode node in doc.documentelement.childnodes) string text = node.innertext; //or loop through its children as wel Console.WriteLine(text); foreach (XmlNode node in doc.documentelement.selectnodes("lazyclsperson/firstname")) string text = node.innertext; //or loop through its children as wel Console.WriteLine(text); foreach (XmlNode node in doc.documentelement.selectnodes("lazyclsperson/phone")) string text = node.innertext; //or loop through its children as wel Console.WriteLine(text); Console.WriteLine("Done Experiment05");

7 private static void Experiment04() List<LazyClsPerson> people = new List<LazyClsPerson>(); LazyClsPerson person1 = new LazyClsPerson(); person1.firstname = "Sansa"; person1.lastname = "Stark"; person1.phone = " "; LazyClsPerson person2 = new LazyClsPerson(); person2.firstname = "Arya"; person2.lastname = "Stark"; person2.phone = " "; people.add(person1); people.add(person2); //XmlSerializer xmlserializer = // new XmlSerializer(people.GetType()); //xmlserializer.serialize(console.out, people); //Console.WriteLine(); //Console.ReadLine(); XmlSerializer xmlserializer = new XmlSerializer(people.GetType()); StreamWriter outputfile = new StreamWriter(@"c:/temp/mycsfile3.xml"); xmlserializer.serialize(outputfile, people); Console.WriteLine("Done Experiment04"); Console.ReadLine(); private static void Experiment03() LazyClsPerson person = new LazyClsPerson(); person.firstname = "Sansa"; person.lastname = "Stark"; person.phone = " "; XmlSerializer xmlserializer = new XmlSerializer(person.GetType()); xmlserializer.serialize(console.out, person); Console.WriteLine(); Console.ReadLine();

8 private static void Experiment02() StreamReader infile = new StreamReader(@"c:/temp/mycsfile2.txt"); String line; int row = 0; string[] tokens = new string[3]; //first, last, phone while ((line = infile.readline())!= null) string[] datachunk = line.split(); if (datachunk.length == 3) tokens = datachunk; if (datachunk.length == 2) tokens[0] = datachunk[0]; tokens[1] = ""; //no last name! tokens[2] = datachunk[1]; for (int i = 0; i < tokens.length; i++) Console.WriteLine(row + "\t" + i + "\t" + tokens[i]); Console.WriteLine(); row++; catch (Exception e) Console.WriteLine("PROBLEM: " + e.message); Environment.Exit(0);

9 private static void Experiment01() StreamWriter output = new StreamWriter(@"c:/temp/mycsfile.txt"); for (int i = 0; i < 5; i++) output.writeline("this is line-" + i); output.writeline(datetime.now); output.close(); catch (Exception e) Console.WriteLine("ERROR: " + e.message); // StreamReader input = new StreamReader(@"c:\temp\mycsfile.txt"); string line; while ((line = input.readline())!= null) Console.WriteLine("ECHO>>> " + line); catch (Exception e) //Program Console.WriteLine("ERROR READING: " + e.message);

Console.ReadLine(); }//Main

Console.ReadLine(); }//Main IST 311 Lecture Notes Chapter 13 IO System using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Net; using System.Net.Sockets; using System.Text; using System.Threading.Tasks;

More information

Cleveland State University. Lecture Notes Feb Iteration Arrays ArrayLists. V. Matos

Cleveland State University. Lecture Notes Feb Iteration Arrays ArrayLists. V. Matos Cleveland State University IST311 V. Matos Lecture Notes Feb 17-22-24 Iteration Arrays ArrayLists Observe that various ideas discussed in class are given as separate code fragments in one large file. You

More information

C# Data Manipulation

C# Data Manipulation C# Data Manipulation Hans-Wolfgang Loidl School of Mathematical and Computer Sciences, Heriot-Watt University, Edinburgh Semester 1 2018/19 H-W. Loidl (Heriot-Watt Univ) F20SC/F21SC

More information

C# Data Manipulation

C# Data Manipulation C# Data Manipulation Hans-Wolfgang Loidl School of Mathematical and Computer Sciences, Heriot-Watt University, Edinburgh Semester 1 2018/19 H-W. Loidl (Heriot-Watt Univ) F20SC/F21SC

More information

Recitation: Loop Jul 7, 2008

Recitation: Loop Jul 7, 2008 Nested Loop Recitation: Loop Jul 7, 2008 1. What is the output of the following program? Use pen and paper only. The output is: ****** ***** **** *** ** * 2. Test this program in your computer 3. Use "for

More information

Files. C# Programming: From Problem Analysis to Program Design 2nd Edition. David McDonald, Ph.D. Director of Emerging Technologies

Files. C# Programming: From Problem Analysis to Program Design 2nd Edition. David McDonald, Ph.D. Director of Emerging Technologies 12 Working with Files C# Programming: From Problem Analysis to Program Design 2nd Edition David McDonald, Ph.D. Director of Emerging Technologies Chapter Objectives Learn about the System.IO namespace

More information

CSIS 1624 CLASS TEST 6

CSIS 1624 CLASS TEST 6 CSIS 1624 CLASS TEST 6 Instructions: Use visual studio 2012/2013 Make sure your work is saved correctly Submit your work as instructed by the demmies. This is an open-book test. You may consult the printed

More information

Duhok Polytechnic University Amedi Technical Institute/ IT Dept. Halkawt Rajab Hussain

Duhok Polytechnic University Amedi Technical Institute/ IT Dept. Halkawt Rajab Hussain Duhok Polytechnic University Amedi Technical Institute/ IT Dept. By Halkawt Rajab Hussain 2016-04-02 String and files: String declaration and initialization. Strings and Char Arrays: Properties And Methods.

More information

Files and Streams. Today you will learn. Files and Web Applications File System Information Reading and Writing with Streams Allowing File Uploads

Files and Streams. Today you will learn. Files and Web Applications File System Information Reading and Writing with Streams Allowing File Uploads Files and Streams Today you will learn Files and Web Applications File System Information Reading and Writing with Streams Allowing File Uploads CSE 409 Advanced Internet Technology Files and Web Applications

More information

RegEx - Numbers matching. Below is a sample code to find the existence of integers within a string.

RegEx - Numbers matching. Below is a sample code to find the existence of integers within a string. RegEx - Numbers matching Below is a sample code to find the existence of integers within a string. Sample code pattern to check for number in a string: using System; using System.Collections.Generic; using

More information

To start we will be using visual studio Start a new C# windows form application project and name it motivational quotes viewer

To start we will be using visual studio Start a new C# windows form application project and name it motivational quotes viewer C# Tutorial Create a Motivational Quotes Viewer Application in Visual Studio In this tutorial we will create a fun little application for Microsoft Windows using Visual Studio. You can use any version

More information

RegEx-validate IP address. Defined below is the pattern for checking an IP address with value: String Pattern Explanation

RegEx-validate IP address. Defined below is the pattern for checking an IP address with value: String Pattern Explanation RegEx-validate IP address Defined below is the pattern for checking an IP address with value: 240.30.20.60 String Pattern Explanation 240 ^[0-9]1,3 To define the starting part as number ranging from 1

More information

1 EXTRACT TEXT FROM PDF USING THE PDF TOOLKIT WITH AQUAFOREST S OCR SDK SPLIT PDF MERGE PDF CREATE A PDF DOCUMENT...

1 EXTRACT TEXT FROM PDF USING THE PDF TOOLKIT WITH AQUAFOREST S OCR SDK SPLIT PDF MERGE PDF CREATE A PDF DOCUMENT... Contents 1 EXTRACT TEXT FROM PDF... 1 1.1 REQUIREMENT... 1 1.2 SOLUTION... 1 2 USING THE PDF TOOLKIT WITH AQUAFOREST S OCR SDK... 2 2.1 REQUIREMENT... 2 2.2 SOLUTION... 2 2.3 COMMENTS... 4 3 SPLIT PDF...

More information

Occupied versus Unoccupied

Occupied versus Unoccupied A1 Problem Statement Occupied versus Unoccupied Most houses have an electricity meter that records the amount of electricity that has been used since the meter was installed. This is typically recorded

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

IST311 Chapter 8: C# Collections - Index-Sequential Search List & Dictionary PROGRAM

IST311 Chapter 8: C# Collections - Index-Sequential Search List & Dictionary PROGRAM IST311 Chapter 8: C# Collections - Index-Sequential Search List & Dictionary PROGRAM class Program static void Main(string[] args) //create a few employees Employee e1 = new Employee(1111111, "Tiryon",

More information

Problem Statement. B1: average speed

Problem Statement. B1: average speed Problem Statement B1: average speed A woman runs on tracks of different lengths each day. She always times the last lap. Use the time for the last lap (in seconds) and the length of the track (in miles)

More information

The contents of this document are directly taken from the EPiServer SDK. Please see the SDK for further technical information about EPiServer.

The contents of this document are directly taken from the EPiServer SDK. Please see the SDK for further technical information about EPiServer. Web Services Product version: 4.50 Document version: 1.0 Document creation date: 04-05-2005 Purpose The contents of this document are directly taken from the EPiServer SDK. Please see the SDK for further

More information

Lesson07-Arrays-Part4. Program class. namespace Lesson07ArraysPart4Prep { class Program { static double METER_TO_INCHES = 100 / 2.

Lesson07-Arrays-Part4. Program class. namespace Lesson07ArraysPart4Prep { class Program { static double METER_TO_INCHES = 100 / 2. Lesson07-Arrays-Part4 Program class namespace Lesson07ArraysPart4Prep class Program static double METER_TO_INCHES = 100 / 2.54; static void Main(string[] args) Experiment01(); //Tuples Experiment02();

More information

Main Game Code. //ok honestly im not sure, if i guess its a class ment for this page called methodtimer that //either uses the timer or set to timer..

Main Game Code. //ok honestly im not sure, if i guess its a class ment for this page called methodtimer that //either uses the timer or set to timer.. using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms;

More information

Lab 11. A sample of the class is:

Lab 11. A sample of the class is: Lab 11 Lesson 11-2: Exercise 1 Exercise 2 A sample of the class is: public class List // Methods public void store(int item) values[length] = item; length++; public void printlist() // Post: If the list

More information

emkt Browserless Coding For C#.Net and Excel

emkt Browserless Coding For C#.Net and Excel emkt Browserless Coding For C#.Net and Excel Browserless Basic Instructions and Sample Code 7/23/2013 Table of Contents Using Excel... 3 Configuring Excel for sending XML to emkt... 3 Sandbox instructions

More information

UNIVERSITY OF THE FREE STATE MAIN & QWA-QWA CAMPUS RIS 124 DEPARTMENT: COMPUTER SCIENCE AND INFORMATICS CONTACT NUMBER:

UNIVERSITY OF THE FREE STATE MAIN & QWA-QWA CAMPUS RIS 124 DEPARTMENT: COMPUTER SCIENCE AND INFORMATICS CONTACT NUMBER: UNIVERSITY OF THE FREE STATE MAIN & QWA-QWA CAMPUS RIS 124 DEPARTMENT: COMPUTER SCIENCE AND INFORMATICS CONTACT NUMBER: 4012754 EXAMINATION: Main End-of-year Examination 2013 PAPER 1 ASSESSORS: Prof. P.J.

More information

The Open Core Interface SDK has to be installed on your development computer. The SDK can be downloaded at:

The Open Core Interface SDK has to be installed on your development computer. The SDK can be downloaded at: This document describes how to create a simple Windows Forms Application using some Open Core Interface functions in C# with Microsoft Visual Studio Express 2013. 1 Preconditions The Open Core Interface

More information

Object oriented lab /second year / review/lecturer: yasmin maki

Object oriented lab /second year / review/lecturer: yasmin maki 1) Examples of method (function): Note: the declaration of any method is : method name ( parameters list ).. Method body.. Access modifier : public,protected, private. Return

More information

CSE 1223: Introduction to Computer Programming in Java Chapter 7 File I/O

CSE 1223: Introduction to Computer Programming in Java Chapter 7 File I/O CSE 1223: Introduction to Computer Programming in Java Chapter 7 File I/O 1 Sending Output to a (Text) File import java.util.scanner; import java.io.*; public class TextFileOutputDemo1 public static void

More information

File Practice Problems

File Practice Problems 1) Write a method reads in from two files and writes them, alternating lines, to an output file. The three file names should be passed into the method as Strings, and then method should NOT thrown any

More information

Objectives. Introduce the core C# language features class Main types variables basic input and output operators arrays control constructs comments

Objectives. Introduce the core C# language features class Main types variables basic input and output operators arrays control constructs comments Basics Objectives Introduce the core C# language features class Main types variables basic input and output operators arrays control constructs comments 2 Class Keyword class used to define new type specify

More information

Problem Statement. A1: being lapped on the track

Problem Statement. A1: being lapped on the track Problem Statement A1: being lapped on the track You and your friend are running laps on the track at the rec complex. Your friend passes you exactly X times in one of your laps (that is, you start the

More information

// Program 2 - Extra Credit // CIS // Spring // Due: 3/11/2015. // By: Andrew L. Wright. //Edited by : Ben Spalding

// Program 2 - Extra Credit // CIS // Spring // Due: 3/11/2015. // By: Andrew L. Wright. //Edited by : Ben Spalding // Program 2 - Extra Credit // CIS 200-01 // Spring 2015 // Due: 3/11/2015 // By: Andrew L. Wright //Edited by : Ben Spalding // File: Prog2Form.cs // This class creates the main GUI for Program 2. It

More information

J2ME .NET Compact Framework

J2ME .NET Compact Framework .NET Compact Framework 1 .NET Framework History Microsoft entered market of mobile devices in 1996 with its first embedded operating system, Windows CE. In 2000, Microsoft announced its.net initiative,

More information

PESIT Bangalore South Campus Hosur road, 1km before Electronic City, Bengaluru -100 Department of Computer Science And Engineering

PESIT Bangalore South Campus Hosur road, 1km before Electronic City, Bengaluru -100 Department of Computer Science And Engineering INTERNAL ASSESSMENT TEST 1 Date : 19 08 2015 Max Marks : 50 Subject & Code : C# Programming and.net & 10CS761 Section : VII CSE A & C Name of faculty : Mrs. Shubha Raj K B Time : 11.30 to 1PM 1. a What

More information

Industrial Programming

Industrial Programming Industrial Programming Lecture 6: C# Data Manipulation Industrial Programming 1 The Stream Programming Model File streams can be used to access stored data. A stream is an object that represents a generic

More information

// Precondition: None // Postcondition: The address' name has been set to the // specified value set;

// Precondition: None // Postcondition: The address' name has been set to the // specified value set; // File: Address.cs // This classes stores a typical US address consisting of name, // two address lines, city, state, and 5 digit zip code. using System; using System.Collections.Generic; using System.Linq;

More information

Lecture Notes CPSC 224 (Spring 2012) Today... Java basics. S. Bowers 1 of 8

Lecture Notes CPSC 224 (Spring 2012) Today... Java basics. S. Bowers 1 of 8 Today... Java basics S. Bowers 1 of 8 Java main method (cont.) In Java, main looks like this: public class HelloWorld { public static void main(string[] args) { System.out.println("Hello World!"); Q: How

More information

Duhok Polytechnic University Amedi Technical Institute/ IT Dept. Halkawt Rajab Hussain

Duhok Polytechnic University Amedi Technical Institute/ IT Dept. Halkawt Rajab Hussain Duhok Polytechnic University Amedi Technical Institute/ IT Dept. By Halkawt Rajab Hussain 2016-04-02 Objects and classes: Basics of object and class in C#. Private and public members and protected. Static

More information

Threads & Networking

Threads & Networking Threads & Networking C# offers facilities for multi threading and network programming an application roughly corresponds to a process, handled by the OS time sharing simulates multi tasking inside an application

More information

Lab - 1. Solution : 1. // Building a Simple Console Application. class HelloCsharp. static void Main() System.Console.WriteLine ("Hello from C#.

Lab - 1. Solution : 1. // Building a Simple Console Application. class HelloCsharp. static void Main() System.Console.WriteLine (Hello from C#. Lab - 1 Solution : 1 // Building a Simple Console Application class HelloCsharp static void Main() System.Console.WriteLine ("Hello from C#."); Solution: 2 & 3 // Building a WPF Application // Verifying

More information

Here is a hierarchy of classes to deal with Input and Output streams.

Here is a hierarchy of classes to deal with Input and Output streams. PART 25 25. Files and I/O 25.1 Reading and Writing Files A stream can be defined as a sequence of data. The InputStream is used to read data from a source and the OutputStream is used for writing data

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

EEE-448 COMPUTER NETWORKS (Programming) Week -6 C# & IP Programming. The StringBuilder Class. StringBuilder Classes. StringBuilder with Append

EEE-448 COMPUTER NETWORKS (Programming) Week -6 C# & IP Programming. The StringBuilder Class. StringBuilder Classes. StringBuilder with Append EEE-448 COMPUTER NETWORKS (Programming) Week -6 C# & IP Programming Turgay IBRIKCI, PhD EEE448 Computer Networks Spring 2011 EEE448 Computer Networks Spring 2011 The StringBuilder Class The StringBuilder

More information

Introduction to Java

Introduction to Java Introduction to Java Module 1: Getting started, Java Basics 22/01/2010 Prepared by Chris Panayiotou for EPL 233 1 Lab Objectives o Objective: Learn how to write, compile and execute HelloWorld.java Learn

More information

How to read/write text file

How to read/write text file How to read/write text file Contents Use StreamWriter... 1 Create button click event handler... 2 Create StreamWriter... 3 Write to file... 5 Close file... 8 Test file writing... 9 Use StreamReader...

More information

A Summoner's Tale MonoGame Tutorial Series. Chapter 15. Saving Game State

A Summoner's Tale MonoGame Tutorial Series. Chapter 15. Saving Game State A Summoner's Tale MonoGame Tutorial Series Chapter 15 Saving Game State This tutorial series is about creating a Pokemon style game with the MonoGame Framework called A Summoner's Tale. The tutorials will

More information

Chapter 8 Files. File Streams

Chapter 8 Files. File Streams Chapter 8 Files Few programs are written that don t involve some type of file input/output. Way back in the days when the C language became popular a set of library functions were designed that have been

More information

A Summoner's Tale MonoGame Tutorial Series. Chapter 8. Conversations

A Summoner's Tale MonoGame Tutorial Series. Chapter 8. Conversations A Summoner's Tale MonoGame Tutorial Series Chapter 8 Conversations This tutorial series is about creating a Pokemon style game with the MonoGame Framework called A Summoner's Tale. The tutorials will make

More information

A sample print out is: is is -11 key entered was: w

A sample print out is: is is -11 key entered was: w Lab 9 Lesson 9-2: Exercise 1, 2 and 3: Note: when you run this you may need to maximize the window. The modified buttonhandler is: private static class ButtonListener implements ActionListener public void

More information

Text File I/O. #include <iostream> #include <fstream> using namespace std; int main() {

Text File I/O. #include <iostream> #include <fstream> using namespace std; int main() { Text File I/O We can use essentially the same techniques we ve been using to input from the keyboard and output to the screen and just apply them to files instead. If you want to prepare input data ahead,

More information

You can call the project anything you like I will be calling this one project slide show.

You can call the project anything you like I will be calling this one project slide show. C# Tutorial Load all images from a folder Slide Show In this tutorial we will see how to create a C# slide show where you load everything from a single folder and view them through a timer. This exercise

More information

Java file manipulations

Java file manipulations Java file manipulations 1 Categories of Java errors We learn that there are three categories of Java errors : Syntax error Runtime error Logic error. A Syntax error (compiler error) arises because a rule

More information

Getting started with Java

Getting started with Java Getting started with Java by Vlad Costel Ungureanu for Learn Stuff Programming Languages A programming language is a formal constructed language designed to communicate instructions to a machine, particularly

More information

Configuration Web Services for.net Framework

Configuration Web Services for.net Framework Cloud Contact Center Software Configuration Web Services for.net Framework Programmer s Guide October 2014 This guide describes how to create a client for the Configuration Web Services with the.net framework

More information

Principles, Models, and Applications for Distributed Systems M

Principles, Models, and Applications for Distributed Systems M Università degli Studi di Bologna Facoltà di Ingegneria Principles, Models, and Applications for Distributed Systems M Exercitation 3 Connected Java Sockets Jacopo De Benedetto Distributed architecture

More information

Duhok Polytechnic University Amedi Technical Institute/ IT Dept. Halkawt Rajab Hussain

Duhok Polytechnic University Amedi Technical Institute/ IT Dept. Halkawt Rajab Hussain Duhok Polytechnic University Amedi Technical Institute/ IT Dept. By Halkawt Rajab Hussain 2016-04-02 Pointers: Pointer declaration and initialization. Pointer To Pointer. Arithmetic operation on pointer

More information

BITG 1113: Files and Stream LECTURE 10

BITG 1113: Files and Stream LECTURE 10 BITG 1113: Files and Stream LECTURE 10 1 LEARNING OUTCOMES At the end of this lecture, you should be able to: 1. Describe the fundamentals of input & output files. 2. Use data files for input & output

More information

General Certificate of Education Advanced Subsidiary Examination June 2010

General Certificate of Education Advanced Subsidiary Examination June 2010 General Certificate of Education Advanced Subsidiary Examination June 2010 Computing COMP1/PM/C# Unit 1 Problem Solving, Programming, Data Representation and Practical Exercise Preliminary Material A copy

More information

Principles, Models, and Applications for Distributed Systems M

Principles, Models, and Applications for Distributed Systems M Università degli Studi di Bologna Facoltà di Ingegneria Principles, Models, and Applications for Distributed Systems M Lab assignment 4 (worked-out) Connection-oriented Java Sockets Luca Foschini Winter

More information

Advanced Programming C# Lecture 2. dr inż. Małgorzata Janik

Advanced Programming C# Lecture 2. dr inż. Małgorzata Janik Advanced Programming C# Lecture 2 dr inż. Małgorzata Janik majanik@if.pw.edu.pl Winter Semester 2017/2018 C# Classes, Properties, Controls Constructions of Note using namespace like import in Java: bring

More information

Learn C# Errata. 3-9 The Nullable Types The Assignment Operators

Learn C# Errata. 3-9 The Nullable Types The Assignment Operators 1 The following pages show errors from the original edition, published in July 2008, corrected in red. Future editions of this book will be printed with these corrections. We apologize for any inconvenience

More information

Introduction to C# Applications

Introduction to C# Applications 1 2 3 Introduction to C# Applications OBJECTIVES To write simple C# applications To write statements that input and output data to the screen. To declare and use data of various types. To write decision-making

More information

Symphony G2 FDK API Manual for C# FDK API Manual for C# June ITS Company

Symphony G2 FDK API Manual for C# FDK API Manual for C# June ITS Company FDK API Manual for C# June 2015 ITS Company Contents Overview... 1 System Environments... 1 Installation files... 1 Sample codes... 1 CCallFdk... 7 static void Initialize(string p_scfgfile)... 7 static

More information

class Class1 { /// <summary> /// The main entry point for the application. /// </summary>

class Class1 { /// <summary> /// The main entry point for the application. /// </summary> Project 06 - UDP Client/Server Applications In this laboratory project you will build a number of Client/Server applications using C# and the.net framework. The first will be a simple console application

More information

Chapter 6: Files and Exceptions. COSC 1436, Summer 2016 Dr. Ling Zhang 06/23/2016

Chapter 6: Files and Exceptions. COSC 1436, Summer 2016 Dr. Ling Zhang 06/23/2016 Chapter 6: Files and Exceptions COSC 1436, Summer 2016 Dr. Ling Zhang 06/23/2016 Introduction to File Input and Output Concept: When a program needs to save data for later use, it writes the data in a

More information

Engr 123 Spring 2018 Notes on Visual Studio

Engr 123 Spring 2018 Notes on Visual Studio Engr 123 Spring 2018 Notes on Visual Studio We will be using Microsoft Visual Studio 2017 for all of the programming assignments in this class. Visual Studio is available on the campus network. For your

More information

CS 200 File Input and Output Jim Williams, PhD

CS 200 File Input and Output Jim Williams, PhD CS 200 File Input and Output Jim Williams, PhD This Week 1. WaTor Change Log 2. Monday Appts - may be interrupted. 3. Optional Lab: Create a Personal Webpage a. demonstrate to TA for same credit as other

More information

create database ABCD use ABCD create table bolumler ( bolumkodu int primary key, bolumadi varchar(20) )

create database ABCD use ABCD create table bolumler ( bolumkodu int primary key, bolumadi varchar(20) ) create database ABCD use ABCD create table bolumler ( bolumkodu int primary key, bolumadi varchar(20) ) insert into bolumler values(1,'elektrik') insert into bolumler values(2,'makina') insert into bolumler

More information

A1 Problem Statement Willie s Push-ups

A1 Problem Statement Willie s Push-ups A1 Problem Statement Willie s Push-ups After every football score, Willie the Wildcat does one push-up for every point scored so far in the current game. On the scoreboard at the stadium, there is displayed

More information

API Guide MSS-8 and MVS-16

API Guide MSS-8 and MVS-16 API Guide and MVS-16 Page 1-8 Channel Matrix Switcher Page 10-16 Channel Matrix Switcher and Multi Viewer MVS-16 API Guide for RS232 RS232 Connection: Port Settings: Bps 9600, Data bits 8, Parity None,

More information

Using Template Bookmarks for Automating Microsoft Word Reports

Using Template Bookmarks for Automating Microsoft Word Reports Using Template Bookmarks for Automating Microsoft Word Reports Darryl Bryk U.S. Army RDECOM-TARDEC Warren, MI 48397 Disclaimer: Reference herein to any specific commercial company, product, process, or

More information

2018/2/5 话费券企业客户接入文档 语雀

2018/2/5 话费券企业客户接入文档 语雀 1 2 2 1 2 1 1 138999999999 2 1 2 https:lark.alipay.com/kaidi.hwf/hsz6gg/ppesyh#2.4-%e4%bc%81%e4%b8%9a%e5%ae%a2%e6%88%b7%e6%8e%a5%e6%94%b6%e5%85%85%e5 1/8 2 1 3 static IAcsClient client = null; public static

More information

CALCULATOR APPLICATION

CALCULATOR APPLICATION CALCULATOR APPLICATION Form1.cs using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms;

More information

CHAPTER 1: INTRODUCING C# 3

CHAPTER 1: INTRODUCING C# 3 INTRODUCTION xix PART I: THE OOP LANGUAGE CHAPTER 1: INTRODUCING C# 3 What Is the.net Framework? 4 What s in the.net Framework? 4 Writing Applications Using the.net Framework 5 What Is C#? 8 Applications

More information

Pace University. Fundamental Concepts of CS121 1

Pace University. Fundamental Concepts of CS121 1 Pace University Fundamental Concepts of CS121 1 Dr. Lixin Tao http://csis.pace.edu/~lixin Computer Science Department Pace University October 12, 2005 This document complements my tutorial Introduction

More information

Input and Output File (Files and Stream )

Input and Output File (Files and Stream ) Input and Output File (Files and Stream ) BITE 1513 Computer Game Programming Week 14 Scope Describe the fundamentals of input & output files. Use data files for input & output purposes. Files Normally,

More information

Duhok Polytechnic University Amedi Technical Institute/ IT Dept. Halkawt Rajab Hussain

Duhok Polytechnic University Amedi Technical Institute/ IT Dept. Halkawt Rajab Hussain Duhok Polytechnic University Amedi Technical Institute/ IT Dept. By Halkawt Rajab Hussain 2016-04-02 Overview. C# program structure. Variables and Constant. Conditional statement (if, if/else, nested if

More information

University of Texas at Arlington, TX, USA

University of Texas at Arlington, TX, USA Dept. of Computer Science and Engineering University of Texas at Arlington, TX, USA A file is a collec%on of data that is stored on secondary storage like a disk or a thumb drive. Accessing a file means

More information

Chapter 6: Files and Exceptions. COSC 1436, Spring 2017 Hong Sun 3/6/2017

Chapter 6: Files and Exceptions. COSC 1436, Spring 2017 Hong Sun 3/6/2017 Chapter 6: Files and Exceptions COSC 1436, Spring 2017 Hong Sun 3/6/2017 Function Review: A major purpose of functions is to group code that gets executed multiple times. Without a function defined, you

More information

CS Week 11. Jim Williams, PhD

CS Week 11. Jim Williams, PhD CS 200 - Week 11 Jim Williams, PhD This Week 1. Exam 2 - Thursday 2. Team Lab: Exceptions, Paths, Command Line 3. Review: Muddiest Point 4. Lecture: File Input and Output Objectives 1. Describe a text

More information

Windows File I/O. Files. Collections of related data stored on external storage media and assigned names so that they can be accessed later

Windows File I/O. Files. Collections of related data stored on external storage media and assigned names so that they can be accessed later Windows File I/O Files Collections of related data stored on external storage media and assigned names so that they can be accessed later Entire collection is a file A file is made up of records One record

More information

This tutorial has been prepared for the beginners to help them understand basics of c# Programming.

This tutorial has been prepared for the beginners to help them understand basics of c# Programming. About thetutorial C# is a simple, modern, general-purpose, object-oriented programming language developed by Microsoft within its.net initiative led by Anders Hejlsberg. This tutorial covers basic C# programming

More information

*** TROUBLESHOOTING TIP ***

*** TROUBLESHOOTING TIP *** *** TROUBLESHOOTING TIP *** If you are experiencing errors with your deliverable 2 setup which deliverable 3 is built upon, delete the deliverable 2 project within Eclipse, and delete the non working newbas

More information

XNA 4.0 RPG Tutorials. Part 24. Level Editor Continued

XNA 4.0 RPG Tutorials. Part 24. Level Editor Continued XNA 4.0 RPG Tutorials Part 24 Level Editor Continued I'm writing these tutorials for the new XNA 4.0 framework. The tutorials will make more sense if they are read in order. You can find the list of tutorials

More information

Advanced Programming Methods. Lecture 9 - Generics, Collections and IO operations in C#

Advanced Programming Methods. Lecture 9 - Generics, Collections and IO operations in C# Advanced Programming Methods Lecture 9 - Generics, Collections and IO operations in C# Content Language C#: 1. Generics 2. Collections 3. IO operations C# GENERICS C# s genericity mechanism, available

More information

Brian Kiser November Vigilant C# 2.5. Commonwealth of Kentucky Frankfort, Kentucky

Brian Kiser November Vigilant C# 2.5. Commonwealth of Kentucky Frankfort, Kentucky Brian Kiser November 2010 Vigilant C# 2.5 Commonwealth of Kentucky Frankfort, Kentucky Table of Contents 1.0 Work Sample Description Page 3 2.0 Skills Demonstrated 2.1 Software development competency using

More information

IT101. File Input and Output

IT101. File Input and Output IT101 File Input and Output IO Streams A stream is a communication channel that a program has with the outside world. It is used to transfer data items in succession. An Input/Output (I/O) Stream represents

More information

Compile error. 2. A run time error occurs when the program runs and is caused by a number of reasons, such as dividing by zero.

Compile error. 2. A run time error occurs when the program runs and is caused by a number of reasons, such as dividing by zero. (טיפול בשגיאות) Exception handling We learn that there are three categories of errors : Syntax error, Runtime error and Logic error. A Syntax error (compiler error) arises because a rule of the language

More information

UNIVERSITY OF THE FREE STATE DEPARTMENT OF COMPUTER SCIENCE AND INFORMATICS CSIS 2614 MODULE TEST 2

UNIVERSITY OF THE FREE STATE DEPARTMENT OF COMPUTER SCIENCE AND INFORMATICS CSIS 2614 MODULE TEST 2 UNIVERSITY OF THE FREE STATE DEPARTMENT OF COMPUTER SCIENCE AND INFORMATICS CSIS 2614 MODULE TEST 2 DATE: 13 May 2016 TIME: 3.5 hours MARKS: 112 ASSESSOR: Prof. P.J. Blignaut BONUS MARKS: 5 MODERATOR:

More information

PES INSTITUTE OF TECHNOLOGY (BSC) V MCA, Second IA Test, September 2014

PES INSTITUTE OF TECHNOLOGY (BSC) V MCA, Second IA Test, September 2014 PES INSTITUTE OF TECHNOLOGY (BSC) V MCA, Second IA Test, September 2014 Topics in Enterprise Architectures-II Solution Set Faculty: Jeny Jijo 1) What is Encapsulation? Explain the two ways of enforcing

More information

File I/O Array Basics For-each loop

File I/O Array Basics For-each loop File I/O Array Basics For-each loop 178 Recap Use the Java API to look-up classes/method details: Math, Character, String, StringBuffer, Random, etc. The Random class gives us several ways to generate

More information

CSC 1051 Algorithms and Data Structures I. Final Examination May 2, Name:

CSC 1051 Algorithms and Data Structures I. Final Examination May 2, Name: CSC 1051 Algorithms and Data Structures I Final Examination May 2, 2015 Name: Question Value 1 10 Score 2 10 3 10 4 10 5 10 6 10 7 10 8 10 9 20 TOTAL 100 Please answer questions in the spaces provided.

More information

Annex B: Prototype Draft Model Code. April 30 th, 2015 Siamak Khaledi, Ankit Shah, Matthew Shoaf

Annex B: Prototype Draft Model Code. April 30 th, 2015 Siamak Khaledi, Ankit Shah, Matthew Shoaf Annex B: Prototype Draft Model Code April 30 th, 2015 Siamak Khaledi, Ankit Shah, Matthew Shoaf 1. Code Set: Prototype FTLADS Draft Model 1.1. Notes on Building the Wheel Draft Algorithm Based on the data

More information

OGSI.NET UVa Grid Computing Group. OGSI.NET Developer Tutorial

OGSI.NET UVa Grid Computing Group. OGSI.NET Developer Tutorial OGSI.NET UVa Grid Computing Group OGSI.NET Developer Tutorial Table of Contents Table of Contents...2 Introduction...3 Writing a Simple Service...4 Simple Math Port Type...4 Simple Math Service and Bindings...7

More information

204111: Computer and Programming

204111: Computer and Programming 204111: Computer and Programming Week 4: Control Structures t Monchai Sopitkamon, Ph.D. Overview Types of control structures Using selection structure Using repetition structure Types of control ol structures

More information

PULSE - API. The purpose of this document is to provide example requests and responses for all relevant Pulse services requests

PULSE - API. The purpose of this document is to provide example requests and responses for all relevant Pulse services requests PULSE - API The purpose of this document is to provide example requests and responses for all relevant Pulse services requests Contents Introduction... 4 Getting Started... 4 Anatomy of a ...6

More information

HTTPCOLONSLASHSLASHRJBDOTSOCDOTPORTDOTACDOTUKSLASHPUNKSLASH RIGHTRIGHTRIGHTRIGHTDOTZIP

HTTPCOLONSLASHSLASHRJBDOTSOCDOTPORTDOTACDOTUKSLASHPUNKSLASH RIGHTRIGHTRIGHTRIGHTDOTZIP Portsmouth Cipher Step 1... - -.--. -.-. ---.-.. --- -.....-...-..........-...-.......-..--- -... -.. --- -... --- -.-. -.. --- -.--. ---.-. - -.. --- -.- -.-. -.. --- -..- -.-....-...-.......--...- -.

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

... 1... 2... 2... 3... 3... 4... 4... 5... 5... 6... 6... 7... 8... 9... 10... 13... 14... 17 1 2 3 4 file.txt.exe file.txt file.jpg.exe file.mp3.exe 5 6 0x00 0xFF try { in.skip(9058); catch (IOException

More information

Chapter 8 Advanced GUI Features

Chapter 8 Advanced GUI Features 159 Chapter 8 Advanced GUI Features There are many other features we can easily add to a Windows C# application. We must be able to have menus and dialogs along with many other controls. One workhorse

More information

About this exam review

About this exam review Final Exam Review About this exam review I ve prepared an outline of the material covered in class May not be totally complete! Exam may ask about things that were covered in class but not in this review

More information

COSC 6397 Big Data Analytics. Distributed File Systems (II) Edgar Gabriel Fall HDFS Basics

COSC 6397 Big Data Analytics. Distributed File Systems (II) Edgar Gabriel Fall HDFS Basics COSC 6397 Big Data Analytics Distributed File Systems (II) Edgar Gabriel Fall 2018 HDFS Basics An open-source implementation of Google File System Assume that node failure rate is high Assumes a small

More information