Objective-C - Under the hood. Michael Pan

Size: px
Start display at page:

Download "Objective-C - Under the hood. Michael Pan"

Transcription

1 Objective-C - Under the hood Michael Pan

2 Outline Pointer & Object C Struct for class Dynamic feature

3 Contacts scentsome@gmail.com Facebook Group : Developer s Lesson Facebook Page : Developer s Note Blogger : Developer s Note

4 Book Objective-C ios booksfile.php?item=

5 Pointer & Object

6 Lets go from C 0x01 0x05 0x09

7 Lets go from C 0x01 int a; 0x05 0x09

8 Lets go from C a 0x01 int a; 0x05 0x09

9 Lets go from C a 0x01 0x05 int a; a=5; 0x09

10 Lets go from C a 0x01 5 int a; a=5; 0x05 0x09

11 Pointer a 0x01 5 int a; a=5; 0x05 0x09 & => address of

12 Pointer a 0x01 5 int a; a=5; 0x05 int * pa; 0x09 & => address of

13 Pointer a 0x01 5 int a; a=5; 0x05 int * pa; pa 0x09 & => address of

14 Pointer a 0x01 5 int a; a=5; 0x05 int * pa; pa 0x09 pa = &a; & => address of

15 Pointer a 0x01 5 int a; a=5; 0x05 int * pa; pa 0x09 0x01 pa = &a; & => address of

16 Pointer - More a 0x01 5 int a; a=5; 0x05 int * pa; pa 0x09 0x01 pa = &a; printf( %d,*pa);

17 Recap - pointer Write some thing

18 Pointer - More a 0x01 5 int a; a=5; 0x05 int * pa; pa 0x09 0x01 pa = &a;

19 Pointer - More a 0x01 5 int a; a=5; 0x05 int * pa; pa 0x09 0x01 pa = &a; *pa = 10

20 Pointer - More a 0x01 5 int a; a=5; 0x05 int * pa; pa 0x09 0x01 pa = &a; *pa = 10 printf( %d,a);

21 Pointer - More a 0x01 0x05 10 int a; a=5; int * pa; pa 0x09 0x01 pa = &a; *pa = 10 printf( %d,a);

22 Struct More complicated type struct Date { int day; int month; int year; }; struct Date date = {3,10,1970}; printf("the day is %d, %d/%d", date.year, date.day, date.month);

23 Struct - Memory date 0x10 struct Date { int day; int month; int year; };

24 Struct - Memory struct Date date ; date 0x10 struct Date { int day; int month; int year; };

25 Struct - Memory struct Date date ; date 0x10 struct Date { int day; int month; int year; };

26 Struct - Memory struct Date date ; date 0x10 date = {3,10,1970}; struct Date { int day; int month; int year; };

27 Struct - Memory struct Date date ; date 0x10 3 date = {3,10,1970}; struct Date { int day; int month; int year; };

28 Function we know main function make another function

29 Function - Memory add int add(int a, int b){ int result = a+b; return result; } result in Stack

30 Objective-C Text Segment - Data Segment - global Heap - ( - malloc) Stack - function Stack Stack Pointer Heap Data Segment Text Segment

31 Stack Function Stack Stack Pointer Heap Data Segment Text Segment int main (int argc, const char * argv[]) { //...! }

32 Stack Function Stack Stack Pointer Heap Data Segment Text Segment int main (int argc, const char * argv[]) { //...! } int sum = add(5, 6);

33 Stack Function Stack Stack Pointer Heap Data Segment Text Segment int main (int argc, const char * argv[]) { //...! } int sum = add(5, 6);

34 Stack Function Stack Heap Data Segment Text Segment Stack Pointer int main (int argc, const char * argv[]) { //...! } int sum = add(5, 6);

35 Stack Function Stack Heap Data Segment Text Segment Stack Pointer int main (int argc, const char * argv[]) { //...! } int sum = add(5, 6); //

36 Stack Function Stack Heap Data Segment Text Segment Stack Pointer int main (int argc, const char * argv[]) { //...! } int sum = add(5, 6); //

37 Stack Function Stack Stack Pointer Heap Data Segment Text Segment int main (int argc, const char * argv[]) { //...! } int sum = add(5, 6); //

38 Stack Heap Stack local variable Heap malloc Data Segment Text Segment

39 Pointer - #include <stdlib.h> int * p_a; p_a = malloc(sizeof(int)); *p_a = 8; printf("value in pointer a is %d\n", *p_a); Stack Heap 0xA0 8 p_a 0xA0

40 Static variable in Data Segment int callstaticvalue(); int main (int argc, const char * argv[]) { callstaticvalue(); callstaticvalue(); printf("static variable is %d", callstaticvalue()); return 0; } Stack Heap Data Segment Text Segment int callstaticvalue(){! static int svar=0; // static! return svar++; // 1 }

41 Struct + function it is what we call Object struct Date { int day; int month; int year; void (*formateddate)( struct Date date); }; void formatedfunction(struct Date date){ printf("the day is %d, %d/%d",date.year, date.month, date.day ); } // in main() struct Date today = {29, 4, 2013}; today.formateddate = formatedfunction; today.formateddate(today);

42 Objective-C class - C struct /usr/include/objc/objc.h typedef struct objc_class *Class; typedef struct objc_object { } *id; Class isa; typedef struct objc_selector!*sel; typedef id (*IMP)(id, SEL,...);

43 SEL struct objc_selector { void *sel_id; const char *sel_types; };

44 Objective-C class - C struct /usr/include/objc/runtime.h struct objc_class { Class isa; #if! OBJC2 Class super_class const char *name long version long info long instance_size struct objc_ivar_list *ivars struct objc_method_list **methodlists /* ignore */ #endif OBJC2_UNAVAILABLE; OBJC2_UNAVAILABLE; OBJC2_UNAVAILABLE; OBJC2_UNAVAILABLE; OBJC2_UNAVAILABLE; OBJC2_UNAVAILABLE; OBJC2_UNAVAILABLE; } OBJC2_UNAVAILABLE; /* Use `Class` instead of `struct objc_class *` */ /* ignore */ typedef struct { const char *name; const char *value; } objc_property_attribute_t;

45 Method struct objc_method { SEL method_name OBJC2_UNAVAILABLE; char *method_types OBJC2_UNAVAILABLE; IMP method_imp OBJC2_UNAVAILABLE; } OBJC2_UNAVAILABLE; struct objc_method_list { struct objc_method_list *obsolete OBJC2_UNAVAILABLE; int method_count OBJC2_UNAVAILABLE; #ifdef LP64 int space OBJC2_UNAVAILABLE; #endif /* variable length structure */ struct objc_method method_list[1] OBJC2_UNAVAILABLE; } OBJC2_UNAVAILABLE;

46 About Message Add method runtime

47 Add method runtime struct objc_method { SEL method_name; char *method_types; IMP method_imp; }; struct objc_method_list { struct objc_method_list *obsolete; int method_count; struct objc_method method_list[1]; };

48 Add method #import <objc/objc-class.h> // create a class with no EmptyClass : NSObject // define the function to add as a method id sayhello ( id self, SEL _cmd,... ) { NSLog (@"Hello"); } void addmethod () { // create the method struct objc_method mymethod; mymethod.method_name = sel_registername("sayhello"); mymethod.method_imp = sayhello; // build the method list. // this memory needs to stick around as long as the // methods belong to the class. struct objc_method_list * mymethodlist; mymethodlist = malloc (sizeof(struct objc_method_list)); mymethodlist->method_count = 1; mymethodlist->method_list[0] = mymethod; // add method to the class class_addmethods ( [EmptyClass class], mymethodlist ); } // try it out EmptyClass * instance = [[EmptyClass alloc] init]; [instance sayhello]; [instance release];

49 Method under the hood MyClass * aobj; int para = 5; [aobj setcount:para]; objc_msgsend( setcount: ), para ); isa Class structure selector function setcount:... table function count...

50 Demo DemoNCCU13 - MyCObject

51 Dynamic feature Dot operation KVC

52 Convenient Way - Since Objective-C Dot Syntax NSString *name = person.name; // name = [person name] person.name Michael ; // [person setname:@ Michael ] - Cascade person.bill.name Andy ; // [[person bill] setname:@ Andy ] person.bill.name ; // [[person bill] name]

53 Property means Person : int (strong) NSString Person * person = [[Person alloc] init]; person.name Michael ; person.age = 35;

54 Key-Value Coding

55 Another access method Read person.name; [person name]; [person name ]; Write person.name michael ; [person setname:@ michael ]; [person setvalue:@ michael forkey:@ name ];

56 Finding rule Find the action -name or -setname Find real variable _name and then name name

57 Accessible Types attribute scalar // auto-boxing for KVC NSString Boolean Immutable object : NSColor, NSNumber to-many relationship - objects in NSArray, NSSet

58 MyObject : NSObject {! NSString * name;! NSString * _name; (retain, readonly) NSString * (retain, readonly) NSString * MyObject * myo = [MyObject new]; [myo setvalue:@"michael" forkey:@"name"]; NSLog(@" kvc %@",[myo valueforkey:@"name"]); Result : kvc (null)? 0. no setter 1. find out _name michael 2. find out name s getter, return name

59 KeyPath MyCar : NSObject {! Engine * Engine : NSObject {! NSString * vendor;

60 Array Operation NSNumber * count; count = MyCar : NSObject {! int mycars = mycar1 mycar2 mycar3

61 Engine : NSObject {! int price; // engines array price NSArray * engines = [???:myengine1, myengine2, myengine3, nil]; NSLog(@" average price is %@",[engines valueforkeypath:@"???"]);

62 nil for scalar value? [engine setvalue: nil price ] error!! overwrite -setnilvalueforkey: - (void) setnilvalueforkey: (NSString *) key { if ([key { price = 0; } else { [super setnilvalueforkey: key]; } }

63 Handle UndefinedKey - (void) setvalue: (id) value forundefinedkey: (NSString *) key { // do something } - (id) valueforundefinedkey:(nsstring *)key { // do something }

64 Recap - (void) setvalue: (id) value forundefinedkey: (NSString *) key; - (id) valueforundefinedkey:(nsstring *)key;

65 Reference Introduction to Key-Value Coding Programming Guide

66 - RSS -

67 With XML - RSS-like <car> <item> <price> 99 </price> <year> 1922 </year> </item> <item> <price> 30 </price> <year> 1990 </year> </item> <item> <price> 82 </price> <year> 1980 </year> </item> <item> <price> 75 </price> <year> 1920 </year> </item> <item> <price> 60 </price> <year> 1910 </year> </item> </car> key value price 99 year 1922 Array Dictionary

68 Array and KVC <car> <item> <price> 99 </price> <year> 1922 </year> </item> <item> <price> 30 </price> <year> 1990 </year> </item> <item> <price> 82 </price> <year> 1980 </year> </item> <item> <price> 75 </price> <year> 1920 </year> </item> <item> <price> 60 </price> <year> 1910 </year> </item> </car> Array Dictionary [array price ] ( ) 99, 30, 82, 75, 60,

69 Demo ValueAndPredicate

70 Question

Introduction to Objective-C. Kevin Cathey

Introduction to Objective-C. Kevin Cathey Introduction to Objective-C Kevin Cathey Introduction to Objective-C What are object-oriented systems? What is the Objective-C language? What are objects? How do you create classes in Objective-C? acm.uiuc.edu/macwarriors/devphone

More information

iphone SDK Enrolled students will be invited to developer program Login to Program Portal Request a Certificate Download and install the SDK

iphone SDK Enrolled students will be invited to developer program Login to Program Portal Request a Certificate Download and install the SDK Objective-C Basics iphone SDK Enrolled students will be invited to developer program Login to Program Portal Request a Certificate Download and install the SDK The First Program in Objective-C #import

More information

iphone Objective-C Exercises

iphone Objective-C Exercises iphone Objective-C Exercises About These Exercises The only prerequisite for these exercises is an eagerness to learn. While it helps to have a background in object-oriented programming, that is not a

More information

INTRODUCTION TO OBJECTIVE-C CSCI 4448/5448: OBJECT-ORIENTED ANALYSIS & DESIGN LECTURE 12 09/29/2011

INTRODUCTION TO OBJECTIVE-C CSCI 4448/5448: OBJECT-ORIENTED ANALYSIS & DESIGN LECTURE 12 09/29/2011 INTRODUCTION TO OBJECTIVE-C CSCI 4448/5448: OBJECT-ORIENTED ANALYSIS & DESIGN LECTURE 12 09/29/2011 1 Goals of the Lecture Present an introduction to Objective-C 2.0 Coverage of the language will be INCOMPLETE

More information

Key-Value Coding Programming Guide

Key-Value Coding Programming Guide Key-Value Coding Programming Guide Contents Introduction 6 Organization of This Document 6 See Also 7 What Is Key-Value Coding? 8 Key-Value Coding and Scripting 8 Using Key-Value Coding to Simplify Your

More information

Objective-C for Experienced Programmers

Objective-C for Experienced Programmers Objective-C for Experienced Programmers Venkat Subramaniam venkats@agiledeveloper.com twitter: venkat_s Objective-C An Object-Oriented extension to C If you re familiar with C/C++/Java syntax, you re at

More information

Lecture 18-19 Data Types and Types of a Language

Lecture 18-19 Data Types and Types of a Language Lecture 18-19 Data Types and Types of a Language April 29, 2014 Data Types and Types of a Language Data, Data Types and Types Type: Generalities Type Systems and Type Safety Type Equivalence, Coercion

More information

Praktikum Entwicklung von Mediensystemen mit

Praktikum Entwicklung von Mediensystemen mit Praktikum Entwicklung von Mediensystemen mit Wintersemester 2013/2014 Christian Weiß, Dr. Alexander De Luca Today Organization Introduction to ios programming Hello World Assignment 1 2 Organization 6

More information

Objective-C Internals

Objective-C Internals Objective-C Internals André Pang Realmac Software Nice license plate, eh? 1 In this talk, we peek under the hood and have a look at Objective-C s engine: how objects are represented in memory, and how

More information

C++FA 5.1 PRACTICE MID-TERM EXAM

C++FA 5.1 PRACTICE MID-TERM EXAM C++FA 5.1 PRACTICE MID-TERM EXAM This practicemid-term exam covers sections C++FA 1.1 through C++FA 1.4 of C++ with Financial Applications by Ben Van Vliet, available at www.benvanvliet.net. 1.) A pointer

More information

Objective-C and Cocoa User Guide and Reference Manual. Version 5.0

Objective-C and Cocoa User Guide and Reference Manual. Version 5.0 Objective-C and Cocoa User Guide and Reference Manual Version 5.0 Copyright and Trademarks LispWorks Objective-C and Cocoa Interface User Guide and Reference Manual Version 5.0 March 2006 Copyright 2006

More information

How To Understand How A Process Works In Unix (Shell) (Shell Shell) (Program) (Unix) (For A Non-Program) And (Shell).Orgode) (Powerpoint) (Permanent) (Processes

How To Understand How A Process Works In Unix (Shell) (Shell Shell) (Program) (Unix) (For A Non-Program) And (Shell).Orgode) (Powerpoint) (Permanent) (Processes Content Introduction and History File I/O The File System Shell Programming Standard Unix Files and Configuration Processes Programs are instruction sets stored on a permanent medium (e.g. harddisc). Processes

More information

Common Lisp ObjectiveC Interface

Common Lisp ObjectiveC Interface Common Lisp ObjectiveC Interface Documentation for the Common Lisp Objective C Interface, version 1.0. Copyright c 2007 Luigi Panzeri Copying and distribution of this file, with or without modification,

More information

ios Dev Fest Research Network Operations Center Thursday, February 7, 13

ios Dev Fest Research Network Operations Center Thursday, February 7, 13 ios Dev Fest Research Network Operations Center Outline http://goo.gl/02blw Getting Started With App Development Setup Developer Environment Setup Certificates and Provisioning Deploying App To Device

More information

C Programming Review & Productivity Tools

C Programming Review & Productivity Tools Review & Productivity Tools Giovanni Agosta Piattaforme Software per la Rete Modulo 2 Outline Preliminaries 1 Preliminaries 2 Function Pointers Variadic Functions 3 Build Automation Code Versioning 4 Preliminaries

More information

CORBA Programming with TAOX11. The C++11 CORBA Implementation

CORBA Programming with TAOX11. The C++11 CORBA Implementation CORBA Programming with TAOX11 The C++11 CORBA Implementation TAOX11: the CORBA Implementation by Remedy IT TAOX11 simplifies development of CORBA based applications IDL to C++11 language mapping is easy

More information

ios Development Tutorial Nikhil Yadav CSE 40816/60816: Pervasive Health 09/09/2011

ios Development Tutorial Nikhil Yadav CSE 40816/60816: Pervasive Health 09/09/2011 ios Development Tutorial Nikhil Yadav CSE 40816/60816: Pervasive Health 09/09/2011 Healthcare iphone apps Various apps for the iphone available Diagnostic, Diet and Nutrition, Fitness, Emotional Well-being

More information

Qt Signals and Slots. Olivier Goffart. October 2013

Qt Signals and Slots. Olivier Goffart. October 2013 Qt Signals and Slots Olivier Goffart October 2013 About Me About Me QStyleSheetStyle Itemviews Animation Framework QtScript (porting to JSC and V8) QObject, moc QML Debugger Modularisation... About Me

More information

1 Abstract Data Types Information Hiding

1 Abstract Data Types Information Hiding 1 1 Abstract Data Types Information Hiding 1.1 Data Types Data types are an integral part of every programming language. ANSI-C has int, double and char to name just a few. Programmers are rarely content

More information

Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008. 1

Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008. 1 Event Driven Simulation in NS2 Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008. 1 Outline Recap: Discrete Event v.s. Time Driven Events and Handlers The Scheduler

More information

Objective-C Tutorial

Objective-C Tutorial Objective-C Tutorial OBJECTIVE-C TUTORIAL Simply Easy Learning by tutorialspoint.com tutorialspoint.com i ABOUT THE TUTORIAL Objective-c tutorial Objective-C is a general-purpose, object-oriented programming

More information

1) The postfix expression for the infix expression A+B*(C+D)/F+D*E is ABCD+*F/DE*++

1) The postfix expression for the infix expression A+B*(C+D)/F+D*E is ABCD+*F/DE*++ Answer the following 1) The postfix expression for the infix expression A+B*(C+D)/F+D*E is ABCD+*F/DE*++ 2) Which data structure is needed to convert infix notations to postfix notations? Stack 3) The

More information

Creating a Custom Class in Xcode

Creating a Custom Class in Xcode Creating a Custom Class in Xcode By Mark Mudri March 28, 2014 Executive Summary: Making an ios application requires the use of Xcode, an integrated development environment (IDE) developed by Apple. Within

More information

MA-WA1920: Enterprise iphone and ipad Programming

MA-WA1920: Enterprise iphone and ipad Programming MA-WA1920: Enterprise iphone and ipad Programming Description This 5 day iphone training course teaches application development for the ios platform. It covers iphone, ipad and ipod Touch devices. This

More information

Java from a C perspective. Plan

Java from a C perspective. Plan Java from a C perspective Cristian Bogdan 2D2052/ingint04 Plan Objectives and Book Packages and Classes Types and memory allocation Syntax and C-like Statements Object Orientation (minimal intro) Exceptions,

More information

Stack Allocation. Run-Time Data Structures. Static Structures

Stack Allocation. Run-Time Data Structures. Static Structures Run-Time Data Structures Stack Allocation Static Structures For static structures, a fixed address is used throughout execution. This is the oldest and simplest memory organization. In current compilers,

More information

Lecture 11 Doubly Linked Lists & Array of Linked Lists. Doubly Linked Lists

Lecture 11 Doubly Linked Lists & Array of Linked Lists. Doubly Linked Lists Lecture 11 Doubly Linked Lists & Array of Linked Lists In this lecture Doubly linked lists Array of Linked Lists Creating an Array of Linked Lists Representing a Sparse Matrix Defining a Node for a Sparse

More information

Object Oriented Software Design II

Object Oriented Software Design II Object Oriented Software Design II Introduction to C++ Giuseppe Lipari http://retis.sssup.it/~lipari Scuola Superiore Sant Anna Pisa February 20, 2012 G. Lipari (Scuola Superiore Sant Anna) C++ Intro February

More information

Specific Simple Network Management Tools

Specific Simple Network Management Tools Specific Simple Network Management Tools Jürgen Schönwälder University of Osnabrück Albrechtstr. 28 49069 Osnabrück, Germany Tel.: +49 541 969 2483 Email: Web:

More information

Tutorial on C Language Programming

Tutorial on C Language Programming Tutorial on C Language Programming Teodor Rus rus@cs.uiowa.edu The University of Iowa, Department of Computer Science Introduction to System Software p.1/64 Tutorial on C programming C program structure:

More information

Software Vulnerabilities

Software Vulnerabilities Software Vulnerabilities -- stack overflow Code based security Code based security discusses typical vulnerabilities made by programmers that can be exploited by miscreants Implementing safe software in

More information

Pentesting ios Apps Runtime Analysis and Manipulation. Andreas Kurtz

Pentesting ios Apps Runtime Analysis and Manipulation. Andreas Kurtz Pentesting ios Apps Runtime Analysis and Manipulation Andreas Kurtz About PhD candidate at the Security Research Group, Department of Computer Science, University of Erlangen-Nuremberg Security of mobile

More information

CSI 402 Lecture 13 (Unix Process Related System Calls) 13 1 / 17

CSI 402 Lecture 13 (Unix Process Related System Calls) 13 1 / 17 CSI 402 Lecture 13 (Unix Process Related System Calls) 13 1 / 17 System Calls for Processes Ref: Process: Chapter 5 of [HGS]. A program in execution. Several processes are executed concurrently by the

More information

How To Port A Program To Dynamic C (C) (C-Based) (Program) (For A Non Portable Program) (Un Portable) (Permanent) (Non Portable) C-Based (Programs) (Powerpoint)

How To Port A Program To Dynamic C (C) (C-Based) (Program) (For A Non Portable Program) (Un Portable) (Permanent) (Non Portable) C-Based (Programs) (Powerpoint) TN203 Porting a Program to Dynamic C Introduction Dynamic C has a number of improvements and differences compared to many other C compiler systems. This application note gives instructions and suggestions

More information

Object Oriented Programming and the Objective-C Programming Language 1.0. (Retired Document)

Object Oriented Programming and the Objective-C Programming Language 1.0. (Retired Document) Object Oriented Programming and the Objective-C Programming Language 1.0 (Retired Document) Contents Introduction to The Objective-C Programming Language 1.0 7 Who Should Read This Document 7 Organization

More information

C++ Overloading, Constructors, Assignment operator

C++ Overloading, Constructors, Assignment operator C++ Overloading, Constructors, Assignment operator 1 Overloading Before looking at the initialization of objects in C++ with constructors, we need to understand what function overloading is In C, two functions

More information

Using Objective-C from Clozure CL. R. Matthew Emerson rme@clozure.com

Using Objective-C from Clozure CL. R. Matthew Emerson rme@clozure.com Using Objective-C from Clozure CL R. Matthew Emerson rme@clozure.com Messaging id dict =... [dict addobject:@"tang" forkey:@"beverage"]; printf("%d\n", [dict count]); receiver message Messaging id dict

More information

Efficient Cross-Platform Method Dispatching for Interpreted Languages

Efficient Cross-Platform Method Dispatching for Interpreted Languages Efficient Cross-Platform Method Dispatching for Interpreted Languages Andrew Weinrich 1 Introduction 2007-12-18 2 Adding Methods and Classes to the Objective-C Runtime Most work on modern compilers is

More information

From C++ to Objective-C

From C++ to Objective-C From C++ to Objective-C version 2.1 en Pierre Chatelier e-mail: pierre.chatelier@club-internet.fr Copyright c 2005, 2006, 2007, 2008, 2009 Pierre Chatelier English adaptation : Aaron Vegh Document revisions

More information

Networks and Protocols Course: 320301 International University Bremen Date: 2004-11-24 Dr. Jürgen Schönwälder Deadline: 2004-12-03.

Networks and Protocols Course: 320301 International University Bremen Date: 2004-11-24 Dr. Jürgen Schönwälder Deadline: 2004-12-03. Networks and Protocols Course: 320301 International University Bremen Date: 2004-11-24 Dr. Jürgen Schönwälder Deadline: 2004-12-03 Problem Sheet #10 Problem 10.1: finger rpc server and client implementation

More information

C Dynamic Data Structures. University of Texas at Austin CS310H - Computer Organization Spring 2010 Don Fussell

C Dynamic Data Structures. University of Texas at Austin CS310H - Computer Organization Spring 2010 Don Fussell C Dynamic Data Structures University of Texas at Austin CS310H - Computer Organization Spring 2010 Don Fussell Data Structures A data structure is a particular organization of data in memory. We want to

More information

MacRuby and HotCocoa. Dominik Dingel. Wednesday, December 21, 11

MacRuby and HotCocoa. Dominik Dingel. Wednesday, December 21, 11 MacRuby and HotCocoa Dominik Dingel Worum geht es überhaupt? Motivation Ruby MacRuby HotCocoa Motivation One size fits all? Syntax mit Zucker Ruby ist: Buzzword compliant Duck Typing Blocks OOP Mixins

More information

Praktikum Entwicklung von Mediensystemen mit ios

Praktikum Entwicklung von Mediensystemen mit ios Praktikum Entwicklung von Mediensystemen mit ios SS 2011 Michael Rohs michael.rohs@ifi.lmu.de MHCI Lab, LMU München Timeline Date Topic/Activity 5.5.2011 Introduction and Overview of the ios Platform 12.5.2011

More information

First Java Programs. V. Paúl Pauca. CSC 111D Fall, 2015. Department of Computer Science Wake Forest University. Introduction to Computer Science

First Java Programs. V. Paúl Pauca. CSC 111D Fall, 2015. Department of Computer Science Wake Forest University. Introduction to Computer Science First Java Programs V. Paúl Pauca Department of Computer Science Wake Forest University CSC 111D Fall, 2015 Hello World revisited / 8/23/15 The f i r s t o b l i g a t o r y Java program @author Paul Pauca

More information

Object Oriented Software Design II

Object Oriented Software Design II Object Oriented Software Design II Real Application Design Christian Nastasi http://retis.sssup.it/~lipari http://retis.sssup.it/~chris/cpp Scuola Superiore Sant Anna Pisa April 25, 2012 C. Nastasi (Scuola

More information

SQLITE C/C++ TUTORIAL

SQLITE C/C++ TUTORIAL http://www.tutorialspoint.com/sqlite/sqlite_c_cpp.htm SQLITE C/C++ TUTORIAL Copyright tutorialspoint.com Installation Before we start using SQLite in our C/C++ programs, we need to make sure that we have

More information

The C Programming Language course syllabus associate level

The C Programming Language course syllabus associate level TECHNOLOGIES The C Programming Language course syllabus associate level Course description The course fully covers the basics of programming in the C programming language and demonstrates fundamental programming

More information

Qt in Education. The Qt object model and the signal slot concept

Qt in Education. The Qt object model and the signal slot concept Qt in Education The Qt object model and the signal slot concept. 2010 Nokia Corporation and its Subsidiary(-ies). The enclosed Qt Educational Training Materials are provided under the Creative Commons

More information

Linux/UNIX System Programming. POSIX Shared Memory. Michael Kerrisk, man7.org c 2015. February 2015

Linux/UNIX System Programming. POSIX Shared Memory. Michael Kerrisk, man7.org c 2015. February 2015 Linux/UNIX System Programming POSIX Shared Memory Michael Kerrisk, man7.org c 2015 February 2015 Outline 22 POSIX Shared Memory 22-1 22.1 Overview 22-3 22.2 Creating and opening shared memory objects 22-10

More information

Phys4051: C Lecture 2 & 3. Comment Statements. C Data Types. Functions (Review) Comment Statements Variables & Operators Branching Instructions

Phys4051: C Lecture 2 & 3. Comment Statements. C Data Types. Functions (Review) Comment Statements Variables & Operators Branching Instructions Phys4051: C Lecture 2 & 3 Functions (Review) Comment Statements Variables & Operators Branching Instructions Comment Statements! Method 1: /* */! Method 2: // /* Single Line */ //Single Line /* This comment

More information

ios Application Security

ios Application Security Diploma Thesis Student: Email: manuel@binna.de Matriculation Number: 108004202162 Supervisor: Prof. Dr. Thorsten Holz Period: From 2010-12-06 till 2011-06-06 Embedded Malware Research Group Prof. Dr. Thorsten

More information

Implementation Aspects of OO-Languages

Implementation Aspects of OO-Languages 1 Implementation Aspects of OO-Languages Allocation of space for data members: The space for data members is laid out the same way it is done for structures in C or other languages. Specifically: The data

More information

Computer Systems II. Unix system calls. fork( ) wait( ) exit( ) How To Create New Processes? Creating and Executing Processes

Computer Systems II. Unix system calls. fork( ) wait( ) exit( ) How To Create New Processes? Creating and Executing Processes Computer Systems II Creating and Executing Processes 1 Unix system calls fork( ) wait( ) exit( ) 2 How To Create New Processes? Underlying mechanism - A process runs fork to create a child process - Parent

More information

The GenomeTools Developer s Guide

The GenomeTools Developer s Guide The GenomeTools Developer s Guide Sascha Steinbiss, Gordon Gremme and Stefan Kurtz February 4, 2013 Contents 1 Introduction 1 2 Object-oriented design 2 3 Directory structure 11 4 Public APIs 13 5 Coding

More information

Crash Dive into Python

Crash Dive into Python ECPE 170 University of the Pacific Crash Dive into Python 2 Lab Schedule Ac:vi:es Assignments Due Today Lab 11 Network Programming Due by Dec 1 st 5:00am Python Lab 12 Next Week Due by Dec 8 th 5:00am

More information

Bonus ChapteR. Objective-C

Bonus ChapteR. Objective-C Bonus ChapteR Objective-C If you want to develop native ios applications, you must learn Objective-C. For many, this is an intimidating task with a steep learning curve. Objective-C mixes a wide range

More information

Buffer Overflows. Security 2011

Buffer Overflows. Security 2011 Buffer Overflows Security 2011 Memory Organiza;on Topics Kernel organizes memory in pages Typically 4k bytes Processes operate in a Virtual Memory Space Mapped to real 4k pages Could live in RAM or be

More information

Intro to GPU computing. Spring 2015 Mark Silberstein, 048661, Technion 1

Intro to GPU computing. Spring 2015 Mark Silberstein, 048661, Technion 1 Intro to GPU computing Spring 2015 Mark Silberstein, 048661, Technion 1 Serial vs. parallel program One instruction at a time Multiple instructions in parallel Spring 2015 Mark Silberstein, 048661, Technion

More information

Keywords are identifiers having predefined meanings in C programming language. The list of keywords used in standard C are : unsigned void

Keywords are identifiers having predefined meanings in C programming language. The list of keywords used in standard C are : unsigned void 1. Explain C tokens Tokens are basic building blocks of a C program. A token is the smallest element of a C program that is meaningful to the compiler. The C compiler recognizes the following kinds of

More information

Using the Caché Objective-C Binding

Using the Caché Objective-C Binding Using the Caché Objective-C Binding Version 2014.1 25 March 2014 InterSystems Corporation 1 Memorial Drive Cambridge MA 02142 www.intersystems.com Using the Caché Objective-C Binding Caché Version 2014.1

More information

BSc (Hons) Business Information Systems, BSc (Hons) Computer Science with Network Security. & BSc. (Hons.) Software Engineering

BSc (Hons) Business Information Systems, BSc (Hons) Computer Science with Network Security. & BSc. (Hons.) Software Engineering BSc (Hons) Business Information Systems, BSc (Hons) Computer Science with Network Security & BSc. (Hons.) Software Engineering Cohort: BIS/05/FT BCNS/05/FT BSE/05/FT Examinations for 2005-2006 / Semester

More information

arrays C Programming Language - Arrays

arrays C Programming Language - Arrays arrays So far, we have been using only scalar variables scalar meaning a variable with a single value But many things require a set of related values coordinates or vectors require 3 (or 2, or 4, or more)

More information

Molecular Dynamics Simulations with Applications in Soft Matter Handout 7 Memory Diagram of a Struct

Molecular Dynamics Simulations with Applications in Soft Matter Handout 7 Memory Diagram of a Struct Dr. Martin O. Steinhauser University of Basel Graduate Lecture Spring Semester 2014 Molecular Dynamics Simulations with Applications in Soft Matter Handout 7 Memory Diagram of a Struct Friday, 7 th March

More information

Stacks. Linear data structures

Stacks. Linear data structures Stacks Linear data structures Collection of components that can be arranged as a straight line Data structure grows or shrinks as we add or remove objects ADTs provide an abstract layer for various operations

More information

Embedded Programming in C/C++: Lesson-1: Programming Elements and Programming in C

Embedded Programming in C/C++: Lesson-1: Programming Elements and Programming in C Embedded Programming in C/C++: Lesson-1: Programming Elements and Programming in C 1 An essential part of any embedded system design Programming 2 Programming in Assembly or HLL Processor and memory-sensitive

More information

Stack Overflows. Mitchell Adair

Stack Overflows. Mitchell Adair Stack Overflows Mitchell Adair Outline Why? What? There once was a VM Virtual Memory Registers Stack stack1, stack2, stack3 Resources Why? Real problem Real money Real recognition Still prevalent Very

More information

Developing Applications for ios

Developing Applications for ios Developing Applications for ios Today Introduction to Objective-C (con t) Continue showing Card Game Model with Deck, PlayingCard, PlayingCardDeck Xcode 5 Demonstration Start building the simple Card Game

More information

Lecture 22: C Programming 4 Embedded Systems

Lecture 22: C Programming 4 Embedded Systems Lecture 22: C Programming 4 Embedded Systems Today s Goals Basic C programming process Variables and constants in C Pointers to access addresses Using a High Level Language High-level languages More human

More information

Masters programmes in Computer Science and Information Systems. Object-Oriented Design and Programming. Sample module entry test xxth December 2013

Masters programmes in Computer Science and Information Systems. Object-Oriented Design and Programming. Sample module entry test xxth December 2013 Masters programmes in Computer Science and Information Systems Object-Oriented Design and Programming Sample module entry test xxth December 2013 This sample paper has more questions than the real paper

More information

Object Oriented Software Design II

Object Oriented Software Design II Object Oriented Software Design II C++ intro Giuseppe Lipari http://retis.sssup.it/~lipari Scuola Superiore Sant Anna Pisa February 26, 2012 G. Lipari (Scuola Superiore Sant Anna) C++ Intro February 26,

More information

Fortify on Demand Security Review. Fortify Open Review

Fortify on Demand Security Review. Fortify Open Review Fortify on Demand Security Review Company: Project: Version: Latest Analysis: Fortify Open Review GNU m4 1.4.17 4/17/2015 12:16:24 PM Executive Summary Company: Project: Version: Static Analysis Date:

More information

Objective C and iphone App

Objective C and iphone App Objective C and iphone App 6 Months Course Description: Understanding the Objective-C programming language is critical to becoming a successful iphone developer. This class is designed to teach you a solid

More information

Sources: On the Web: Slides will be available on:

Sources: On the Web: Slides will be available on: C programming Introduction The basics of algorithms Structure of a C code, compilation step Constant, variable type, variable scope Expression and operators: assignment, arithmetic operators, comparison,

More information

C++ INTERVIEW QUESTIONS

C++ INTERVIEW QUESTIONS C++ INTERVIEW QUESTIONS http://www.tutorialspoint.com/cplusplus/cpp_interview_questions.htm Copyright tutorialspoint.com Dear readers, these C++ Interview Questions have been designed specially to get

More information

Shared Memory Segments and POSIX Semaphores 1

Shared Memory Segments and POSIX Semaphores 1 Shared Memory Segments and POSIX Semaphores 1 Alex Delis delis -at+ pitt.edu October 2012 1 Acknowledgements to Prof. T. Stamatopoulos, M. Avidor, Prof. A. Deligiannakis, S. Evangelatos, Dr. V. Kanitkar

More information

7th Marathon of Parallel Programming WSCAD-SSC/SBAC-PAD-2012

7th Marathon of Parallel Programming WSCAD-SSC/SBAC-PAD-2012 7th Marathon of Parallel Programming WSCAD-SSC/SBAC-PAD-2012 October 17 th, 2012. Rules For all problems, read carefully the input and output session. For all problems, a sequential implementation is given,

More information

Software Development Tools for Embedded Systems. Hesen Zhang

Software Development Tools for Embedded Systems. Hesen Zhang Software Development Tools for Embedded Systems Hesen Zhang What Are Tools? a handy tool makes a handy man What Are Software Development Tools? Outline Debug tools GDB practice Debug Agent Design Debugging

More information

Introduction to iphone Development

Introduction to iphone Development Introduction to iphone Development Introduction to iphone Development Contents Task 1 2 3 4 Application Runtime Core Architecture and Life-cycles What s in a bundle? The resources in an app bundle Customizing

More information

Output: 12 18 30 72 90 87. struct treenode{ int data; struct treenode *left, *right; } struct treenode *tree_ptr;

Output: 12 18 30 72 90 87. struct treenode{ int data; struct treenode *left, *right; } struct treenode *tree_ptr; 50 20 70 10 30 69 90 14 35 68 85 98 16 22 60 34 (c) Execute the algorithm shown below using the tree shown above. Show the exact output produced by the algorithm. Assume that the initial call is: prob3(root)

More information

An Incomplete C++ Primer. University of Wyoming MA 5310

An Incomplete C++ Primer. University of Wyoming MA 5310 An Incomplete C++ Primer University of Wyoming MA 5310 Professor Craig C. Douglas http://www.mgnet.org/~douglas/classes/na-sc/notes/c++primer.pdf C++ is a legacy programming language, as is other languages

More information

Embedded Systems. Review of ANSI C Topics. A Review of ANSI C and Considerations for Embedded C Programming. Basic features of C

Embedded Systems. Review of ANSI C Topics. A Review of ANSI C and Considerations for Embedded C Programming. Basic features of C Embedded Systems A Review of ANSI C and Considerations for Embedded C Programming Dr. Jeff Jackson Lecture 2-1 Review of ANSI C Topics Basic features of C C fundamentals Basic data types Expressions Selection

More information

Lecture 12 Doubly Linked Lists (with Recursion)

Lecture 12 Doubly Linked Lists (with Recursion) Lecture 12 Doubly Linked Lists (with Recursion) In this lecture Introduction to Doubly linked lists What is recursion? Designing a node of a DLL Recursion and Linked Lists o Finding a node in a LL (recursively)

More information

What is COM/DCOM. Distributed Object Systems 4 COM/DCOM. COM vs Corba 1. COM vs. Corba 2. Multiple inheritance vs multiple interfaces

What is COM/DCOM. Distributed Object Systems 4 COM/DCOM. COM vs Corba 1. COM vs. Corba 2. Multiple inheritance vs multiple interfaces Distributed Object Systems 4 COM/DCOM Piet van Oostrum Sept 18, 2008 What is COM/DCOM Component Object Model Components (distributed objects) à la Microsoft Mainly on Windows platforms Is used in large

More information

Tail call elimination. Michel Schinz

Tail call elimination. Michel Schinz Tail call elimination Michel Schinz Tail calls and their elimination Loops in functional languages Several functional programming languages do not have an explicit looping statement. Instead, programmers

More information

Comp151. Definitions & Declarations

Comp151. Definitions & Declarations Comp151 Definitions & Declarations Example: Definition /* reverse_printcpp */ #include #include using namespace std; int global_var = 23; // global variable definition void reverse_print(const

More information

ASCII Encoding. The char Type. Manipulating Characters. Manipulating Characters

ASCII Encoding. The char Type. Manipulating Characters. Manipulating Characters The char Type ASCII Encoding The C char type stores small integers. It is usually 8 bits. char variables guaranteed to be able to hold integers 0.. +127. char variables mostly used to store characters

More information

Debugging with TotalView

Debugging with TotalView Tim Cramer 17.03.2015 IT Center der RWTH Aachen University Why to use a Debugger? If your program goes haywire, you may... ( wand (... buy a magic... read the source code again and again and...... enrich

More information

Assignment I Walkthrough

Assignment I Walkthrough Assignment I Walkthrough Objective Reproduce the demonstration (building a calculator) given in class. Goals 1. Downloading and installing the ios4 SDK. 2. Creating a new project in Xcode. 3. Defining

More information

Lecture 3. Arrays. Name of array. c[0] c[1] c[2] c[3] c[4] c[5] c[6] c[7] c[8] c[9] c[10] c[11] Position number of the element within array c

Lecture 3. Arrays. Name of array. c[0] c[1] c[2] c[3] c[4] c[5] c[6] c[7] c[8] c[9] c[10] c[11] Position number of the element within array c Lecture 3 Data structures arrays structs C strings: array of chars Arrays as parameters to functions Multiple subscripted arrays Structs as parameters to functions Default arguments Inline functions Redirection

More information

5 Arrays and Pointers

5 Arrays and Pointers 5 Arrays and Pointers 5.1 One-dimensional arrays Arrays offer a convenient way to store and access blocks of data. Think of arrays as a sequential list that offers indexed access. For example, a list of

More information

Fuzzing Apache OpenOffice

Fuzzing Apache OpenOffice Fuzzing Apache OpenOffice An Approach to Automated Black-box Security Testing Rob Weir April 7th, 2014 Who is Rob? 1) Rob Weir from Westford Massachusetts 2) rob@robweir.com, @rcweir, http://www.linkedin.com/in/rcweir

More information

PES Institute of Technology-BSC QUESTION BANK

PES Institute of Technology-BSC QUESTION BANK PES Institute of Technology-BSC Faculty: Mrs. R.Bharathi CS35: Data Structures Using C QUESTION BANK UNIT I -BASIC CONCEPTS 1. What is an ADT? Briefly explain the categories that classify the functions

More information

Performance Improvement In Java Application

Performance Improvement In Java Application Performance Improvement In Java Application Megha Fulfagar Accenture Delivery Center for Technology in India Accenture, its logo, and High Performance Delivered are trademarks of Accenture. Agenda Performance

More information

Praktikum Entwicklung von Mediensystemen mit ios

Praktikum Entwicklung von Mediensystemen mit ios Praktikum Entwicklung von Mediensystemen mit ios SS 2011 Michael Rohs michael.rohs@ifi.lmu.de MHCI Lab, LMU München Today Schedule Organization Introduction to ios Exercise 1 2 Schedule Phase 1 Individual

More information

C Interview Questions

C Interview Questions http://techpreparation.com C Interview Questions And Answers 2008 V i s i t T e c h P r e p a r a t i o n. c o m f o r m o r e i n t e r v i e w q u e s t i o n s a n d a n s w e r s C Interview Questions

More information

Illustration 1: Diagram of program function and data flow

Illustration 1: Diagram of program function and data flow The contract called for creation of a random access database of plumbing shops within the near perimeter of FIU Engineering school. The database features a rating number from 1-10 to offer a guideline

More information

Adapter, Bridge, and Façade

Adapter, Bridge, and Façade CHAPTER 5 Adapter, Bridge, and Façade Objectives The objectives of this chapter are to identify the following: Complete the exercise in class design. Introduce the adapter, bridge, and façade patterns.

More information

Everything You Need to Know to Become an Objective-C Guru. Learn Objective-C. on the Mac. Mark Dalrymple Scott Knaster

Everything You Need to Know to Become an Objective-C Guru. Learn Objective-C. on the Mac. Mark Dalrymple Scott Knaster Everything You Need to Know to Become an Objective-C Guru Learn Objective-C on the Mac Mark Dalrymple Scott Knaster Learn Objective-C on the Mac Penciled by MARK DALRYMPLE Inked by SCOTT KNASTER Learn

More information

Cataloguing and Avoiding the Buffer Overflow Attacks in Network Operating Systems

Cataloguing and Avoiding the Buffer Overflow Attacks in Network Operating Systems Abstract: Cataloguing and Avoiding the Buffer Overflow Attacks in Network Operating Systems *P.VADIVELMURUGAN #K.ALAGARSAMY *Research Scholar, Department of Computer Center, Madurai Kamaraj University,

More information

Partitioning under the hood in MySQL 5.5

Partitioning under the hood in MySQL 5.5 Partitioning under the hood in MySQL 5.5 Mattias Jonsson, Partitioning developer Mikael Ronström, Partitioning author Who are we? Mikael is a founder of the technology behind NDB

More information